diff mbox series

[FFmpeg-devel,4/6] avformat/rtsp: Fix build failure when RTP demuxers are disabled

Message ID 20210130044424.3677308-4-andreas.rheinhardt@gmail.com
State Accepted
Commit e9513052b533e4b528b3a7dddc529ee5bf74dd02
Headers show
Series [FFmpeg-devel,1/6] avformat/cutils, dvenc: Move ff_brktimegm to its only user | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 30, 2021, 4:44 a.m. UTC
rtsp.c uses a check of the form "if (CONFIG_RTSP_DEMUXER && ...) {}"
with the intent to make the code compilable even though the part guarded
by this check contains calls to functions that don't exist when the RTSP
demuxer is disabled. Yet even then compilers still need a declaration of
all the functions in the dead code block and error out if not (due to
our usage of -Werror=implicit-function-declaration) and no such
declaration exists for a static function in rtsp.c. Simply adding a
declaration leads to a "used but never defined" warning, therefore this
commit resorts to an #if.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/rtsp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Paul B Mahol Jan. 30, 2021, 2:23 p.m. UTC | #1
probably ok

On Sat, Jan 30, 2021 at 5:45 AM Andreas Rheinhardt <
andreas.rheinhardt@gmail.com> wrote:

> rtsp.c uses a check of the form "if (CONFIG_RTSP_DEMUXER && ...) {}"
> with the intent to make the code compilable even though the part guarded
> by this check contains calls to functions that don't exist when the RTSP
> demuxer is disabled. Yet even then compilers still need a declaration of
> all the functions in the dead code block and error out if not (due to
> our usage of -Werror=implicit-function-declaration) and no such
> declaration exists for a static function in rtsp.c. Simply adding a
> declaration leads to a "used but never defined" warning, therefore this
> commit resorts to an #if.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/rtsp.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index 1b24496f3c..9a2933346e 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1941,12 +1941,15 @@ redirect:
>          break;
>      }
>
> -    if (CONFIG_RTSP_DEMUXER && s->iformat) {
> +#if CONFIG_RTSP_DEMUXER
> +    if (s->iformat) {
>          if (rt->server_type == RTSP_SERVER_SATIP)
>              err = init_satip_stream(s);
>          else
>              err = ff_rtsp_setup_input_streams(s, reply);
> -    } else if (CONFIG_RTSP_MUXER)
> +    } else
> +#endif
> +           if (CONFIG_RTSP_MUXER)
>          err = ff_rtsp_setup_output_streams(s, host);
>      else
>          av_assert0(0);
> --
> 2.25.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".
diff mbox series

Patch

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 1b24496f3c..9a2933346e 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1941,12 +1941,15 @@  redirect:
         break;
     }
 
-    if (CONFIG_RTSP_DEMUXER && s->iformat) {
+#if CONFIG_RTSP_DEMUXER
+    if (s->iformat) {
         if (rt->server_type == RTSP_SERVER_SATIP)
             err = init_satip_stream(s);
         else
             err = ff_rtsp_setup_input_streams(s, reply);
-    } else if (CONFIG_RTSP_MUXER)
+    } else
+#endif
+           if (CONFIG_RTSP_MUXER)
         err = ff_rtsp_setup_output_streams(s, host);
     else
         av_assert0(0);