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 /libavformat/bintext.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 'libavformat/bintext.c')
-rw-r--r-- | libavformat/bintext.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/libavformat/bintext.c b/libavformat/bintext.c index 217ea49247..3a24c811ef 100644 --- a/libavformat/bintext.c +++ b/libavformat/bintext.c @@ -54,12 +54,12 @@ static AVStream * init_stream(AVFormatContext *s) AVStream *st = avformat_new_stream(s, NULL); if (!st) return NULL; - st->codec->codec_tag = 0; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->codec_tag = 0; + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; if (!bin->width) { - st->codec->width = (80<<3); - st->codec->height = (25<<4); + st->codecpar->width = (80<<3); + st->codecpar->height = (25<<4); } avpriv_set_pts_info(st, 60, bin->framerate.den, bin->framerate.num); @@ -74,9 +74,9 @@ static AVStream * init_stream(AVFormatContext *s) /** * Given filesize and width, calculate height (assume font_height of 16) */ -static void calculate_height(AVCodecContext *avctx, uint64_t fsize) +static void calculate_height(AVCodecParameters *par, uint64_t fsize) { - avctx->height = (fsize / ((avctx->width>>3)*2)) << 4; + par->height = (fsize / ((par->width>>3)*2)) << 4; } #endif @@ -119,11 +119,11 @@ static int next_tag_read(AVFormatContext *avctx, uint64_t *fsize) return 0; } -static void predict_width(AVCodecContext *avctx, uint64_t fsize, int got_width) +static void predict_width(AVCodecParameters *par, uint64_t fsize, int got_width) { /** attempt to guess width */ if (!got_width) - avctx->width = fsize > 4000 ? (160<<3) : (80<<3); + par->width = fsize > 4000 ? (160<<3) : (80<<3); } static int bintext_read_header(AVFormatContext *s) @@ -134,12 +134,12 @@ static int bintext_read_header(AVFormatContext *s) AVStream *st = init_stream(s); if (!st) return AVERROR(ENOMEM); - st->codec->codec_id = AV_CODEC_ID_BINTEXT; + st->codecpar->codec_id = AV_CODEC_ID_BINTEXT; - if (ff_alloc_extradata(st->codec, 2)) + if (ff_alloc_extradata(st->codecpar, 2)) return AVERROR(ENOMEM); - st->codec->extradata[0] = 16; - st->codec->extradata[1] = 0; + st->codecpar->extradata[0] = 16; + st->codecpar->extradata[1] = 0; if (pb->seekable) { int got_width = 0; @@ -147,8 +147,8 @@ static int bintext_read_header(AVFormatContext *s) if (ff_sauce_read(s, &bin->fsize, &got_width, 0) < 0) next_tag_read(s, &bin->fsize); if (!bin->width) { - predict_width(st->codec, bin->fsize, got_width); - calculate_height(st->codec, bin->fsize); + predict_width(st->codecpar, bin->fsize, got_width); + calculate_height(st->codecpar, bin->fsize); } avio_seek(pb, 0, SEEK_SET); } @@ -179,30 +179,30 @@ static int xbin_read_header(AVFormatContext *s) return AVERROR(ENOMEM); avio_skip(pb, 5); - st->codec->width = avio_rl16(pb)<<3; - st->codec->height = avio_rl16(pb); + st->codecpar->width = avio_rl16(pb)<<3; + st->codecpar->height = avio_rl16(pb); fontheight = avio_r8(pb); - st->codec->height *= fontheight; + st->codecpar->height *= fontheight; flags = avio_r8(pb); - st->codec->extradata_size = 2; + st->codecpar->extradata_size = 2; if ((flags & BINTEXT_PALETTE)) - st->codec->extradata_size += 48; + st->codecpar->extradata_size += 48; if ((flags & BINTEXT_FONT)) - st->codec->extradata_size += fontheight * (flags & 0x10 ? 512 : 256); - st->codec->codec_id = flags & 4 ? AV_CODEC_ID_XBIN : AV_CODEC_ID_BINTEXT; + st->codecpar->extradata_size += fontheight * (flags & 0x10 ? 512 : 256); + st->codecpar->codec_id = flags & 4 ? AV_CODEC_ID_XBIN : AV_CODEC_ID_BINTEXT; - if (ff_alloc_extradata(st->codec, st->codec->extradata_size)) + if (ff_alloc_extradata(st->codecpar, st->codecpar->extradata_size)) return AVERROR(ENOMEM); - st->codec->extradata[0] = fontheight; - st->codec->extradata[1] = flags; - if (avio_read(pb, st->codec->extradata + 2, st->codec->extradata_size - 2) < 0) + st->codecpar->extradata[0] = fontheight; + st->codecpar->extradata[1] = flags; + if (avio_read(pb, st->codecpar->extradata + 2, st->codecpar->extradata_size - 2) < 0) return AVERROR(EIO); if (pb->seekable) { - bin->fsize = avio_size(pb) - 9 - st->codec->extradata_size; + bin->fsize = avio_size(pb) - 9 - st->codecpar->extradata_size; ff_sauce_read(s, &bin->fsize, NULL, 0); - avio_seek(pb, 9 + st->codec->extradata_size, SEEK_SET); + avio_seek(pb, 9 + st->codecpar->extradata_size, SEEK_SET); } return 0; @@ -222,28 +222,28 @@ static int adf_read_header(AVFormatContext *s) st = init_stream(s); if (!st) return AVERROR(ENOMEM); - st->codec->codec_id = AV_CODEC_ID_BINTEXT; + st->codecpar->codec_id = AV_CODEC_ID_BINTEXT; - if (ff_alloc_extradata(st->codec, 2 + 48 + 4096)) + if (ff_alloc_extradata(st->codecpar, 2 + 48 + 4096)) return AVERROR(ENOMEM); - st->codec->extradata[0] = 16; - st->codec->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT; + st->codecpar->extradata[0] = 16; + st->codecpar->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT; - if (avio_read(pb, st->codec->extradata + 2, 24) < 0) + if (avio_read(pb, st->codecpar->extradata + 2, 24) < 0) return AVERROR(EIO); avio_skip(pb, 144); - if (avio_read(pb, st->codec->extradata + 2 + 24, 24) < 0) + if (avio_read(pb, st->codecpar->extradata + 2 + 24, 24) < 0) return AVERROR(EIO); - if (avio_read(pb, st->codec->extradata + 2 + 48, 4096) < 0) + if (avio_read(pb, st->codecpar->extradata + 2 + 48, 4096) < 0) return AVERROR(EIO); if (pb->seekable) { int got_width = 0; bin->fsize = avio_size(pb) - 1 - 192 - 4096; - st->codec->width = 80<<3; + st->codecpar->width = 80<<3; ff_sauce_read(s, &bin->fsize, &got_width, 0); if (!bin->width) - calculate_height(st->codec, bin->fsize); + calculate_height(st->codecpar, bin->fsize); avio_seek(pb, 1 + 192 + 4096, SEEK_SET); } return 0; @@ -277,24 +277,24 @@ static int idf_read_header(AVFormatContext *s) st = init_stream(s); if (!st) return AVERROR(ENOMEM); - st->codec->codec_id = AV_CODEC_ID_IDF; + st->codecpar->codec_id = AV_CODEC_ID_IDF; - if (ff_alloc_extradata(st->codec, 2 + 48 + 4096)) + if (ff_alloc_extradata(st->codecpar, 2 + 48 + 4096)) return AVERROR(ENOMEM); - st->codec->extradata[0] = 16; - st->codec->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT; + st->codecpar->extradata[0] = 16; + st->codecpar->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT; avio_seek(pb, avio_size(pb) - 4096 - 48, SEEK_SET); - if (avio_read(pb, st->codec->extradata + 2 + 48, 4096) < 0) + if (avio_read(pb, st->codecpar->extradata + 2 + 48, 4096) < 0) return AVERROR(EIO); - if (avio_read(pb, st->codec->extradata + 2, 48) < 0) + if (avio_read(pb, st->codecpar->extradata + 2, 48) < 0) return AVERROR(EIO); bin->fsize = avio_size(pb) - 12 - 4096 - 48; ff_sauce_read(s, &bin->fsize, &got_width, 0); if (!bin->width) - calculate_height(st->codec, bin->fsize); + calculate_height(st->codecpar, bin->fsize); avio_seek(pb, 12, SEEK_SET); return 0; } |