package {
    default_applicable_licenses: [
        "frameworks_av_media_codecs_m4v_h263_enc_license",
    ],
}

// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
    name: "frameworks_av_media_codecs_m4v_h263_enc_license",
    visibility: [":__subpackages__"],
    license_kinds: [
        "SPDX-license-identifier-Apache-2.0",
        "SPDX-license-identifier-BSD",
    ],
    license_text: [
        "NOTICE",
    ],
}

cc_library_static {
    name: "libstagefright_m4vh263enc",
    vendor_available: true,
    apex_available: [
        "//apex_available:platform",
        "com.android.media.swcodec",
    ],
    min_sdk_version: "29",
    host_supported: true,
    target: {
        darwin: {
            enabled: false,
        },
    },

    srcs: [
        "src/bitstream_io.cpp",
        "src/combined_encode.cpp", "src/datapart_encode.cpp",
        "src/dct.cpp",
        "src/findhalfpel.cpp",
        "src/fastcodemb.cpp",
        "src/fastidct.cpp",
        "src/fastquant.cpp",
        "src/me_utils.cpp",
        "src/mp4enc_api.cpp",
        "src/rate_control.cpp",
        "src/motion_est.cpp",
        "src/motion_comp.cpp",
        "src/sad.cpp",
        "src/sad_halfpel.cpp",
        "src/vlc_encode.cpp",
        "src/vop.cpp",
    ],

    cflags: [
        "-DBX_RC",
        "-Werror",
    ],

    local_include_dirs: ["src"],
    export_include_dirs: ["include"],

    sanitize: {
        misc_undefined: [
            "signed-integer-overflow",
        ],
        cfi: true,
    },
}

//###############################################################################

cc_test {
    name: "libstagefright_m4vh263enc_test",
    gtest: false,

    srcs: ["test/m4v_h263_enc_test.cpp"],

    local_include_dirs: ["src"],

    cflags: [
        "-DBX_RC",
        "-Wall",
        "-Werror",
    ],

    sanitize: {
        misc_undefined: [
            "signed-integer-overflow",
        ],
        cfi: true,
    },

    static_libs: ["libstagefright_m4vh263enc"],
}
