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


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

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


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

示例1: getMediaPlayer

static void
com_media_ffmpeg_FFMpegPlayer_release(JNIEnv *env, jobject thiz)
{
    __android_log_print(ANDROID_LOG_INFO, TAG, "com_media_ffmpeg_FFMpegPlayer_release() ");
    MediaPlayer* mp = getMediaPlayer(env, thiz);
    if (mp != NULL) {
        // this prevents native callbacks after the object is released
        mp->setListener(0);
        delete (mp);
        env->SetIntField(thiz, fields.context, (int)NULL);
    }

}
开发者ID:WangCrystal,项目名称:FFplayer,代码行数:13,代码来源:com_media_ffmpeg_FFMpegPlayer.cpp

示例2: MediaPlayer

static void
com_media_ffmpeg_FFMpegPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this)
{
	__android_log_print(ANDROID_LOG_INFO, TAG, "native_setup");
    MediaPlayer* mp = new MediaPlayer();
    if (mp == NULL) {
        jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
        return;
    }
    // create new listener and give it to MediaPlayer
    JNIFFmpegMediaPlayerListener* listener = new JNIFFmpegMediaPlayerListener(env, thiz, weak_this);
    mp->setListener(listener);
    // Stow our new C++ MediaPlayer in an opaque field in the Java object.
    setMediaPlayer(env, thiz, mp);
}
开发者ID:WangCrystal,项目名称:FFplayer,代码行数:15,代码来源:com_media_ffmpeg_FFMpegPlayer.cpp

示例3: setMediaPlayer

static void
wseemann_media_FFmpegMediaPlayer_release(JNIEnv *env, jobject thiz)
{
    __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "release");
    //decVideoSurfaceRef(env, thiz);
    MediaPlayer* mp = setMediaPlayer(env, thiz, 0);
    if (mp != NULL) {
        // this prevents native callbacks after the object is released
    	JNIMediaPlayerListener *listener = (JNIMediaPlayerListener *) mp->getListener();
    	delete listener;
        mp->setListener(0);
        mp->disconnect();
        
        delete mp;
        setMediaPlayer(env, thiz, 0);
    }
}
开发者ID:03050903,项目名称:FFmpegMediaPlayer,代码行数:17,代码来源:wseemann_media_MediaPlayer.cpp

示例4: MediaPlayer

static void
wseemann_media_FFmpegMediaPlayer_native_setup(JNIEnv *env, jobject thiz, jobject weak_this, jbyteArray buffer)
{
    __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, "native_setup");
    MediaPlayer* mp = new MediaPlayer();
    if (mp == NULL) {
        jniThrowException(env, "java/lang/RuntimeException", "Out of memory");
        return;
    }

    // create new listener and give it to MediaPlayer
    JNIMediaPlayerListener* listener = new JNIMediaPlayerListener(env, thiz, weak_this, buffer);
    mp->setListener(listener);

    // Stow our new C++ MediaPlayer in an opaque field in the Java object.
    setMediaPlayer(env, thiz, (int)mp);
}
开发者ID:03050903,项目名称:FFmpegMediaPlayer,代码行数:17,代码来源:wseemann_media_MediaPlayer.cpp

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