From 27b979219ff9435721f8fab99f02ef6ca8d15833 Mon Sep 17 00:00:00 2001 From: zhangwenting15 Date: Thu, 24 Jul 2025 17:00:06 +0800 Subject: [PATCH] number to int Signed-off-by: zhangwenting15 Change-Id: I3e0e355ba557af539fba71ecfde8c111029ff296 --- .../taihe/idl/ohos.multimedia.media.taihe | 264 +++++++++--------- frameworks/taihe/idl/soundPool.taihe | 34 +-- .../media/include/avmetadataextractor_taihe.h | 4 +- .../taihe/media/include/avplayer_taihe.h | 72 ++--- .../taihe/media/include/avrecorder_taihe.h | 4 +- .../media/include/avscreen_capture_taihe.h | 2 +- .../taihe/media/include/avtranscoder_taihe.h | 8 +- .../helper_data_source_callback_taihe.h | 2 +- .../media_source_loading_request_taihe.h | 2 +- .../media/src/avimagegenerator_taihe.cpp | 4 +- .../media/src/avmetadataextractor_taihe.cpp | 10 +- .../media/src/avplayer_callback_taihe.cpp | 42 ++- frameworks/taihe/media/src/avplayer_taihe.cpp | 130 +++++---- .../taihe/media/src/avrecorder_taihe.cpp | 48 ++-- .../media/src/avscreen_capture_taihe.cpp | 6 +- .../media/src/avtranscoder_callback_taihe.cpp | 6 +- .../taihe/media/src/avtranscoder_taihe.cpp | 16 +- .../src/helper_data_source_callback_taihe.cpp | 7 +- .../media_source_loader_callback_taihe.cpp | 22 +- .../media_source_loading_request_taihe.cpp | 8 +- .../taihe/media/src/media_source_taihe.cpp | 12 +- .../soundpool/include/sound_pool_taihe.h | 24 +- .../src/sound_pool_callback_taihe.cpp | 8 +- .../taihe/soundpool/src/sound_pool_taihe.cpp | 32 +-- 24 files changed, 386 insertions(+), 381 deletions(-) diff --git a/frameworks/taihe/idl/ohos.multimedia.media.taihe b/frameworks/taihe/idl/ohos.multimedia.media.taihe index 3a8cf552f..b2fb0b4cc 100644 --- a/frameworks/taihe/idl/ohos.multimedia.media.taihe +++ b/frameworks/taihe/idl/ohos.multimedia.media.taihe @@ -27,13 +27,13 @@ from soundPool use PlayParameters; from soundPool use SoundPool; struct AVFileDescriptor { - fd: f64; - offset: Optional; - length: Optional; + fd: i32; + offset: Optional; + length: Optional; } struct AVDataSrcDescriptor { - fileSize: f64; - callback: (buffer: @arraybuffer Array, length: f64, pos: Optional) => f64; + fileSize: i64; + callback: (buffer: @arraybuffer Array, length: i64, @optional pos: Optional) => i32; } @gen_async("createAVImageGenerator") @@ -53,7 +53,7 @@ function GetScreenCaptureMonitorSync(): Optional; @gen_async("createSoundPool") @gen_promise("createSoundPool") -function CreateSoundPoolSync(maxStreams: f64, audioRendererInfo: @sts_type("audio.AudioRendererInfo") Opaque): Optional; +function CreateSoundPoolSync(maxStreams: i32, audioRendererInfo: @sts_type("audio.AudioRendererInfo") Opaque): Optional; @gen_async("createVideoRecorder") @gen_promise("createVideoRecorder") @@ -73,7 +73,7 @@ function CreateMediaSourceWithUrl(url: String, headers: Optional<@record Map): Optional; @gen_promise("reportAVScreenCaptureUserChoice") -function ReportAVScreenCaptureUserChoiceSync(sessionId: f64, choice: String): void; +function ReportAVScreenCaptureUserChoiceSync(sessionId: i32, choice: String): void; enum HdrType: i32 { AV_HDR_TYPE_NONE = 0, @@ -87,9 +87,9 @@ struct Location { struct MediaStream { url: String; - width: f64; - height: f64; - bitrate: f64; + width: i32; + height: i32; + bitrate: i32; } struct AVMetadata { @@ -130,15 +130,15 @@ enum PixelFormat: i32 { } struct PixelMapParams { - width: Optional; - height: Optional; + width: Optional; + height: Optional; colorFormat: Optional; } struct PlaybackStrategy { - preferredWidth: Optional; - preferredHeight: Optional; - preferredBufferDuration: Optional; + preferredWidth: Optional; + preferredHeight: Optional; + preferredBufferDuration: Optional; preferredHdr: Optional; mutedMediaType: Optional; preferredAudioLanguage: Optional; @@ -165,10 +165,10 @@ interface AVMetadataExtractor { FetchMetadataSync(): Optional; @gen_promise("getFrameIndexByTime") - GetFrameIndexByTimeSync(timeUs: f64): f64; + GetFrameIndexByTimeSync(timeUs: i64): i32; @gen_promise("getTimeByFrameIndex") - GetTimeByFrameIndexSync(index: f64): f64; + GetTimeByFrameIndexSync(index: i32): i64; } enum MediaDescriptionKey: String { @@ -190,12 +190,12 @@ enum MediaDescriptionKey: String { union MediaDescriptionValue { type_string: String; - type_int: f64; + type_int: i32; } union PlaybackInfoValue { type_string: String; - type_int: f64; + type_int: i32; } enum SwitchMode: i32 { @@ -208,11 +208,11 @@ interface AVPlayer { @get GetUrl(): Optional; @set SetUrl(url: Optional): void; - @get GetWidth(): f64; - @get GetHeight(): f64; + @get GetWidth(): i32; + @get GetHeight(): i32; @get GetState(): String; - @get GetDuration(): f64; - @get GetCurrentTime(): f64; + @get GetDuration(): i32; + @get GetCurrentTime(): i32; SetVolume(volume: f64): void; @get GetDataSrc(): Optional; @set SetDataSrc(dataSrc: Optional): void; @@ -223,12 +223,12 @@ interface AVPlayer { @get GetFdSrc(): Optional; @set SetFdSrc(fdSrc: Optional): void; SetSpeed(speed: PlaybackSpeed): void; - Seek(timeMs: f64, mode: Optional): void; + Seek(timeMs: i32, mode: Optional): void; @get GetVideoScaleType(): Optional; @set SetVideoScaleType(videoScaleType: Optional): void; IsSeekContinuousSupported() : bool; - GetPlaybackPosition(): f64; - SetBitrate(bitrate: f64): void; + GetPlaybackPosition(): i32; + SetBitrate(bitrate: i32): void; @gen_async("getTrackDescription") @gen_promise("getTrackDescription") @@ -259,19 +259,19 @@ interface AVPlayer { PrepareSync(): void; @gen_promise("getSelectedTracks") - GetSelectedTracksSync(): Array; + GetSelectedTracksSync(): Array; @gen_promise("selectTrack") - SelectTrackSync(index: f64, mode: Optional): void; + SelectTrackSync(index: i32, mode: Optional): void; @gen_promise("deselectTrack") - DeselectTrackSync(index: f64): void; + DeselectTrackSync(index: i32): void; @gen_promise("setMediaSource") SetMediaSourceSync(src: MediaSource, strategy: Optional): void; @gen_promise("addSubtitleFromFd") - AddSubtitleFromFdSync(fd: f64, offset: Optional, length: Optional): void; + AddSubtitleFromFdSync(fd: i32, offset: Optional, length: Optional): void; @gen_promise("addSubtitleFromUrl") AddSubtitleFromUrlSync(url: String): void; @@ -283,10 +283,10 @@ interface AVPlayer { SetSuperResolutionSync(enabled: bool): void; @gen_promise("setVideoWindowSize") - SetVideoWindowSizeSync(width: f64, height: f64): void; + SetVideoWindowSizeSync(width: i32, height: i32): void; @gen_promise("setPlaybackRange") - SetPlaybackRangeSync(startTimeMs: f64, endTimeMs: f64, mode: Optional): void; + SetPlaybackRangeSync(startTimeMs: i32, endTimeMs: i32, mode: Optional): void; @gen_promise("setMediaMuted") SetMediaMutedSync(mediaType: MediaType, muted: bool): void; @@ -306,33 +306,33 @@ interface AVPlayer { } else if (type === "startRenderFrame") { this.onStartRenderFrame(callback as (data:undefined)=> void); } else if (type === "seekDone") { - this.onSeekDone(callback as (data: double)=> void); + this.onSeekDone(callback as (data: int)=> void); } else if (type === "durationUpdate") { - this.onDurationUpdate(callback as (data: double)=> void); + this.onDurationUpdate(callback as (data: int)=> void); } else if (type === "timeUpdate") { - this.onTimeUpdate(callback as (data: double)=> void); + this.onTimeUpdate(callback as (data: int)=> void); } else if (type === "volumeChange") { this.onVolumeChange(callback as (data: double)=> void); } else if (type === "speedDone") { - this.onSpeedDone(callback as (data: double)=> void); + this.onSpeedDone(callback as (data: int)=> void); } else if (type === "bitrateDone") { - this.onBitrateDone(callback as (data: double)=> void); + this.onBitrateDone(callback as (data: int)=> void); } else if (type === "availableBitrates") { - this.onAvailableBitrates(callback as (data: Array)=> void); + this.onAvailableBitrates(callback as (data: Array)=> void); } else if (type === "amplitudeUpdate") { this.onAmplitudeUpdate(callback as (data: Array)=> void); } else if (type === "bufferingUpdate") { - this.onBufferingUpdate(callback as (infoType: BufferingInfoType, value: double)=> void); + this.onBufferingUpdate(callback as (infoType: BufferingInfoType, value: int)=> void); } else if (type === "videoSizeChange") { - this.onVideoSizeChange(callback as (width: double, height: double)=> void); + this.onVideoSizeChange(callback as (width: int, height: int)=> void); } else if (type === "trackChange") { - this.onTrackChange(callback as (index: double, isSelected: boolean)=> void); + this.onTrackChange(callback as (index: int, isSelected: boolean)=> void); } else if (type === "subtitleUpdate") { this.onSubtitleUpdate(callback as (data: SubtitleInfo)=> void); } else if (type === "superResolutionChanged") { this.onSuperResolutionChanged(callback as (enabled: boolean)=> void); } else if (type === "trackInfoUpdate") { - this.onTrackInfoUpdate(callback as (data: Array>)=> void); + this.onTrackInfoUpdate(callback as (data: Array>)=> void); } else { throw new Error(`Unknown type: ${type}`); } @@ -341,30 +341,30 @@ interface AVPlayer { OnStateChange(callback: (state: String, reason: StateChangeReason)=> void): void; OnEndOfStream(callback: (data: @sts_type("undefined") Opaque) => void): void; OnStartRenderFrame(callback: (data: @sts_type("undefined") Opaque) => void): void; - OnSeekDone(callback: (data: f64) => void): void; - OnDurationUpdate(callback: (data: f64) => void): void; - OnTimeUpdate(callback: (data: f64) => void): void; + OnSeekDone(callback: (data: i32) => void): void; + OnDurationUpdate(callback: (data: i32) => void): void; + OnTimeUpdate(callback: (data: i32) => void): void; OnVolumeChange(callback: (data: f64) => void): void; - OnSpeedDone(callback: (data: f64) => void): void; - OnBitrateDone(callback: (data: f64) => void): void; - OnAvailableBitrates(callback: (data: Array) => void): void; + OnSpeedDone(callback: (data: i32) => void): void; + OnBitrateDone(callback: (data: i32) => void): void; + OnAvailableBitrates(callback: (data: Array) => void): void; OnAmplitudeUpdate(callback: (data: Array) => void): void; - OnBufferingUpdate(callback: (infoType: BufferingInfoType, value: f64) => void): void; - OnVideoSizeChange(callback: (width: f64, height: f64) => void): void; - OnTrackChange(callback: (index: f64, isSelected: bool) => void): void; + OnBufferingUpdate(callback: (infoType: BufferingInfoType, value: i32) => void): void; + OnVideoSizeChange(callback: (width: i32, height: i32) => void): void; + OnTrackChange(callback: (index: i32, isSelected: bool) => void): void; OnSubtitleUpdate(callback: (data: SubtitleInfo) => void): void; OnSuperResolutionChanged(callback: (enabled: bool) => void): void; OnTrackInfoUpdate(callback: (data: Array<@record Map>) => void): void; - @!sts_inject_into_interface("on(type: string, payloadTypes: Array, callback: (messages: Array, playbackPosition?: double)=> void): void;") - @!sts_inject_into_class("""on(type: string, payloadTypes: Array, callback: object): void { + @!sts_inject_into_interface("on(type: string, payloadTypes: Array, callback: (messages: Array, playbackPosition?: int)=> void): void;") + @!sts_inject_into_class("""on(type: string, payloadTypes: Array, callback: object): void { if (type === "seiMessageReceived") { - this.onSeiMessageReceived(payloadTypes as (Array), callback as (messages: Array, playbackPosition?: double) => void); + this.onSeiMessageReceived(payloadTypes as (Array), callback as (messages: Array, playbackPosition?: int) => void); } else { } }""") - OnSeiMessageReceived(payloadTypes: Array, callback: (messages: Array, - playbackPosition: Optional) => void): void; + OnSeiMessageReceived(payloadTypes: Array, callback: (messages: Array, + playbackPosition: Optional) => void): void; @!sts_inject_into_interface("off(type: string, callback?: (state: string, reason: StateChangeReason)=> void): void;") @!sts_inject_into_interface("off(type: string, callback?: (data: object)=> void): void;") @@ -378,33 +378,33 @@ interface AVPlayer { } else if (type === "startRenderFrame") { this.offStartRenderFrame(callback as (((data:undefined)=> void) | undefined)); } else if (type === "seekDone") { - this.offSeekDone(callback as (((data: double) => void) | undefined)); + this.offSeekDone(callback as (((data: int) => void) | undefined)); } else if (type === "durationUpdate") { - this.offDurationUpdate(callback as (((data: double) => void) | undefined)); + this.offDurationUpdate(callback as (((data: int) => void) | undefined)); } else if (type === "timeUpdate") { - this.offTimeUpdate(callback as (((data: double) => void) | undefined)); + this.offTimeUpdate(callback as (((data: int) => void) | undefined)); } else if (type === "volumeChange") { this.offVolumeChange(callback as (((data: double) => void) | undefined)); } else if (type === "speedDone") { - this.offSpeedDone(callback as (((data: double) => void) | undefined)); + this.offSpeedDone(callback as (((data: int) => void) | undefined)); } else if (type === "bitrateDone") { - this.offBitrateDone(callback as (((data: double) => void) | undefined)); + this.offBitrateDone(callback as (((data: int) => void) | undefined)); } else if (type === "availableBitrates") { - this.offAvailableBitrates(callback as (((data: Array) => void) | undefined)); + this.offAvailableBitrates(callback as (((data: Array) => void) | undefined)); } else if (type === "amplitudeUpdate") { this.offAmplitudeUpdate(callback as (((data: Array) => void) | undefined)); } else if (type === "bufferingUpdate") { - this.offBufferingUpdate(callback as (((infoType: object, value: double) => void) | undefined)); + this.offBufferingUpdate(callback as (((infoType: object, value: int) => void) | undefined)); } else if (type === "videoSizeChange") { - this.offVideoSizeChange(callback as (((width: double, height: double) => void) | undefined)); + this.offVideoSizeChange(callback as (((width: int, height: int) => void) | undefined)); } else if (type === "trackChange") { - this.offTrackChange(callback as (((index: double, isSelected: boolean) => void) | undefined)); + this.offTrackChange(callback as (((index: int, isSelected: boolean) => void) | undefined)); } else if (type === "subtitleUpdate") { this.offSubtitleUpdate(callback as (((data: object) => void) | undefined)); } else if (type === "superResolutionChanged") { this.offSuperResolutionChanged(callback as (((enabled: boolean) => void) | undefined)); } else if (type === "trackInfoUpdate") { - this.offTrackInfoUpdate(callback as (((data: Array>) => void) | undefined)); + this.offTrackInfoUpdate(callback as (((data: Array>) => void) | undefined)); } else { throw new Error(`Unknown type: ${type}`); } @@ -413,34 +413,34 @@ interface AVPlayer { OffStateChange(callback: Optional<(state: String, reason: StateChangeReason)=> void>): void; OffEndOfStream(callback: Optional<(data: @sts_type("undefined") Opaque) => void>): void; OffStartRenderFrame(callback: Optional<(data: @sts_type("undefined") Opaque) => void>): void; - OffSeekDone(callback: Optional<(data: f64) => void>): void; - OffDurationUpdate(callback: Optional<(data: f64) => void>): void; - OffTimeUpdate(callback: Optional<(data: f64) => void>): void; + OffSeekDone(callback: Optional<(data: i32) => void>): void; + OffDurationUpdate(callback: Optional<(data: i32) => void>): void; + OffTimeUpdate(callback: Optional<(data: i32) => void>): void; OffVolumeChange(callback: Optional<(data: f64) => void>): void; - OffSpeedDone(callback: Optional<(data: f64) => void>): void; - OffBitrateDone(callback: Optional<(data: f64) => void>): void; - OffAvailableBitrates(callback: Optional<(data: Array) => void>): void; + OffSpeedDone(callback: Optional<(data: i32) => void>): void; + OffBitrateDone(callback: Optional<(data: i32) => void>): void; + OffAvailableBitrates(callback: Optional<(data: Array) => void>): void; OffAmplitudeUpdate(callback: Optional<(data: Array) => void>): void; - OffBufferingUpdate(callback: Optional<(infoType: BufferingInfoType, value: f64) => void>): void; - OffVideoSizeChange(callback: Optional<(width: f64, height: f64) => void>): void; - OffTrackChange(callback: Optional<(index: f64, isSelected: bool) => void>): void; + OffBufferingUpdate(callback: Optional<(infoType: BufferingInfoType, value: i32) => void>): void; + OffVideoSizeChange(callback: Optional<(width: i32, height: i32) => void>): void; + OffTrackChange(callback: Optional<(index: i32, isSelected: bool) => void>): void; OffSubtitleUpdate(callback: Optional<(data: SubtitleInfo) => void>): void; OffSuperResolutionChanged(callback: Optional<(enabled: bool) => void>): void; - OffTrackInfoUpdate(callback: Optional<(data: Array<@record Map>) => void>): void; + OffTrackInfoUpdate(callback: Optional<(data: Array<@record Map>) => void>): void; - @!sts_inject_into_interface("off(type: string, payloadTypes: Array, callback?: (messages: Array, playbackPosition?: double)=> void): void;") - @!sts_inject_into_class("""off(type: string, payloadTypes: Array, callback?: object): void { + @!sts_inject_into_interface("off(type: string, payloadTypes: Array, callback?: (messages: Array, playbackPosition?: int)=> void): void;") + @!sts_inject_into_class("""off(type: string, payloadTypes: Array, callback?: object): void { if (type === "seiMessageReceived") { - this.offSeiMessageReceived(payloadTypes as (Array), callback as (((messages: Array, playbackPosition?: double) => void) | undefined)); + this.offSeiMessageReceived(payloadTypes as (Array), callback as (((messages: Array, playbackPosition?: int) => void) | undefined)); } else { } }""") - OffSeiMessageReceived(payloadTypes: Array, callback: Optional<(messages: Array, - playbackPosition: Optional) => void>): void; + OffSeiMessageReceived(payloadTypes: Array, callback: Optional<(messages: Array, + playbackPosition: Optional) => void>): void; } struct SeiMessage { - payloadType: f64; + payloadType: i32; payload: @arraybuffer Array; } @@ -467,8 +467,8 @@ enum StateChangeReason: i32 { } struct SubtitleInfo { - duration: Optional; - startTime: Optional; + duration: Optional; + startTime: Optional; text: Optional; } @@ -585,16 +585,16 @@ enum PlaybackInfoKey: String { } struct VideoRecorderProfile { - @readonly audioBitrate: f64; - @readonly audioChannels: f64; + @readonly audioBitrate: i32; + @readonly audioChannels: i32; @readonly audioCodec: CodecMimeType; - @readonly audioSampleRate: f64; + @readonly audioSampleRate: i32; @readonly fileFormat: ContainerFormatType; - @readonly videoBitrate: f64; + @readonly videoBitrate: i32; @readonly videoCodec: CodecMimeType; - @readonly videoFrameWidth: f64; - @readonly videoFrameHeight: f64; - @readonly videoFrameRate: f64; + @readonly videoFrameWidth: i32; + @readonly videoFrameHeight: i32; + @readonly videoFrameRate: i32; } struct VideoRecorderConfig { @@ -602,13 +602,13 @@ struct VideoRecorderConfig { videoSourceType: VideoSourceType; profile: VideoRecorderProfile; url: String; - rotation: Optional; + rotation: Optional; location: Optional; } struct WatermarkConfig { - top: f64; - left: f64; + top: i32; + left: i32; } interface AVImageGenerator { @@ -666,11 +666,11 @@ interface AVRecorder { IsWatermarkSupportedSync(): bool; @gen_promise("updateRotation") - UpdateRotationSync(rotation: f64): void; + UpdateRotationSync(rotation: i32): void; @gen_async("getAudioCapturerMaxAmplitude") @gen_promise("getAudioCapturerMaxAmplitude") - GetAudioCapturerMaxAmplitudeSync(): f64; + GetAudioCapturerMaxAmplitudeSync(): i32; @gen_async("getAvailableEncoder") @gen_promise("getAvailableEncoder") @@ -731,8 +731,8 @@ enum MediaType: i32 { } struct Range { - min: f64; - max: f64; + min: i32; + max: i32; } struct EncoderInfo { @@ -743,7 +743,7 @@ struct EncoderInfo { width: Optional; height: Optional; channels: Optional; - sampleRate: Optional>; + sampleRate: Optional>; } enum BufferingInfoType: i32 { @@ -757,8 +757,8 @@ interface AVTranscoder { @get GetFdSrc(): AVFileDescriptor; @set SetFdSrc(fdSrc: AVFileDescriptor): void; - @get GetFdDst(): f64; - @set SetFdDst(fdDst: f64): void; + @get GetFdDst(): i32; + @set SetFdDst(fdDst: i32): void; @gen_async("prepare") @gen_promise("prepare") @@ -791,7 +791,7 @@ interface AVTranscoder { } else if (type === "error") { this.onError(callback as (err: BusinessError)=> void); } else if (type === "progressUpdate") { - this.onProgressUpdate(callback as (data: double)=> void); + this.onProgressUpdate(callback as (data: int)=> void); } else { throw new Error(`Unknown type: ${type}`); } @@ -804,7 +804,7 @@ interface AVTranscoder { } else if (type === "error") { this.offError(callback as (((err: BusinessError)=> void) | undefined )); } else if (type === "progressUpdate") { - this.offProgressUpdate(callback as (((data: double)=> void) | undefined )); + this.offProgressUpdate(callback as (((data: int)=> void) | undefined )); } else { throw new Error(`Unknown type: ${type}`); } @@ -816,18 +816,18 @@ interface AVTranscoder { OnError(callback: (err: @sts_type("BusinessError") Opaque)=> void): void; OffError(callback: Optional<(err: @sts_type("BusinessError") Opaque)=> void>): void; - OnProgressUpdate(callback: (data: f64) => void): void; - OffProgressUpdate(callback: Optional<(data: f64) => void>); + OnProgressUpdate(callback: (data: i32) => void): void; + OffProgressUpdate(callback: Optional<(data: i32) => void>); } struct AVTranscoderConfig { - audioBitrate: Optional; + audioBitrate: Optional; audioCodec: Optional; fileFormat: ContainerFormatType; - videoBitrate: Optional; + videoBitrate: Optional; videoCodec: Optional; - videoFrameWidth: Optional; - videoFrameHeight: Optional; + videoFrameWidth: Optional; + videoFrameHeight: Optional; } enum AVScreenCaptureRecordPreset:i32 { @@ -841,15 +841,15 @@ enum AVScreenCaptureFillMode:i32 { } struct AVScreenCaptureRecordConfig { - fd: f64; - frameWidth: Optional; - frameHeight: Optional; - videoBitrate: Optional; - audioSampleRate: Optional; - audioChannelCount: Optional; - audioBitrate: Optional; + fd: i32; + frameWidth: Optional; + frameHeight: Optional; + videoBitrate: Optional; + audioSampleRate: Optional; + audioChannelCount: Optional; + audioBitrate: Optional; preset: Optional; - displayId: Optional; + displayId: Optional; fillMode: Optional; } @@ -870,20 +870,20 @@ struct AVRecorderConfig { metaSourceTypes: Optional>; fileGenerationMode: Optional; metadata: Optional; - maxDuration: Optional; + maxDuration: Optional; } struct AVRecorderProfile { - audioBitrate: Optional; - audioChannels: Optional; + audioBitrate: Optional; + audioChannels: Optional; audioCodec: Optional; - audioSampleRate: Optional; + audioSampleRate: Optional; fileFormat: ContainerFormatType; - videoBitrate: Optional; + videoBitrate: Optional; videoCodec: Optional; - videoFrameWidth: Optional; - videoFrameHeight: Optional; - videoFrameRate: Optional; + videoFrameWidth: Optional; + videoFrameHeight: Optional; + videoFrameRate: Optional; isHdr: Optional; enableTemporalScale: Optional; enableStableQualityMode: Optional; @@ -942,7 +942,7 @@ interface AVScreenCaptureRecorder { StopRecordingSync(): void; @gen_promise("skipPrivacyMode") - SkipPrivacyModeSync(windowIDs: Array): void; + SkipPrivacyModeSync(windowIDs: Array): void; @gen_promise("setMicEnabled") SetMicEnabledSync(enable: bool): void; @@ -997,15 +997,15 @@ interface MediaSourceLoadingRequest { @get GetUrl(): String; @get GetHeader(): Optional<@record Map>; - RespondData(uuid: f64, offset: f64, buffer: @arraybuffer Array): Optional; - RespondHeader(uuid: f64, header: Optional<@record Map>, redirectUrl: Optional): void; - FinishLoading(uuid: f64, state: LoadingRequestError): void; + RespondData(uuid: i64, offset: i64, buffer: @arraybuffer Array): Optional; + RespondHeader(uuid: i64, header: Optional<@record Map>, redirectUrl: Optional): void; + FinishLoading(uuid: i64, state: LoadingRequestError): void; } struct MediaSourceLoader { - open: (request: MediaSourceLoadingRequest) => f64; - read: (uuid: f64, requestedOffset: f64, requestedLength: f64) => void; - close: (uuid: f64) => void; + open: (request: MediaSourceLoadingRequest) => i64; + read: (uuid: i64, requestedOffset: i64, requestedLength: i64) => void; + close: (uuid: i64) => void; } interface MediaSource { diff --git a/frameworks/taihe/idl/soundPool.taihe b/frameworks/taihe/idl/soundPool.taihe index ffd9ec191..8c25b567a 100644 --- a/frameworks/taihe/idl/soundPool.taihe +++ b/frameworks/taihe/idl/soundPool.taihe @@ -20,51 +20,51 @@ import { BusinessError, ErrorCallback, AsyncCallback, Callback } from '@ohos.bas """) struct PlayParameters { - loop: Optional; - rate: Optional; + loop: Optional; + rate: Optional; leftVolume: Optional; rightVolume: Optional; - priority: Optional; + priority: Optional; parallelPlayFlag: Optional; } interface SoundPool { @gen_async("load") @gen_promise("load") - LoadSync(uri: String): f64; + LoadSync(uri: String): i32; @gen_async("load") @gen_promise("load") - LoadWithFdSync(fd: f64, offset: f64, length: f64): f64; + LoadWithFdSync(fd: i32, offset: f64, length: f64): i32; @gen_promise("play") - PlaySync(soundID: f64, params: Optional): f64; + PlaySync(soundID: i32, params: Optional): i32; @gen_async("play") - PlayWithoutParam(soundID: f64): f64; + PlayWithoutParam(soundID: i32): i32; @gen_async("play") - PlayWithParam(soundID: f64, params: PlayParameters): f64; + PlayWithParam(soundID: i32, params: PlayParameters): i32; @gen_async("stop") @gen_promise("stop") - StopSync(streamID: f64): void; + StopSync(streamID: i32): void; @gen_async("setLoop") @gen_promise("setLoop") - SetLoopSync(streamID: f64, loop: f64): void; + SetLoopSync(streamID: i32, loop: i32): void; @gen_async("setPriority") @gen_promise("setPriority") - SetPrioritySync(streamID: f64, priority: f64): void; + SetPrioritySync(streamID: i32, priority: i32): void; @gen_async("setVolume") @gen_promise("setVolume") - SetVolumeSync(streamID: f64, leftVolume: f64, rightVolume: f64): void; + SetVolumeSync(streamID: i32, leftVolume: f64, rightVolume: f64): void; @gen_async("unload") @gen_promise("unload") - UnloadSync(soundID: f64): void; + UnloadSync(soundID: i32): void; @gen_async("release") @gen_promise("release") @@ -73,11 +73,11 @@ interface SoundPool { @!sts_inject_into_interface("on(type: string, callback: (data: object)=> void): void;") @!sts_inject_into_class("""on(type: string, callback: object): void { if (type === "playFinishedWithStreamId") { - this.onPlayFinishedWithStreamId(callback as (data: double)=> void); + this.onPlayFinishedWithStreamId(callback as (data: int)=> void); } else if (type === "error") { this.onError(callback as (err: BusinessError)=> void); } else if (type === "loadComplete") { - this.onLoadComplete(callback as (data: double)=> void); + this.onLoadComplete(callback as (data: int)=> void); } else if (type === "playFinished") { this.onPlayFinished(callback as (data: undefined)=> void); } else { @@ -103,10 +103,10 @@ interface SoundPool { OnError(callback: (err: @sts_type("BusinessError") Opaque)=> void): void; OffError(): void; - OnPlayFinishedWithStreamId(callback: (data: f64) => void): void; + OnPlayFinishedWithStreamId(callback: (data: i32) => void): void; OffPlayFinishedWithStreamId(); - OnLoadComplete(callback: (data: f64) => void): void; + OnLoadComplete(callback: (data: i32) => void): void; OffLoadComplete(); OnPlayFinished(callback: (data: @sts_type("undefined") Opaque) => void): void; diff --git a/frameworks/taihe/media/include/avmetadataextractor_taihe.h b/frameworks/taihe/media/include/avmetadataextractor_taihe.h index e14a333dd..c36b56a4a 100644 --- a/frameworks/taihe/media/include/avmetadataextractor_taihe.h +++ b/frameworks/taihe/media/include/avmetadataextractor_taihe.h @@ -38,8 +38,8 @@ public: void SetDataSrc(optional_view dataSrc); optional FetchMetadataSync(); void ReleaseSync(); - double GetFrameIndexByTimeSync(double timeUs); - double GetTimeByFrameIndexSync(double index); + int32_t GetFrameIndexByTimeSync(double timeUs); + double GetTimeByFrameIndexSync(int32_t index); private: std::shared_ptr helper_; std::shared_ptr dataSrcCb_ = nullptr; diff --git a/frameworks/taihe/media/include/avplayer_taihe.h b/frameworks/taihe/media/include/avplayer_taihe.h index 73bbf8b2b..154ce8168 100644 --- a/frameworks/taihe/media/include/avplayer_taihe.h +++ b/frameworks/taihe/media/include/avplayer_taihe.h @@ -109,11 +109,11 @@ public: optional GetUrl(); void SetUrl(optional_view url); - double GetWidth(); - double GetHeight(); + int32_t GetWidth(); + int32_t GetHeight(); string GetState(); - double GetDuration(); - double GetCurrentTime(); + int32_t GetDuration(); + int32_t GetCurrentTime(); void SetVolume(double volume); optional GetDataSrc(); void SetDataSrc(optional_view dataSrc); @@ -124,13 +124,13 @@ public: optional GetFdSrc(); void SetFdSrc(optional_view fdSrc); void SetSpeed(PlaybackSpeed speed); - void Seek(double timeMs, optional_view mode); + void Seek(int32_t timeMs, optional_view mode); optional GetVideoScaleType(); void SetVideoScaleType(optional_view videoScaleType); bool IsSeekContinuousSupported(); array> GetTrackDescriptionSync(); - double GetPlaybackPosition(); - void SetBitrate(double bitrate); + int32_t GetPlaybackPosition(); + void SetBitrate(int32_t bitrate); void StopSync(); void PlaySync(); void ResetSync(); @@ -142,15 +142,15 @@ public: void GetPlayStrategy(AVPlayStrategyTmp &playStrategy, PlaybackStrategy strategy); void EnqueueMediaSourceTask(const std::shared_ptr &mediaSource, const struct AVPlayStrategy &strategy); - void AddSubtitleFromFdSync(double fd, optional_view offset, optional_view length); - array GetSelectedTracksSync(); - void SelectTrackSync(double index, ::taihe::optional_view<::ohos::multimedia::media::SwitchMode> mode); - void DeselectTrackSync(double index); + void AddSubtitleFromFdSync(int32_t fd, optional_view offset, optional_view length); + array GetSelectedTracksSync(); + void SelectTrackSync(int32_t index, ::taihe::optional_view<::ohos::multimedia::media::SwitchMode> mode); + void DeselectTrackSync(int32_t index); void AddSubtitleFromUrlSync(::taihe::string_view url); map GetPlaybackInfoSync(); - void SetVideoWindowSizeSync(double width, double height); + void SetVideoWindowSizeSync(int32_t width, int32_t height); void SetSuperResolutionSync(bool enabled); - void SetPlaybackRangeSync(double startTimeMs, double endTimeMs, + void SetPlaybackRangeSync(int32_t startTimeMs, int32_t endTimeMs, optional_view<::ohos::multimedia::media::SeekMode> mode); void SetMediaMutedSync(::ohos::multimedia::media::MediaType mediaType, bool muted); void SetPlaybackStrategySync(::ohos::multimedia::media::PlaybackStrategy const& strategy); @@ -159,22 +159,22 @@ public: void OnMediaKeySystemInfoUpdate(callback_view callback); void OnEndOfStream(callback_view callback); void OnStartRenderFrame(callback_view callback); - void OnSeekDone(callback_view callback); - void OnDurationUpdate(callback_view callback); - void OnTimeUpdate(callback_view callback); + void OnSeekDone(callback_view callback); + void OnDurationUpdate(callback_view callback); + void OnTimeUpdate(callback_view callback); void OnVolumeChange(callback_view callback); - void OnSpeedDone(callback_view callback); - void OnBitrateDone(callback_view callback); - void OnAvailableBitrates(callback_view)> callback); + void OnSpeedDone(callback_view callback); + void OnBitrateDone(callback_view callback); + void OnAvailableBitrates(callback_view)> callback); void OnAmplitudeUpdate(callback_view)> callback); - void OnBufferingUpdate(callback_view callback); - void OnVideoSizeChange(callback_view callback); - void OnTrackChange(callback_view callback); + void OnBufferingUpdate(callback_view callback); + void OnVideoSizeChange(callback_view callback); + void OnTrackChange(callback_view callback); void OnSubtitleUpdate(callback_view callback); void OnSuperResolutionChanged(callback_view callback); void OnTrackInfoUpdate(callback_view>)> callback); - void OnSeiMessageReceived(array_view payloadTypes, - callback_view, optional_view)> callback); + void OnSeiMessageReceived(array_view payloadTypes, + callback_view, optional_view)> callback); void OffError(optional_view> callback); void OffStateChange(optional_view> callback); void OffEndOfStream(optional_view> callback); void OffStartRenderFrame(optional_view> callback); - void OffSeekDone(optional_view> callback); - void OffDurationUpdate(optional_view> callback); - void OffTimeUpdate(optional_view> callback); + void OffSeekDone(optional_view> callback); + void OffDurationUpdate(optional_view> callback); + void OffTimeUpdate(optional_view> callback); void OffVolumeChange(optional_view> callback); - void OffSpeedDone(optional_view> callback); - void OffBitrateDone(optional_view> callback); - void OffAvailableBitrates(optional_view)>> callback); + void OffSpeedDone(optional_view> callback); + void OffBitrateDone(optional_view> callback); + void OffAvailableBitrates(optional_view)>> callback); void OffAmplitudeUpdate(optional_view)>> callback); void OffBufferingUpdate(optional_view> callback); - void OffVideoSizeChange(optional_view> callback); - void OffTrackChange(optional_view> callback); + int32_t)>> callback); + void OffVideoSizeChange(optional_view> callback); + void OffTrackChange(optional_view> callback); void OffSubtitleUpdate(optional_view> callback); void OffSuperResolutionChanged(optional_view> callback); - void OffTrackInfoUpdate(optional_view>)>> callback); - void OffSeiMessageReceived(array_view payloadTypes, - optional_view, optional_view)>> callback); + void OffTrackInfoUpdate(optional_view>)>> callback); + void OffSeiMessageReceived(array_view payloadTypes, + optional_view, optional_view)>> callback); bool GetIntArrayArgument(std::vector &vec, const std::vector &inputArray); void SeiMessageCallbackOff(std::string &callbackName, const std::vector &payloadTypes); void MaxAmplitudeCallbackOff(std::string callbackName); diff --git a/frameworks/taihe/media/include/avrecorder_taihe.h b/frameworks/taihe/media/include/avrecorder_taihe.h index 08f4900df..64fdccdb0 100644 --- a/frameworks/taihe/media/include/avrecorder_taihe.h +++ b/frameworks/taihe/media/include/avrecorder_taihe.h @@ -184,12 +184,12 @@ public: const std::unique_ptr &asyncCtx); int32_t IsWatermarkSupported(bool &isWatermarkSupported); - void UpdateRotationSync(double rotation); + void UpdateRotationSync(int32_t rotation); int32_t GetRotation(std::unique_ptr &asyncCtx, int32_t rotation); std::shared_ptr> GetSetOrientationHintTask( const std::unique_ptr &asyncCtx); - double GetAudioCapturerMaxAmplitudeSync(); + int32_t GetAudioCapturerMaxAmplitudeSync(); std::shared_ptr> GetMaxAmplitudeTask( const std::unique_ptr &asyncCtx); int32_t GetMaxAmplitude(int32_t &maxAmplitude); diff --git a/frameworks/taihe/media/include/avscreen_capture_taihe.h b/frameworks/taihe/media/include/avscreen_capture_taihe.h index d55f6e27b..880a58323 100644 --- a/frameworks/taihe/media/include/avscreen_capture_taihe.h +++ b/frameworks/taihe/media/include/avscreen_capture_taihe.h @@ -66,7 +66,7 @@ public: void InitSync(::ohos::multimedia::media::AVScreenCaptureRecordConfig const& config); void StartRecordingSync(); void StopRecordingSync(); - void SkipPrivacyModeSync(::taihe::array_view windowIDs); + void SkipPrivacyModeSync(::taihe::array_view windowIDs); void SetMicEnabledSync(bool enable); void ReleaseSync(); diff --git a/frameworks/taihe/media/include/avtranscoder_taihe.h b/frameworks/taihe/media/include/avtranscoder_taihe.h index a02484ace..503104c27 100644 --- a/frameworks/taihe/media/include/avtranscoder_taihe.h +++ b/frameworks/taihe/media/include/avtranscoder_taihe.h @@ -117,8 +117,8 @@ public: ohos::multimedia::media::AVFileDescriptor GetFdSrc(); void SetFdSrc(ohos::multimedia::media::AVFileDescriptor const& fdSrc); - double GetFdDst(); - void SetFdDst(double fdDst); + int32_t GetFdDst(); + void SetFdDst(int32_t fdDst); void PrepareSync(AVTranscoderConfig const& config); RetInfo Start(); RetInfo Pause(); @@ -156,8 +156,8 @@ public: void OnError(callback_view callback); void OffError(optional_view> callback); - void OnProgressUpdate(callback_view callback); - void OffProgressUpdate(optional_view> callback); + void OnProgressUpdate(callback_view callback); + void OffProgressUpdate(optional_view> callback); using AvTransCoderTaskqFunc = RetInfo (AVTranscoderImpl::*)(); private: diff --git a/frameworks/taihe/media/include/helper_data_source_callback_taihe.h b/frameworks/taihe/media/include/helper_data_source_callback_taihe.h index 33f025acb..b38d7b8b8 100644 --- a/frameworks/taihe/media/include/helper_data_source_callback_taihe.h +++ b/frameworks/taihe/media/include/helper_data_source_callback_taihe.h @@ -23,7 +23,7 @@ namespace OHOS { namespace Media { -using DataSrcCallback = taihe::callback, double, taihe::optional_view)>; +using DataSrcCallback = taihe::callback, int64_t, taihe::optional_view)>; struct HelperDataSourceTHCallback { HelperDataSourceTHCallback(const std::string &callbackName, const std::shared_ptr &mem, diff --git a/frameworks/taihe/media/include/media_source_loading_request_taihe.h b/frameworks/taihe/media/include/media_source_loading_request_taihe.h index 7e0946fd4..b4a79168a 100644 --- a/frameworks/taihe/media/include/media_source_loading_request_taihe.h +++ b/frameworks/taihe/media/include/media_source_loading_request_taihe.h @@ -29,7 +29,7 @@ public: MediaSourceLoadingRequestImpl(uint64_t requestId); string GetUrl(); optional> GetHeader(); - optional RespondData(double uuid, double offset, array_view buffer); + optional RespondData(double uuid, double offset, array_view buffer); void RespondHeader(double uuid, optional_view> header, optional_view redirectUrl); void FinishLoading(double uuid, LoadingRequestError state); static ::ohos::multimedia::media::MediaSourceLoadingRequest CreateLoadingRequest( diff --git a/frameworks/taihe/media/src/avimagegenerator_taihe.cpp b/frameworks/taihe/media/src/avimagegenerator_taihe.cpp index 0dbab8041..b66432edc 100644 --- a/frameworks/taihe/media/src/avimagegenerator_taihe.cpp +++ b/frameworks/taihe/media/src/avimagegenerator_taihe.cpp @@ -39,8 +39,8 @@ optional AVImageGeneratorImpl::GetFdSrc() MEDIA_LOGI("GetFdSrc In"); AVFileDescriptor fdSrc; fdSrc.fd = fileDescriptor_.fd; - fdSrc.offset = optional(std::in_place_t{}, fileDescriptor_.offset); - fdSrc.length = optional(std::in_place_t{}, fileDescriptor_.length); + fdSrc.offset = optional(std::in_place_t{}, fileDescriptor_.offset); + fdSrc.length = optional(std::in_place_t{}, fileDescriptor_.length); MEDIA_LOGI("GetFdSrc Out"); return optional(std::in_place_t{}, fdSrc); } diff --git a/frameworks/taihe/media/src/avmetadataextractor_taihe.cpp b/frameworks/taihe/media/src/avmetadataextractor_taihe.cpp index ccefa3aa7..bf09b6670 100644 --- a/frameworks/taihe/media/src/avmetadataextractor_taihe.cpp +++ b/frameworks/taihe/media/src/avmetadataextractor_taihe.cpp @@ -40,8 +40,8 @@ optional AVMetadataExtractorImpl::GetFdSrc() MEDIA_LOGI("TaiheGetAVFileDescriptor In"); AVFileDescriptor fdSrc; fdSrc.fd = fileDescriptor_.fd; - fdSrc.offset = optional(std::in_place_t{}, fileDescriptor_.offset); - fdSrc.length = optional(std::in_place_t{}, fileDescriptor_.length); + fdSrc.offset = optional(std::in_place_t{}, fileDescriptor_.offset); + fdSrc.length = optional(std::in_place_t{}, fileDescriptor_.length); MEDIA_LOGI("TaiheGetAVFileDescriptor Out"); return optional(std::in_place_t{}, fdSrc); } @@ -300,7 +300,7 @@ void AVMetadataExtractorImpl::ReleaseSync() helper_->Release(); } -double AVMetadataExtractorImpl::GetFrameIndexByTimeSync(double timeUs) +int32_t AVMetadataExtractorImpl::GetFrameIndexByTimeSync(double timeUs) { OHOS::Media::MediaTrace trace("AVMetadataExtractorImpl::GetFrameIndexByTimeSync"); timeStamp_ = static_cast(timeUs); @@ -316,10 +316,10 @@ double AVMetadataExtractorImpl::GetFrameIndexByTimeSync(double timeUs) set_business_error(OHOS::Media::MSERR_EXT_API9_UNSUPPORT_FORMAT, "Demuxer getFrameIndexByTime failed."); return -1; } - return static_cast(index_); + return static_cast(index_); } -double AVMetadataExtractorImpl::GetTimeByFrameIndexSync(double index) +double AVMetadataExtractorImpl::GetTimeByFrameIndexSync(int32_t index) { OHOS::Media::MediaTrace trace("AVMetadataExtractorImpl::GetTimeByFrameIndexSync"); if (index < 0) { diff --git a/frameworks/taihe/media/src/avplayer_callback_taihe.cpp b/frameworks/taihe/media/src/avplayer_callback_taihe.cpp index cc40be8dd..10fe8da77 100644 --- a/frameworks/taihe/media/src/avplayer_callback_taihe.cpp +++ b/frameworks/taihe/media/src/avplayer_callback_taihe.cpp @@ -91,8 +91,8 @@ public: "%{public}s AutoRef is nullptr", callbackName.c_str()); auto func = intRef->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); (*cacheCallback)(value); } }; @@ -109,9 +109,9 @@ public: int32_t val = 0; auto func = intVecRef->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> + std::shared_ptr> cacheCallback = std::reinterpret_pointer_cast>(func); + (ohos::multimedia::media::BufferingInfoType, int32_t)>>(func); ohos::multimedia::media::BufferingInfoType::key_t key; MediaTaiheUtils::GetEnumKeyByValue(firstValueAsDouble, key); (*cacheCallback)(ohos::multimedia::media::BufferingInfoType(key), val); @@ -126,17 +126,15 @@ public: CHECK_AND_RETURN_LOG(intVecRef != nullptr, "%{public}s AutoRef is nullptr", callbackName.c_str()); CHECK_AND_RETURN_LOG(valueVec.size() > 1, "valueVec size is less than 2"); - double firstValueAsDouble = static_cast(valueVec[0]); - double secondValueAsDouble = static_cast(valueVec[1]); auto func = intVecRef->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); - (*cacheCallback)(firstValueAsDouble, secondValueAsDouble); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); + (*cacheCallback)(valueVec[0], valueVec[1]); } }; struct IntArray : public Base { - std::vector valueVec; + std::vector valueVec; void UvWork() override { std::shared_ptr intVecRef = callback.lock(); @@ -144,8 +142,8 @@ public: "%{public}s AutoRef is nullptr", callbackName.c_str()); auto func = intVecRef->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr)>> cacheCallback = - std::reinterpret_pointer_cast)>>(func); + std::shared_ptr)>> cacheCallback = + std::reinterpret_pointer_cast)>>(func); (*cacheCallback)(valueVec); } }; @@ -211,8 +209,8 @@ public: CHECK_AND_RETURN_LOG(trackChangeRef != nullptr, "%{public}s AutoRef is nullptr", callbackName.c_str()); auto func = trackChangeRef->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); (*cacheCallback)(number, isSelect); } }; @@ -251,7 +249,7 @@ public: }; struct SeiInfoUpadte : public Base { - double playbackPosition; + int32_t playbackPosition; std::vector payloadGroup; void UvWork() override { @@ -259,9 +257,9 @@ public: CHECK_AND_RETURN_LOG(seiInfoRef != nullptr, "%{public}s AutoRef is nullptr", callbackName.c_str()); auto func = seiInfoRef->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr, optional_view)>> cacheCallback = + std::shared_ptr, optional_view)>> cacheCallback = std::reinterpret_pointer_cast, - optional_view)>>(func); + optional_view)>>(func); std::vector seiMessages; for (const auto& format : payloadGroup) { uint8_t* bufferData = nullptr; @@ -283,7 +281,7 @@ public: seiMessages.push_back(seiMessage); } array_view seiMessageView(seiMessages); - (*cacheCallback)(seiMessageView, optional_view(&playbackPosition)); + (*cacheCallback)(seiMessageView, optional_view(&playbackPosition)); } }; @@ -323,8 +321,8 @@ public: (::ohos::multimedia::media::SubtitleInfo const&)>>(func); ::ohos::multimedia::media::SubtitleInfo subtitleInfo; subtitleInfo.text = ::taihe::optional(std::in_place_t{}, valueMap.text); - subtitleInfo.startTime = taihe::optional(std::in_place_t{}, valueMap.pts); - subtitleInfo.duration = taihe::optional(std::in_place_t{}, valueMap.duration); + subtitleInfo.startTime = taihe::optional(std::in_place_t{}, valueMap.pts); + subtitleInfo.duration = taihe::optional(std::in_place_t{}, valueMap.duration); (*cacheCallback)(subtitleInfo); } }; @@ -709,7 +707,7 @@ void AVPlayerCallback::OnBitRateCollectedCb(const int32_t extra, const Format &i return; } - std::vector bitrateVec; + std::vector bitrateVec; if (infoBody.ContainKey(std::string(PlayerKeys::PLAYER_AVAILABLE_BITRATES))) { uint8_t *addr = nullptr; size_t size = 0; @@ -726,7 +724,7 @@ void AVPlayerCallback::OnBitRateCollectedCb(const int32_t extra, const Format &i MEDIA_LOGI("bitrate = %{public}u", bitrate); addr += sizeof(uint32_t); size -= sizeof(uint32_t); - bitrateVec.push_back(static_cast(bitrate)); + bitrateVec.push_back(static_cast(bitrate)); } } diff --git a/frameworks/taihe/media/src/avplayer_taihe.cpp b/frameworks/taihe/media/src/avplayer_taihe.cpp index f741e9758..d7c4a7db4 100644 --- a/frameworks/taihe/media/src/avplayer_taihe.cpp +++ b/frameworks/taihe/media/src/avplayer_taihe.cpp @@ -29,7 +29,7 @@ #endif using namespace ANI::Media; -using DataSrcCallback = taihe::callback, double, taihe::optional_view)>; +using DataSrcCallback = taihe::callback, int64_t, taihe::optional_view)>; namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_METADATA, "AVPlayerTaihe"}; @@ -109,7 +109,7 @@ void AVPlayerImpl::SetUrl(optional_view url) MEDIA_LOGI("0x%{public}06" PRIXPTR " SetUrl Out", FAKE_POINTER(this)); } -double AVPlayerImpl::GetWidth() +int32_t AVPlayerImpl::GetWidth() { MediaTrace trace("AVPlayerImpl::get width"); MEDIA_LOGI("TaiheGetWidth"); @@ -122,7 +122,7 @@ double AVPlayerImpl::GetWidth() return width; } -double AVPlayerImpl::GetHeight() +int32_t AVPlayerImpl::GetHeight() { MediaTrace trace("AVPlayerImpl::get height"); MEDIA_LOGI("TaiheGetHeight"); @@ -147,7 +147,7 @@ string AVPlayerImpl::GetState() return curState; } -double AVPlayerImpl::GetDuration() +int32_t AVPlayerImpl::GetDuration() { MediaTrace trace("AVPlayerImpl::get duration"); MEDIA_LOGD("TaiheGetDuration In"); @@ -162,7 +162,7 @@ double AVPlayerImpl::GetDuration() return duration; } -double AVPlayerImpl::GetCurrentTime() +int32_t AVPlayerImpl::GetCurrentTime() { MediaTrace trace("AVPlayerImpl::get currentTime"); MEDIA_LOGD("TaiheGetCurrentTime In"); @@ -423,8 +423,8 @@ optional AVPlayerImpl::GetFdSrc() ohos::multimedia::media::AVFileDescriptor fdSrc; fdSrc.fd = fileDescriptor_.fd; - fdSrc.offset = optional(std::in_place_t{}, fileDescriptor_.offset); - fdSrc.length = optional(std::in_place_t{}, fileDescriptor_.length); + fdSrc.offset = optional(std::in_place_t{}, fileDescriptor_.offset); + fdSrc.length = optional(std::in_place_t{}, fileDescriptor_.length); MEDIA_LOGI("TaiheGetAVFileDescriptor Out"); return optional(std::in_place_t{}, fdSrc); } @@ -547,7 +547,7 @@ void AVPlayerImpl::SeekEnqueueTask(AVPlayerImpl *taihePlayer, int32_t time, int3 MEDIA_LOGI("0x%{public}06" PRIXPTR " TaiheSeek Out", FAKE_POINTER(taihePlayer)); } -void AVPlayerImpl::Seek(double timeMs, optional_view mode) +void AVPlayerImpl::Seek(int32_t timeMs, optional_view mode) { MediaTrace trace("AVPlayerImpl::seek"); MEDIA_LOGI("TaiheSeek in"); @@ -795,9 +795,11 @@ void AVPlayerImpl::GetPlayStrategy(AVPlayStrategyTmp &playStrategy, PlaybackStra } if (strategy.preferredBufferDurationForPlaying.has_value()) { playStrategy.preferredBufferDurationForPlaying = strategy.preferredBufferDurationForPlaying.value(); + playStrategy.isSetBufferDurationForPlaying = true; } if (strategy.thresholdForAutoQuickPlay.has_value()) { playStrategy.thresholdForAutoQuickPlay = strategy.thresholdForAutoQuickPlay.value(); + playStrategy.isSetThresholdForAutoQuickPlay = true; } } @@ -848,7 +850,7 @@ void AVPlayerImpl::SetMediaSourceSync(weak::MediaSource src, optional_view offset, optional_view length) +void AVPlayerImpl::AddSubtitleFromFdSync(int32_t fd, optional_view offset, optional_view length) { MEDIA_LOGI("AddSubtitleAVFileDescriptor In"); int64_t offsetLocal = -1; @@ -935,7 +937,7 @@ map AVPlayerImpl::GetPlaybackInfoSync() return MediaTaiheUtils::CreateFormatBufferByRef(playbackInfo); } -void AVPlayerImpl::DeselectTrackSync(double index) +void AVPlayerImpl::DeselectTrackSync(int32_t index) { MediaTrace trace("AVPlayerImpl::deselectTrack"); MEDIA_LOGI("deselectTrack In"); @@ -959,7 +961,7 @@ void AVPlayerImpl::DeselectTrackSync(double index) MEDIA_LOGI("deselectTrack Out"); } -void AVPlayerImpl::SelectTrackSync(double index, optional_view mode) +void AVPlayerImpl::SelectTrackSync(int32_t index, optional_view mode) { MediaTrace trace("AVPlayerImpl::selectTrack"); MEDIA_LOGI("SelectTrack In"); @@ -1024,7 +1026,7 @@ PlayerSwitchMode AVPlayerImpl::TransferSwitchMode(int32_t mode) return switchMode; } -array AVPlayerImpl::GetSelectedTracksSync() +array AVPlayerImpl::GetSelectedTracksSync() { MediaTrace trace("AVPlayerImpl::get selected tracks"); MEDIA_LOGI("TaiheGetSelectedTracks In"); @@ -1052,10 +1054,10 @@ array AVPlayerImpl::GetSelectedTracksSync() "current state unsupport get current selections"); } MEDIA_LOGI("TaiheGetSelectedTracks Out"); - return array(copy_data_t{}, trackIndex.data(), trackIndex.size()); + return array(copy_data_t{}, trackIndex.data(), trackIndex.size()); } -void AVPlayerImpl::SetVideoWindowSizeSync(double width, double height) +void AVPlayerImpl::SetVideoWindowSizeSync(int32_t width, int32_t height) { MediaTrace trace("AVPlayerImpl::setVideoWindowSize"); MEDIA_LOGI("TaiheSetVideoWindowSize In"); @@ -1142,7 +1144,7 @@ std::shared_ptr> AVPlayerImpl::SetSuperResolutionTask(bool return task; } -double AVPlayerImpl::GetPlaybackPosition() +int32_t AVPlayerImpl::GetPlaybackPosition() { MediaTrace trace("AVPlayerImpl::get playbackPosition"); MEDIA_LOGD("getPlaybackPosition In"); @@ -1165,7 +1167,7 @@ double AVPlayerImpl::GetPlaybackPosition() return playbackPosition; } -void AVPlayerImpl::SetBitrate(double bitrate) +void AVPlayerImpl::SetBitrate(int32_t bitrate) { MediaTrace trace("AVPlayerImpl::setBitrate"); MEDIA_LOGI("SelectBitrate In"); @@ -1190,7 +1192,7 @@ void AVPlayerImpl::SetBitrate(double bitrate) MEDIA_LOGI("0x%{public}06" PRIXPTR " SelectBitrate Out", FAKE_POINTER(this)); } -void AVPlayerImpl::SetPlaybackRangeSync(double startTimeMs, double endTimeMs, +void AVPlayerImpl::SetPlaybackRangeSync(int32_t startTimeMs, int32_t endTimeMs, optional_view<::ohos::multimedia::media::SeekMode> mode) { MediaTrace trace("AVPlayerImpl::setPlaybackRange"); @@ -1850,7 +1852,7 @@ void AVPlayerImpl::OnStartRenderFrame(callback_view callback) return; } -void AVPlayerImpl::OnSeekDone(callback_view callback) +void AVPlayerImpl::OnSeekDone(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnSeekDone"); MEDIA_LOGD("TaiheOnSeekDone In"); @@ -1860,8 +1862,8 @@ void AVPlayerImpl::OnSeekDone(callback_view callback) return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_SEEK_DONE, autoRef); @@ -1869,7 +1871,7 @@ void AVPlayerImpl::OnSeekDone(callback_view callback) return; } -void AVPlayerImpl::OnDurationUpdate(callback_view callback) +void AVPlayerImpl::OnDurationUpdate(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnDurationUpdate"); MEDIA_LOGD("TaiheOnDurationUpdate In"); @@ -1879,8 +1881,8 @@ void AVPlayerImpl::OnDurationUpdate(callback_view callback) return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_DURATION_UPDATE, autoRef); @@ -1889,7 +1891,7 @@ void AVPlayerImpl::OnDurationUpdate(callback_view callback) return; } -void AVPlayerImpl::OnTimeUpdate(callback_view callback) +void AVPlayerImpl::OnTimeUpdate(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnTimeUpdate"); MEDIA_LOGD("TaiheOnTimeUpdate In"); @@ -1899,8 +1901,8 @@ void AVPlayerImpl::OnTimeUpdate(callback_view callback) return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_TIME_UPDATE, autoRef); @@ -1927,7 +1929,7 @@ void AVPlayerImpl::OnVolumeChange(callback_view callback) return; } -void AVPlayerImpl::OnSpeedDone(callback_view callback) +void AVPlayerImpl::OnSpeedDone(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnSpeedDone"); MEDIA_LOGD("TaiheOnSpeedDone In"); @@ -1937,8 +1939,8 @@ void AVPlayerImpl::OnSpeedDone(callback_view callback) return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_SPEED_DONE, autoRef); @@ -1946,7 +1948,7 @@ void AVPlayerImpl::OnSpeedDone(callback_view callback) return; } -void AVPlayerImpl::OnBitrateDone(callback_view callback) +void AVPlayerImpl::OnBitrateDone(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnBitrateDone"); MEDIA_LOGD("TaiheOnBitrateDone In"); @@ -1956,8 +1958,8 @@ void AVPlayerImpl::OnBitrateDone(callback_view callback) return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_BITRATE_DONE, autoRef); @@ -1965,7 +1967,7 @@ void AVPlayerImpl::OnBitrateDone(callback_view callback) return; } -void AVPlayerImpl::OnAvailableBitrates(callback_view)> callback) +void AVPlayerImpl::OnAvailableBitrates(callback_view)> callback) { MediaTrace trace("AVPlayerImpl::OnBitrateDone"); MEDIA_LOGD("TaiheOnBitrateDone In"); @@ -1975,8 +1977,8 @@ void AVPlayerImpl::OnAvailableBitrates(callback_view)> c return; } ani_env *env = taihe::get_env(); - std::shared_ptr)>> taiheCallback = - std::make_shared)>>(callback); + std::shared_ptr)>> taiheCallback = + std::make_shared)>>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_AVAILABLE_BITRATES, autoRef); @@ -2004,14 +2006,18 @@ void AVPlayerImpl::OnAmplitudeUpdate(callback_view)> cal return; } -void AVPlayerImpl::OnBufferingUpdate(callback_view callback) +void AVPlayerImpl::OnBufferingUpdate(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnBufferingUpdate"); MEDIA_LOGD("TaiheOnBufferingUpdate In"); + if (GetCurrentState() == AVPlayerState::STATE_RELEASED) { + OnErrorCb(MSERR_EXT_API9_OPERATE_NOT_PERMIT, "current state is released, unsupport to on event"); + return; + } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_BUFFERING_UPDATE, autoRef); @@ -2020,7 +2026,7 @@ void AVPlayerImpl::OnBufferingUpdate(callback_view callback) +void AVPlayerImpl::OnVideoSizeChange(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnVideoSizeChange"); MEDIA_LOGD("TaiheOnVideoSizeChange In"); @@ -2030,8 +2036,8 @@ void AVPlayerImpl::OnVideoSizeChange(callback_view callbac return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_VIDEO_SIZE_CHANGE, autoRef); @@ -2040,7 +2046,7 @@ void AVPlayerImpl::OnVideoSizeChange(callback_view callbac return; } -void AVPlayerImpl::OnTrackChange(callback_view callback) +void AVPlayerImpl::OnTrackChange(callback_view callback) { MediaTrace trace("AVPlayerImpl::OnTrackChange"); MEDIA_LOGD("TaiheOnTrackChange In"); @@ -2050,8 +2056,8 @@ void AVPlayerImpl::OnTrackChange(callback_view callback) return; } ani_env *env = taihe::get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_TRACKCHANGE, autoRef); @@ -2064,6 +2070,10 @@ void AVPlayerImpl::OnSubtitleUpdate(callback_view> taiheCallback = std::make_shared>(callback); @@ -2116,8 +2126,8 @@ void AVPlayerImpl::OnTrackInfoUpdate(callback_view payloadTypes, - callback_view, optional_view)> callback) +void AVPlayerImpl::OnSeiMessageReceived(array_view payloadTypes, + callback_view, optional_view)> callback) { MediaTrace trace("AVPlayerImpl::OnSeiMessageReceived"); MEDIA_LOGD("TaiheOnSeiMessageReceived In"); @@ -2138,8 +2148,8 @@ void AVPlayerImpl::OnSeiMessageReceived(array_view payloadTypes, player_->SetSeiMessageCbStatus(seiMessageCallbackflag_, payloadTypesInt); } ani_env *env = taihe::get_env(); - std::shared_ptr, optional_view)>> taiheCallback = - std::make_shared, optional_view)>>(callback); + std::shared_ptr, optional_view)>> taiheCallback = + std::make_shared, optional_view)>>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); SaveCallbackReference(AVPlayerEvent::EVENT_SEI_MESSAGE_INFO, autoRef); @@ -2221,7 +2231,7 @@ void AVPlayerImpl::OffStartRenderFrame(optional_view> ClearCallbackReference(callbackName); MEDIA_LOGI("OffStartRenderFrame End"); } -void AVPlayerImpl::OffSeekDone(optional_view> callback) +void AVPlayerImpl::OffSeekDone(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffSeekDone"); MEDIA_LOGD("OffSeekDone In"); @@ -2235,7 +2245,7 @@ void AVPlayerImpl::OffSeekDone(optional_view> callback) ClearCallbackReference(callbackName); MEDIA_LOGI("OffSeekDone End"); } -void AVPlayerImpl::OffDurationUpdate(optional_view> callback) +void AVPlayerImpl::OffDurationUpdate(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffDurationUpdate"); MEDIA_LOGD("OffDurationUpdate In"); @@ -2249,7 +2259,7 @@ void AVPlayerImpl::OffDurationUpdate(optional_view> callb ClearCallbackReference(callbackName); MEDIA_LOGI("OffDurationUpdate End"); } -void AVPlayerImpl::OffTimeUpdate(optional_view> callback) +void AVPlayerImpl::OffTimeUpdate(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffTimeUpdate"); MEDIA_LOGD("OffTimeUpdate In"); @@ -2277,7 +2287,7 @@ void AVPlayerImpl::OffVolumeChange(optional_view> callbac ClearCallbackReference(callbackName); MEDIA_LOGI("OffVolumeChange End"); } -void AVPlayerImpl::OffSpeedDone(optional_view> callback) +void AVPlayerImpl::OffSpeedDone(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffSpeedDone"); MEDIA_LOGD("OffSpeedDone In"); @@ -2291,7 +2301,7 @@ void AVPlayerImpl::OffSpeedDone(optional_view> callback) ClearCallbackReference(callbackName); MEDIA_LOGI("OffSpeedDone End"); } -void AVPlayerImpl::OffBitrateDone(optional_view> callback) +void AVPlayerImpl::OffBitrateDone(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffBitrateDone"); MEDIA_LOGD("OffBitrateDone In"); @@ -2305,7 +2315,7 @@ void AVPlayerImpl::OffBitrateDone(optional_view> callback ClearCallbackReference(callbackName); MEDIA_LOGI("OffBitrateDone End"); } -void AVPlayerImpl::OffAvailableBitrates(optional_view)>> callback) +void AVPlayerImpl::OffAvailableBitrates(optional_view)>> callback) { MediaTrace trace("AVPlayerImpl::OffAvailableBitrates"); MEDIA_LOGD("OffAvailableBitrates In"); @@ -2335,7 +2345,7 @@ void AVPlayerImpl::OffAmplitudeUpdate(optional_view> callback) + int32_t)>> callback) { MediaTrace trace("AVPlayerImpl::OffBufferingUpdate"); MEDIA_LOGD("OffBufferingUpdate In"); @@ -2349,7 +2359,7 @@ void AVPlayerImpl::OffBufferingUpdate(optional_view> callback) +void AVPlayerImpl::OffVideoSizeChange(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffVideoSizeChange"); MEDIA_LOGD("OffVideoSizeChange In"); @@ -2364,7 +2374,7 @@ void AVPlayerImpl::OffVideoSizeChange(optional_view> callback) +void AVPlayerImpl::OffTrackChange(optional_view> callback) { MediaTrace trace("AVPlayerImpl::OffTrackChange"); MEDIA_LOGD("OffTrackChange In"); @@ -2408,7 +2418,7 @@ void AVPlayerImpl::OffSuperResolutionChanged(optional_view> ClearCallbackReference(callbackName); MEDIA_LOGI("OffSuperResolutionChanged End"); } -void AVPlayerImpl::OffTrackInfoUpdate(optional_view>)>> callback) +void AVPlayerImpl::OffTrackInfoUpdate(optional_view>)>> callback) { MediaTrace trace("AVPlayerImpl::OffTrackInfoUpdate"); MEDIA_LOGD("OffTrackInfoUpdate In"); @@ -2423,9 +2433,9 @@ void AVPlayerImpl::OffTrackInfoUpdate(optional_view payloadTypes, +void AVPlayerImpl::OffSeiMessageReceived(array_view payloadTypes, optional_view, - optional_view)>> callback) + optional_view)>> callback) { MediaTrace trace("AVPlayerImpl::OffSeiMessageReceived"); MEDIA_LOGD("OffSeiMessageReceived In"); diff --git a/frameworks/taihe/media/src/avrecorder_taihe.cpp b/frameworks/taihe/media/src/avrecorder_taihe.cpp index 3adb69e19..e1b87315b 100644 --- a/frameworks/taihe/media/src/avrecorder_taihe.cpp +++ b/frameworks/taihe/media/src/avrecorder_taihe.cpp @@ -978,7 +978,7 @@ void AVRecorderImpl::SetAVRecorderConfig( optional<::taihe::array<::ohos::multimedia::media::MetaSourceType>>(std::nullopt), optional<::ohos::multimedia::media::FileGenerationMode>(std::nullopt), optional<::ohos::multimedia::media::AVMetadata>(std::nullopt), - optional(std::nullopt), + optional(std::nullopt), }; return config; } @@ -996,20 +996,20 @@ void AVRecorderImpl::SetAVRecorderConfig( MediaTaiheUtils::GetEnumKeyByStringValue( fileFormatValue, containerFormatTypeKey); ::ohos::multimedia::media::AVRecorderProfile aVRecorderProfile { - optional(std::nullopt), optional(std::nullopt), + optional(std::nullopt), optional(std::nullopt), optional<::ohos::multimedia::media::CodecMimeType>(std::nullopt), - optional(std::nullopt), + optional(std::nullopt), containerFormatTypeKey, - optional(std::nullopt), + optional(std::nullopt), optional<::ohos::multimedia::media::CodecMimeType>(std::nullopt), - optional(std::nullopt), optional(std::nullopt), - optional(std::nullopt), optional(std::nullopt), + optional(std::nullopt), optional(std::nullopt), + optional(std::nullopt), optional(std::nullopt), optional(std::nullopt), optional(std::nullopt), }; if (config->withAudio) { - aVRecorderProfile.audioBitrate = optional(std::in_place_t{}, config->profile.audioBitrate); - aVRecorderProfile.audioChannels = optional(std::in_place_t{}, config->profile.audioChannels); - aVRecorderProfile.audioSampleRate = optional(std::in_place_t{}, config->profile.audioSampleRate); + aVRecorderProfile.audioBitrate = optional(std::in_place_t{}, config->profile.audioBitrate); + aVRecorderProfile.audioChannels = optional(std::in_place_t{}, config->profile.audioChannels); + aVRecorderProfile.audioSampleRate = optional(std::in_place_t{}, config->profile.audioSampleRate); std::string audioCodec = ""; SetAudioCodecFormat(config->profile.audioCodecFormat, audioCodec); taihe::string audioValue = MediaTaiheUtils::ToTaiheString(audioCodec); @@ -1019,10 +1019,10 @@ void AVRecorderImpl::SetAVRecorderConfig( optional<::ohos::multimedia::media::CodecMimeType>(std::in_place_t{}, codecMimeTypeKey); } if (config->withVideo) { - aVRecorderProfile.videoBitrate = optional(std::in_place_t{}, config->profile.videoBitrate); - aVRecorderProfile.videoFrameWidth = optional(std::in_place_t{}, config->profile.videoFrameWidth); - aVRecorderProfile.videoFrameHeight = optional(std::in_place_t{}, config->profile.videoFrameHeight); - aVRecorderProfile.videoFrameRate = optional(std::in_place_t{}, config->profile.videoFrameRate); + aVRecorderProfile.videoBitrate = optional(std::in_place_t{}, config->profile.videoBitrate); + aVRecorderProfile.videoFrameWidth = optional(std::in_place_t{}, config->profile.videoFrameWidth); + aVRecorderProfile.videoFrameHeight = optional(std::in_place_t{}, config->profile.videoFrameHeight); + aVRecorderProfile.videoFrameRate = optional(std::in_place_t{}, config->profile.videoFrameRate); std::string videoCodec = ""; SetVideoCodecFormat(config->profile.videoCodecFormat, videoCodec); taihe::string videoValue = MediaTaiheUtils::ToTaiheString(videoCodec); @@ -1044,16 +1044,16 @@ void AVRecorderImpl::SetAVRecorderConfig( MediaTaiheUtils::GetEnumKeyByStringValue( value, containerFormatTypeKey); ::ohos::multimedia::media::AVRecorderProfile aVRecorderProfile { - optional(std::nullopt), - optional(std::nullopt), + optional(std::nullopt), + optional(std::nullopt), optional<::ohos::multimedia::media::CodecMimeType>(std::nullopt), - optional(std::nullopt), + optional(std::nullopt), containerFormatTypeKey, - optional(std::nullopt), + optional(std::nullopt), optional<::ohos::multimedia::media::CodecMimeType>(std::nullopt), - optional(std::nullopt), - optional(std::nullopt), - optional(std::nullopt), + optional(std::nullopt), + optional(std::nullopt), + optional(std::nullopt), optional(std::nullopt), optional(std::nullopt), optional(std::nullopt), @@ -1183,7 +1183,7 @@ void AVRecorderImpl::GetAudioEncoderInfo(EncoderCapabilityData encoderCapData, optional<::ohos::multimedia::media::Range>(std::nullopt), optional<::ohos::multimedia::media::Range>(std::in_place_t{}, GetRange( encoderCapData.channels.minVal, encoderCapData.channels.maxVal)), - optional<::taihe::array>(std::in_place_t{}, array(copy_data_t{}, + optional<::taihe::array>(std::in_place_t{}, array(copy_data_t{}, encoderCapData.sampleRate.data(), encoderCapData.sampleRate.size())), }; TaiheEncoderInfos.push_back(TaiheEncoderInfo); @@ -1208,7 +1208,7 @@ void AVRecorderImpl::GetVideoEncoderInfo(EncoderCapabilityData encoderCapData, optional<::ohos::multimedia::media::Range>(std::in_place_t{}, GetRange( encoderCapData.height.minVal, encoderCapData.height.maxVal)), optional<::ohos::multimedia::media::Range>(std::nullopt), - optional<::taihe::array>(std::nullopt), + optional<::taihe::array>(std::nullopt), }; TaiheEncoderInfos.push_back(TaiheEncoderInfo); } @@ -1415,7 +1415,7 @@ int32_t AVRecorderImpl::IsWatermarkSupported(bool &isWatermarkSupported) return recorder_->IsWatermarkSupported(isWatermarkSupported); } -void AVRecorderImpl::UpdateRotationSync(double rotation) +void AVRecorderImpl::UpdateRotationSync(int32_t rotation) { MediaTrace trace("AVRecorder::UpdateRotationSync"); const std::string &opt = AVRecordergOpt::SET_ORIENTATION_HINT; @@ -1486,7 +1486,7 @@ std::shared_ptr> AVRecorderImpl::GetSetOrientationHintTask( }); } -double AVRecorderImpl::GetAudioCapturerMaxAmplitudeSync() +int32_t AVRecorderImpl::GetAudioCapturerMaxAmplitudeSync() { MediaTrace trace("AVRecorder::GetAudioCapturerMaxAmplitudeSync"); const std::string &opt = AVRecordergOpt::GET_MAX_AMPLITUDE; diff --git a/frameworks/taihe/media/src/avscreen_capture_taihe.cpp b/frameworks/taihe/media/src/avscreen_capture_taihe.cpp index 751100f56..ad2526422 100644 --- a/frameworks/taihe/media/src/avscreen_capture_taihe.cpp +++ b/frameworks/taihe/media/src/avscreen_capture_taihe.cpp @@ -68,12 +68,12 @@ optional CreateAVScreenCaptureRecorderSync() return optional(std::in_place, res); } -void ReportAVScreenCaptureUserChoiceSync(double sessionId, string_view choice) +void ReportAVScreenCaptureUserChoiceSync(int32_t sessionId, string_view choice) { MediaTrace trace("AVScreenCapture::TaiheReportAVScreenCaptureUserChoice"); const std::string &opt = AVScreenCapturegOpt::REPORT_USER_CHOICE; MEDIA_LOGI("Taihe %{public}s Start", opt.c_str()); - MEDIA_LOGI("TaiheReportAVScreenCaptureUserChoice sessionId: %{public}f, choice: %{public}s", + MEDIA_LOGI("TaiheReportAVScreenCaptureUserChoice sessionId: %{public}d, choice: %{public}s", sessionId, static_cast(choice).c_str()); auto asyncCtx = std::make_unique(); CHECK_AND_RETURN_LOG(asyncCtx != nullptr, "failed to get AsyncContext"); @@ -450,7 +450,7 @@ std::shared_ptr> AVScreenCaptureRecorderImpl::GetSkipPrivac }); } -void AVScreenCaptureRecorderImpl::SkipPrivacyModeSync(::taihe::array_view windowIDs) +void AVScreenCaptureRecorderImpl::SkipPrivacyModeSync(::taihe::array_view windowIDs) { MediaTrace trace("AVScreenCapture::TaiheSkipPrivacyMode"); const std::string &option = AVScreenCapturegOpt::SKIP_PRIVACY_MODE; diff --git a/frameworks/taihe/media/src/avtranscoder_callback_taihe.cpp b/frameworks/taihe/media/src/avtranscoder_callback_taihe.cpp index aeb1e0253..14d7bd060 100644 --- a/frameworks/taihe/media/src/avtranscoder_callback_taihe.cpp +++ b/frameworks/taihe/media/src/avtranscoder_callback_taihe.cpp @@ -165,9 +165,9 @@ void AVTransCoderCallback::OnTaiheProgressUpdateCallback(AVTransCoderTaiheCallba auto func = ref->callbackRef_; CHECK_AND_BREAK_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); - (*cacheCallback)(static_cast(taiheCb->progress)); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); + (*cacheCallback)(static_cast(taiheCb->progress)); } while (0); delete taiheCb; } diff --git a/frameworks/taihe/media/src/avtranscoder_taihe.cpp b/frameworks/taihe/media/src/avtranscoder_taihe.cpp index 89cc25eeb..14a0b74f6 100644 --- a/frameworks/taihe/media/src/avtranscoder_taihe.cpp +++ b/frameworks/taihe/media/src/avtranscoder_taihe.cpp @@ -179,14 +179,14 @@ RetInfo AVTranscoderImpl::SetOutputFile(int32_t fd) return RetInfo(MSERR_EXT_API9_OK, ""); } -double AVTranscoderImpl::GetFdDst() +int32_t AVTranscoderImpl::GetFdDst() { MediaTrace trace("AVTranscoderImpl::get url"); MEDIA_LOGD("TaiheGetUrl Out Current Url: %{public}s", srcUrl_.c_str()); return dstFd_; } -void AVTranscoderImpl::SetFdDst(double fdDst) +void AVTranscoderImpl::SetFdDst(int32_t fdDst) { MediaTrace trace("AVTranscoderImpl::set fd"); auto asyncCtx = std::make_unique(); @@ -215,8 +215,8 @@ ohos::multimedia::media::AVFileDescriptor AVTranscoderImpl::GetFdSrc() MediaTrace trace("AVTranscoderImpl::get url"); ohos::multimedia::media::AVFileDescriptor fdSrc; fdSrc.fd = srcFd_.fd; - fdSrc.offset = optional(std::in_place_t{}, srcFd_.offset); - fdSrc.length = optional(std::in_place_t{}, srcFd_.length); + fdSrc.offset = optional(std::in_place_t{}, srcFd_.offset); + fdSrc.length = optional(std::in_place_t{}, srcFd_.length); MEDIA_LOGD("TaiheGetUrl Out Current Url: %{public}s", srcUrl_.c_str()); return fdSrc; } @@ -510,15 +510,15 @@ void AVTranscoderImpl::OffComplete(optional_view> call MEDIA_LOGI("OffComplete End"); } -void AVTranscoderImpl::OnProgressUpdate(callback_view callback) +void AVTranscoderImpl::OnProgressUpdate(callback_view callback) { MediaTrace trace("AVTranscoderImpl::OnProgressUpdate"); MEDIA_LOGI("OnProgressUpdate Start"); std::string callbackName = STATE_PROGRESSUPDATE; ani_env *env = get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); @@ -526,7 +526,7 @@ void AVTranscoderImpl::OnProgressUpdate(callback_view callback) MEDIA_LOGI("OnProgressUpdate End"); } -void AVTranscoderImpl::OffProgressUpdate(optional_view> callback) +void AVTranscoderImpl::OffProgressUpdate(optional_view> callback) { MediaTrace trace("AVTranscoderImpl::OffProgressUpdate"); MEDIA_LOGI("OffProgressUpdate Start"); diff --git a/frameworks/taihe/media/src/helper_data_source_callback_taihe.cpp b/frameworks/taihe/media/src/helper_data_source_callback_taihe.cpp index dc1fb5395..c5ba5a090 100644 --- a/frameworks/taihe/media/src/helper_data_source_callback_taihe.cpp +++ b/frameworks/taihe/media/src/helper_data_source_callback_taihe.cpp @@ -117,12 +117,11 @@ void HelperDataSourceCallback::UvWork(HelperDataSourceTHCallbackWraper *cbWrap, auto func = ref->callbackRef_; CHECK_AND_BREAK_LOG(func != nullptr, "failed to get callback"); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(func); - taihe::optional_view posOption = taihe::optional_view(std::nullopt); + taihe::optional_view posOption = taihe::optional_view(std::nullopt); if (event->pos_ != -1) { - double pos = static_cast(event->pos_); - posOption = taihe::optional_view(&pos); + posOption = taihe::optional_view(&event->pos_); } - event->readSize_ = (*cacheCallback)(dataVector, static_cast(event->length_), posOption); + event->readSize_ = (*cacheCallback)(dataVector, static_cast(event->length_), posOption); std::unique_lock lock(event->mutexCond_); event->setResult_ = true; event->cond_.notify_all(); diff --git a/frameworks/taihe/media/src/media_source_loader_callback_taihe.cpp b/frameworks/taihe/media/src/media_source_loader_callback_taihe.cpp index 8bf0c7919..a03ee890b 100644 --- a/frameworks/taihe/media/src/media_source_loader_callback_taihe.cpp +++ b/frameworks/taihe/media/src/media_source_loader_callback_taihe.cpp @@ -87,12 +87,11 @@ int64_t MediaSourceLoaderCallback::Open(std::shared_ptr &request CHECK_AND_BREAK_LOG(ref != nullptr, "%{public}s AutoRef is nullptr", taiheCb_->callbackName_.c_str()); auto func = ref->callbackRef_; CHECK_AND_BREAK_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast> + (func); taiheCb_->uuid_ = (*cacheCallback)(static_cast< - ::ohos::multimedia::media::weak::MediaSourceLoadingRequest>( + ohos::multimedia::media::weak::MediaSourceLoadingRequest>( MediaSourceLoadingRequestImpl::CreateLoadingRequest(taiheCb_->request_))); std::unique_lock lock(taiheCb_->mutexCond_); taiheCb_->setResult_ = true; @@ -130,10 +129,9 @@ void MediaSourceLoaderCallback::Read(int64_t uuid, int64_t requestedOffset, int6 CHECK_AND_RETURN_LOG(ref != nullptr, "%{public}s AutoRef is nullptr", taiheCb_->callbackName_.c_str()); auto func = ref->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); - (*cacheCallback)(static_cast(taiheCb_->uuid_), static_cast(taiheCb_->requestedOffset_), - static_cast(taiheCb_->requestedLength_)); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); + (*cacheCallback)(taiheCb_->uuid_, taiheCb_->requestedOffset_, taiheCb_->requestedLength_); } while (0); } @@ -161,9 +159,9 @@ void MediaSourceLoaderCallback::Close(int64_t uuid) CHECK_AND_RETURN_LOG(ref != nullptr, "%{public}s AutoRef is nullptr", taiheCb_->callbackName_.c_str()); auto func = ref->callbackRef_; CHECK_AND_RETURN_LOG(func != nullptr, "failed to get callback"); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); - (*cacheCallback)(static_cast(taiheCb_->uuid_)); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); + (*cacheCallback)(taiheCb_->uuid_); } while (0); } diff --git a/frameworks/taihe/media/src/media_source_loading_request_taihe.cpp b/frameworks/taihe/media/src/media_source_loading_request_taihe.cpp index d65e77c47..3092b4ada 100644 --- a/frameworks/taihe/media/src/media_source_loading_request_taihe.cpp +++ b/frameworks/taihe/media/src/media_source_loading_request_taihe.cpp @@ -58,7 +58,7 @@ optional> MediaSourceLoadingRequestImpl::GetHeader() return optional>(std::in_place_t{}, taiheHeader); } -optional MediaSourceLoadingRequestImpl::RespondData(double uuid, double offset, array_view buffer) +optional MediaSourceLoadingRequestImpl::RespondData(double uuid, double offset, array_view buffer) { MediaTrace trace("MediaSourceLoadingRequestTaihe::respondData"); MEDIA_LOGI("respondData In"); @@ -67,12 +67,12 @@ optional MediaSourceLoadingRequestImpl::RespondData(double uuid, double auto bufferInner = std::make_shared(static_cast(arrayBufferSize), AVSharedMemory::FLAGS_READ_WRITE, "userBuffer"); - CHECK_AND_RETURN_RET_LOG(bufferInner != nullptr, optional(std::nullopt), "get buffer fail"); + CHECK_AND_RETURN_RET_LOG(bufferInner != nullptr, optional(std::nullopt), "get buffer fail"); bufferInner->Init(); bufferInner->Write(static_cast(arrayBuffer), arrayBufferSize); MEDIA_LOGI("respondData getSize: %{public}d", bufferInner->GetSize()); - double res = request_->RespondData(uuid, offset, bufferInner); - return optional(std::in_place_t{}, res); + int32_t res = request_->RespondData(uuid, offset, bufferInner); + return optional(std::in_place_t{}, res); } void MediaSourceLoadingRequestImpl::RespondHeader(double uuid, optional_view> header, diff --git a/frameworks/taihe/media/src/media_source_taihe.cpp b/frameworks/taihe/media/src/media_source_taihe.cpp index 9f88863b1..e3b92aec5 100644 --- a/frameworks/taihe/media/src/media_source_taihe.cpp +++ b/frameworks/taihe/media/src/media_source_taihe.cpp @@ -160,22 +160,22 @@ void MediaSourceImpl::SetMediaResourceLoaderDelegate(::ohos::multimedia::media:: mediaSourceLoaderCb_ = std::make_shared(); CHECK_AND_RETURN_LOG(mediaSourceLoaderCb_ != nullptr, "Cb_ is nullptr"); ani_env *env = get_env(); - std::shared_ptr> + std::shared_ptr> taiheCallbackOpen = std::make_shared>(resourceLoader.open); + int64_t(ohos::multimedia::media::weak::MediaSourceLoadingRequest)>>(resourceLoader.open); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallbackOpen); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); mediaSourceLoaderCb_->SaveCallbackReference(FunctionName::SOURCE_OPEN, autoRef); - std::shared_ptr> taiheCallbackRead = - std::make_shared>(resourceLoader.read); + std::shared_ptr> taiheCallbackRead = + std::make_shared>(resourceLoader.read); cacheCallback = std::reinterpret_pointer_cast(taiheCallbackRead); autoRef = std::make_shared(env, cacheCallback); mediaSourceLoaderCb_->SaveCallbackReference(FunctionName::SOURCE_READ, autoRef); - std::shared_ptr> taiheCallbackClose = - std::make_shared>(resourceLoader.close); + std::shared_ptr> taiheCallbackClose = + std::make_shared>(resourceLoader.close); cacheCallback = std::reinterpret_pointer_cast(taiheCallbackClose); autoRef = std::make_shared(env, cacheCallback); mediaSourceLoaderCb_->SaveCallbackReference(FunctionName::SOURCE_CLOSE, autoRef); diff --git a/frameworks/taihe/soundpool/include/sound_pool_taihe.h b/frameworks/taihe/soundpool/include/sound_pool_taihe.h index e19fcd0e5..7d583b98c 100644 --- a/frameworks/taihe/soundpool/include/sound_pool_taihe.h +++ b/frameworks/taihe/soundpool/include/sound_pool_taihe.h @@ -35,24 +35,24 @@ class SoundPoolImpl { public: SoundPoolImpl(int32_t maxStreams, uintptr_t audioRendererInfo); - double LoadSync(string_view uri); - double LoadWithFdSync(double fd, double offset, double length); - double PlaySync(double soundID, optional_view params); - double PlayWithoutParam(double soundID); - double PlayWithParam(double soundID, PlayParameters const& params); - void StopSync(double streamID); - void UnloadSync(double soundID); + int32_t LoadSync(string_view uri); + int32_t LoadWithFdSync(int32_t fd, double offset, double length); + int32_t PlaySync(int32_t soundID, optional_view params); + int32_t PlayWithoutParam(int32_t soundID); + int32_t PlayWithParam(int32_t soundID, PlayParameters const& params); + void StopSync(int32_t streamID); + void UnloadSync(int32_t soundID); void ReleaseSync(); - void SetLoopSync(double streamID, double loop); - void SetPrioritySync(double streamID, double priority); - void SetVolumeSync(double streamID, double leftVolume, double rightVolume); + void SetLoopSync(int32_t streamID, int32_t loop); + void SetPrioritySync(int32_t streamID, int32_t priority); + void SetVolumeSync(int32_t streamID, double leftVolume, double rightVolume); void OnError(callback_view callback); void OffError(); - void OnPlayFinishedWithStreamId(callback_view callback); + void OnPlayFinishedWithStreamId(callback_view callback); void OffPlayFinishedWithStreamId(); - void OnLoadComplete(callback_view callback); + void OnLoadComplete(callback_view callback); void OffLoadComplete(); void OnPlayFinished(callback_view callback); diff --git a/frameworks/taihe/soundpool/src/sound_pool_callback_taihe.cpp b/frameworks/taihe/soundpool/src/sound_pool_callback_taihe.cpp index 248d4fa92..c0a36c9c3 100644 --- a/frameworks/taihe/soundpool/src/sound_pool_callback_taihe.cpp +++ b/frameworks/taihe/soundpool/src/sound_pool_callback_taihe.cpp @@ -227,8 +227,8 @@ void SoundPoolCallBackTaihe::OnTaiheloadCompletedCallBack(SoundPoolTaiheCallBack CHECK_AND_BREAK_LOG(ref != nullptr, "%{public}s AutoRef is nullptr", request.c_str()); auto func = ref->callbackRef_; CHECK_AND_BREAK_LOG(func != nullptr, "%{public}s failed to get callback", request.c_str()); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); (*cacheCallback)(taiheCb->loadSoundId); } while (0); delete taiheCb; @@ -244,8 +244,8 @@ void SoundPoolCallBackTaihe::OnTaiheplayCompletedCallBack(SoundPoolTaiheCallBack CHECK_AND_BREAK_LOG(ref != nullptr, "%{public}s AutoRef is nullptr", request.c_str()); auto func = ref->callbackRef_; CHECK_AND_BREAK_LOG(func != nullptr, "%{public}s failed to get callback", request.c_str()); - std::shared_ptr> cacheCallback = - std::reinterpret_pointer_cast>(func); + std::shared_ptr> cacheCallback = + std::reinterpret_pointer_cast>(func); (*cacheCallback)(taiheCb->playFinishedStreamID); } else if (request == SoundPoolEvent::EVENT_PLAY_FINISHED) { MEDIA_LOGD("OnTaiheloadCompletedCallBack is called"); diff --git a/frameworks/taihe/soundpool/src/sound_pool_taihe.cpp b/frameworks/taihe/soundpool/src/sound_pool_taihe.cpp index fd6fa55da..c8360736e 100644 --- a/frameworks/taihe/soundpool/src/sound_pool_taihe.cpp +++ b/frameworks/taihe/soundpool/src/sound_pool_taihe.cpp @@ -104,7 +104,7 @@ optional CreateSoundPoolSync(double maxStreams, uintptr_t audioRender return optional(std::in_place, res); } -double SoundPoolImpl::PlaySync(double soundID, optional_view params) +int32_t SoundPoolImpl::PlaySync(int32_t soundID, optional_view params) { MediaTrace trace("SoundPool::TaihePlay"); MEDIA_LOGI("SoundPoolTaihe::TaihePlay"); @@ -125,7 +125,7 @@ double SoundPoolImpl::PlaySync(double soundID, optional_view par return streamId; } -double SoundPoolImpl::PlayWithoutParam(double soundID) +int32_t SoundPoolImpl::PlayWithoutParam(int32_t soundID) { MediaTrace trace("SoundPool::TaihePlayWithoutParam"); MEDIA_LOGI("SoundPoolTaihe::TaihePlayWithoutParam"); @@ -145,7 +145,7 @@ double SoundPoolImpl::PlayWithoutParam(double soundID) return streamId; } -double SoundPoolImpl::PlayWithParam(double soundID, PlayParameters const& params) +int32_t SoundPoolImpl::PlayWithParam(int32_t soundID, PlayParameters const& params) { MediaTrace trace("SoundPool::TaihePlayWithParam"); MEDIA_LOGI("SoundPoolTaihe::TaihePlayWithParam"); @@ -205,7 +205,7 @@ int32_t SoundPoolImpl::ParserPlayOption(const PlayParameters ¶ms) return MSERR_OK; } -double SoundPoolImpl::LoadSync(string_view uri) +int32_t SoundPoolImpl::LoadSync(string_view uri) { MediaTrace trace("SoundPool::TaiheLoad"); MEDIA_LOGI("SoundPoolNapi::TaiheLoad"); @@ -220,7 +220,7 @@ double SoundPoolImpl::LoadSync(string_view uri) return soundId; } -double SoundPoolImpl::LoadWithFdSync(double fd, double offset, double length) +int32_t SoundPoolImpl::LoadWithFdSync(int32_t fd, double offset, double length) { MediaTrace trace("SoundPool::TaiheLoad"); MEDIA_LOGI("SoundPoolNapi::TaiheLoad"); @@ -242,7 +242,7 @@ double SoundPoolImpl::LoadWithFdSync(double fd, double offset, double length) return soundId; } -void SoundPoolImpl::StopSync(double streamID) +void SoundPoolImpl::StopSync(int32_t streamID) { MediaTrace trace("SoundPool::TaiheStop"); MEDIA_LOGI("SoundPoolNapi::TaiheStop"); @@ -258,7 +258,7 @@ void SoundPoolImpl::StopSync(double streamID) MEDIA_LOGI("The taihe thread of stop finishes execution and returns"); } -void SoundPoolImpl::SetLoopSync(double streamID, double loop) +void SoundPoolImpl::SetLoopSync(int32_t streamID, int32_t loop) { MediaTrace trace("SoundPool::TaiheSetLoop"); MEDIA_LOGI("SoundPoolNapi::TaiheSetLoop"); @@ -277,7 +277,7 @@ void SoundPoolImpl::SetLoopSync(double streamID, double loop) } } -void SoundPoolImpl::SetPrioritySync(double streamID, double priority) +void SoundPoolImpl::SetPrioritySync(int32_t streamID, int32_t priority) { MediaTrace trace("SoundPool::TaiheSetPriority"); MEDIA_LOGI("SoundPoolNapi::TaiheSetPriority"); @@ -299,7 +299,7 @@ void SoundPoolImpl::SetPrioritySync(double streamID, double priority) } } -void SoundPoolImpl::SetVolumeSync(double streamID, double leftVolume, double rightVolume) +void SoundPoolImpl::SetVolumeSync(int32_t streamID, double leftVolume, double rightVolume) { MediaTrace trace("SoundPool::TaiheSetVolume"); MEDIA_LOGI("SoundPoolNapi::TaiheSetVolume"); @@ -319,7 +319,7 @@ void SoundPoolImpl::SetVolumeSync(double streamID, double leftVolume, double rig } } -void SoundPoolImpl::UnloadSync(double soundID) +void SoundPoolImpl::UnloadSync(int32_t soundID) { MediaTrace trace("SoundPool::TaiheUnload"); MEDIA_LOGI("SoundPoolNapi::TaiheUnload"); @@ -374,14 +374,14 @@ void SoundPoolImpl::OffError() MEDIA_LOGI("OffError End"); } -void SoundPoolImpl::OnPlayFinishedWithStreamId(callback_view callback) +void SoundPoolImpl::OnPlayFinishedWithStreamId(callback_view callback) { MediaTrace trace("SoundPoolImpl::OnPlayFinishedWithStreamId"); MEDIA_LOGI("OnPlayFinishedWithStreamId Start"); std::string callbackName = SoundPoolEvent::EVENT_PLAY_FINISHED_WITH_STREAM_ID; ani_env *env = get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); @@ -399,14 +399,14 @@ void SoundPoolImpl::OffPlayFinishedWithStreamId() MEDIA_LOGI("OffPlayFinishedWithStreamId End"); } -void SoundPoolImpl::OnLoadComplete(callback_view callback) +void SoundPoolImpl::OnLoadComplete(callback_view callback) { MediaTrace trace("SoundPoolImpl::OnLoadComplete"); MEDIA_LOGI("OnLoadComplete Start"); std::string callbackName = SoundPoolEvent::EVENT_LOAD_COMPLETED; ani_env *env = get_env(); - std::shared_ptr> taiheCallback = - std::make_shared>(callback); + std::shared_ptr> taiheCallback = + std::make_shared>(callback); std::shared_ptr cacheCallback = std::reinterpret_pointer_cast(taiheCallback); std::shared_ptr autoRef = std::make_shared(env, cacheCallback); -- Gitee