Firefly Open Source Community

Title: How to add RK Kodi 16 Support to Firefly RK3288 [Print This Page]

Author: dewet    Time: 3/5/2016 11:33
Title: How to add RK Kodi 16 Support to Firefly RK3288

Add this to Firefly SDK for Audio Pass-Through
  1. diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
  2. index ab38864..c387858 100644
  3. --- a/core/jni/android_media_AudioTrack.cpp
  4. +++ b/core/jni/android_media_AudioTrack.cpp
  5. @@ -68,6 +68,7 @@ struct audiotrack_callback_cookie {
  6. // keep these values in sync with AudioTrack.java
  7. #define MODE_STATIC 0
  8. #define MODE_STREAM 1
  9. +#define MODE_STREAM_DIRECT 2

  10. // ----------------------------------------------------------------------------
  11. class AudioTrackJniStorage {
  12. @@ -333,6 +334,26 @@ android_media_AudioTrack_setup(JNIEnv *env, jobject thiz, jobject weak_this,
  13.                  -1, -1,                       // default uid, pid values
  14.                  paa);
  15.          break;
  16. +        
  17. +    case MODE_STREAM_DIRECT:
  18. +
  19. +        status = lpTrack->set(
  20. +                AUDIO_STREAM_DEFAULT,// stream type, but more info conveyed in paa (last argument)
  21. +                sampleRateInHertz,
  22. +                format,// word length, PCM
  23. +                nativeChannelMask,
  24. +                frameCount,
  25. +                AUDIO_OUTPUT_FLAG_DIRECT,
  26. +                audioCallback, &(lpJniStorage->mCallbackData),//callback, callback data (user)
  27. +                0,// notificationFrames == 0 since not using EVENT_MORE_DATA to feed the AudioTrack
  28. +                0,// shared mem
  29. +                true,// thread can call Java
  30. +                sessionId,// audio session ID
  31. +                AudioTrack::TRANSFER_SYNC,
  32. +                NULL,                         // default offloadInfo
  33. +                -1, -1,                       // default uid, pid values
  34. +                paa);
  35. +        break;

  36.      default:
  37.          ALOGE("Unknown mode %d", memoryMode);
  38. diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
  39. index 547d87e..ea56cc9 100644
  40. --- a/media/java/android/media/AudioTrack.java
  41. +++ b/media/java/android/media/AudioTrack.java
  42. @@ -92,7 +92,7 @@ public class AudioTrack
  43.      /** Minimum value for sample rate */
  44.      private static final int SAMPLE_RATE_HZ_MIN = 4000;
  45.      /** Maximum value for sample rate */
  46. -    private static final int SAMPLE_RATE_HZ_MAX = 96000;
  47. +    private static final int SAMPLE_RATE_HZ_MAX = 192000;

  48.      /** Maximum value for AudioTrack channel count */
  49.      private static final int CHANNEL_COUNT_MAX = 8;
  50. @@ -116,6 +116,7 @@ public class AudioTrack
  51.       */
  52.      public static final int MODE_STREAM = 1;

  53. +    public static final int MODE_STREAM_DIRECT = 2;
  54.      /**
  55.       * State of an AudioTrack that was not successfully initialized upon creation.
  56.       */
  57. @@ -528,7 +529,7 @@ public class AudioTrack

  58.          //--------------
  59.          // audio load mode
  60. -        if (((mode != MODE_STREAM) && (mode != MODE_STATIC)) ||
  61. +        if (((mode != MODE_STREAM) && (mode != MODE_STATIC) && (mode != MODE_STREAM_DIRECT)) ||
  62.                  ((mode != MODE_STREAM) && !AudioFormat.isEncodingLinearPcm(mAudioFormat))) {
  63.              throw new IllegalArgumentException("Invalid mode.");
Copy the code

Now you can build normal RK Kodi apk from this source
https://github.com/zidootech/zid ... zidoo-rk3368-16.0b4

It is also possible to rebase RK changes in above code to official Kodi Jarvis 16 Final branch and build it.




Author: mac_l1    Time: 3/5/2016 23:59
TNX for the post!




Welcome Firefly Open Source Community (https://bbs.t-firefly.com/) Powered by Discuz! X3.1