ffmpeg-priv.h 5.39 KB
Newer Older
aymeric's avatar
aymeric committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*
mediastreamer2 library - modular sound and video processing and streaming
Copyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef FFMPEG_PRIV_H
#define FFMPEG_PRIV_H

23 24 25 26 27
#ifdef __cplusplus
/*see http://linux.die.net/man/3/uint64_c */
#define __STDC_CONSTANT_MACROS 1
#endif

aymeric's avatar
aymeric committed
28 29 30 31
#ifdef HAVE_CONFIG_H
#include "mediastreamer-config.h"
#endif

32 33 34 35 36 37
#ifdef __clang__
/*in case of compile with -g static inline can produce this type of warning*/
#pragma GCC diagnostic ignored "-Wunused-function"
#endif


unknown's avatar
unknown committed
38 39
#include <ortp/port.h>

aymeric's avatar
aymeric committed
40 41 42 43
#if defined(HAVE_LIBAVCODEC_AVCODEC_H)
/* new layout */
# include <libavcodec/avcodec.h>
# include <libavutil/avutil.h>
44
# include <libavutil/mem.h>
aymeric's avatar
aymeric committed
45 46 47 48 49 50 51
#endif

#if defined(HAVE_LIBSWSCALE_SWSCALE_H)
/* new layout */
#  include <libswscale/swscale.h>
#endif

52
#if defined(HAVE_LIBAVCODEC_AVCODEC_H)
53
#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52,24,0)
54 55 56 57 58 59
/*should work as long as nobody uses avformat.h*/
typedef struct AVPacket{
	uint8_t *data;
	int size;
}AVPacket;

aymeric's avatar
aymeric committed
60 61 62
static inline void av_init_packet(AVPacket *pkt){
	
}
63 64 65 66 67 68
static inline int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
                         int *got_picture_ptr,
                         AVPacket *avpkt){
	return avcodec_decode_video(avctx,picture, got_picture_ptr,avpkt->data,avpkt->size);
}
#endif
69 70 71
#if HAVE_AVCODEC_OLD_CODEC_IDS 
#include <libavcodec/old_codec_ids.h>
#endif
72

73 74

#if LIBAVUTIL_VERSION_MAJOR <= 51
75
#define AVPixelFormat PixelFormat
76 77 78 79 80 81 82 83 84 85 86 87
#define AV_PIX_FMT_YUVJ420P PIX_FMT_YUVJ420P
#define AV_PIX_FMT_RGBA PIX_FMT_RGBA
#define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
#define AV_PIX_FMT_BGR24 PIX_FMT_BGR24
#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
#define AV_PIX_FMT_YUYV422 PIX_FMT_YUYV422
#define AV_PIX_FMT_UYVY422 PIX_FMT_UYVY422
#define AV_PIX_FMT_YUYV422 PIX_FMT_YUYV422
#define AV_PIX_FMT_RGB565 PIX_FMT_RGB565

#endif

88
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54,25,0) 
89
/*CODEC_ID_* and CodecID have been deprecated for a long time and this release removes it altogether. Please use AV_CODEC_ID_* and AVCodecID instead.*/
90
#define CodecID AVCodecID
91 92 93 94 95 96 97
#ifndef HAVE_AVCODEC_OLD_CODEC_IDS
	#define CODEC_ID_H264 AV_CODEC_ID_H264 
	#define CODEC_ID_H263 AV_CODEC_ID_H263 
	#define CODEC_ID_H263P AV_CODEC_ID_H263P 
	#define CODEC_ID_MPEG4 AV_CODEC_ID_MPEG4 
	#define CODEC_ID_MJPEG AV_CODEC_ID_MJPEG 
#endif
98
#endif
99 100 101

#ifndef HAVE_FUN_avcodec_encode_video2
int avcodec_encode_video2 (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr);
102
#endif
103 104 105

#ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/
int avcodec_get_context_defaults3 (AVCodecContext *s, const AVCodec *codec);
Simon Morlat's avatar
Simon Morlat committed
106
AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
107
#endif
108 109

#ifndef HAVE_FUN_avcodec_open2 /**/
110
int avcodec_open2 (AVCodecContext *avctx, const AVCodec *codec, /*AVDictionary*/ void **options);
111
#endif
112

113 114
#ifndef HAVE_FUN_av_frame_alloc
AVFrame* av_frame_alloc (void);
115 116 117 118 119 120 121 122
#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,45,101)
#define av_frame_alloc avcodec_alloc_frame
/*http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges
 2013-12-11 - 29c83d2 / b9fb59d,409a143 / 9431356,44967ab / d7b3ee9 - lavc 55.45.101 / 55.28.1 - avcodec.h
   av_frame_alloc(), av_frame_unref() and av_frame_free() now can and should be
   used instead of avcodec_alloc_frame(), avcodec_get_frame_defaults() and
   avcodec_free_frame() respectively. The latter three functions are deprecated.
*jehan: previous version (55.39.100 at least) might be buggy */
123 124 125 126
#endif

#ifndef HAVE_FUN_av_frame_free
void av_frame_free (AVFrame** frame);
127 128 129 130 131 132 133 134
#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,45,101)
#define av_frame_free avcodec_free_frame
/*http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges
 2013-12-11 - 29c83d2 / b9fb59d,409a143 / 9431356,44967ab / d7b3ee9 - lavc 55.45.101 / 55.28.1 - avcodec.h
   av_frame_alloc(), av_frame_unref() and av_frame_free() now can and should be
   used instead of avcodec_alloc_frame(), avcodec_get_frame_defaults() and
   avcodec_free_frame() respectively. The latter three functions are deprecated.
*jehan: previous version (55.39.100 at least) might be buggy */
135 136 137 138
#endif

#ifndef HAVE_FUN_av_frame_unref
void av_frame_unref (AVFrame *frame);
139 140 141 142 143 144 145 146
#elif LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,45,101)
#define av_frame_unref avcodec_get_frame_defaults
/*http://git.videolan.org/?p=ffmpeg.git;a=blob;f=doc/APIchanges
 2013-12-11 - 29c83d2 / b9fb59d,409a143 / 9431356,44967ab / d7b3ee9 - lavc 55.45.101 / 55.28.1 - avcodec.h
   av_frame_alloc(), av_frame_unref() and av_frame_free() now can and should be
   used instead of avcodec_alloc_frame(), avcodec_get_frame_defaults() and
   avcodec_free_frame() respectively. The latter three functions are deprecated.
 *jehan: previous version (55.39.100 at least) might be buggy */
147 148 149
#endif


150
#endif /*iHAVE_LIBAVCODEC_AVCODEC_H*/
aymeric's avatar
aymeric committed
151
#endif /* FFMPEG_PRIV_H */