1./packages/providers/mediaprovider/
Generate mediaprovider.apk after compilation. Media files (images, videos, and audios) on the local machine and sdcard will be scanned at startup ),
And generate internal. dB (/system/Meida) in the/data/COM. Android. providers. Media/databases directory)
And external -?. DB (/sdcard) Two database files. After that, all multimedia information is obtained from these two databases.
2./packages/apps/music
After compilation, music.apk is generated to play audio files. The playlist and related information are from external -?. DB.
3./packages/apps/camera/
After compilation, produce camera.apk, which corresponds to three applications: Camera, gallery, and camcorder.
Gallery is used to manage all video and image files. It has functions such as playing, viewing, and deleting.
4./frameworks/base/CORE/Java/Android/widget/videoview. Java
A video playback control encapsulated by android can be used in the following ways:
Import Android. widget. videoview;
...
Final videoview view = (videoview) findviewbyid (R. Id. video_view );
View. setvideopath ("/sdcard/test.mp4 ");
View. Start ();
...
Add the following content to the XML Description:
<Videoview Android: Id = "@ + ID/video_view"
Android: layout_width = "fill_parent"
Android: layout_height = "300px"
/>
5./frameworks/base/CORE/Java/Android/provider/mediastore. Java
All multimedia data information of android can be extracted from the multimedia database provided by Android. Database
You can use contentresolver to call related interfaces.
6./frameworks/base/Media/Java/Android/Media
Provides operation interfaces for the Multimedia Application Layer on Android. Note:
Mediaplayer. Java: provides APIs for video, audio, and data stream playback control.
Mediarecorder. Java: Provides interfaces for recording videos and audios.
Audiomanager. Java: provides audio volume control and playback mode (mute, vibrate, etc.
Ringtonemanager. Java, ringtone. Java: provides sound playback control for reminders, alarms, and events.
Mediascanner *. Java: supports the media scan interface.
Audiotrack. Java: soundpool. Java: play audio resources of the android application.
Audiorecord. Java: Provides the recording setting (sample, Chanel, etc.) interface for Android applicatio;
Simple Example:
Play a file:
Mediaplayer MP = new mediaplayer ();
MP. setdatasource ("/sdcard/testbench ");
MP. Prepare ();
MP. Start ();
Play raw resouce
Mediaplayer MP = mediaplayer. Create (context, R. Raw. sound_file_1 );
MP. Start ();
Recording:
Mediarecorder recorder = new mediarecorder ();
Recorder. setaudiosource (mediarecorder. audiosource. Mic );
Recorder. setoutputformat (mediarecorder. outputformat. three_gpp );
Recorder. setaudioencoder (mediarecorder. audioencoder. amr_nb );
Recorder. setoutputfile ("/sdcard/test. Amr ");
Recorder. Prepare ();
Recorder. Start ();
...
Alarmclock:
...
Mmediaplayer = new mediaplayer ();
Mmediaplayer. setvolume (in_call_volume, in_call_volume );
// Check whether the call is in progress. If yes, use a small voice prompt.
If (TM. getcallstate ()! = Telephonymanager. call_state_idle ){
Log. V ("using the in-call alarm ");
Mmediaplayer. setvolume (in_call_volume, in_call_volume );
Setperformancefromresource (context. getresources (),
Mmediaplayer, R. Raw. in_call_alarm );
}
Else
{
Mmediaplayer. setdatasource (context, Uri. parse (malert ));
}
Mmediaplayer. setaudiostreamtype (audiomanager. stream_alarm );
Mmediaplayer. setlooping (true );
Mmediaplayer. Prepare ();
Mmediaplayer. Prepare ();
...
Android multimedia-related code Overview 2 (Framework-related)
The post was posted
1../frameworks/base/Media/JNI
Java local call. The goal generated after compilation is libmedia_jni.so.
Android_media_mediaplayer.cpp: the Java local call part of mediaplayer.
It defines a jninativemethod (Java local call method) type of data gmethods,
Used to describe the association information of the interface.
Android_media_mediarecorder.cpp: defines the local call Implementation of the recording.
Android_media_amrinputstream.cpp: Local call implementation related to AMR encoding.
Android_media_mediascanner.cpp: Local call implementation related to media scanning.
Soundpool/android_media_soundpool.cpp: defines the local call Implementation of the audio system.
2../frameworks/base/Media/libmedia
./Frameworks/base/include/Media/
Libmedia. So is compiled for the underlying library of multimedia, which is at the core of the android multimedia architecture.
It provides the mediaplayer, mediarecorder, mediascanner, and other interfaces to the upper layer.
Android. Meida. * is implemented by calling the libmedia. So interface through libmedia_jni.so.
It should also be noted that the mediaplayerinterface. h header file defines the mediaplayer
Underlying interface. It mainly defines the following classes:
Mediaplayerbase: the abstract base class of mediaplayerinterface, which includes audio output,
Basic interfaces for video output and playback control.
Mediaplayerinterface and mediaplayerhwinterface inherit the extensions provided by mediaplayerbase for different outputs.
3../frameworks/base/Media/libmediaplayerservice
This is the multimedia service part. compile and generate libmediaplayerservice. So.
Mediaplayerservice. cpp implements a service named media. Player.
IPC communicates with it to establish a suitable player.
In mediaplayerservice. cpp, different players are created based on the playertype.
The existing player types include pvplayer, midifile, and vorbiplayer.
Mediaplayerinterface. We can inherit mediaplayerinterface
To add a new player implementation.
4../external/opencore/
Opencore multimedia player, compilation mainly generates libopencoreplayer. So. There are two main parts provided to the upper layer:
* Pvplayer: supports media playback.
* Pvauthor: Provides the media recording function.
The opencore/Android directory implements the interaction interface between opencore and libmediaplayerservice. So.