harvesterplugins/media/video/src/cpixmediavideodoc.cpp
changeset 17 7d8c8d8f5eab
parent 12 993ab30e92fc
child 20 68cdadcf169e
equal deleted inserted replaced
12:993ab30e92fc 17:7d8c8d8f5eab
   104     if(aObject.Property( titlePropDef, property ) != KErrNotFound)
   104     if(aObject.Property( titlePropDef, property ) != KErrNotFound)
   105         {
   105         {
   106         CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   106         CMdETextProperty* textProperty = ( CMdETextProperty* ) property;
   107         if( textProperty->Value().Compare(KNullDesC) > 0 )AddToFieldExcerptL(name); //Add name to excerpt field
   107         if( textProperty->Value().Compare(KNullDesC) > 0 )AddToFieldExcerptL(name); //Add name to excerpt field
   108         }
   108         }
       
   109 #ifdef USE_HIGHLIGHTER
       
   110     //Get the media file extension and store
       
   111     TBuf<KMaxExtLength> extension;        
       
   112     GetExtension(aObject.Uri(),extension);
       
   113     AddToFieldExcerptL(extension);
       
   114 #endif 
   109 
   115 
   110     //URI and Excerpt is done add additional properties here 
   116     //URI and Excerpt is done add additional properties here 
   111     CMdEPropertyDef& descriptionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDescriptionProperty );
   117     
   112     if(aObject.Property( descriptionPropDef, property ) != KErrNotFound)
       
   113        {
       
   114        //Add field to document
       
   115        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
       
   116        AddFiledtoDocumentL(*index_item,
       
   117                   MdeConstants::MediaObject::KDescriptionProperty,
       
   118                   textProperty->Value());
       
   119        AddToFieldExcerptL(textProperty->Value());
       
   120        }
       
   121     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
   118     CMdEPropertyDef& artistPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KArtistProperty );
   122     if(aObject.Property( artistPropDef, property )!= KErrNotFound)
   119     if(aObject.Property( artistPropDef, property )!= KErrNotFound)
   123        {
   120        {
   124        //Add field to document
   121        //Add field to document
   125        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   122        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   187        }
   184        }
   188     //Size property
   185     //Size property
   189     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   186     CMdEPropertyDef& sizePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
   190     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   187     if(aObject.Property( sizePropDef, property )!= KErrNotFound)
   191        {
   188        {
   192        //Add field to document
   189        //Add field to document       
   193        if( property->Def().PropertyType() == EPropertyUint32 )
   190        CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   194            {
   191        TBuf<32> buf;
   195            CMdEUint32Property& sizeProperty = static_cast < CMdEUint32Property& > (*property );
   192        buf.Format(_L("%u"), sizeProperty.Value());
   196            TBuf<32> buf;
   193        AddFiledtoDocumentL(*index_item,
   197            buf.Format(_L("%u"), sizeProperty.Value());
   194                        MdeConstants::Object::KSizeProperty,
   198            AddFiledtoDocumentL(*index_item,
   195                        buf,
   199                            MdeConstants::Object::KSizeProperty,
   196                        CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   200                            buf,
   197        AddToFieldExcerptL(buf);
   201                            CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   202            AddToFieldExcerptL(buf);
       
   203            }
       
   204        }    
   198        }    
   205     //Get resolution property
   199     //Get resolution property
   206     CMdEPropertyDef& resolutionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KResolutionUnitProperty );
   200     CMdEPropertyDef& resolutionPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KResolutionUnitProperty );
   207     if(aObject.Property( resolutionPropDef, property ) != KErrNotFound)
   201     if(aObject.Property( resolutionPropDef, property ) != KErrNotFound)
   208        {
   202        {
   209        //Add field to document
   203        //Add field to document       
   210        if( property->Def().PropertyType() == EPropertyUint16 )
   204        CMdEUint16Property& resolutionProperty = static_cast < CMdEUint16Property& > (*property );               
   211            {
   205        TBuf<32> buf;
   212            CMdEUint16Property& resolutionProperty = static_cast < CMdEUint16Property& > (*property );               
   206        buf.Format(_L("%d"), resolutionProperty.Value());
   213            TBuf<32> buf;
   207        AddFiledtoDocumentL(*index_item,
   214            buf.Format(_L("%d"), resolutionProperty.Value());
   208                           MdeConstants::MediaObject::KResolutionUnitProperty,
   215            AddFiledtoDocumentL(*index_item,
   209                           buf,
   216                               MdeConstants::MediaObject::KResolutionUnitProperty,
   210                           CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   217                               buf,
   211        
   218                               CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   219            }       
       
   220        }    
   212        }    
   221     //Get legal property
   213     //Get legal property
   222     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
   214     CMdEPropertyDef& legalPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KLegalProperty );
   223     if(aObject.Property( legalPropDef, property ) != KErrNotFound)
   215     if(aObject.Property( legalPropDef, property ) != KErrNotFound)
   224        {
   216        {
   225        //Add field to document
   217        //Add field to document
   226        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   218        CMdETextProperty* textProperty = static_cast< CMdETextProperty* > (property );
   227        AddFiledtoDocumentL(*index_item,
   219        AddFiledtoDocumentL(*index_item,
   228                    MdeConstants::MediaObject::KLegalProperty,
   220                    MdeConstants::MediaObject::KLegalProperty,
   229                    textProperty->Value());       
   221                    textProperty->Value());
       
   222        AddToFieldExcerptL(textProperty->Value());
   230        }
   223        }
   231     //Get track property
   224     //Get track property
   232     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
   225     CMdEPropertyDef& trackPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KTrackProperty );
   233     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
   226     if(aObject.Property( trackPropDef, property ) != KErrNotFound)
   234        {
   227        {
   235        //Add field to document       
   228        //Add field to document       
   236        if( property->Def().PropertyType() == EPropertyUint16 )
   229        CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
   237            {
   230        TBuf<32> buf;
   238            CMdEUint16Property& trackProperty = static_cast < CMdEUint16Property& > (*property );               
   231        buf.Format(_L("%d"), trackProperty.Value());
   239            TBuf<32> buf;
   232        AddFiledtoDocumentL(*index_item,
   240            buf.Format(_L("%d"), trackProperty.Value());
   233                           MdeConstants::MediaObject::KTrackProperty,
   241            AddFiledtoDocumentL(*index_item,
   234                           buf);
   242                               MdeConstants::MediaObject::KTrackProperty,
   235        
   243                               buf);
       
   244            }       
       
   245        }
   236        }
   246     // Capturedate property
   237     // Capturedate property
   247     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
   238     CMdEPropertyDef& captureDatePropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KCaptureDateProperty);
   248     if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
   239     if(aObject.Property( captureDatePropDef, property ) != KErrNotFound)
   249       {
   240       {
   250       //Add field to document
   241       //Add field to document
   251       if(EPropertyTime == property->Def().PropertyType())
   242       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   252           {
   243       TDateTime time = timeProperty.Value().DateTime();
   253           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   244       TBuf<32> buf;
   254           TDateTime time = timeProperty.Value().DateTime();
   245       buf.Format( KFormatDateTime, time.Year(), 
   255           TBuf<32> buf;
   246                                    time.Month() + 1, 
   256           buf.Format( KFormatDateTime, time.Year(), 
   247                                    time.Day() + 1, 
   257                                        time.Month() + 1, 
   248                                    time.Hour(), 
   258                                        time.Day() + 1, 
   249                                    time.Minute());
   259                                        time.Hour(), 
   250       
   260                                        time.Minute());
   251       AddFiledtoDocumentL(*index_item,
   261           
   252                          MdeConstants::MediaObject::KCaptureDateProperty,
   262           AddFiledtoDocumentL(*index_item,
   253                          buf,
   263                              MdeConstants::MediaObject::KCaptureDateProperty,
   254                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   264                              buf,
   255       //Format for excerpt field
   265                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   256       buf.Format( KExcerptFormat, time.Year(), 
   266           //Format for excerpt field
   257                              time.Month() + 1, 
   267           buf.Format( KExcerptFormat, time.Year(), 
   258                              time.Day() + 1, 
   268                                  time.Month() + 1, 
   259                              time.Hour(), 
   269                                  time.Day() + 1, 
   260                              time.Minute());
   270                                  time.Hour(), 
   261       AddToFieldExcerptL(buf);
   271                                  time.Minute());
       
   272           AddToFieldExcerptL(buf);
       
   273           }
       
   274       }
   262       }
   275     //Get LastModifiedDate property
   263     //Get LastModifiedDate property
   276     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   264     CMdEPropertyDef& dateTimePropDef = aObjectDef.GetPropertyDefL(MdeConstants::Object::KLastModifiedDateProperty);
   277     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   265     if(aObject.Property( dateTimePropDef, property ) != KErrNotFound)
   278       {
   266       {
   279       //Add field to document
   267       //Add field to document      
   280       if(EPropertyTime == property->Def().PropertyType())
   268       CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   281           {
   269       TDateTime time = timeProperty.Value().DateTime();
   282           CMdETimeProperty& timeProperty = static_cast < CMdETimeProperty& > (*property);
   270       TBuf<32> buf;
   283           TDateTime time = timeProperty.Value().DateTime();
   271       buf.Format( KFormatDateTime, time.Year(),
   284           TBuf<32> buf;
   272                                    time.Month() + 1,
   285           buf.Format( KFormatDateTime, time.Year(),
   273                                    time.Day() + 1,
   286                                        time.Month() + 1,
   274                                    time.Hour(),
   287                                        time.Day() + 1,
       
   288                                        time.Hour(),
       
   289                                        time.Minute());
       
   290           
       
   291           AddFiledtoDocumentL(*index_item,
       
   292                              MdeConstants::Object::KLastModifiedDateProperty,
       
   293                              buf,
       
   294                              CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   295           //Format for excerpt field
       
   296           buf.Format( KExcerptFormat, time.Year(), 
       
   297                                    time.Month() + 1, 
       
   298                                    time.Day() + 1, 
       
   299                                    time.Hour(), 
       
   300                                    time.Minute());
   275                                    time.Minute());
   301           AddToFieldExcerptL(buf);
   276       
   302           }
   277       AddFiledtoDocumentL(*index_item,
       
   278                          MdeConstants::Object::KLastModifiedDateProperty,
       
   279                          buf,
       
   280                          CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   281       //Format for excerpt field
       
   282       buf.Format( KExcerptFormat, time.Year(), 
       
   283                                time.Month() + 1, 
       
   284                                time.Day() + 1, 
       
   285                                time.Hour(), 
       
   286                                time.Minute());
       
   287       AddToFieldExcerptL(buf);
   303       }
   288       }
   304     //Get duration property
   289     //Get duration property
   305     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
   290     CMdEPropertyDef& durationPropDef = aObjectDef.GetPropertyDefL(MdeConstants::MediaObject::KDurationProperty );
   306     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
   291     if(aObject.Property( durationPropDef, property ) != KErrNotFound)
   307        {
   292        {
   308        //Add field to document       
   293        //Add field to document       
   309        if( property->Def().PropertyType() == EPropertyReal32 )
   294        CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
   310            {
   295        TBuf<32> buf;
   311            CMdEReal32Property& durationProperty = static_cast < CMdEReal32Property& > (*property );               
   296        buf.Format(_L("%f"), durationProperty.Value());
   312            TBuf<32> buf;
   297        AddFiledtoDocumentL(*index_item,
   313            buf.Format(_L("%f"), durationProperty.Value());
   298                           MdeConstants::MediaObject::KDurationProperty,
   314            AddFiledtoDocumentL(*index_item,
   299                           buf,
   315                               MdeConstants::MediaObject::KDurationProperty,
   300                           CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   316                               buf,
       
   317                               CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
       
   318            }       
       
   319        }
   301        }
   320     if( iExcerpt )
   302     if( iExcerpt )
   321         {
   303         {
   322         index_item->AddExcerptL(*iExcerpt);
   304         index_item->AddExcerptL(*iExcerpt);
   323         }
   305         }