[FFmpeg-devel] [PATCH] [RFC]doc/examples: alternative input handler

Bodecs Bela bodecsb at vivanet.hu
Sun Apr 8 18:27:56 EEST 2018



2018.04.06. 0:39 keltezéssel, Michael Niedermayer írta:
> 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
ok
> I think this is complex enough that it needs a maintainer
>

May I take your response as you agree to inlcude this as an example app?



> [...]
>
>> +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"
yes, I will fix it
>
> also you are mixing EINVAL with AVERROR(ENOMEM) these arent compatible.
> Either all should be AVERROR or none
ok, should I will modify EIVAL all of them to AVERROR(EINVAL)?

>
> thx
>
> [...]
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
thank you,

bb



More information about the ffmpeg-devel mailing list