/*
 * Copyright (c) 2017 Kiall Mac Innes <kiall@macinnes.ie>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package ie.macinnes.tvheadend.player;

import android.content.Context;

import com.google.android.exoplayer2.extractor.Extractor;
import com.google.android.exoplayer2.extractor.ExtractorsFactory;
import com.google.android.exoplayer2.extractor.ts.TsExtractor;

public class HtspExtractorsFactory implements ExtractorsFactory {
    private static final String TAG = HtspExtractorsFactory.class.getName();

    private final Context mContext;

    public HtspExtractorsFactory(Context context) {
        mContext = context;
    }

    @Override
    public Extractor[] createExtractors() {
        Extractor[] extractors = new Extractor[2];

        extractors[0] = new HtspExtractor(mContext);
        extractors[1] = new TsExtractor(0);

        return extractors;
    }
}

@@ -864,13 +864,675 @@
 tor.
-ts.Ts
+flv.FlvExtractor;%0Aimport com.google.android.exoplayer2.extractor.mkv.MatroskaExtractor;%0Aimport com.google.android.exoplayer2.extractor.mp3.Mp3Extractor;%0Aimport com.google.android.exoplayer2.extractor.mp4.FragmentedMp4Extractor;%0Aimport com.google.android.exoplayer2.extractor.mp4.Mp4Extractor;%0Aimport com.google.android.exoplayer2.extractor.ogg.OggExtractor;%0Aimport com.google.android.exoplayer2.extractor.ts.Ac3Extractor;%0Aimport com.google.android.exoplayer2.extractor.ts.AdtsExtractor;%0Aimport com.google.android.exoplayer2.extractor.ts.PsExtractor;%0Aimport com.google.android.exoplayer2.extractor.ts.TsExtractor;%0Aimport com.google.android.exoplayer2.extractor.wav.Wav
 Extr
@@ -1912,16 +1912,17 @@
 tractor%5B
+1
 2%5D;%0A%0A   
@@ -2003,21 +2003,481 @@
 new 
-TsExtractor(0
+MatroskaExtractor(0);%0A        extractors%5B2%5D = new FragmentedMp4Extractor(0);%0A        extractors%5B3%5D = new Mp4Extractor();%0A        extractors%5B4%5D = new Mp3Extractor(0);%0A        extractors%5B5%5D = new AdtsExtractor();%0A        extractors%5B6%5D = new Ac3Extractor();%0A        extractors%5B7%5D = new TsExtractor(0);%0A        extractors%5B8%5D = new FlvExtractor();%0A        extractors%5B9%5D = new OggExtractor();%0A        extractors%5B10%5D = new PsExtractor();%0A        extractors%5B11%5D = new WavExtractor(
 );%0A%0A

Add additional Extractors