OpenMAXBellagio  0.9.3
omx_base_audio_port.c
Go to the documentation of this file.
1 
26 #include <string.h>
27 #include <unistd.h>
28 #include <omxcore.h>
29 #include <OMX_Core.h>
30 #include <OMX_Component.h>
31 
32 #include "omx_base_component.h"
33 #include "omx_base_audio_port.h"
34 
51 OMX_ERRORTYPE base_audio_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,omx_base_PortType **openmaxStandPort,OMX_U32 nPortIndex, OMX_BOOL isInput) {
53  omx_base_audio_PortType *omx_base_audio_Port;
54 
55  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s of component %p\n", __func__, openmaxStandComp);
56  if (!(*openmaxStandPort)) {
57  *openmaxStandPort = calloc(1, sizeof(omx_base_audio_PortType));
58  }
59 
60  if (!(*openmaxStandPort)) {
62  }
63 
64  err = base_port_Constructor(openmaxStandComp,openmaxStandPort,nPortIndex, isInput);
65  if (err != OMX_ErrorNone) {
66  DEBUG(DEB_LEV_ERR, "In %s base port constructor failed\n", __func__);
67  return err;
68  }
69 
70  omx_base_audio_Port = (omx_base_audio_PortType *)*openmaxStandPort;
71 
72  setHeader(&omx_base_audio_Port->sAudioParam, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE));
73  omx_base_audio_Port->sAudioParam.nPortIndex = nPortIndex;
74  omx_base_audio_Port->sAudioParam.nIndex = 0;
75  omx_base_audio_Port->sAudioParam.eEncoding = OMX_AUDIO_CodingUnused;
76 
77  omx_base_audio_Port->sPortParam.eDomain = OMX_PortDomainAudio;
78  omx_base_audio_Port->sPortParam.format.audio.cMIMEType = malloc(DEFAULT_MIME_STRING_LENGTH);
79  if (!omx_base_audio_Port->sPortParam.format.audio.cMIMEType) {
80  DEBUG(DEB_LEV_ERR, "Memory allocation failed in %s\n", __func__);
82  }
83  strcpy(omx_base_audio_Port->sPortParam.format.audio.cMIMEType, "raw/audio");
84  omx_base_audio_Port->sPortParam.format.audio.pNativeRender = 0;
85  omx_base_audio_Port->sPortParam.format.audio.bFlagErrorConcealment = OMX_FALSE;
87 
89 
90  omx_base_audio_Port->PortDestructor = &base_audio_port_Destructor;
91 
92  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s of component %p\n", __func__, openmaxStandComp);
93  return OMX_ErrorNone;
94 }
95 
110  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s of port %p\n", __func__, openmaxStandPort);
111  if(openmaxStandPort->sPortParam.format.audio.cMIMEType) {
112  free(openmaxStandPort->sPortParam.format.audio.cMIMEType);
113  openmaxStandPort->sPortParam.format.audio.cMIMEType = NULL;
114  }
115  err = base_port_Destructor(openmaxStandPort);
116  if (err != OMX_ErrorNone) {
117  DEBUG(DEB_LEV_ERR, "In %s base port destructor failed\n", __func__);
118  return err;
119  }
120  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s of port %p\n", __func__, openmaxStandPort);
121  return OMX_ErrorNone;
122 }
OMX_AUDIO_PORTDEFINITIONTYPE::bFlagErrorConcealment
OMX_BOOL bFlagErrorConcealment
Definition: OMX_Audio.h:109
DEB_LEV_FUNCTION_NAME
#define DEB_LEV_FUNCTION_NAME
Definition: omx_comp_debug_levels.h:59
OMX_AUDIO_PARAM_PORTFORMATTYPE::nPortIndex
OMX_U32 nPortIndex
Definition: OMX_Audio.h:122
DEBUG
#define DEBUG(n, fmt, args...)
Definition: omx_comp_debug_levels.h:77
OMX_PARAM_PORTDEFINITIONTYPE::audio
OMX_AUDIO_PORTDEFINITIONTYPE audio
Definition: OMX_Component.h:79
OMX_ERRORTYPE
OMX_ERRORTYPE
Definition: OMX_Core.h:127
OMX_AUDIO_PARAM_PORTFORMATTYPE::eEncoding
OMX_AUDIO_CODINGTYPE eEncoding
Definition: OMX_Audio.h:124
OMX_U32
unsigned long OMX_U32
Definition: OMX_Types.h:145
OMX_TRUE
@ OMX_TRUE
Definition: OMX_Types.h:191
OMX_AUDIO_PORTDEFINITIONTYPE::cMIMEType
OMX_STRING cMIMEType
Definition: OMX_Audio.h:105
OMX_AUDIO_CodingUnused
@ OMX_AUDIO_CodingUnused
Definition: OMX_Audio.h:64
OMX_Core.h
OMX_AUDIO_PARAM_PORTFORMATTYPE::nIndex
OMX_U32 nIndex
Definition: OMX_Audio.h:123
DEB_LEV_ERR
#define DEB_LEV_ERR
Definition: omx_comp_debug_levels.h:39
DEFAULT_MIME_STRING_LENGTH
#define DEFAULT_MIME_STRING_LENGTH
Definition: omx_base_component.h:58
base_port_Constructor
OMX_ERRORTYPE base_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
The base contructor for the generic OpenMAX ST port.
Definition: omx_base_port.c:55
omxcore.h
DEFAULT_OUT_BUFFER_SIZE
#define DEFAULT_OUT_BUFFER_SIZE
Definition: omx_base_component.h:56
omx_base_audio_PortType::PortDestructor
OMX_ERRORTYPE(* PortDestructor)(omx_base_PortType *openmaxStandPort)
Definition: omx_base_audio_port.h:44
OMX_Component.h
OMX_PARAM_PORTDEFINITIONTYPE::format
union OMX_PARAM_PORTDEFINITIONTYPE::@0 format
base_audio_port_Destructor
OMX_ERRORTYPE base_audio_port_Destructor(omx_base_PortType *openmaxStandPort)
The base audio port destructor for the generic OpenMAX ST Audio port.
Definition: omx_base_audio_port.c:108
omx_base_component.h
OMX_AUDIO_PORTDEFINITIONTYPE::eEncoding
OMX_AUDIO_CODINGTYPE eEncoding
Definition: OMX_Audio.h:111
omx_base_audio_PortType::sPortParam
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
Definition: omx_base_audio_port.h:44
DEFAULT_IN_BUFFER_SIZE
#define DEFAULT_IN_BUFFER_SIZE
Definition: omx_base_component.h:54
base_port_Destructor
OMX_ERRORTYPE base_port_Destructor(omx_base_PortType *openmaxStandPort)
The base destructor for the generic OpenMAX ST port.
Definition: omx_base_port.c:134
OMX_BOOL
OMX_BOOL
Definition: OMX_Types.h:189
omx_base_audio_port.h
OMX_PARAM_PORTDEFINITIONTYPE::eDomain
OMX_PORTDOMAINTYPE eDomain
Definition: OMX_Component.h:77
omx_base_PortType
Definition: omx_base_port.h:105
OMX_ErrorInsufficientResources
@ OMX_ErrorInsufficientResources
Definition: OMX_Core.h:131
OMX_COMPONENTTYPE
Definition: OMX_Component.h:308
OMX_PARAM_PORTDEFINITIONTYPE::nBufferSize
OMX_U32 nBufferSize
Definition: OMX_Component.h:68
OMX_AUDIO_PORTDEFINITIONTYPE::pNativeRender
OMX_NATIVE_DEVICETYPE pNativeRender
Definition: OMX_Audio.h:106
base_audio_port_Constructor
OMX_ERRORTYPE base_audio_port_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, omx_base_PortType **openmaxStandPort, OMX_U32 nPortIndex, OMX_BOOL isInput)
The base constructor for the generic OpenMAX ST Audio port.
Definition: omx_base_audio_port.c:51
omx_base_audio_PortType::sAudioParam
OMX_AUDIO_PARAM_PORTFORMATTYPE sAudioParam
Definition: omx_base_audio_port.h:44
err
OMX_ERRORTYPE err
Definition: omxvolcontroltest.c:34
OMX_FALSE
@ OMX_FALSE
Definition: OMX_Types.h:190
omx_base_PortType::sPortParam
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
Definition: omx_base_port.h:142
OMX_ErrorNone
@ OMX_ErrorNone
Definition: OMX_Core.h:128
OMX_AUDIO_PARAM_PORTFORMATTYPE
Definition: OMX_Audio.h:119
omx_base_audio_PortType
Definition: omx_base_audio_port.h:40
OMX_PortDomainAudio
@ OMX_PortDomainAudio
Definition: OMX_Component.h:51
setHeader
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
Definition: omx_base_component.c:746

Generated for OpenMAX Bellagio rel. 0.9.3 by  doxygen 1.5.1
SourceForge.net Logo