[FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
Carl Eugen Hoyos
ceffmpeg at gmail.com
Sat Feb 9 16:51:07 EET 2019
2019-02-09 14:37 GMT+01:00, Carl Eugen Hoyos <ceffmpeg at gmail.com>:
> 2019-02-01 1:13 GMT+01:00, Michael Niedermayer <michael at niedermayer.cc>:
>> On Thu, Jan 31, 2019 at 09:54:14PM +0100, Carl Eugen Hoyos wrote:
>>> 2019-01-31 21:43 GMT+01:00, Carl Eugen Hoyos <ceffmpeg at gmail.com>:
>>> > Hi!
>>> >
>>> > Attached patch persistently uses "const" for AVInputFormat pointer
>>> > after the next version bump.
>>>
>>> Now with an actually working version.
>>>
>>> Please comment, Carl Eugen
>>
>>> allformats.c | 6 +++++-
>>> avformat.h | 32 +++++++++++++++++++++++++++++++-
>>> dashdec.c | 3 +++
>>> format.c | 32 ++++++++++++++++++++++++++++++--
>>> hls.c | 3 +++
>>> img2dec.c | 2 +-
>>> mpeg.c | 3 +++
>>> rtpdec_asf.c | 3 +++
>>> sapdec.c | 3 +++
>>> utils.c | 11 ++++++++---
>>> version.h | 3 +++
>>> 11 files changed, 93 insertions(+), 8 deletions(-)
>>> d3aece2f0b9a9c3ff8b2a187ceccdc744ea40de2
>>> 0001-lavf-Constify-AVInputFormat-pointer.patch
>>> From f383a7f914b2c7240378b404d529a7d73c68941b Mon Sep 17 00:00:00 2001
>>> From: Carl Eugen Hoyos <ceffmpeg at gmail.com>
>>> Date: Thu, 31 Jan 2019 21:51:56 +0100
>>> Subject: [PATCH] lavf: Constify AVInputFormat pointer.
>>>
>>> ---
>>> libavformat/allformats.c | 6 +++++-
>>> libavformat/avformat.h | 32 +++++++++++++++++++++++++++++++-
>>> libavformat/dashdec.c | 3 +++
>>> libavformat/format.c | 32 ++++++++++++++++++++++++++++++--
>>> libavformat/hls.c | 3 +++
>>> libavformat/img2dec.c | 2 +-
>>> libavformat/mpeg.c | 3 +++
>>> libavformat/rtpdec_asf.c | 3 +++
>>> libavformat/sapdec.c | 3 +++
>>> libavformat/utils.c | 11 ++++++++---
>>> libavformat/version.h | 3 +++
>>> 11 files changed, 93 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/libavformat/allformats.c b/libavformat/allformats.c
>>> index 0684498..01c4c14 100644
>>> --- a/libavformat/allformats.c
>>> +++ b/libavformat/allformats.c
>>> @@ -583,7 +583,11 @@ AVInputFormat *av_iformat_next(const AVInputFormat
>>> *f)
>>> ff_thread_once(&av_format_next_init, av_format_init_next);
>>>
>>> if (f)
>>> - return f->next;
>>> + return
>>> +#if !FF_API_AVINPUTFORMAT
>>> + (AVInputFormat *)
>>> +#endif
>>> + f->next;
>>> else {
>>> void *opaque = NULL;
>>> return (AVInputFormat *)av_demuxer_iterate(&opaque);
>>> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
>>> index fdaffa5..7c4ec8f 100644
>>> --- a/libavformat/avformat.h
>>> +++ b/libavformat/avformat.h
>>> @@ -676,7 +676,10 @@ typedef struct AVInputFormat {
>>> * New public fields should be added right above.
>>> *****************************************************************
>>> */
>>> - struct AVInputFormat *next;
>>> +#if !FF_API_AVINPUTFORMAT
>>> + const
>>> +#endif
>>> +struct AVInputFormat *next;
>>
>> some av_const59 which is defined to nothing until version 59
>> should avoid the repeated #if/endif
>> it would require an eventual update to change it to const at some
>> point but it would avoid most preprocessor comands
>
> New patch attached.
Now with correct condition.
Carl Eugen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavf-Constify-AVInputFormat-pointer.patch
Type: text/x-patch
Size: 12776 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190209/0d17f159/attachment.bin>
More information about the ffmpeg-devel
mailing list