diff mbox series

[FFmpeg-devel] avformat/libsrt: print streamid at client

Message ID 20201001061805.951579-1-raghavendra.rao@collabora.com
State Superseded
Headers show
Series [FFmpeg-devel] avformat/libsrt: print streamid at client | expand

Commit Message

Raghavendra Rao Sidlagatta Oct. 1, 2020, 6:18 a.m. UTC
Print the SRT streamid at the client.

Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
---
 libavformat/libsrt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Nicolas George Oct. 1, 2020, 7:48 a.m. UTC | #1
raghavendra (12020-10-01):
> Print the SRT streamid at the client.
> 
> Signed-off-by: raghavendra <raghavendra.rao@collabora.com>
> ---
>  libavformat/libsrt.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
> index a490a386e6..ee64cb82f7 100644
> --- a/libavformat/libsrt.c
> +++ b/libavformat/libsrt.c
> @@ -359,6 +359,13 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
>      return 0;
>  }
>  
> +static void libsrt_dump_streamid(URLContext *h, int fd)
> +{
> +    char streamid[512];
> +    int optlen = sizeof(streamid);
> +    if(!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))

> +        av_log(NULL, AV_LOG_INFO, "srt_streamid : %s\n", streamid);

Do not log to NULL. You have a context.

Is this information relevant for a normal user? If not, info → verbose.

> +}
>  
>  static int libsrt_setup(URLContext *h, const char *uri, int flags)
>  {
> @@ -442,6 +449,8 @@ static int libsrt_setup(URLContext *h, const char *uri, int flags)
>              goto fail1;
>          listen_fd = fd;
>          fd = ret;
> +        // dump srt streamid at client
> +        libsrt_dump_streamid(h, fd);
>      } else {
>          if (s->mode == SRT_MODE_RENDEZVOUS) {
>              ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);

Regards,
diff mbox series

Patch

diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
index a490a386e6..ee64cb82f7 100644
--- a/libavformat/libsrt.c
+++ b/libavformat/libsrt.c
@@ -359,6 +359,13 @@  static int libsrt_set_options_pre(URLContext *h, int fd)
     return 0;
 }
 
+static void libsrt_dump_streamid(URLContext *h, int fd)
+{
+    char streamid[512];
+    int optlen = sizeof(streamid);
+    if(!libsrt_getsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", streamid, &optlen))
+        av_log(NULL, AV_LOG_INFO, "srt_streamid : %s\n", streamid);
+}
 
 static int libsrt_setup(URLContext *h, const char *uri, int flags)
 {
@@ -442,6 +449,8 @@  static int libsrt_setup(URLContext *h, const char *uri, int flags)
             goto fail1;
         listen_fd = fd;
         fd = ret;
+        // dump srt streamid at client
+        libsrt_dump_streamid(h, fd);
     } else {
         if (s->mode == SRT_MODE_RENDEZVOUS) {
             ret = srt_bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);