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/smacker.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/smacker.c')
-rw-r--r-- | libavformat/smacker.c | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/libavformat/smacker.c b/libavformat/smacker.c index de8bbdb07a..8a21cc0767 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -175,12 +175,12 @@ static int smacker_read_header(AVFormatContext *s) if (!st) return AVERROR(ENOMEM); smk->videoindex = st->index; - st->codec->width = smk->width; - st->codec->height = smk->height; - st->codec->pix_fmt = AV_PIX_FMT_PAL8; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = AV_CODEC_ID_SMACKVIDEO; - st->codec->codec_tag = smk->magic; + st->codecpar->width = smk->width; + st->codecpar->height = smk->height; + st->codecpar->format = AV_PIX_FMT_PAL8; + st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; + st->codecpar->codec_id = AV_CODEC_ID_SMACKVIDEO; + st->codecpar->codec_tag = smk->magic; /* Smacker uses 100000 as internal timebase */ if(smk->pts_inc < 0) smk->pts_inc = -smk->pts_inc; @@ -198,36 +198,36 @@ static int smacker_read_header(AVFormatContext *s) if (!ast[i]) return AVERROR(ENOMEM); smk->indexes[i] = ast[i]->index; - ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; + ast[i]->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; if (smk->aflags[i] & SMK_AUD_BINKAUD) { - ast[i]->codec->codec_id = AV_CODEC_ID_BINKAUDIO_RDFT; + ast[i]->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_RDFT; } else if (smk->aflags[i] & SMK_AUD_USEDCT) { - ast[i]->codec->codec_id = AV_CODEC_ID_BINKAUDIO_DCT; + ast[i]->codecpar->codec_id = AV_CODEC_ID_BINKAUDIO_DCT; } else if (smk->aflags[i] & SMK_AUD_PACKED){ - ast[i]->codec->codec_id = AV_CODEC_ID_SMACKAUDIO; - ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A'); + ast[i]->codecpar->codec_id = AV_CODEC_ID_SMACKAUDIO; + ast[i]->codecpar->codec_tag = MKTAG('S', 'M', 'K', 'A'); } else { - ast[i]->codec->codec_id = AV_CODEC_ID_PCM_U8; + ast[i]->codecpar->codec_id = AV_CODEC_ID_PCM_U8; } if (smk->aflags[i] & SMK_AUD_STEREO) { - ast[i]->codec->channels = 2; - ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO; + ast[i]->codecpar->channels = 2; + ast[i]->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; } else { - ast[i]->codec->channels = 1; - ast[i]->codec->channel_layout = AV_CH_LAYOUT_MONO; + ast[i]->codecpar->channels = 1; + ast[i]->codecpar->channel_layout = AV_CH_LAYOUT_MONO; } - ast[i]->codec->sample_rate = smk->rates[i]; - ast[i]->codec->bits_per_coded_sample = (smk->aflags[i] & SMK_AUD_16BITS) ? 16 : 8; - if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == AV_CODEC_ID_PCM_U8) - ast[i]->codec->codec_id = AV_CODEC_ID_PCM_S16LE; - avpriv_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate - * ast[i]->codec->channels * ast[i]->codec->bits_per_coded_sample / 8); + ast[i]->codecpar->sample_rate = smk->rates[i]; + ast[i]->codecpar->bits_per_coded_sample = (smk->aflags[i] & SMK_AUD_16BITS) ? 16 : 8; + if(ast[i]->codecpar->bits_per_coded_sample == 16 && ast[i]->codecpar->codec_id == AV_CODEC_ID_PCM_U8) + ast[i]->codecpar->codec_id = AV_CODEC_ID_PCM_S16LE; + avpriv_set_pts_info(ast[i], 64, 1, ast[i]->codecpar->sample_rate + * ast[i]->codecpar->channels * ast[i]->codecpar->bits_per_coded_sample / 8); } } /* load trees to extradata, they will be unpacked by decoder */ - if(ff_alloc_extradata(st->codec, smk->treesize + 16)){ + if(ff_alloc_extradata(st->codecpar, smk->treesize + 16)){ av_log(s, AV_LOG_ERROR, "Cannot allocate %"PRIu32" bytes of extradata\n", smk->treesize + 16); @@ -235,16 +235,16 @@ static int smacker_read_header(AVFormatContext *s) av_freep(&smk->frm_flags); return AVERROR(ENOMEM); } - ret = avio_read(pb, st->codec->extradata + 16, st->codec->extradata_size - 16); - if(ret != st->codec->extradata_size - 16){ + ret = avio_read(pb, st->codecpar->extradata + 16, st->codecpar->extradata_size - 16); + if(ret != st->codecpar->extradata_size - 16){ av_freep(&smk->frm_size); av_freep(&smk->frm_flags); return AVERROR(EIO); } - ((int32_t*)st->codec->extradata)[0] = av_le2ne32(smk->mmap_size); - ((int32_t*)st->codec->extradata)[1] = av_le2ne32(smk->mclr_size); - ((int32_t*)st->codec->extradata)[2] = av_le2ne32(smk->full_size); - ((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size); + ((int32_t*)st->codecpar->extradata)[0] = av_le2ne32(smk->mmap_size); + ((int32_t*)st->codecpar->extradata)[1] = av_le2ne32(smk->mclr_size); + ((int32_t*)st->codecpar->extradata)[2] = av_le2ne32(smk->full_size); + ((int32_t*)st->codecpar->extradata)[3] = av_le2ne32(smk->type_size); smk->curstream = -1; smk->nextpos = avio_tell(pb); |