[FFmpeg-devel] [PATCH]lavf:Constify AVOutputFormat pointer
Carl Eugen Hoyos
ceffmpeg at gmail.com
Thu Feb 14 22:54:34 EET 2019
2019-02-09 15:46 GMT+01:00, Carl Eugen Hoyos <ceffmpeg at gmail.com>:
> 2019-02-09 15:44 GMT+01:00, Carl Eugen Hoyos <ceffmpeg at gmail.com>:
>> 2019-02-09 15:42 GMT+01:00, James Almer <jamrial at gmail.com>:
>>> On 2/9/2019 11:23 AM, Carl Eugen Hoyos wrote:
>>>> Hi!
>>>>
>>>> Attached patch is supposed to constify all occurrences of
>>>> AVOutputFormat in libavformat.
>>>>
>>>> Please comment, Carl Eugen
>>>>
>>>>
>>>> 0001-lavf-Constify-AVOutputFormat-pointer.patch
>>>>
>>>> From ba32f41824df07b7a6cb45964ef912c5fc05b276 Mon Sep 17 00:00:00 2001
>>>> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
>>>> Date: Sat, 9 Feb 2019 15:21:17 +0100
>>>> Subject: [PATCH] lavf: Constify AVOutputFormat pointer.
>>>>
>>>> ---
>>>> libavformat/allformats.c | 4 ++++
>>>> libavformat/avformat.h | 15 ++++++++++-----
>>>> libavformat/fifo.c | 4 ++--
>>>> libavformat/format.c | 6 +++---
>>>> libavformat/hdsenc.c | 2 +-
>>>> libavformat/hlsenc.c | 4 ++--
>>>> libavformat/mux.c | 4 ++--
>>>> libavformat/rtp.c | 2 +-
>>>> libavformat/rtpenc_chain.c | 2 +-
>>>> libavformat/rtpenc_mpegts.c | 4 ++--
>>>> libavformat/segment.c | 2 +-
>>>> libavformat/smoothstreamingenc.c | 2 +-
>>>> libavformat/version.h | 3 +++
>>>> libavformat/webm_chunk.c | 2 +-
>>>> 14 files changed, 34 insertions(+), 22 deletions(-)
>>>>
>>>> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
>>>> index 0684498..64d0f02 100644
>>>> --- a/libavformat/allformats.c
>>>> +++ b/libavformat/allformats.c
>>>> @@ -595,7 +595,11 @@ AVOutputFormat *av_oformat_next(const
>>>> AVOutputFormat
>>>> *f)
>>>> ff_thread_once(&av_format_next_init, av_format_init_next);
>>>>
>>>> if (f)
>>>> +#if FF_API_AVIOFORMAT
>>>> + return (AVOutputFormat *) f->next;
>>>> +#else
>>>> return f->next;
>>>> +#endif
>>>> else {
>>>> void *opaque = NULL;
>>>> return (AVOutputFormat *)av_muxer_iterate(&opaque);
>>>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>>>> index fdaffa5..52922c0 100644
>>>> --- a/libavformat/avformat.h
>>>> +++ b/libavformat/avformat.h
>>>> @@ -532,7 +532,12 @@ typedef struct AVOutputFormat {
>>>> * New public fields should be added right above.
>>>> *****************************************************************
>>>> */
>>>> - struct AVOutputFormat *next;
>>>> +#if FF_API_AVIOFORMAT
>>>> +#define av_const59 const
>>>> +#else
>>>> +#define av_const59
>>>> +#endif
>>>
>>> Shouldn't it be the other way around? FF_API_AVIOFORMAT
>>> evaluates to 1 when major is < 59.
>>
>> Yes, I had realized this in the meantime, new patch attached.
>
> And with the correct version in version.h
Ping.
Carl Eugen
More information about the ffmpeg-devel
mailing list