Dont try to compute AVPacket duration for possibly interlaced video codecs
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Apr 2010 22:39:39 +0000 (22:39 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 9 Apr 2010 22:39:39 +0000 (22:39 +0000)
when no parser is available.
This partly fixes the frame rate misdetection in issue1756.

Originally committed as revision 22824 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/utils.c

index aa779ed..eaa9126 100644 (file)
@@ -739,6 +739,11 @@ static void compute_frame_duration(int *pnum, int *pden, AVStream *st,
             if (pc && pc->repeat_pict) {
                 *pnum = (*pnum) * (1 + pc->repeat_pict);
             }
+            //If this codec can be interlaced or progressive then we need a parser to compute duration of a packet
+            //Thus if we have no parser in such case leave duration undefined.
+            if(st->codec->ticks_per_frame>1 && !pc){
+                *pnum = *pden = 0;
+            }
         }
         break;
     case AVMEDIA_TYPE_AUDIO: