aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mlvdec.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:58:15 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:59:55 +0100
commit6f69f7a8bf6a0d013985578df2ef42ee6b1c7994 (patch)
tree0c2ec8349ff1763d5f48454b8b9f26374dbd80b0 /libavformat/mlvdec.c
parent60b75186b2c878b6257b43c8fcc0b1356ada218e (diff)
parent9200514ad8717c63f82101dc394f4378854325bf (diff)
downloadffmpeg-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 'libavformat/mlvdec.c')
-rw-r--r--libavformat/mlvdec.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 288b2a1010..665b28d4f8 100644
--- a/libavformat/mlvdec.c
+++ b/libavformat/mlvdec.c
@@ -130,32 +130,32 @@ static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int f
break;
size -= 16;
if (vst && type == MKTAG('R','A','W','I') && size >= 164) {
- vst->codec->width = avio_rl16(pb);
- vst->codec->height = avio_rl16(pb);
- ret = av_image_check_size(vst->codec->width, vst->codec->height, 0, avctx);
+ vst->codecpar->width = avio_rl16(pb);
+ vst->codecpar->height = avio_rl16(pb);
+ ret = av_image_check_size(vst->codecpar->width, vst->codecpar->height, 0, avctx);
if (ret < 0)
return ret;
if (avio_rl32(pb) != 1)
avpriv_request_sample(avctx, "raw api version");
avio_skip(pb, 20); // pointer, width, height, pitch, frame_size
- vst->codec->bits_per_coded_sample = avio_rl32(pb);
- if (vst->codec->bits_per_coded_sample < 0 ||
- vst->codec->bits_per_coded_sample > (INT_MAX - 7) / (vst->codec->width * vst->codec->height)) {
+ vst->codecpar->bits_per_coded_sample = avio_rl32(pb);
+ if (vst->codecpar->bits_per_coded_sample < 0 ||
+ vst->codecpar->bits_per_coded_sample > (INT_MAX - 7) / (vst->codecpar->width * vst->codecpar->height)) {
av_log(avctx, AV_LOG_ERROR,
"invalid bits_per_coded_sample %d (size: %dx%d)\n",
- vst->codec->bits_per_coded_sample,
- vst->codec->width, vst->codec->height);
+ vst->codecpar->bits_per_coded_sample,
+ vst->codecpar->width, vst->codecpar->height);
return AVERROR_INVALIDDATA;
}
avio_skip(pb, 8 + 16 + 24); // black_level, white_level, xywh, active_area, exposure_bias
if (avio_rl32(pb) != 0x2010100) /* RGGB */
avpriv_request_sample(avctx, "cfa_pattern");
avio_skip(pb, 80); // calibration_illuminant1, color_matrix1, dynamic_range
- vst->codec->pix_fmt = AV_PIX_FMT_BAYER_RGGB16LE;
- vst->codec->codec_tag = MKTAG('B', 'I', 'T', 16);
+ vst->codecpar->format = AV_PIX_FMT_BAYER_RGGB16LE;
+ vst->codecpar->codec_tag = MKTAG('B', 'I', 'T', 16);
size -= 164;
} else if (ast && type == MKTAG('W', 'A', 'V', 'I') && size >= 16) {
- ret = ff_get_wav_header(avctx, pb, ast->codec, 16, 0);
+ ret = ff_get_wav_header(avctx, pb, ast->codecpar, 16, 0);
if (ret < 0)
return ret;
size -= 16;
@@ -286,23 +286,23 @@ static int read_header(AVFormatContext *avctx)
vst->nb_frames = nb_video_frames;
if ((mlv->class[0] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA)))
avpriv_request_sample(avctx, "compression");
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
switch (mlv->class[0] & ~(MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA)) {
case MLV_VIDEO_CLASS_RAW:
- vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
break;
case MLV_VIDEO_CLASS_YUV:
- vst->codec->pix_fmt = AV_PIX_FMT_YUV420P;
- vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
- vst->codec->codec_tag = 0;
+ vst->codecpar->format = AV_PIX_FMT_YUV420P;
+ vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ vst->codecpar->codec_tag = 0;
break;
case MLV_VIDEO_CLASS_JPEG:
- vst->codec->codec_id = AV_CODEC_ID_MJPEG;
- vst->codec->codec_tag = 0;
+ vst->codecpar->codec_id = AV_CODEC_ID_MJPEG;
+ vst->codecpar->codec_tag = 0;
break;
case MLV_VIDEO_CLASS_H264:
- vst->codec->codec_id = AV_CODEC_ID_H264;
- vst->codec->codec_tag = 0;
+ vst->codecpar->codec_id = AV_CODEC_ID_H264;
+ vst->codecpar->codec_tag = 0;
break;
default:
avpriv_request_sample(avctx, "unknown video class");
@@ -320,8 +320,8 @@ static int read_header(AVFormatContext *avctx)
if ((mlv->class[1] & ~MLV_CLASS_FLAG_LZMA) != MLV_AUDIO_CLASS_WAV)
avpriv_request_sample(avctx, "unknown audio class");
- ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate);
+ ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
}
if (vst) {
@@ -413,15 +413,15 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt)
if (size < 16)
return AVERROR_INVALIDDATA;
avio_skip(pb, 12); //timestamp, frameNumber
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
avio_skip(pb, 8); // cropPosX, cropPosY, panPosX, panPosY
space = avio_rl32(pb);
avio_skip(pb, space);
if ((mlv->class[st->id] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA))) {
ret = AVERROR_PATCHWELCOME;
- } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
- ret = av_get_packet(pb, pkt, (st->codec->width * st->codec->height * st->codec->bits_per_coded_sample + 7) >> 3);
+ } else if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+ ret = av_get_packet(pb, pkt, (st->codecpar->width * st->codecpar->height * st->codecpar->bits_per_coded_sample + 7) >> 3);
} else { // AVMEDIA_TYPE_AUDIO
if (space > UINT_MAX - 24 || size < (24 + space))
return AVERROR_INVALIDDATA;