[PATCH] lavf/tcp: apply minor fixes to documentation
In particular, add an Examples section and correct the unit of the listen_timeout option value, from microseconds to milliseconds. --- doc/protocols.texi | 21 +++++++++++++++------ libavformat/tcp.c | 6 +++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index dc2fdb1..72d199d 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -1069,11 +1069,11 @@ tcp://@var{hostname}:@var{port}[?@var{options}] @var{options} contains a list of &-separated options of the form @var{key}=@var{val}. -The list of supported options follows. +@subsection Options @table @option @item listen=@var{1|0} -Listen for an incoming connection. Default value is 0. +If set to 1, listen for an incoming connection. Default value is 0. @item timeout=@var{microseconds} Set raise error timeout, expressed in microseconds. @@ -1081,16 +1081,25 @@ Set raise error timeout, expressed in microseconds. This option is only relevant in read mode: if no data arrived in more than this time interval, raise error. -@item listen_timeout=@var{microseconds} -Set listen timeout, expressed in microseconds. +@item listen_timeout=@var{milliseconds} +Set listen timeout, expressed in milliseconds. + +The protocol agent will try to connect repeatedly until the timeout +value is reached. In case a value of -1 is specified, only one listen +connection attempt will be tried. Default value is -1. @end table -The following example shows how to setup a listening TCP connection -with @command{ffmpeg}, which is then accessed with @command{ffplay}: +@subsection Examples + +@itemize +@item +Setup a listening TCP connection with @command{ffmpeg}, which is then +accessed with @command{ffplay}: @example ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen ffplay tcp://@var{hostname}:@var{port} @end example +@end itemize @section tls diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 0aabc9d..ddc4a94 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -44,9 +44,9 @@ typedef struct TCPContext { #define D AV_OPT_FLAG_DECODING_PARAM #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - { "listen", "Listen for incoming connections", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, - { "timeout", "set timeout (in microseconds) of socket I/O operations", OFFSET(rw_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, - { "listen_timeout", "Connection awaiting timeout", OFFSET(listen_timeout), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, .flags = D|E }, + { "listen", "listen for incoming connections", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E }, + { "listen_timeout", "set connection awaiting timeout (in milliseconds)", OFFSET(listen_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D|E }, + { "timeout", "set timeout of socket I/O operations (in microseconds)", OFFSET(rw_timeout), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, D|E }, { NULL } }; -- 1.8.3.2
On Wed, Nov 12, 2014 at 7:14 AM, Stefano Sabatini <stefasab@gmail.com> wrote:
In particular, add an Examples section and correct the unit of the listen_timeout option value, from microseconds to milliseconds.
This is a huge mistake, and therefore needs to be backported to release branches as well.
--- doc/protocols.texi | 21 +++++++++++++++------ libavformat/tcp.c | 6 +++--- 2 files changed, 18 insertions(+), 9 deletions(-)
The change itself LGTM, although it would be great if someone double check the unit issue. [...] Timothy
On Wed, Nov 12, 2014 at 04:14:11PM +0100, Stefano Sabatini wrote:
In particular, add an Examples section and correct the unit of the listen_timeout option value, from microseconds to milliseconds. --- doc/protocols.texi | 21 +++++++++++++++------ libavformat/tcp.c | 6 +++--- 2 files changed, 18 insertions(+), 9 deletions(-)
probably ok indepenant of this, I suggest that all timeout values should be changed to proper SI units currently we have a mix of micro and milli seconds as shown by git grep '"timeout"' if the user writes -timeout 123ms that should result in 123 milli seconds [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB When the tyrant has disposed of foreign enemies by conquest or treaty, and there is nothing more to fear from them, then he is always stirring up some war or other, in order that the people may require a leader. -- Plato
participants (3)
-
Michael Niedermayer -
Stefano Sabatini -
Timothy Gu