blob: 9d4b4998b8ba640ddb93157dfe74e9778599f8c9 [file] [log] [blame]
// Copyright 2016 The Cobalt Authors. All Rights Reserved.
//
// 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.
#ifndef STARBOARD_SHARED_FFMPEG_FFMPEG_COMMON_H_
#define STARBOARD_SHARED_FFMPEG_FFMPEG_COMMON_H_
// Include FFmpeg header files.
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavutil/channel_layout.h>
#include <libavutil/imgutils.h>
#include <libavutil/mathematics.h>
#include <libavutil/opt.h>
} // extern "C"
#include "starboard/shared/internal_only.h"
#ifndef LIBAVUTIL_VERSION_52_8
#define LIBAVUTIL_VERSION_52_8 AV_VERSION_INT(52, 8, 0)
#endif
#ifndef LIBAVCODEC_VERSION_57_100
#define LIBAVCODEC_VERSION_57_100 AV_VERSION_INT(57, 100, 0)
#endif
#ifndef LIBAVFORMAT_VERSION_57_83
#define LIBAVFORMAT_VERSION_57_83 AV_VERSION_INT(57, 83, 0)
#endif
#if !defined(LIBAVUTIL_VERSION_MAJOR)
#error "LIBAVUTIL_VERSION_MAJOR not defined"
#endif // !defined(LIBAVUTIL_VERSION_MAJOR)
#if LIBAVUTIL_VERSION_MAJOR > 52
#define PIX_FMT_NONE AV_PIX_FMT_NONE
#define PIX_FMT_YUV420P AV_PIX_FMT_YUV420P
#define PIX_FMT_YUVJ420P AV_PIX_FMT_YUVJ420P
#endif // LIBAVUTIL_VERSION_MAJOR > 52
#if !defined(LIBAVCODEC_VERSION_MAJOR)
#error "LIBAVCODEC_VERSION_MAJOR not defined"
#endif // !defined(LIBAVCODEC_VERSION_MAJOR)
#if !defined(LIBAVCODEC_VERSION_MICRO)
#error "LIBAVCODEC_VERSION_MICRO not defined"
#endif // !defined(LIBAVCODEC_VERSION_MICRO)
#if LIBAVCODEC_VERSION_MICRO >= 100
#define LIBAVCODEC_LIBRARY_IS_FFMPEG 1
#else
#define LIBAVCODEC_LIBRARY_IS_FFMPEG 0
#endif // LIBAVCODEC_VERSION_MICRO >= 100
// Use the major version number of libavcodec plus a single digit distinguishing
// between ffmpeg and libav as the template parameter for the
// explicit specialization of the audio and video decoder classes.
#define FFMPEG ((LIBAVCODEC_VERSION_MAJOR * 10) + LIBAVCODEC_LIBRARY_IS_FFMPEG)
#endif // STARBOARD_SHARED_FFMPEG_FFMPEG_COMMON_H_