[FFmpeg-devel] [PATCH 3/8] decklink: Introduce support for capture of multiple audio streams

Devin Heitmueller dheitmueller at ltnglobal.com
Fri Dec 29 23:14:04 EET 2017


Hi Carl,

> On Dec 29, 2017, at 3:55 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 
> 2017-12-29 19:12 GMT+01:00 Devin Heitmueller <dheitmueller at ltnglobal.com>:
> 
>> +        for (int i = 0; i < ctx->max_audio_channels / 2; i++) {
>> +            st = avformat_new_stream(avctx, NULL);
>> +            if (!st) {
>> +                av_log(avctx, AV_LOG_ERROR, "Cannot add stream %d\n", i);
>> +                ret = AVERROR(ENOMEM);
>> +                goto error;
>> +            }
>> +            st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
>> +            st->codecpar->codec_id    = ctx->audio_depth == 32 ?
>> AV_CODEC_ID_PCM_S32LE : AV_CODEC_ID_PCM_S16LE;
>> +            st->codecpar->sample_rate = bmdAudioSampleRate48kHz;
>> +            st->codecpar->channels    = 2;
>> +            avpriv_set_pts_info(st, 64, 1, 1000000);  /* 64 bits pts in us */
>> +            ctx->audio_st[i] = st;
>> +            ctx->num_audio_streams++;
>> +        }
> 
> I would have expected that the channel_layout is set to STEREO in
> this case, is that not always true?

I’m not sure I understand your comment.  Is there some channel layout property of the codec parameters I should be setting?

For the moment, it’s true that we’re only supporting capturing stereo pairs.  But coming down the pipe is support for compressed audio over SDI pairs, as well as more complex layouts which involve discrete 5.1 or 7.1 channels.  This patch is a stepping stone to that (I’ve designed it with those use cases in mind, even though I haven’t implemented them yet).

For example, it’s not uncommon to have a series of SDI pairs such as the following:

SDI channels 1-6 contain discrete 5.1 audio as PCM
SDI channels 7-8 contain a stereo PCM pair with a second language
SDI channels 9-10 contain a compressed 5.1 AC-3 stream.

This patch doesn’t let you do the above, but it’s working in that direction.

Devin


More information about the ffmpeg-devel mailing list