当前位置: 首页>>代码示例>>C++>>正文


C++ MediaPlayer::prepare方法代码示例

本文整理汇总了C++中MediaPlayer::prepare方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaPlayer::prepare方法的具体用法?C++ MediaPlayer::prepare怎么用?C++ MediaPlayer::prepare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaPlayer的用法示例。


在下文中一共展示了MediaPlayer::prepare方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getMediaPlayer

static void
com_media_ffmpeg_FFMpegPlayer_prepare(JNIEnv *env, jobject thiz)
{
    MediaPlayer* mp = getMediaPlayer(env, thiz);
    if (mp == NULL ) {
        jniThrowException(env, "java/lang/IllegalStateException", NULL);
        return;
    }
    process_media_player_call( env, thiz, mp->prepare(), "java/io/IOException", "Prepare failed." );
}
开发者ID:DemoYolk,项目名称:ffmpeg_base,代码行数:10,代码来源:com_media_ffmpeg_FFMpegPlayer.cpp

示例2: newMediaPlayer

MediaPlayer* CameraService::newMediaPlayer(const char *file) {
    MediaPlayer* mp = new MediaPlayer();
    if (mp->setDataSource(file, NULL) == NO_ERROR) {
        mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);
        mp->prepare();
    } else {
        LOGE("Failed to load CameraService sounds: %s", file);
        return NULL;
    }
    return mp;
}
开发者ID:28vicky,项目名称:platform_frameworks_base,代码行数:11,代码来源:CameraService.cpp

示例3: getMediaPlayer

static void
wseemann_media_FFmpegMediaPlayer_prepare(JNIEnv *env, jobject thiz)
{
    MediaPlayer* mp = getMediaPlayer(env, thiz);
    if (mp == NULL ) {
        jniThrowException(env, "java/lang/IllegalStateException", NULL);
        return;
    }

    // Handle the case where the display surface was set before the mp was
    // initialized. We try again to make it stick.
    //sp<IGraphicBufferProducer> st = getVideoSurfaceTexture(env, thiz);
    //mp->setVideoSurfaceTexture(st);

    process_media_player_call( env, thiz, mp->prepare(), "java/io/IOException", "Prepare failed." );
}
开发者ID:03050903,项目名称:FFmpegMediaPlayer,代码行数:16,代码来源:wseemann_media_MediaPlayer.cpp

示例4: bootMusic

void  BootAnimation::bootMusic()  
{  
    int index;  
    MediaPlayer* mp = new MediaPlayer();  

	 if((access(SYSTEM_BOOTMUSIC_FILE,F_OK))!=-1){  
		if (mp->setDataSource(SYSTEM_BOOTMUSIC_FILE, NULL) == NO_ERROR) {  
        mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);  
        mp->prepare();
		mp->setLooping(true);  
	    }  
	    AudioSystem::getStreamVolumeIndex(AUDIO_STREAM_ENFORCED_AUDIBLE, &index);  
	    if (index != 0) {  
		
	        mp->seekTo(0);  
	        mp->start();  

	    } 
   	}  
}  
开发者ID:fards,项目名称:ainol_elfii_frameworks,代码行数:20,代码来源:BootAnimation.cpp

示例5: newMediaPlayer

MediaPlayer* CameraService::newMediaPlayer(const char *file) {
#ifdef  MTK_CAMERAPROFILE_SUPPORT
    AutoCPTLog cptlog(Event_CS_newMediaPlayer);
#endif
    
#ifdef  MTK_CAMERA_BSP_SUPPORT    
    LOG1("[CameraService::newMediaPlayer] + (%s)\r\n", file);
#endif
    MediaPlayer* mp = new MediaPlayer();
    if (mp->setDataSource(file, NULL) == NO_ERROR) {
        mp->setAudioStreamType(AUDIO_STREAM_ENFORCED_AUDIBLE);
        mp->prepare();
    } else {
        ALOGE("Failed to load CameraService sounds: %s", file);
        return NULL;
    }
#ifdef  MTK_CAMERA_BSP_SUPPORT
    LOG1("[CameraService::newMediaPlayer] -\r\n");
#endif
    return mp;
}
开发者ID:Jiangyi,项目名称:12055,代码行数:21,代码来源:CameraService.cpp

示例6: main

int main(int argc, char **argv) {

  if (argc != 2) {
    ALOGE("filename unspecified");
    return 1;
  }
  signal(SIGTERM, signalHandler);
  signal(SIGHUP, signalHandler);
  signal(SIGPIPE, signalHandler);
  prctl(PR_SET_PDEATHSIG, SIGKILL);

  int fd = open(argv[1], O_RDONLY);
  if (fd < 0) {
    ALOGE("Error %d: Unable to open %s", argv[1]);
    return 1;
  }
  int64_t length = lseek64(fd, 0, SEEK_END);
  lseek64(fd, 0, SEEK_SET);

  OK(pipe(pipefd));

  sp<ProcessState> ps = ProcessState::self();
  ps->startThreadPool();

  MediaPlayer m;
  OK(m.setListener(new MPListener));
  OK(m.setDataSource(fd, 0, length));
  OK(m.prepare());
  OK(m.start());

  int c;
  TEMP_FAILURE_RETRY(read(pipefd[0], &c, 1));

  // Don't bother trying to shut down cleanly, just let mediaplayer deal with the
  // unexpected disconnect.
  exit(0);
}
开发者ID:Nekotana,项目名称:silk,代码行数:37,代码来源:player.cpp


注:本文中的MediaPlayer::prepare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。