AMediaExtractor_setDataSource() in C++ code not working

270 visualitzacions
Ves al primer missatge no llegit

thierr...@technicolor.com

no llegida,
4 de set. 2017, 10:57:254/9/17
a android-ndk
Hi,

I'm using AMediaExtractor api from C++ code (no java). I have a problem when calling AMediaExtractor_setDataSource(ex, "/sdcard/gandalf2.avi"). It returns error code -10000.
This is the basic code I'm using. Is somebody has any idea of the problem I get ?

Thank's for the replies,

Thierry




        gpu::platform::android::Application::getCurrent().attachToJVM();



        AMediaExtractor *ex = AMediaExtractor_new(); // this works fine, AMediaExtractor_new is ok
.
        if(ex != nullptr)
            __android_log_print(ANDROID_LOG_INFO, "com.technicolor.vrfl.thierry", "ici 2 = AMediaExtractor_new ok");
        else
            __android_log_print(ANDROID_LOG_INFO, "com.technicolor.vrfl.thierry", "ici 3 = AMediaExtractor_new nok");       
   
       


        media_status_t err = AMediaExtractor_setDataSource(ex, "/sdcard/gandalf2.avi");  //AMediaExtractor_setDataSource returns an error code -10000
        if (err != AMEDIA_OK )
            __android_log_print(ANDROID_LOG_INFO, "com.technicolor.vrfl.thierry", "AMediaExtractor_setDataSource ici 4 = AMEDIA_NOK error %d",  err); 
        else
            __android_log_print(ANDROID_LOG_INFO, "com.technicolor.vrfl.thierry", "AMediaExtractor_setDataSource ici 5 = AMEDIA_OK");  

      
   
        gpu::platform::android::Application::getCurrent().detachFromJVM();


Alex Cohn

no llegida,
11 de set. 2017, 9:27:1211/9/17
a android-ndk
/sdcard may be hidden for your application. This alias may be available from adb shell but you cannot trust it. See e.g. https://stackoverflow.com/a/19569136/192373. External storage may temporarily not be mounted, e.g. when it is used for USB file transfer, or the sd-card is pulled out. Finally, your app may not have permissions to read from external storage. 

BR,
Alex

Dan Albert

no llegida,
11 de set. 2017, 21:52:1511/9/17
a android-ndk
You do have an sdcard in the device, right? For devices with removable storage that don't have an sdcard in place (or perhaps just unmounted) file system operations in /sdcard will fail. Could be one of those errors being propagated up to your application.

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk+unsubscribe@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/1da5474f-6e11-4187-a3fa-a13e4071f935%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Respon a tots
Respon a l'autor
Reenvia
0 missatges nous