Android MediaExtractor Construction & Destruction

1. Loadlibrary

(1) MediaExtractor
file: MediaExtractor.java

    static {
        System.loadLibrary("media_jni");
        native_init();
    }

(2)android_media_MediaExtractor_native_init
file: android_media_MediaExtractor.cpp

Created with Raphaël 2.1.0 MediaExtractor MediaExtractor android_media_MediaExtractor android_media_MediaExtractor DataSource DataSource native_init android_media_MediaExtractor_init RegisterDefaultSniffers

2. new

Created with Raphaël 2.1.0 MediaExtractor MediaExtractor android_media_MediaExtractor android_media_MediaExtractor JMediaExtractor JMediaExtractor NuMediaExtractor NuMediaExtractor MediaExtractor native_setup new new mImpI setMediaExtractor

(1)android_media_MediaExtractor_native_setup
file: android_media_MediaExtractor.cpp

static void android_media_MediaExtractor_native_setup(
        JNIEnv *env, jobject thiz) {
    sp<JMediaExtractor> extractor = new JMediaExtractor(env, thiz);
    setMediaExtractor(env,thiz, extractor);
}

(2) setMediaExtractor

static sp<JMediaExtractor> setMediaExtractor(
        JNIEnv *env, jobject thiz, const sp<JMediaExtractor> &extractor) {
    sp<JMediaExtractor> old =
        (JMediaExtractor *)env->GetLongField(thiz, gFields.context);

    if (extractor != NULL) {
        extractor->incStrong(thiz);
    }
    if (old != NULL) {
        old->decStrong(thiz);
    }
    env->SetLongField(thiz, gFields.context, (jlong)extractor.get());

    return old;
}

3. finalize

(1)native_finalize
(2) android_media_MediaExtractor_release
(3)setMediaExtractor(env, thiz, null)

Created with Raphaël 2.1.0 MediaExtractor MediaExtractor android_media_MediaExtractor android_media_MediaExtractor finalize native_finalize android_media_MediaExtractor_release setMediaExtractor(null)

你可能感兴趣的:(android,media,jni,native,extractor)