]> 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     int last_pic_num;
34     uint8_t *base[4];
35     uint8_t *data[4];
36     int linesize[4];
37     int width;
38     int height;
39     enum PixelFormat pix_fmt;
40 } InternalBuffer;
41
42 typedef struct AVCodecInternal {
43     /**
44      * internal buffer count
45      * used by default get/release/reget_buffer().
46      */
47     int buffer_count;
48
49     /**
50      * internal buffers
51      * used by default get/release/reget_buffer().
52      */
53     InternalBuffer *buffer;
54
55     /**
56      * Whether the parent AVCodecContext is a copy of the context which had
57      * init() called on it.
58      * This is used by multithreading - shared tables and picture pointers
59      * should be freed from the original context only.
60      */
61     int is_copy;
62 } AVCodecInternal;
63
64 struct AVCodecDefault {
65     const uint8_t *key;
66     const uint8_t *value;
67 };
68
69 /**
70  * Determine whether pix_fmt is a hardware accelerated format.
71  */
72 int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt);
73
74 /**
75  * Return the hardware accelerated codec for codec codec_id and
76  * pixel format pix_fmt.
77  *
78  * @param codec_id the codec to match
79  * @param pix_fmt the pixel format to match
80  * @return the hardware accelerated codec, or NULL if none was found.
81  */
82 AVHWAccel *ff_find_hwaccel(enum CodecID codec_id, enum PixelFormat pix_fmt);
83
84 /**
85  * Return the index into tab at which {a,b} match elements {[0],[1]} of tab.
86  * If there is no such matching pair then size is returned.
87  */
88 int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b);
89
90 unsigned int avpriv_toupper4(unsigned int x);
91
92 /**
93  * does needed setup of pkt_pts/pos and such for (re)get_buffer();
94  */
95 void ff_init_buffer_info(AVCodecContext *s, AVFrame *pic);
96
97 int avpriv_lock_avformat(void);
98 int avpriv_unlock_avformat(void);
99
100 #endif /* AVCODEC_INTERNAL_H */