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

Carl Eugen Hoyos ceffmpeg at gmail.com
Fri Dec 29 23:17:06 EET 2017


2017-12-29 22:14 GMT+01:00 Devin Heitmueller <dheitmueller at ltnglobal.com>:
> 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?

Yes, AVCodecParameters->channel_layout.

Carl Eugen


More information about the ffmpeg-devel mailing list