blob: c45cf69dd3e9680a950ea9be1affc2799c849a23 [file] [log] [blame]
Ho-Eun Ryu77c54602009-12-16 11:27:16 +09001/*
2 * Copyright (c) 2009 Wind River Systems, Inc.
3 *
4 * The right to copy, distribute, modify, or otherwise make use
5 * of this software may be licensed only pursuant to the terms
6 * of an applicable Wind River license agreement.
7 */
8
9#include <stdio.h>
10#include <stdlib.h>
11#include <string.h>
12#include <unistd.h>
13
14#include <OMX_Core.h>
15
16#include <cmodule.h>
17#include <portvideo.h>
18#include <componentbase.h>
19
20#include <pv_omxcore.h>
21
22#include "psb.h"
23
24#define LOG_NDEBUG 0
25
26#define LOG_TAG "mrst_psb"
27#include <log.h>
28
29/*
30 * constructor & destructor
31 */
32MrstPsbComponent::MrstPsbComponent()
33{
34 LOGV("%s(): enter\n", __func__);
35
36 LOGV("%s(),%d: exit (ret = void)\n", __func__, __LINE__);
37}
38
39MrstPsbComponent::~MrstPsbComponent()
40{
41 LOGV("%s(): enter\n", __func__);
42
43 LOGV("%s(),%d: exit (ret = void)\n", __func__, __LINE__);
44}
45
46/* end of constructor & destructor */
47
48/* core methods & helpers */
49OMX_ERRORTYPE MrstPsbComponent::ComponentAllocatePorts(void)
50{
51 PortBase **ports;
52
53 OMX_U32 codec_port_index, raw_port_index;
54 OMX_DIRTYPE codec_port_dir, raw_port_dir;
55
56 OMX_PORT_PARAM_TYPE portparam;
57
58 const char *working_role;
59
60 OMX_ERRORTYPE ret = OMX_ErrorUndefined;
61
62 LOGV("%s(): enter\n", __func__);
63
64 ports = new PortBase *[NR_PORTS];
65 if (!ports)
66 return OMX_ErrorInsufficientResources;
67
68 this->nr_ports = NR_PORTS;
69 this->ports = ports;
70
71 /* video_[encoder/decoder].[avc/whatever] */
72 working_role = GetWorkingRole();
73 working_role = strpbrk(working_role, "_");
74
75 if (!strncmp(working_role, "_encoder", strlen("_encoder")))
76 isencoder = true;
77 else
78 isencoder = false;
79
80 working_role = strpbrk(working_role, ".");
81 if (!strcmp(working_role, ".avc"))
82 coding_type = OMX_VIDEO_CodingAVC;
83
84 if (isencoder) {
85 raw_port_index = INPORT_INDEX;
86 codec_port_index = OUTPORT_INDEX;
87 raw_port_dir = OMX_DirInput;
88 codec_port_dir = OMX_DirOutput;
89 }
90 else {
91 codec_port_index = INPORT_INDEX;
92 raw_port_index = OUTPORT_INDEX;
93 codec_port_dir = OMX_DirInput;
94 raw_port_dir = OMX_DirOutput;
95 }
96
97 if (coding_type == OMX_VIDEO_CodingAVC)
98 ret = __AllocateAvcPort(codec_port_index, codec_port_dir);
99
100 if (ret != OMX_ErrorNone)
101 goto free_ports;
102
103 ret = __AllocateRawPort(raw_port_index, raw_port_dir);
104 if (ret != OMX_ErrorNone)
105 goto free_codecport;
106
107 /* OMX_PORT_PARAM_TYPE */
108 memset(&portparam, 0, sizeof(portparam));
109 SetTypeHeader(&portparam, sizeof(portparam));
110 portparam.nPorts = NR_PORTS;
111 portparam.nStartPortNumber = INPORT_INDEX;
112
113 memcpy(&this->portparam, &portparam, sizeof(portparam));
114 /* end of OMX_PORT_PARAM_TYPE */
115
116 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, OMX_ErrorNone);
117 return OMX_ErrorNone;
118
119free_codecport:
120 delete ports[codec_port_index];
121 ports[codec_port_index] = NULL;
122
123free_ports:
124 coding_type = OMX_VIDEO_CodingUnused;
125
126 delete []ports;
127 ports = NULL;
128
129 this->ports = NULL;
130 this->nr_ports = 0;
131
132 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
133 return ret;
134}
135
136OMX_ERRORTYPE MrstPsbComponent::__AllocateAvcPort(OMX_U32 port_index,
137 OMX_DIRTYPE dir)
138{
139 PortAvc *avcport;
140
141 OMX_PARAM_PORTDEFINITIONTYPE avcportdefinition;
142 OMX_VIDEO_PARAM_AVCTYPE avcportparam;
143
144 LOGV("%s(): enter\n", __func__);
145
146 ports[port_index] = new PortAvc;
147 if (!ports[port_index]) {
148 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
149 OMX_ErrorInsufficientResources);
150 return OMX_ErrorInsufficientResources;
151 }
152
153 avcport = static_cast<PortAvc *>(this->ports[port_index]);
154
155 /* OMX_PARAM_PORTDEFINITIONTYPE */
156 memset(&avcportdefinition, 0, sizeof(avcportdefinition));
157 SetTypeHeader(&avcportdefinition, sizeof(avcportdefinition));
158 avcportdefinition.nPortIndex = port_index;
159 avcportdefinition.eDir = dir;
160 if (dir == OMX_DirInput) {
161 avcportdefinition.nBufferCountActual = INPORT_AVC_ACTUAL_BUFFER_COUNT;
162 avcportdefinition.nBufferCountMin = INPORT_AVC_MIN_BUFFER_COUNT;
163 avcportdefinition.nBufferSize = INPORT_AVC_BUFFER_SIZE;
164 }
165 else {
166 avcportdefinition.nBufferCountActual = OUTPORT_AVC_ACTUAL_BUFFER_COUNT;
167 avcportdefinition.nBufferCountMin = OUTPORT_AVC_MIN_BUFFER_COUNT;
168 avcportdefinition.nBufferSize = OUTPORT_AVC_BUFFER_SIZE;
169 }
170 avcportdefinition.bEnabled = OMX_TRUE;
171 avcportdefinition.bPopulated = OMX_FALSE;
172 avcportdefinition.eDomain = OMX_PortDomainVideo;
173 avcportdefinition.format.video.cMIMEType = (char *)"video/h264";
174 avcportdefinition.format.video.pNativeRender = NULL;
175 avcportdefinition.format.video.nFrameWidth = 176;
176 avcportdefinition.format.video.nFrameHeight = 144;
177 avcportdefinition.format.video.nStride = 0;
178 avcportdefinition.format.video.nSliceHeight = 0;
179 avcportdefinition.format.video.nBitrate = 64000;
180 avcportdefinition.format.video.xFramerate = 15 << 16;
181 avcportdefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
182 avcportdefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
183 avcportdefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
184 avcportdefinition.format.video.pNativeWindow = NULL;
185 avcportdefinition.bBuffersContiguous = OMX_FALSE;
186 avcportdefinition.nBufferAlignment = 0;
187
188 avcport->SetPortDefinition(&avcportdefinition, true);
189
190 /* end of OMX_PARAM_PORTDEFINITIONTYPE */
191
192 /* OMX_VIDEO_PARAM_AVCTYPE */
193 memset(&avcportparam, 0, sizeof(avcportparam));
194 SetTypeHeader(&avcportparam, sizeof(avcportparam));
195 avcportparam.nPortIndex = port_index;
196 avcportparam.eProfile = OMX_VIDEO_AVCProfileBaseline;
197 avcportparam.eLevel = OMX_VIDEO_AVCLevel1;
198
199 avcport->SetPortAvcParam(&avcportparam, true);
200 /* end of OMX_VIDEO_PARAM_AVCTYPE */
201
202 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, OMX_ErrorNone);
203 return OMX_ErrorNone;
204}
205
206OMX_ERRORTYPE MrstPsbComponent::__AllocateRawPort(OMX_U32 port_index,
207 OMX_DIRTYPE dir)
208{
209 PortVideo *rawport;
210
211 OMX_PARAM_PORTDEFINITIONTYPE rawportdefinition;
212 OMX_VIDEO_PARAM_PORTFORMATTYPE rawvideoparam;
213
214 LOGV("%s(): enter\n", __func__);
215
216 ports[port_index] = new PortVideo;
217 if (!ports[port_index]) {
218 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
219 OMX_ErrorInsufficientResources);
220 return OMX_ErrorInsufficientResources;
221 }
222
223 rawport = static_cast<PortVideo *>(this->ports[port_index]);
224
225 /* OMX_PARAM_PORTDEFINITIONTYPE */
226 memset(&rawportdefinition, 0, sizeof(rawportdefinition));
227 SetTypeHeader(&rawportdefinition, sizeof(rawportdefinition));
228 rawportdefinition.nPortIndex = port_index;
229 rawportdefinition.eDir = dir;
230 if (dir == OMX_DirInput) {
231 rawportdefinition.nBufferCountActual = INPORT_RAW_ACTUAL_BUFFER_COUNT;
232 rawportdefinition.nBufferCountMin = INPORT_RAW_MIN_BUFFER_COUNT;
233 rawportdefinition.nBufferSize = INPORT_RAW_BUFFER_SIZE;
234 }
235 else {
236 rawportdefinition.nBufferCountActual = OUTPORT_RAW_ACTUAL_BUFFER_COUNT;
237 rawportdefinition.nBufferCountMin = OUTPORT_RAW_MIN_BUFFER_COUNT;
238 rawportdefinition.nBufferSize = OUTPORT_RAW_BUFFER_SIZE;
239 }
240 rawportdefinition.bEnabled = OMX_TRUE;
241 rawportdefinition.bPopulated = OMX_FALSE;
242 rawportdefinition.eDomain = OMX_PortDomainVideo;
243 rawportdefinition.format.video.cMIMEType = (char *)"video/raw";
244 rawportdefinition.format.video.pNativeRender = NULL;
245 rawportdefinition.format.video.nFrameWidth = 176;
246 rawportdefinition.format.video.nFrameHeight = 144;
247 rawportdefinition.format.video.nStride = 0;
248 rawportdefinition.format.video.nSliceHeight = 0;
249 rawportdefinition.format.video.nBitrate = 64000;
250 rawportdefinition.format.video.xFramerate = 15 << 16;
251 rawportdefinition.format.video.bFlagErrorConcealment = OMX_FALSE;
252 rawportdefinition.format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
253 rawportdefinition.format.video.eColorFormat = OMX_COLOR_FormatUnused;
254 rawportdefinition.format.video.pNativeWindow = NULL;
255 rawportdefinition.bBuffersContiguous = OMX_FALSE;
256 rawportdefinition.nBufferAlignment = 0;
257
258 rawport->SetPortDefinition(&rawportdefinition, true);
259
260 /* end of OMX_PARAM_PORTDEFINITIONTYPE */
261
262 /* OMX_VIDEO_PARAM_PORTFORMATTYPE */
263 rawvideoparam.nPortIndex = port_index;
264 rawvideoparam.nIndex = 0;
265 rawvideoparam.eCompressionFormat = OMX_VIDEO_CodingUnused;
266 rawvideoparam.eColorFormat = OMX_COLOR_FormatYUV420Planar;
267
268 rawport->SetPortVideoParam(&rawvideoparam, true);
269
270 /* end of OMX_VIDEO_PARAM_PORTFORMATTYPE */
271
272 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, OMX_ErrorNone);
273 return OMX_ErrorNone;
274}
275
276/* end of core methods & helpers */
277
278/*
279 * component methods & helpers
280 */
281/* Get/SetParameter */
282OMX_ERRORTYPE MrstPsbComponent::ComponentGetParameter(
283 OMX_INDEXTYPE nParamIndex,
284 OMX_PTR pComponentParameterStructure)
285{
286 OMX_ERRORTYPE ret = OMX_ErrorNone;
287
288 LOGV("%s(): enter (index = 0x%08x)\n", __func__, nParamIndex);
289
290 switch (nParamIndex) {
291 case OMX_IndexParamVideoPortFormat: {
292 OMX_VIDEO_PARAM_PORTFORMATTYPE *p =
293 (OMX_VIDEO_PARAM_PORTFORMATTYPE *)pComponentParameterStructure;
294 OMX_U32 index = p->nPortIndex;
295 PortVideo *port = NULL;
296
297 LOGV("%s(): port index : %lu\n", __func__, index);
298
299 ret = CheckTypeHeader(p, sizeof(*p));
300 if (ret != OMX_ErrorNone) {
301 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
302 return ret;
303 }
304
305 if (index < nr_ports)
306 port = static_cast<PortVideo *>(ports[index]);
307
308 if (!port) {
309 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
310 OMX_ErrorBadPortIndex);
311 return OMX_ErrorBadPortIndex;
312 }
313
314 memcpy(p, port->GetPortVideoParam(), sizeof(*p));
315 break;
316 }
317 case OMX_IndexParamVideoAvc: {
318 OMX_VIDEO_PARAM_AVCTYPE *p =
319 (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
320 OMX_U32 index = p->nPortIndex;
321 PortAvc *port = NULL;
322
323 if (strcmp(GetWorkingRole(), "video_decoder.avc")) {
324 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
325 OMX_ErrorUnsupportedIndex);
326 return OMX_ErrorUnsupportedIndex;
327 }
328
329 ret = CheckTypeHeader(p, sizeof(*p));
330 if (ret != OMX_ErrorNone) {
331 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
332 return ret;
333 }
334
335 if (index < nr_ports)
336 port = static_cast<PortAvc *>(ports[index]);
337
338 if (!port) {
339 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
340 OMX_ErrorBadPortIndex);
341 return OMX_ErrorBadPortIndex;
342 }
343
344 memcpy(p, port->GetPortAvcParam(), sizeof(*p));
345 break;
346 }
347 case (OMX_INDEXTYPE) PV_OMX_COMPONENT_CAPABILITY_TYPE_INDEX: {
348 PV_OMXComponentCapabilityFlagsType *p =
349 (PV_OMXComponentCapabilityFlagsType *)pComponentParameterStructure;
350
351 p->iIsOMXComponentMultiThreaded = OMX_TRUE;
352 p->iOMXComponentSupportsExternalInputBufferAlloc = OMX_TRUE;
353 p->iOMXComponentSupportsExternalOutputBufferAlloc = OMX_TRUE;
354#ifdef PV_FULL_AVC_FRAME_MODE
355 p->iOMXComponentSupportsMovableInputBuffers = OMX_FALSE;
356 p->iOMXComponentUsesNALStartCodes = OMX_FALSE;
357 p->iOMXComponentSupportsPartialFrames = OMX_FALSE;
358 p->iOMXComponentCanHandleIncompleteFrames = OMX_TRUE;
359 p->iOMXComponentUsesFullAVCFrames = OMX_TRUE;
360#else
361 p->iOMXComponentSupportsMovableInputBuffers = OMX_TRUE;
362 p->iOMXComponentUsesNALStartCodes = OMX_FALSE;
363 p->iOMXComponentSupportsPartialFrames = OMX_TRUE;
364 p->iOMXComponentCanHandleIncompleteFrames = OMX_TRUE;
365 p->iOMXComponentUsesFullAVCFrames = OMX_FALSE;
366#endif
367 break;
368 }
369 default:
370 ret = OMX_ErrorUnsupportedIndex;
371 } /* switch */
372
373 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
374 return ret;
375}
376
377OMX_ERRORTYPE MrstPsbComponent::ComponentSetParameter(
378 OMX_INDEXTYPE nIndex,
379 OMX_PTR pComponentParameterStructure)
380{
381 OMX_ERRORTYPE ret = OMX_ErrorNone;
382
383 LOGV("%s(): enter (index = 0x%08x)\n", __func__, nIndex);
384
385 switch (nIndex) {
386 case OMX_IndexParamVideoPortFormat: {
387 OMX_VIDEO_PARAM_PORTFORMATTYPE *p =
388 (OMX_VIDEO_PARAM_PORTFORMATTYPE *)pComponentParameterStructure;
389 OMX_U32 index = p->nPortIndex;
390 PortVideo *port = NULL;
391
392 ret = CheckTypeHeader(p, sizeof(*p));
393 if (ret != OMX_ErrorNone) {
394 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
395 return ret;
396 }
397
398 if (index < nr_ports)
399 port = static_cast<PortVideo *>(ports[index]);
400
401 if (!port) {
402 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
403 OMX_ErrorBadPortIndex);
404 return OMX_ErrorBadPortIndex;
405 }
406
407 if (port->IsEnabled()) {
408 OMX_STATETYPE state;
409
410 CBaseGetState((void *)GetComponentHandle(), &state);
411 if (state != OMX_StateLoaded &&
412 state != OMX_StateWaitForResources) {
413 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
414 OMX_ErrorIncorrectStateOperation);
415 return OMX_ErrorIncorrectStateOperation;
416 }
417 }
418
419 ret = port->SetPortVideoParam(p, false);
420 break;
421 }
422 case OMX_IndexParamVideoAvc: {
423 OMX_VIDEO_PARAM_AVCTYPE *p =
424 (OMX_VIDEO_PARAM_AVCTYPE *)pComponentParameterStructure;
425 OMX_U32 index = p->nPortIndex;
426 PortAvc *port = NULL;
427
428 ret = CheckTypeHeader(p, sizeof(*p));
429 if (ret != OMX_ErrorNone) {
430 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
431 return ret;
432 }
433
434 if (index < nr_ports)
435 port = static_cast<PortAvc *>(ports[index]);
436
437 if (!port) {
438 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
439 OMX_ErrorBadPortIndex);
440 return OMX_ErrorBadPortIndex;
441 }
442
443 if (port->IsEnabled()) {
444 OMX_STATETYPE state;
445
446 CBaseGetState((void *)GetComponentHandle(), &state);
447 if (state != OMX_StateLoaded &&
448 state != OMX_StateWaitForResources) {
449 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__,
450 OMX_ErrorIncorrectStateOperation);
451 return OMX_ErrorIncorrectStateOperation;
452 }
453 }
454
455 ret = port->SetPortAvcParam(p, false);
456 break;
457 }
458 default:
459 ret = OMX_ErrorUnsupportedIndex;
460 } /* switch */
461
462 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
463 return ret;
464}
465
466/* Get/SetConfig */
467OMX_ERRORTYPE MrstPsbComponent::ComponentGetConfig(
468 OMX_INDEXTYPE nIndex,
469 OMX_PTR pComponentConfigStructure)
470{
471 OMX_ERRORTYPE ret = OMX_ErrorUnsupportedIndex;
472 LOGV("%s(): enter\n", __func__);
473
474 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
475 return ret;
476}
477
478OMX_ERRORTYPE MrstPsbComponent::ComponentSetConfig(
479 OMX_INDEXTYPE nParamIndex,
480 OMX_PTR pComponentConfigStructure)
481{
482 OMX_ERRORTYPE ret = OMX_ErrorUnsupportedIndex;
483 LOGV("%s(): enter\n", __func__);
484
485 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
486 return ret;
487}
488
489/* implement ComponentBase::Processor[*] */
490OMX_ERRORTYPE MrstPsbComponent::ProcessorInit(void)
491{
492 OMX_ERRORTYPE ret = OMX_ErrorNone;
493
494 LOGV("%s(): enter\n", __func__);
495
496 if (coding_type == OMX_VIDEO_CodingAVC) {
497 /*
498 * avc decoder specific code
499 */
500 }
501
502 /* decoder */
503 if (!isencoder) {
504 /*
505 * decoder specific code
506 */
507 }
508
509 /*
510 * common codes
511 */
512
513 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
514 return ret;
515}
516
517OMX_ERRORTYPE MrstPsbComponent::ProcessorDeinit(void)
518{
519 OMX_ERRORTYPE ret = OMX_ErrorNone;
520 LOGV("%s(): enter\n", __func__);
521
522 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
523 return ret;
524}
525
526OMX_ERRORTYPE MrstPsbComponent::ProcessorStart(void)
527{
528 OMX_ERRORTYPE ret = OMX_ErrorNone;
529 LOGV("%s(): enter\n", __func__);
530
531 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
532 return ret;
533}
534
535OMX_ERRORTYPE MrstPsbComponent::ProcessorStop(void)
536{
537 OMX_ERRORTYPE ret = OMX_ErrorNone;
538 LOGV("%s(): enter\n", __func__);
539
540 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
541 return ret;
542}
543
544OMX_ERRORTYPE MrstPsbComponent::ProcessorPause(void)
545{
546 OMX_ERRORTYPE ret = OMX_ErrorNone;
547 LOGV("%s(): enter\n", __func__);
548
549 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
550 return ret;
551}
552
553OMX_ERRORTYPE MrstPsbComponent::ProcessorResume(void)
554{
555 OMX_ERRORTYPE ret = OMX_ErrorNone;
556 LOGV("%s(): enter\n", __func__);
557
558 LOGV("%s(),%d: exit (ret = 0x%08x)\n", __func__, __LINE__, ret);
559 return ret;
560}
561
562/* implement ComponentBase::ProcessorProcess */
563void MrstPsbComponent::ProcessorProcess(
564 OMX_BUFFERHEADERTYPE **buffers,
565 bool *retain,
566 OMX_U32 nr_buffers)
567{
568 OMX_U32 outfilledlen = 0;
569 OMX_S64 outtimestamp = 0;
570
571 LOGV("%s(): enter\n", __func__);
572
573 DumpBuffer(buffers[INPORT_INDEX]);
574
575 if (!buffers[INPORT_INDEX]->nFilledLen) {
576 LOGE("%s(),%d: exit, input buffer's nFilledLen is zero (ret = void)\n",
577 __func__, __LINE__);
578 return;
579 }
580
581 /* decoder */
582 if (!isencoder) {
583 if ((buffers[INPORT_INDEX]->nFlags & OMX_BUFFERFLAG_ENDOFFRAME) &&
584 (buffers[INPORT_INDEX]->nFlags & OMX_BUFFERFLAG_CODECCONFIG)) {
585
586 /*
587 * processing codec data
588 */
589
590 retain[OUTPORT_INDEX] = true;
591 }
592
593 if (coding_type == OMX_VIDEO_CodingAVC) {
594 /*
595 * avc decoding specific code
596 */
597 }
598
599 /*
600 * decoding common code
601 */
602
603 outfilledlen = buffers[OUTPORT_INDEX]->nAllocLen;
604 outtimestamp = buffers[INPORT_INDEX]->nTimeStamp;
605 }
606
607 buffers[OUTPORT_INDEX]->nFilledLen = outfilledlen;
608 buffers[OUTPORT_INDEX]->nTimeStamp = outtimestamp;
609
610 //if (!retain[OUTPORT_INDEX])
611 // DumpBuffer(buffers[OUTPORT_INDEX]);
612
613 LOGV("%s(),%d: exit (ret = void)\n", __func__, __LINE__);
614}
615
616/* end of implement ComponentBase::Processor[*] */
617
618/* end of component methods & helpers */
619
620/*
621 * CModule Interface
622 */
623#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
624
625static const char *g_name = (const char *)"OMX.Intel.Mrst.PSB";
626
627static const char *g_roles[] =
628{
629 (const char *)"video_decoder.avc",
630};
631
632OMX_ERRORTYPE wrs_omxil_cmodule_ops_instantiate(OMX_PTR *instance)
633{
634 ComponentBase *cbase;
635
636 cbase = new MrstPsbComponent;
637 if (!cbase) {
638 *instance = NULL;
639 return OMX_ErrorInsufficientResources;
640 }
641
642 *instance = cbase;
643 return OMX_ErrorNone;
644}
645
646struct wrs_omxil_cmodule_ops_s cmodule_ops = {
647 instantiate: wrs_omxil_cmodule_ops_instantiate,
648};
649
650struct wrs_omxil_cmodule_s WRS_OMXIL_CMODULE_SYMBOL = {
651 name: g_name,
652 roles: &g_roles[0],
653 nr_roles: ARRAY_SIZE(g_roles),
654 ops: &cmodule_ops,
655};