247 } |
247 } |
248 |
248 |
249 CMdEObject* object = iMdsSession->NewObjectLC( |
249 CMdEObject* object = iMdsSession->NewObjectLC( |
250 *iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1-> |
250 *iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1-> |
251 |
251 |
252 // check if the file exists and use the creation time from the file |
252 // Value from aVideo is taken in use in Media2ObjectL if aVideo contains creation date |
253 |
253 SetCreationAndModifiedDatesL( *object ); // use current time |
254 SetCreationAndModifiedDatesL( *object ); |
254 |
255 |
|
256 #if 0 |
|
257 TTime time; |
|
258 time.UniversalTime(); |
|
259 TTimeIntervalSeconds timeOffset = User::UTCOffset(); |
|
260 TTime localTime = time + timeOffset; |
|
261 |
|
262 const TInt secondsInMinute( 60 ); |
|
263 object->AddTimePropertyL( *iCreationDatePropertyDef, localTime ); |
|
264 object->AddInt16PropertyL( *iTimeOffsetPropertyDef, timeOffset.Int() / secondsInMinute ); |
|
265 object->AddTimePropertyL( *iLastModifiedDatePropertyDef, localTime ); |
|
266 #endif |
|
267 object->AddUint8PropertyL( *iOriginPropertyDef, |
255 object->AddUint8PropertyL( *iOriginPropertyDef, |
268 aVideo.ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ) ); |
256 aVideo.ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ) ); |
269 |
257 |
270 CMdEProperty* property; |
258 CMdEProperty* property; |
271 |
259 |
653 CMdEObject* object = ObjectL( aId ); |
641 CMdEObject* object = ObjectL( aId ); |
654 |
642 |
655 if ( !object ) |
643 if ( !object ) |
656 { |
644 { |
657 MPX_DEBUG2("CVcxMyVideosMdsDb:: mds id %d not found from mds", aId); |
645 MPX_DEBUG2("CVcxMyVideosMdsDb:: mds id %d not found from mds", aId); |
658 User::Leave( KErrNotFound ); |
646 return NULL; |
659 } |
647 } |
660 |
648 |
661 CleanupStack::PushL( object ); // 1-> |
649 CleanupStack::PushL( object ); // 1-> |
662 |
650 |
663 CMPXMedia* video = CMPXMedia::NewL( ); |
651 CMPXMedia* video = CMPXMedia::NewL( ); |
738 |
726 |
739 // --------------------------------------------------------------------------- |
727 // --------------------------------------------------------------------------- |
740 // CVcxMyVideosMdsDb::ObjectL |
728 // CVcxMyVideosMdsDb::ObjectL |
741 // --------------------------------------------------------------------------- |
729 // --------------------------------------------------------------------------- |
742 // |
730 // |
743 CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId ) |
731 CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId, TBool aIsVideo ) |
744 { |
732 { |
745 if ( !iMdsSession ) |
733 if ( !iMdsSession ) |
746 { |
734 { |
747 MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError); |
735 MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError); |
748 User::Leave( iMdsError ); |
736 User::Leave( iMdsError ); |
958 { |
954 { |
959 TInt pos = static_cast<CMdEReal32Property*>(property)->Value(); |
955 TInt pos = static_cast<CMdEReal32Property*>(property)->Value(); |
960 |
956 |
961 aVideo.SetTObjectValueL<TInt>( KMPXMediaGeneralLastPlaybackPosition, pos ); |
957 aVideo.SetTObjectValueL<TInt>( KMPXMediaGeneralLastPlaybackPosition, pos ); |
962 } |
958 } |
963 |
|
964 #if 0 |
|
965 //18. DOWNLOAD ID (BRIEF) |
|
966 if ( aObject.Property( *iDownloadIdPropertyDef, property, 0 ) != KErrNotFound ) |
|
967 { |
|
968 aVideo.SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, |
|
969 static_cast<CMdEUint32Property*>(property)->Value() ); |
|
970 } |
|
971 else |
|
972 { |
|
973 aVideo.SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, 0 ); |
|
974 } |
|
975 #endif |
|
976 |
959 |
977 //19. RATING (FULL) |
960 //19. RATING (FULL) |
978 if ( aObject.Property( *iRatingPropertyDef, property, 0 ) != KErrNotFound |
961 if ( aObject.Property( *iRatingPropertyDef, property, 0 ) != KErrNotFound |
979 && aFullDetails ) |
962 && aFullDetails ) |
980 { |
963 { |
1104 aObject.AddUint32PropertyL( *iSizePropertyDef, size ); |
1087 aObject.AddUint32PropertyL( *iSizePropertyDef, size ); |
1105 } |
1088 } |
1106 } |
1089 } |
1107 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
1090 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
1108 |
1091 |
1109 #if 0 |
|
1110 // 6. KMPXMediaGeneralDate ( creation date ) |
1092 // 6. KMPXMediaGeneralDate ( creation date ) |
1111 if ( aVideo.IsSupported( KMPXMediaGeneralDate ) ) |
1093 SetCreationDateToObjectL( aVideo, aObject ); |
1112 { |
|
1113 TInt64 creationDateInt64 = 0; |
|
1114 creationDateInt64 = aVideo.ValueTObjectL<TInt64>( KMPXMediaGeneralDate ); |
|
1115 TTime creationDate( creationDateInt64 ); |
|
1116 if ( aObject.Property( *iCreationDatePropertyDef, property, 0 ) != KErrNotFound ) |
|
1117 { |
|
1118 static_cast<CMdETimeProperty*>(property)->SetValueL( creationDate ); |
|
1119 } |
|
1120 else |
|
1121 { |
|
1122 aObject.AddTimePropertyL( *iCreationDatePropertyDef, creationDate ); |
|
1123 } |
|
1124 } |
|
1125 #endif |
|
1126 |
1094 |
1127 // 7. KMPXMediaGeneralFlags (including DRM flag) |
1095 // 7. KMPXMediaGeneralFlags (including DRM flag) |
1128 if ( aVideo.IsSupported( KMPXMediaGeneralFlags ) ) |
1096 if ( aVideo.IsSupported( KMPXMediaGeneralFlags ) ) |
1129 { |
1097 { |
1130 TUint32 flags = aVideo.ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ); |
1098 TUint32 flags = aVideo.ValueTObjectL<TUint32>( KMPXMediaGeneralFlags ); |
1327 else |
1295 else |
1328 { |
1296 { |
1329 aObject.AddReal32PropertyL( *iLastPlayPositionPropertyDef, lastPlaybackPos ); |
1297 aObject.AddReal32PropertyL( *iLastPlayPositionPropertyDef, lastPlaybackPos ); |
1330 } |
1298 } |
1331 } |
1299 } |
1332 |
|
1333 #if 0 |
|
1334 // 18. DOWNLOAD ID |
|
1335 if ( aVideo.IsSupported( KVcxMediaMyVideosDownloadId ) ) |
|
1336 { |
|
1337 TUint32 dlId = aVideo.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ); |
|
1338 |
|
1339 if ( aObject.Property( *iDownloadIdPropertyDef, property, 0 ) != KErrNotFound ) |
|
1340 { |
|
1341 static_cast<CMdEUint32Property*>(property)->SetValueL( dlId ); |
|
1342 } |
|
1343 else |
|
1344 { |
|
1345 aObject.AddUint32PropertyL( *iDownloadIdPropertyDef, dlId ); |
|
1346 } |
|
1347 } |
|
1348 #endif |
|
1349 |
1300 |
1350 // 19. RATING |
1301 // 19. RATING |
1351 if ( aVideo.IsSupported( KVcxMediaMyVideosRating ) ) |
1302 if ( aVideo.IsSupported( KVcxMediaMyVideosRating ) ) |
1352 { |
1303 { |
1353 TUint8 rating = aVideo.ValueTObjectL<TUint8>( KVcxMediaMyVideosRating ); |
1304 TUint8 rating = aVideo.ValueTObjectL<TUint8>( KVcxMediaMyVideosRating ); |
1432 else |
1383 else |
1433 { |
1384 { |
1434 aObject.AddTextPropertyL( |
1385 aObject.AddTextPropertyL( |
1435 *iArtistPropertyDef, aVideo.ValueText( KMPXMediaVideoArtist ) ); |
1386 *iArtistPropertyDef, aVideo.ValueText( KMPXMediaVideoArtist ) ); |
1436 } |
1387 } |
|
1388 } |
|
1389 } |
|
1390 |
|
1391 // --------------------------------------------------------------------------- |
|
1392 // CVcxMyVideosMdsDb::SetCreationDateToObjectL |
|
1393 // --------------------------------------------------------------------------- |
|
1394 // |
|
1395 void CVcxMyVideosMdsDb::SetCreationDateToObjectL( const CMPXMedia& aVideo, CMdEObject& aObject ) |
|
1396 { |
|
1397 CMdEProperty* property; |
|
1398 |
|
1399 if ( aVideo.IsSupported( KMPXMediaGeneralDate ) ) |
|
1400 { |
|
1401 TInt64 creationDateInt64 = 0; |
|
1402 creationDateInt64 = aVideo.ValueTObjectL<TInt64>( KMPXMediaGeneralDate ); |
|
1403 TTime creationDate( creationDateInt64 ); |
|
1404 if ( aObject.Property( *iCreationDatePropertyDef, property, 0 ) != KErrNotFound ) |
|
1405 { |
|
1406 static_cast<CMdETimeProperty*>(property)->SetValueL( creationDate ); |
|
1407 } |
|
1408 else |
|
1409 { |
|
1410 aObject.AddTimePropertyL( *iCreationDatePropertyDef, creationDate ); |
|
1411 } |
|
1412 #ifdef _DEBUG |
|
1413 TDateTime dT = creationDate.DateTime(); |
|
1414 TBuf<200> buf; |
|
1415 buf.Format(_L("date from aVideo to aObject: %2d.%2d.%4d %2d:%2d:%2d"), |
|
1416 dT.Day()+1, dT.Month()+1, dT.Year(), dT.Hour(), dT.Minute(), dT.Second() ); |
|
1417 MPX_DEBUG2("%S", &buf ); |
|
1418 #endif |
1437 } |
1419 } |
1438 } |
1420 } |
1439 |
1421 |
1440 // --------------------------------------------------------------------------- |
1422 // --------------------------------------------------------------------------- |
1441 // CVcxMyVideosMdsDb::GetSchemaDefinitionsL |
1423 // CVcxMyVideosMdsDb::GetSchemaDefinitionsL |