Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] fftools/ffmpeg: rename read_file() to avoid conflict with libass
@ 2022-10-20  7:12 Anton Khirnov
  2022-10-20  8:06 ` Rémi Denis-Courmont
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Khirnov @ 2022-10-20  7:12 UTC (permalink / raw)
  To: ffmpeg-devel

libass defines a non-static read_file() symbol, which causes conflicts
with static linking.
---
 fftools/ffmpeg.h          | 2 +-
 fftools/ffmpeg_mux_init.c | 4 ++--
 fftools/ffmpeg_opt.c      | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 2dcce45741..5966cac60e 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -702,7 +702,7 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b);
 void assert_avoptions(AVDictionary *m);
 
 void assert_file_overwrite(const char *filename);
-char *read_file(const char *filename);
+char *file_read(const char *filename);
 AVDictionary *strip_specifiers(AVDictionary *dict);
 const AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder);
 int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index c8b2552104..c77260c24b 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -380,7 +380,7 @@ static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc,
     }
 
     if (ost->filters_script)
-        return read_file(ost->filters_script);
+        return file_read(ost->filters_script);
     else if (ost->filters)
         return av_strdup(ost->filters);
 
@@ -585,7 +585,7 @@ static OutputStream *new_video_stream(Muxer *mux, OptionsContext *o, int source_
                 av_dict_set(&ost->encoder_opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
             } else {
                 if (video_enc->flags & AV_CODEC_FLAG_PASS2) {
-                    char  *logbuffer = read_file(logfilename);
+                    char  *logbuffer = file_read(logfilename);
 
                     if (!logbuffer) {
                         av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index ead4ee1b38..9245e02813 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1300,7 +1300,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
 }
 
 /* read file contents into a string */
-char *read_file(const char *filename)
+char *file_read(const char *filename)
 {
     AVIOContext *pb      = NULL;
     int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
@@ -1725,7 +1725,7 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
 static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
 {
     FilterGraph *fg;
-    char *graph_desc = read_file(arg);
+    char *graph_desc = file_read(arg);
     if (!graph_desc)
         return AVERROR(EINVAL);
 
-- 
2.35.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: rename read_file() to avoid conflict with libass
  2022-10-20  7:12 [FFmpeg-devel] [PATCH] fftools/ffmpeg: rename read_file() to avoid conflict with libass Anton Khirnov
@ 2022-10-20  8:06 ` Rémi Denis-Courmont
  2022-10-20  8:25   ` Anton Khirnov
  0 siblings, 1 reply; 3+ messages in thread
From: Rémi Denis-Courmont @ 2022-10-20  8:06 UTC (permalink / raw)
  To: FFmpeg development discussions and patches, Anton Khirnov, ffmpeg-devel

Le 20 octobre 2022 10:12:28 GMT+03:00, Anton Khirnov <anton@khirnov.net> a écrit :
>libass defines a non-static read_file() symbol, which causes conflicts
>with static linking.
>---
> fftools/ffmpeg.h          | 2 +-
> fftools/ffmpeg_mux_init.c | 4 ++--
> fftools/ffmpeg_opt.c      | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
>index 2dcce45741..5966cac60e 100644
>--- a/fftools/ffmpeg.h
>+++ b/fftools/ffmpeg.h
>@@ -702,7 +702,7 @@ void remove_avoptions(AVDictionary **a, AVDictionary *b);
> void assert_avoptions(AVDictionary *m);
> 
> void assert_file_overwrite(const char *filename);
>-char *read_file(const char *filename);
>+char *file_read(const char *filename);
> AVDictionary *strip_specifiers(AVDictionary *dict);
> const AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder);
> int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
>diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
>index c8b2552104..c77260c24b 100644
>--- a/fftools/ffmpeg_mux_init.c
>+++ b/fftools/ffmpeg_mux_init.c
>@@ -380,7 +380,7 @@ static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc,
>     }
> 
>     if (ost->filters_script)
>-        return read_file(ost->filters_script);
>+        return file_read(ost->filters_script);
>     else if (ost->filters)
>         return av_strdup(ost->filters);
> 
>@@ -585,7 +585,7 @@ static OutputStream *new_video_stream(Muxer *mux, OptionsContext *o, int source_
>                 av_dict_set(&ost->encoder_opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
>             } else {
>                 if (video_enc->flags & AV_CODEC_FLAG_PASS2) {
>-                    char  *logbuffer = read_file(logfilename);
>+                    char  *logbuffer = file_read(logfilename);
> 
>                     if (!logbuffer) {
>                         av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
>diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
>index ead4ee1b38..9245e02813 100644
>--- a/fftools/ffmpeg_opt.c
>+++ b/fftools/ffmpeg_opt.c
>@@ -1300,7 +1300,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
> }
> 
> /* read file contents into a string */
>-char *read_file(const char *filename)
>+char *file_read(const char *filename)
> {
>     AVIOContext *pb      = NULL;
>     int ret = avio_open(&pb, filename, AVIO_FLAG_READ);
>@@ -1725,7 +1725,7 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
> static int opt_filter_complex_script(void *optctx, const char *opt, const char *arg)
> {
>     FilterGraph *fg;
>-    char *graph_desc = read_file(arg);
>+    char *graph_desc = file_read(arg);
>     if (!graph_desc)
>         return AVERROR(EINVAL);
> 

Hi,

`file_read` is just as likely to cause naming conflicts. And I have seen really insane libraries with no namespacing getting preloaded, so it is unfortunately not even only a problem with libraries that FFmpeg links with.

If you're going to treat this as an FFmpeg bug... I fear that the only solution consists of prefixing all extern symbols for namespacing.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] fftools/ffmpeg: rename read_file() to avoid conflict with libass
  2022-10-20  8:06 ` Rémi Denis-Courmont
@ 2022-10-20  8:25   ` Anton Khirnov
  0 siblings, 0 replies; 3+ messages in thread
From: Anton Khirnov @ 2022-10-20  8:25 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Quoting Rémi Denis-Courmont (2022-10-20 10:06:45)
> `file_read` is just as likely to cause naming conflicts. And I have
> seen really insane libraries with no namespacing getting preloaded, so
> it is unfortunately not even only a problem with libraries that FFmpeg
> links with.
>
> If you're going to treat this as an FFmpeg bug... I fear that the only
> solution consists of prefixing all extern symbols for namespacing.

No, as far as I'm concerned this is libass bug and this is merely a
workaround. I don't think we should preemptively try to work around
other bugs in other libraries - they should be found and fixed there.

Apparently this is going to be fixed in libass as well, but we still
need to hanlde older versions.

-- 
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-20  8:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-20  7:12 [FFmpeg-devel] [PATCH] fftools/ffmpeg: rename read_file() to avoid conflict with libass Anton Khirnov
2022-10-20  8:06 ` Rémi Denis-Courmont
2022-10-20  8:25   ` Anton Khirnov

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git