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_CODINGTYPE eEncoding
Definition: OMX_Audio.h:124
unsigned long OMX_U32
Definition: OMX_Types.h:145
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.
OMX_ERRORTYPE(* PortDestructor)(omx_base_PortType *openmaxStandPort)
#define DEBUG(n, fmt, args...)
OMX_ERRORTYPE base_port_Destructor(omx_base_PortType *openmaxStandPort)
The base destructor for the generic OpenMAX ST port.
union OMX_PARAM_PORTDEFINITIONTYPE::@0 format
OMX_BOOL
Definition: OMX_Types.h:189
#define DEB_LEV_ERR
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
#define DEFAULT_OUT_BUFFER_SIZE
OMX_AUDIO_CODINGTYPE eEncoding
Definition: OMX_Audio.h:111
OMX_ERRORTYPE err
OMX_PORTDOMAINTYPE eDomain
Definition: OMX_Component.h:77
#define DEFAULT_IN_BUFFER_SIZE
OMX_ERRORTYPE base_audio_port_Destructor(omx_base_PortType *openmaxStandPort)
The base audio port destructor for the generic OpenMAX ST Audio port.
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
OMX_NATIVE_DEVICETYPE pNativeRender
Definition: OMX_Audio.h:106
#define DEB_LEV_FUNCTION_NAME
OMX_AUDIO_PARAM_PORTFORMATTYPE sAudioParam
#define DEFAULT_MIME_STRING_LENGTH
OMX_AUDIO_PORTDEFINITIONTYPE audio
Definition: OMX_Component.h:79
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_ERRORTYPE
Definition: OMX_Core.h:126

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