@@ -416,14 +416,13 @@ Java_org_akanework_gramophone_logic_utils_NativeTrack_create(
416416}
417417
418418extern " C" JNIEXPORT jint JNICALL
419- Java_org_akanework_gramophone_logic_utils_NativeTrack_doSet (
419+ Java_org_akanework_gramophone_logic_utils_NativeTrack_set (
420420 JNIEnv * env, jobject, jlong ptr, jint streamType, jint sampleRate, jint format,
421421 jint channelMask, jint frameCount, jint trackFlags, jint sessionId, jfloat maxRequiredSpeed,
422422 jint selectedDeviceId, jint bitRate, jlong durationUs, jboolean hasVideo,
423- jboolean isStreaming, jint bitWidth, jint offloadBufferSize, jint usage,
424- jint encapsulationMode, jint contentId, jint syncId, jint contentType, jint source,
425- jint attrFlags, jstring inTags, jint notificationFrames, jboolean doNotReconnect,
426- jint transferMode) {
423+ jboolean isStreaming, jint bitWidth, jint offloadBufferSize, jint usage, jint contentType,
424+ jint source, jint attrFlags, jstring inTags, jint notificationFrames,
425+ jboolean doNotReconnect, jint transferMode) {
427426 if (android_get_device_api_level () < 23 && maxRequiredSpeed != 1 .0f ) {
428427 ALOGE (" Android 5.x does not support speed adjustment, maxRequiredSpeed != 1f is wrong" );
429428 return INT32_MIN;
@@ -432,10 +431,6 @@ Java_org_akanework_gramophone_logic_utils_NativeTrack_doSet(
432431 ALOGE (" Android 5.x does not support selected devices, selectedDeviceId != 0 is wrong" );
433432 return INT32_MIN;
434433 }
435- if (android_get_device_api_level () < 30 && (contentId != 0 || syncId != 0 )) {
436- ALOGE (" Tuner is supported since Android 11, (contentId != 0 || syncId != 0) is wrong" );
437- return INT32_MIN;
438- }
439434 auto holder = (track_holder*) ptr;
440435 jint ret = 0 ;
441436 fake_sp sharedMemory = {.thePtr = nullptr }; // TODO impl shared memory
@@ -463,9 +458,9 @@ Java_org_akanework_gramophone_logic_utils_NativeTrack_doSet(
463458 .bit_width = (uint32_t )bitWidth,
464459 .offload_buffer_size = (uint32_t )offloadBufferSize,
465460 .usage = usage,
466- .encapsulation_mode = encapsulationMode , // informative, since Android 11
467- .content_id = contentId , // since Android 11
468- .sync_id = syncId , // since Android 11
461+ .encapsulation_mode = 0 , // tuner
462+ .content_id = 0 , // tuner
463+ .sync_id = 0 , // tuner
469464 };
470465 audioAttributes.newAttrs = {
471466 .content_type = contentType,
@@ -781,7 +776,7 @@ Java_org_akanework_gramophone_logic_utils_NativeTrack_00024Companion_isOffloadSu
781776 .is_streaming = (bool )false ,
782777 .bit_width = (uint32_t )0 ,
783778 .offload_buffer_size = (uint32_t )0 ,
784- .usage = 0 ,
779+ .usage = LEGACY_AUDIO_USAGE_MEDIA ,
785780 .encapsulation_mode = 0 ,
786781 .content_id = 0 ,
787782 .sync_id = 0
@@ -806,63 +801,21 @@ Java_org_akanework_gramophone_logic_utils_NativeTrack_00024Companion_isOffloadSu
806801 return ZN7android11AudioSystem18isOffloadSupportedERK20audio_offload_info_t (offloadInfo.oldInfo );
807802}
808803
809- // TODO
810- // void setAudioTrackCallback(const sp<media::IAudioTrackCallback>& callback) {
811- // mAudioTrackCallback->setAudioTrackCallback(callback);
812- // }
813-
814- // TODO
815- // audio_port_handle_t getPortId() const { return mPortId; };
816-
817- // TODO
818- // bool isPlaying() {
819- // AutoMutex lock(mLock);
820- // return isPlaying_l();
821- // }
822- // bool isPlaying_l() {
823- // return mState == STATE_ACTIVE || mState == STATE_STOPPING;
824- // }
825-
826- // TODO
804+ // TODO hardcode offsets for 21/22/23/24/25/26/27, dump otherwise
827805// audio_output_flags_t getFlags() const { AutoMutex _l(mLock); return mFlags; }
828806
829- // TODO
830- // audio_session_t getSessionId() const { return mSessionId; }
831-
832- // TODO
833- // void setCallerName(const std::string &name) {
834- // mCallerName = name;
835- // }
836- // std::string getCallerName() const {
837- // return mCallerName;
838- // };
839-
840- // TODO we can just keep ref here?
841- // sp<IMemory> sharedBuffer() const { return mSharedBuffer; }
842-
843- // TODO
807+ // TODO hardcode offsets for 21/22/23/24/25/26/27, dump otherwise
844808// uint32_t getNotificationPeriodInFrames() const { return mNotificationFramesAct; }
845809
846- // TODO
847- // size_t frameSize() const { return mFrameSize; }
848- // uint32_t channelCount() const { return mChannelCount; }
849- // size_t frameCount() const { return mFrameCount; }
850- // audio_channel_mask_t channelMask() const { return mChannelMask; }
851- // audio_format_t format() const { return mFormat; }
852- // status_t initCheck() const { return mStatus; }
853-
854- // TODO
810+ // TODO need datatype but should be easy
855811// status_t addAudioDeviceCallback(const sp<AudioSystem::AudioDeviceCallback>& callback);
856812// status_t removeAudioDeviceCallback(
857813// const sp<AudioSystem::AudioDeviceCallback>& callback);
858814
859- // TODO
815+ // TODO types
860816// status_t getTimestamp(ExtendedTimestamp *timestamp);
861817
862- // TODO
818+ // TODO types
863819// media::VolumeShaper::Status applyVolumeShaper(
864820// const sp<media::VolumeShaper::Configuration>& configuration,
865- // const sp<media::VolumeShaper::Operation>& operation);
866-
867- // TODO
868- // status_t getMetrics(mediametrics::Item * &item);
821+ // const sp<media::VolumeShaper::Operation>& operation);
0 commit comments