package com.foxx.androidcast.receiver.av;

import android.content.Context;

import com.foxx.androidcast.AppPreferences;

public final class ReceiverAvPipelineFactory {
    private ReceiverAvPipelineFactory() {}

    public static ReceiverVideoPipeline createVideo(Context context) {
        Context app = context.getApplicationContext();
        ReceiverVideoPreset preset = AppPreferences.getReceiverVideoPreset(app);
        switch (preset) {
            case IMMERSIVE:
            case HDR:
                return new GlExperimentalVideoPipeline(app, preset);
            case DEFAULT:
            default:
                return ReceiverVideoPipeline.passthrough();
        }
    }

    public static AudioFilterChain createAudio(Context context) {
        ReceiverAudioPreset preset = AppPreferences.getReceiverAudioPreset(context);
        int intensity = AppPreferences.getReceiverAvIntensity(context);
        switch (preset) {
            case BASS_BOOST:
                return new AudioFilterChain(new AudioFilter[] {new BassBoostAudioFilter()}, intensity);
            case IMMERSIVE:
                return new AudioFilterChain(new AudioFilter[] {new ImmersiveAudioFilter()}, intensity);
            case DOLBY_51:
                return new AudioFilterChain(new AudioFilter[] {new DolbySurroundAudioFilter(false)}, intensity);
            case DOLBY_71:
                return new AudioFilterChain(new AudioFilter[] {new DolbySurroundAudioFilter(true)}, intensity);
            case DEFAULT:
            default:
                return AudioFilterChain.passthrough();
        }
    }
}
