harvesterplugins/media/audio/src/cpixmediaaudiodoc.cpp
changeset 13 0a2ec6860a93
parent 9 4a2987baf8f7
child 16 e918432ddd92
equal deleted inserted replaced
10:d05738f02936 13:0a2ec6860a93
   219     
   219     
   220     //Size property
   220     //Size property
   221     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   221     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   222     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   222     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   223        {
   223        {
   224        //Add field to document
   224        //Add field to document       
   225        if( property->Def().PropertyType() == EPropertyUint32 )
   225        CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   226            {
   226        TBuf<32> buf;
   227            CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   227        buf.Format(_L("%u"), sizeProperty.Value());
   228            TBuf<32> buf;
   228        AddFiledtoDocumentL(*index_item,
   229            buf.Format(_L("%u"), sizeProperty.Value());
   229                        MdeConstants::Object::KSizeProperty,
   230            AddFiledtoDocumentL(*index_item,
   230                        buf,
   231                            MdeConstants::Object::KSizeProperty,
   231                        CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   232                            buf,
   232        AddToFieldExcerptL(buf);       
   233                            CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   234            AddToFieldExcerptL(buf);
       
   235            }
       
   236        }
   233        }
   237     
   234     
   238     //Get legal property
   235     //Get legal property
   239     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
   236     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
   240     if(aObject.Property( legalPropDef, property ) != KErrNotFound)
   237     if(aObject.Property( legalPropDef, property ) != KErrNotFound)
   249     //Get track property
   246     //Get track property
   250     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
   247     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
   251     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
   248     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
   252        {
   249        {
   253        //Add field to document       
   250        //Add field to document       
   254        if( property->Def().PropertyType() == EPropertyUint16 )
   251        CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
   255            {
   252        TBuf<32> buf;
   256            CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
   253        buf.Format(_L("%d"), trackProperty.Value());
   257            TBuf<32> buf;
   254        AddFiledtoDocumentL(*index_item,
   258            buf.Format(_L("%d"), trackProperty.Value());
   255                           MdeConstants::MediaObject::KTrackProperty,
   259            AddFiledtoDocumentL(*index_item,
   256                           buf);
   260                               MdeConstants::MediaObject::KTrackProperty,
   257        
   261                               buf);
       
   262            }       
       
   263        }
   258        }
   264     // Capturedate property
   259     // Capturedate property
   265     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
   260     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
   266     if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
   261     if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
   267       {
   262       {
   268       //Add field to document
   263       //Add field to document      
   269       if(EPropertyTime == property->Def().PropertyType())
   264       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   270           {
   265       TDateTime time = timeProperty.Value().DateTime();
   271           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   266       TBuf<32> buf;
   272           TDateTime time = timeProperty.Value().DateTime();
   267       buf.Format( KFormatDateTime, time.Year(), 
   273           TBuf<32> buf;
   268                                    time.Month() + 1, 
   274           buf.Format( KFormatDateTime, time.Year(), 
   269                                    time.Day() + 1, 
   275                                        time.Month() + 1, 
   270                                    time.Hour(), 
   276                                        time.Day() + 1, 
   271                                    time.Minute());
   277                                        time.Hour(), 
   272       
   278                                        time.Minute());
   273       AddFiledtoDocumentL(*index_item,
   279           
   274                          MdeConstants::MediaObject::KCaptureDateProperty,
   280           AddFiledtoDocumentL(*index_item,
   275                          buf,
   281                              MdeConstants::MediaObject::KCaptureDateProperty,
   276                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   282                              buf,
   277       
   283                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   278       //Format for excerpt field
   284           
   279       buf.Format( KExcerptFormat, time.Year(), 
   285           //Format for excerpt field
   280                                  time.Month() + 1, 
   286           buf.Format( KExcerptFormat, time.Year(), 
   281                                  time.Day() + 1, 
   287                                      time.Month() + 1, 
   282                                  time.Hour(), 
   288                                      time.Day() + 1, 
   283                                  time.Minute());
   289                                      time.Hour(), 
   284       AddToFieldExcerptL(buf);         
   290                                      time.Minute());
       
   291           AddToFieldExcerptL(buf);
       
   292           }
       
   293       }
   285       }
   294     //Get LastModifiedDate property
   286     //Get LastModifiedDate property
   295     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   287     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   296     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   288     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   297       {
   289       {
   298       //Add field to document
   290       //Add field to document      
   299       if(EPropertyTime == property->Def().PropertyType())
   291       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   300           {
   292       TDateTime time = timeProperty.Value().DateTime();
   301           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   293       TBuf<32> buf;
   302           TDateTime time = timeProperty.Value().DateTime();
   294       buf.Format( KFormatDateTime, time.Year(),
   303           TBuf<32> buf;
   295                                    time.Month() + 1,
   304           buf.Format( KFormatDateTime, time.Year(),
   296                                    time.Day() + 1,
   305                                        time.Month() + 1,
   297                                    time.Hour(),
   306                                        time.Day() + 1,
       
   307                                        time.Hour(),
       
   308                                        time.Minute());
       
   309           
       
   310           AddFiledtoDocumentL(*index_item,
       
   311                              MdeConstants::Object::KLastModifiedDateProperty,
       
   312                              buf,
       
   313                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   314           //Format for excerpt field
       
   315           buf.Format( KExcerptFormat, time.Year(), 
       
   316                                    time.Month() + 1, 
       
   317                                    time.Day() + 1, 
       
   318                                    time.Hour(), 
       
   319                                    time.Minute());
   298                                    time.Minute());
   320           AddToFieldExcerptL(buf);
   299       
   321           }
   300       AddFiledtoDocumentL(*index_item,
       
   301                          MdeConstants::Object::KLastModifiedDateProperty,
       
   302                          buf,
       
   303                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   304       //Format for excerpt field
       
   305       buf.Format( KExcerptFormat, time.Year(), 
       
   306                                time.Month() + 1, 
       
   307                                time.Day() + 1, 
       
   308                                time.Hour(), 
       
   309                                time.Minute());
       
   310       AddToFieldExcerptL(buf);
   322       }
   311       }
   323     //Get duration property
   312     //Get duration property
   324     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
   313     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
   325     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
   314     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
   326        {        
   315        {        
   327        //Add field to document
   316        //Add field to document       
   328        if( property->Def().PropertyType() == EPropertyReal32 )
   317        CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
   329            {
   318        TBuf<32> buf;
   330            CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
   319        buf.Format(_L("%f"), durationProperty.Value());
   331            TBuf<32> buf;
   320        AddFiledtoDocumentL(*index_item,
   332            buf.Format(_L("%f"), durationProperty.Value());
   321                       MdeConstants::MediaObject::KDurationProperty,
   333            AddFiledtoDocumentL(*index_item,
   322                       buf );
   334                           MdeConstants::MediaObject::KDurationProperty,
   323        
   335                           buf );
   324        }
   336            }       
   325     
   337        }
   326     index_item->AddExcerptL(*iExcerpt);
   338     if( iExcerpt )
   327 
   339         {
       
   340         index_item->AddExcerptL(*iExcerpt);
       
   341         }
       
   342     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
   328     CPIXLOGSTRING("END CCPIXMediaAudioDoc::GetCpixDocumentL");
   343     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
   329     OstTraceFunctionExit0( CCPIXMEDIAAUDIODOC_GETCPIXDOCUMENTL_EXIT );
   344     return index_item;
   330     return index_item;
   345     }
   331     }
   346 //End of life
   332 //End of life