Add compatiblity for some older ffmpeg versions

This commit is contained in:
Timo R 2014-04-05 16:12:32 +02:00
parent 22aec1c391
commit 15639d928c
3 changed files with 25 additions and 0 deletions

View File

@ -20,7 +20,9 @@
#include <obs.h>
#include <libavformat/avformat.h>
#include "obs-ffmpeg-formats.h"
#include "obs-ffmpeg-compat.h"
struct aac_encoder {
obs_encoder_t encoder;

View File

@ -0,0 +1,22 @@
#pragma once
#include <libavcodec/avcodec.h>
/* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
* a is the major version
* b and c the minor and micro versions of libav
* d and e the minor and micro versions of FFmpeg */
#define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \
( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \
(LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) )
#if !LIBAVCODEC_VERSION_CHECK(54, 28, 0, 59, 100)
# define avcodec_free_frame av_freep
#endif
#if LIBAVCODEC_VERSION_INT < 0x371c01
# define av_frame_alloc avcodec_alloc_frame
# define av_frame_unref avcodec_get_frame_defaults
# define av_frame_free avcodec_free_frame
#endif

View File

@ -27,6 +27,7 @@
#include <libswscale/swscale.h>
#include "obs-ffmpeg-formats.h"
#include "obs-ffmpeg-compat.h"
//#define OBS_FFMPEG_VIDEO_FORMAT VIDEO_FORMAT_I420
#define OBS_FFMPEG_VIDEO_FORMAT VIDEO_FORMAT_NV12