Miguel Angel Arcos wrote:
> 
> 1 - *av_guess_format* asking with "video/mp4" and "h264" or "mpeg" like
> output_example.c. In all cases the function returns NULL.
> 2 - *ByteIOContext* but when I arrive to the function av_open_input_stream
> this crash with an *Access Violation*. I think I init in a good way the
> ByteIOContext and AVFormatContext but I'm not sure about the
> initialitation
> of AVInputFormat and the AVFormatParameters. 
> 

Here is my function. It works.

int thread_record::init_input(void)
{AVFormatParameters ap;
 int r;

        input=avformat_alloc_context(); //it is a class member, declared as
AVFormatContext *input;
        if(!input) {
                return 1;
        }
        input->iformat=av_find_input_format(m_iformat.c_str()); /* this string 
must
be exact format 
name. ffmpeg -formats will give you a list of supported formats*/
        if(m_iformat=="rawvideo")
                m_raw=1;

        bio_buffer=(unsigned char *)av_malloc(bio_buffer_size);
        if(!bio_buffer) {
                av_freep(&input);
                return 1;
        }

input->pb=av_alloc_put_byte(bio_buffer,bio_buffer_size,0,this,read_packets,NULL,NULL);
        if(!input->pb) {
                av_freep(&input);
                av_freep(&bio_buffer);
                return 1;
        }
        
        input->pb->is_streamed=1;

        input->flags|=AVFMT_NOFILE|AVFMT_FLAG_IGNIDX;
        input->flags&=~AVFMT_FLAG_GENPTS;
        input->max_index_size=1024*50;
        input->max_picture_buffer=1024*100;

        //input->debug|=FF_FDEBUG_TS;

        memset(&ap, 0, sizeof(ap));
        ap.prealloced_context=1;

        r=av_open_input_stream(&input,input->pb,"stream",input->iformat,&ap);
        _OutputDebugString("av_open_input_stream, r=%d\n",r);

        if(r) {
                av_freep(&bio_buffer);
                av_free(&(input->pb));
                av_close_input_stream(input);
                input=NULL;
                return 1;
        }

        if(!input->nb_streams){
                av_free(bio_buffer);
                av_free(input->pb);
                av_close_input_stream(input);
                input=NULL;
                return 2;
        }
        
        if(m_raw){
                input->streams[0]->codec->width=m_width;
                input->streams[0]->codec->height=m_height;
                input->streams[0]->codec->pix_fmt=(PixelFormat)m_pixfmt;
        }

        r=av_find_stream_info(input);
        if(r<0) {
                av_freep(&bio_buffer);
                av_freep(&(input->pb));
                av_close_input_stream(input);
                input=NULL;
                return 2;
        }
        
        return 0;
}



Miguel Angel Arcos wrote:
> 
> Then maybe I probably do wrong
> anything and make my call to the av_open_input_stream crash.
> 
Try adding some printf()' s to the ffmpeg sources and relink your
application with them.
This will give you an overview of what' s happening.


Miguel Angel Arcos wrote:
> 
> have this: -9223372036854775808.
> 
this is AV_NOPTS_VALUE


Miguel Angel Arcos wrote:
> 
> PD: Which NAL Unit of H264 contain the information to know if the data is
> I-frame?? Any knows? I parse all the packets and I don't know where is
> that
> information.
> 
Here is the link to the old messages in archives:
http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2009-February/061496.html
Try to find traces and use this code
-- 
View this message in context: 
http://n4.nabble.com/H264-decoding-tp1468742p1474279.html
Sent from the libav-users mailing list archive at Nabble.com.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to