[FFmpeg-devel] [PATCH 1/2] add CODEC_FLAG2_TIMEBASE_RELIABLE

Måns Rullgård mans
Wed Jan 26 19:01:43 CET 2011


"Ronald S. Bultje" <rsbultje at gmail.com> writes:

> Hi,
>
> On Tue, Jan 25, 2011 at 5:56 AM, Peter Ross <pross at xvid.org> wrote:
>> ---
>> ?libavcodec/avcodec.h | ? ?1 +
>> ?libavformat/utils.c ?| ? ?2 ++
>> ?2 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>> index 601f8ed..c1ad76f 100644
>> --- a/libavcodec/avcodec.h
>> +++ b/libavcodec/avcodec.h
>> @@ -667,6 +667,7 @@ typedef struct RcOverride{
>> ?#define CODEC_FLAG2_PSY ? ? ? ? ? 0x00080000 ///< Use psycho visual optimizations.
>> ?#define CODEC_FLAG2_SSIM ? ? ? ? ?0x00100000 ///< Compute SSIM during encoding, error[] values are undefined.
>> ?#define CODEC_FLAG2_INTRA_REFRESH 0x00200000 ///< Use periodic insertion of intra blocks instead of keyframes.
>> +#define CODEC_FLAG2_TIMEBASE_RELIABLE 0x00400000 ///< Consider reported timebase values to be reliable
>>
>> ?/* Unsupported options :
>> ?* ? ? ? ? ? ? ?Syntax Arithmetic coding (SAC)
>> diff --git a/libavformat/utils.c b/libavformat/utils.c
>> index c208bd9..c5259f2 100644
>> --- a/libavformat/utils.c
>> +++ b/libavformat/utils.c
>> @@ -2175,6 +2175,8 @@ static int get_std_framerate(int i){
>> ?* And there are "variable" fps files this needs to detect as well.
>> ?*/
>> ?static int tb_unreliable(AVCodecContext *c){
>> + ? ?if ((c->flags2 & CODEC_FLAG2_TIMEBASE_RELIABLE))
>> + ? ? ? ?return 0;
>> ? ? if( ? c->time_base.den >= 101L*c->time_base.num
>> ? ? ? ?|| c->time_base.den < ? ?5L*c->time_base.num
>> ?/* ? ? ? || c->codec_tag == AV_RL32("DIVX")
>> --
>> 1.7.1
>
> I guess this is a workaround for this function being wrong? What's
> wrong? Can we fix it?

IMO time bases should be considered correct by default.  If anything,
we should add some kind of flag to the demuxers returning guesses
rather than hard data.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list