Lines 351-365
static gboolean
Link Here
|
351 |
settings_changed (GstFFMpegAudDec * ffmpegdec, AVFrame * frame) |
351 |
settings_changed (GstFFMpegAudDec * ffmpegdec, AVFrame * frame) |
352 |
{ |
352 |
{ |
353 |
GstAudioFormat format; |
353 |
GstAudioFormat format; |
354 |
gint channels = |
354 |
gint channels = av_get_channel_layout_nb_channels (frame->channel_layout); |
355 |
av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame)); |
|
|
356 |
|
355 |
|
357 |
format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); |
356 |
format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); |
358 |
if (format == GST_AUDIO_FORMAT_UNKNOWN) |
357 |
if (format == GST_AUDIO_FORMAT_UNKNOWN) |
359 |
return TRUE; |
358 |
return TRUE; |
360 |
|
359 |
|
361 |
return !(ffmpegdec->info.rate == |
360 |
return !(ffmpegdec->info.rate == |
362 |
av_frame_get_sample_rate (frame) && |
361 |
frame->sample_rate && |
363 |
ffmpegdec->info.channels == channels && |
362 |
ffmpegdec->info.channels == channels && |
364 |
ffmpegdec->info.finfo->format == format); |
363 |
ffmpegdec->info.finfo->format == format); |
365 |
} |
364 |
} |
Lines 378-387
gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
Link Here
|
378 |
format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); |
377 |
format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); |
379 |
if (format == GST_AUDIO_FORMAT_UNKNOWN) |
378 |
if (format == GST_AUDIO_FORMAT_UNKNOWN) |
380 |
goto no_caps; |
379 |
goto no_caps; |
381 |
channels = |
380 |
channels = av_get_channel_layout_nb_channels (frame->channel_layout); |
382 |
av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame)); |
|
|
383 |
if (channels == 0) |
381 |
if (channels == 0) |
384 |
channels = av_frame_get_channels (frame); |
|
|
385 |
if (channels == 0) |
386 |
goto no_caps; |
382 |
goto no_caps; |
387 |
|
383 |
|
Lines 389-399
gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
Link Here
|
389 |
GST_DEBUG_OBJECT (ffmpegdec, |
387 |
GST_DEBUG_OBJECT (ffmpegdec, |
390 |
"Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)", |
388 |
"Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)", |
391 |
ffmpegdec->info.rate, ffmpegdec->info.channels, |
389 |
ffmpegdec->info.rate, ffmpegdec->info.channels, |
392 |
ffmpegdec->info.finfo->format, av_frame_get_sample_rate (frame), channels, |
390 |
ffmpegdec->info.finfo->format, frame->sample_rate, channels, format); |
393 |
format); |
|
|
394 |
|
391 |
|
395 |
gst_ffmpeg_channel_layout_to_gst (av_frame_get_channel_layout (frame), |
392 |
gst_ffmpeg_channel_layout_to_gst (frame->channel_layout, channels, pos); |
396 |
channels, pos); |
|
|
397 |
memcpy (ffmpegdec->ffmpeg_layout, pos, |
393 |
memcpy (ffmpegdec->ffmpeg_layout, pos, |
398 |
sizeof (GstAudioChannelPosition) * channels); |
394 |
sizeof (GstAudioChannelPosition) * channels); |
399 |
|
395 |
|
Lines 402-408
gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
Link Here
|
402 |
ffmpegdec->needs_reorder = |
398 |
ffmpegdec->needs_reorder = |
403 |
memcmp (pos, ffmpegdec->ffmpeg_layout, sizeof (pos[0]) * channels) != 0; |
399 |
memcmp (pos, ffmpegdec->ffmpeg_layout, sizeof (pos[0]) * channels) != 0; |
404 |
gst_audio_info_set_format (&ffmpegdec->info, format, |
400 |
gst_audio_info_set_format (&ffmpegdec->info, format, |
405 |
av_frame_get_sample_rate (frame), channels, pos); |
401 |
frame->sample_rate, channels, pos); |
406 |
|
402 |
|
407 |
if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec), |
403 |
if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec), |
408 |
&ffmpegdec->info)) |
404 |
&ffmpegdec->info)) |