[FFmpeg-devel] [PATCH 2/3] avcodec/codec2utils: move codec2_version_from_extradata to lavf

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Tue Oct 27 17:47:26 EET 2020


James Almer:
> It's only used by the codec2 demuxers
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/codec2utils.h | 5 -----
>  libavformat/codec2.c     | 5 +++++
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/libavcodec/codec2utils.h b/libavcodec/codec2utils.h
> index e9b1f84d84..2ee7a592a1 100644
> --- a/libavcodec/codec2utils.h
> +++ b/libavcodec/codec2utils.h
> @@ -70,11 +70,6 @@ static inline void codec2_make_extradata(uint8_t *ptr, int mode) {
>      ptr[3] = 0;     //flags
>  }
>  
> -//Returns version as a 16-bit value. 0.8 -> 0x0008
> -static inline uint16_t codec2_version_from_extradata(uint8_t *ptr) {
> -    return (ptr[0] << 8) + ptr[1];
> -}
> -
>  static inline uint8_t codec2_mode_from_extradata(uint8_t *ptr) {
>      return ptr[2];
>  }
> diff --git a/libavformat/codec2.c b/libavformat/codec2.c
> index 1f7f16a106..edd450716f 100644
> --- a/libavformat/codec2.c
> +++ b/libavformat/codec2.c
> @@ -86,6 +86,11 @@ static int codec2_read_header_common(AVFormatContext *s, AVStream *st)
>      return 0;
>  }
>  
> +//Returns version as a 16-bit value. 0.8 -> 0x0008
> +static uint16_t codec2_version_from_extradata(uint8_t *ptr) {
> +    return (ptr[0] << 8) + ptr[1];
> +}
> +
>  static int codec2_read_header(AVFormatContext *s)
>  {
>      AVStream *st = avformat_new_stream(s, NULL);
> 
Why not just remove this and directly use AV_RB16()?

- Andreas


More information about the ffmpeg-devel mailing list