History

avcodec.h: split AVCodecDescriptor API into its own header

Anton Khirnov committed 6 years ago

Commit 672946c1 parent c6978414 files · +134 −93Browse files

Unified · Split

4 files
  1. doc/APIchanges +2 −1
  2. libavcodec/avcodec.h +1 −91
  3. libavcodec/codec_desc.c +3 −1
  4. libavcodec/codec_desc.h +128 −0
doc/APIchanges+2−1
@@ -15,7 +15,8 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182020-xx-xx - xxxxxxxxxx - lavc 58.78.100 - avcodec.h codec_id.h packet.h182020-xx-xx - xxxxxxxxxx - lavc 58.78.100 - avcodec.h codec_desc.h codec_id.h packet.h
19 Move AVCodecDesc-related public API to new header codec_desc.h.
19 Move AVCodecID enum to new header codec_id.h.20 Move AVCodecID enum to new header codec_id.h.
20 Move AVPacket-related public API to new header packet.h.21 Move AVPacket-related public API to new header packet.h.
21 22
libavcodec/avcodec.h+1−91
@@ -41,6 +41,7 @@ · 40 unmodified lines
41#include "libavutil/pixfmt.h"41#include "libavutil/pixfmt.h"
42#include "libavutil/rational.h"42#include "libavutil/rational.h"
43 43
44#include "codec_desc.h"
44#include "codec_id.h"45#include "codec_id.h"
45#include "packet.h"46#include "packet.h"
46#include "version.h"47#include "version.h"
@@ -200,77 +201,6 @@ · 153 unmodified lines
200 * @{201 * @{
201 */202 */
202 203
203/**
204 * This struct describes the properties of a single codec described by an
205 * AVCodecID.
206 * @see avcodec_descriptor_get()
207 */
208typedef struct AVCodecDescriptor {
209 enum AVCodecID id;
210 enum AVMediaType type;
211 /**
212 * Name of the codec described by this descriptor. It is non-empty and
213 * unique for each codec descriptor. It should contain alphanumeric
214 * characters and '_' only.
215 */
216 const char *name;
217 /**
218 * A more descriptive name for this codec. May be NULL.
219 */
220 const char *long_name;
221 /**
222 * Codec properties, a combination of AV_CODEC_PROP_* flags.
223 */
224 int props;
225 /**
226 * MIME type(s) associated with the codec.
227 * May be NULL; if not, a NULL-terminated array of MIME types.
228 * The first item is always non-NULL and is the preferred MIME type.
229 */
230 const char *const *mime_types;
231 /**
232 * If non-NULL, an array of profiles recognized for this codec.
233 * Terminated with FF_PROFILE_UNKNOWN.
234 */
235 const struct AVProfile *profiles;
236} AVCodecDescriptor;
237
238/**
239 * Codec uses only intra compression.
240 * Video and audio codecs only.
241 */
242#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
243/**
244 * Codec supports lossy compression. Audio and video codecs only.
245 * @note a codec may support both lossy and lossless
246 * compression modes
247 */
248#define AV_CODEC_PROP_LOSSY (1 << 1)
249/**
250 * Codec supports lossless compression. Audio and video codecs only.
251 */
252#define AV_CODEC_PROP_LOSSLESS (1 << 2)
253/**
254 * Codec supports frame reordering. That is, the coded order (the order in which
255 * the encoded packets are output by the encoders / stored / input to the
256 * decoders) may be different from the presentation order of the corresponding
257 * frames.
258 *
259 * For codecs that do not have this property set, PTS and DTS should always be
260 * equal.
261 */
262#define AV_CODEC_PROP_REORDER (1 << 3)
263/**
264 * Subtitle codec is bitmap based
265 * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
266 */
267#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
268/**
269 * Subtitle codec is text based.
270 * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
271 */
272#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
273
274/**204/**
275 * @ingroup lavc_decoding205 * @ingroup lavc_decoding
276 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.206 * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@@ -5059,26 +4989,6 @@ int av_codec_is_encoder(const AVCodec *codec); · 4782 unmodified lines
5059 */4989 */
5060int av_codec_is_decoder(const AVCodec *codec);4990int av_codec_is_decoder(const AVCodec *codec);
5061 4991
5062/**
5063 * @return descriptor for given codec ID or NULL if no descriptor exists.
5064 */
5065const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
5066
5067/**
5068 * Iterate over all codec descriptors known to libavcodec.
5069 *
5070 * @param prev previous descriptor. NULL to get the first descriptor.
5071 *
5072 * @return next descriptor or NULL after the last descriptor
5073 */
5074const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
5075
5076/**
5077 * @return codec descriptor with the given name or NULL if no such descriptor
5078 * exists.
5079 */
5080const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
5081
5082/**4992/**
5083 * Allocate a CPB properties structure and initialize its fields to default4993 * Allocate a CPB properties structure and initialize its fields to default
5084 * values.4994 * values.
libavcodec/codec_desc.c+3−1
@@ -23,7 +23,9 @@ · 22 unmodified lines
23 23
24#include "libavutil/common.h"24#include "libavutil/common.h"
25#include "libavutil/internal.h"25#include "libavutil/internal.h"
26#include "avcodec.h"26
27#include "codec_id.h"
28#include "codec_desc.h"
27#include "profiles.h"29#include "profiles.h"
28#include "version.h"30#include "version.h"
29 31
libavcodec/codec_desc.h+128−0
@@ -0,0 +1,128 @@
1/*
2 * Codec descriptors public API
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef AVCODEC_CODEC_DESC_H
22#define AVCODEC_CODEC_DESC_H
23
24#include "libavutil/avutil.h"
25
26#include "codec_id.h"
27
28/**
29 * @addtogroup lavc_core
30 * @{
31 */
32
33/**
34 * This struct describes the properties of a single codec described by an
35 * AVCodecID.
36 * @see avcodec_descriptor_get()
37 */
38typedef struct AVCodecDescriptor {
39 enum AVCodecID id;
40 enum AVMediaType type;
41 /**
42 * Name of the codec described by this descriptor. It is non-empty and
43 * unique for each codec descriptor. It should contain alphanumeric
44 * characters and '_' only.
45 */
46 const char *name;
47 /**
48 * A more descriptive name for this codec. May be NULL.
49 */
50 const char *long_name;
51 /**
52 * Codec properties, a combination of AV_CODEC_PROP_* flags.
53 */
54 int props;
55 /**
56 * MIME type(s) associated with the codec.
57 * May be NULL; if not, a NULL-terminated array of MIME types.
58 * The first item is always non-NULL and is the preferred MIME type.
59 */
60 const char *const *mime_types;
61 /**
62 * If non-NULL, an array of profiles recognized for this codec.
63 * Terminated with FF_PROFILE_UNKNOWN.
64 */
65 const struct AVProfile *profiles;
66} AVCodecDescriptor;
67
68/**
69 * Codec uses only intra compression.
70 * Video and audio codecs only.
71 */
72#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
73/**
74 * Codec supports lossy compression. Audio and video codecs only.
75 * @note a codec may support both lossy and lossless
76 * compression modes
77 */
78#define AV_CODEC_PROP_LOSSY (1 << 1)
79/**
80 * Codec supports lossless compression. Audio and video codecs only.
81 */
82#define AV_CODEC_PROP_LOSSLESS (1 << 2)
83/**
84 * Codec supports frame reordering. That is, the coded order (the order in which
85 * the encoded packets are output by the encoders / stored / input to the
86 * decoders) may be different from the presentation order of the corresponding
87 * frames.
88 *
89 * For codecs that do not have this property set, PTS and DTS should always be
90 * equal.
91 */
92#define AV_CODEC_PROP_REORDER (1 << 3)
93/**
94 * Subtitle codec is bitmap based
95 * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
96 */
97#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
98/**
99 * Subtitle codec is text based.
100 * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
101 */
102#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
103
104/**
105 * @return descriptor for given codec ID or NULL if no descriptor exists.
106 */
107const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
108
109/**
110 * Iterate over all codec descriptors known to libavcodec.
111 *
112 * @param prev previous descriptor. NULL to get the first descriptor.
113 *
114 * @return next descriptor or NULL after the last descriptor
115 */
116const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
117
118/**
119 * @return codec descriptor with the given name or NULL if no such descriptor
120 * exists.
121 */
122const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
123
124/**
125 * @}
126 */
127
128#endif // AVCODEC_CODEC_DESC_H

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t