aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/swfdec.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/swfdec.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/swfdec.c')
-rw-r--r--libavformat/swfdec.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index eb17e82e08..fa2435e0a0 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -181,21 +181,21 @@ static AVStream *create_new_audio_stream(AVFormatContext *s, int id, int info)
return NULL;
ast->id = id;
if (info & 1) {
- ast->codec->channels = 2;
- ast->codec->channel_layout = AV_CH_LAYOUT_STEREO;
+ ast->codecpar->channels = 2;
+ ast->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
- ast->codec->channels = 1;
- ast->codec->channel_layout = AV_CH_LAYOUT_MONO;
+ ast->codecpar->channels = 1;
+ ast->codecpar->channel_layout = AV_CH_LAYOUT_MONO;
}
- ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
- ast->codec->codec_id = ff_codec_get_id(swf_audio_codec_tags, info>>4 & 15);
+ ast->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
+ ast->codecpar->codec_id = ff_codec_get_id(swf_audio_codec_tags, info>>4 & 15);
ast->need_parsing = AVSTREAM_PARSE_FULL;
sample_rate_code = info>>2 & 3;
sample_size_code = info>>1 & 1;
- if (!sample_size_code && ast->codec->codec_id == AV_CODEC_ID_PCM_S16LE)
- ast->codec->codec_id = AV_CODEC_ID_PCM_U8;
- ast->codec->sample_rate = 44100 >> (3 - sample_rate_code);
- avpriv_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
+ if (!sample_size_code && ast->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE)
+ ast->codecpar->codec_id = AV_CODEC_ID_PCM_U8;
+ ast->codecpar->sample_rate = 44100 >> (3 - sample_rate_code);
+ avpriv_set_pts_info(ast, 64, 1, ast->codecpar->sample_rate);
return ast;
}
@@ -226,7 +226,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for (i=0; i<s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id)
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id)
goto skip;
}
@@ -239,8 +239,8 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
if (!vst)
return AVERROR(ENOMEM);
vst->id = ch_id;
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = ff_codec_get_id(ff_swf_codec_tags, avio_r8(pb));
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_id = ff_codec_get_id(ff_swf_codec_tags, avio_r8(pb));
avpriv_set_pts_info(vst, 16, 256, swf->frame_rate);
len -= 8;
} else if (tag == TAG_STREAMHEAD || tag == TAG_STREAMHEAD2) {
@@ -248,7 +248,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for (i=0; i<s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1)
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1)
goto skip;
}
@@ -265,7 +265,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for (i=0; i<s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == ch_id)
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->id == ch_id)
goto skip;
}
@@ -292,7 +292,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
len -= 2;
for(i=0; i<s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
frame = avio_rl16(pb);
len -= 2;
if (len <= 0)
@@ -368,7 +368,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && st->id == -3)
+ if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO && st->id == -3)
break;
}
if (i == s->nb_streams) {
@@ -378,17 +378,17 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
goto bitmap_end;
}
vst->id = -3; /* -3 to avoid clash with video stream and audio stream */
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO;
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
avpriv_set_pts_info(vst, 64, 256, swf->frame_rate);
st = vst;
}
if ((res = av_new_packet(pkt, out_len - colormapsize * colormapbpp)) < 0)
goto bitmap_end;
- if (!st->codec->width && !st->codec->height) {
- st->codec->width = width;
- st->codec->height = height;
+ if (!st->codecpar->width && !st->codecpar->height) {
+ st->codecpar->width = width;
+ st->codecpar->height = height;
} else {
ff_add_param_change(pkt, 0, 0, 0, width, height);
}
@@ -417,10 +417,10 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
default:
av_assert0(0);
}
- if (st->codec->pix_fmt != AV_PIX_FMT_NONE && st->codec->pix_fmt != pix_fmt) {
+ if (st->codecpar->format != AV_PIX_FMT_NONE && st->codecpar->format != pix_fmt) {
av_log(s, AV_LOG_ERROR, "pixel format change unsupported\n");
} else
- st->codec->pix_fmt = pix_fmt;
+ st->codecpar->format = pix_fmt;
if (linesize * height > pkt->size) {
res = AVERROR_INVALIDDATA;
@@ -443,8 +443,8 @@ bitmap_end_skip:
} else if (tag == TAG_STREAMBLOCK) {
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
- if (st->codec->codec_id == AV_CODEC_ID_MP3) {
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
+ if (st->codecpar->codec_id == AV_CODEC_ID_MP3) {
avio_skip(pb, 4);
len -= 4;
if (len <= 0)
@@ -465,7 +465,7 @@ bitmap_end_skip:
} else if (tag == TAG_JPEG2) {
for (i=0; i<s->nb_streams; i++) {
st = s->streams[i];
- if (st->codec->codec_id == AV_CODEC_ID_MJPEG && st->id == -2)
+ if (st->codecpar->codec_id == AV_CODEC_ID_MJPEG && st->id == -2)
break;
}
if (i == s->nb_streams) {
@@ -473,8 +473,8 @@ bitmap_end_skip:
if (!vst)
return AVERROR(ENOMEM);
vst->id = -2; /* -2 to avoid clash with video stream and audio stream */
- vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- vst->codec->codec_id = AV_CODEC_ID_MJPEG;
+ vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
+ vst->codecpar->codec_id = AV_CODEC_ID_MJPEG;
avpriv_set_pts_info(vst, 64, 256, swf->frame_rate);
st = vst;
}