在openhamony中使用dash插件
1 将dash加入编译
1 bad插件的BUILD.gn中添加编译信息
ohos_source_set("dash_source") {
sources = [
"ext/dash/gstdashdemux.c",
"ext/dash/gstmpdnode.c",
"ext/dash/gstmpdrootnode.c",
"ext/dash/gstmpdbaseurlnode.c",
"ext/dash/gstmpdutctimingnode.c",
"ext/dash/gstmpdmetricsnode.c",
"ext/dash/gstmpdmetricsrangenode.c",
"ext/dash/gstmpdsnode.c",
"ext/dash/gstmpdsegmenttimelinenode.c",
"ext/dash/gstmpdsegmenttemplatenode.c",
"ext/dash/gstmpdsegmenturlnode.c",
"ext/dash/gstmpdsegmentlistnode.c",
"ext/dash/gstmpdsegmentbasenode.c",
"ext/dash/gstmpdperiodnode.c",
"ext/dash/gstmpdrepresentationbasenode.c",
"ext/dash/gstmpdmultsegmentbasenode.c",
"ext/dash/gstmpdrepresentationnode.c",
"ext/dash/gstmpdsubrepresentationnode.c",
"ext/dash/gstmpdadaptationsetnode.c",
"ext/dash/gstmpdsubsetnode.c",
"ext/dash/gstmpdprograminformationnode.c",
"ext/dash/gstmpdlocationnode.c",
"ext/dash/gstmpdreportingnode.c",
"ext/dash/gstmpdurltypenode.c",
"ext/dash/gstmpddescriptortypenode.c",
"ext/dash/gstxmlhelper.c",
"ext/dash/gstmpdhelper.c",
"ext/dash/gstmpdparser.c",
"ext/dash/gstmpdclient.c",
"ext/dash/gstplugin.c",
"ext/dash/gstdashsink.c",
]
include_dirs = [
".",
"./gst-libs",
"//third_party/gstreamer/gstreamer",
"//third_party/gstreamer/gstreamer/libs",
"//third_party/gstreamer/gstplugins_base",
"//third_party/gstreamer/gstplugins_base/gst-libs",
"//third_party/glib/glib",
"//third_party/glib",
"//third_party/glib/gmodule",
"//third_party/gstreamer/gstplugins_base/gst-libs/gst/pbutils",
"//third_party/gstreamer/gstplugins_bad/gst-libs/gst/adaptivedemux",
"//third_party/gstreamer/gstplugins_bad/gst-libs/gst/uridownloader",
"//third_party/gstreamer/gstplugins_bad/gst-libs/gst/tag",
"//third_party/gstreamer/gstplugins_bad/gst-libs/gst/isoff",
"//third_party/gstreamer/gstplugins_base/gst/gst/gio",
"//third_party/gstreamer/gstreamer/libs/gst/net",
"//third_party/libxml2/include"
]
configs = [
":gst_plugins_config",
":dash_source_config",
]
}
ohos_shared_library("gstdash") {
deps = [
":dash_source",
"//third_party/glib:glib",
"//third_party/glib:gio",
"//third_party/glib:gobject",
"//third_party/gstreamer/gstreamer:gstbase",
"//third_party/gstreamer/gstreamer:gstreamer",
"//third_party/libxml2:xml2",
"//third_party/gstreamer/gstplugins_bad:gstadaptivedemux",
"//third_party/gstreamer/gstplugins_bad:gsturidownloader",
"//third_party/gstreamer/gstplugins_base:gsttag",
"//third_party/gstreamer/gstplugins_base:gstpbutils",
"//third_party/gstreamer/gstplugins_bad:gstisoff",
"//third_party/gstreamer/gstplugins_base:gstgio",
"//third_party/gstreamer/gstreamer:gstnet",
]
relative_install_dir = "media/plugins"
part_name = "gstreamer"
subsystem_name = "thirdparty"
}
2解决依赖中缺少的库
[OHOS INFO] ERROR Unresolved dependencies.
[OHOS INFO] //third_party/gstreamer/gstplugins_bad:gstdash(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] needs //third_party/glib:gio(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] //third_party/gstreamer/gstplugins_bad:gstdash(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] needs //third_party/gstreamer/gstplugins_bad:gstisoff(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] //third_party/gstreamer/gstplugins_bad:gstdash(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] needs //third_party/gstreamer/gstplugins_base:gstgio(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] //third_party/gstreamer/gstplugins_bad:gstdash(//build/toolchain/ohos:ohos_clang_arm)
[OHOS INFO] needs //third_party/gstreamer/gstreamer:gstnet(//build/toolchain/ohos:ohos_clang_arm)
gstisoff
ohos_source_set("isoff_source") {
sources = [
"gst-libs/gst/isoff/gstisoff.c",
]
configs = [
":gst_plugins_config",
]
}
ohos_shared_library("gstisoff") {
deps = [
":isoff_source",
"//third_party/glib:glib",
"//third_party/glib:gobject",
"//third_party/gstreamer/gstreamer:gstbase",
"//third_party/gstreamer/gstreamer:gstreamer",
]
relative_install_dir = "media/plugins"
part_name = "multimedia_player_framework"
subsystem_name = "multimedia"
}
group("gstplugins_bad_packages") {
deps = [
":gstcurl",
":gsthls",
":gstmpegtsdemux",
":gstvideoparsersbad",
":gsturidownloader",
":gstisoff",
":gstdash",
]
}
gstgio
\third_party\gstreamer\gstplugins_base\BUILD.gn
config("gstgio_config") {
include_dirs = [
"//third_party/glib/glib",
"//third_party/glib/gio",
]
cflags = [
"-DGST_STATIC_COMPILATION",
]
}
ohos_source_set("gstgio_source") {
sources = [
"gst/gio/gstgioelement.c",
"gst/gio/gstgiobasesink.c",
"gst/gio/gstgiobasesrc.c",
"gst/gio/gstgiosink.c",
"gst/gio/gstgiosrc.c",
"gst/gio/gstgiostreamsink.c",
"gst/gio/gstgiostreamsrc.c",
]
configs = [
":gst_plugins_config",
]
}
ohos_shared_library("gstgio") {
deps = [
":gstgio_source",
"//third_party/glib:glib",
"//third_party/glib:gio",
"//third_party/glib:gmodule",
"//third_party/glib:gobject",
"//third_party/gstreamer/gstreamer:gstbase",
"//third_party/gstreamer/gstreamer:gstreamer",
]
part_name = "multimedia_player_framework"
subsystem_name = "multimedia"
}
group("gstplugins_base_packages") {
deps = [
":gstapp",
":gstaudioconvert",
":gstaudioresample",
":gstplayback",
":gstriff",
":gsttypefindfunctions",
":gstvideoconvert",
":gstvideoscale",
":gstgio",
":gsttag",
":gstpbutils",
]
}
config("gst_plugins_config") {
visibility = [ ":*" ]
include_dirs = [
".",
"./gst-libs",
"../gst_dfx/",
"//third_party/gstreamer/gstreamer",
"//third_party/gstreamer/gstreamer/gst",
"//third_party/gstreamer/gstreamer/libs",
"//third_party/glib/glib",
"//third_party/glib",
"//third_party/glib/gmodule",
"//third_party/zlib/",
]
gstnet
third_party\gstreamer\gstreamer\BUILD.gn
group("gstreamer_packages") {
deps = [
":gst-inspect",
":gst-launch",
":gstbase",
":gstcoreelements",
":gstreamer",
":gstnet",
]
}
config("gstnet_config") {
include_dirs = [
".",
"./libs",
"./libs/gst/net",
"../gst_dfx",
"//third_party/glib/glib",
"//third_party/glib",
"//third_party/glib/gmodule",
"//third_party/glib/gio",
]
cflags = [
"-DHAVE_CONFIG_H",
"-fno-strict-aliasing",
"-Wno-sign-compare",
"-Wno-builtin-requires-header",
"-Wno-undefined-internal",
"-Wno-unused-function",
"-DOHOS_EXT_FUNC",
"-DOHOS_OPT_COMPAT",
"-DOHOS_OPT_CVE",
"-DOHOS_OPT_PERFORMANCE",
"-DOHOS_GLIB_COMPATIBLE",
"-DG_LOG_DOMAIN=\"GStreamer\"",
]
}
ohos_source_set("gstnet_source") {
sources = [
"libs/gst/net/gstnetaddressmeta.c",
"libs/gst/net/gstnetclientclock.c",
"libs/gst/net/gstnetcontrolmessagemeta.c",
"libs/gst/net/gstnettimepacket.c",
"libs/gst/net/gstnettimeprovider.c",
"libs/gst/net/gstptpclock.c",
"libs/gst/net/gstntppacket.c",
"libs/gst/net/gstnetutils.c",
]
configs = [ ":gstnet_config" ]
}
ohos_shared_library("gstnet") {
deps = [
":gstnet_source",
":gstreamer",
":gstbase",
"../gst_dfx:gst_trace",
"//third_party/glib:glib",
"//third_party/glib:gobject",
"//third_party/glib:gio",
]
part_name = "multimedia_player_framework"
subsystem_name = "multimedia"
}
glib:gio
third_party\glib\BUILD.gn
config("gio_config") {
visibility = [ ":*" ]
include_dirs = [
".",
"gio",
"glib",
"gio/xdgmime",
"gio/inotify",
"gmodule",
"//third_party/gettext/gettext-runtime/intl",
"//third_party/zlib",
]
cflags = [
"-DG_LOG_DOMAIN=\"GLib-GIO\"",
#"-DGOBJECT_COMPILATION",
"-Wno-sign-compare",
"-Wno-unused-function",
"-Wno-int-conversion",
"-DGIO_COMPILATION",
"-DGIO_MODULE_DIR=\"\"",
"-DLOCALSTATEDIR=\"var\"",
"-Wno-implicit-function-declaration",
"-Wno-format",
"-Wno-conditional-type-mismatch",
"-Wno-self-assign",
"-Wno-unused-value",
"-Wno-unused-function",
"-Wno-pointer-sign",
"-fvisibility=hidden",
"-DMAJOR_IN_SYSMACROS",
"-DG_ENABLE_DEBUG",
]
}
ohos_source_set("gio_source") {
sources = [
# application_sources
"gio/gaction.c",
"gio/gactiongroup.c",
"gio/gactiongroupexporter.c",
"gio/gactionmap.c",
"gio/gapplication.c",
"gio/gapplicationcommandline.c",
"gio/gapplicationimpl-dbus.c",
"gio/gdbusactiongroup.c",
"gio/gdbusmenumodel.c",
"gio/gmenu.c",
"gio/gmenuexporter.c",
"gio/gmenumodel.c",
"gio/gnotification.c",
"gio/gnotificationbackend.c",
"gio/gpropertyaction.c",
"gio/gremoteactiongroup.c",
"gio/gsimpleaction.c",
"gio/gsimpleactiongroup.c",
# settings_sources
"gio/gdelayedsettingsbackend.c",
"gio/gkeyfilesettingsbackend.c",
"gio/gmemorysettingsbackend.c",
"gio/gnullsettingsbackend.c",
"gio/gsettings-mapping.c",
"gio/gsettings.c",
"gio/gsettingsbackend.c",
"gio/gsettingsschema.c",
"gio/gvdb/gvdb-reader.c",
# gdbus_sources
"gio/gdbusaddress.c",
"gio/gdbusauth.c",
"gio/gdbusauthmechanism.c",
"gio/gdbusauthmechanismanon.c",
"gio/gdbusauthmechanismexternal.c",
"gio/gdbusauthmechanismsha1.c",
"gio/gdbusauthobserver.c",
"gio/gdbusconnection.c",
"gio/gdbuserror.c",
"gio/gdbusinterface.c",
"gio/gdbusinterfaceskeleton.c",
"gio/gdbusintrospection.c",
"gio/gdbusmessage.c",
"gio/gdbusmethodinvocation.c",
"gio/gdbusnameowning.c",
"gio/gdbusnamewatching.c",
"gio/gdbusobject.c",
"gio/gdbusobjectmanager.c",
"gio/gdbusobjectmanagerclient.c",
"gio/gdbusobjectmanagerserver.c",
"gio/gdbusobjectproxy.c",
"gio/gdbusobjectskeleton.c",
"gio/gdbusprivate.c",
"gio/gdbusproxy.c",
"gio/gdbusserver.c",
"gio/gdbusutils.c",
"gio/gtestdbus.c",
# portal_sources
"gio/gdocumentportal.c",
"gio/gmemorymonitorportal.c",
"gio/gnetworkmonitorportal.c",
"gio/gopenuriportal.c",
"gio/gportalnotificationbackend.c",
"gio/gportalsupport.c",
"gio/gproxyresolverportal.c",
"gio/gtrashportal.c",
# local_sources
"gio/ghttpproxy.c",
"gio/glocalfile.c",
"gio/glocalfileenumerator.c",
"gio/glocalfileinfo.c",
"gio/glocalfileinputstream.c",
"gio/glocalfileiostream.c",
"gio/glocalfilemonitor.c",
"gio/glocalfileoutputstream.c",
"gio/glocalvfs.c",
"gio/gsocks4aproxy.c",
"gio/gsocks4proxy.c",
"gio/gsocks5proxy.c",
"gio/thumbnail-verify.c",
# unix_sources + HAVE_NETLINK
"gio/gnetworkmonitornetlink.c",
"gio/gnetworkmonitornm.c",
# unix_sources
"gio/gfdonotificationbackend.c",
"gio/gfiledescriptorbased.c",
"gio/ggtknotificationbackend.c",
"gio/giounix-private.c",
"gio/gunixconnection.c",
"gio/gunixcredentialsmessage.c",
"gio/gunixfdlist.c",
"gio/gunixfdmessage.c",
"gio/gunixinputstream.c",
"gio/gunixmount.c",
"gio/gunixmounts.c",
"gio/gunixoutputstream.c",
"gio/gunixsocketaddress.c",
"gio/gunixvolume.c",
"gio/gunixvolumemonitor.c",
# appinfo_sources
"gio/gdesktopappinfo.c",
# contenttype_sources
"gio/gcontenttype.c",
# gdbus_daemon_sources
"gio/gdbusdaemon.c",
# gio_sources
"gio/gappinfo.c",
"gio/gasynchelper.c",
"gio/gasyncinitable.c",
"gio/gasyncresult.c",
"gio/gbufferedinputstream.c",
"gio/gbufferedoutputstream.c",
"gio/gbytesicon.c",
"gio/gcancellable.c",
"gio/gcharsetconverter.c",
"gio/gcontextspecificgroup.c",
"gio/gconverter.c",
"gio/gconverterinputstream.c",
"gio/gconverteroutputstream.c",
"gio/gcredentials.c",
"gio/gdatagrambased.c",
"gio/gdatainputstream.c",
"gio/gdataoutputstream.c",
"gio/gdrive.c",
"gio/gdtlsclientconnection.c",
"gio/gdtlsconnection.c",
"gio/gdtlsserverconnection.c",
"gio/gdummyfile.c",
"gio/gdummyproxyresolver.c",
"gio/gdummytlsbackend.c",
"gio/gemblem.c",
"gio/gemblemedicon.c",
"gio/gfile.c",
"gio/gfileattribute.c",
"gio/gfileenumerator.c",
"gio/gfileicon.c",
"gio/gfileinfo.c",
"gio/gfileinputstream.c",
"gio/gfileiostream.c",
"gio/gfilemonitor.c",
"gio/gfilenamecompleter.c",
"gio/gfileoutputstream.c",
"gio/gfilterinputstream.c",
"gio/gfilteroutputstream.c",
"gio/gicon.c",
"gio/ginetaddress.c",
"gio/ginetaddressmask.c",
"gio/ginetsocketaddress.c",
"gio/ginitable.c",
"gio/ginputstream.c",
"gio/gioerror.c",
"gio/giomodule-priv.c",
"gio/giomodule.c",
"gio/gioscheduler.c",
"gio/giostream.c",
"gio/glistmodel.c",
"gio/gliststore.c",
"gio/gloadableicon.c",
"gio/gmarshal-internal.c",
"gio/gmemoryinputstream.c",
"gio/gmemorymonitor.c",
"gio/gmemorymonitordbus.c",
"gio/gmemoryoutputstream.c",
"gio/gmount.c",
"gio/gmountoperation.c",
"gio/gnativesocketaddress.c",
"gio/gnativevolumemonitor.c",
"gio/gnetworkaddress.c",
"gio/gnetworking.c",
"gio/gnetworkmonitor.c",
"gio/gnetworkmonitorbase.c",
"gio/gnetworkservice.c",
"gio/goutputstream.c",
"gio/gpermission.c",
"gio/gpollableinputstream.c",
"gio/gpollableoutputstream.c",
"gio/gpollableutils.c",
"gio/gpollfilemonitor.c",
"gio/gproxy.c",
"gio/gproxyaddress.c",
"gio/gproxyaddressenumerator.c",
"gio/gproxyresolver.c",
"gio/gresolver.c",
"gio/gresource.c",
"gio/gresourcefile.c",
"gio/gseekable.c",
"gio/gsimpleasyncresult.c",
"gio/gsimpleiostream.c",
"gio/gsimplepermission.c",
"gio/gsimpleproxyresolver.c",
"gio/gsocket.c",
"gio/gsocketaddress.c",
"gio/gsocketaddressenumerator.c",
"gio/gsocketclient.c",
"gio/gsocketconnectable.c",
"gio/gsocketconnection.c",
"gio/gsocketcontrolmessage.c",
"gio/gsocketinputstream.c",
"gio/gsocketlistener.c",
"gio/gsocketoutputstream.c",
"gio/gsocketservice.c",
"gio/gsrvtarget.c",
"gio/gsubprocess.c",
"gio/gsubprocesslauncher.c",
"gio/gtask.c",
"gio/gtcpconnection.c",
"gio/gtcpwrapperconnection.c",
"gio/gthemedicon.c",
"gio/gthreadedresolver.c",
"gio/gthreadedresolver.h",
"gio/gthreadedsocketservice.c",
"gio/gtlsbackend.c",
"gio/gtlscertificate.c",
"gio/gtlsclientconnection.c",
"gio/gtlsconnection.c",
"gio/gtlsdatabase.c",
"gio/gtlsfiledatabase.c",
"gio/gtlsinteraction.c",
"gio/gtlspassword.c",
"gio/gtlsserverconnection.c",
"gio/gunionvolumemonitor.c",
"gio/gvfs.c",
"gio/gvolume.c",
"gio/gvolumemonitor.c",
"gio/gzlibcompressor.c",
"gio/gzlibdecompressor.c",
# out
"gio/gdbus-daemon-generated.c",
"gio/gioenumtypes.c",
"gio/xdp-dbus.c",
]
configs = [ ":gio_config" ]
}
ohos_shared_library("gio") {
deps = [
":ginotify",
":gio_source",
":glib",
":gmodule",
":gobject",
":gxdgmime",
"//third_party/gettext:libgettext",
"//third_party/zlib:libz",
]
part_name = "glib"
subsystem_name = "thirdparty"
}
config("gxdgmime_config") {
visibility = [ ":*" ]
include_dirs = [
".",
"gmodule",
"glib",
]
cflags = [
"-DXDG_PREFIX=_gio_xdg",
"-fvisibility=hidden",
"-Wno-shift-negative-value",
"-Wno-sign-compare",
]
}
ohos_source_set("gxdgmime_source") {
sources = [
"gio/xdgmime/xdgmime.c",
"gio/xdgmime/xdgmimealias.c",
"gio/xdgmime/xdgmimecache.c",
"gio/xdgmime/xdgmimeglob.c",
"gio/xdgmime/xdgmimeicon.c",
"gio/xdgmime/xdgmimeint.c",
"gio/xdgmime/xdgmimemagic.c",
"gio/xdgmime/xdgmimeparent.c",
]
configs = [ ":gxdgmime_config" ]
}
ohos_static_library("gxdgmime") {
deps = [ ":gxdgmime_source" ]
part_name = "glib"
subsystem_name = "thirdparty"
}
config("ginotify_config") {
visibility = [ ":*" ]
include_dirs = [
".",
"gmodule",
"glib",
]
cflags = [
"-DXDG_PREFIX=_gio_xdg",
"-fvisibility=hidden",
"-Wno-shift-negative-value",
"-Wno-sign-compare",
"-DGIO_COMPILATION",
]
}
ohos_source_set("ginotify_source") {
sources = [
"gio/inotify/ginotifyfilemonitor.c",
"gio/inotify/inotify-helper.c",
"gio/inotify/inotify-kernel.c",
"gio/inotify/inotify-missing.c",
"gio/inotify/inotify-path.c",
"gio/inotify/inotify-sub.c",
]
configs = [ ":ginotify_config" ]
}
ohos_static_library("ginotify") {
deps = [ ":ginotify_source" ]
part_name = "glib"
subsystem_name = "thirdparty"
}
group("glib_packages") {
deps = [
":ginotify",
":gio",
":glib",
":gmodule",
":gobject",
":gxdgmime",
]
}
config("glib_config") {
visibility = [ ":*" ]
include_dirs = [
".",
"glib/libcharset",
"glib",
"glib/deprecated",
"//third_party/gettext/gettext-runtime/intl",
"//third_party/pcre2/pcre2/src",
"//foundation/multimedia/media_standard/services/utils",
"glibmemdfx",
]
ohos_shared_library("glib") {
deps = [
":glib_source",
"//third_party/gettext:libgettext",
"//third_party/glib:glibpcre",
]
config("gobject_config") {
visibility = [ ":*" ]
include_dirs = [
".",
"gobject",
"glib",
"//third_party/libffi/include",
"//third_party/gettext/gettext-runtime/intl",
]
dash内部链接失败
BUILD.gn中将gstmpdcontentcomponentnode.c加入编译
在gstmpdparser.h中引入头文件gstmpdcontentcomponentnode.h
2 加载dash插件
挂载系统
hdc shell mount -o rw,remount -t auto /
清除插件加载缓存
hdc shell rm -rf /.cache/gstreamer-1.0
重新加载插件信息
GST_DEBUG=2,GST_PLUGIN_LOADING:5,GST_REGISTRY:5 gst-inspect
dash解析加密信息
qtdemux_sink_activate_mode GST_PAD_MODE_PUSH
gst_qtdemux_process_adapter
gst_qtdemux_configure_stream(已传入stream->subtype == FOURCC_vide)
gst_qtdemux_configure_protected_caps(“Failed to configure protected stream caps.”)
证明已经发现了该类型为cenc并且能够找到
dash插件上板后找不到依赖的库
现象是,插件数量不变,dash没有成功加载,看加载信息会发现其依赖的库找不到,但是明明就和dash在一个目录啊!原因是有些库不该在和dash 一样的位置system/lib/media/plugins
,尝试放在system/lib
(gst-inspect-1.0:1384): Gstreamer-WARNING **: 19:50:25.997: Failed to load plugin '/system/lib/media/plugins/libgstgio.z.so': Error loading shared library libgettext.z.so: No such file or directory (needed by /system/lib/libgio.z.so)
(gst-inspect-1.0:1384): Gstreamer-WARNING **: 19:50:26.016: Failed to load plugin '/system/lib/media/plugins/libgstdash.z.so': Error loading shared library libgstisoff.z.so: No such file or directory (needed by /system/lib/media/plugins/libgstdash.z.so)
(gst-inspect-1.0:1384): Gstreamer-WARNING **: 19:50:26.041: Failed to load plugin '/system/lib/media/plugins/libgstnet.z.so': Error loading shared library libgettext.z.so: No such file or directory (needed by /system/lib/libgio.z.so)
可以参考:
hdc shell mount -o rw,remount -t auto /
cd %~dp0
hdc file send .\libgio.z.so /system/lib/
hdc file send .\libgstisoff.z.so /system/lib/
hdc file send .\libgstnet.z.so /system/lib/
hdc file send .\libgettext.z.so /system/lib
hdc file send .\libgstdash.z.so /system/lib/media/plugins
hdc file send .\libgstgio.z.so /system/lib/media/plugins
hdc file send .\libgstpbutils.z.so /system/lib/media/plugins
hdc file send .\libgsturidownloader.z.so /system/lib/media/plugins
pause
播放dash码流
插件能够运行后,用python搭建一个服务器