Scmad Chapter13


Published on

Chapter 13 - This material is only for studies purposes

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Scmad Chapter13

  1. 1. By Marcel Caraciolo Chapter 13– MMAPI SCMAD Certification 45mm 61mm
  2. 2. Agenda <ul><li>MMAPI </li></ul><ul><ul><li>Mobile Media API </li></ul></ul><ul><ul><li>Controls: StopTimeControl, MetaDataControl </li></ul></ul><ul><ul><li>Controls: RateControl, GUIControl </li></ul></ul><ul><ul><li>Controls: VideoControl </li></ul></ul><ul><ul><li>Controls: FramePositioningControl </li></ul></ul><ul><ul><li>Controls: RecordControl </li></ul></ul><ul><ul><li>Controls: MIDIControl, PitchControl </li></ul></ul><ul><ul><li>Controls: TempoControl </li></ul></ul><ul><ul><li>Protocols </li></ul></ul><ul><ul><li>TimeBase </li></ul></ul>
  3. 3. MMAPI – Mobile Media API <ul><li>Adds multimedia features to MIDP’s Sound API </li></ul><ul><li>Does not depend on MIDP, runs on CLDC </li></ul><ul><li>Added features: </li></ul><ul><ul><li>Video execution and capture </li></ul></ul><ul><ul><li>Audio capture </li></ul></ul><ul><ul><li>Metadata access </li></ul></ul><ul><ul><li>MIDI generation </li></ul></ul><ul><li>The features are independent from each other. A device may, for instance, provide audio capabilities, but no video support . Optional features are accessed by controls. </li></ul>
  4. 4. MMAPI – Mobile Media API <ul><li>System properties (values are comma-separated): </li></ul><ul><ul><li> MMAPI version </li></ul></ul><ul><ul><li>supports.mixing: “true” or “false”. When it’s true, at least two sounds may be played at the same time </li></ul></ul><ul><ul><li> If sound capture is supported </li></ul></ul><ul><ul><li> If video capture is supported </li></ul></ul><ul><ul><li>supports.recording: If some kind of recording is supported. </li></ul></ul><ul><ul><li>audio.encodings: Supported audio codecs </li></ul></ul><ul><ul><li>video.encodings: Supported video codecs </li></ul></ul><ul><ul><li>video.snapshot.encodings: Supported image encodings when taking pictures (VideoControl.getSnapshot) </li></ul></ul><ul><ul><li>streamable.contents: Data types that may be downloaded while are being executed </li></ul></ul>
  5. 5. StopTimeControl, MetaDataControl <ul><li>StopControl: Sets a specific moment(based on media time) where the execution will be stopped. This controls should be implemented by players that capture or execute audio or video </li></ul><ul><li>MetaDataControl: Fetched media metadata (e.g. title, author). Define the methods: </li></ul><ul><ul><li>getKeys(): Name of all available attributes </li></ul></ul><ul><ul><li>getKeyValue(key): Attribute value </li></ul></ul>
  6. 6. RateControl, GUIControl <ul><li>RateControl: Controls the execution “speed” (“events” rate by timebase). Its value is expressed in percent-thousands, hence, 100.000 is the default speed and 200.000 is twice the regular speed. Ranges from getMinRate() to getMaxRate(). </li></ul><ul><li>GUIControl: UI-Integration control to merge the MMAPI and the GUI API (for MMAPI, only VideoControl extends this interface). Allows output only through the graphics API components. </li></ul>
  7. 7. VideoControl <ul><li>Operations for video capture and execution </li></ul><ul><li>Methods: </li></ul><ul><ul><li>initDisplayMode( mode,arg): Initializes how the video will interact with the platform. Can be: </li></ul></ul><ul><ul><ul><li>USE_GUI_PRIMITIVE: A component from the graphics API is returned. For CDC (Personal Profile) , you get a java.awt.Component. For MIDP, you get a LCDUI Item. arg must be null or a string with the fully qualified class name of the component that shall be returned (useful at platforms that support more than one API) </li></ul></ul></ul><ul><ul><ul><li>USE_DIRECT_VIDEO: Used only at LCDUI. arg must be a Canvas, where the result will be rendered, and null is returned. setDisplayLocation(x,y) method specifies where the video will be rendered on the Canvas. </li></ul></ul></ul>
  8. 8. VideoControl:Methods <ul><li>setVisible (visible) : If the video is visible or not. When rendered as Gui Primitive, default is true. For Direct Video, default is false. </li></ul><ul><li>setDisplaySize(width,height): Resizes the output. The device may not support resizing and then simply cut the video (if the size is smalled than the content) or leave a blank area (if the size is greater than the content). </li></ul><ul><li>getSourceWidth(), getSourceHeight(): Original video size. </li></ul><ul><li>getDisplayWidth(), getDisplayHeight(): Video display size. </li></ul><ul><li>getSnapshot(imageType): Captures the image being displayed on the video and return as byte array. The parameter specifies the image details (encoding, resolution, etc.) </li></ul>
  9. 9. FramePositioningControl <ul><li>Sets the video execution on a specific frame. The positioning may not be done on the specific frame because some frames might have been lost or the file may be corrupted and contain invalid frames. Defines the following methods: </li></ul><ul><ul><li>seek(frameNumber): Goes to a specific framer </li></ul></ul><ul><ul><li>skip(framesToSkip): Skips the number of frames </li></ul></ul><ul><ul><li>mapFrameToTime(frameNumber) and mapTimeToFrame(mediaTime): Converts frame in time and vice versa. </li></ul></ul>
  10. 10. RecordControl <ul><li>Controls media recording (for audio and video). Records what is being executed by the player. Recording is done on a stream passed to the control. For instance, a URL that points to a video capture device (e.g. “ capture://video”) exposes both a VideoControl and a RecordControl. This VideoControl keeps continuously showing camera captured images </li></ul><ul><li>Methods: </li></ul><ul><ul><li>setRecordStream( stream): Stream where data will be recorded </li></ul></ul><ul><ul><li>setRecordLocation( locator): Output URL to where data will be written (e.g. file: ///data/video.mpg) </li></ul></ul><ul><ul><li>getContentType(): Content type of what`s being recorded </li></ul></ul>
  11. 11. RecordControl <ul><li>startRecord(): Starts recording. If the player is being executed, the output is recorded. If the player is stopped, this control will be on “stand-by” waiting for the execution to start only then start recording. </li></ul><ul><li>stopRecord(): Stops recording. If the player is stopped before calling this method, this recorder returns to “stand-by” </li></ul><ul><li>commit(): Finishes the recording process, sending data to the stream. This must be called before data on the stream is used. </li></ul><ul><li>setRecordSizeLimit(size): Limit (in bytes) of data that may be recorded. </li></ul><ul><li>reset(): Erases current recording. Does nothing if called after a commit. </li></ul>
  12. 12. MIDIControl, PitchControl <ul><li>MIDIControl: Controls devices that render and transmit MIDI (synthesizers). May be obtained opening a MIDI resource or though Manager.MIDI_DEVICE_LOCATOR URL, creating an empty player to be controlled programatically. </li></ul><ul><li>PitchControl: Controls sound frequency. MIDI Players must implement this control. These methods are defined: </li></ul><ul><ul><li>setPitch(millisemitones): Sets pitch value. Negative values reduce the pitch, and positive values increase the pitch </li></ul></ul><ul><ul><li>getMinPitch(), getMaxPitch(): Minimum and maximum pitch supported by the player. </li></ul></ul>
  13. 13. TempoControl <ul><li>TempoControl: Controls “musical tempo” (beats per minute). Usually it’s only available for MIDI players. Extends RateControl and define the setTempo( millitempo) method. </li></ul>
  14. 14. TempoControl <ul><li>TempoControl: Controls “musical tempo” (beats per minute). Usually it’s only available for MIDI players. Extends RateControl and define the setTempo( millitempo) method. </li></ul>
  15. 15. Protocols: DataSource <ul><li>Data access customization is done through DataSources. DataSources are more sophisticated than InputStreams because they allow random access and seeking (while input streams allow only sequential access). </li></ul><ul><li>DataSource: Class that manages resource access. For instance, when a network URL is used as locator, the Manager will internally use a DataSource to access the HTTP resource. DataSources may be created by the application when it needs to access a resource that the devices does no support. It has methods to connect to the resource and expose the streams. </li></ul>
  16. 16. Protocols: DataSource <ul><li>SourceStream: Used with data source, implements data access. Defines content size, read operations random access to the data </li></ul><ul><li>ContentDescriptor: Used with SourceStream, identifies a content type. </li></ul>
  17. 17. TimeBase <ul><li>Players use time bases to control time passing </li></ul><ul><li>Players may have their time bases synchronized with pa.setTimeBase(pb.getTimeBase()) </li></ul>
  18. 18. Example Codes <ul><li>Some examples and MIDlets samples are available for reference and studying at this link: </li></ul><ul><ul><li> mpc/chapter13.rar </li></ul></ul><ul><li>The source codes include: </li></ul><ul><ul><li>MobileMediaMIDlet </li></ul></ul>
  19. 19. Future Work <ul><li>Next Chapter: </li></ul><ul><ul><li>MIDP – Security </li></ul></ul><ul><ul><ul><li>Security </li></ul></ul></ul><ul><ul><ul><li>Permissions </li></ul></ul></ul><ul><ul><ul><li>Security-Free API </li></ul></ul></ul><ul><ul><ul><li>Protection Domains </li></ul></ul></ul><ul><ul><ul><li>Application Signing </li></ul></ul></ul><ul><ul><ul><li>Permissions definition </li></ul></ul></ul>
  20. 20. References <ul><li>ALVES F. Eduardo. SCMAD Study Guide, </li></ul><ul><li>27/04/2008. </li></ul><ul><li>JAKL Andreas, Java Platform, Micro Edition Part </li></ul><ul><li>01 slides, 12/2007. </li></ul><ul><li>Sun Certification Mobile Application Developer </li></ul><ul><li>Website: []. </li></ul>