Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-03-20 19:23 GMT+01:00, Lou Logan : > On Wed, Mar 20, 2019, at 9:58 AM, Carl Eugen Hoyos wrote: >> >> Patch applied. >> > > Breaks compilation for me on x86_64 linux: Should be fixed, sorry for the nuisance. Thank you for the report, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
On Wed, Mar 20, 2019, at 9:58 AM, Carl Eugen Hoyos wrote: > > Patch applied. > Breaks compilation for me on x86_64 linux: /usr/bin/ld: libavformat/libavformat.a(allformats.o):(.data.rel.ro+0x398): undefined reference to `ff_kux_demuxer' collect2: error: ld returned 1 exit status make: *** [Makefile:108: ffmpeg_g] Error 1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-02-09 15:51 GMT+01:00, Carl Eugen Hoyos : > 2019-02-09 14:37 GMT+01:00, Carl Eugen Hoyos : >> 2019-02-01 1:13 GMT+01:00, Michael Niedermayer : >>> 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 : > 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 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. Patch applied. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-02-09 15:51 GMT+01:00, Carl Eugen Hoyos : > 2019-02-09 14:37 GMT+01:00, Carl Eugen Hoyos : >> 2019-02-01 1:13 GMT+01:00, Michael Niedermayer : >>> 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 : > 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 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. Ping. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-02-09 14:37 GMT+01:00, Carl Eugen Hoyos : > 2019-02-01 1:13 GMT+01:00, Michael Niedermayer : >> 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 : >>> > 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 >>> 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 From 7ab30f3dbc869ad9641d9b791bb9e3cd97a432fa Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 9 Feb 2019 14:36:07 +0100 Subject: [PATCH] lavf: Constify AVInputFormat pointer. --- libavformat/allformats.c |4 libavformat/avformat.h | 23 ++- libavformat/avidec.c |2 +- libavformat/dashdec.c|2 +- libavformat/format.c | 16 libavformat/hls.c|2 +- libavformat/img2dec.c|2 +- libavformat/mpeg.c |2 +- libavformat/rtpdec_asf.c |2 +- libavformat/sapdec.c |2 +- libavformat/utils.c |6 +++--- libavformat/version.h|3 +++ 12 files changed, 39 insertions(+), 27 deletions(-) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 0684498..242edc3 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) +#if FF_API_AVIOFORMAT return f->next; +#else +return (AVInputFormat *) f->next; +#endif else { void *opaque = NULL; return (AVInputFormat *)av_demuxer_iterate(&opaque); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index fdaffa5..a866c33 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -676,7 +676,12 @@ typedef struct AVInputFormat { * New public fields should be added right above. * */ -struct AVInputFormat *next; +#if FF_API_AVIOFORMAT +#define av_const59 +#else +#define av_const59 const +#endif +av_const59 struct AVInputFormat *next; /** * Raw demuxers store their codec ID here. @@ -1346,7 +1351
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-02-01 1:13 GMT+01:00, Michael Niedermayer : > 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 : >> > 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 >> 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. Please comment, Carl Eugen From 7ab30f3dbc869ad9641d9b791bb9e3cd97a432fa Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 9 Feb 2019 14:36:07 +0100 Subject: [PATCH] lavf: Constify AVInputFormat pointer. --- libavformat/allformats.c |4 libavformat/avformat.h | 23 ++- libavformat/avidec.c |2 +- libavformat/dashdec.c|2 +- libavformat/format.c | 16 libavformat/hls.c|2 +- libavformat/img2dec.c|2 +- libavformat/mpeg.c |2 +- libavformat/rtpdec_asf.c |2 +- libavformat/sapdec.c |2 +- libavformat/utils.c |6 +++--- libavformat/version.h|3 +++ 12 files changed, 39 insertions(+), 27 deletions(-) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 0684498..242edc3 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) +#if FF_API_AVIOFORMAT +return (AVInputFormat *) f->next; +#else return f->next; +#endif else { void *opaque = NULL; return (AVInputFormat *)av_demuxer_iterate(&opaque); diff --git a/libavformat/avformat.h b/libavformat/avformat.h index fdaffa5..a866c33 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -676,7 +676,12 @@ typedef struct AVInputFormat { * New public fields should be added right above. * */ -struct AVInputFormat *next; +#if FF_API_AVIOFORMAT +#define av_const59 const +#else +#define av_const59 +#endif +av_const59 struct AVInputFormat *next; /** * Raw demuxers store their codec ID here. @@ -1346,7 +1351,7 @@ typedef struct AVFormatContext { * * Demuxing only, set by avformat_open_input(). */ -struct AVInputFormat *iformat;
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
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 : > > 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 > 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 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
On 1/31/2019 5:54 PM, Carl Eugen Hoyos wrote: > 2019-01-31 21:43 GMT+01:00, Carl Eugen Hoyos : >> Hi! >> >> Attached patch persistently uses "const" for AVInputFormat pointer >> after the next version bump. > Now with an actually working version. > > Please comment, Carl Eugen > > > 0001-lavf-Constify-AVInputFormat-pointer.patch > > From f383a7f914b2c7240378b404d529a7d73c68941b Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos > 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; > > /** > * Raw demuxers store their codec ID here. > @@ -1346,6 +1349,9 @@ typedef struct AVFormatContext { > * > * Demuxing only, set by avformat_open_input(). > */ > +#if !FF_API_AVINPUTFORMAT > +const > +#endif > struct AVInputFormat *iformat; > > /** > @@ -,6 +2228,9 @@ int avformat_alloc_output_context2(AVFormatContext > **ctx, AVOutputFormat *oforma > /** > * Find AVInputFormat based on the short name of the input format. > */ > +#if !FF_API_AVINPUTFORMAT > +const > +#endif > AVInputFormat *av_find_input_format(const char *short_name); I'd prefer if you instead do like with av_probe_input_buffer() so we can simply remove the dead code after a major bump and end up with a single line prototype without extra line changes. > > /** > @@ -2231,6 +2240,9 @@ AVInputFormat *av_find_input_format(const char > *short_name); > * @param is_opened Whether the file is already opened; determines whether > * demuxers with or without AVFMT_NOFILE are probed. > */ > +#if !FF_API_AVINPUTFORMAT > +const > +#endif > AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); > > /** > @@ -2245,6 +2257,9 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, > int is_opened); > * If the score is <= AVPROBE_SCORE_MAX / 4 it is > recommended > * to retry with a larger probe buffer. > */ > +#if !FF_API_AVINPUTFORMAT > +const > +#endif > AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int > *score_max); > > /** > @@ -2254,6 +2269,9 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, > int is_opened, int *score > * demuxers with or without AVFMT_NOFILE are probed. > * @param score_ret The score of the best detection. > */ > +#if !FF_API_AVINPUTFORMAT > +const > +#endif > AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int > *score_ret); > > /** > @@ -2272,14 +2290,22 @@ AVInputFormat *av_probe_input_format3(AVProbeData > *pd, int is_opened, int *score > * the maximal score is AVPROBE_SCORE_MAX > * AVERROR code otherwise > */ > +#if FF_API_AVINPUTFORMAT > int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, > +#else > +int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, > +#endif > const char *url, void *logctx, > unsigned int offset, unsigned int max_probe_size); > > /** > * Like av_probe_input_buffer2() but returns 0 on success > */ > +#if FF_API_AVINPUTFORMAT > int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, > +#else > +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, > +#endif >const char *url, void
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-01-31 21:43 GMT+01:00, Carl Eugen Hoyos : > Hi! > > Attached patch persistently uses "const" for AVInputFormat pointer > after the next version bump. Now with an actually working version. Please comment, Carl Eugen From f383a7f914b2c7240378b404d529a7d73c68941b Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos 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; /** * Raw demuxers store their codec ID here. @@ -1346,6 +1349,9 @@ typedef struct AVFormatContext { * * Demuxing only, set by avformat_open_input(). */ +#if !FF_API_AVINPUTFORMAT +const +#endif struct AVInputFormat *iformat; /** @@ -,6 +2228,9 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oforma /** * Find AVInputFormat based on the short name of the input format. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_find_input_format(const char *short_name); /** @@ -2231,6 +2240,9 @@ AVInputFormat *av_find_input_format(const char *short_name); * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); /** @@ -2245,6 +2257,9 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended * to retry with a larger probe buffer. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); /** @@ -2254,6 +2269,9 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score * demuxers with or without AVFMT_NOFILE are probed. * @param score_ret The score of the best detection. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); /** @@ -2272,14 +2290,22 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * the maximal score is AVPROBE_SCORE_MAX * AVERROR code otherwise */ +#if FF_API_AVINPUTFORMAT int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, +#else +int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, +#endif const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Like av_probe_input_buffer2() but returns 0 on success */ +#if FF_API_AVINPUTFORMAT int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, +#else +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, +#endif const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); @@ -2302,7 +2328,11 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ +#if FF_API_AVINPUTFORMAT int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); +#else +int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options); +#endif attribute_deprecated int av_
[FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
Hi! Attached patch persistently uses "const" for AVInputFormat pointer after the next version bump. Please comment, Carl Eugen From 95fc17cc1a82ea6d2e9e96932e145cc2b4c210b6 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 31 Jan 2019 21:40:58 +0100 Subject: [PATCH] lavf: Constify AVInputFormat pointer. --- libavformat/allformats.c |6 +- libavformat/avformat.h | 32 +++- libavformat/dashdec.c|3 +++ 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 +++ 10 files changed, 63 insertions(+), 6 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; /** * Raw demuxers store their codec ID here. @@ -1346,6 +1349,9 @@ typedef struct AVFormatContext { * * Demuxing only, set by avformat_open_input(). */ +#if !FF_API_AVINPUTFORMAT +const +#endif struct AVInputFormat *iformat; /** @@ -,6 +2228,9 @@ int avformat_alloc_output_context2(AVFormatContext **ctx, AVOutputFormat *oforma /** * Find AVInputFormat based on the short name of the input format. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_find_input_format(const char *short_name); /** @@ -2231,6 +2240,9 @@ AVInputFormat *av_find_input_format(const char *short_name); * @param is_opened Whether the file is already opened; determines whether * demuxers with or without AVFMT_NOFILE are probed. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); /** @@ -2245,6 +2257,9 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended * to retry with a larger probe buffer. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); /** @@ -2254,6 +2269,9 @@ AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score * demuxers with or without AVFMT_NOFILE are probed. * @param score_ret The score of the best detection. */ +#if !FF_API_AVINPUTFORMAT +const +#endif AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score_ret); /** @@ -2272,14 +2290,22 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * the maximal score is AVPROBE_SCORE_MAX * AVERROR code otherwise */ +#if FF_API_AVINPUTFORMAT int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, +#else +int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, +#endif const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Like av_probe_input_buffer2() but returns 0 on success */ +#if FF_API_AVINPUTFORMAT int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, +#else +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, +#endif const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); @@ -2302,7 +2328,11 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ +#if FF_API_AVINPUTFORMAT int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); +#else +int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options); +#endif attribute_deprecated int av_demuxer_open(AVFormatContext *ic); diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index f4f4e93..ad9cdb1 100644 --- a/libavformat/dashdec.c +++ b/l
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-01-30 17:03 GMT+01:00, James Almer : > On 1/30/2019 12:33 PM, Michael Niedermayer wrote: >> On Sun, Jan 27, 2019 at 10:38:13PM +0100, Carl Eugen Hoyos wrote: >>> Attached patch was requested in ticket #7220 iiuc. >>> >>> Please review, Carl Eugen >> >>> avformat.h |8 >>> format.c |4 ++-- >>> hls.c |2 +- >>> utils.c|4 ++-- >>> 4 files changed, 9 insertions(+), 9 deletions(-) >>> 0a59a10c224ba092d8b7b61e3cac78a93c23bee2 >>> 0001-lavf-Constify-AVInputFormat-pointer.patch >>> From a713b58767e8d77b641d1b87e68de11c176fd454 Mon Sep 17 00:00:00 2001 >>> From: Carl Eugen Hoyos >>> Date: Sun, 27 Jan 2019 22:35:51 +0100 >>> Subject: [PATCH] lavf: Constify AVInputFormat pointer. >> >> there is some tiny chance this could break some user apps >> build i think so if done strictly correct it would need to be >> delayed to the next bump i think Yes, it unfortunately breaks C++ compilation: #define __STDC_CONSTANT_MACROS #include "libavformat/avformat.h" int main() { /*const*/ AVInputFormat **dummy = NULL; return av_probe_input_buffer2(NULL, dummy, NULL, NULL, 0, 0); } > We have tied constifying (or the opposite) to major bumps before, > so i agree. It depended on the placement of const, I believe this patch did not break anything: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=f2c86705 Will try to create a new patch with a version dependency, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
On 1/30/2019 12:33 PM, Michael Niedermayer wrote: > On Sun, Jan 27, 2019 at 10:38:13PM +0100, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch was requested in ticket #7220 iiuc. >> >> Please review, Carl Eugen > >> avformat.h |8 >> format.c |4 ++-- >> hls.c |2 +- >> utils.c|4 ++-- >> 4 files changed, 9 insertions(+), 9 deletions(-) >> 0a59a10c224ba092d8b7b61e3cac78a93c23bee2 >> 0001-lavf-Constify-AVInputFormat-pointer.patch >> From a713b58767e8d77b641d1b87e68de11c176fd454 Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Sun, 27 Jan 2019 22:35:51 +0100 >> Subject: [PATCH] lavf: Constify AVInputFormat pointer. > > there is some tiny chance this could break some user apps build i think > so if done strictly correct it would need to be delayed to the next > bump i think We have tied constifying (or the opposite) to major bumps before, so i agree. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
On Sun, Jan 27, 2019 at 10:38:13PM +0100, Carl Eugen Hoyos wrote: > Hi! > > Attached patch was requested in ticket #7220 iiuc. > > Please review, Carl Eugen > avformat.h |8 > format.c |4 ++-- > hls.c |2 +- > utils.c|4 ++-- > 4 files changed, 9 insertions(+), 9 deletions(-) > 0a59a10c224ba092d8b7b61e3cac78a93c23bee2 > 0001-lavf-Constify-AVInputFormat-pointer.patch > From a713b58767e8d77b641d1b87e68de11c176fd454 Mon Sep 17 00:00:00 2001 > From: Carl Eugen Hoyos > Date: Sun, 27 Jan 2019 22:35:51 +0100 > Subject: [PATCH] lavf: Constify AVInputFormat pointer. there is some tiny chance this could break some user apps build i think so if done strictly correct it would need to be delayed to the next bump i think [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you think the mosad wants you dead since a long time then you are either wrong or dead since a long time. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
2019-01-27 22:38 GMT+01:00, Carl Eugen Hoyos : > Attached patch was requested in ticket #7220 iiuc. Ping. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]lavf:Constify AVInputFormat pointer
Hi! Attached patch was requested in ticket #7220 iiuc. Please review, Carl Eugen From a713b58767e8d77b641d1b87e68de11c176fd454 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 27 Jan 2019 22:35:51 +0100 Subject: [PATCH] lavf: Constify AVInputFormat pointer. --- libavformat/avformat.h |8 libavformat/format.c |4 ++-- libavformat/hls.c |2 +- libavformat/utils.c|4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index fdaffa5..9cfdbe8 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1346,7 +1346,7 @@ typedef struct AVFormatContext { * * Demuxing only, set by avformat_open_input(). */ -struct AVInputFormat *iformat; +const struct AVInputFormat *iformat; /** * The output container format. @@ -2272,14 +2272,14 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * the maximal score is AVPROBE_SCORE_MAX * AVERROR code otherwise */ -int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat const **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Like av_probe_input_buffer2() but returns 0 on success */ -int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); @@ -2302,7 +2302,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ -int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); +int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options); attribute_deprecated int av_demuxer_open(AVFormatContext *ic); diff --git a/libavformat/format.c b/libavformat/format.c index 2c4c895..157e09a 100644 --- a/libavformat/format.c +++ b/libavformat/format.c @@ -219,7 +219,7 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened) return av_probe_input_format2(pd, is_opened, &score); } -int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer2(AVIOContext *pb, const AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { @@ -309,7 +309,7 @@ fail: return ret < 0 ? ret : score; } -int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, +int av_probe_input_buffer(AVIOContext *pb, const AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { diff --git a/libavformat/hls.c b/libavformat/hls.c index 8975a87..4c2265a 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -1868,7 +1868,7 @@ static int hls_read_header(AVFormatContext *s) /* Open the demuxer for each playlist */ for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; -AVInputFormat *in_fmt = NULL; +const AVInputFormat *in_fmt = NULL; if (!(pls->ctx = avformat_alloc_context())) { ret = AVERROR(ENOMEM); diff --git a/libavformat/utils.c b/libavformat/utils.c index 7afef54..98e8849 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -535,7 +535,7 @@ FF_ENABLE_DEPRECATION_WARNINGS int avformat_open_input(AVFormatContext **ps, const char *filename, -AVInputFormat *fmt, AVDictionary **options) +const AVInputFormat *fmt, AVDictionary **options) { AVFormatContext *s = *ps; int i, ret = 0; @@ -2163,7 +2163,7 @@ static int64_t ff_read_timestamp(AVFormatContext *s, int stream_index, int64_t * int ff_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags) { -AVInputFormat *avif = s->iformat; +const AVInputFormat *avif = s->iformat; int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit; int64_t ts_min, ts_max, ts; int index; -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel