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 }

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