aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mvdec.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/mvdec.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/mvdec.c')
-rw-r--r--libavformat/mvdec.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index 7aa6452f66..80ef4b1569 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -106,9 +106,9 @@ static int set_channels(AVFormatContext *avctx, AVStream *st, int channels)
av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid.\n", channels);
return AVERROR_INVALIDDATA;
}
- st->codec->channels = channels;
- st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO
- : AV_CH_LAYOUT_STEREO;
+ st->codecpar->channels = channels;
+ st->codecpar->channel_layout = (st->codecpar->channels == 1) ? AV_CH_LAYOUT_MONO
+ : AV_CH_LAYOUT_STEREO;
return 0;
}
@@ -156,10 +156,10 @@ static int parse_audio_var(AVFormatContext *avctx, AVStream *st,
} else if (!strcmp(name, "NUM_CHANNELS")) {
return set_channels(avctx, st, var_read_int(pb, size));
} else if (!strcmp(name, "SAMPLE_RATE")) {
- st->codec->sample_rate = var_read_int(pb, size);
- avpriv_set_pts_info(st, 33, 1, st->codec->sample_rate);
+ st->codecpar->sample_rate = var_read_int(pb, size);
+ avpriv_set_pts_info(st, 33, 1, st->codecpar->sample_rate);
} else if (!strcmp(name, "SAMPLE_WIDTH")) {
- st->codec->bits_per_coded_sample = var_read_int(pb, size) * 8;
+ st->codecpar->bits_per_coded_sample = var_read_int(pb, size) * 8;
} else
return AVERROR_INVALIDDATA;
@@ -181,16 +181,16 @@ static int parse_video_var(AVFormatContext *avctx, AVStream *st,
if (!str)
return AVERROR_INVALIDDATA;
if (!strcmp(str, "1")) {
- st->codec->codec_id = AV_CODEC_ID_MVC1;
+ st->codecpar->codec_id = AV_CODEC_ID_MVC1;
} else if (!strcmp(str, "2")) {
- st->codec->pix_fmt = AV_PIX_FMT_ABGR;
- st->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ st->codecpar->format = AV_PIX_FMT_ABGR;
+ st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
} else if (!strcmp(str, "3")) {
- st->codec->codec_id = AV_CODEC_ID_SGIRLE;
+ st->codecpar->codec_id = AV_CODEC_ID_SGIRLE;
} else if (!strcmp(str, "10")) {
- st->codec->codec_id = AV_CODEC_ID_MJPEG;
+ st->codecpar->codec_id = AV_CODEC_ID_MJPEG;
} else if (!strcmp(str, "MVC2")) {
- st->codec->codec_id = AV_CODEC_ID_MVC2;
+ st->codecpar->codec_id = AV_CODEC_ID_MVC2;
} else {
avpriv_request_sample(avctx, "Video compression %s", str);
}
@@ -200,18 +200,18 @@ static int parse_video_var(AVFormatContext *avctx, AVStream *st,
avpriv_set_pts_info(st, 64, fps.den, fps.num);
st->avg_frame_rate = fps;
} else if (!strcmp(name, "HEIGHT")) {
- st->codec->height = var_read_int(pb, size);
+ st->codecpar->height = var_read_int(pb, size);
} else if (!strcmp(name, "PIXEL_ASPECT")) {
st->sample_aspect_ratio = var_read_float(pb, size);
av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den,
st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
INT_MAX);
} else if (!strcmp(name, "WIDTH")) {
- st->codec->width = var_read_int(pb, size);
+ st->codecpar->width = var_read_int(pb, size);
} else if (!strcmp(name, "ORIENTATION")) {
if (var_read_int(pb, size) == 1101) {
- st->codec->extradata = av_strdup("BottomUp");
- st->codec->extradata_size = 9;
+ st->codecpar->extradata = av_strdup("BottomUp");
+ st->codecpar->extradata_size = 9;
}
} else if (!strcmp(name, "Q_SPATIAL") || !strcmp(name, "Q_TEMPORAL")) {
var_read_metadata(avctx, name, size);
@@ -259,8 +259,8 @@ static void read_index(AVIOContext *pb, AVStream *st)
uint32_t size = avio_rb32(pb);
avio_skip(pb, 8);
av_add_index_entry(st, pos, timestamp, size, 0, AVINDEX_KEYFRAME);
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
- timestamp += size / (st->codec->channels * 2);
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
+ timestamp += size / (st->codecpar->channels * 2);
} else {
timestamp++;
}
@@ -293,37 +293,37 @@ static int mv_read_header(AVFormatContext *avctx)
if (!vst)
return AVERROR(ENOMEM);
avpriv_set_pts_info(vst, 64, 1, 15);
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
vst->avg_frame_rate = av_inv_q(vst->time_base);
vst->nb_frames = avio_rb32(pb);
v = avio_rb32(pb);
switch (v) {
case 1:
- vst->codec->codec_id = AV_CODEC_ID_MVC1;
+ vst->codecpar->codec_id = AV_CODEC_ID_MVC1;
break;
case 2:
- vst->codec->pix_fmt = AV_PIX_FMT_ARGB;
- vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ vst->codecpar->format = AV_PIX_FMT_ARGB;
+ vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
break;
default:
avpriv_request_sample(avctx, "Video compression %i", v);
break;
}
- vst->codec->codec_tag = 0;
- vst->codec->width = avio_rb32(pb);
- vst->codec->height = avio_rb32(pb);
+ vst->codecpar->codec_tag = 0;
+ vst->codecpar->width = avio_rb32(pb);
+ vst->codecpar->height = avio_rb32(pb);
avio_skip(pb, 12);
- ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
ast->nb_frames = vst->nb_frames;
- ast->codec->sample_rate = avio_rb32(pb);
- avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate);
+ ast->codecpar->sample_rate = avio_rb32(pb);
+ avpriv_set_pts_info(ast, 33, 1, ast->codecpar->sample_rate);
if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
return AVERROR_INVALIDDATA;
v = avio_rb32(pb);
if (v == AUDIO_FORMAT_SIGNED) {
- ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16BE;
} else {
avpriv_request_sample(avctx, "Audio compression (format %i)", v);
}
@@ -341,7 +341,7 @@ static int mv_read_header(AVFormatContext *avctx)
avio_skip(pb, 8);
av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME);
av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME);
- timestamp += asize / (ast->codec->channels * 2);
+ timestamp += asize / (ast->codecpar->channels * 2);
}
} else if (!version && avio_rb16(pb) == 3) {
avio_skip(pb, 4);
@@ -356,21 +356,21 @@ static int mv_read_header(AVFormatContext *avctx)
ast = avformat_new_stream(avctx, NULL);
if (!ast)
return AVERROR(ENOMEM);
- ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
if ((read_table(avctx, ast, parse_audio_var)) < 0)
return ret;
if (mv->acompression == 100 &&
mv->aformat == AUDIO_FORMAT_SIGNED &&
- ast->codec->bits_per_coded_sample == 16) {
- ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE;
+ ast->codecpar->bits_per_coded_sample == 16) {
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_S16BE;
} else {
avpriv_request_sample(avctx,
"Audio compression %i (format %i, sr %i)",
mv->acompression, mv->aformat,
- ast->codec->bits_per_coded_sample);
- ast->codec->codec_id = AV_CODEC_ID_NONE;
+ ast->codecpar->bits_per_coded_sample);
+ ast->codecpar->codec_id = AV_CODEC_ID_NONE;
}
- if (ast->codec->channels <= 0) {
+ if (ast->codecpar->channels <= 0) {
av_log(avctx, AV_LOG_ERROR, "No valid channel count found.\n");
return AVERROR_INVALIDDATA;
}
@@ -383,7 +383,7 @@ static int mv_read_header(AVFormatContext *avctx)
vst = avformat_new_stream(avctx, NULL);
if (!vst)
return AVERROR(ENOMEM);
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
if ((ret = read_table(avctx, vst, parse_video_var))<0)
return ret;
}