YARP  2.3.70.1
Yet Another Robot Platform
ffmpeg_api.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 RobotCub Consortium
3  * Authors: Paul Fitzpatrick
4  * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
5  *
6  */
7 
8 #ifndef FFMPEG_API_YARP
9 #define FFMPEG_API_YARP
10 
11 // ffmpeg changes all the time.
12 // time to start factoring out some of the things that change.
13 
14 #ifndef __STDC_CONSTANT_MACROS
15 #define __STDC_CONSTANT_MACROS
16 #endif
17 
18 extern "C" {
19 #include <avcodec.h>
20 #include <avformat.h>
21 #include <avdevice.h>
22 #include <swscale.h>
23 #include <mathematics.h>
24 }
25 
26 
27 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 0, 0)
28 # error "ffmpeg version is too old, sorry - please download and compile newer version"
29 #endif
30 
31 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 0, 0)
32 # define USE_AVFORMAT_OPEN_INPUT
33 #endif
34 
35 #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55, 0, 0)
36 # define USE_AV_FRAME_ALLOC
37 # define USE_AUDIO4
38 #endif
39 
40 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(52, 0, 0)
41 # define AV_PIX_FMT_RGB24 PIX_FMT_RGB24
42 # define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
43 # define AVPixelFormat PixelFormat
44 #endif
45 
46 #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(54, 4, 100)
47 # define av_dict_set_int(x, k, v, f) { char buf[256]; sprintf(buf,"%d",v); av_dict_set(x, k ,buf, 0); }
48 #endif
49 
50 
51 
52 
53 int stable_img_convert (AVPicture *dst, int dst_pix_fmt,
54  const AVPicture *src, int src_pix_fmt,
55  int src_width, int src_height);
56 
57 #ifndef CODEC_TYPE_AUDIO
58 # define CodecType AVMediaType
59 # define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN
60 # define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO
61 # define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO
62 # define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA
63 # define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE
64 # define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT
65 # define CODEC_TYPE_NB AVMEDIA_TYPE_NB
66 # define PKT_FLAG_KEY AV_PKT_FLAG_KEY
67 # define guess_format av_guess_format
68 # define av_alloc_format_context avformat_alloc_context
69 # define FFEPOCH3
70 #endif
71 
72 
73 
74 #ifdef USE_AV_FRAME_ALLOC
75 # define YARP_avcodec_alloc_frame av_frame_alloc
76 #else
77 # define YARP_avcodec_alloc_frame avcodec_alloc_frame
78 #endif
79 
80 #ifdef USE_AVFORMAT_OPEN_INPUT
81 # define YARP_av_find_stream_info(a) avformat_find_stream_info(a,NULL)
82 # define YARP_dump_format av_dump_format
83 # define YARP_av_close_input_file(x) avformat_close_input(&(x))
84 # define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
85 # define CodecID AVCodecID
86 # define CODEC_ID_NONE AV_CODEC_ID_NONE
87 # define CODEC_ID_PCM_S16LE AV_CODEC_ID_PCM_S16LE
88 # define CODEC_ID_PCM_S16BE AV_CODEC_ID_PCM_S16BE
89 # define CODEC_ID_PCM_U16LE AV_CODEC_ID_PCM_U16LE
90 # define CODEC_ID_PCM_U16BE AV_CODEC_ID_PCM_U16BE
91 # define CODEC_ID_MPEG1VIDEO AV_CODEC_ID_MPEG1VIDEO
92 # define CODEC_ID_MPEG2VIDEO AV_CODEC_ID_MPEG2VIDEO
93 # define url_fopen avio_open
94 # define url_fclose avio_close
95 # define URL_WRONLY AVIO_FLAG_WRITE
96 # define AV_NO_SET_PARAMETERS
97 # define av_write_header(x) avformat_write_header(x,NULL)
98 # define av_new_stream(x,v) avformat_new_stream(x,NULL)
99 #else
100 # define YARP_av_find_stream_info av_find_stream_info
101 # define YARP_dump_format dump_format
102 # define YARP_av_close_input_file av_close_input_file
103 #endif
104 
105 #endif
int stable_img_convert(AVPicture *dst, int dst_pix_fmt, const AVPicture *src, int src_pix_fmt, int src_width, int src_height)
Definition: ffmpeg_api.cpp:11