diff mbox

[FFmpeg-devel] avformat/udp: deprecate local_port option

Message ID 20161012062139.10210-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Liu Steven Oct. 12, 2016, 6:21 a.m. UTC
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 doc/protocols.texi    |    3 +++
 libavformat/udp.c     |   19 ++++++++++++++++++-
 libavformat/version.h |    3 +++
 3 files changed, 24 insertions(+), 1 deletions(-)

Comments

Steven Liu Oct. 13, 2016, 12:57 p.m. UTC | #1
ping

2016-10-12 14:21 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:

>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  doc/protocols.texi    |    3 +++
>  libavformat/udp.c     |   19 ++++++++++++++++++-
>  libavformat/version.h |    3 +++
>  3 files changed, 24 insertions(+), 1 deletions(-)
>
> diff --git a/doc/protocols.texi b/doc/protocols.texi
> index 3abc5f3..85a3f56 100644
> --- a/doc/protocols.texi
> +++ b/doc/protocols.texi
> @@ -1304,6 +1304,9 @@ input has enough packets to sustain it.
>  When using @var{bitrate} this specifies the maximum number of bits in
>  packet bursts.
>
> +@item local_port=@var{port}
> +This is a deprecated option, you can use localport instead it.
> +
>  @item localport=@var{port}
>  Override the local UDP port to bind with.
>
> diff --git a/libavformat/udp.c b/libavformat/udp.c
> index 3835f98..af06b89 100644
> --- a/libavformat/udp.c
> +++ b/libavformat/udp.c
> @@ -86,6 +86,9 @@ typedef struct UDPContext {
>      int pkt_size;
>      int is_multicast;
>      int is_broadcast;
> +#if FF_API_UDP_LOCAL_PORT
> +    int local_port_deprecated;
> +#endif
>      int local_port;
>      int reuse_socket;
>      int overrun_nonfatal;
> @@ -123,7 +126,9 @@ static const AVOption options[] = {
>      { "bitrate",        "Bits to send per second",
>  OFFSET(bitrate),        AV_OPT_TYPE_INT64,  { .i64 = 0  },     0,
> INT64_MAX, .flags = E },
>      { "burst_bits",     "Max length of bursts in bits (when using
> bitrate)", OFFSET(burst_bits),   AV_OPT_TYPE_INT64,  { .i64 = 0  },     0,
> INT64_MAX, .flags = E },
>      { "localport",      "Local port",
>   OFFSET(local_port),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1,
> INT_MAX, D|E },
> -    { "local_port",     "Local port",
>   OFFSET(local_port),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1,
> INT_MAX, .flags = D|E },
> +#if FF_API_UDP_LOCAL_PORT
> +    { "local_port",     "Local port",
>   OFFSET(local_port_deprecated),     AV_OPT_TYPE_INT,    { .i64 = -1 },
> -1, INT_MAX, .flags = D|E },
> +#endif
>      { "localaddr",      "Local address",
>  OFFSET(localaddr),      AV_OPT_TYPE_STRING, { .str = NULL },
>  .flags = D|E },
>      { "udplite_coverage", "choose UDPLite head size which should be
> validated by checksum", OFFSET(udplite_coverage), AV_OPT_TYPE_INT, {.i64 =
> 0}, 0, INT_MAX, D|E },
>      { "pkt_size",       "Maximum UDP packet size",
>  OFFSET(pkt_size),       AV_OPT_TYPE_INT,    { .i64 = 1472 },  -1, INT_MAX,
> .flags = D|E },
> @@ -377,6 +382,12 @@ static int udp_socket_create(URLContext *h, struct
> sockaddr_storage *addr,
>
>      if (((struct sockaddr *) &s->dest_addr)->sa_family)
>          family = ((struct sockaddr *) &s->dest_addr)->sa_family;
> +#if FF_API_UDP_LOCAL_PORT
> +    if (s->local_port_deprecated >= 0) {
> +        av_log(s, AV_LOG_WARNING, "the local_port option is deprecated,
> please use localport option\n");
> +        s->local_port = s->local_port_deprecated;
> +    }
> +#endif
>      res0 = udp_resolve_host(h, (localaddr && localaddr[0]) ? localaddr :
> NULL,
>                              s->local_port,
>                              SOCK_DGRAM, family, AI_PASSIVE);
> @@ -481,6 +492,12 @@ int ff_udp_set_remote_url(URLContext *h, const char
> *uri)
>  int ff_udp_get_local_port(URLContext *h)
>  {
>      UDPContext *s = h->priv_data;
> +#if FF_API_UDP_LOCAL_PORT
> +    if (s->local_port_deprecated >= 0) {
> +        av_log(s, AV_LOG_WARNING, "the local_port option is deprecated,
> please use localport option\n");
> +        s->local_port = s->local_port_deprecated;
> +    }
> +#endif
>      return s->local_port;
>  }
>
> diff --git a/libavformat/version.h b/libavformat/version.h
> index 92801b4..71c03ef 100644
> --- a/libavformat/version.h
> +++ b/libavformat/version.h
> @@ -85,6 +85,9 @@
>  #ifndef FF_API_HTTP_USER_AGENT
>  #define FF_API_HTTP_USER_AGENT          (LIBAVFORMAT_VERSION_MAJOR < 58)
>  #endif
> +#ifndef FF_API_UDP_LOCAL_PORT
> +#define FF_API_UDP_LOCAL_PORT           (LIBAVFORMAT_VERSION_MAJOR < 59)
> +#endif
>
>  #ifndef FF_API_R_FRAME_RATE
>  #define FF_API_R_FRAME_RATE            1
> --
> 1.7.1
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
Steven Liu Oct. 15, 2016, 1:57 a.m. UTC | #2
2016-10-13 20:57 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>:

> ping
>
> 2016-10-12 14:21 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
>
>>
>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> ---
>>  doc/protocols.texi    |    3 +++
>>  libavformat/udp.c     |   19 ++++++++++++++++++-
>>  libavformat/version.h |    3 +++
>>  3 files changed, 24 insertions(+), 1 deletions(-)
>>
>> diff --git a/doc/protocols.texi b/doc/protocols.texi
>> index 3abc5f3..85a3f56 100644
>> --- a/doc/protocols.texi
>> +++ b/doc/protocols.texi
>> @@ -1304,6 +1304,9 @@ input has enough packets to sustain it.
>>  When using @var{bitrate} this specifies the maximum number of bits in
>>  packet bursts.
>>
>> +@item local_port=@var{port}
>> +This is a deprecated option, you can use localport instead it.
>> +
>>  @item localport=@var{port}
>>  Override the local UDP port to bind with.
>>
>> diff --git a/libavformat/udp.c b/libavformat/udp.c
>> index 3835f98..af06b89 100644
>> --- a/libavformat/udp.c
>> +++ b/libavformat/udp.c
>> @@ -86,6 +86,9 @@ typedef struct UDPContext {
>>      int pkt_size;
>>      int is_multicast;
>>      int is_broadcast;
>> +#if FF_API_UDP_LOCAL_PORT
>> +    int local_port_deprecated;
>> +#endif
>>      int local_port;
>>      int reuse_socket;
>>      int overrun_nonfatal;
>> @@ -123,7 +126,9 @@ static const AVOption options[] = {
>>      { "bitrate",        "Bits to send per second",
>>    OFFSET(bitrate),        AV_OPT_TYPE_INT64,  { .i64 = 0  },     0,
>> INT64_MAX, .flags = E },
>>      { "burst_bits",     "Max length of bursts in bits (when using
>> bitrate)", OFFSET(burst_bits),   AV_OPT_TYPE_INT64,  { .i64 = 0  },     0,
>> INT64_MAX, .flags = E },
>>      { "localport",      "Local port",
>>   OFFSET(local_port),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1,
>> INT_MAX, D|E },
>> -    { "local_port",     "Local port",
>>   OFFSET(local_port),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1,
>> INT_MAX, .flags = D|E },
>> +#if FF_API_UDP_LOCAL_PORT
>> +    { "local_port",     "Local port",
>>   OFFSET(local_port_deprecated),     AV_OPT_TYPE_INT,    { .i64 = -1 },
>>   -1, INT_MAX, .flags = D|E },
>> +#endif
>>      { "localaddr",      "Local address",
>>    OFFSET(localaddr),      AV_OPT_TYPE_STRING, { .str = NULL },
>>    .flags = D|E },
>>      { "udplite_coverage", "choose UDPLite head size which should be
>> validated by checksum", OFFSET(udplite_coverage), AV_OPT_TYPE_INT, {.i64 =
>> 0}, 0, INT_MAX, D|E },
>>      { "pkt_size",       "Maximum UDP packet size",
>>    OFFSET(pkt_size),       AV_OPT_TYPE_INT,    { .i64 = 1472 },  -1,
>> INT_MAX, .flags = D|E },
>> @@ -377,6 +382,12 @@ static int udp_socket_create(URLContext *h, struct
>> sockaddr_storage *addr,
>>
>>      if (((struct sockaddr *) &s->dest_addr)->sa_family)
>>          family = ((struct sockaddr *) &s->dest_addr)->sa_family;
>> +#if FF_API_UDP_LOCAL_PORT
>> +    if (s->local_port_deprecated >= 0) {
>> +        av_log(s, AV_LOG_WARNING, "the local_port option is deprecated,
>> please use localport option\n");
>> +        s->local_port = s->local_port_deprecated;
>> +    }
>> +#endif
>>      res0 = udp_resolve_host(h, (localaddr && localaddr[0]) ? localaddr :
>> NULL,
>>                              s->local_port,
>>                              SOCK_DGRAM, family, AI_PASSIVE);
>> @@ -481,6 +492,12 @@ int ff_udp_set_remote_url(URLContext *h, const char
>> *uri)
>>  int ff_udp_get_local_port(URLContext *h)
>>  {
>>      UDPContext *s = h->priv_data;
>> +#if FF_API_UDP_LOCAL_PORT
>> +    if (s->local_port_deprecated >= 0) {
>> +        av_log(s, AV_LOG_WARNING, "the local_port option is deprecated,
>> please use localport option\n");
>> +        s->local_port = s->local_port_deprecated;
>> +    }
>> +#endif
>>      return s->local_port;
>>  }
>>
>> diff --git a/libavformat/version.h b/libavformat/version.h
>> index 92801b4..71c03ef 100644
>> --- a/libavformat/version.h
>> +++ b/libavformat/version.h
>> @@ -85,6 +85,9 @@
>>  #ifndef FF_API_HTTP_USER_AGENT
>>  #define FF_API_HTTP_USER_AGENT          (LIBAVFORMAT_VERSION_MAJOR < 58)
>>  #endif
>> +#ifndef FF_API_UDP_LOCAL_PORT
>> +#define FF_API_UDP_LOCAL_PORT           (LIBAVFORMAT_VERSION_MAJOR < 59)
>> +#endif
>>
>>  #ifndef FF_API_R_FRAME_RATE
>>  #define FF_API_R_FRAME_RATE            1
>> --
>> 1.7.1
>>
>>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
hi wm4,

      What about this one?

and ping Luca Abeni
Michael Niedermayer Oct. 15, 2016, 2:19 a.m. UTC | #3
On Sat, Oct 15, 2016 at 09:57:40AM +0800, Steven Liu wrote:
[...]
> and ping Luca Abeni

iam not sure he is still maintaining udp, he hasnt been active since
many years IIRC

[...]
Steven Liu Oct. 15, 2016, 3:09 a.m. UTC | #4
2016-10-15 10:19 GMT+08:00 Michael Niedermayer <michael@niedermayer.cc>:

> On Sat, Oct 15, 2016 at 09:57:40AM +0800, Steven Liu wrote:
> [...]
> > and ping Luca Abeni
>
> iam not sure he is still maintaining udp, he hasnt been active since
> many years IIRC
>
ping Michael :-D

>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> There will always be a question for which you do not know the correct
> answer.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
diff mbox

Patch

diff --git a/doc/protocols.texi b/doc/protocols.texi
index 3abc5f3..85a3f56 100644
--- a/doc/protocols.texi
+++ b/doc/protocols.texi
@@ -1304,6 +1304,9 @@  input has enough packets to sustain it.
 When using @var{bitrate} this specifies the maximum number of bits in
 packet bursts.
 
+@item local_port=@var{port}
+This is a deprecated option, you can use localport instead it.
+
 @item localport=@var{port}
 Override the local UDP port to bind with.
 
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 3835f98..af06b89 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -86,6 +86,9 @@  typedef struct UDPContext {
     int pkt_size;
     int is_multicast;
     int is_broadcast;
+#if FF_API_UDP_LOCAL_PORT
+    int local_port_deprecated;
+#endif
     int local_port;
     int reuse_socket;
     int overrun_nonfatal;
@@ -123,7 +126,9 @@  static const AVOption options[] = {
     { "bitrate",        "Bits to send per second",                         OFFSET(bitrate),        AV_OPT_TYPE_INT64,  { .i64 = 0  },     0, INT64_MAX, .flags = E },
     { "burst_bits",     "Max length of bursts in bits (when using bitrate)", OFFSET(burst_bits),   AV_OPT_TYPE_INT64,  { .i64 = 0  },     0, INT64_MAX, .flags = E },
     { "localport",      "Local port",                                      OFFSET(local_port),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, D|E },
-    { "local_port",     "Local port",                                      OFFSET(local_port),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, .flags = D|E },
+#if FF_API_UDP_LOCAL_PORT
+    { "local_port",     "Local port",                                      OFFSET(local_port_deprecated),     AV_OPT_TYPE_INT,    { .i64 = -1 },    -1, INT_MAX, .flags = D|E },
+#endif
     { "localaddr",      "Local address",                                   OFFSET(localaddr),      AV_OPT_TYPE_STRING, { .str = NULL },               .flags = D|E },
     { "udplite_coverage", "choose UDPLite head size which should be validated by checksum", OFFSET(udplite_coverage), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, D|E },
     { "pkt_size",       "Maximum UDP packet size",                         OFFSET(pkt_size),       AV_OPT_TYPE_INT,    { .i64 = 1472 },  -1, INT_MAX, .flags = D|E },
@@ -377,6 +382,12 @@  static int udp_socket_create(URLContext *h, struct sockaddr_storage *addr,
 
     if (((struct sockaddr *) &s->dest_addr)->sa_family)
         family = ((struct sockaddr *) &s->dest_addr)->sa_family;
+#if FF_API_UDP_LOCAL_PORT
+    if (s->local_port_deprecated >= 0) {
+        av_log(s, AV_LOG_WARNING, "the local_port option is deprecated, please use localport option\n");
+        s->local_port = s->local_port_deprecated;
+    }
+#endif
     res0 = udp_resolve_host(h, (localaddr && localaddr[0]) ? localaddr : NULL,
                             s->local_port,
                             SOCK_DGRAM, family, AI_PASSIVE);
@@ -481,6 +492,12 @@  int ff_udp_set_remote_url(URLContext *h, const char *uri)
 int ff_udp_get_local_port(URLContext *h)
 {
     UDPContext *s = h->priv_data;
+#if FF_API_UDP_LOCAL_PORT
+    if (s->local_port_deprecated >= 0) {
+        av_log(s, AV_LOG_WARNING, "the local_port option is deprecated, please use localport option\n");
+        s->local_port = s->local_port_deprecated;
+    }
+#endif
     return s->local_port;
 }
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 92801b4..71c03ef 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -85,6 +85,9 @@ 
 #ifndef FF_API_HTTP_USER_AGENT
 #define FF_API_HTTP_USER_AGENT          (LIBAVFORMAT_VERSION_MAJOR < 58)
 #endif
+#ifndef FF_API_UDP_LOCAL_PORT
+#define FF_API_UDP_LOCAL_PORT           (LIBAVFORMAT_VERSION_MAJOR < 59)
+#endif
 
 #ifndef FF_API_R_FRAME_RATE
 #define FF_API_R_FRAME_RATE            1