diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-04-10 20:58:15 +0100 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-04-10 20:59:55 +0100 |
commit | 6f69f7a8bf6a0d013985578df2ef42ee6b1c7994 (patch) | |
tree | 0c2ec8349ff1763d5f48454b8b9f26374dbd80b0 /libavdevice/v4l2enc.c | |
parent | 60b75186b2c878b6257b43c8fcc0b1356ada218e (diff) | |
parent | 9200514ad8717c63f82101dc394f4378854325bf (diff) | |
download | ffmpeg-6f69f7a8bf6a0d013985578df2ef42ee6b1c7994.tar.gz |
Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
lavf: replace AVStream.codec with AVStream.codecpar
This has been a HUGE effort from:
- Derek Buitenhuis <derek.buitenhuis@gmail.com>
- Hendrik Leppkes <h.leppkes@gmail.com>
- wm4 <nfxjfg@googlemail.com>
- Clément Bœsch <clement@stupeflix.com>
- James Almer <jamrial@gmail.com>
- Michael Niedermayer <michael@niedermayer.cc>
- Rostislav Pehlivanov <atomnuker@gmail.com>
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavdevice/v4l2enc.c')
-rw-r--r-- | libavdevice/v4l2enc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavdevice/v4l2enc.c b/libavdevice/v4l2enc.c index ac4068cbd4..faf6e07f86 100644 --- a/libavdevice/v4l2enc.c +++ b/libavdevice/v4l2enc.c @@ -33,7 +33,7 @@ static av_cold int write_header(AVFormatContext *s1) .type = V4L2_BUF_TYPE_VIDEO_OUTPUT }; V4L2Context *s = s1->priv_data; - AVCodecContext *enc_ctx; + AVCodecParameters *par; uint32_t v4l2_pixfmt; if (s1->flags & AVFMT_FLAG_NONBLOCK) @@ -47,19 +47,19 @@ static av_cold int write_header(AVFormatContext *s1) } if (s1->nb_streams != 1 || - s1->streams[0]->codec->codec_type != AVMEDIA_TYPE_VIDEO || - s1->streams[0]->codec->codec_id != AV_CODEC_ID_RAWVIDEO) { + s1->streams[0]->codecpar->codec_type != AVMEDIA_TYPE_VIDEO || + s1->streams[0]->codecpar->codec_id != AV_CODEC_ID_RAWVIDEO) { av_log(s1, AV_LOG_ERROR, "V4L2 output device supports only a single raw video stream\n"); return AVERROR(EINVAL); } - enc_ctx = s1->streams[0]->codec; + par = s1->streams[0]->codecpar; - v4l2_pixfmt = ff_fmt_ff2v4l(enc_ctx->pix_fmt, AV_CODEC_ID_RAWVIDEO); + v4l2_pixfmt = ff_fmt_ff2v4l(par->format, AV_CODEC_ID_RAWVIDEO); if (!v4l2_pixfmt) { // XXX: try to force them one by one? av_log(s1, AV_LOG_ERROR, "Unknown V4L2 pixel format equivalent for %s\n", - av_get_pix_fmt_name(enc_ctx->pix_fmt)); + av_get_pix_fmt_name(par->format)); return AVERROR(EINVAL); } @@ -69,10 +69,10 @@ static av_cold int write_header(AVFormatContext *s1) return res; } - fmt.fmt.pix.width = enc_ctx->width; - fmt.fmt.pix.height = enc_ctx->height; + fmt.fmt.pix.width = par->width; + fmt.fmt.pix.height = par->height; fmt.fmt.pix.pixelformat = v4l2_pixfmt; - fmt.fmt.pix.sizeimage = av_image_get_buffer_size(enc_ctx->pix_fmt, enc_ctx->width, enc_ctx->height, 1); + fmt.fmt.pix.sizeimage = av_image_get_buffer_size(par->format, par->width, par->height, 1); if (ioctl(s->fd, VIDIOC_S_FMT, &fmt) < 0) { res = AVERROR(errno); |