示例#1
0
int main(void)
{
    char choose;
    int media;

    printf("[?]Launch server on port 1337 ? (y/n) ");
    scanf("%c" , &choose );

    printf("[?]Media player to control:\n");
    printf("[1]VLCPLayer\n");
    printf("[2]OMXPlayer\n");
    printf("[!]Choice: ");
    scanf("%d", &media );

    //Set the Media Player to controll
    setMediaPlayer( media );

    if( choose == 'y' )
    {
        printf("[+]Create server...\n");


        createServer();
    }
    else
    {
        return 0;
    }

    printf("\n");
    return 0;
}
JNIEXPORT void JNICALL android_media_player_native_setup
        (JNIEnv *env, jobject obj, jobject ytxMediaPlayer_weak_this) {


    YtxMediaPlayer *mPlayer = new YtxMediaPlayer();

    // create new listener and give it to MediaPlayer
    JNIMediaPlayerListener *listener = new JNIMediaPlayerListener(env, obj,
                                                                  ytxMediaPlayer_weak_this);
    mPlayer->setListener(listener);
    setMediaPlayer(env, obj, mPlayer);

}
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);
}
VideoLayerWebKitThread::VideoLayerWebKitThread(MediaPlayer* mediaPlayer)
    : LayerWebKitThread(Layer, 0)
{
    setMediaPlayer(mediaPlayer);
}