-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PCM renderer component component based on non-blocking ALSA apis. Closes
#7.
- Loading branch information
Juan A. Rubio
committed
Jul 30, 2013
1 parent
b6b86e8
commit 5263fc4
Showing
18 changed files
with
1,982 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
|
||
SUBDIRS = \ | ||
audio_renderer \ | ||
audio_renderer_non_block \ | ||
file_reader \ | ||
file_writer \ | ||
mp3_decoder \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2011-2013 Aratelia Limited - Juan A. Rubio | ||
# | ||
# This file is part of Tizonia | ||
# | ||
# Tizonia is free software: you can redistribute it and/or modify it under the | ||
# terms of the GNU Lesser General Public License as published by the Free | ||
# Software Foundation, either version 3 of the License, or (at your option) | ||
# any later version. | ||
# | ||
# Tizonia is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with Tizonia. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
|
||
SUBDIRS= src tests | ||
|
||
#pkgconfigdir = $(libdir)/pkgconfig | ||
#pkgconfig_DATA = tizcomps.pc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright (C) 2011-2013 Aratelia Limited - Juan A. Rubio | ||
# | ||
# This file is part of Tizonia | ||
# | ||
# Tizonia is free software: you can redistribute it and/or modify it under the | ||
# terms of the GNU Lesser General Public License as published by the Free | ||
# Software Foundation, either version 3 of the License, or (at your option) | ||
# any later version. | ||
# | ||
# Tizonia is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with Tizonia. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
AC_PREREQ([2.67]) | ||
AC_INIT([libtizarnb], [0.1.0], [juan.rubio@aratelia.com]) | ||
AC_CONFIG_AUX_DIR([.]) | ||
AM_INIT_AUTOMAKE([foreign color-tests silent-rules -Wall -Werror]) | ||
AC_CONFIG_SRCDIR([config.h.in]) | ||
AC_CONFIG_HEADERS([config.h]) | ||
|
||
|
||
|
||
# Checks for programs. | ||
AC_PROG_CXX | ||
AC_PROG_AWK | ||
AC_PROG_CC | ||
AM_PROG_CC_C_O | ||
AC_PROG_GCC_TRADITIONAL | ||
LT_INIT | ||
AC_PROG_INSTALL | ||
AC_PROG_LN_S | ||
AC_PROG_MAKE_SET | ||
PKG_PROG_PKG_CONFIG() | ||
|
||
# Checks for libraries. | ||
PKG_CHECK_MODULES([ALSA], [alsa]) | ||
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4]) | ||
#PKG_CHECK_MODULES([KHROMTIZ12], [libkhromxil12]) | ||
#PKG_CHECK_MODULES([TIZ], [libtizosal]) | ||
#PKG_CHECK_MODULES([TIZCORE], [libtizcore]) | ||
|
||
# Checks for header files. | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
|
||
# Checks for library functions. | ||
|
||
|
||
AC_CONFIG_FILES([Makefile | ||
src/Makefile | ||
tests/Makefile]) | ||
|
||
# End the configure script. | ||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Copyright (C) 2011-2013 Aratelia Limited - Juan A. Rubio | ||
# | ||
# This file is part of Tizonia | ||
# | ||
# Tizonia is free software: you can redistribute it and/or modify it under the | ||
# terms of the GNU Lesser General Public License as published by the Free | ||
# Software Foundation, either version 3 of the License, or (at your option) | ||
# any later version. | ||
# | ||
# Tizonia is distributed in the hope that it will be useful, but WITHOUT ANY | ||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public License | ||
# along with Tizonia. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
lib_LTLIBRARIES = libtizarnb.la | ||
|
||
noinst_HEADERS = \ | ||
arprc.h \ | ||
arprc_decls.h | ||
|
||
libtizarnb_la_SOURCES = \ | ||
ar.c \ | ||
arprc.c | ||
|
||
libtizarnb_la_CFLAGS = \ | ||
-I$(top_srcdir)/../../include/omxil-1.2 \ | ||
-I$(top_srcdir)/../../libtizosal/src \ | ||
-I$(top_srcdir)/../../libtizonia/src \ | ||
@ALSA_CFLAGS@ | ||
|
||
libtizarnb_la_LIBADD = \ | ||
$(top_builddir)/../../libtizosal/src/libtizosal.la \ | ||
$(top_builddir)/../../libtizonia/src/libtizonia.la \ | ||
@ALSA_LIBS@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
/** | ||
* Copyright (C) 2011-2013 Aratelia Limited - Juan A. Rubio | ||
* | ||
* This file is part of Tizonia | ||
* | ||
* Tizonia is free software: you can redistribute it and/or modify it under the | ||
* terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation, either version 3 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* Tizonia is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with Tizonia. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/** | ||
* @file audio_renderer.c | ||
* @author Juan A. Rubio <juan.rubio@aratelia.com> | ||
* | ||
* @brief Tizonia OpenMAX IL - PCM Audio Renderer based on ALSA | ||
* | ||
* | ||
*/ | ||
|
||
#ifdef HAVE_CONFIG_H | ||
#include <config.h> | ||
#endif | ||
|
||
#include <assert.h> | ||
#include <string.h> | ||
|
||
#include "OMX_Core.h" | ||
#include "OMX_Component.h" | ||
#include "OMX_Types.h" | ||
|
||
#include "tizosal.h" | ||
#include "tizutils.h" | ||
#include "tizscheduler.h" | ||
#include "tizpcmport.h" | ||
#include "tizconfigport.h" | ||
#include "arprc.h" | ||
|
||
#ifdef TIZ_LOG_CATEGORY_NAME | ||
#undef TIZ_LOG_CATEGORY_NAME | ||
#define TIZ_LOG_CATEGORY_NAME "tiz.audio_renderer" | ||
#endif | ||
|
||
#define ARATELIA_AUDIO_RENDERER_DEFAULT_ROLE "audio_renderer.pcm" | ||
#define ARATELIA_AUDIO_RENDERER_COMPONENT_NAME "OMX.Aratelia.audio_renderer_nb.pcm" | ||
#define ARATELIA_AUDIO_RENDERER_PORT_INDEX 0 /* With libtizonia, port indexes must start at index 0 */ | ||
#define ARATELIA_AUDIO_RENDERER_PORT_MIN_BUF_COUNT 2 | ||
#define ARATELIA_AUDIO_RENDERER_PORT_MIN_BUF_SIZE 1024 | ||
#define ARATELIA_AUDIO_RENDERER_PORT_NONCONTIGUOUS OMX_FALSE | ||
#define ARATELIA_AUDIO_RENDERER_PORT_ALIGNMENT 0 | ||
#define ARATELIA_AUDIO_RENDERER_PORT_SUPPLIERPREF OMX_BufferSupplyInput | ||
|
||
static OMX_VERSIONTYPE audio_renderer_version = { {1, 0, 0, 0} }; | ||
|
||
static OMX_PTR | ||
instantiate_pcm_port (OMX_HANDLETYPE ap_hdl) | ||
{ | ||
OMX_PTR p_pcmport = NULL; | ||
OMX_AUDIO_PARAM_PCMMODETYPE pcmmode; | ||
OMX_AUDIO_CONFIG_VOLUMETYPE volume; | ||
OMX_AUDIO_CONFIG_MUTETYPE mute; | ||
OMX_AUDIO_CODINGTYPE encodings[] = { | ||
OMX_AUDIO_CodingPCM, | ||
OMX_AUDIO_CodingMax | ||
}; | ||
tiz_port_options_t port_opts = { | ||
OMX_PortDomainAudio, | ||
OMX_DirInput, | ||
ARATELIA_AUDIO_RENDERER_PORT_MIN_BUF_COUNT, | ||
ARATELIA_AUDIO_RENDERER_PORT_MIN_BUF_SIZE, | ||
ARATELIA_AUDIO_RENDERER_PORT_NONCONTIGUOUS, | ||
ARATELIA_AUDIO_RENDERER_PORT_ALIGNMENT, | ||
ARATELIA_AUDIO_RENDERER_PORT_SUPPLIERPREF, | ||
{ARATELIA_AUDIO_RENDERER_PORT_INDEX, NULL, NULL, NULL}, | ||
-1 /* use -1 for now */ | ||
}; | ||
|
||
/* Instantiate the pcm port */ | ||
pcmmode.nSize = sizeof (OMX_AUDIO_PARAM_PCMMODETYPE); | ||
pcmmode.nVersion.nVersion = OMX_VERSION; | ||
pcmmode.nPortIndex = ARATELIA_AUDIO_RENDERER_PORT_INDEX; | ||
pcmmode.nChannels = 2; | ||
pcmmode.eNumData = OMX_NumericalDataSigned; | ||
pcmmode.eEndian = OMX_EndianLittle; | ||
pcmmode.bInterleaved = OMX_TRUE; | ||
pcmmode.nBitPerSample = 16; | ||
pcmmode.nSamplingRate = 48000; | ||
pcmmode.ePCMMode = OMX_AUDIO_PCMModeLinear; | ||
pcmmode.eChannelMapping[0] = OMX_AUDIO_ChannelLF; | ||
pcmmode.eChannelMapping[1] = OMX_AUDIO_ChannelRF; | ||
|
||
|
||
volume.nSize = sizeof (OMX_AUDIO_CONFIG_VOLUMETYPE); | ||
volume.nVersion.nVersion = OMX_VERSION; | ||
volume.nPortIndex = ARATELIA_AUDIO_RENDERER_PORT_INDEX; | ||
volume.bLinear = OMX_FALSE; | ||
volume.sVolume.nValue = 50; | ||
volume.sVolume.nMin = 0; | ||
volume.sVolume.nMax = 100; | ||
|
||
|
||
mute.nSize = sizeof (OMX_AUDIO_CONFIG_MUTETYPE); | ||
mute.nVersion.nVersion = OMX_VERSION; | ||
mute.nPortIndex = ARATELIA_AUDIO_RENDERER_PORT_INDEX; | ||
mute.bMute = OMX_FALSE; | ||
|
||
tiz_pcmport_init (); | ||
p_pcmport = factory_new (tizpcmport, &port_opts, &encodings, | ||
&pcmmode, &volume, &mute); | ||
assert (p_pcmport); | ||
|
||
return p_pcmport; | ||
} | ||
|
||
static OMX_PTR | ||
instantiate_config_port (OMX_HANDLETYPE ap_hdl) | ||
{ | ||
OMX_PTR p_cport = NULL; | ||
|
||
/* Instantiate the config port */ | ||
tiz_configport_init (); | ||
p_cport = factory_new (tizconfigport, NULL, /* this port does not take options */ | ||
ARATELIA_AUDIO_RENDERER_COMPONENT_NAME, | ||
audio_renderer_version); | ||
assert (p_cport); | ||
|
||
return p_cport; | ||
} | ||
|
||
static OMX_PTR | ||
instantiate_processor (OMX_HANDLETYPE ap_hdl) | ||
{ | ||
OMX_PTR p_proc = NULL; | ||
|
||
/* Instantiate the processor */ | ||
ar_prc_init (); | ||
p_proc = factory_new (arprc, ap_hdl); | ||
assert (p_proc); | ||
|
||
return p_proc; | ||
} | ||
|
||
OMX_ERRORTYPE | ||
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl) | ||
{ | ||
tiz_role_factory_t role_factory; | ||
const tiz_role_factory_t *rf_list[] = { &role_factory }; | ||
|
||
assert (ap_hdl); | ||
|
||
TIZ_LOG (TIZ_TRACE, "OMX_ComponentInit: Inititializing [%s]", | ||
ARATELIA_AUDIO_RENDERER_COMPONENT_NAME); | ||
|
||
strcpy ((OMX_STRING) role_factory.role, | ||
ARATELIA_AUDIO_RENDERER_DEFAULT_ROLE); | ||
role_factory.pf_cport = instantiate_config_port; | ||
role_factory.pf_port[0] = instantiate_pcm_port; | ||
role_factory.nports = 1; | ||
role_factory.pf_proc = instantiate_processor; | ||
|
||
tiz_comp_init (ap_hdl, ARATELIA_AUDIO_RENDERER_COMPONENT_NAME); | ||
|
||
tiz_comp_register_roles (ap_hdl, rf_list, 1); | ||
|
||
return OMX_ErrorNone; | ||
} |
Oops, something went wrong.