package {
    default_applicable_licenses: ["frameworks_av_services_mediacodec_license"],
}

// Added automatically by a large-scale-change
// See: http://go/android-license-faq
license {
    name: "frameworks_av_services_mediacodec_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
    ],
    license_text: [
        "NOTICE",
    ],
}

cc_binary {
    name: "mediaswcodec",
    vendor_available: true,
    min_sdk_version: "29",
    apex_available: ["com.android.media.swcodec"],

    srcs: [
        "main_swcodecservice.cpp",
    ],

    shared_libs: [
        "libavservices_minijail",
        "libbase",
        "libhidlbase",
        "liblog",
        "libmedia_codecserviceregistrant",
    ],

    header_libs: [
        "libmedia_headers",
    ],

    cflags: [
        "-Werror",
        "-Wall",
        "-Wno-error=deprecated-declarations",
    ],
}

prebuilt_etc {
    name: "mediaswcodec.policy",
    sub_dir: "seccomp_policy",
    arch: {
        arm: {
            src: "seccomp_policy/mediaswcodec-arm.policy",
        },
        arm64: {
            src: "seccomp_policy/mediaswcodec-arm64.policy",
        },
        riscv64: {
            src: "seccomp_policy/mediaswcodec-riscv64.policy",
        },
        x86: {
            src: "seccomp_policy/mediaswcodec-x86.policy",
        },
        x86_64: {
            src: "seccomp_policy/mediaswcodec-x86_64.policy",
        },
    },
    required: [
        "crash_dump.policy",
        "code_coverage.policy",
    ],
}

// media.codec -- the one that handles vendor & HW codecs

cc_binary {
    name: "android.hardware.media.omx@1.0-service",
    relative_install_path: "hw",
    vendor: true,

    srcs: [
        "main_codecservice.cpp",
    ],

    shared_libs: [
        "libbinder",
        "libutils",
        "liblog",
        "libbase",
        "libavservices_minijail",
        "libcutils",
        "libhidlbase",
        "libstagefright_omx",
        "libstagefright_xmlparser",
        "android.hardware.media.omx@1.0",
        "android.hidl.memory@1.0",
    ],

    // OMX interfaces force this to stay in 32-bit mode;
    compile_multilib: "32",

    init_rc: ["android.hardware.media.omx@1.0-service.rc"],

    required: [
        "mediacodec.policy",
    ],

    cflags: [
        "-Werror",
        "-Wall",
        "-Wno-error=deprecated-declarations",
    ],
}


prebuilt_etc {
    name: "mediacodec.policy",
    sub_dir: "seccomp_policy",
    arch: {
        arm: {
            src: "seccomp_policy/mediacodec-arm.policy",
        },
        arm64: {
            src: "seccomp_policy/mediacodec-arm64.policy",
        },
        riscv64: {
            enabled: false,
        },
        x86: {
            src: "seccomp_policy/mediacodec-x86.policy",
        },
        x86_64: {
            src: "seccomp_policy/mediacodec-x86_64.policy",
        },
    },
    required: [
        "crash_dump.policy",
        "code_coverage.policy",
    ],
}
