# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

with Files("**"):
    BUG_COMPONENT = ("Core", "Audio/Video: Playback")

EXPORTS += [
    'Adts.h',
    'AnnexB.h',
    'H264.h',
]

UNIFIED_SOURCES += [
    'Adts.cpp',
    'AnnexB.cpp',
    'H264.cpp',
]

LOCAL_INCLUDES += [
    '../../../mp4/',
]

FINAL_LIBRARY = 'xul'

# Suppress warnings in third-party code.
if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
    CFLAGS += [
        '-wd4013', # 'function' undefined; assuming extern returning int
        '-wd4101', # unreferenced local variable
    ]
    CXXFLAGS += [
        '-wd4018', # '<' : signed/unsigned mismatch
        '-wd4275', # non dll-interface class used as base for dll-interface class
        '-wd4305', # '=' : truncation from 'double' to 'float'
        '-wd4309', # '=' : truncation of constant value
        '-wd4355', # 'this' : used in base member initializer list
        '-wd4804', # '>' : unsafe use of type 'bool' in operation
        '-wd4099', # mismatched class/struct tags
    ]
elif CONFIG['CC_TYPE'] in ('clang', 'gcc'):
    CFLAGS += [
        '-Wno-comment',
        '-Wno-sign-compare',
        '-Wno-unused-function',
    ]
    CXXFLAGS += [
        '-Werror=format',
        '-Wno-multichar',
        '-Wno-sign-compare',
        '-Wno-unused',
    ]
    if CONFIG['CC_TYPE'] == 'clang':
        CXXFLAGS += [
            '-Wno-mismatched-tags',
            '-Wno-tautological-constant-out-of-range-compare',
            '-Wno-unreachable-code-return',
            '-Wno-implicit-fallthrough',
        ]
