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 * Subtitle codec is bitmap based
101 * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field.
102 */
103#define AV_CODEC_PROP_BITMAP_SUB (1 << 16)
104/**
105 * Subtitle codec is text based.
106 * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field.
107 */
108#define AV_CODEC_PROP_TEXT_SUB (1 << 17)
109
110/**
111 * @return descriptor for given codec ID or NULL if no descriptor exists.
112 */
113const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id);
114
115/**
116 * Iterate over all codec descriptors known to libavcodec.
117 *
118 * @param prev previous descriptor. NULL to get the first descriptor.
119 *
120 * @return next descriptor or NULL after the last descriptor
121 */
122const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev);
123
124/**
125 * @return codec descriptor with the given name or NULL if no such descriptor
126 * exists.
127 */
128const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name);
129
130/**
131 * @}
132 */
133
134#endif // AVCODEC_CODEC_DESC_H
135