/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * 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.
 *
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
 */

package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_av_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_av_license"],
}

cc_defaults {
    name: "C2Fuzzer-defaults",
    team: "trendy_team_media_codec_framework",
    defaults: ["libcodec2-static-defaults"],

    srcs: [
        "C2Fuzzer.cpp",
    ],

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

cc_defaults {
    name: "C2Fuzzer-defaults-shipped",
    defaults: ["C2Fuzzer-defaults"],
    fuzz_config: {
        cc: [
            "android-fwk-video@google.com",
        ],
        componentid: 1344,
        hotlists: [
            "4593311",
        ],
        description: "The fuzzer targets the APIs of libcodec2",
        vector: "remote",
        service_privilege: "constrained",
        users: "multi_user",
        fuzzed_code_usage: "shipped",
    },
}

cc_defaults {
    name: "C2Fuzzer-defaults-experimental",
    defaults: ["C2Fuzzer-defaults"],
    fuzz_config: {
        cc: [
            "android-fwk-video@google.com",
        ],
        componentid: 1344,
        hotlists: [
            "4593311",
        ],
        description: "The fuzzer targets the APIs of libcodec2",
        vector: "remote",
        service_privilege: "constrained",
        users: "multi_user",
        fuzzed_code_usage: "experimental",
    },
}

cc_fuzz {
    name: "C2FuzzerAvcDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.avc.decoder\"",
    ],

    static_libs: [
        "libavcdec",
        "libcodec2_soft_avcdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerHevcDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.hevc.decoder\"",
    ],

    static_libs: [
        "libhevcdec",
        "libcodec2_soft_hevcdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerMpeg2Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.mpeg2.decoder\"",
    ],

    static_libs: [
        "libmpeg2dec",
        "libcodec2_soft_mpeg2dec",
    ],
}

cc_fuzz {
    name: "C2FuzzerMpeg4Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.mpeg4.decoder\"",
    ],

    static_libs: [
        "libstagefright_m4vh263dec",
        "libcodec2_soft_mpeg4dec",
    ],
}

cc_fuzz {
    name: "C2FuzzerH263Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.h263.decoder\"",
    ],

    static_libs: [
        "libstagefright_m4vh263dec",
        "libcodec2_soft_h263dec",
    ],
}

cc_fuzz {
    name: "C2FuzzerVp8Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.vp8.decoder\"",
    ],

    static_libs: [
        "libvpx",
        "libcodec2_soft_vp8dec",
    ],
}

cc_fuzz {
    name: "C2FuzzerVp9Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.vp9.decoder\"",
    ],

    static_libs: [
        "libvpx",
        "libcodec2_soft_vp9dec",
    ],
}

cc_fuzz {
    name: "C2FuzzerAV1Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.av1.decoder\"",
    ],

    static_libs: [
        "libgav1",
        "libyuv",
        "libcodec2_soft_av1dec_gav1",
    ],
}

cc_fuzz {
    name: "C2FuzzerAPVDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.apv.decoder\"",
    ],

    static_libs: [
        "libopenapv",
        "libcodec2_soft_apvdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerAacDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.aac.decoder\"",
    ],

    static_libs: [
        "libFraunhoferAAC",
        "libcodec2_soft_aacdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerAmrnbDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.amrnb.decoder\"",
    ],

    static_libs: [
        "libstagefright_amrnbdec",
        "libstagefright_amrwbdec",
        "libstagefright_amrnb_common",
        "libcodec2_soft_amrnbdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerAmrwbDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.amrwb.decoder\"",
    ],

    static_libs: [
        "libstagefright_amrnbdec",
        "libstagefright_amrwbdec",
        "libstagefright_amrnb_common",
        "libcodec2_soft_amrwbdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerFlacDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.flac.decoder\"",
    ],

    static_libs: [
        "libFLAC",
        "libstagefright_flacdec",
        "libcodec2_soft_flacdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerG711AlawDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.g711.alaw.decoder\"",
    ],

    static_libs: [
        "codecs_g711dec",
        "libcodec2_soft_g711alawdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerG711MlawDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.g711.mlaw.decoder\"",
    ],

    static_libs: [
        "codecs_g711dec",
        "libcodec2_soft_g711mlawdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerGsmDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.gsm.decoder\"",
    ],

    static_libs: [
        "libgsm",
        "libcodec2_soft_gsmdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerIamfDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.iamf.decoder\"",
    ],

    static_libs: [
        "iamf_tools",
        "libcodec2_soft_iamfdec",
        "libFLAC",
        "libFraunhoferAAC",
        "libopus",
    ],
}

cc_fuzz {
    name: "C2FuzzerMp3Dec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.mp3.decoder\"",
    ],

    static_libs: [
        "libstagefright_mp3dec",
        "libcodec2_soft_mp3dec",
    ],
}

cc_fuzz {
    name: "C2FuzzerOpusDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.opus.decoder\"",
    ],

    static_libs: [
        "libopus",
        "libcodec2_soft_opusdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerRawDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.raw.decoder\"",
    ],

    static_libs: [
        "libcodec2_soft_rawdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerVorbisDec",
    defaults: ["C2Fuzzer-defaults-shipped"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.vorbis.decoder\"",
    ],

    static_libs: [
        "libvorbisidec",
        "libcodec2_soft_vorbisdec",
    ],
}

cc_fuzz {
    name: "C2FuzzerXaacDec",
    defaults: ["C2Fuzzer-defaults-experimental"],

    cflags: [
        "-DC2COMPONENTNAME=\"c2.android.xaac.decoder\"",
    ],

    static_libs: [
        "libxaacdec",
        "libcodec2_soft_xaacdec",
    ],
}
