aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/astenc.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/astenc.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/astenc.c')
-rw-r--r--libavformat/astenc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/libavformat/astenc.c b/libavformat/astenc.c
index cf7a12c95d..11f8717495 100644
--- a/libavformat/astenc.c
+++ b/libavformat/astenc.c
@@ -37,7 +37,7 @@ typedef struct ASTMuxContext {
#define CHECK_LOOP(type) \
if (ast->loop ## type > 0) { \
- ast->loop ## type = av_rescale_rnd(ast->loop ## type, enc->sample_rate, 1000, AV_ROUND_DOWN); \
+ ast->loop ## type = av_rescale_rnd(ast->loop ## type, par->sample_rate, 1000, AV_ROUND_DOWN); \
if (ast->loop ## type < 0 || ast->loop ## type > UINT_MAX) { \
av_log(s, AV_LOG_ERROR, "Invalid loop" #type " value\n"); \
return AVERROR(EINVAL); \
@@ -48,22 +48,22 @@ static int ast_write_header(AVFormatContext *s)
{
ASTMuxContext *ast = s->priv_data;
AVIOContext *pb = s->pb;
- AVCodecContext *enc;
+ AVCodecParameters *par;
unsigned int codec_tag;
if (s->nb_streams == 1) {
- enc = s->streams[0]->codec;
+ par = s->streams[0]->codecpar;
} else {
av_log(s, AV_LOG_ERROR, "only one stream is supported\n");
return AVERROR(EINVAL);
}
- if (enc->codec_id == AV_CODEC_ID_ADPCM_AFC) {
+ if (par->codec_id == AV_CODEC_ID_ADPCM_AFC) {
av_log(s, AV_LOG_ERROR, "muxing ADPCM AFC is not implemented\n");
return AVERROR_PATCHWELCOME;
}
- codec_tag = ff_codec_get_tag(ff_codec_ast_tags, enc->codec_id);
+ codec_tag = ff_codec_get_tag(ff_codec_ast_tags, par->codec_id);
if (!codec_tag) {
av_log(s, AV_LOG_ERROR, "unsupported codec\n");
return AVERROR(EINVAL);
@@ -84,9 +84,9 @@ static int ast_write_header(AVFormatContext *s)
avio_wb32(pb, 0); /* File size minus header */
avio_wb16(pb, codec_tag);
avio_wb16(pb, 16); /* Bit depth */
- avio_wb16(pb, enc->channels);
+ avio_wb16(pb, par->channels);
avio_wb16(pb, 0); /* Loop flag */
- avio_wb32(pb, enc->sample_rate);
+ avio_wb32(pb, par->sample_rate);
ast->samples = avio_tell(pb);
avio_wb32(pb, 0); /* Number of samples */
@@ -110,8 +110,8 @@ static int ast_write_packet(AVFormatContext *s, AVPacket *pkt)
{
AVIOContext *pb = s->pb;
ASTMuxContext *ast = s->priv_data;
- AVCodecContext *enc = s->streams[0]->codec;
- int size = pkt->size / enc->channels;
+ AVCodecParameters *par = s->streams[0]->codecpar;
+ int size = pkt->size / par->channels;
if (s->streams[0]->nb_frames == 0)
ast->fbs = size;
@@ -133,9 +133,9 @@ static int ast_write_trailer(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
ASTMuxContext *ast = s->priv_data;
- AVCodecContext *enc = s->streams[0]->codec;
+ AVCodecParameters *par = s->streams[0]->codecpar;
int64_t file_size = avio_tell(pb);
- int64_t samples = (file_size - 64 - (32 * s->streams[0]->nb_frames)) / enc->block_align; /* PCM_S16BE_PLANAR */
+ int64_t samples = (file_size - 64 - (32 * s->streams[0]->nb_frames)) / par->block_align; /* PCM_S16BE_PLANAR */
av_log(s, AV_LOG_DEBUG, "total samples: %"PRId64"\n", samples);