API Reference | developer.brewmp.com API Reference | developer.brewmp.com


API Reference


Brew Release
Brew MP 1.0.2
See Also
IGallery provides the functionality to catalog content available on the device. Its primarily purpose is to support multimedia applications that utilize media metainfo such as Album, Artist, or media type (e.g. video or video), but it indexes all files in its mounted directories and thus it can be used by generically file system browsing applications.
IGallery is typically supported by an underlying database engine. The IGallery interface does not permit direct access to the underlying database(s), but its methods generally take input in the form of SQL clauses. This allows users to perform powerful and arbitrarily complex operations on a Gallery and at the same time allows the implementation to hide the intimate details involved in creating and maintaining the database(s).
A Gallery exposes its contents thru a single simple psuedo database table. Each row represents an entry in the Gallery and each column represents a piece of metadata information for the entry.
           |  id  |  col1  |  col2  |  col3  |  ...  |
   entry1  |  1   |  |  |  |  ...  |
   entry2  |  2   |  |  |  |  ...  |
   entry3  |  3   |  |  |  |  ...  |
    ...    |  ... |  ...   |  ...   |  ...   |  ...  |

The class implementing IGallery must define the columns supported in the table. The IGallery interface requires classes implementing IGallery to comply with schema versioning and only allows classes to add columns when incrementing the schema version in order to ensure that IGallery users are forward compatible with newer schema versions. See AEEGallerySchema.h for and example schema definition.
Simple queries do not require the table name. However, some complex operations may require subqueries which may require the tablename to appear in the SQL clause. The fragment "@TABLE@" is used to represent the pseudo table. An example, an IGallery_Update() call used to update sizes for folder entries, is shown here:
nErr = IGallery_Update(pif, L"FileSize =" L" (SELECT TOTAL(FileSize)" L" FROM (SELECT FullPath AS Path, FileSize, MimeType FROM @TABLE@)" L" WHERE MimeType <> 'x-directory' AND Path LIKE FullPath || '%')", L"MimeType = 'x-directory'", &piStmt);
Call IGallery_MountDirs() to set the Gallery instance's view of the file system. Call IGallery_Sync() to ensure Gallery is consistent with the current file system contents. Call IGallery_Query() to query contents. Call IGallery_Update() to update a field in the Gallery.