[FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler
Michael Niedermayer
michael at niedermayer.cc
Fri Apr 6 01:39:18 EEST 2018
On Fri, Mar 30, 2018 at 02:47:25PM +0200, Bodecs Bela wrote:
> Hi All,
>
> regularly, on different forums and mailing lists a requirement popups for a
> feature to automatically failover switching between main input and a
> secondary input in case of main input unavailability.
>
> The base motivation: let's say you have a unreliable live stream source and
> you
> want to transcode its video and audio streams in realtime but you
> want to survive the ocasions when the source is unavailable. So use a
> secondary live source but the transition should occur seamlessly without
> breaking/re-starting the transcoding processs.
>
> Some days ago there was a discussion on devel-irc about this topic and we
> concluded that this feature is not feasible inside ffmpeg without "hacking",
> but a separate client app could do this.
>
> So I created this example app to handle two separate input sources and
> switching realtime between them. I am not sure wheter it should be inside
> the tools subdir.
>
> The detailed description is available in the header section of the source
> file.
>
> I will appretiate your suggestions about it.
>
> Thank you in advance.
>
> best,
>
> Bela Bodecs
>
>
> configure | 2
> doc/examples/Makefile | 1
> doc/examples/Makefile.example | 1
> doc/examples/alternative_input.c | 1233 +++++++++++++++++++++++++++++++++++++++
You may want to add yourself to MAINTAINERS, so it is not unmaintained
I think this is complex enough that it needs a maintainer
[...]
> +static int open_single_input(int input_index)
> +{
> + int ret, i;
> + AVInputFormat *input_format = NULL;
> + AVDictionary * input_options = NULL;
> + AVFormatContext * input_fmt_ctx = NULL;
> +
> + if (app_ctx.input_format_names[input_index]) {
> + if (!(input_format = av_find_input_format(app_ctx.input_format_names[input_index]))) {
> + timed_log(AV_LOG_ERROR, "Input #%d Unknown input format: '%s'\n", input_index,
> + app_ctx.input_format_names[input_index]);
> + return EINVAL;
> + }
> + }
> +
> + av_dict_set(&input_options, "rw_timeout", "2000000", 0);
> + av_dict_set(&input_options, "timeout", "2000", 0);
> + if ((app_ctx.input_fmt_ctx[input_index] = avformat_alloc_context()) < 0)
> + return AVERROR(ENOMEM);
i guess this was intended to be "!= NULL"
also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
Either all should be AVERROR or none
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No great genius has ever existed without some touch of madness. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180406/13d11b51/attachment.sig>
More information about the ffmpeg-devel
mailing list