X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavdevice%2Fv4l2.c;h=103fb105f2789c53b484a45ec7dc79fcf3fc52fd;hb=c29ac4abb8183513555ff2ee90666c6eac7cbf4f;hp=383033e738936590cb918a784733d768fe297bda;hpb=b9aa4ccff51598553cfc81b619b8c2bef26c1413;p=ffmpeg diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 383033e7389..103fb105f27 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -938,8 +938,8 @@ static int v4l2_read_header(AVFormatContext *ctx) if ((res = v4l2_set_parameters(ctx)) < 0) goto fail; - st->codec->pix_fmt = ff_fmt_v4l2ff(desired_format, codec_id); - s->frame_size = av_image_get_buffer_size(st->codec->pix_fmt, + st->codecpar->format = ff_fmt_v4l2ff(desired_format, codec_id); + s->frame_size = av_image_get_buffer_size(st->codecpar->format, s->width, s->height, 1); if ((res = mmap_init(ctx)) || @@ -948,22 +948,22 @@ static int v4l2_read_header(AVFormatContext *ctx) s->top_field_first = first_field(s); - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = codec_id; + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->codec_id = codec_id; if (codec_id == AV_CODEC_ID_RAWVIDEO) - st->codec->codec_tag = - avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); + st->codecpar->codec_tag = + avcodec_pix_fmt_to_codec_tag(st->codecpar->format); else if (codec_id == AV_CODEC_ID_H264) { st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; } if (desired_format == V4L2_PIX_FMT_YVU420) - st->codec->codec_tag = MKTAG('Y', 'V', '1', '2'); + st->codecpar->codec_tag = MKTAG('Y', 'V', '1', '2'); else if (desired_format == V4L2_PIX_FMT_YVU410) - st->codec->codec_tag = MKTAG('Y', 'V', 'U', '9'); - st->codec->width = s->width; - st->codec->height = s->height; + st->codecpar->codec_tag = MKTAG('Y', 'V', 'U', '9'); + st->codecpar->width = s->width; + st->codecpar->height = s->height; if (st->avg_frame_rate.den) - st->codec->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8; + st->codecpar->bit_rate = s->frame_size * av_q2d(st->avg_frame_rate) * 8; return 0;