On Tue, Apr 12, 2016 at 08:46:29PM +0300, sebechlebsky...@gmail.com wrote:
> From: Jan Sebechlebsky <sebechlebsky...@gmail.com>
> 
> Adds per slave option 'onfail' to the tee muxer allowing an output to
> fail,so other slave outputs can continue.
> 
> Signed-off-by: Jan Sebechlebsky <sebechlebsky...@gmail.com>
> ---
>  doc/muxers.texi   |  14 ++++++++
>  libavformat/tee.c | 102 
> +++++++++++++++++++++++++++++++++++++++++++++---------
>  2 files changed, 100 insertions(+), 16 deletions(-)
> 
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 2aafbad..2d63083 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1372,6 +1372,12 @@ Select the streams that should be mapped to the slave 
> output,
>  specified by a stream specifier. If not specified, this defaults to
>  all the input streams. You may use multiple stream specifiers
>  separated by commas (@code{,}) e.g.: @code{a:0,v}
> +
> +@item onfail
> +Specify behaviour on output failure. This can be set to either @code{abort} 
> (which is
> +default) or @code{ignore}. @code{abort} will cause whole process to fail in 
> case of failure
> +on this slave output. @code{ignore} will ignore failure on this output, so 
> other outputs
> +will continue without being affected.
>  @end table
>  
>  @subsection Examples
> @@ -1386,6 +1392,14 @@ ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v 
> -map 0:a
>  @end example
>  
>  @item
> +As above, but continue streaming even if output to local file fails
> +(for example local drive fills up):
> +@example
> +ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
> +  "[onfail=ignore]archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
> +@end example
> +
> +@item
>  Use @command{ffmpeg} to encode the input, and send the output
>  to three different destinations. The @code{dump_extra} bitstream
>  filter is used to add extradata information to all the output video
> diff --git a/libavformat/tee.c b/libavformat/tee.c
> index 222826a..5f8c121 100644
> --- a/libavformat/tee.c
> +++ b/libavformat/tee.c
> @@ -29,10 +29,19 @@
>  
>  #define MAX_SLAVES 16
>  
> +typedef enum {
> +    ON_SLAVE_FAILURE_ABORT  = 1,
> +    ON_SLAVE_FAILURE_IGNORE = 2
> +} SlaveFailurePolicy;
> +
> +#define DEFAULT_SLAVE_FAILURE_POLICY ON_SLAVE_FAILURE_ABORT
> +
>  typedef struct {
>      AVFormatContext *avf;
>      AVBitStreamFilterContext **bsfs; ///< bitstream filters per stream
>  
> +    SlaveFailurePolicy on_fail;
> +
>      /** map from input to output streams indexes,
>       * disabled output streams are set to -1 */
>      int *stream_map;

[...]

> @@ -198,6 +220,17 @@ static int open_slave(AVFormatContext *avf, char *slave, 
> TeeSlave *tee_slave)
>  
>      STEAL_OPTION("f", format);
>      STEAL_OPTION("select", select);
> +    STEAL_OPTION("onfail", on_fail);
> +
> +    tee_slave->on_fail = parse_slave_failure_policy_option(on_fail);
> +    if (tee_slave->on_fail < 0) {

on_fail is a enum made of purely positive values it and may not be
able to represent negative values

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates

Attachment: signature.asc
Description: Digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to