[FFmpeg-devel] [PATCH 20/25] avformat: Avoid allocation for AVFormatInternal

James Almer jamrial at gmail.com
Fri Aug 27 19:34:44 EEST 2021


On 8/27/2021 11:27 AM, Andreas Rheinhardt wrote:
> diff --git a/libavformat/internal.h b/libavformat/internal.h
> index 4fc1154b9d..813032870f 100644
> --- a/libavformat/internal.h
> +++ b/libavformat/internal.h
> @@ -69,7 +69,12 @@ typedef struct FFFrac {
>   } FFFrac;
>   
>   
> -struct AVFormatInternal {
> +typedef struct FFFormatContext {

Why not just keep the AVFormatInternal name?

[...]

> diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
> index 5afbae2147..c80ea5e216 100644
> --- a/libavformat/oggdec.c
> +++ b/libavformat/oggdec.c
> @@ -174,7 +174,7 @@ static int ogg_reset(AVFormatContext *s)
>          os->segp       = 0;
>          os->incomplete = 0;
>          os->got_data = 0;
> -        if (start_pos <= s->internal->data_offset) {
> +        if (start_pos <= ffformatcontext(s)->data_offset) {

I'd prefer if you use dedicated pointers here and everywhere else you 
replace s->internal, like you did in patch 19, and get rid of 
ffformatcontext().

>              os->lastpts = 0;
>          }
>          os->start_trimming = 0;



More information about the ffmpeg-devel mailing list