History

lavu: add av_get_media_type_string() convenience function

Avoid code duplication.

Stefano Sabatini committed 15 years ago

Commit 69e2c1a1 parent 31ac0ac3 files · +22 −1Browse files

Unified · Split

3 files
  1. doc/APIchanges +3 −0
  2. libavutil/avutil.h +7 −1
  3. libavutil/utils.c +12 −0
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-20 - xxxxxx - lavu 51.13.0
17+ Add av_get_media_type_string().
18+
1619 2011-08-14 - xxxxxx - lavu 52.12.0
1720 Add av_fifo_peek2(), deprecate av_fifo_peek().
1821
libavutil/avutil.h+7−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040 #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c)
4141
4242 #define LIBAVUTIL_VERSION_MAJOR 51
43−#define LIBAVUTIL_VERSION_MINOR 12
43+#define LIBAVUTIL_VERSION_MINOR 13
4444 #define LIBAVUTIL_VERSION_MICRO 0
4545
4646 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -95,6 +95,12 @@ enum AVMediaType { · 48 unmodified lines
9595 AVMEDIA_TYPE_NB
9696 };
9797
98+/**
99+ * Return a string describing the media_type enum, NULL if media_type
100+ * is unknown.
101+ */
102+const char *av_get_media_type_string(enum AVMediaType media_type);
103+
98104 #define FF_LAMBDA_SHIFT 7
99105 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT)
100106 #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda
libavutil/utils.c+12−0
@@ -40,6 +40,18 @@ const char *avutil_license(void) · 39 unmodified lines
4040 return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
4141 }
4242
43+const char *av_get_media_type_string(enum AVMediaType media_type)
44+{
45+ switch (media_type) {
46+ case AVMEDIA_TYPE_VIDEO: return "video";
47+ case AVMEDIA_TYPE_AUDIO: return "audio";
48+ case AVMEDIA_TYPE_DATA: return "data";
49+ case AVMEDIA_TYPE_SUBTITLE: return "subtitle";
50+ case AVMEDIA_TYPE_ATTACHMENT: return "attachment";
51+ default: return NULL;
52+ }
53+}
54+
4355 char av_get_picture_type_char(enum AVPictureType pict_type)
4456 {
4557 switch (pict_type) {

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