开发学院手机开发Android 开发 Android多媒体框架初步分析 阅读

Android多媒体框架初步分析

 2010-05-27 03:42:00 来源:WEB开发网   
核心提示:void reset()Restarts the MediaRecorder to its idle state.void setAudioEncoder(int audio_encoder)Sets the audio encoder to be used for recording.void setAudioSou

void reset()

Restarts the MediaRecorder to its idle state.

void setAudioEncoder(int audio_encoder)

Sets the audio encoder to be used for recording.

void setAudioSource(int audio_source)

Sets the audio source to be used for recording.

void setOutputFile(String path)

Sets the path of the output file to be produced.

void setOutputFormat(int output_format)

Sets the format of the output file produced during recording.

void setPreviewDisplay(Surface sv)

Sets a Surface to show a preview of recorded media (video).

void start()

Begins capturing and encoding data to the file specified with setOutputFile().

void stop()

Stops recording.

简单的例子:

Example:

MediaRecorder recorder = new MediaRecorder();

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);

recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);

recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

recorder.setOutputFile(PATH_NAME);

recorder.prepare();

recorder.start(); // Recording is now started ... recorder.stop();

recorder.reset(); // You can reuse the object by going back to

setAudioSource() step

recorder.release(); // Now the object cannot be reused

整体的结构如下图所示:

l MediaPlayer JNI

代码位置 /frameworks/base/media/jni

l MediaPlayer (Native)

代码位置 /frameworks/base/media/libmedia

l MediaPlayerService (Server)

代码位置 /frameworks/base/media/libmediaplayerservice

l MediaPlayerService Host Process

代码位置 /frameworks/base/media/mediaserver/main_mediaserver.cpp

l PVPlayer

代码位置 /external/opencore/android/

实际调用过程如下图所示:

上一页  1 2 3 4 

Tags:Android 多媒体 框架

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接