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 AV_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/**
95 * Video codec supports separate coding of fields in interlaced frames.
96 */
97#define AV_CODEC_PROP_FIELDS (1 << 4)
98
99/**
100 * Video codec contains enhancement information meant to be applied to other
101 * existing frames, and can't generate usable image data on its own.
102 * A standalone decoder is unlikely to be available for it and should not
103 * be expected.
104 */
105#define AV_CODEC_PROP_ENHANCEMENT (1 << 5)
106
107/**
108 * Subtitle codec is bitmap based
109 * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
110 */
111#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
112/**
113 * Subtitle codec is text based.
114 * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
115 */
116#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
117
118/**
119 * @return descriptor for given codec ID or NULL if no descriptor exists.
120 */
121const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
122
123/**
124 * Iterate over all codec descriptors known to libavcodec.
125 *
126 * @param prev previous descriptor. NULL to get the first descriptor.
127 *
128 * @return next descriptor or NULL after the last descriptor
129 */
130const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
131
132/**
133 * @return codec descriptor with the given name or NULL if no such descriptor
134 * exists.
135 */
136const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
137
138/**
139 * @}
140 */
141
142#endif // AVCODEC_CODEC_DESC_H
143