[FFmpeg-devel] [PATCH] dv codec : allow selecting between 720p60 and 720p50 profiles based on framerate

Michael Niedermayer michaelni at gmx.at
Wed Dec 3 13:46:15 CET 2014


On Wed, Dec 03, 2014 at 12:48:46PM +0100, Steve Jiekak wrote:
> 
> Signed-off-by: Steve Jiekak <devaureshy at gmail.com>
> ---
>  libavcodec/dv_profile.c |   14 +++++++++++---
>  libavcodec/dv_profile.h |    2 +-
>  libavcodec/dvenc.c      |    2 +-
>  libavformat/dv.c        |    2 +-
>  libavformat/dvenc.c     |    3 ++-
>  5 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/dv_profile.c b/libavcodec/dv_profile.c
> index b301cbf..5c4e23c 100644
> --- a/libavcodec/dv_profile.c
> +++ b/libavcodec/dv_profile.c
> @@ -312,18 +312,26 @@ const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
>  }
>  
>  const AVDVProfile *av_dv_codec_profile(int width, int height,
> -                                       enum AVPixelFormat pix_fmt)
> +                                       enum AVPixelFormat pix_fmt,
> +                                       AVRational time_base)
>  {
> +    const AVDVProfile *p = NULL;
>  #if CONFIG_DVPROFILE
>      int i;
> +    /* frame rate is necessary to select between 720p50 and 720p60 profiles */
> +    int validtimebase = time_base.num == 0 || time_base.den == 0;
>  
>      for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
>          if (height  == dv_profiles[i].height  &&
>              pix_fmt == dv_profiles[i].pix_fmt &&
>              width   == dv_profiles[i].width)
> -            return &dv_profiles[i];
> +        {
> +            p = &dv_profiles[i];
> +            if( !validtimebase || av_div_q(p->time_base, time_base).num == 1 )

is av_div_q() what you meant to use or av_cmp_q() ?


> +                return p;
> +        }
>  #endif
>  
> -    return NULL;
> +    return p;
>  }
>  
> diff --git a/libavcodec/dv_profile.h b/libavcodec/dv_profile.h
> index d4437c9..c595f21 100644
> --- a/libavcodec/dv_profile.h
> +++ b/libavcodec/dv_profile.h
> @@ -81,6 +81,6 @@ const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
>  /**
>   * Get a DV profile for the provided stream parameters.
>   */
> -const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt);
> +const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt, AVRational time_base);

you cannot change public API, you can add new public API if needed
though

make sure you bump minor version and update APIChanges accordingly
though

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141203/9f6528bd/attachment.asc>


More information about the ffmpeg-devel mailing list