package com.ucarsink.sink.natives;

import a.a.a.b;
import com.ucar.vehiclesdk.UCarCommon;
import java.util.HashMap;

public class SinkNative {

    /* renamed from: a  reason: collision with root package name */
    private static final String f234a = "SinkNative";
    private static a b;
    private static volatile SinkNative c;

    public interface a {
        void a(String str);

        void a(String str, UCarCommon.AudioType audioType, int i, byte[] bArr);

        void a(String str, UCarCommon.VideoType videoType, int i, byte[] bArr, long j);

        void a(String str, String str2, int i, int i2);

        void a(String str, boolean z);

        void b(String str);

        void b(String str, String str2, int i, int i2);
    }

    static {
        System.loadLibrary("ovmsink");
    }

    private SinkNative() {
    }

    public static SinkNative a() {
        if (c == null) {
            synchronized (SinkNative.class) {
                if (c == null) {
                    c = new SinkNative();
                }
            }
        }
        return c;
    }

    public static void a(a aVar) {
        b = aVar;
    }

    public static void b() {
        b = null;
    }

    public static void onNativeAudioDataReceived(String str, int i, int i2, byte[] bArr) {
        if (b != null) {
            b.a(str, UCarCommon.AudioType.fromInt(i), i2, bArr);
        }
    }

    public static void onNativeCastAudioInitialized(String str, String str2, int i, int i2) {
        b.c(f234a, "onNativeCastAudioInitialized, deviceId: " + str + ", mimeType: " + str2 + ", sampleRate: " + i + ", channelCount: " + i2);
        a aVar = b;
        if (aVar != null) {
            aVar.a(str, str2, i, i2);
        }
    }

    public static void onNativeCastVideoInitialized(String str, String str2, int i, int i2) {
        b.c(f234a, "onNativeCastVideoInitialized, deviceId: " + str + ", mimeType: " + str2 + ", width: " + i + ", height: " + i2);
        a aVar = b;
        if (aVar != null) {
            aVar.b(str, str2, i, i2);
        }
    }

    public static void onNativeVideoDataReceived(String str, int i, int i2, byte[] bArr, long j) {
        if (b != null) {
            b.a(str, UCarCommon.VideoType.fromInt(i), i2, bArr, j);
        }
    }

    public static void onNativeWfdSinkStarted(String str) {
        b.c(f234a, "onNativeWfdSinkStarted, session: " + str);
        a aVar = b;
        if (aVar != null) {
            aVar.b(str);
        }
    }

    public static void onNativeWfdSinkStopped(String str) {
        b.c(f234a, "onNativeWfdSinkStopped, session: " + str);
        a aVar = b;
        if (aVar != null) {
            aVar.a(str);
        }
    }

    public static void onUibcEncrypted(String str, boolean z) {
        b.c(f234a, "onUibcEncrypted, session: " + str + ", enable: " + z);
        a aVar = b;
        if (aVar != null) {
            aVar.a(str, z);
        }
    }

    public static native boolean onUibcEvent(String str, byte[] bArr);

    public static native boolean pause(String str);

    public static native boolean resume(String str);

    public static native boolean setParameter(String str, HashMap<String, String> hashMap);

    public static native boolean start(String str, int i, int i2, int i3, int i4, int i5, boolean z, boolean z2);

    public static native boolean stop(String str);
}
