Example #1
0
void ijkmp_set_max_fps(IjkMediaPlayer *mp, int max_fps)
{
    assert(mp);

    MPTRACE("ijkmp_set_max_fp(%d)\n", max_fps);
    pthread_mutex_lock(&mp->mutex);
    ffp_set_max_fps(mp->ffplayer, max_fps);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_set_max_fp()=void\n");
}
Example #2
0
void ijkmp_set_sws_option(IjkMediaPlayer *mp, const char *name, const char *value)
{
    assert(mp);

    MPTRACE("ijkmp_set_sws_option()\n");
    pthread_mutex_lock(&mp->mutex);
    ffp_set_sws_option(mp->ffplayer, name, value);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_set_sws_option()=void\n");
}
Example #3
0
void ijkmp_set_picture_queue_capicity(IjkMediaPlayer *mp, int frame_count)
{
    assert(mp);

    MPTRACE("ijkmp_set_picture_queue_capicity(%d)\n", frame_count);
    pthread_mutex_lock(&mp->mutex);
    ffp_set_picture_queue_capicity(mp->ffplayer, frame_count);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_set_picture_queue_capicity()=void\n");
}
Example #4
0
void ijkmp_set_format_callback(IjkMediaPlayer *mp, ijk_format_control_message cb, void *opaque)
{
    assert(mp);

    MPTRACE("ijkmp_set_format_callback(%p, %p)\n", cb, opaque);
    pthread_mutex_lock(&mp->mutex);
    ffp_set_format_callback(mp->ffplayer, cb, opaque);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_set_format_callback()=void\n");
}
Example #5
0
int ijkmp_seek_to(IjkMediaPlayer *mp, long msec)
{
    assert(mp);
    MPTRACE("ijkmp_seek_to(%ld)\n", msec);
    pthread_mutex_lock(&mp->mutex);
    int retval = ijkmp_seek_to_l(mp, msec);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_seek_to(%ld)=%d\n", msec, retval);

    return retval;
}
Example #6
0
void ijkmp_android_set_surface(JNIEnv *env, IjkMediaPlayer *mp, jobject android_surface)
{
    if (!mp)
        return;

    MPTRACE("ijkmp_set_android_surface(surface=%p)", (void*)android_surface);
    pthread_mutex_lock(&mp->mutex);
    ijkmp_android_set_surface_l(env, mp, android_surface);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_set_android_surface(surface=%p)=void", (void*)android_surface);
}
Example #7
0
int ijkmp_get_audio_codec_info(IjkMediaPlayer *mp, char **codec_info)
{
    assert(mp);

    MPTRACE("%s\n", __func__);
    pthread_mutex_lock(&mp->mutex);
    int ret = ffp_get_audio_codec_info(mp->ffplayer, codec_info);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("%s()=void\n", __func__);
    return ret;
}
Example #8
0
int ijkmp_set_stream_selected(IjkMediaPlayer *mp, int stream, int selected)
{
    assert(mp);

    MPTRACE("%s(%d, %d)\n", __func__, stream, selected);
    pthread_mutex_lock(&mp->mutex);
    int ret = ffp_set_stream_selected(mp->ffplayer, stream, selected);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("%s(%d, %d)=%d\n", __func__, stream, selected, ret);
    return ret;
}
Example #9
0
void airstashmp_shutdown_l(AirStashMediaPlayer *mp)
{
    assert(mp);

    MPTRACE("airstashmp_shutdown_l()\n");
    if (mp->ffplayer) {
        ffp_stop_l(mp->ffplayer);
        ffp_wait_stop_l(mp->ffplayer);
    }
    MPTRACE("airstashmp_shutdown_l()=void\n");
}
Example #10
0
int airstashmp_seek_to(AirStashMediaPlayer *mp, long msec)
{
    assert(mp);
    MPTRACE("airstashmp_seek_to(%ld)\n", msec);
    pthread_mutex_lock(&mp->mutex);
    int retval = airstashmp_seek_to_l(mp, msec);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("airstashmp_seek_to(%ld)=%d\n", msec, retval);

    return retval;
}
Example #11
0
void ijkmp_set_overlay_format(IjkMediaPlayer *mp, int chroma_fourcc)
{
    if (!mp)
        return;

    MPTRACE("ijkmp_set_overlay_format(%.4s(0x%x))\n", (char*)&chroma_fourcc, chroma_fourcc);
    if (mp->ffplayer) {
        ffp_set_overlay_format(mp->ffplayer, chroma_fourcc);
    }
    MPTRACE("ijkmp_set_overlay_format()=void\n");
}
Example #12
0
int airstashmp_get_video_codec_info(AirStashMediaPlayer *mp, char **codec_info)
{
    assert(mp);

    MPTRACE("%s\n", __func__);
    pthread_mutex_lock(&mp->mutex);
    int ret = ffp_get_video_codec_info(mp->ffplayer, codec_info);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("%s()=void\n", __func__);
    return ret;
}
Example #13
0
void ijkmp_shutdown_l(IjkMediaPlayer *mp)
{
    assert(mp);

    MPTRACE("ijkmp_shutdown_l()\n");
    if (mp->ffplayer) {
        ffp_stop_l(mp->ffplayer);
        ffp_wait_stop_l(mp->ffplayer);
    }
    MPTRACE("ijkmp_shutdown_l()=void\n");
}
Example #14
0
int ijkmp_set_data_source(IjkMediaPlayer *mp, const char *url)
{
    assert(mp);
    assert(url);
    MPTRACE("ijkmp_set_data_source(url=\"%s\")\n", url);
    pthread_mutex_lock(&mp->mutex);
    int retval = ijkmp_set_data_source_l(mp, url);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_set_data_source(url=\"%s\")=%d\n", url, retval);
    return retval;
}
void ksymp_shutdown_l(KSYMediaPlayer *mp)
{
    assert(mp);

    MPTRACE("ksymp_shutdown_l()\n");
    if (mp->ffplayer) {
        ffp_stop_l(mp->ffplayer);
        ffp_wait_stop_l(mp->ffplayer);
    }
    MPTRACE("ksymp_shutdown_l()=void\n");
}
Example #16
0
void ksymp_shutdown_l(KSYMediaPlayer *mp)
{
    assert(mp);
    ksymp_change_state_l(mp, MP_STATE_RELEASING);
    MPTRACE("ksymp_shutdown_l()\n");
    if (mp->ffplayer) {
        ffp_stop_l(mp->ffplayer);
        ffp_wait_stop_l(mp->ffplayer);
    }
    ksymp_change_state_l(mp, MP_STATE_END);
    MPTRACE("ksymp_shutdown_l()=void\n");
}
Example #17
0
void airstashmp_set_inject_opaque(AirStashMediaPlayer *mp, void *opaque)
{
    assert(mp);

    MPTRACE("%s(%p)\n", __func__, opaque);
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
#endif
    airstashmp_set_option_int(mp, AIRSTASHMP_OPT_CATEGORY_FORMAT, "airstashinject-opaque", (int64_t)opaque);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
    MPTRACE("%s()=void\n", __func__);
}
Example #18
0
void ijkmp_android_set_mediacodec_select_callback(IjkMediaPlayer *mp, bool (*callback)(void *opaque, ijkmp_mediacodecinfo_context *mcc), void *opaque)
{
    if (!mp)
        return;

    MPTRACE("ijkmp_android_set_mediacodec_select_callback()");
    pthread_mutex_lock(&mp->mutex);

    if (mp && mp->ffplayer && mp->ffplayer->pipeline) {
        ffpipeline_set_mediacodec_select_callback(mp->ffplayer->pipeline, callback, opaque);
    }

    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_android_set_mediacodec_select_callback()=void");
}
Example #19
0
void ijkmp_android_set_volume(JNIEnv *env, IjkMediaPlayer *mp, float left, float right)
{
    if (!mp)
        return;

    MPTRACE("ijkmp_android_set_volume(%f, %f)", left, right);
    pthread_mutex_lock(&mp->mutex);

    if (mp && mp->ffplayer && mp->ffplayer->aout) {
        SDL_AoutSetStereoVolume(mp->ffplayer->aout, left, right);
    }

    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ijkmp_android_set_volume(%f, %f)=void", left, right);
}
Example #20
0
void ijkmp_set_inject_opaque(IjkMediaPlayer *mp, void *opaque)
{
    assert(mp);

    MPTRACE("%s(%p)\n", __func__, opaque);
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpointer-to-int-cast"
#endif
    ijkmp_set_option_int(mp, IJKMP_OPT_CATEGORY_FORMAT, "ijkinject-opaque", (int64_t)opaque);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
    MPTRACE("%s()=void\n", __func__);
}
Example #21
0
void ksymp_shutdown(KSYMediaPlayer *mp)
{
    if(mp->mp_state != MP_STATE_END && mp->mp_state != MP_STATE_RELEASING)
    	return ksymp_shutdown_l(mp);
    else
	MPTRACE("[%s:%d]mp_state=%d\n", __FUNCTION__,__LINE__,mp->mp_state);
}
Example #22
0
static int ksymp_prepare_async_l(KSYMediaPlayer *mp)
{
    assert(mp);

    MPTRACE("[%s:%d]mp_state=%d\n", __FUNCTION__, __LINE__,mp->mp_state);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_IDLE);
    // MPST_RET_IF_EQ(mp->mp_state, MP_STATE_INITIALIZED);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_ASYNC_PREPARING);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_PREPARED);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_STARTED);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_PAUSED);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_COMPLETED);
    // MPST_RET_IF_EQ(mp->mp_state, MP_STATE_STOPPED);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_ERROR);
    MPST_RET_IF_EQ(mp->mp_state, MP_STATE_END);

    assert(mp->data_source);

    ksymp_change_state_l(mp, MP_STATE_ASYNC_PREPARING);

    msg_queue_start(&mp->ffplayer->msg_queue);

    // released in msg_loop
    ksymp_inc_ref(mp);
    mp->msg_thread = SDL_CreateThreadEx(&mp->_msg_thread, mp->msg_loop, mp, "ff_msg_loop");
    // TODO: 9 release weak_thiz if pthread_create() failed;

    int retval = ffp_prepare_async_l(mp->ffplayer, mp->data_source, mp->header);
    if (retval < 0) {
        ksymp_change_state_l(mp, MP_STATE_ERROR);
        return retval;
    }

    return 0;
}
Example #23
0
static void
IjkMediaPlayer_setOption(JNIEnv *env, jobject thiz, jint category, jobject name, jobject value)
{
    MPTRACE("%s\n", __func__);
    IjkMediaPlayer *mp = jni_get_media_player(env, thiz);
    const char *c_name = NULL;
    const char *c_value = NULL;
    JNI_CHECK_GOTO(mp, env, "java/lang/IllegalStateException", "mpjni: setOption: null mp", LABEL_RETURN);

    c_name = (*env)->GetStringUTFChars(env, name, NULL );
    JNI_CHECK_GOTO(c_name, env, "java/lang/OutOfMemoryError", "mpjni: setOption: name.string oom", LABEL_RETURN);

    if (value) {
        c_value = (*env)->GetStringUTFChars(env, value, NULL );
        JNI_CHECK_GOTO(c_name, env, "java/lang/OutOfMemoryError", "mpjni: setOption: name.string oom", LABEL_RETURN);
    }

    ijkmp_set_option(mp, category, c_name, c_value);

LABEL_RETURN:
    if (c_name)
        (*env)->ReleaseStringUTFChars(env, name, c_name);
    if (c_value)
        (*env)->ReleaseStringUTFChars(env, value, c_value);
    ijkmp_dec_ref_p(&mp);
}
Example #24
0
static void
IjkMediaPlayer_native_setLogLevel(JNIEnv *env, jclass clazz, jint level)
{
    MPTRACE("%s(%d)\n", __func__, level);
    ijkmp_global_set_log_level(level);
    ALOGD("moncleanup\n");
}
Example #25
0
static void
IjkMediaPlayer_native_profileBegin(JNIEnv *env, jclass clazz, jstring libName)
{
    MPTRACE("IjkMediaPlayer_native_profileBegin");

    const char *c_lib_name = NULL;
    static int s_monstartup = 0;

    if (!libName)
        return;

    if (s_monstartup) {
        ALOGW("monstartup already called\b");
        return;
    }

    c_lib_name = (*env)->GetStringUTFChars(env, libName, NULL );
    JNI_CHECK_GOTO(c_lib_name, env, "java/lang/OutOfMemoryError", "mpjni: monstartup: libName.string oom", LABEL_RETURN);

    s_monstartup = 1;
    monstartup(c_lib_name);
    ALOGD("monstartup: %s\n", c_lib_name);

LABEL_RETURN:
    if (c_lib_name)
        (*env)->ReleaseStringUTFChars(env, libName, c_lib_name);
}
Example #26
0
int ksymp_set_data_source(KSYMediaPlayer *mp, const char *url, const char *header)
{
//#ifdef _ARM_
//    LOGW("name=%s", name);
//    android::CallStack stack;
//    stack.update(1, 100);
//    stack.dump("");
//#endif

    assert(mp);
    assert(url);
    MPTRACE("ksymp_set_data_source(url=\"%s\")\n", url);
    pthread_mutex_lock(&mp->mutex);
    int retval = ksymp_set_data_source_l(mp, url, header);
    pthread_mutex_unlock(&mp->mutex);
    MPTRACE("ksymp_set_data_source(url=\"%s\")=%d\n", url, retval);
    return retval;
}
Example #27
0
static int message_loop(void *arg)
{
    MPTRACE("message_loop");

    JNIEnv *env = NULL;
    (*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL);

    IjkMediaPlayer *mp = (IjkMediaPlayer*) arg;
    JNI_CHECK_GOTO(mp, env, NULL, "mpjni: native_message_loop: null mp", LABEL_RETURN);

    message_loop_n(env, mp);

LABEL_RETURN:
    ijkmp_dec_ref_p(&mp);
    (*g_jvm)->DetachCurrentThread(g_jvm);

    MPTRACE("message_loop exit");
    return 0;
}
Example #28
0
void ijkmp_dec_ref(IjkMediaPlayer *mp)
{
    if (!mp)
        return;

    int ref_count = __sync_sub_and_fetch(&mp->ref_count, 1);
    if (ref_count == 0) {
        MPTRACE("ijkmp_dec_ref(): ref=0\n");
        ijkmp_shutdown(mp);
        ijkmp_destroy_p(&mp);
    }
}
Example #29
0
static void
IjkMediaPlayer_seekTo(JNIEnv *env, jobject thiz, int msec)
{
    MPTRACE("IjkMediaPlayer_seekTo");
    IjkMediaPlayer *mp = jni_get_media_player(env, thiz);
    JNI_CHECK_GOTO(mp, env, "java/lang/IllegalStateException", "mpjni: seekTo: null mp", LABEL_RETURN);

    ijkmp_seek_to(mp, msec);

LABEL_RETURN:
    ijkmp_dec_ref_p(&mp);
}
Example #30
0
static void
IjkMediaPlayer_setAutoPlayOnPrepared(JNIEnv *env, jobject thiz, jboolean enabled)
{
    MPTRACE("%s", __func__);
    IjkMediaPlayer *mp = jni_get_media_player(env, thiz);
    JNI_CHECK_GOTO(mp, env, "java/lang/IllegalStateException", "mpjni: setAutoPlayOnPrepared: null mp", LABEL_RETURN);

    ijkmp_set_auto_play_on_prepared(mp, enabled);

LABEL_RETURN:
    ijkmp_dec_ref_p(&mp);
}