diff options
author | Diego Biurrun <diego@biurrun.de> | 2016-05-11 15:26:02 +0200 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2016-05-17 11:16:26 +0200 |
commit | b8de14bcdf876c7e236a6dd2ad35342ff4b42cf8 (patch) | |
tree | 7e999ca67c836f181696a442d4394f65206ac1d5 /tools/ismindex.c | |
parent | 393596f9d51134d6e45d81ae129223f4faea1232 (diff) | |
download | ffmpeg-b8de14bcdf876c7e236a6dd2ad35342ff4b42cf8.tar.gz |
tools: Port to codec parameters API
Diffstat (limited to 'tools/ismindex.c')
-rw-r--r-- | tools/ismindex.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/tools/ismindex.c b/tools/ismindex.c index 71bb36bf53..3d7e082b6d 100644 --- a/tools/ismindex.c +++ b/tools/ismindex.c @@ -450,40 +450,40 @@ fail: return err; } -static int get_private_data(struct Track *track, AVCodecContext *codec) +static int get_private_data(struct Track *track, AVCodecParameters *codecpar) { - track->codec_private_size = codec->extradata_size; - track->codec_private = av_mallocz(codec->extradata_size); + track->codec_private_size = codecpar->extradata_size; + track->codec_private = av_mallocz(codecpar->extradata_size); if (!track->codec_private) return AVERROR(ENOMEM); - memcpy(track->codec_private, codec->extradata, codec->extradata_size); + memcpy(track->codec_private, codecpar->extradata, codecpar->extradata_size); return 0; } -static int get_video_private_data(struct Track *track, AVCodecContext *codec) +static int get_video_private_data(struct Track *track, AVCodecParameters *codecpar) { AVIOContext *io = NULL; uint16_t sps_size, pps_size; int err; - if (codec->codec_id == AV_CODEC_ID_VC1) - return get_private_data(track, codec); + if (codecpar->codec_id == AV_CODEC_ID_VC1) + return get_private_data(track, codecpar); if ((err = avio_open_dyn_buf(&io)) < 0) goto fail; err = AVERROR(EINVAL); - if (codec->extradata_size < 11 || codec->extradata[0] != 1) + if (codecpar->extradata_size < 11 || codecpar->extradata[0] != 1) goto fail; - sps_size = AV_RB16(&codec->extradata[6]); - if (11 + sps_size > codec->extradata_size) + sps_size = AV_RB16(&codecpar->extradata[6]); + if (11 + sps_size > codecpar->extradata_size) goto fail; avio_wb32(io, 0x00000001); - avio_write(io, &codec->extradata[8], sps_size); - pps_size = AV_RB16(&codec->extradata[9 + sps_size]); - if (11 + sps_size + pps_size > codec->extradata_size) + avio_write(io, &codecpar->extradata[8], sps_size); + pps_size = AV_RB16(&codecpar->extradata[9 + sps_size]); + if (11 + sps_size + pps_size > codecpar->extradata_size) goto fail; avio_wb32(io, 0x00000001); - avio_write(io, &codec->extradata[11 + sps_size], pps_size); + avio_write(io, &codecpar->extradata[11 + sps_size], pps_size); err = 0; fail: @@ -523,7 +523,7 @@ static int handle_file(struct Tracks *tracks, const char *file, int split, struct Track **temp; AVStream *st = ctx->streams[i]; - if (st->codec->bit_rate == 0) { + if (st->codecpar->bit_rate == 0) { fprintf(stderr, "Skipping track %d in %s as it has zero bitrate\n", st->id, file); continue; @@ -548,12 +548,12 @@ static int handle_file(struct Tracks *tracks, const char *file, int split, if ((ptr = strrchr(file, '/'))) track->name = ptr + 1; - track->bitrate = st->codec->bit_rate; + track->bitrate = st->codecpar->bit_rate; track->track_id = st->id; track->timescale = st->time_base.den; track->duration = st->duration; - track->is_audio = st->codec->codec_type == AVMEDIA_TYPE_AUDIO; - track->is_video = st->codec->codec_type == AVMEDIA_TYPE_VIDEO; + track->is_audio = st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; + track->is_video = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO; if (!track->is_audio && !track->is_video) { fprintf(stderr, @@ -571,30 +571,30 @@ static int handle_file(struct Tracks *tracks, const char *file, int split, if (tracks->audio_track < 0) tracks->audio_track = tracks->nb_tracks; tracks->nb_audio_tracks++; - track->channels = st->codec->channels; - track->sample_rate = st->codec->sample_rate; - if (st->codec->codec_id == AV_CODEC_ID_AAC) { + track->channels = st->codecpar->channels; + track->sample_rate = st->codecpar->sample_rate; + if (st->codecpar->codec_id == AV_CODEC_ID_AAC) { track->fourcc = "AACL"; track->tag = 255; track->blocksize = 4; - } else if (st->codec->codec_id == AV_CODEC_ID_WMAPRO) { + } else if (st->codecpar->codec_id == AV_CODEC_ID_WMAPRO) { track->fourcc = "WMAP"; - track->tag = st->codec->codec_tag; - track->blocksize = st->codec->block_align; + track->tag = st->codecpar->codec_tag; + track->blocksize = st->codecpar->block_align; } - get_private_data(track, st->codec); + get_private_data(track, st->codecpar); } if (track->is_video) { if (tracks->video_track < 0) tracks->video_track = tracks->nb_tracks; tracks->nb_video_tracks++; - track->width = st->codec->width; - track->height = st->codec->height; - if (st->codec->codec_id == AV_CODEC_ID_H264) + track->width = st->codecpar->width; + track->height = st->codecpar->height; + if (st->codecpar->codec_id == AV_CODEC_ID_H264) track->fourcc = "H264"; - else if (st->codec->codec_id == AV_CODEC_ID_VC1) + else if (st->codecpar->codec_id == AV_CODEC_ID_VC1) track->fourcc = "WVC1"; - get_video_private_data(track, st->codec); + get_video_private_data(track, st->codecpar); } tracks->nb_tracks++; |