From patchwork Tue Mar 14 09:45:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Liu X-Patchwork-Id: 20902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id D88DBC6FD1D for ; Tue, 14 Mar 2023 09:45:10 +0000 (UTC) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mx.groups.io with SMTP id smtpd.web10.4754.1678787108939551532 for ; Tue, 14 Mar 2023 02:45:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=K+7asxs9; spf=pass (domain: gmail.com, ip: 209.85.167.48, mailfrom: liu.ming50@gmail.com) Received: by mail-lf1-f48.google.com with SMTP id n2so19136444lfb.12 for ; Tue, 14 Mar 2023 02:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678787107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Hi7jPlrVwdFmQCO8qGglrgUVXLhSOByxE24E4uMuq8A=; b=K+7asxs9N/ftCB2f9niUZaTFg1PEbsBMemKTiaxM13g+lPlYMXAEqchhJ6tWPgPxxv EoBv/2s52hj63k2H0twVoiB3dPPnS8WGNPSxNbwURU8urdeMBbRpR2euRjvkySOpNXFy gPRkeYYhlqx7vDLHl1Thb2dZCw1D/id+ohT1F1QSH+wPr7pqtk8X4DU1jgvYZ3Fi3897 ojhN7lMUzJwVvjGBw4BYAm6Z4WruSaMLAHWlhL/9F6YKDL31/+7P/UBW1xTJaN4gOmhV RrO2MLdiHCYfBrWadGkZ2wmweBe2ben7EWWER0gixaJbBuNOut134buxLvXASXVg26yO Nu/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678787107; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Hi7jPlrVwdFmQCO8qGglrgUVXLhSOByxE24E4uMuq8A=; b=5g9Q3FklmpbSttUadUupgFussMo9qMSy86RgayfiMixvyjR/ly8VC0QLVLMcFgsJea z+TRdR0Hvzj77x32gXAfyMVs7v3lgsy5xFVIppTz9/JPCHdshH/2E5rCa89T2/lPsPWV DXrc7ehVfDxiN8Oy+dwO0LqGggblO02tSkAljRYtNJAl/C9DTVUw8AlUDFF3sEqcA0Ls dGO8nW1f7PuIQr2jraCtUGH4rKi2KQRdQJEhJl4+GbAQ90M+dl7shBt+dAKoKaIcxGTM LxUi4hpQcW2JSLF0LV6ix/+3cKxKoAf2dDndx2bPbEGMR+9Y5g8ldc8UJRxC2jm6zSTq 5nuA== X-Gm-Message-State: AO0yUKVZ+g1RjWTEVx0VdQxlcxMBAPNNNLQ3ExV1OMNY6fKY3W1aqC37 7dhM0Cu01+tQH62eG5EJmcapvUFwD5U= X-Google-Smtp-Source: AK7set9r6L44t5Ymp5URINxEvCaHIR28eu9kqcn+nq0hdvbUIj6Bcq+EGTm3pH4kCfd4/rcQhDVQIA== X-Received: by 2002:ac2:597a:0:b0:4dd:a060:402d with SMTP id h26-20020ac2597a000000b004dda060402dmr592754lfp.15.1678787106769; Tue, 14 Mar 2023 02:45:06 -0700 (PDT) Received: from peterliu-Precision-7530.emea.group.atlascopco.com (customer-212-100-112-191.stosn.net. [212.100.112.191]) by smtp.gmail.com with ESMTPSA id y26-20020ac255ba000000b004cb10c151fasm333086lfg.88.2023.03.14.02.45.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 02:45:06 -0700 (PDT) From: liu.ming50@gmail.com To: meta-freescale@lists.yoctoproject.org Cc: Ming Liu Subject: [meta-freescale] [PATCH V2 1/1] gstreamer1.0-plugins-base: set default videosink for IMXQM/IMXQXP Date: Tue, 14 Mar 2023 10:45:00 +0100 Message-Id: <20230314094500.125826-2-liu.ming50@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230314094500.125826-1-liu.ming50@gmail.com> References: <20230314094500.125826-1-liu.ming50@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 14 Mar 2023 09:45:10 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/meta-freescale/message/24912 From: Ming Liu The default 'autovideosink' gives very bad performance when playing H264/H265 videos on IMXQM/IMXQXP machines. Let's choose 'imxvideoconvert_g2d ! autovideosink' as the default videosink, so the end users dont need manually pass 'imxvideoconvert_g2d' pipeline to gst-play-1.0. Signed-off-by: Ming Liu --- ...e-default-videosink-autosink-options.patch | 106 ++++++++++++++++++ .../gstreamer1.0-plugins-base_1.20.3.imx.bb | 14 ++- 2 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-Introduce-default-videosink-autosink-options.patch diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-Introduce-default-videosink-autosink-options.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-Introduce-default-videosink-autosink-options.patch new file mode 100644 index 00000000..9465899e --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-Introduce-default-videosink-autosink-options.patch @@ -0,0 +1,106 @@ +From c929a3fd4a10a2d5f57933b40447aa76ce0b6c5a Mon Sep 17 00:00:00 2001 +From: Ming Liu +Date: Sun, 5 Mar 2023 13:52:05 +0100 +Subject: [PATCH] Introduce default videosink/autosink options + +So the end users can choose the default videosink/autosink at build +time. It now supports pipeline as default videosink/autosink. + +Upstream-Status: Submitted [https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1299] + +Signed-off-by: Ming Liu +--- + gst/playback/gstplaysink.c | 10 ++++++++-- + meson.build | 5 ++--- + meson_options.txt | 5 +++++ + tools/gst-play.c | 7 +++++++ + 4 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c +index dc8bfdacd..1abb4ac7e 100755 +--- a/gst/playback/gstplaysink.c ++++ b/gst/playback/gstplaysink.c +@@ -1770,7 +1770,10 @@ gen_video_chain (GstPlaySink * playsink, gboolean raw, gboolean async) + /* if default sink from config.h is different then try it too */ + if (strcmp (DEFAULT_VIDEOSINK, "autovideosink")) { + GST_DEBUG_OBJECT (playsink, "trying " DEFAULT_VIDEOSINK); +- elem = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink"); ++ if (strchr (DEFAULT_VIDEOSINK, ' ') != NULL) ++ elem = gst_parse_bin_from_description (DEFAULT_VIDEOSINK, TRUE, NULL); ++ else ++ elem = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink"); + chain->sink = try_element (playsink, elem, TRUE); + } + } +@@ -2713,7 +2716,10 @@ gen_audio_chain (GstPlaySink * playsink, gboolean raw) + /* if default sink from config.h is different then try it too */ + if (strcmp (DEFAULT_AUDIOSINK, "autoaudiosink")) { + GST_DEBUG_OBJECT (playsink, "trying " DEFAULT_AUDIOSINK); +- elem = gst_element_factory_make (DEFAULT_AUDIOSINK, "audiosink"); ++ if (strchr (DEFAULT_AUDIOSINK, ' ') != NULL) ++ elem = gst_parse_bin_from_description (DEFAULT_AUDIOSINK, TRUE, NULL); ++ else ++ elem = gst_element_factory_make (DEFAULT_AUDIOSINK, "audiosink"); + chain->sink = try_element (playsink, elem, TRUE); + } + } +diff --git a/meson.build b/meson.build +index 5ad1ab3ad..a6280eccd 100644 +--- a/meson.build ++++ b/meson.build +@@ -280,9 +280,8 @@ endif + core_conf.set_quoted('GST_PACKAGE_NAME', gst_package_name) + core_conf.set_quoted('GST_PACKAGE_ORIGIN', get_option('package-origin')) + +-# FIXME: These should be configure options +-core_conf.set_quoted('DEFAULT_VIDEOSINK', 'autovideosink') +-core_conf.set_quoted('DEFAULT_AUDIOSINK', 'autoaudiosink') ++core_conf.set_quoted('DEFAULT_VIDEOSINK', get_option('defaultvideosink')) ++core_conf.set_quoted('DEFAULT_AUDIOSINK', get_option('defaultaudiosink')) + + # Set whether the audioresampling method should be detected at runtime + core_conf.set('AUDIORESAMPLE_FORMAT_' + get_option('audioresample_format').to_upper(), true) +diff --git a/meson_options.txt b/meson_options.txt +index 7010b9162..49bd1a728 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -21,6 +21,11 @@ option('opengl_module_name', type : 'string', value : '', + option('gles2_module_name', type : 'string', value : '', + description : 'The file to pass to g_module_open to open the libGLESv2 library (default: libGLESv2)') + ++option('defaultaudiosink', type : 'string', value : 'autoaudiosink', ++ description : 'The default audiosink') ++option('defaultvideosink', type : 'string', value : 'autovideosink', ++ description : 'The default videosink') ++ + # Feature option for opengl plugin and integration library + option('gl', type : 'feature', value : 'auto', description : 'OpenGL integration library and OpenGL plugin') + option('gl-graphene', type : 'feature', value : 'auto', description : 'Use Graphene in OpenGL plugin') +diff --git a/tools/gst-play.c b/tools/gst-play.c +index 0e858d282..4c1e92e42 100644 +--- a/tools/gst-play.c ++++ b/tools/gst-play.c +@@ -205,6 +205,7 @@ play_new (gchar ** uris, const gchar * audio_sink, const gchar * video_sink, + else + g_warning ("Couldn't create specified audio sink '%s'", audio_sink); + } ++ + if (video_sink != NULL) { + if (strchr (video_sink, ' ') != NULL) + sink = gst_parse_bin_from_description (video_sink, TRUE, NULL); +@@ -1674,6 +1675,12 @@ main (int argc, char **argv) + playlist_file = NULL; + } + ++ if (audio_sink == NULL) ++ audio_sink = g_strdup(DEFAULT_AUDIOSINK); ++ ++ if (video_sink == NULL) ++ video_sink = g_strdup(DEFAULT_VIDEOSINK); ++ + if (playlist->len == 0 && (filenames == NULL || *filenames == NULL)) { + gst_printerr (_("Usage: %s FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ..."), + "gst-play-" GST_API_VERSION); +-- +2.25.1 + diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.3.imx.bb b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.3.imx.bb index 0ef9daea..b3da7438 100644 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.3.imx.bb +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.20.3.imx.bb @@ -121,7 +121,9 @@ SRC_URI:remove = " \ file://0003-viv-fb-Make-sure-config.h-is-included.patch \ file://0002-ssaparse-enhance-SSA-text-lines-parsing.patch" SRC_URI:prepend = "${GST1.0-PLUGINS-BASE_SRC};branch=${SRCBRANCH} " -SRC_URI += "file://0001-gstallocatorphymem.c-Typecast-result-of-gst_phymem_g.patch" +SRC_URI:append = " \ + file://0001-gstallocatorphymem.c-Typecast-result-of-gst_phymem_g.patch \ + file://0001-Introduce-default-videosink-autosink-options.patch" GST1.0-PLUGINS-BASE_SRC ?= "gitsm://github.com/nxp-imx/gst-plugins-base.git;protocol=https" SRCBRANCH = "MM_04.07.02_2210_L5.15.y" SRCREV = "cbf542ce3e0bad1009d5ecf72707e870c375c3f0" @@ -130,6 +132,9 @@ S = "${WORKDIR}/git" inherit use-imx-headers +DEFAULT_AUDIOSINK ?= "autoaudiosink" +DEFAULT_VIDEOSINK ?= "autovideosink" + PACKAGECONFIG_GL:imxgpu2d = \ "${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'opengl viv-fb', '', d)}" PACKAGECONFIG_GL:imxgpu3d = \ @@ -144,7 +149,12 @@ PACKAGECONFIG:append:imxgpu2d = " g2d" PACKAGECONFIG[g2d] = ",,virtual/libg2d" PACKAGECONFIG[viv-fb] = ",,virtual/libgles2" -EXTRA_OEMESON += "-Dc_args="${CFLAGS} -I${STAGING_INCDIR_IMX}"" +DEFAULT_AUDIOSINK ?= "autoaudiosink" +DEFAULT_VIDEOSINK ?= "autovideosink" +DEFAULT_VIDEOSINK:mx8qm-nxp-bsp = "imxvideoconvert_g2d ! autovideosink" +DEFAULT_VIDEOSINK:mx8qxp-nxp-bsp = "imxvideoconvert_g2d ! autovideosink" + +EXTRA_OEMESON += "-Ddefaultaudiosink="${DEFAULT_AUDIOSINK}" -Ddefaultvideosink="${DEFAULT_VIDEOSINK}" -Dc_args="${CFLAGS} -I${STAGING_INCDIR_IMX}"" # links with imx-gpu libs which are pre-built for glibc # gcompat will address it during runtime