aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Kern <kernrj@gmail.com>2016-05-05 09:08:02 -0400
committerThilo Borgmann <thilo.borgmann@mail.de>2016-05-05 16:03:45 +0200
commitf1560dbb2a0089d63ca61a324673f7e2e30fb517 (patch)
treedbe4eb03cd8f263bb0a4d4c42dc3fc205328d02a
parent5b174dd3f133387688be96eaead1ca0e15cc74f5 (diff)
downloadffmpeg-f1560dbb2a0089d63ca61a324673f7e2e30fb517.tar.gz
lavd/avfoundation: use AVCodecParameters
Fixes "Could not find codec parameters for stream" error (#5494) Signed-off-by: Rick Kern <kernrj@gmail.com>
-rw-r--r--libavdevice/avfoundation.m26
1 files changed, 13 insertions, 13 deletions
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 763e675766..8132278bdf 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -560,11 +560,11 @@ static int get_video_config(AVFormatContext *s)
image_buffer = CMSampleBufferGetImageBuffer(ctx->current_frame);
image_buffer_size = CVImageBufferGetEncodedSize(image_buffer);
- stream->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- stream->codec->width = (int)image_buffer_size.width;
- stream->codec->height = (int)image_buffer_size.height;
- stream->codec->pix_fmt = ctx->pixel_format;
+ stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ stream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ stream->codecpar->width = (int)image_buffer_size.width;
+ stream->codecpar->height = (int)image_buffer_size.height;
+ stream->codecpar->format = ctx->pixel_format;
CFRelease(ctx->current_frame);
ctx->current_frame = nil;
@@ -603,10 +603,10 @@ static int get_audio_config(AVFormatContext *s)
return 1;
}
- stream->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- stream->codec->sample_rate = basic_desc->mSampleRate;
- stream->codec->channels = basic_desc->mChannelsPerFrame;
- stream->codec->channel_layout = av_get_default_channel_layout(stream->codec->channels);
+ stream->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ stream->codecpar->sample_rate = basic_desc->mSampleRate;
+ stream->codecpar->channels = basic_desc->mChannelsPerFrame;
+ stream->codecpar->channel_layout = av_get_default_channel_layout(stream->codecpar->channels);
ctx->audio_channels = basic_desc->mChannelsPerFrame;
ctx->audio_bits_per_sample = basic_desc->mBitsPerChannel;
@@ -620,22 +620,22 @@ static int get_audio_config(AVFormatContext *s)
ctx->audio_float &&
ctx->audio_bits_per_sample == 32 &&
ctx->audio_packed) {
- stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE;
+ stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE;
} else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
ctx->audio_signed_integer &&
ctx->audio_bits_per_sample == 16 &&
ctx->audio_packed) {
- stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE;
+ stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE;
} else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
ctx->audio_signed_integer &&
ctx->audio_bits_per_sample == 24 &&
ctx->audio_packed) {
- stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE;
+ stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE;
} else if (basic_desc->mFormatID == kAudioFormatLinearPCM &&
ctx->audio_signed_integer &&
ctx->audio_bits_per_sample == 32 &&
ctx->audio_packed) {
- stream->codec->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
+ stream->codecpar->codec_id = ctx->audio_be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE;
} else {
av_log(s, AV_LOG_ERROR, "audio format is not supported\n");
return 1;