创建Android TV应用程序以获取HDMI端口数据并将其发送到我的自定义应用程序

时间:2017-10-03 16:54:14

标签: java android service android-tv hdmi

尝试创建一个Android电视应用,它将从HDMI端口接收输入并将其显示在videoView中。

我已经加载了Realtek的库文件并创建了一个流服务。 硬件 Realtek RTD1295

在MainFragment内部,正在创建HDMI管理器。 onStart方法如下:

@Override
public void onStart() {
    super.onStart();

    if (preferences == null) {
        preferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
    }

    // halt startup if we don't have all needed permissions
    if (!checkPermissions()) {
        return;
    }

    if (hdmiSurfaceHolderCallback == null) {
        hdmiSurfaceHolderCallback = new HdmiSurfaceHolderCallback();
        surfaceHolder.addCallback(hdmiSurfaceHolderCallback);
    }

    if (hdmiHotplugReceiver == null) {
        hdmiHotplugReceiver = new HdmiHotplugReceiver();
        getActivity().registerReceiver(hdmiHotplugReceiver, new IntentFilter(HDMIRxStatus.ACTION_HDMIRX_PLUGGED));
    }

    if (checkHdmiReadyHandler == null) {
        checkHdmiReadyHandler = new Handler(new Handler.Callback() {
            @Override
            public boolean handleMessage(Message msg) {
                checkHdmiReady();
                return true;
            }
        });
    }

    if (hdmiRxManager == null) {
        hdmiRxManager = new RtkHDMIRxManager(); //Line 128 Of MainFragment
    }

    if (streamActivityReceiver == null) {
        streamActivityReceiver = new StreamActivityReceiver();
        getActivity().registerReceiver(streamActivityReceiver, new IntentFilter(STREAM_ACTIVITY_INTENT));
    }

    if (preferencesChangeListener == null) {
        preferencesChangeListener = new SharedPreferenceChangeListener();
        preferences.registerOnSharedPreferenceChangeListener(preferencesChangeListener);
    }
}

有两个问题,

  1. 应用程序的首次运行始终是成功的。但从第二次开始 它总是会引发同样的错误。
  2. 即使应用程序第一次运行,也从未检测到HDMI输入。
  3. 目前的发展基于this project

    错误日志如下:

        Process: com.hydra.sid.hdmistreamer, PID: 5757
                                                                          java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.hydra.sid.hdmistreamer-1/base.apk", zip file"/data/app/com.hydra.sid.hdmistreamer-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.hydra.sid.hdmistreamer-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.hydra.sid.hdmistreamer-1/lib/x86, /vendor/lib, /system/lib]]] couldn't find "librealtek_runtime.so"at java.lang.Runtime.loadLibrary(Runtime.java:367)
                                                                              at java.lang.System.loadLibrary(System.java:1076)
                                                                              at com.realtek.hardware.RtkHDMIRxManager.<clinit>(RtkHDMIRxManager.java:30)
                                                                              at com.hydra.sid.hdmistreamer.layout.MainFragment.onStart(MainFragment.java:128)
                                                                              at android.app.Fragment.performStart(Fragment.java:2244)
                                                                              at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1002)
                                                                              at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1148)
                                                                              at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1130)
                                                                              at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:1958)
                                                                              at android.app.FragmentController.dispatchStart(FragmentController.java:163)
                                                                              at android.app.Activity.performStart(Activity.java:6259)
                                                                              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2379)
                                                                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
                                                                              at android.app.ActivityThread.-wrap11(ActivityThread.java)
                                                                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
                                                                              at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                              at android.os.Looper.loop(Looper.java:148)
                                                                              at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                                              at java.lang.reflect.Method.invoke(Native Method)
                                                                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    

1 个答案:

答案 0 :(得分:0)

我也开发了这种类型的项目,但由于我所使用的媒体盒不支持realtek硬件,因此我遇到了同样的错误,因此请检查您的盒支持并使用Realtek支持,然后您的应用程序就可以找到来自系统的realtek库