From f44d3502882a3ae06da36b243581ef70d00f646b Mon Sep 17 00:00:00 2001 From: guoyao Date: Fri, 15 Dec 2023 15:55:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?pluginbase=20=E5=8F=82=E6=95=B0=E5=B8=A6?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E4=BC=A0=E9=80=92=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoyao --- interface/inner_api/meta/media_types.h | 40 +++++++++++++----------- interface/inner_api/plugin/plugin_base.h | 10 +++--- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/interface/inner_api/meta/media_types.h b/interface/inner_api/meta/media_types.h index 6587594b..005223e4 100644 --- a/interface/inner_api/meta/media_types.h +++ b/interface/inner_api/meta/media_types.h @@ -16,7 +16,8 @@ #ifndef MEDIA_FOUNDATION_MEDIA_TYPES_H #define MEDIA_FOUNDATION_MEDIA_TYPES_H -#include // NOLINT: used it +#include // NOLINT: used it +#include #include namespace OHOS { @@ -29,12 +30,12 @@ namespace Plugin { * @version 1.0 */ enum class MediaType : int32_t { - UNKNOWN = -1, ///< Usually treated as DATA + UNKNOWN = -1, ///< Usually treated as DATA AUDIO = 0, VIDEO = 1, SUBTITLE = 2, - ATTACHMENT, ///< Opaque data information usually sparse - DATA ///< Opaque data information usually continuous + ATTACHMENT, ///< Opaque data information usually sparse + DATA ///< Opaque data information usually continuous }; /** @@ -43,11 +44,7 @@ enum class MediaType : int32_t { * @since 1.0 * @version 1.0 */ -enum class Seekable : int32_t { - INVALID = -1, - UNSEEKABLE = 0, - SEEKABLE = 1 -}; +enum class Seekable : int32_t { INVALID = -1, UNSEEKABLE = 0, SEEKABLE = 1 }; /** * @enum Codec Mode. @@ -86,10 +83,10 @@ struct Location { * @version 1.0 */ enum struct SeekMode : uint32_t { - SEEK_NEXT_SYNC = 0, ///> sync to keyframes after the time point. - SEEK_PREVIOUS_SYNC, ///> sync to keyframes before the time point. - SEEK_CLOSEST_SYNC, ///> sync to closest keyframes. - SEEK_CLOSEST, ///> seek to frames closest the time point. + SEEK_NEXT_SYNC = 0, ///> sync to keyframes after the time point. + SEEK_PREVIOUS_SYNC, ///> sync to keyframes before the time point. + SEEK_CLOSEST_SYNC, ///> sync to closest keyframes. + SEEK_CLOSEST, ///> seek to frames closest the time point. }; /** @@ -143,8 +140,10 @@ enum struct ProtocolType : uint32_t { STREAM, ///< Stream protocol, uri prefix: "stream://" HTTP, ///< Http protocol, uri prefix: "http://" HTTPS, ///< Https protocol, uri prefix: "https://" - HLS, ///< Http live streaming protocol, uri prefix: "https://" or "https://" or "file://", suffix: ".m3u8" - DASH, ///< Dynamic adaptive streaming over Http protocol, uri prefix: "https://" or "https://", suffix: ".mpd" + HLS, ///< Http live streaming protocol, uri prefix: "https://" or "https://" + ///< or "file://", suffix: ".m3u8" + DASH, ///< Dynamic adaptive streaming over Http protocol, uri prefix: + ///< "https://" or "https://", suffix: ".mpd" RTSP, ///< Real time streaming protocol, uri prefix: "rtsp://" RTP, ///< Real-time transport protocol, uri prefix: "rtp://" RTMP, ///< RTMP protocol, uri prefix: "rtmp://" @@ -170,7 +169,8 @@ enum struct PluginType : int32_t { VIDEO_SINK, ///< reference VideoSinkPlugin MUXER, ///< reference MuxerPlugin OUTPUT_SINK, ///< reference OutputSinkPlugin - GENERIC_PLUGIN, ///< generic plugin can be used to represent any user extended plugin + GENERIC_PLUGIN, ///< generic plugin can be used to represent any user extended + ///< plugin }; /** @@ -180,14 +180,16 @@ enum struct PluginType : int32_t { * @version 1.0 */ enum struct State : int32_t { - CREATED = 0, ///< Indicates the status of the plugin when it is constructed. + CREATED = 0, ///< Indicates the status of the plugin when it is constructed. ///< The plug-in will not be restored in the entire life cycle. INITIALIZED = 1, ///< Plugin global resource initialization completion status. PREPARED = 2, ///< Status of parameters required for plugin running. RUNNING = 3, ///< The system enters the running state after call start(). PAUSED = 4, ///< Plugin temporarily stops processing data. This state is optional. - DESTROYED = -1, ///< Plugin destruction state. In this state, all resources are released. - INVALID = -2, ///< An error occurs in any state and the plugin enters the invalid state. + DESTROYED = -1, ///< Plugin destruction state. In this state, all resources + ///< are released. + INVALID = -2, ///< An error occurs in any state and the plugin enters the + ///< invalid state. }; /** diff --git a/interface/inner_api/plugin/plugin_base.h b/interface/inner_api/plugin/plugin_base.h index 6a93478a..c693eebf 100644 --- a/interface/inner_api/plugin/plugin_base.h +++ b/interface/inner_api/plugin/plugin_base.h @@ -64,9 +64,9 @@ struct Callback { * @since 1.0 * @version 1.0 */ - /// Constructor +/// Constructor struct PluginBase { - explicit PluginBase(std::string name): pluginName_(std::move(name)) {} + explicit PluginBase(std::string name) : pluginName_(std::move(name)) {} /// Destructor virtual ~PluginBase() = default; @@ -180,7 +180,7 @@ struct PluginBase { * @retval OK: Plugin GetParameter succeeded. * @retval ERROR_INVALID_PARAMETER: The plugin does not support this parameter. */ - virtual Status GetParameter(std::shared_ptr meta) + virtual Status GetParameter(std::shared_ptr &meta) { (void)meta; return Status::ERROR_UNIMPLEMENTED; @@ -199,7 +199,7 @@ struct PluginBase { * @retval ERROR_INVALID_DATA: The value is not in the valid range. * @retval ERROR_MISMATCHED_TYPE: The data type is mismatched. */ - virtual Status SetParameter(std::shared_ptr meta) + virtual Status SetParameter(const std::shared_ptr &meta) { (void)meta; return Status::ERROR_UNIMPLEMENTED; @@ -214,7 +214,7 @@ struct PluginBase { * @return Execution status return * @retval OK: Plugin SetCallback succeeded. */ - virtual Status SetCallback(Callback* cb) + virtual Status SetCallback(Callback *cb) { (void)cb; return Status::OK; -- Gitee From 97adbef3a5ddeb251ca4089f7bbe885c7f909e34 Mon Sep 17 00:00:00 2001 From: guoyao Date: Tue, 19 Dec 2023 16:59:54 +0800 Subject: [PATCH 2/2] audio vivid key Signed-off-by: guoyao --- interface/inner_api/meta/meta_key.h | 38 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/interface/inner_api/meta/meta_key.h b/interface/inner_api/meta/meta_key.h index 9621cfbe..3d8cc026 100644 --- a/interface/inner_api/meta/meta_key.h +++ b/interface/inner_api/meta/meta_key.h @@ -25,25 +25,25 @@ public: /* -------------------- regular tag -------------------- */ static constexpr const char REGULAR_TRACK_ID[] = "track_index"; ///< track id static constexpr const char REQUIRED_IN_BUFFER_CNT[] = - "max_input_buffer_count"; ///< required buffer count of plugin; read only tag + "max_input_buffer_count"; ///< required buffer count of plugin; read only tag static constexpr const char REQUIRED_IN_BUFFER_SIZE[] = - "max_input_size"; ///< required buffer size of plugin; read only tag + "max_input_size"; ///< required buffer size of plugin; read only tag static constexpr const char REQUIRED_OUT_BUFFER_CNT[] = - "max_output_buffer_count"; ///< required buffer count of plugin; read only tag + "max_output_buffer_count"; ///< required buffer count of plugin; read only tag static constexpr const char REQUIRED_OUT_BUFFER_SIZE[] = - "regular.required.out.buffer.size"; ///< required buffer size of plugin; read only tag + "regular.required.out.buffer.size"; ///< required buffer size of plugin; read only tag static constexpr const char BUFFER_ALLOCATOR[] = - "regular.buffer.allocator"; ///< Allocator, allocator to alloc buffers - static constexpr const char BUFFERING_SIZE[] = "regular.buffering.size"; ///< download buffer size - static constexpr const char WATERLINE_HIGH[] = "regular.waterline.high"; ///< high waterline - static constexpr const char WATERLINE_LOW[] = "regular.waterline.low"; ///< low waterline - static constexpr const char SRC_INPUT_TYPE[] = "regular.src.input.type"; ///< SrcInputType - static constexpr const char APP_TOKEN_ID[] = "regular.app.token.id"; ///< app token id + "regular.buffer.allocator"; ///< Allocator, allocator to alloc buffers + static constexpr const char BUFFERING_SIZE[] = "regular.buffering.size"; ///< download buffer size + static constexpr const char WATERLINE_HIGH[] = "regular.waterline.high"; ///< high waterline + static constexpr const char WATERLINE_LOW[] = "regular.waterline.low"; ///< low waterline + static constexpr const char SRC_INPUT_TYPE[] = "regular.src.input.type"; ///< SrcInputType + static constexpr const char APP_TOKEN_ID[] = "regular.app.token.id"; ///< app token id static constexpr const char APP_FULL_TOKEN_ID[] = "regular.app.full.token.id"; ///< app full token id static constexpr const char APP_UID[] = "regular.app.uid"; ///< app uid static constexpr const char APP_PID[] = "regular.app.pid"; ///< app pid static constexpr const char AUDIO_RENDER_INFO[] = - "regular.audio.render.info"; ///< AudioRenderInfo, audio render info + "regular.audio.render.info"; ///< AudioRenderInfo, audio render info static constexpr const char AUDIO_INTERRUPT_MODE[] = "regular.audio.interrupt.mode"; ///< AudioInterruptMode, audio interrupt mode static constexpr const char VIDEO_SCALE_TYPE[] = "scale_type"; ///< VideoScaleType, video scale type @@ -108,8 +108,8 @@ public: static constexpr const char AUDIO_BITS_PER_CODED_SAMPLE[] = "bits_per_coded_sample"; ///< bits per coded sample /* -------------------- audio specific tag -------------------- */ - static constexpr const char AUDIO_MPEG_VERSION[] = "audio.mpeg.version"; ///< mpeg version - static constexpr const char AUDIO_MPEG_LAYER[] = "audio.mpeg.layer"; ///< mpeg layer + static constexpr const char AUDIO_MPEG_VERSION[] = "audio.mpeg.version"; ///< mpeg version + static constexpr const char AUDIO_MPEG_LAYER[] = "audio.mpeg.layer"; ///< mpeg layer static constexpr const char AUDIO_AAC_PROFILE[] = "audio.aac.profile"; ///< @see AudioAacProfile static constexpr const char AUDIO_AAC_LEVEL[] = "audio.aac.level"; ///< acc level @@ -122,6 +122,10 @@ public: static constexpr const char AUDIO_VORBIS_IDENTIFICATION_HEADER[] = "identification_header"; ///< Key for vorbis identification header static constexpr const char AUDIO_VORBIS_SETUP_HEADER[] = "setup_header"; ///< Key for vorbis setup header + static constexpr const char OH_MD_KEY_AUDIO_OBJECT_NUMBER[] = + "audio_object_number_key"; ///< Key for audio object number + static constexpr const char OH_MD_KEY_AUDIO_VIVID_METADATA[] = + "audio_vivid_metadata_key"; ///< Key for audio vivid metadata /* -------------------- video universal tag -------------------- */ static constexpr const char VIDEO_WIDTH[] = "width"; ///< video width @@ -141,7 +145,7 @@ public: static constexpr const char VIDEO_DELAY[] = "video_delay"; ///< video delay static constexpr const char VIDEO_I_FRAME_INTERVAL[] = "i_frame_interval"; ///< Key for the interval of key frame. static constexpr const char VIDEO_REQUEST_I_FRAME[] = - "req_i_frame"; ///< Key for the request a I-Frame immediately. + "req_i_frame"; ///< Key for the request a I-Frame immediately. static constexpr const char VIDEO_ENCODE_BITRATE_MODE[] = "video_encode_bitrate_mode"; ///< Key for video encode bitrate mode, see {link @VideoEncodeBitrateMode} static constexpr const char VIDEO_ENCODE_QUALITY[] = @@ -156,11 +160,11 @@ public: static constexpr const char VIDEO_CHROMA_LOCATION[] = "chroma_location"; ///< @see ChromaLocation /* -------------------- user specific tag -------------------- */ - static constexpr const char USER_FRAME_PTS[] = "user.frame.pts"; ///< The user frame pts + static constexpr const char USER_FRAME_PTS[] = "user.frame.pts"; ///< The user frame pts static constexpr const char USER_TIME_SYNC_RESULT[] = - "user.time.sync.result"; ///< std::string : The time sync result + "user.time.sync.result"; ///< std::string : The time sync result static constexpr const char USER_AV_SYNC_GROUP_INFO[] = - "user.av.sync.group.info"; ///< std::string : The av sync group info + "user.av.sync.group.info"; ///< std::string : The av sync group info static constexpr const char USER_SHARED_MEMORY_FD[] = "user.shared.memory.fd"; ///< std::string : The shared memory fd static constexpr const char USER_PUSH_DATA_TIME[] = "user.push.data.time"; ///< The user push data time -- Gitee