1250 Java Media Framework and Java Sound (Free web space) (on
1250 Java Media Framework and Java Sound (on CD) Chapter 22 further so that it can be saved to a file. The Controller that handles media is a Processor, which extends interface Player. Finally, an object that implements interface DataSink saves the captured, formatted media. The Processor object handles the flow of data from the DataSourceto the DataSinkobject. JMF and Java Sound use media sources extensively, so programmers must understand the arrangement of data in the media. The header on a media source specifies the media format and other essential information needed to play the media. The media content usually consists of tracks of data, similar to tracks of music on a CD. Media sources may have one or more tracks that contain a variety of data. For example, a movie clip may contain one track for video, one track for audio, and a third track for closed-captioning data for the hearing-impaired. 1 // Fig. 22.2: CapturePlayer.java 2 // Presents and saves captured media 3 4 // Java core packages 5 import java.awt.*; 6 import java.awt.event.*; 7 import java.io.*; 8 import java.util.*; 9 10 // Java extension packages 11 import javax.swing.*; 12 import javax.swing.event.*; 13 import javax.media.*; 14 import javax.media.protocol.*; 15 import javax.media.format.*; 16 import javax.media.control.*; 17 import javax.media.datasink.*; 18 19 public class CapturePlayer extends JFrame { 20 21 // capture and save button 22 private JButton captureButton; 23 24 // component for save capture GUI 25 private Component saveProgress; 26 27 // formats of device’s media, user-chosen format 28 private Format formats[], selectedFormat; 29 30 // controls of device’s media formats 31 private FormatControl formatControls[]; 32 33 // specification information of device 34 private CaptureDeviceInfo deviceInfo; 35 36 // vector containing all devices’ information 37 private Vector deviceList; 38 Fig. 22.2Formatting and saving media from capture devices (part 1 of 9). Fig. 22.2
If you are searching for cheap webhost for your web application, please visit MySQL5 Web Hosting services.