Commit 4f670add by aquilescanta Committed by Oliver Woodman

Add support for AC-3 streams in HLS

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131398594
parent e48462d5
......@@ -296,14 +296,18 @@
"name": "HLS",
"samples": [
{
"name": "Apple master playlist",
"name": "Apple 4x3 basic stream",
"uri": "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8"
},
{
"name": "Apple master playlist advanced",
"name": "Apple 16x9 basic stream",
"uri": "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/bipbop_16x9_variant.m3u8"
},
{
"name": "Apple master playlist advanced",
"uri": "https://tungsten.aaplimg.com/VOD/bipbop_adv_example_v2/master.m3u8"
},
{
"name": "Apple TS media playlist",
"uri": "https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear1/prog_index.m3u8"
},
......
......@@ -22,6 +22,7 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.extractor.Extractor;
import com.google.android.exoplayer2.extractor.mp3.Mp3Extractor;
import com.google.android.exoplayer2.extractor.ts.Ac3Extractor;
import com.google.android.exoplayer2.extractor.ts.AdtsExtractor;
import com.google.android.exoplayer2.extractor.ts.PtsTimestampAdjuster;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;
......@@ -63,6 +64,7 @@ public class HlsChunkSource {
private static final double LIVE_VARIANT_SWITCH_SAFETY_EXTRA_SECS = 2.0;
private static final String TAG = "HlsChunkSource";
private static final String AAC_FILE_EXTENSION = ".aac";
private static final String AC3_FILE_EXTENSION = ".ac3";
private static final String MP3_FILE_EXTENSION = ".mp3";
private static final String VTT_FILE_EXTENSION = ".vtt";
private static final String WEBVTT_FILE_EXTENSION = ".webvtt";
......@@ -286,6 +288,8 @@ public class HlsChunkSource {
// identifier com.apple.streaming.transportStreamTimestamp. This may also apply to the MP3
// case below.
extractor = new AdtsExtractor(startTimeUs);
} else if (lastPathSegment.endsWith(AC3_FILE_EXTENSION)) {
extractor = new Ac3Extractor(startTimeUs);
} else if (lastPathSegment.endsWith(MP3_FILE_EXTENSION)) {
extractor = new Mp3Extractor(startTimeUs);
} else if (lastPathSegment.endsWith(WEBVTT_FILE_EXTENSION)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment