summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2015-11-03 10:16:01 -0800
committerJohn Stebbins <[email protected]>2015-11-09 14:35:20 -0800
commit75549414927212d4d1666730133805b33447de79 (patch)
treec606d08822a64de68152ac42acae4e0921ebba73 /libhb
parent6d66bd598d2e292acdfd1addeb3a1fd38e62e82b (diff)
muxavformat: add support for mp4 fallback audio signalling
Diffstat (limited to 'libhb')
-rw-r--r--libhb/muxavformat.c52
1 files changed, 51 insertions, 1 deletions
diff --git a/libhb/muxavformat.c b/libhb/muxavformat.c
index 0d7059775..373c2ab75 100644
--- a/libhb/muxavformat.c
+++ b/libhb/muxavformat.c
@@ -121,7 +121,7 @@ static int avformatInit( hb_mux_object_t * m )
hb_mux_data_t * track;
int meta_mux;
int max_tracks;
- int ii, ret;
+ int ii, jj, ret;
int clock_min, clock_max, clock;
hb_video_framerate_get_limits(&clock_min, &clock_max, &clock);
@@ -589,6 +589,56 @@ static int avformatInit( hb_mux_object_t * m )
}
}
+ // Check for audio track associations
+ for (ii = 0; ii < hb_list_count(job->list_audio); ii++)
+ {
+ audio = hb_list_item(job->list_audio, ii);
+ switch (audio->config.out.codec & HB_ACODEC_MASK)
+ {
+ case HB_ACODEC_FFAAC:
+ case HB_ACODEC_CA_AAC:
+ case HB_ACODEC_CA_HAAC:
+ case HB_ACODEC_FDK_AAC:
+ case HB_ACODEC_FDK_HAAC:
+ break;
+
+ default:
+ {
+ // Mark associated fallback audio tracks for any non-aac track
+ for(jj = 0; jj < hb_list_count( job->list_audio ); jj++ )
+ {
+ hb_audio_t * fallback;
+ int codec;
+
+ if (ii == jj) continue;
+
+ fallback = hb_list_item( job->list_audio, jj );
+ codec = fallback->config.out.codec & HB_ACODEC_MASK;
+ if (fallback->config.in.track == audio->config.in.track &&
+ (codec == HB_ACODEC_FFAAC ||
+ codec == HB_ACODEC_CA_AAC ||
+ codec == HB_ACODEC_CA_HAAC ||
+ codec == HB_ACODEC_FDK_AAC ||
+ codec == HB_ACODEC_FDK_HAAC))
+ {
+ hb_mux_data_t * fallback_track;
+ int * sd;
+
+ track = audio->priv.mux_data;
+ fallback_track = fallback->priv.mux_data;
+ sd = (int*)av_stream_new_side_data(track->st,
+ AV_PKT_DATA_FALLBACK_TRACK,
+ sizeof(int));
+ if (sd != NULL)
+ {
+ *sd = fallback_track->st->index;
+ }
+ }
+ }
+ } break;
+ }
+ }
+
char * subidx_fmt =
"size: %dx%d\n"
"org: %d, %d\n"