aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacketVideo CM <engbuild@pv.com>2010-06-23 14:06:52 -0700
committerPacketVideo CM <engbuild@pv.com>2010-06-23 14:31:04 -0700
commit2136fdd17eebe4d37498bcb2993814e0f24c8d8a (patch)
treea5d645ee7379fb83aae16a462d2787aae39f5475
parent2b7f42f492d8513bf06d80cf99cf7568d0fa7d44 (diff)
downloadopencore-2136fdd17eebe4d37498bcb2993814e0f24c8d8a.tar.gz
RIO-7188: Add more metadata support in MP3 Parser and ID3 Parcom
Change-Id: I05eac318322768c6d1a342a9757b72b188f8bac7
-rw-r--r--engines/2way/src/pv_2way_sdkinfo.h2
-rw-r--r--engines/author/src/pv_author_sdkinfo.h2
-rw-r--r--engines/player/src/pv_player_sdkinfo.h2
-rw-r--r--fileformats/id3parcom/include/pv_id3_parcom.h24
-rw-r--r--fileformats/id3parcom/include/pv_id3_parcom_constants.h10
-rw-r--r--fileformats/id3parcom/src/pv_id3_parcom.cpp175
-rw-r--r--fileformats/mp3/parser/include/mp3parser.h10
-rw-r--r--fileformats/mp3/parser/src/imp3ff.cpp62
-rw-r--r--fileformats/mp3/parser/src/mp3parser.cpp28
-rw-r--r--pvmi/pvmf/include/pvmi_kvp.h21
10 files changed, 319 insertions, 17 deletions
diff --git a/engines/2way/src/pv_2way_sdkinfo.h b/engines/2way/src/pv_2way_sdkinfo.h
index 0c0f78238..ef27d1d4f 100644
--- a/engines/2way/src/pv_2way_sdkinfo.h
+++ b/engines/2way/src/pv_2way_sdkinfo.h
@@ -21,7 +21,7 @@
// This header file is automatically generated at build-time
// *** OFFICIAL RELEASE INFO -- Will not auto update
-#define PV2WAY_ENGINE_SDKINFO_LABEL "1502033"
+#define PV2WAY_ENGINE_SDKINFO_LABEL "1503207"
#define PV2WAY_ENGINE_SDKINFO_DATE 0x20100617
#endif //PV_2WAY_SDKINFO_H_INCLUDED
diff --git a/engines/author/src/pv_author_sdkinfo.h b/engines/author/src/pv_author_sdkinfo.h
index 4bdb707d5..865c0fac4 100644
--- a/engines/author/src/pv_author_sdkinfo.h
+++ b/engines/author/src/pv_author_sdkinfo.h
@@ -21,7 +21,7 @@
// This header file is automatically generated at build-time
// *** OFFICIAL RELEASE INFO -- Will not auto update
-#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1502033"
+#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1503207"
#define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20100617
#endif //PV_AUTHOR_SDKINFO_H_INCLUDED
diff --git a/engines/player/src/pv_player_sdkinfo.h b/engines/player/src/pv_player_sdkinfo.h
index 63828baa3..b52e56330 100644
--- a/engines/player/src/pv_player_sdkinfo.h
+++ b/engines/player/src/pv_player_sdkinfo.h
@@ -21,7 +21,7 @@
// This header file is automatically generated at build-time
// *** OFFICIAL RELEASE INFO -- Will not auto update
-#define PVPLAYER_ENGINE_SDKINFO_LABEL "1502033"
+#define PVPLAYER_ENGINE_SDKINFO_LABEL "1503207"
#define PVPLAYER_ENGINE_SDKINFO_DATE 0x20100617
#endif //PV_PLAYER_SDKINFO_H_INCLUDED
diff --git a/fileformats/id3parcom/include/pv_id3_parcom.h b/fileformats/id3parcom/include/pv_id3_parcom.h
index 81e557125..ad88488d0 100644
--- a/fileformats/id3parcom/include/pv_id3_parcom.h
+++ b/fileformats/id3parcom/include/pv_id3_parcom.h
@@ -350,6 +350,7 @@ class PVID3ParCom
PV_ID3_FRAME_DESCRIPTION, /* brief description of the content */
PV_ID3_FRAME_VERSION, /* Software version of the authoring software */
PV_ID3_FRAME_PART_OF_SET, /* Which part of a set this belongs to */
+ PV_ID3_FRAME_POPULARIMETER, /* how popular an audio file is */
PV_ID3_FRAME_EEND /**< End. Marks end of frames.*/
} PVID3FrameType;
@@ -745,6 +746,16 @@ class PVID3ParCom
PVMFStatus ReadAlbumArtFrame(PVID3FrameType aFrameType, uint8 unicode, uint32 aFrameSize);
/**
+ * @brief This function is costructing the key-value pair for popularity meter(popm) frame. It
+ * first converts the Popularitymeter frame in to the PvmfPopmStruct and then set the
+ * key_specific_value of the Pvmikvp struct.
+ * @param frame type
+ * @param frame size
+ * @return Success if read successful.
+ */
+ PVMFStatus ReadPopularimeterFrame(uint32 aFrameSize);
+
+ /**
* @brief This function extracts the albumart information, for ascii data, based on frametype (apic/pic).
* @param frame type
* @param frame size
@@ -752,7 +763,7 @@ class PVID3ParCom
* @param description
* @param picture type
* @param data length
- * @return Success if conversion is successfull.
+ * @return Success if conversion is successful.
*/
PVMFStatus GetAlbumArtInfo(PVID3FrameType aFrameType, uint32 aFrameSize, OSCL_HeapString<OsclMemAllocator> &ImageFormat,
uint8 &PicType, OSCL_HeapString<OsclMemAllocator> &Description, uint32 &DataLen);
@@ -770,6 +781,17 @@ class PVID3ParCom
uint8 &PicType, OSCL_wHeapString<OsclMemAllocator> &aDescription, uint32 &DataLen);
+ /**
+ * @brief This function extracts the albumart information, for unicode data, based on frametype (apic/pic).
+ * @param frame size
+ * @param email id
+ * @param rating
+ * @param playback counter
+ * @return Success if conversion is successful.
+ */
+ PVMFStatus GetPopmFrameData(uint32 aFrameSize, OSCL_HeapString<OsclMemAllocator> &aEmailId, uint8 *aRating,
+ uint32 &aPlaybackCounter, uint32 &aDataLen);
+
/**
* @brief This function does the actual conversion from the raw ascii data from the
diff --git a/fileformats/id3parcom/include/pv_id3_parcom_constants.h b/fileformats/id3parcom/include/pv_id3_parcom_constants.h
index 554f531e7..665b6e15b 100644
--- a/fileformats/id3parcom/include/pv_id3_parcom_constants.h
+++ b/fileformats/id3parcom/include/pv_id3_parcom_constants.h
@@ -1,5 +1,5 @@
/* ------------------------------------------------------------------
- * Copyright (C) 1998-2009 PacketVideo
+ * Copyright (C) 1998-2010 PacketVideo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -169,6 +169,7 @@
#define ID3_FRAME_ID_COMPOSER "TCOM"
#define ID3_FRAME_ID_DESCRIPTION "TIT3"
#define ID3_FRAME_ID_VERSION "TENC"
+#define ID3_FRAME_ID_POPULARIMETER "POPM"
/* - List of unsupported frames - */
#define ID3_FRAME_ID_ENCRYPTION "AENC"
@@ -185,7 +186,6 @@
#define ID3_FRAME_ID_OWNERSHIP_FRAME "OWNE"
#define ID3_FRAME_ID_PRIVATE_FRAME "PRIV"
#define ID3_FRAME_ID_PLAY_COUNTER "PCNT"
-#define ID3_FRAME_ID_POPULARIMETER "POPM"
#define ID3_FRAME_ID_POSITION_SYNCH_FRAME "POSS"
#define ID3_FRAME_ID_RECOMMENDED_BUFFER_SIZE "RBUF"
#define ID3_FRAME_ID_RELATIVE_VOLUME_ADJUSTMENT2 "RVA2"
@@ -319,6 +319,8 @@
#define KVP_KEY_LYRICS_LEN 6
#define KVP_KEY_ALBUMART "graphic"
#define KVP_KEY_ALBUMART_LEN 8
+#define KVP_KEY_POPULARIMETER "popularimeter"
+#define KVP_KEY_POPULARIMETER_LEN 14
#define SEMI_COLON _STRLIT_CHAR(";")
#define NULL_CHARACTER _STRLIT_CHAR("\0")
@@ -346,11 +348,11 @@
#define KVP_PARAM_CHAR_ENCODING_UTF8 "char-encoding=UTF8"
#define KVP_FORMAT_ALBUMART "format=APIC"
#define KVP_FORMAT_ID3V1 "format=id3v1"
-#define KVP_VALTYPE_ALBUMART "valtype=ksv"
+#define KVP_VALTYPE_KSV "valtype=ksv"
#define KVP_ID3V2_VALUE "id3v2"
-#define KVP_VALTYPE_LYRICS "valtype=ksv"
#define KVP_VALTYPE_REQSIZE "reqsize="
+
//id3v1 Genre Lookup table
static const uint8 ID3V1_GENRE[150][64] = { "Blues", "Classic Rock", "Country", "Dance", "Disco",
"Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age",
diff --git a/fileformats/id3parcom/src/pv_id3_parcom.cpp b/fileformats/id3parcom/src/pv_id3_parcom.cpp
index 227f4a9c3..61b098d9f 100644
--- a/fileformats/id3parcom/src/pv_id3_parcom.cpp
+++ b/fileformats/id3parcom/src/pv_id3_parcom.cpp
@@ -1290,9 +1290,12 @@ int PVID3ParCom::ReadTagID3V2(PVID3Version aVersion)
{
uint8 unicodeCheck;
- if (read8(iInputFile, unicodeCheck) == false)
+ if (frameType != PV_ID3_FRAME_POPULARIMETER)
{
- return count;
+ if (read8(iInputFile, unicodeCheck) == false)
+ {
+ return count;
+ }
}
if ((frameType == PV_ID3_FRAME_LYRICS) || (frameType == PV_ID3_FRAME_COMMENT))
@@ -1309,6 +1312,14 @@ int PVID3ParCom::ReadTagID3V2(PVID3Version aVersion)
return count;
}
}
+ else if (frameType == PV_ID3_FRAME_POPULARIMETER)
+ {
+ if (ReadPopularimeterFrame(currFrameLength) != PVMFSuccess)
+ {
+ LOG_ERR((0, "PVID3ParCom::ReadTagID3V2: Error - ReadPopularimeterFrame failed"));
+ return count;
+ }
+ }
else if (unicodeCheck < PV_ID3_CHARSET_END)
{
@@ -1979,6 +1990,10 @@ PVID3ParCom::PVID3FrameType PVID3ParCom::FrameSupportedID3V2(PVID3Version aVersi
{
ID3V2FrameTypeReturnValue = PV_ID3_FRAME_VERSION;
}
+ else if (oscl_memcmp(pFrameID, ID3_FRAME_ID_POPULARIMETER, ID3V2_FRAME_NUM_BYTES_ID) == 0)
+ {
+ ID3V2FrameTypeReturnValue = PV_ID3_FRAME_POPULARIMETER;
+ }
else if (oscl_memcmp(pFrameID, endTestBuf, ID3V2_FRAME_NUM_BYTES_ID) == 0)
{
ID3V2FrameTypeReturnValue = PV_ID3_FRAME_EEND;
@@ -2101,7 +2116,6 @@ PVID3ParCom::PVID3FrameType PVID3ParCom::FrameSupportedID3V2_2(void)
{
ID3V2_2FrameTypeReturnValue = PV_ID3_FRAME_VERSION;
}
-
else if (oscl_memcmp(iID3TagInfo.iID3V2FrameID, endTestBuf, ID3V2_2_FRAME_NUM_BYTES_ID) == 0)
{
ID3V2_2FrameTypeReturnValue = PV_ID3_FRAME_EEND;
@@ -2507,7 +2521,7 @@ PVMFStatus PVID3ParCom::ConstructKvpKey(OSCL_String& aKey, PVID3FrameType aType,
if ((iVersion != PV_ID3_V1_1) && (iVersion != PV_ID3_V1))
{
aKey += SEMI_COLON;
- aKey += KVP_VALTYPE_LYRICS;
+ aKey += KVP_VALTYPE_KSV;
}
break;
case PV_ID3_FRAME_TRACK_LENGTH:
@@ -2523,8 +2537,13 @@ PVMFStatus PVID3ParCom::ConstructKvpKey(OSCL_String& aKey, PVID3FrameType aType,
case PV_ID3_FRAME_LYRICS:
aKey += _STRLIT_CHAR(KVP_KEY_LYRICS);
aKey += SEMI_COLON;
- aKey += KVP_VALTYPE_LYRICS;
+ aKey += KVP_VALTYPE_KSV;
break;
+ case PV_ID3_FRAME_POPULARIMETER:
+ aKey += _STRLIT_CHAR(KVP_KEY_POPULARIMETER);
+ aKey += SEMI_COLON;
+ aKey += KVP_VALTYPE_KSV;
+ return PVMFSuccess;
case PV_ID3_FRAME_UNRECOGNIZED:
case PV_ID3_FRAME_CANDIDATE:
aKey += _STRLIT_CHAR(KVP_ID3V2_VALUE);
@@ -2849,6 +2868,70 @@ PVID3ParCom::readNullTerminatedAsciiString(PVFile* aInputFile, OSCL_HeapString<O
return true;
}
+PVMFStatus PVID3ParCom::ReadPopularimeterFrame(uint32 aFrameSize)
+{
+ PvmfPopmStruct* popmStruct = NULL;
+ uint8 rating;
+ uint32 dataLen = 0;
+ uint32 playbackCounter = 0;
+ int32 err = OsclErrNone;
+ PvmiKvpSharedPtr kvpPtr;
+ OSCL_StackString<128> keyStr;
+ OSCL_HeapString<OsclMemAllocator> emailId;
+ bool truncate = false;
+
+ if (ConstructKvpKey(keyStr, PV_ID3_FRAME_POPULARIMETER, PV_ID3_CHARSET_ISO88591) != PVMFSuccess)
+ {
+ LOG_ERR((0, "PVID3ParCom::ReadPopularimeterFrame: Error - ConstructKvpKey failed"));
+ return PVMFErrNotSupported;
+ }
+
+ if (PVMFSuccess == GetPopmFrameData(aFrameSize, emailId, &rating, playbackCounter, dataLen))
+ {
+ uint32 rfs = emailId.get_size() * sizeof(oscl_wchar) + 2;
+ uint32 total_size = sizeof(PvmfPopmStruct) + rfs;
+
+ OSCL_TRY(err, kvpPtr = AllocateKvp(keyStr, PVMI_KVPVALTYPE_KSV, total_size, truncate););
+ if (OsclErrNone != err || !kvpPtr)
+ {
+ LOG_ERR((0, "PVID3ParCom::ReadPopularimeterFrame: Error - AllocateKvp failed. err=%d", err));
+ return PVMFFailure;
+ }
+
+ uint8 *ptr = NULL;
+ uint32 used_size = 0;
+
+ popmStruct = OSCL_STATIC_CAST(PvmfPopmStruct *, kvpPtr->value.key_specific_value);
+ ptr = (uint8 *)kvpPtr->value.key_specific_value;
+ if (!ptr)
+ {
+ return PVMFFailure;
+ }
+
+ ptr += sizeof(PvmfPopmStruct);
+ used_size += sizeof(PvmfPopmStruct);
+ popmStruct->iUserEmail = OSCL_STATIC_CAST(oscl_wchar *, ptr);
+ uint32 sz = oscl_strlen(emailId.get_cstr()) * sizeof(oscl_wchar) + 2;
+
+ oscl_UTF8ToUnicode((const char *)emailId.get_cstr(), emailId.get_size(), popmStruct->iUserEmail, sz);
+ popmStruct->iCounter = playbackCounter;
+ popmStruct->iRating = rating;
+
+ kvpPtr->capacity = total_size;
+ kvpPtr->length = total_size;
+
+ //convert raw data to struct
+ kvpPtr->value.key_specific_value = (OsclAny*) popmStruct;
+
+ OSCL_TRY(err, iFrames.push_back(kvpPtr););
+ OSCL_FIRST_CATCH_ANY(err,
+ LOG_ERR((0, "PVID3ParCom::ReadPopularimeterFrame: Error - iFrame.push_back failed"));
+ return PVMFErrNoMemory;
+ );
+ }
+ return PVMFSuccess;
+}
+
PVMFStatus PVID3ParCom::ReadAlbumArtFrame(PVID3FrameType aFrameType, uint8 unicode, uint32 aFrameSize)
{
PvmfApicStruct* aApicStruct = NULL;
@@ -2885,7 +2968,7 @@ PVMFStatus PVID3ParCom::ReadAlbumArtFrame(PVID3FrameType aFrameType, uint8 unico
keyStr += KVP_FORMAT_ALBUMART;
keyStr += SEMI_COLON;
- keyStr += KVP_VALTYPE_ALBUMART;
+ keyStr += KVP_VALTYPE_KSV;
//description and image format are stored as wchar.
uint32 rfs = aFrameSize - (ImageFormat.get_size() + description.get_size());
@@ -2941,7 +3024,7 @@ PVMFStatus PVID3ParCom::ReadAlbumArtFrame(PVID3FrameType aFrameType, uint8 unico
keyStr += KVP_FORMAT_ALBUMART;
keyStr += SEMI_COLON;
- keyStr += KVP_VALTYPE_ALBUMART;
+ keyStr += KVP_VALTYPE_KSV;
//image format is stored as wchar.
uint32 rfs = aFrameSize - (ImageFormat.get_size() + (2 * oscl_strlen(description.get_str())));
@@ -3038,7 +3121,6 @@ PVMFStatus PVID3ParCom::ReadAlbumArtFrame(PVID3FrameType aFrameType, uint8 unico
PVMFStatus PVID3ParCom::ReadLyricsCommFrame(uint8 unicodeCheck, uint32 aFramesize, PVID3FrameType aFrameType)
{
-
uint32 framesize = aFramesize;
bool truncate = false;
if (readByteData(iInputFile, ID3V2_LANGUAGE_SIZE, iID3TagInfo.iID3V2LanguageID) == false)
@@ -3585,6 +3667,78 @@ PVMFStatus PVID3ParCom::GetAlbumArtInfo(PVID3FrameType aFrameType, uint32 aFrame
return PVMFSuccess;
}
+PVMFStatus PVID3ParCom::GetPopmFrameData(uint32 aFrameSize, OSCL_HeapString<OsclMemAllocator> &aEmailId, uint8* aRating,
+ uint32 &aPlaybackCounter, uint32 &aDataLen)
+{
+ PVMFStatus status = 0;
+ uint32 emailSize = 0;
+ TOsclFileOffset currentfilepos = 0 ;
+ uint32 frameBytesRead = 0;
+ uint32 pbcounter = 0;
+
+ currentfilepos = iInputFile->Tell();
+ //read user email
+ status = readNullTerminatedAsciiString(iInputFile, aEmailId);
+ if (status != PVMFSuccess)
+ {
+ iInputFile->Seek(currentfilepos, Oscl_File::SEEKSET);
+ return PVMFFailure;
+ }
+ //get the email id len
+ emailSize = aEmailId.get_size() + 1 ; // 1 byte for null char
+ frameBytesRead += emailSize;
+
+ // read the rating
+ if (read8(iInputFile, *aRating) == false)
+ {
+ return PVMFFailure;
+ }
+
+ frameBytesRead++; // for rating byte
+ // check if the counter exist
+ if (aFrameSize > frameBytesRead)
+ {
+ uint32 counterLength = aFrameSize - frameBytesRead;
+ if (counterLength < 4) // 4 is min length of counter
+ {
+ frameBytesRead += counterLength;
+ iInputFile->Seek(counterLength, Oscl_File::SEEKCUR);
+ }
+ else
+ {
+ bool ret = true;
+ if (counterLength == 4)
+ ret = read32(iInputFile, (uint32&)pbcounter);
+ else
+ {
+ uint8* counter = OSCL_ARRAY_NEW(uint8, counterLength + 1);
+ ret = readByteData(iInputFile, counterLength, counter);
+ pbcounter = (uint32)(*counter);
+ OSCL_ARRAY_DELETE(counter);
+ }
+
+ frameBytesRead += counterLength; // for counter length
+
+ if (!ret)
+ {
+ return PVMFFailure;
+ }
+ }
+ }
+
+
+ aDataLen = frameBytesRead;
+ aPlaybackCounter = pbcounter;
+
+ if (aDataLen > aFrameSize)
+ {
+ iInputFile->Seek(currentfilepos, Oscl_File::SEEKSET);
+ aDataLen = 0;
+ return PVMFFailure;
+ }
+ return PVMFSuccess;
+}
+
////////////////////////////////////////////////////////////////////////////
PVMFStatus PVID3ParCom::ReadTrackLengthFrame(uint32 aValueSize, PVID3CharacterSet aCharSet)
@@ -3952,6 +4106,11 @@ PVMFStatus PVID3ParCom::GetFrameTypeFromKvp(const PvmiKvp& aKvp,
aFrameID = _STRLIT_CHAR(ID3_FRAME_ID_ALBUMART);
aFrameType = PV_ID3_FRAME_APIC;
}
+ else if (pv_mime_strcmp(aKvp.key, KVP_KEY_POPULARIMETER) == 0)
+ {
+ aFrameID = _STRLIT_CHAR(ID3_FRAME_ID_POPULARIMETER);
+ aFrameType = PV_ID3_FRAME_POPULARIMETER;
+ }
else
{
LOG_ERR((0, "PVID3ParCom::GetFrameTypeFromKvp: Error : Frame type not supported for composing"));
diff --git a/fileformats/mp3/parser/include/mp3parser.h b/fileformats/mp3/parser/include/mp3parser.h
index 2e9ae6ff5..c00659a80 100644
--- a/fileformats/mp3/parser/include/mp3parser.h
+++ b/fileformats/mp3/parser/include/mp3parser.h
@@ -310,6 +310,15 @@ class MP3Parser
uint32 GetChannelMode() const;
/**
+ * @brief Retreives and returns layer id for the current
+ * of mp3 file
+ *
+ * @param
+ * @returns
+ */
+ uint32 GetLayerID() const;
+
+ /**
* @brief Returns the content of decoder specific info.
*
* @param None
@@ -486,7 +495,6 @@ class MP3Parser
uint32 iBinWidth;
uint32 iMaxTOCFillStepsPerBin;
uint32 iBinFillCounter;
-
uint32 iSamplingRate;
uint32 iSamplesPerFrame;
diff --git a/fileformats/mp3/parser/src/imp3ff.cpp b/fileformats/mp3/parser/src/imp3ff.cpp
index 55a9a62ed..0d74dda11 100644
--- a/fileformats/mp3/parser/src/imp3ff.cpp
+++ b/fileformats/mp3/parser/src/imp3ff.cpp
@@ -61,11 +61,13 @@ static const char PVMP3METADATA_TRACKINFO_SAMPLERATE_KEY[] = "track-info/sample-
static const char PVMP3METADATA_TRACKINFO_AUDIO_FORMAT_KEY[] = "track-info/audio/format";
static const char PVMP3METADATA_TRACKINFO_AUDIO_CHANNELS_KEY[] = "track-info/audio/channels";
static const char PVMP3METADATA_TRACKINFO_AUDIO_CHANNEL_MODE_KEY[] = "track-info/audio/channel-mode";
+static const char PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY[] = "track-info/audio/layer-id";
static const char PVMP3METADATA_BITRATE_KEY[] = "bit-rate";
static const char PVMP3METADATA_SAMPLERATE_KEY[] = "sample-rate";
static const char PVMP3METADATA_FORMAT_KEY[] = "format";
static const char PVMP3METADATA_CHANNELS_KEY[] = "channels";
static const char PVMP3METADATA_CHANNEL_MODE_KEY[] = "channel-mode";
+static const char PVMP3METADATA_LAYER_ID_KEY[] = "layer-id";
static const char PVMP3METADATA_RANDOM_ACCESS_DENIED_KEY[] = "random-access-denied";
static const char PVMP3METADATA_SEMICOLON[] = ";";
static const char PVMP3METADATA_CHARENCUTF8[] = "char-encoding=UTF8";
@@ -256,6 +258,13 @@ OSCL_EXPORT_REF MP3ErrorType IMpeg3File::ParseMp3File()
return MP3_ERR_NO_MEMORY;
}
+ leavecode = OsclErrNone;
+ leavecode = PushKVPKey(PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY, iAvailableMetadataKeys);
+ if (OsclErrNone != leavecode)
+ {
+ return MP3_ERR_NO_MEMORY;
+ }
+
MP3ContentFormatType mp3info;
if (GetConfigDetails(mp3info) == MP3_SUCCESS)
{
@@ -651,6 +660,16 @@ OSCL_EXPORT_REF uint32 IMpeg3File::GetNumMetadataValues(PVMFMetadataList& aKeyLi
++numvalentries;
}
}
+ else if (oscl_strcmp(aKeyList[lcv].get_cstr(), PVMP3METADATA_LAYER_ID_KEY) == 0 ||
+ oscl_strcmp(aKeyList[lcv].get_cstr(), PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY) == 0)
+ {
+ // Layer id
+ if (pMP3Parser)
+ {
+ // Increment the counter for the number of values found so far
+ ++numvalentries;
+ }
+ }
} // End of for loop
return numvalentries;
}
@@ -1416,6 +1435,49 @@ OSCL_EXPORT_REF PVMFStatus IMpeg3File::GetMetadataValues(PVMFMetadataList& aKeyL
}
}
}
+ else if (oscl_strcmp(aKeyList[lcv].get_cstr(), PVMP3METADATA_LAYER_ID_KEY) == 0 ||
+ oscl_strcmp(aKeyList[lcv].get_cstr(), PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY) == 0)
+ {
+ // Layer ID
+ if (pMP3Parser)
+ {
+ // Increment the counter for the number of values found so far
+ ++numvalentries;
+
+ // Create a value entry if past the starting index
+ if (numvalentries > aStartingValueIndex)
+ {
+ KeyLen = oscl_strlen(PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY) + 1; // for "track-info/audio/layer-id;"
+ KeyLen += oscl_strlen(PVMI_KVPVALTYPE_STRING_CONSTCHAR); // for "valtype="
+ KeyLen += oscl_strlen(PVMI_KVPVALTYPE_UINT32_STRING_CONSTCHAR) + 1; // for "uint32" and NULL terminator
+
+ // Allocate memory for the string
+ leavecode = 0;
+ KeyVal.key = (char*) AllocateKVPKeyArray(leavecode, PVMI_KVPVALTYPE_CHARPTR, KeyLen);
+
+ if (leavecode == 0)
+ {
+ // Copy the key string
+ oscl_strncpy(KeyVal.key, PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY, oscl_strlen(PVMP3METADATA_TRACKINFO_AUDIO_LAYER_ID_KEY) + 1);
+ oscl_strncat(KeyVal.key, PVMP3METADATA_SEMICOLON, oscl_strlen(PVMP3METADATA_SEMICOLON));
+ oscl_strncat(KeyVal.key, PVMI_KVPVALTYPE_STRING_CONSTCHAR, oscl_strlen(PVMI_KVPVALTYPE_STRING_CONSTCHAR));
+ oscl_strncat(KeyVal.key, PVMI_KVPVALTYPE_UINT32_STRING_CONSTCHAR, oscl_strlen(PVMI_KVPVALTYPE_UINT32_STRING_CONSTCHAR));
+ KeyVal.key[KeyLen-1] = NULL_TERM_CHAR;
+ // Copy the value
+ KeyVal.value.uint32_value = pMP3Parser->GetLayerID();
+ // Set the length and capacity
+ KeyVal.length = 1;
+ KeyVal.capacity = 1;
+ }
+ else
+ {
+ // Memory allocation failed
+ KeyVal.key = NULL;
+ break;
+ }
+ }
+ }
+ }
// Add the KVP to the list if the key string was created
if (KeyVal.key != NULL)
diff --git a/fileformats/mp3/parser/src/mp3parser.cpp b/fileformats/mp3/parser/src/mp3parser.cpp
index 6bcb11bca..1c918f2f8 100644
--- a/fileformats/mp3/parser/src/mp3parser.cpp
+++ b/fileformats/mp3/parser/src/mp3parser.cpp
@@ -1435,6 +1435,34 @@ uint32 MP3Parser::GetChannelMode() const
}
/***********************************************************************
+ * Function : GetLayerID
+ * Purpose : Fetch Layer ID for the clip
+ * Input : None
+ * Output :
+ * Return : LayerID
+ * Modified :
+ ***********************************************************************/
+uint32 MP3Parser::GetLayerID() const
+{
+ uint32 layerId = 0;
+ switch (iMP3HeaderInfo.layerID)
+ {
+ case MPEG_LAYER_I:
+ layerId = 1;
+ break;
+ case MPEG_LAYER_II:
+ layerId = 2;
+ break;
+ case MPEG_LAYER_III:
+ layerId = 3;
+ break;
+ default:
+ break;
+ }
+ return layerId;
+}
+
+/***********************************************************************
* Function : GetDurationFromMetadata
* Purpose : Fetch duration value from id3 frame (TLEN - track length)
* Input : None
diff --git a/pvmi/pvmf/include/pvmi_kvp.h b/pvmi/pvmf/include/pvmi_kvp.h
index 6e2587e7d..e2f126d09 100644
--- a/pvmi/pvmf/include/pvmi_kvp.h
+++ b/pvmi/pvmf/include/pvmi_kvp.h
@@ -343,6 +343,27 @@ class PvmfLyricsCommStruct
oscl_wchar *iData;
};
+class PvmfPopmStruct
+{
+ public:
+ PvmfPopmStruct()
+ {
+ iUserEmail = NULL;
+ iRating = 0;
+ iCounter = 0;
+ };
+ virtual ~PvmfPopmStruct()
+ {
+ iUserEmail = NULL;
+ iRating = 0;
+ iCounter = 0;
+ }
+
+ oscl_wchar *iUserEmail;
+ int32 iRating;
+ int32 iCounter;
+};
+
class PvmfAssetInfo3GPPLocationStruct
{