recipes-multimedia: gstreamer: Update recipes to new BSP release imx_5.4.47_2.2.0

Includes:
gstreamer1.0: Switch branch to MM_04.05.06_2008_L5.4.47
imx-gst1.0-plugin: Switch branch to MM_04.05.06_2008_L5.4.47
gstreamer1.0-plugins-bad: Switch branch to MM_04.05.06_2008_L5.4.47
gstreamer1.0-plugins-base: Switch branch to MM_04.05.06_2008_L5.4.47
gstreamer1.0-plugins-good: Switch branch to MM_04.05.06_2008_L5.4.47

    Signed-off-by: i.MX Yocto Project Build <imx.build@nxp.com>
Added tinycompress by depencecies

Signed-off-by: Hector Bujanda <Hector.Bujanda@digi.com>
This commit is contained in:
Hector Bujanda 2020-10-29 01:29:37 +01:00
parent f776a19ac2
commit acd74f7858
10 changed files with 1441 additions and 19 deletions

View File

@ -3,14 +3,12 @@ require recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.16.2.bb
DEPENDS += "jpeg libdrm"
DEPENDS_append_imxgpu2d = " virtual/libg2d"
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/${PN}:"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
GST1.0-PLUGINS-BAD_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-bad.git;protocol=https"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "2fdaef1839ebfef7ea3bc8c1c59463a9ef0ae19a"
SRCBRANCH = "MM_04.05.06_2008_L5.4.47"
SRCREV = "3f6c1ccbabe46a709680b32ce7d5bc521854e08e"
SRC_URI = " \
${GST1.0-PLUGINS-BAD_SRC};branch=${SRCBRANCH} \
file://configure-allow-to-disable-libssh2.patch \
@ -22,6 +20,8 @@ SRC_URI = " \
S = "${WORKDIR}/git"
PACKAGECONFIG[tinycompress] = "--enable-tinycompress,--disable-tinycompress,tinycompress"
# This remove "--exclude=autopoint" option from autoreconf argument to avoid
# configure.ac:30: error: required file './ABOUT-NLS' not found
EXTRA_AUTORECONF = ""
@ -31,7 +31,7 @@ PACKAGE_ARCH_mx8 = "${MACHINE_SOCARCH}"
PACKAGECONFIG_append_mx6q = " opencv"
PACKAGECONFIG_append_mx6qp = " opencv"
PACKAGECONFIG_append_mx8 = " opencv kms"
PACKAGECONFIG_append_mx8 = " opencv kms tinycompress"
#Remove vulkan as it's incompatible for i.MX 8M Mini
PACKAGECONFIG_remove_mx8mm = " vulkan"

View File

@ -1,14 +1,12 @@
require recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.2.bb
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/${PN}:"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
GST1.0-PLUGINS-BASE_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-base.git;protocol=https"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "cad00a3c4318c787c9661990e8f9328e4a69a329"
SRCBRANCH = "MM_04.05.06_2008_L5.4.47"
SRCREV = "3c4aa2a58576d68f6e684efa58609665679c9969"
SRC_URI = " \
${GST1.0-PLUGINS-BASE_SRC};branch=${SRCBRANCH} \
file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \

View File

@ -1,13 +1,11 @@
require recipes-multimedia/gstreamer/gstreamer1.0-plugins-good_1.16.2.bb
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/${PN}:"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
GST1.0-PLUGINS-GOOD_SRC ?= "gitsm://source.codeaurora.org/external/imx/gst-plugins-good.git;protocol=https"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "fc6d8ccf3bd775517fafb1ce1d9224312d2812d8"
SRCBRANCH = "MM_04.05.06_2008_L5.4.47"
SRCREV = "a1ba15d53aab342dd921261148562f47eeed7d98"
SRC_URI = " \
${GST1.0-PLUGINS-GOOD_SRC};branch=${SRCBRANCH} \

View File

@ -1,13 +1,11 @@
require recipes-multimedia/gstreamer/gstreamer1.0_1.16.2.bb
PV = "1.16.1.imx"
FILESEXTRAPATHS_prepend := "${COREBASE}/meta/recipes-multimedia/gstreamer/files:"
# Use i.MX fork of GST for customizations
GST1.0_SRC ?= "gitsm://source.codeaurora.org/external/imx/gstreamer.git;protocol=https"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCREV = "beca1b382febc2ba38a21fcb8f5092209773eb7f"
SRCBRANCH = "MM_04.05.06_2008_L5.4.47"
SRCREV = "8514bc61ccab208a65e387eab9347276a8e770e7"
SRC_URI = " \
${GST1.0_SRC};branch=${SRCBRANCH} \
file://0001-introspection.m4-prefix-pkgconfig-paths-with-PKG_CON.patch \

View File

@ -21,12 +21,12 @@ LIC_FILES_CHKSUM = "file://COPYING-LGPL-2;md5=5f30f0716dfdd0d91eb439ebec522ec2 \
file://COPYING-LGPL-2.1;md5=fbc093901857fcd118f065f900982c24"
IMXGST_SRC ?= "git://source.codeaurora.org/external/imx/imx-gst1.0-plugin.git;protocol=https"
SRCBRANCH = "MM_04.05.05_2005_L5.4.24"
SRCBRANCH = "MM_04.05.06_2008_L5.4.47"
SRC_URI = "${IMXGST_SRC};branch=${SRCBRANCH} \
file://0001-imx-gst1.0-plugin-Update-KERNEL_VERSION-check.patch \
"
SRCREV = "4d2e5c1547c5f8a5e4e26a034ab87c809b34fb54"
SRCREV = "a4373418f5884de7d2da63581d3905f0e3a5d842"
S = "${WORKDIR}/git"

View File

@ -0,0 +1,221 @@
From 4d4bc0a958fe254531920095fbabc241aad88113 Mon Sep 17 00:00:00 2001
From: Shengjiu Wang <shengjiu.wang@nxp.com>
Date: Tue, 28 Jul 2020 13:00:36 +0800
Subject: [PATCH] cplay: Support wave file
The supported format is mono/stereo, S16_LE/S32_LE, 8kHz-192kHz.
Command is:
cplay -c x -I PCM test.wav
Upstream-Status: Inappropriate [i.MX specific]
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
include/tinycompress/wave_formats.h | 51 +++++++++++++
src/utils/cplay.c | 107 ++++++++++++++++++++++++++++
2 files changed, 158 insertions(+)
create mode 100644 include/tinycompress/wave_formats.h
diff --git a/include/tinycompress/wave_formats.h b/include/tinycompress/wave_formats.h
new file mode 100644
index 000000000000..4e2e009206cf
--- /dev/null
+++ b/include/tinycompress/wave_formats.h
@@ -0,0 +1,51 @@
+#ifndef WAVE_FORMATS_H
+#define WAVE_FORMATS_H 1
+
+#define COMPOSE_ID(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
+
+#define WAV_RIFF COMPOSE_ID('R','I','F','F')
+#define WAV_RIFX COMPOSE_ID('R','I','F','X')
+#define WAV_WAVE COMPOSE_ID('W','A','V','E')
+#define WAV_FMT COMPOSE_ID('f','m','t',' ')
+#define WAV_DATA COMPOSE_ID('d','a','t','a')
+
+/* WAVE fmt block constants from Microsoft mmreg.h header */
+#define WAV_FMT_PCM 0x0001
+#define WAV_FMT_IEEE_FLOAT 0x0003
+#define WAV_FMT_DOLBY_AC3_SPDIF 0x0092
+#define WAV_FMT_EXTENSIBLE 0xfffe
+
+/* Used with WAV_FMT_EXTENSIBLE format */
+#define WAV_GUID_TAG "\x00\x00\x00\x00\x10\x00\x80\x00\x00\xAA\x00\x38\x9B\x71"
+
+typedef struct {
+ u_int magic; /* 'RIFF' */
+ u_int length; /* filelen */
+ u_int type; /* 'WAVE' */
+} WaveHeader;
+
+typedef struct {
+ u_short format; /* see WAV_FMT_* */
+ u_short channels;
+ u_int sample_fq; /* frequence of sample */
+ u_int byte_p_sec;
+ u_short byte_p_spl; /* samplesize; 1 or 2 bytes */
+ u_short bit_p_spl; /* 8, 12 or 16 bit */
+} WaveFmtBody;
+
+typedef struct {
+ WaveFmtBody format;
+ u_short ext_size;
+ u_short bit_p_spl;
+ u_int channel_mask;
+ u_short guid_format; /* WAV_FMT_* */
+ u_char guid_tag[14]; /* WAV_GUID_TAG */
+} WaveFmtExtensibleBody;
+
+typedef struct {
+ u_int type; /* 'data' */
+ u_int length; /* samplecount */
+} WaveChunkHeader;
+
+
+#endif /* FORMATS */
diff --git a/src/utils/cplay.c b/src/utils/cplay.c
index 5b749419e731..8882f4d9746d 100644
--- a/src/utils/cplay.c
+++ b/src/utils/cplay.c
@@ -1,4 +1,6 @@
/*
+ * Copyright 2020 NXP
+ *
* This file is provided under a dual BSD/LGPLv2.1 license. When using or
* redistributing this file, you may do so under either license.
*
@@ -73,6 +75,8 @@
#include "tinycompress/tinycompress.h"
#include "tinycompress/tinymp3.h"
#include "tinycompress/id3_tag_decode.h"
+#include "tinycompress/wave_formats.h"
+#include <alsa/asoundlib.h>
static int verbose;
static const unsigned int DEFAULT_CODEC_ID = SND_AUDIOCODEC_PCM;
@@ -166,6 +170,77 @@ static int parse_mp3_header(struct mp3_header *header, unsigned int *num_channel
return 0;
}
+static int parse_wav_header(FILE *file, unsigned int *num_channels, unsigned int *sample_rate,
+ unsigned int *format) {
+ WaveHeader wave_header;
+ WaveChunkHeader chunk_header;
+ WaveFmtBody fmt_body;
+ int more_chunks = 1;
+
+ fread(&wave_header, sizeof(WaveHeader), 1, file);
+ if ((wave_header.magic != WAV_RIFF) ||
+ (wave_header.type != WAV_WAVE)) {
+ fprintf(stderr, "Error: it is not a riff/wave file\n");
+ return -1;
+ }
+
+ do {
+ fread(&chunk_header, sizeof(WaveChunkHeader), 1, file);
+ switch (chunk_header.type) {
+ case WAV_FMT:
+ fread(&fmt_body, sizeof(WaveFmtBody), 1, file);
+ /* If the format header is larger, skip the rest */
+ if (chunk_header.length > sizeof(WaveFmtBody))
+ fseek(file, chunk_header.length - sizeof(WaveFmtBody), SEEK_CUR);
+
+ *num_channels = fmt_body.channels;
+ *sample_rate = fmt_body.sample_fq;
+
+ switch (fmt_body.bit_p_spl) {
+ case 8:
+ *format = SND_PCM_FORMAT_U8;
+ break;
+ case 16:
+ *format = SND_PCM_FORMAT_S16_LE;
+ break;
+ case 24:
+ switch (fmt_body.byte_p_spl / fmt_body.channels) {
+ case 3:
+ *format = SND_PCM_FORMAT_S24_3LE;
+ break;
+ case 4:
+ *format = SND_PCM_FORMAT_S24_LE;
+ break;
+ default:
+ fprintf(stderr, "format error\n");
+ return -1;
+ }
+ break;
+ case 32:
+ if (fmt_body.format == WAV_FMT_PCM) {
+ *format = SND_PCM_FORMAT_S32_LE;
+ } else if (fmt_body.format == WAV_FMT_IEEE_FLOAT) {
+ *format = SND_PCM_FORMAT_FLOAT_LE;
+ }
+ break;
+ default:
+ fprintf(stderr, "format error\n");
+ return -1;
+ }
+ break;
+ case WAV_DATA:
+ /* Stop looking for chunks */
+ more_chunks = 0;
+ break;
+ default:
+ /* Unknown chunk, skip bytes */
+ fseek(file, chunk_header.length, SEEK_CUR);
+ }
+ } while (more_chunks);
+
+ return 0;
+}
+
static int print_time(struct compress *compress)
{
unsigned int avail;
@@ -385,6 +460,35 @@ void get_codec_iec(FILE *file, struct compr_config *config,
codec->format = 0;
}
+void get_codec_pcm(FILE *file, struct compr_config *config,
+ struct snd_codec *codec)
+{
+ unsigned int channels, rate, format;
+
+ if (parse_wav_header(file, &channels, &rate, &format) == -1) {
+ fclose(file);
+ exit(EXIT_FAILURE);
+ }
+
+ if (channels > 2 || (format != SND_PCM_FORMAT_S16_LE && format != SND_PCM_FORMAT_S32_LE) ||
+ rate > 192000) {
+ fprintf(stderr, "unsupported wave file\n");
+ fclose(file);
+ exit(EXIT_FAILURE);
+ }
+
+ codec->id = SND_AUDIOCODEC_PCM;
+ codec->ch_in = channels;
+ codec->ch_out = channels;
+ codec->sample_rate = rate;
+ codec->bit_rate = 0;
+ codec->rate_control = 0;
+ codec->profile = SND_AUDIOPROFILE_PCM;
+ codec->level = 0;
+ codec->ch_mode = 0;
+ codec->format = format;
+}
+
void play_samples(char *name, unsigned int card, unsigned int device,
unsigned long buffer_size, unsigned int frag,
unsigned long codec_id)
@@ -411,6 +515,9 @@ void play_samples(char *name, unsigned int card, unsigned int device,
case SND_AUDIOCODEC_IEC61937:
get_codec_iec(file, &config, &codec);
break;
+ case SND_AUDIOCODEC_PCM:
+ get_codec_pcm(file, &config, &codec);
+ break;
default:
fprintf(stderr, "codec ID %ld is not supported\n", codec_id);
exit(EXIT_FAILURE);
--
2.27.0

View File

@ -0,0 +1,147 @@
From 6f778c21ee357a662cdd758cff578a3e4b85eedf Mon Sep 17 00:00:00 2001
From: Zhang Peng <peng.zhang_8@nxp.com>
Date: Tue, 4 Aug 2020 15:29:29 +0800
Subject: [PATCH] cplay: Add pause feature
Add option: -p pause
Upstream-Status: Inappropriate [i.MX specific]
Signed-off-by: Zhang Peng <peng.zhang_8@nxp.com>
---
src/utils/cplay.c | 56 +++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 52 insertions(+), 4 deletions(-)
diff --git a/src/utils/cplay.c b/src/utils/cplay.c
index 8882f4d..8e3dcbb 100644
--- a/src/utils/cplay.c
+++ b/src/utils/cplay.c
@@ -117,6 +117,9 @@ static void usage(void)
"-f\tfragments\n\n"
"-v\tverbose mode\n"
"-h\tPrints this help list\n\n"
+ "-p\tpause\n"
+ "-m\tpause blocks\n"
+ "-n\tpause time duration\n"
"Example:\n"
"\tcplay -c 1 -d 2 test.mp3\n"
"\tcplay -f 5 test.mp3\n\n"
@@ -133,7 +136,8 @@ static void usage(void)
void play_samples(char *name, unsigned int card, unsigned int device,
unsigned long buffer_size, unsigned int frag,
- unsigned long codec_id);
+ unsigned long codec_id, int pause_count, int pause_block,
+ int pause_duration);
struct mp3_header {
uint16_t sync;
@@ -262,12 +266,15 @@ int main(int argc, char **argv)
int c, i;
unsigned int card = 0, device = 0, frag = 0;
unsigned int codec_id = SND_AUDIOCODEC_MP3;
+ int pause_count = 0;
+ int pause_block = 6;
+ int pause_duration = 10;
if (argc < 2)
usage();
verbose = 0;
- while ((c = getopt(argc, argv, "hvb:f:c:d:I:")) != -1) {
+ while ((c = getopt(argc, argv, "hvb:f:c:d:I:p:m:n:")) != -1) {
switch (c) {
case 'h':
usage();
@@ -306,6 +313,23 @@ int main(int argc, char **argv)
case 'v':
verbose = 1;
break;
+ case 'p':
+ pause_count = strtol(optarg, NULL, 10);
+ break;
+ case 'm':
+ pause_block = strtol(optarg, NULL, 10);
+ if (pause_duration < 0) {
+ printf("Set wrong paramter! Set duration default 6.\n");
+ pause_duration = 6;
+ }
+ break;
+ case 'n':
+ pause_duration = strtol(optarg, NULL, 10);
+ if (pause_duration < 0) {
+ printf("Set wrong paramter! Set duration default 10.\n");
+ pause_duration = 10;
+ }
+ break;
default:
exit(EXIT_FAILURE);
}
@@ -315,7 +339,7 @@ int main(int argc, char **argv)
file = argv[optind];
- play_samples(file, card, device, buffer_size, frag, codec_id);
+ play_samples(file, card, device, buffer_size, frag, codec_id, pause_count, pause_block, pause_duration);
fprintf(stderr, "Finish Playing.... Close Normally\n");
exit(EXIT_SUCCESS);
@@ -491,7 +515,8 @@ void get_codec_pcm(FILE *file, struct compr_config *config,
void play_samples(char *name, unsigned int card, unsigned int device,
unsigned long buffer_size, unsigned int frag,
- unsigned long codec_id)
+ unsigned long codec_id, int pause_count, int pause_block,
+ int pause_duration)
{
struct compr_config config;
struct snd_codec codec;
@@ -499,6 +524,7 @@ void play_samples(char *name, unsigned int card, unsigned int device,
FILE *file;
char *buffer;
int size, num_read, wrote;
+ int write_count = 0;
if (verbose)
printf("%s: entry\n", __func__);
@@ -574,6 +600,13 @@ void play_samples(char *name, unsigned int card, unsigned int device,
if (verbose)
printf("%s: You should hear audio NOW!!!\n", __func__);
+ if (pause_count > 0) {
+ printf("sleep...\n");
+ compress_pause(compress);
+ sleep(pause_duration);
+ compress_resume(compress);
+ }
+
do {
num_read = fread(buffer, 1, size, file);
if (num_read > 0) {
@@ -592,8 +625,23 @@ void play_samples(char *name, unsigned int card, unsigned int device,
printf("%s: wrote %d\n", __func__, wrote);
}
}
+ write_count++;
+ if ((pause_count > 0) && (write_count % pause_block == 0)) {
+ printf("pause...\n");
+ compress_pause(compress);
+ sleep(pause_duration);
+ printf("pause release...\n");
+ compress_resume(compress);
+ pause_count--;
+ }
} while (num_read > 0);
+ if (pause_count > 0) {
+ compress_pause(compress);
+ sleep(5);
+ compress_resume(compress);
+ }
+
if (verbose)
printf("%s: exit success\n", __func__);
/* issue drain if it supports */
--
2.17.1

View File

@ -0,0 +1,41 @@
From a2892bf5db7520689fa9cb1d1589fa804bd9dc1a Mon Sep 17 00:00:00 2001
From: Bing Song <bing.song@nxp.com>
Date: Tue, 18 Aug 2020 15:26:51 +0800
Subject: [PATCH] tinycompress: pass NULL buffer with 0 size to driver.
The NULL buffer with 0 size to indecate driver drain input data with
non-block mode. The defaul drain is block mode.
upstream status: imx specific
Signed-off-by: Bing Song <bing.song@nxp.com>
---
src/lib/compress.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/lib/compress.c b/src/lib/compress.c
index bba4fcf..d66df0b 100644
--- a/src/lib/compress.c
+++ b/src/lib/compress.c
@@ -315,7 +315,8 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size
fds.events = POLLOUT;
/*TODO: treat auto start here first */
- while (size) {
+ /* NULL buffer with 0 size for non-block drain */
+ do {
if (ioctl(compress->fd, SNDRV_COMPRESS_AVAIL, &avail))
return oops(compress, errno, "cannot get avail");
@@ -357,7 +358,7 @@ int compress_write(struct compress *compress, const void *buf, unsigned int size
size -= written;
cbuf += written;
total += written;
- }
+ } while (size);
return total;
}
--
2.17.1

View File

@ -0,0 +1,18 @@
SUMMARY = "tinycompress library for compress audio offload in alsa"
DESCRIPTION = "A library to handle compressed formats like MP3 etc"
LICENSE = "BSD-3-Clause"
inherit autotools pkgconfig
LIC_FILES_CHKSUM = "file://COPYING;md5=cf9105c1a2d4405cbe04bbe3367373a0"
DEPENDS_append = " alsa-lib"
SRC_URI = "git://git.alsa-project.org/tinycompress.git;protocol=git;branch=master \
file://0001-tinycompress-Add-id3-decoding.patch \
file://0002-cplay-Support-wave-file.patch \
file://0003-cplay-Add-pause-feature.patch \
file://0004-tinycompress-pass-NULL-buffer-with-0-size-to-driver.patch \
"
SRCREV = "995f2ed91045dad8c20485ab1a64727d22cd92e5"
S = "${WORKDIR}/git"