problem in the function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

problem in the function

Cheng Tao(TRS)

--

hi,
        i found a problem when decoding a video file with the format of
(*.mpg), and this is my code:

        AVPacket packet;
        int frameFinished = 0;
        int index = 0;
        int succeed = 0;
        while(av_read_frame(pFormatCtx,&packet)>=0)
        {
                if(packet.stream_index == videoStream)
                {
                        if(++index>300) break;                  
                        avcodec_decode_video(pCodecCtx, pFrame,
&frameFinished,packet.data,
packet.size);
                        if(frameFinished)
                        {
                                succeed++;
                        }
                }
        }
        printf("\n%d\t%d\n",index,succeed);

the result is : 301 ,299

however, when adding a av_seek_frame(),like this:

        av_seek_frame(pFormatCtx,-1,AV_TIME_BASE *
        10,AVSEEK_FLAG_BACKWARD);

        AVPacket packet;
        int frameFinished = 0;
        int index = 0;
        int succeed = 0;
        while(av_read_frame(pFormatCtx,&packet)>=0)
        {
                if(packet.stream_index == videoStream)
                {
                        if(++index>300) break;                  
                        avcodec_decode_video(pCodecCtx, pFrame,
&frameFinished,packet.data,
packet.size);
                        if(frameFinished)
                        {
                                succeed++;
                        }
                }
        }
        printf("\n%d\t%d\n",index,succeed);

the result turn to : 301  0

anybody tell me why? is there any problem in the function
av_seek_frame()?

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user