From a28371788e4345c1348861cf1be8f54ab11e7ebe Mon Sep 17 00:00:00 2001 From: fangchao Date: Mon, 13 Jan 2025 15:16:50 +0800 Subject: [PATCH 1/3] add rm ac3 demuxer Signed-off-by: fangchao --- bundle.json | 3 ++- config.gni | 2 ++ interface/inner_api/meta/media_types.h | 2 ++ interface/inner_api/plugin/plugin_list.h | 2 ++ src/BUILD.gn | 4 ++++ src/plugin/plugin_list.cpp | 28 ++++++++++++++++++++++++ 6 files changed, 40 insertions(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index ca9da726..401b7407 100644 --- a/bundle.json +++ b/bundle.json @@ -38,7 +38,8 @@ "media_foundation_enable_recorder", "media_foundation_enable_video", "media_foundation_enable_avs3da", - "media_foundation_enable_plugin_codec_adapter" + "media_foundation_enable_plugin_codec_adapter", + "media_foundation_enable_customization_codec" ], "adapted_system_type": [ "mini", diff --git a/config.gni b/config.gni index 1abce3d5..ba5ac374 100755 --- a/config.gni +++ b/config.gni @@ -65,6 +65,8 @@ declare_args() { media_foundation_enable_video = false media_foundation_enable_avs3da = false + media_foundation_enable_customization_codec = false + # enable ffrt task instead of pthread task media_foundation_enable_ffrt = false diff --git a/interface/inner_api/meta/media_types.h b/interface/inner_api/meta/media_types.h index 0231e4e0..5082a0a2 100644 --- a/interface/inner_api/meta/media_types.h +++ b/interface/inner_api/meta/media_types.h @@ -147,6 +147,8 @@ enum class FileType : int32_t { MPEGPS = 106, MOV = 107, AVI = 105, + RM = 108, + AC3 = 109, AMR = 201, AAC = 202, MP3 = 203, diff --git a/interface/inner_api/plugin/plugin_list.h b/interface/inner_api/plugin/plugin_list.h index 14e46892..22e87e7f 100644 --- a/interface/inner_api/plugin/plugin_list.h +++ b/interface/inner_api/plugin/plugin_list.h @@ -66,9 +66,11 @@ private: void AddWebvttDemuxerPlugin(); void AddOggDemuxerPlugin(); void AddWavDemuxerPlugin(); + void AddRmDemuxerPlugin(); void AddFFmpegDemuxerPlugins(); void AddMpegAudioDecoderPlugin(); void AddAacAudioDecoderPlugin(); + void AddCookAudioDecoderPlugin(); void AddFFmpegAudioDecodersPlugins(); void AddAudioVividDecodersPlugins(); void AddG711muAudioDecoderPlugins(); diff --git a/src/BUILD.gn b/src/BUILD.gn index 2ae3fd78..98f41a45 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -35,6 +35,10 @@ if (hst_is_standard_sys) { defines += [ "MEDIA_FOUNDATION_FFRT" ] } + if (media_foundation_enable_customization_codec) { + defines += [ "SUPPORT_CUSTOMIZATION_CODEC" ] + } + include_dirs = [ "$histreamer_root_dir/osal/base", "$histreamer_root_dir/plugin", diff --git a/src/plugin/plugin_list.cpp b/src/plugin/plugin_list.cpp index 7b302483..20d160bb 100644 --- a/src/plugin/plugin_list.cpp +++ b/src/plugin/plugin_list.cpp @@ -365,6 +365,30 @@ void PluginList::AddWavDemuxerPlugin() pluginDescriptionList_.push_back(wavDemuxerPlugin); } +#ifdef SUPPORT_CUSTOMIZATION_CODEC +void PluginList::AddRmDemuxerPlugin() +{ + PluginDescription rmDemuxerPlugin; + rmDemuxerPlugin.pluginName = "avdemux_rm"; + rmDemuxerPlugin.packageName = "FFmpegDemuxer"; + rmDemuxerPlugin.pluginType = PluginType::DEMUXER; + rmDemuxerPlugin.cap = ""; + rmDemuxerPlugin.rank = DEFAULT_RANK; + pluginDescriptionList_.push_back(rmDemuxerPlugin); +} + +void PluginList::AddAc3DemuxerPlugin() +{ + PluginDescription ac3DemuxerPlugin; + ac3DemuxerPlugin.pluginName = "avdemux_ac3"; + ac3DemuxerPlugin.packageName = "FFmpegDemuxer"; + ac3DemuxerPlugin.pluginType = PluginType::DEMUXER; + ac3DemuxerPlugin.cap = ""; + ac3DemuxerPlugin.rank = DEFAULT_RANK; + pluginDescriptionList_.push_back(ac3DemuxerPlugin); +} +#endif + void PluginList::AddFFmpegDemuxerPlugins() { AddAacDemuxerPlugin(); @@ -386,6 +410,10 @@ void PluginList::AddFFmpegDemuxerPlugins() AddWebvttDemuxerPlugin(); AddOggDemuxerPlugin(); AddWavDemuxerPlugin(); +#ifdef SUPPORT_CUSTOMIZATION_CODEC + AddRmDemuxerPlugin(); + AddAc3DemuxerPlugin(); +#endif } void PluginList::AddMpegAudioDecoderPlugin() -- Gitee From e2728f50bb7e45be979468b9ca8b08f8ab83ff12 Mon Sep 17 00:00:00 2001 From: fangchao Date: Mon, 13 Jan 2025 15:28:26 +0800 Subject: [PATCH 2/3] add rm ac3 demuxer Signed-off-by: fangchao --- interface/inner_api/plugin/plugin_list.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interface/inner_api/plugin/plugin_list.h b/interface/inner_api/plugin/plugin_list.h index 22e87e7f..39a62f92 100644 --- a/interface/inner_api/plugin/plugin_list.h +++ b/interface/inner_api/plugin/plugin_list.h @@ -66,11 +66,9 @@ private: void AddWebvttDemuxerPlugin(); void AddOggDemuxerPlugin(); void AddWavDemuxerPlugin(); - void AddRmDemuxerPlugin(); void AddFFmpegDemuxerPlugins(); void AddMpegAudioDecoderPlugin(); void AddAacAudioDecoderPlugin(); - void AddCookAudioDecoderPlugin(); void AddFFmpegAudioDecodersPlugins(); void AddAudioVividDecodersPlugins(); void AddG711muAudioDecoderPlugins(); @@ -86,6 +84,10 @@ private: void AddMp3AudioEncoderPlugins(); void AddFFmpegMuxerPlugins(); void AddAudioVendorAacEncodersPlugin(); +#ifdef SUPPORT_CUSTOMIZATION_CODEC + void AddRmDemuxerPlugin(); + void AddAc3DemuxerPlugin(); +#endif std::vector pluginDescriptionList_; }; -- Gitee From f305c71c894bb2d8d006edbf78b8cdd04e0943f2 Mon Sep 17 00:00:00 2001 From: fangchao Date: Wed, 15 Jan 2025 09:42:16 +0800 Subject: [PATCH 3/3] modify config Signed-off-by: fangchao --- bundle.json | 4 ++- config.gni | 4 ++- interface/inner_api/meta/mime_type.h | 4 +++ interface/inner_api/plugin/plugin_list.h | 8 ++++- src/BUILD.gn | 10 ++++-- src/plugin/plugin_list.cpp | 40 ++++++++++++++++++++++-- 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/bundle.json b/bundle.json index 401b7407..6a5b6667 100644 --- a/bundle.json +++ b/bundle.json @@ -39,7 +39,9 @@ "media_foundation_enable_video", "media_foundation_enable_avs3da", "media_foundation_enable_plugin_codec_adapter", - "media_foundation_enable_customization_codec" + "media_foundation_enable_codec_rm", + "media_foundation_enable_codec_cook", + "media_foundation_enable_codec_ac3" ], "adapted_system_type": [ "mini", diff --git a/config.gni b/config.gni index ba5ac374..3c6c62c3 100755 --- a/config.gni +++ b/config.gni @@ -65,7 +65,9 @@ declare_args() { media_foundation_enable_video = false media_foundation_enable_avs3da = false - media_foundation_enable_customization_codec = false + media_foundation_enable_codec_rm = false + media_foundation_enable_codec_cook = false + media_foundation_enable_codec_ac3 = false # enable ffrt task instead of pthread task media_foundation_enable_ffrt = false diff --git a/interface/inner_api/meta/mime_type.h b/interface/inner_api/meta/mime_type.h index 311a2b78..229705d1 100644 --- a/interface/inner_api/meta/mime_type.h +++ b/interface/inner_api/meta/mime_type.h @@ -29,6 +29,8 @@ public: static constexpr const char VIDEO_VP8[] = "video/x-vnd.on2.vp8"; static constexpr const char VIDEO_VP9[] = "video/x-vnd.on2.vp9"; static constexpr const char VIDEO_VVC[] = "video/vvc"; + static constexpr const char VIDEO_RV30[] = "video/rv30"; + static constexpr const char VIDEO_RV40[] = "video/rv40"; static constexpr const char AUDIO_AMR_NB[] = "audio/3gpp"; static constexpr const char AUDIO_AMR_WB[] = "audio/amr-wb"; @@ -42,6 +44,8 @@ public: static constexpr const char AUDIO_AVS3DA[] = "audio/av3a"; static constexpr const char AUDIO_LBVC[] = "audio/lbvc"; static constexpr const char AUDIO_APE[] = "audio/x-ape"; + static constexpr const char AUDIO_COOK[] = "audio/cook"; + static constexpr const char AUDIO_AC3[] = "audio/ac3"; static constexpr const char IMAGE_JPG[] = "image/jpeg"; static constexpr const char IMAGE_PNG[] = "image/png"; diff --git a/interface/inner_api/plugin/plugin_list.h b/interface/inner_api/plugin/plugin_list.h index 39a62f92..2290d51d 100644 --- a/interface/inner_api/plugin/plugin_list.h +++ b/interface/inner_api/plugin/plugin_list.h @@ -84,9 +84,15 @@ private: void AddMp3AudioEncoderPlugins(); void AddFFmpegMuxerPlugins(); void AddAudioVendorAacEncodersPlugin(); -#ifdef SUPPORT_CUSTOMIZATION_CODEC +#ifdef SUPPORT_CODEC_RM void AddRmDemuxerPlugin(); +#endif +#ifdef SUPPORT_CODEC_COOK + void AddCookAudioDecoderPlugins(); +#endif +#ifdef SUPPORT_CODEC_AC3 void AddAc3DemuxerPlugin(); + void AddAc3AudioDecoderPlugins(); #endif std::vector pluginDescriptionList_; diff --git a/src/BUILD.gn b/src/BUILD.gn index 98f41a45..3d7ae740 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -35,8 +35,14 @@ if (hst_is_standard_sys) { defines += [ "MEDIA_FOUNDATION_FFRT" ] } - if (media_foundation_enable_customization_codec) { - defines += [ "SUPPORT_CUSTOMIZATION_CODEC" ] + if (media_foundation_enable_codec_rm) { + defines += [ "SUPPORT_CODEC_RM" ] + } + if (media_foundation_enable_codec_cook) { + defines += [ "SUPPORT_CODEC_COOK" ] + } + if (media_foundation_enable_codec_ac3) { + defines += [ "SUPPORT_CODEC_AC3" ] } include_dirs = [ diff --git a/src/plugin/plugin_list.cpp b/src/plugin/plugin_list.cpp index 20d160bb..87c20a12 100644 --- a/src/plugin/plugin_list.cpp +++ b/src/plugin/plugin_list.cpp @@ -102,6 +102,12 @@ PluginList::PluginList() AddAmrnbAudioEncoderPlugins(); AddMp3AudioEncoderPlugins(); AddFFmpegMuxerPlugins(); +#ifdef SUPPORT_CODEC_COOK + AddCookAudioDecoderPlugins(); +#endif +#ifdef SUPPORT_CODEC_AC3 + AddAc3AudioDecoderPlugins(); +#endif } void PluginList::AddDataSourceStreamPlugins() @@ -365,7 +371,7 @@ void PluginList::AddWavDemuxerPlugin() pluginDescriptionList_.push_back(wavDemuxerPlugin); } -#ifdef SUPPORT_CUSTOMIZATION_CODEC +#ifdef SUPPORT_CODEC_RM void PluginList::AddRmDemuxerPlugin() { PluginDescription rmDemuxerPlugin; @@ -376,7 +382,9 @@ void PluginList::AddRmDemuxerPlugin() rmDemuxerPlugin.rank = DEFAULT_RANK; pluginDescriptionList_.push_back(rmDemuxerPlugin); } +#endif +#ifdef SUPPORT_CODEC_AC3 void PluginList::AddAc3DemuxerPlugin() { PluginDescription ac3DemuxerPlugin; @@ -410,8 +418,10 @@ void PluginList::AddFFmpegDemuxerPlugins() AddWebvttDemuxerPlugin(); AddOggDemuxerPlugin(); AddWavDemuxerPlugin(); -#ifdef SUPPORT_CUSTOMIZATION_CODEC +#ifdef SUPPORT_CODEC_RM AddRmDemuxerPlugin(); +#endif +#ifdef SUPPORT_CODEC_AC3 AddAc3DemuxerPlugin(); #endif } @@ -528,6 +538,32 @@ void PluginList::AddOpusAudioDecoderPlugins() pluginDescriptionList_.push_back(opusAudioDecoderPlugin); } +#ifdef SUPPORT_CODEC_COOK +void PluginList::AddCookAudioDecoderPlugins() +{ + PluginDescription cookAudioDecoderPlugin; + cookAudioDecoderPlugin.pluginName = "OH.Media.Codec.Decoder.Audio.COOK"; + cookAudioDecoderPlugin.packageName = "CookAudioDecoder"; + cookAudioDecoderPlugin.pluginType = PluginType::AUDIO_DECODER; + cookAudioDecoderPlugin.cap = "audio/cook"; + cookAudioDecoderPlugin.rank = DEFAULT_RANK; + pluginDescriptionList_.push_back(cookAudioDecoderPlugin); +} +#endif + +#ifdef SUPPORT_CODEC_AC3 +void PluginList::AddAc3AudioDecoderPlugins() +{ + PluginDescription ac3AudioDecoderPlugin; + ac3AudioDecoderPlugin.pluginName = "OH.Media.Codec.Decoder.Audio.AC3"; + ac3AudioDecoderPlugin.packageName = "Ac3AudioDecoder"; + ac3AudioDecoderPlugin.pluginType = PluginType::AUDIO_DECODER; + ac3AudioDecoderPlugin.cap = "audio/ac3"; + ac3AudioDecoderPlugin.rank = DEFAULT_RANK; + pluginDescriptionList_.push_back(ac3AudioDecoderPlugin); +} +#endif + void PluginList::AddAudioServerSinkPlugins() { PluginDescription audioServerSinkPlugin; -- Gitee