[FFmpeg-devel] [PATCH] lavf/tcp: apply minor fixes to documentation

Stefano Sabatini stefasab at gmail.com
Wed Nov 12 16:14:11 CET 2014


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.
+ at 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.
 
- at item listen_timeout=@var{microseconds}
-Set listen timeout, expressed in microseconds.
+ at 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}:
+ at subsection Examples
+
+ at itemize
+ at 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
+ at 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



More information about the ffmpeg-devel mailing list