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/webmdashenc.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/webmdashenc.c')
-rw-r--r-- | libavformat/webmdashenc.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c index 301c045b41..d4b3146790 100644 --- a/libavformat/webmdashenc.c +++ b/libavformat/webmdashenc.c @@ -152,17 +152,17 @@ static int bitstream_switching(AVFormatContext *s, AdaptationSet *as) { int i; AVDictionaryEntry *gold_track_num = av_dict_get(s->streams[as->streams[0]]->metadata, TRACK_NUMBER, NULL, 0); - AVCodecContext *gold_codec = s->streams[as->streams[0]]->codec; + AVCodecParameters *gold_par = s->streams[as->streams[0]]->codecpar; if (!gold_track_num) return 0; for (i = 1; i < as->nb_streams; i++) { AVDictionaryEntry *track_num = av_dict_get(s->streams[as->streams[i]]->metadata, TRACK_NUMBER, NULL, 0); - AVCodecContext *codec = s->streams[as->streams[i]]->codec; + AVCodecParameters *par = s->streams[as->streams[i]]->codecpar; if (!track_num || strncmp(gold_track_num->value, track_num->value, strlen(gold_track_num->value)) || - gold_codec->codec_id != codec->codec_id || - gold_codec->extradata_size != codec->extradata_size || - memcmp(gold_codec->extradata, codec->extradata, codec->extradata_size)) { + gold_par->codec_id != par->codec_id || + gold_par->extradata_size != par->extradata_size || + memcmp(gold_par->extradata, par->extradata, par->extradata_size)) { return 0; } } @@ -189,18 +189,18 @@ static int write_representation(AVFormatContext *s, AVStream *stream, char *id, avio_printf(s->pb, "<Representation id=\"%s\"", id); // FIXME: For live, This should be obtained from the input file or as an AVOption. avio_printf(s->pb, " bandwidth=\"%s\"", - w->is_live ? (stream->codec->codec_type == AVMEDIA_TYPE_AUDIO ? "128000" : "1000000") : bandwidth->value); - if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO && output_width) - avio_printf(s->pb, " width=\"%d\"", stream->codec->width); - if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO && output_height) - avio_printf(s->pb, " height=\"%d\"", stream->codec->height); - if (stream->codec->codec_type == AVMEDIA_TYPE_AUDIO && output_sample_rate) - avio_printf(s->pb, " audioSamplingRate=\"%d\"", stream->codec->sample_rate); + w->is_live ? (stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? "128000" : "1000000") : bandwidth->value); + if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && output_width) + avio_printf(s->pb, " width=\"%d\"", stream->codecpar->width); + if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && output_height) + avio_printf(s->pb, " height=\"%d\"", stream->codecpar->height); + if (stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && output_sample_rate) + avio_printf(s->pb, " audioSamplingRate=\"%d\"", stream->codecpar->sample_rate); if (w->is_live) { // For live streams, Codec and Mime Type always go in the Representation tag. - avio_printf(s->pb, " codecs=\"%s\"", get_codec_name(stream->codec->codec_id)); + avio_printf(s->pb, " codecs=\"%s\"", get_codec_name(stream->codecpar->codec_id)); avio_printf(s->pb, " mimeType=\"%s/webm\"", - stream->codec->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); + stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); // For live streams, subsegments always start with key frames. So this // is always 1. avio_printf(s->pb, " startsWithSAP=\"1\""); @@ -224,9 +224,9 @@ static int write_representation(AVFormatContext *s, AVStream *stream, char *id, static int check_matching_width(AVFormatContext *s, AdaptationSet *as) { int first_width, i; if (as->nb_streams < 2) return 1; - first_width = s->streams[as->streams[0]]->codec->width; + first_width = s->streams[as->streams[0]]->codecpar->width; for (i = 1; i < as->nb_streams; i++) - if (first_width != s->streams[as->streams[i]]->codec->width) + if (first_width != s->streams[as->streams[i]]->codecpar->width) return 0; return 1; } @@ -237,9 +237,9 @@ static int check_matching_width(AVFormatContext *s, AdaptationSet *as) { static int check_matching_height(AVFormatContext *s, AdaptationSet *as) { int first_height, i; if (as->nb_streams < 2) return 1; - first_height = s->streams[as->streams[0]]->codec->height; + first_height = s->streams[as->streams[0]]->codecpar->height; for (i = 1; i < as->nb_streams; i++) - if (first_height != s->streams[as->streams[i]]->codec->height) + if (first_height != s->streams[as->streams[i]]->codecpar->height) return 0; return 1; } @@ -250,9 +250,9 @@ static int check_matching_height(AVFormatContext *s, AdaptationSet *as) { static int check_matching_sample_rate(AVFormatContext *s, AdaptationSet *as) { int first_sample_rate, i; if (as->nb_streams < 2) return 1; - first_sample_rate = s->streams[as->streams[0]]->codec->sample_rate; + first_sample_rate = s->streams[as->streams[0]]->codecpar->sample_rate; for (i = 1; i < as->nb_streams; i++) - if (first_sample_rate != s->streams[as->streams[i]]->codec->sample_rate) + if (first_sample_rate != s->streams[as->streams[i]]->codecpar->sample_rate) return 0; return 1; } @@ -319,7 +319,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index) { WebMDashMuxContext *w = s->priv_data; AdaptationSet *as = &w->as[as_index]; - AVCodecContext *codec = s->streams[as->streams[0]]->codec; + AVCodecParameters *par = s->streams[as->streams[0]]->codecpar; AVDictionaryEntry *lang; int i; static const char boolean[2][6] = { "false", "true" }; @@ -330,7 +330,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index) // on their respective Representation tag. For live streams, they always go // in the Representation tag. int width_in_as = 1, height_in_as = 1, sample_rate_in_as = 1; - if (codec->codec_type == AVMEDIA_TYPE_VIDEO) { + if (par->codec_type == AVMEDIA_TYPE_VIDEO) { width_in_as = !w->is_live && check_matching_width(s, as); height_in_as = !w->is_live && check_matching_height(s, as); } else { @@ -339,18 +339,18 @@ static int write_adaptation_set(AVFormatContext *s, int as_index) avio_printf(s->pb, "<AdaptationSet id=\"%s\"", as->id); avio_printf(s->pb, " mimeType=\"%s/webm\"", - codec->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); - avio_printf(s->pb, " codecs=\"%s\"", get_codec_name(codec->codec_id)); + par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); + avio_printf(s->pb, " codecs=\"%s\"", get_codec_name(par->codec_id)); lang = av_dict_get(s->streams[as->streams[0]]->metadata, "language", NULL, 0); if (lang) avio_printf(s->pb, " lang=\"%s\"", lang->value); - if (codec->codec_type == AVMEDIA_TYPE_VIDEO && width_in_as) - avio_printf(s->pb, " width=\"%d\"", codec->width); - if (codec->codec_type == AVMEDIA_TYPE_VIDEO && height_in_as) - avio_printf(s->pb, " height=\"%d\"", codec->height); - if (codec->codec_type == AVMEDIA_TYPE_AUDIO && sample_rate_in_as) - avio_printf(s->pb, " audioSamplingRate=\"%d\"", codec->sample_rate); + if (par->codec_type == AVMEDIA_TYPE_VIDEO && width_in_as) + avio_printf(s->pb, " width=\"%d\"", par->width); + if (par->codec_type == AVMEDIA_TYPE_VIDEO && height_in_as) + avio_printf(s->pb, " height=\"%d\"", par->height); + if (par->codec_type == AVMEDIA_TYPE_AUDIO && sample_rate_in_as) + avio_printf(s->pb, " audioSamplingRate=\"%d\"", par->sample_rate); avio_printf(s->pb, " bitstreamSwitching=\"%s\"", boolean[bitstream_switching(s, as)]); @@ -374,7 +374,7 @@ static int write_adaptation_set(AVFormatContext *s, int as_index) &media_pattern); if (ret) return ret; avio_printf(s->pb, "<ContentComponent id=\"1\" type=\"%s\"/>\n", - codec->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); + par->codec_type == AVMEDIA_TYPE_VIDEO ? "video" : "audio"); avio_printf(s->pb, "<SegmentTemplate"); avio_printf(s->pb, " timescale=\"1000\""); avio_printf(s->pb, " duration=\"%d\"", w->chunk_duration); |