From e006602ee863683bc3b55b8a1f8be06a160290a1 Mon Sep 17 00:00:00 2001 From: Jingtao Chen Date: Fri, 24 Jul 2015 15:43:44 +0800 Subject: [PATCH 1/4] replace mime with format Signed-off-by: Jingtao Chen --- lib/mediainfo.c | 14 +------------- lib/mediainfo.h | 21 ++------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/lib/mediainfo.c b/lib/mediainfo.c index 57c6bc2..82ad4ae 100644 --- a/lib/mediainfo.c +++ b/lib/mediainfo.c @@ -78,7 +78,6 @@ static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) /* "user interface" functions */ static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) { - int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); AVStream *st = ic->streams[i]; AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); @@ -246,7 +245,6 @@ void collect_codec_info (AVCodecContext *enc) void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { int i; - const char *mimefmt = ""; uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL; if (ic->nb_streams && !printed) return; @@ -328,7 +326,6 @@ void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) { AVStream *st = ic->streams[i]; AVCodecContext *codec = st->codec; - AVCodec *decoder = avcodec_find_decoder (codec->codec_id); int codec_type = codec->codec_type; if (codec_type == AVMEDIA_TYPE_VIDEO) { @@ -349,27 +346,18 @@ void dump_format(AVFormatContext *ic, int index, const char *url, int is_output) dump_stream_format(ic, i, index, is_output); } - /**** Do not change below two blocks! ****/ if (cnt_a > 0) { snprintf (mMetadataValues[MetaNameMap[METADATA_KEY_HAS_AUDIO].key], MAX_METADATA_STRING_LENGTH, "True"); - mimefmt = "audio/%s"; } if (cnt_v > 0) { snprintf (mMetadataValues[MetaNameMap[METADATA_KEY_HAS_VIDEO].key], MAX_METADATA_STRING_LENGTH, "True"); - mimefmt = "video/%s"; } - /**** ****/ if (ic->iformat) { - for (i = 0; i < (int) DIM (MimeMap); i++) { - if (strcmp (ic->iformat->name, MimeMap[i].ffname) == 0) { - snprintf (mMetadataValues[METADATA_KEY_MIMETYPE], - MAX_METADATA_STRING_LENGTH, mimefmt, MimeMap[i].mime); - } - } + snprintf (mMetadataValues[MetaNameMap[METADATA_KEY_FILE_FORMAT].key], MAX_METADATA_STRING_LENGTH, "%s", ic->iformat->name); } av_free(printed); diff --git a/lib/mediainfo.h b/lib/mediainfo.h index 0980196..815cc5a 100644 --- a/lib/mediainfo.h +++ b/lib/mediainfo.h @@ -14,7 +14,7 @@ enum { METADATA_KEY_DURATION = 0, METADATA_KEY_START_TIME , METADATA_KEY_BITRATE , - METADATA_KEY_MIMETYPE , + METADATA_KEY_FILE_FORMAT , METADATA_KEY_HAS_VIDEO , METADATA_KEY_HAS_AUDIO , METADATA_KEY_VIDEO_CODEC , @@ -56,7 +56,7 @@ MetaNameMapEntry MetaNameMap[] = { {METADATA_KEY_DURATION, "Duration"}, {METADATA_KEY_START_TIME, "Start Sime"}, {METADATA_KEY_BITRATE, "Bitrate"}, - {METADATA_KEY_MIMETYPE, "Mime"}, + {METADATA_KEY_FILE_FORMAT, "Format"}, {METADATA_KEY_HAS_VIDEO, "Has Video"}, {METADATA_KEY_HAS_AUDIO, "Has Audio"}, {METADATA_KEY_VIDEO_CODEC, "Video"}, @@ -92,23 +92,6 @@ MetaNameMapEntry MetaNameMap[] = { {METADATA_KEY_COPYRIGHT, "Copyright"}, }; -typedef struct MimeMapEntry -{ - const char *ffname; - const char *mime; -} MimeMapEntry; - -MimeMapEntry MimeMap[] = { - {"mp3", "mpeg"}, - {"matroska", "x-matroska"}, - {"mov,mp4,m4a,3gp,3g2,mj2", "mp4"}, - {"mpeg", "mpeg"}, - {"avi", "avi"}, - {"ogg", "ogg"}, - {"rm", "rm"}, - {"ape", "ape"} -}; - const int MAX_METADATA_STRING_LENGTH = 128; const int NUM_METADATA_KEYS = 37; From c0da61c5fc8b40ccbd91cc33680421576e160e66 Mon Sep 17 00:00:00 2001 From: Jingtao Chen Date: Fri, 24 Jul 2015 15:55:38 +0800 Subject: [PATCH 2/4] start time Signed-off-by: Jingtao Chen --- lib/mediainfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mediainfo.h b/lib/mediainfo.h index 815cc5a..a74e7bc 100644 --- a/lib/mediainfo.h +++ b/lib/mediainfo.h @@ -54,7 +54,7 @@ enum { MetaNameMapEntry MetaNameMap[] = { {METADATA_KEY_DURATION, "Duration"}, - {METADATA_KEY_START_TIME, "Start Sime"}, + {METADATA_KEY_START_TIME, "Start Time"}, {METADATA_KEY_BITRATE, "Bitrate"}, {METADATA_KEY_FILE_FORMAT, "Format"}, {METADATA_KEY_HAS_VIDEO, "Has Video"}, From 1abcf290887bcab0f6f68bbde7068f69eb236d8b Mon Sep 17 00:00:00 2001 From: Jingtao Chen Date: Fri, 24 Jul 2015 16:21:12 +0800 Subject: [PATCH 3/4] Add audio channels Signed-off-by: Jingtao Chen --- lib/mediainfo.c | 3 +-- lib/mediainfo.h | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/mediainfo.c b/lib/mediainfo.c index 82ad4ae..c090f6f 100644 --- a/lib/mediainfo.c +++ b/lib/mediainfo.c @@ -216,8 +216,7 @@ void collect_codec_info (AVCodecContext *enc) if (enc->sample_rate) { snprintf (mMetadataValues[MetaNameMap[METADATA_KEY_AUDIO_SAMPLE_RATE].key], MAX_METADATA_STRING_LENGTH, "%d Hz", enc->sample_rate); } - //av_strlcat(buf, ", ", buf_size); - //av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout); + av_get_channel_layout_string (mMetadataValues[MetaNameMap[METADATA_KEY_AUDIO_CHANNEL].key], MAX_METADATA_STRING_LENGTH, enc->channels, enc->channel_layout); if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) { snprintf (mMetadataValues[MetaNameMap[METADATA_KEY_AUDIO_SAMPLE_FORMAT].key], MAX_METADATA_STRING_LENGTH, "%s", av_get_sample_fmt_name(enc->sample_fmt)); } diff --git a/lib/mediainfo.h b/lib/mediainfo.h index a74e7bc..fc14b43 100644 --- a/lib/mediainfo.h +++ b/lib/mediainfo.h @@ -21,6 +21,7 @@ enum { METADATA_KEY_AUDIO_CODEC , METADATA_KEY_VIDEO_PROFILE , METADATA_KEY_AUDIO_PROFILE , + METADATA_KEY_AUDIO_CHANNEL , METADATA_KEY_AUDIO_SAMPLE_RATE , METADATA_KEY_AUDIO_SAMPLE_FORMAT , METADATA_KEY_FRAME_RATE , @@ -47,7 +48,7 @@ enum { METADATA_KEY_COMPOSER , METADATA_KEY_ORGANIZATION , METADATA_KEY_AUTHOR , - METADATA_KEY_COPYRIGHT = 36, + METADATA_KEY_COPYRIGHT = 37, // Add more here... }; @@ -63,6 +64,7 @@ MetaNameMapEntry MetaNameMap[] = { {METADATA_KEY_AUDIO_CODEC, "Audio"}, {METADATA_KEY_VIDEO_PROFILE, "Video Profile"}, {METADATA_KEY_AUDIO_PROFILE, "Audio Profile"}, + {METADATA_KEY_AUDIO_CHANNEL, "Channel"}, {METADATA_KEY_AUDIO_SAMPLE_RATE, "Sample Rate"}, {METADATA_KEY_AUDIO_SAMPLE_FORMAT, "Sample Format"}, {METADATA_KEY_FRAME_RATE, "Framerate"}, @@ -93,10 +95,10 @@ MetaNameMapEntry MetaNameMap[] = { }; const int MAX_METADATA_STRING_LENGTH = 128; -const int NUM_METADATA_KEYS = 37; +const int NUM_METADATA_KEYS = 38; #define DIM(a) (sizeof(a)/ sizeof(a[0])) -char mMetadataValues[37][128]; +char mMetadataValues[38][128]; #endif void media_info (const char *filename, char msg[]); From 47b1e2a572b24d4d6f57c8b6145c72f4912eb0e2 Mon Sep 17 00:00:00 2001 From: Jingtao Chen Date: Tue, 25 Aug 2015 14:28:25 +0800 Subject: [PATCH 4/4] Add COPYING Change-Id: I5ef536807c3fe2544265faeae6dc7aafd1460e15 Signed-off-by: Jingtao Chen --- COPYING | 9 ++++++ lib/mediainfo.c | 14 +++++++++ lib/mediainfo.h | 74 ++++++++++++++++++++++++++------------------ test/testmediainfo.c | 14 +++++++++ 4 files changed, 81 insertions(+), 30 deletions(-) diff --git a/COPYING b/COPYING index e69de29..6dc00e9 100644 --- a/COPYING +++ b/COPYING @@ -0,0 +1,9 @@ +Copyright (c) [2015] Qualcomm Technologies International, Ltd. +All Rights Reserved. +Qualcomm Technologies Inc. Confidential and Proprietary. +Not a Contribution. Notifications and licenses are retained for attribution +purposes only . Your use of this code is governed by the terms of your license +agreement with Qualcomm Technologies International, Ltd.(“QTIL”). +Except as may be granted by separate express written agreement, this file +provides no rights under or license to any QTIL or its affiliates patents, +trademarks, copyrights,or other intellectual property. diff --git a/lib/mediainfo.c b/lib/mediainfo.c index c090f6f..4e77efa 100644 --- a/lib/mediainfo.c +++ b/lib/mediainfo.c @@ -1,3 +1,17 @@ +/**************************************************************************** +** +** Copyright (c) [2015] Qualcomm Technologies International, Ltd. +** All Rights Reserved. +** Qualcomm Technologies Inc. Confidential and Proprietary. +** Not a Contribution. Notifications and licenses are retained for attribution +** purposes only . Your use of this code is governed by the terms of your +** license agreement with Qualcomm Technologies International, Ltd.(“QTIL”). +** Except as may be granted by separate express written agreement, this file +** provides no rights under or license to any QTIL or its affiliates patents, +** trademarks, copyrights,or other intellectual property. +** +****************************************************************************/ + #include #include #include diff --git a/lib/mediainfo.h b/lib/mediainfo.h index fc14b43..4224d3a 100644 --- a/lib/mediainfo.h +++ b/lib/mediainfo.h @@ -1,3 +1,17 @@ +/**************************************************************************** +** +** Copyright (c) [2015] Qualcomm Technologies International, Ltd. +** All Rights Reserved. +** Qualcomm Technologies Inc. Confidential and Proprietary. +** Not a Contribution. Notifications and licenses are retained for attribution +** purposes only . Your use of this code is governed by the terms of your +** license agreement with Qualcomm Technologies International, Ltd.(“QTIL”). +** Except as may be granted by separate express written agreement, this file +** provides no rights under or license to any QTIL or its affiliates patents, +** trademarks, copyrights,or other intellectual property. +** +****************************************************************************/ + #ifndef __MEDIAINFO_H__ #define __MEDIAINFO_H__ #include @@ -22,32 +36,32 @@ enum { METADATA_KEY_VIDEO_PROFILE , METADATA_KEY_AUDIO_PROFILE , METADATA_KEY_AUDIO_CHANNEL , - METADATA_KEY_AUDIO_SAMPLE_RATE , - METADATA_KEY_AUDIO_SAMPLE_FORMAT , + METADATA_KEY_AUDIO_SAMPLE_RATE , + METADATA_KEY_AUDIO_SAMPLE_FORMAT , METADATA_KEY_FRAME_RATE , - METADATA_KEY_WIDTH , - METADATA_KEY_HEIGHT , - METADATA_KEY_TBN , - METADATA_KEY_TBC , - METADATA_KEY_PAR , - METADATA_KEY_DAR , - METADATA_KEY_TITLE , - METADATA_KEY_ALBUM , - METADATA_KEY_ARTIST , - METADATA_KEY_GENRE , + METADATA_KEY_WIDTH , + METADATA_KEY_HEIGHT , + METADATA_KEY_TBN , + METADATA_KEY_TBC , + METADATA_KEY_PAR , + METADATA_KEY_DAR , + METADATA_KEY_TITLE , + METADATA_KEY_ALBUM , + METADATA_KEY_ARTIST , + METADATA_KEY_GENRE , METADATA_KEY_ALBUMARTIST , METADATA_KEY_LANGUAGE , - METADATA_KEY_CD_TRACK_NUMBER , - METADATA_KEY_DATE , - METADATA_KEY_TYER , + METADATA_KEY_CD_TRACK_NUMBER , + METADATA_KEY_DATE , + METADATA_KEY_TYER , METADATA_KEY_COMMENT , METADATA_KEY_TAGGING_TIME , METADATA_KEY_TOOL_NAME , METADATA_KEY_ENCODER , - METADATA_KEY_YEAR , + METADATA_KEY_YEAR , METADATA_KEY_COMPOSER , METADATA_KEY_ORGANIZATION , - METADATA_KEY_AUTHOR , + METADATA_KEY_AUTHOR , METADATA_KEY_COPYRIGHT = 37, // Add more here... @@ -62,32 +76,32 @@ MetaNameMapEntry MetaNameMap[] = { {METADATA_KEY_HAS_AUDIO, "Has Audio"}, {METADATA_KEY_VIDEO_CODEC, "Video"}, {METADATA_KEY_AUDIO_CODEC, "Audio"}, - {METADATA_KEY_VIDEO_PROFILE, "Video Profile"}, - {METADATA_KEY_AUDIO_PROFILE, "Audio Profile"}, - {METADATA_KEY_AUDIO_CHANNEL, "Channel"}, - {METADATA_KEY_AUDIO_SAMPLE_RATE, "Sample Rate"}, - {METADATA_KEY_AUDIO_SAMPLE_FORMAT, "Sample Format"}, + {METADATA_KEY_VIDEO_PROFILE, "Video Profile"}, + {METADATA_KEY_AUDIO_PROFILE, "Audio Profile"}, + {METADATA_KEY_AUDIO_CHANNEL, "Channel"}, + {METADATA_KEY_AUDIO_SAMPLE_RATE, "Sample Rate"}, + {METADATA_KEY_AUDIO_SAMPLE_FORMAT, "Sample Format"}, {METADATA_KEY_FRAME_RATE, "Framerate"}, {METADATA_KEY_WIDTH, "Width"}, {METADATA_KEY_HEIGHT, "Height"}, - {METADATA_KEY_TBN, "TBN"}, - {METADATA_KEY_TBC, "TBC"}, - {METADATA_KEY_PAR, "PAR"}, - {METADATA_KEY_DAR, "DAR"}, + {METADATA_KEY_TBN, "TBN"}, + {METADATA_KEY_TBC, "TBC"}, + {METADATA_KEY_PAR, "PAR"}, + {METADATA_KEY_DAR, "DAR"}, {METADATA_KEY_TITLE, "Title"}, {METADATA_KEY_ALBUM, "Album"}, {METADATA_KEY_ARTIST, "Artist"}, {METADATA_KEY_GENRE, "Genre"}, {METADATA_KEY_ALBUMARTIST, "Album_Artist"}, {METADATA_KEY_LANGUAGE, "Language"}, - {METADATA_KEY_CD_TRACK_NUMBER, "Track"}, - {METADATA_KEY_DATE, "Date"}, - {METADATA_KEY_TYER, "Tyer"}, + {METADATA_KEY_CD_TRACK_NUMBER, "Track"}, + {METADATA_KEY_DATE, "Date"}, + {METADATA_KEY_TYER, "Tyer"}, {METADATA_KEY_COMMENT, "Comment"}, {METADATA_KEY_TAGGING_TIME, "Tagging Time"}, {METADATA_KEY_TOOL_NAME, "Tool Name"}, {METADATA_KEY_ENCODER, "Encode"}, - {METADATA_KEY_YEAR, "Year"}, + {METADATA_KEY_YEAR, "Year"}, {METADATA_KEY_COMPOSER, "Composer"}, {METADATA_KEY_ORGANIZATION, "Organization"}, {METADATA_KEY_AUTHOR, "Author"}, diff --git a/test/testmediainfo.c b/test/testmediainfo.c index 998ea9a..c6a9f97 100644 --- a/test/testmediainfo.c +++ b/test/testmediainfo.c @@ -1,3 +1,17 @@ +/**************************************************************************** +** +** Copyright (c) [2015] Qualcomm Technologies International, Ltd. +** All Rights Reserved. +** Qualcomm Technologies Inc. Confidential and Proprietary. +** Not a Contribution. Notifications and licenses are retained for attribution +** purposes only . Your use of this code is governed by the terms of your +** license agreement with Qualcomm Technologies International, Ltd.(“QTIL”). +** Except as may be granted by separate express written agreement, this file +** provides no rights under or license to any QTIL or its affiliates patents, +** trademarks, copyrights,or other intellectual property. +** +****************************************************************************/ + #include #include "mediainfo.h"