zoukankan      html  css  js  c++  java
  • ffmpeg: libjniaudio on gingerbread

    Hi,

    I tried to run the ffpmeg app on Galaxy S with v. 2.3.3. Issue #1 was with libjniaudio - due to change of signature of android::AudioTrack::set().

    Follows my patch for audiotrack.cpp, function AndroidAudioTrack_set():

    status_t ret = NAME_NOT_FOUND;
    
    void *lptr_media = dlopen("libmedia.so", 0);
    __android_log_print(ANDROID_LOG_DEBUG, TAG, "dlopen returns %p", lptr_media);
    
    if (lptr_media)         // first, try gingerbread
    {
        status_t (*fptr_set)(AudioTrack* track,
                            int streamType,
                            uint32_t sampleRate,
                            int format,
                            int channels,
                            int frameCount,
                            uint32_t flags,
                            AudioTrack::callback_t cbf,
                            void* user,
                            int notificationFrames,
                            const sp<IMemory>& sharedBuffer,
                            bool threadCanCallJava,
                            int sessionId);
    
        fptr_set = (typeof fptr_set)dlsym(lptr_media, "_ZN7android10AudioTrack3setEijiiijPFviPvS1_ES1_iRKNS_2spINS_7IMemoryEEEbi");
        __android_log_print(ANDROID_LOG_DEBUG, TAG, "dlsym returns %p", fptr_set);
    
        if (fptr_set != 0)
        {
            ret = fptr_set(track,
                           streamType,
                           sampleRate,
                           format,
                           channels,
                           0, 0, 0, 0, 0, 0, 0, 0);
            __android_log_print(ANDROID_LOG_DEBUG, TAG, "fptr_set() returns %d", ret);
            dlclose(lptr_media);
            lptr_media = 0;
        }
    }
    
    if (lptr_media)         // second, try froyo
    {
        status_t (*fptr_set)(AudioTrack* track,
                            int streamType,
                            uint32_t sampleRate,
                            int format,
                            int channels,
                            int frameCount,
                            uint32_t flags,
                            AudioTrack::callback_t cbf,
                            void* user,
                            int notificationFrames,
                            const sp<IMemory>& sharedBuffer,
                            bool threadCanCallJava);
    
        fptr_set = (typeof fptr_set)dlsym(lptr_media, "_ZN7android10AudioTrack3setEijiiijPFviPvS1_ES1_iRKNS_2spINS_7IMemoryEEEb");
        __android_log_print(ANDROID_LOG_INFO, TAG, "dlsym returns %p", fptr_set);
    
        if (fptr_set != 0)
        {
            ret = fptr_set(track,
                           streamType,
                           sampleRate,
                           format,
                           channels,
                           0, 0, 0, 0, 0, 0, 0); // push max number of parameters
            __android_log_print(ANDROID_LOG_INFO, TAG, "fptr_set() returns %d", ret);
            dlclose(lptr_media);
            lptr_media = 0;
        }
    }
    
    if (lptr_media)         // finally, close library anyway
    {
        dlclose(lptr_media);
    }




    ffmpeg: libjnivideo on gingerbread

    No milestone

    No one is assigned

    Hi,

    I tried to run the ffpmeg app on Galaxy S with v. 2.3.3. Issue #2 was with libjnivideo - due to change of name of the native surface field in android/view/Surface class.

    Follows my patch for surface.cpp, function getNativeSurface():


    static Surface* getNativeSurface(JNIEnv* env, jobject jsurface) {
     jclass clazz = env->FindClass("android/view/Surface"); 
     jfieldID field_surface = env->GetFieldID(clazz, "mSurface", "I"); 
     if(field_surface == NULL) {
    #ifdef ANDROID_VIEW_SURFACE_JNI_ID // using gingerbread version of <surfaceflinger/Surface.h>
      env->ExceptionClear();
      field_surface = env->GetFieldID(clazz, ANDROID_VIEW_SURFACE_JNI_ID, "I");
    #endif
     }
     if(field_surface == NULL) {
     return NULL; 
     } 
     return (Surface *) env->GetIntField(jsurface, field_surface); 

       alexcohnhavlenapetr, and sunrui are participating in this issue.

    hi, you should change the mSurface to mNativeSurface with under above 2.3.
    BTW, how to compile with neon or vfp?

    yes I know, better way will be add ifdef for OS version, neon or vfp support zou must set in config.h of ffmpeg, but I think that better way is compile ffmpeg with theirs makefiles and than use this libffmpeg.so like prebuilt library in android's project


  • 相关阅读:
    scala入门-03基础知识->表达式
    scala入门-02基础知识->方法
    jetty命令行方式启动jetty-runner.jar 容器
    本地开发spark代码上传spark集群服务并运行(基于spark官网文档)
    Linux下查看进程和线程
    scala入门-01-IDEA安装scala插件
    spark-1.2.0 集群环境搭建
    ubuntu每次登陆都用root账号登陆
    hadoop2.6.0版本集群环境搭建
    spark ssh配置
  • 原文地址:https://www.cnblogs.com/weinyzhou/p/4983457.html
Copyright © 2011-2022 走看看