diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2015-11-22 17:41:51 +0000 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2015-11-22 17:41:51 +0000 |
commit | 64db3639af7bfe9a5eec6755daf4e52556f3c141 (patch) | |
tree | f82936e5b506f6a440cb0497a5b1b8663e6155b6 | |
parent | fe20e34b139fde727d23c7f50c310e11567bcc5f (diff) | |
parent | ca489564ae150bc41764f175b88151d883e69ae0 (diff) | |
download | ffmpeg-64db3639af7bfe9a5eec6755daf4e52556f3c141.tar.gz |
Merge commit 'ca489564ae150bc41764f175b88151d883e69ae0'
* commit 'ca489564ae150bc41764f175b88151d883e69ae0':
movenc: add fallback audio track tref support
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavformat/movenc.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 372c41f800..dc84c628bc 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3201,10 +3201,21 @@ static int mov_write_moov_tag(AVIOContext *pb, MOVMuxContext *mov, mov->tracks[i].tref_id = mov->tracks[mov->chapter_track].track_id; } for (i = 0; i < mov->nb_streams; i++) { - if (mov->tracks[i].tag == MKTAG('r','t','p',' ')) { - mov->tracks[i].tref_tag = MKTAG('h','i','n','t'); - mov->tracks[i].tref_id = - mov->tracks[mov->tracks[i].src_track].track_id; + MOVTrack *track = &mov->tracks[i]; + if (track->tag == MKTAG('r','t','p',' ')) { + track->tref_tag = MKTAG('h','i','n','t'); + track->tref_id = mov->tracks[track->src_track].track_id; + } else if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO) { + int * fallback, size; + fallback = (int*)av_stream_get_side_data(track->st, + AV_PKT_DATA_FALLBACK_TRACK, + &size); + if (fallback != NULL && size == sizeof(int)) { + if (*fallback >= 0 && *fallback < mov->nb_streams) { + track->tref_tag = MKTAG('f','a','l','l'); + track->tref_id = mov->tracks[*fallback].track_id; + } + } } } for (i = 0; i < mov->nb_streams; i++) { |