History

lavc: add avcodec_get_type() for mapping codec_id -> type.

Anton Khirnov committed 15 years ago

Commit bca06e71 parent 7f5bf4f4 files · +27 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavcodec/avcodec.h +8 −0
  3. libavcodec/utils.c +14 −0
  4. libavcodec/version.h +2 −2
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
1313
1414 API changes, most recent first:
1515
16+2011-08-xx - xxxxxxx - lavc 53.8.0
17+ Add avcodec_get_type().
18+
1619 2011-08-06 - 2f63440 - lavf 53.4.0
1720 Add error_recognition to AVFormatContext.
1821
libavcodec/avcodec.h+8−0
@@ -210,6 +210,7 @@ enum CodecID { · 209 unmodified lines
210210 CODEC_ID_DFA,
211211
212212 /* various PCM "codecs" */
213+ CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
213214 CODEC_ID_PCM_S16LE= 0x10000,
214215 CODEC_ID_PCM_S16BE,
215216 CODEC_ID_PCM_U16LE,
@@ -340,6 +341,7 @@ enum CodecID { · 124 unmodified lines
340341 CODEC_ID_QDMC,
341342
342343 /* subtitle codecs */
344+ CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
343345 CODEC_ID_DVD_SUBTITLE= 0x17000,
344346 CODEC_ID_DVB_SUBTITLE,
345347 CODEC_ID_TEXT, ///< raw UTF-8 text
@@ -351,6 +353,7 @@ enum CodecID { · 5 unmodified lines
351353 CODEC_ID_SRT,
352354
353355 /* other specific kind of codecs (generally used for attachments) */
356+ CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs.
354357 CODEC_ID_TTF= 0x18000,
355358
356359 CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
@@ -4273,4 +4276,9 @@ enum AVLockOp { · 3916 unmodified lines
42734276 */
42744277 int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op));
42754278
4279+/**
4280+ * Get the type of the given codec.
4281+ */
4282+enum AVMediaType avcodec_get_type(enum CodecID codec_id);
4283+
42764284 #endif /* AVCODEC_AVCODEC_H */
libavcodec/utils.c+14−0
@@ -1301,3 +1301,17 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count) · 1300 unmodified lines
13011301 return ff_thread_init(s);
13021302 }
13031303 #endif
1304+
1305+enum AVMediaType avcodec_get_type(enum CodecID codec_id)
1306+{
1307+ if (codec_id <= CODEC_ID_NONE)
1308+ return AVMEDIA_TYPE_UNKNOWN;
1309+ else if (codec_id < CODEC_ID_FIRST_AUDIO)
1310+ return AVMEDIA_TYPE_VIDEO;
1311+ else if (codec_id < CODEC_ID_FIRST_SUBTITLE)
1312+ return AVMEDIA_TYPE_AUDIO;
1313+ else if (codec_id < CODEC_ID_FIRST_UNKNOWN)
1314+ return AVMEDIA_TYPE_SUBTITLE;
1315+
1316+ return AVMEDIA_TYPE_UNKNOWN;
1317+}
libavcodec/version.h+2−2
@@ -21,8 +21,8 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
24−#define LIBAVCODEC_VERSION_MINOR 7
25−#define LIBAVCODEC_VERSION_MICRO 1
24+#define LIBAVCODEC_VERSION_MINOR 8
25+#define LIBAVCODEC_VERSION_MICRO 0
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
2828 LIBAVCODEC_VERSION_MINOR, \

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