]> git.sesse.net Git - ffmpeg/blob - libavcodec/internal.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / internal.h
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18
19 /**
20  * @file
21  * common internal api header.
22  */
23
24 #ifndef AVCODEC_INTERNAL_H
25 #define AVCODEC_INTERNAL_H
26
27 #include <stdint.h>
28
29 #include "libavutil/pixfmt.h"
30 #include "avcodec.h"
31
32 typedef struct InternalBuffer {
33     uint8_t *base[AV_NUM_DATA_POINTERS];
34     uint8_t *data[AV_NUM_DATA_POINTERS];
35     int linesize[AV_NUM_DATA_POINTERS];
36     int width;
37     int height;
38     enum PixelFormat pix_fmt;
39     uint8_t **extended_data;
40     int audio_data_size;
41     int nb_channels;
42 } InternalBuffer;
43
44 typedef struct AVCodecInternal {
45     /**
46      * internal buffer count
47      * used by default get/release/reget_buffer().
48      */
49     int buffer_count;
50
51     /**
52      * internal buffers
53      * used by default get/release/reget_buffer().
54      */
55     InternalBuffer *buffer;
56
57     /**
58      * Whether the parent AVCodecContext is a copy of the context which had
59      * init() called on it.
60      * This is used by multithreading - shared tables and picture pointers
61      * should be freed from the original context only.
62      */
63     int is_copy;
64 } AVCodecInternal;
65
66 struct AVCodecDefault {
67     const uint8_t *key;
68     const uint8_t *value;
69 };
70
71 /**
72  * Determine whether pix_fmt is a hardware accelerated format.
73  */
74 int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
75
76 /**
77  * Return the hardware accelerated codec for codec codec_id and
78  * pixel format pix_fmt.
79  *
80  * @param codec_id the codec to match
81  * @param pix_fmt the pixel format to match
82  * @return the hardware accelerated codec, or NULL if none was found.
83  */
84 AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt);
85
86 /**
87  * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
88  * If there is no such matching pair then size is returned.
89  */
90 int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
91
92 unsigned int avpriv_toupper4(unsigned int x);
93
94 /**
95  * does needed setup of pkt_pts/pos and such for (re)get_buffer();
96  */
97 void ff_init_buffer_info(AVCodecContext *s, AVFrame *pic);
98
99 /**
100  * Remove and free all side data from packet.
101  */
102 void ff_packet_free_side_data(AVPacket *pkt);
103
104 int avpriv_lock_avformat(void);
105 int avpriv_unlock_avformat(void);
106
107 /**
108  * Maximum size in bytes of extradata.
109  * This value was chosen such that every bit of the buffer is
110  * addressable by a 32-bit signed integer as used by get_bits.
111  */
112 #define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
113
114 #endif /* AVCODEC_INTERNAL_H */