[FFmpeg-devel] [PATCH 3/9] avformat/matroskaenc: Use smaller types

James Almer jamrial at gmail.com
Tue Oct 22 02:43:57 EEST 2019


On 10/15/2019 8:17 AM, Andreas Rheinhardt wrote:
> Several members of structures denote offsets inside dynamic buffers and
> therefore always fit into an int. So it is unnecessary to use an int64_t
> for them.

True, but they are set using avio_tell() and then passed to avio_seek(),
both of which expect int64_t. This change may result in some pedantic
compilers warning about that conversion.

I don't really see the benefit in doing his. The struct size gains are
minimal.

> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  libavformat/matroskaenc.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 63ad6e47b4..e024c58c84 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -95,11 +95,11 @@ typedef struct mkv_track {
>      int             write_dts;
>      int             has_cue;
>      int             sample_rate;
> -    int64_t         sample_rate_offset;
> +    int             sample_rate_offset;
>      int64_t         last_timestamp;
>      int64_t         duration;
> -    int64_t         duration_offset;
> -    int64_t         codecpriv_offset;
> +    int             duration_offset;
> +    int             codecpriv_offset;
>      int64_t         ts_offset;
>  } mkv_track;
>  
> @@ -134,7 +134,7 @@ typedef struct MatroskaMuxContext {
>      AVIOContext     *cluster_bc;
>      int64_t         cluster_pos;        ///< file offset of the current cluster
>      int64_t         cluster_pts;
> -    int64_t         duration_offset;
> +    int             duration_offset;
>      int64_t         duration;
>      mkv_seekhead    *seekhead;
>      mkv_cues        *cues;
> 



More information about the ffmpeg-devel mailing list