diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c index 4dac3f9cb4..833bca3b06 100644 --- a/libavdevice/alsa-audio-dec.c +++ b/libavdevice/alsa-audio-dec.c @@ -79,7 +79,7 @@ static av_cold int audio_read_header(AVFormatContext *s1, return AVERROR(ENOMEM); } sample_rate = ap->sample_rate; - codec_id = ap->audio_codec_id; + codec_id = s1->audio_codec_id; ret = ff_alsa_open(s1, SND_PCM_STREAM_CAPTURE, &sample_rate, ap->channels, &codec_id); diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index a9ffe3acd6..36c8d66c6b 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -552,7 +552,7 @@ static uint32_t device_try_init(AVFormatContext *s1, int *height, enum CodecID *codec_id) { - uint32_t desired_format = fmt_ff2v4l(ap->pix_fmt, ap->video_codec_id); + uint32_t desired_format = fmt_ff2v4l(ap->pix_fmt, s1->video_codec_id); if (desired_format == 0 || device_init(s1, width, height, desired_format) < 0) { @@ -560,8 +560,8 @@ static uint32_t device_try_init(AVFormatContext *s1, desired_format = 0; for (i = 0; ivideo_codec_id == CODEC_ID_NONE || - fmt_conversion_table[i].codec_id == ap->video_codec_id) { + if (s1->video_codec_id == CODEC_ID_NONE || + fmt_conversion_table[i].codec_id == s1->video_codec_id) { desired_format = fmt_conversion_table[i].v4l2_fmt; if (device_init(s1, width, height, desired_format) >= 0) { break; @@ -617,7 +617,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) desired_format = device_try_init(s1, ap, &width, &height, &codec_id); if (desired_format == 0) { av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for " - "codec_id %d, pix_fmt %d.\n", ap->video_codec_id, ap->pix_fmt); + "codec_id %d, pix_fmt %d.\n", s1->video_codec_id, ap->pix_fmt); close(s->fd); return AVERROR(EIO); diff --git a/libavformat/img2.c b/libavformat/img2.c index 9fb8bc4cbf..124f135ddb 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -232,12 +232,12 @@ static int img_read_header(AVFormatContext *s1, AVFormatParameters *ap) st->duration = last_index - first_index + 1; } - if(ap->video_codec_id){ + if(s1->video_codec_id){ st->codec->codec_type = CODEC_TYPE_VIDEO; - st->codec->codec_id = ap->video_codec_id; - }else if(ap->audio_codec_id){ + st->codec->codec_id = s1->video_codec_id; + }else if(s1->audio_codec_id){ st->codec->codec_type = CODEC_TYPE_AUDIO; - st->codec->codec_id = ap->audio_codec_id; + st->codec->codec_id = s1->audio_codec_id; }else{ st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = av_str2id(img_tags, s->path);