Multimedia support is mainly implemented by the imedia interface. Many media interfaces are derived from the imedia interface, as shown in Figure 11-3:
Figure11-3:ImediaSome media formats supported by the API
The imedia interface provides an abstract base class for all brew multimedia objects, and provides operations such as playing, recording, and searching, stopping, pausing, and resuming media objects related to playing/recording, developers can perform operations on all multimedia objects through the imedia interface. The multimedia framework in brew is 11-4.
Figure11-4: Multimedia architecture in mobile phones
The playback status of the media conforms to the finite state machine model. Generally, there are six statuses: idle, ready, play, play_pause, record, and record_pause. imedia uses the media state machine 11-5.
Figure11-5:ImediaMultimedia state machine used
Various methods using the imedia interface must be switched according to the state of this state machine to ensure maximum use. If a status error occurs, you must reset the state machine.
The imedia multimedia playback process is 11-6, showing the changes in the status of multimedia objects between ready and play.
Figure11-6:ImediaMultimedia playback process
Brew3.x also provides abundant support for image processing. Brew applications can use ibitmap and idisplay for bitmap operations. idib is an interface and data structure derived from ibitmap. The idib data structure member variable can be used to locate the position of the image point (pixel) in the bitmap, and how to parse the color value of the image point. The idib structure can be used to directly operate the bitmap data. One way to scale an image is through the itransform interface. You need to obtain the itransform handle through the target bitmap. The location of the scaled target bitmap is specified by the user, and the scaling must be set through aeetransformmatrix, another method is to use ibitmapscale, ibitmaprot, and ibitmapfx in combination. You can use idisplay_setprefs to handle display screen rotation events.