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/img2dec.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/img2dec.c')
-rw-r--r-- | libavformat/img2dec.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c index 6864374897..8dfb8138ad 100644 --- a/libavformat/img2dec.c +++ b/libavformat/img2dec.c @@ -221,8 +221,8 @@ int ff_img_read_header(AVFormatContext *s1) avpriv_set_pts_info(st, 64, s->framerate.den, s->framerate.num); if (s->width && s->height) { - st->codec->width = s->width; - st->codec->height = s->height; + st->codecpar->width = s->width; + st->codecpar->height = s->height; } if (!s->is_pipe) { @@ -307,18 +307,18 @@ int ff_img_read_header(AVFormatContext *s1) } if (s1->video_codec_id) { - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = s1->video_codec_id; + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->codec_id = s1->video_codec_id; } else if (s1->audio_codec_id) { - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = s1->audio_codec_id; + st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; + st->codecpar->codec_id = s1->audio_codec_id; } else if (s1->iformat->raw_codec_id) { - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = s1->iformat->raw_codec_id; + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->codec_id = s1->iformat->raw_codec_id; } else { const char *str = strrchr(s->path, '.'); s->split_planes = str && !av_strcasecmp(str + 1, "y"); - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; if (s1->pb) { int probe_buffer_size = 2048; uint8_t *probe_buffer = av_realloc(NULL, probe_buffer_size + AVPROBE_PADDING_SIZE); @@ -346,7 +346,7 @@ int ff_img_read_header(AVFormatContext *s1) !fmt->raw_codec_id) continue; if (fmt->read_probe(&pd) > 0) { - st->codec->codec_id = fmt->raw_codec_id; + st->codecpar->codec_id = fmt->raw_codec_id; break; } } @@ -355,16 +355,16 @@ int ff_img_read_header(AVFormatContext *s1) } else ffio_rewind_with_probe_data(s1->pb, &probe_buffer, probe_buffer_size); } - if (st->codec->codec_id == AV_CODEC_ID_NONE) - st->codec->codec_id = ff_guess_image2_codec(s->path); - if (st->codec->codec_id == AV_CODEC_ID_LJPEG) - st->codec->codec_id = AV_CODEC_ID_MJPEG; - if (st->codec->codec_id == AV_CODEC_ID_ALIAS_PIX) // we cannot distingiush this from BRENDER_PIX - st->codec->codec_id = AV_CODEC_ID_NONE; + if (st->codecpar->codec_id == AV_CODEC_ID_NONE) + st->codecpar->codec_id = ff_guess_image2_codec(s->path); + if (st->codecpar->codec_id == AV_CODEC_ID_LJPEG) + st->codecpar->codec_id = AV_CODEC_ID_MJPEG; + if (st->codecpar->codec_id == AV_CODEC_ID_ALIAS_PIX) // we cannot distingiush this from BRENDER_PIX + st->codecpar->codec_id = AV_CODEC_ID_NONE; } - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && pix_fmt != AV_PIX_FMT_NONE) - st->codec->pix_fmt = pix_fmt; + st->codecpar->format = pix_fmt; return 0; } @@ -377,7 +377,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) int i, res; int size[3] = { 0 }, ret[3] = { 0 }; AVIOContext *f[3] = { NULL }; - AVCodecContext *codec = s1->streams[0]->codec; + AVCodecParameters *par = s1->streams[0]->codecpar; if (!s->is_pipe) { /* loop over input */ @@ -418,7 +418,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) filename[strlen(filename) - 1] = 'U' + i; } - if (codec->codec_id == AV_CODEC_ID_NONE) { + if (par->codec_id == AV_CODEC_ID_NONE) { AVProbeData pd = { 0 }; AVInputFormat *ifmt; uint8_t header[PROBE_BUF_MIN + AVPROBE_PADDING_SIZE]; @@ -436,11 +436,11 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt) ifmt = av_probe_input_format3(&pd, 1, &score); if (ifmt && ifmt->read_packet == ff_img_read_packet && ifmt->raw_codec_id) - codec->codec_id = ifmt->raw_codec_id; + par->codec_id = ifmt->raw_codec_id; } - if (codec->codec_id == AV_CODEC_ID_RAWVIDEO && !codec->width) - infer_size(&codec->width, &codec->height, size[0]); + if (par->codec_id == AV_CODEC_ID_RAWVIDEO && !par->width) + infer_size(&par->width, &par->height, size[0]); } else { f[0] = s1->pb; if (avio_feof(f[0]) && s->loop && s->is_pipe) |