From e19e8aeeaaff3d4bc8f6065764c93f0298782ac6 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 28 Mar 2013 09:10:09 +0100 Subject: avtools: move media_type_string() from avprobe to cmdutils. It will be useful outside of avprobe. --- avprobe.c | 14 -------------- cmdutils.c | 12 ++++++++++++ cmdutils.h | 5 +++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/avprobe.c b/avprobe.c index 2f15d5c..c410cd2 100644 --- a/avprobe.c +++ b/avprobe.c @@ -526,20 +526,6 @@ static char *tag_string(char *buf, int buf_size, int tag) return buf; } - - -static const char *media_type_string(enum AVMediaType media_type) -{ - switch (media_type) { - case AVMEDIA_TYPE_VIDEO: return "video"; - case AVMEDIA_TYPE_AUDIO: return "audio"; - case AVMEDIA_TYPE_DATA: return "data"; - case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; - case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; - default: return "unknown"; - } -} - static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt) { char val_str[128]; diff --git a/cmdutils.c b/cmdutils.c index 7084fae..f43f701 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -1553,3 +1553,15 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) } return array; } + +const char *media_type_string(enum AVMediaType media_type) +{ + switch (media_type) { + case AVMEDIA_TYPE_VIDEO: return "video"; + case AVMEDIA_TYPE_AUDIO: return "audio"; + case AVMEDIA_TYPE_DATA: return "data"; + case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; + case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; + default: return "unknown"; + } +} diff --git a/cmdutils.h b/cmdutils.h index 1ae1978..2372b3f 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -514,6 +514,11 @@ FILE *get_preset_file(char *filename, size_t filename_size, */ void *grow_array(void *array, int elem_size, int *size, int new_size); +/** + * Get a string describing a media type. + */ +const char *media_type_string(enum AVMediaType media_type); + #define GROW_ARRAY(array, nb_elems)\ array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1) -- cgit v1.1