On 28/02/12 00:56, Justin Ruggles wrote:
> This is a utility function for the user to get the frame duration based on
> the codec id, frame size in bytes, and various AVCodecContext parameters.
> ---
>  doc/APIchanges       |    3 +
>  libavcodec/avcodec.h |   10 ++++
>  libavcodec/utils.c   |  142 
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 155 insertions(+), 0 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index f10aa77..248ae87 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -13,6 +13,9 @@ libavutil:   2011-04-18
>  API changes, most recent first:
>  
>  2012-xx-xx - xxxxxxx - lavc 54.x.x
> +  Add av_get_audio_frame_duration()
> +
> +2012-xx-xx - xxxxxxx - lavc 54.x.x
>    Add av_get_exact_bits_per_sample()
>  
>  2012-02-25 - c9bca80 - lavu 51.24.0 - error.h
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index f2f21cb..f4b6f40 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3891,6 +3891,16 @@ int av_get_bits_per_sample(enum CodecID codec_id);
>   */
>  int av_get_exact_bits_per_sample(enum CodecID codec_id);
>  
> +/**
> + * Return audio frame duration.
> + *
> + * @param avctx        codec context
> + * @param frame_bytes  size of the frame, or 0 if unknown
> + * @return             frame duration, in samples, if known. 0 if not able to
> + *                     determine.
> + */
> +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes);
> +
>  /* frame parsing */
>  typedef struct AVCodecParserContext {
>      void *priv_data;
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 574d4cd..6c0521c 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1729,6 +1729,148 @@ int av_get_bits_per_sample(enum CodecID codec_id)
>      }
>  }
>  
> +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes)
> +{

I wonder if having a specific per codec function with an override would
be tidier.

lu

-- 

Luca Barbato
Gentoo/linux
http://dev.gentoo.org/~lu_zero

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to