summaryrefslogtreecommitdiffstats
path: root/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-03-11 09:15:55 (GMT)
committeraxis <qt-info@nokia.com>2010-03-11 09:42:47 (GMT)
commita375537d32bc33ba1154ec132f99f5a779bce067 (patch)
tree3c23e3b2c44fb52d7d62036fe7dd793e589841e8 /src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
parent02f6da62a42bd1059eb0da091d1f46efbb919750 (diff)
parent1e9552f826c05bf9884fb2893dedca265ead363b (diff)
downloadQt-a375537d32bc33ba1154ec132f99f5a779bce067.zip
Qt-a375537d32bc33ba1154ec132f99f5a779bce067.tar.gz
Qt-a375537d32bc33ba1154ec132f99f5a779bce067.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts: mkspecs/common/symbian/symbian.conf qmake/generators/makefile.h qmake/project.cpp src/3rdparty/webkit/WebCore/WebCore.pro src/src.pro
Diffstat (limited to 'src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm')
-rw-r--r--src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm75
1 files changed, 44 insertions, 31 deletions
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
index a14981a..59d01a2 100644
--- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
+++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playermetadata.mm
@@ -132,15 +132,19 @@ static OSStatus readMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, QT
UInt32 propFlags;
OSStatus err = QTMetaDataGetItemPropertyInfo(metaDataRef, item, propClass, id, &type, &propSize, &propFlags);
-
- *value = malloc(propSize);
-
- err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size);
-
- if (type == 'code' || type == 'itsk' || type == 'itlk') {
- // convert from native endian to big endian
- OSTypePtr pType = (OSTypePtr)*value;
- *pType = EndianU32_NtoB(*pType);
+ if (err == noErr) {
+ *value = malloc(propSize);
+ if (*value != 0) {
+ err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size);
+
+ if (err == noErr && (type == 'code' || type == 'itsk' || type == 'itlk')) {
+ // convert from native endian to big endian
+ OSTypePtr pType = (OSTypePtr)*value;
+ *pType = EndianU32_NtoB(*pType);
+ }
+ }
+ else
+ return -1;
}
return err;
@@ -153,10 +157,14 @@ static UInt32 getMetaType(QTMetaDataRef metaDataRef, QTMetaDataItem item)
OSStatus err = readMetaValue(
metaDataRef, item, kPropertyClass_MetaDataItem, kQTMetaDataItemPropertyID_DataType, &value, &ignore);
- UInt32 type = *((UInt32 *) value);
- if (value)
- free(value);
- return type;
+ if (err == noErr) {
+ UInt32 type = *((UInt32 *) value);
+ if (value)
+ free(value);
+ return type;
+ }
+
+ return 0;
}
static QString cFStringToQString(CFStringRef str)
@@ -179,23 +187,26 @@ static QString getMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, SInt
QTPropertyValuePtr value = 0;
ByteCount size = 0;
OSStatus err = readMetaValue(metaDataRef, item, kPropertyClass_MetaDataItem, id, &value, &size);
-
QString string;
- UInt32 dataType = getMetaType(metaDataRef, item);
- switch (dataType){
- case kQTMetaDataTypeUTF8:
- case kQTMetaDataTypeMacEncodedText:
- string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false));
- break;
- case kQTMetaDataTypeUTF16BE:
- string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false));
- break;
- default:
- break;
+
+ if (err == noErr) {
+ UInt32 dataType = getMetaType(metaDataRef, item);
+ switch (dataType){
+ case kQTMetaDataTypeUTF8:
+ case kQTMetaDataTypeMacEncodedText:
+ string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false));
+ break;
+ case kQTMetaDataTypeUTF16BE:
+ string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false));
+ break;
+ default:
+ break;
+ }
+
+ if (value)
+ free(value);
}
- if (value)
- free(value);
return string;
}
@@ -234,11 +245,13 @@ void QT7PlayerMetaDataControl::updateTags()
#ifdef QUICKTIME_C_API_AVAILABLE
QTMetaDataRef metaDataRef;
OSStatus err = QTCopyMovieMetaData([movie quickTimeMovie], &metaDataRef);
-
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap);
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap);
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap);
+ if (err == noErr) {
+ readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap);
+ readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap);
+ readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap);
+ }
#else
+ AutoReleasePool pool;
NSString *name = [movie attributeForKey:@"QTMovieDisplayNameAttribute"];
metaMap.insert(QLatin1String("nam"), QString::fromUtf8([name UTF8String]));
#endif // QUICKTIME_C_API_AVAILABLE