OpenMAX Bellagio 0.9.3
omx_base_audio_port.c
Go to the documentation of this file.
1
25
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
50
51OMX_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;
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
107
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_ERRORTYPE
Definition OMX_Core.h:127
@ OMX_ErrorInsufficientResources
Definition OMX_Core.h:131
@ OMX_ErrorNone
Definition OMX_Core.h:128
unsigned long OMX_U32
Definition OMX_Types.h:145
OMX_BOOL
Definition OMX_Types.h:189
@ OMX_TRUE
Definition OMX_Types.h:191
@ OMX_FALSE
Definition OMX_Types.h:190
@ OMX_AUDIO_CodingUnused
Definition OMX_Audio.h:64
@ OMX_PortDomainAudio
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_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.
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
#define DEFAULT_IN_BUFFER_SIZE
#define DEFAULT_OUT_BUFFER_SIZE
#define DEFAULT_MIME_STRING_LENGTH
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.
OMX_ERRORTYPE base_port_Destructor(omx_base_PortType *openmaxStandPort)
The base destructor for the generic OpenMAX ST port.
#define DEB_LEV_FUNCTION_NAME
#define DEB_LEV_ERR
#define DEBUG(n, fmt, args...)
OMX_ERRORTYPE err
OMX_AUDIO_CODINGTYPE eEncoding
Definition OMX_Audio.h:124
OMX_NATIVE_DEVICETYPE pNativeRender
Definition OMX_Audio.h:106
OMX_AUDIO_CODINGTYPE eEncoding
Definition OMX_Audio.h:111
OMX_PORTDOMAINTYPE eDomain
OMX_AUDIO_PORTDEFINITIONTYPE audio
union OMX_PARAM_PORTDEFINITIONTYPE::@177272256172124162243064033106232350376140173200 format
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_AUDIO_PARAM_PORTFORMATTYPE sAudioParam
OMX_ERRORTYPE(* PortDestructor)(omx_base_PortType *openmaxStandPort)

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