2 * Copyright 2012 Michael Chen <omxcodec@gmail.com>
3 * Copyright 2015 The CyanogenMod Project
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 //#define LOG_NDEBUG 0
19 #define LOG_TAG "SoftFFmpegVideo"
20 #include <utils/Log.h>
22 #include "SoftFFmpegVideo.h"
23 #include "FFmpegComponents.h"
25 #include <media/stagefright/foundation/ADebug.h>
26 #include <media/stagefright/foundation/AUtils.h>
27 #include <media/stagefright/foundation/hexdump.h>
28 #include <media/stagefright/MediaDefs.h>
33 static int decoder_reorder_pts = -1;
37 static const CodecProfileLevel kM4VProfileLevels[] = {
38 { OMX_VIDEO_MPEG4ProfileSimple, OMX_VIDEO_MPEG4Level5 },
39 { OMX_VIDEO_MPEG4ProfileAdvancedSimple, OMX_VIDEO_MPEG4Level5 },
42 SoftFFmpegVideo::SoftFFmpegVideo(
44 const char *componentRole,
45 OMX_VIDEO_CODINGTYPE codingType,
46 const CodecProfileLevel *profileLevels,
47 size_t numProfileLevels,
48 const OMX_CALLBACKTYPE *callbacks,
50 OMX_COMPONENTTYPE **component,
51 enum AVCodecID codecID)
52 : SoftVideoDecoderOMXComponent(name, componentRole, codingType,
53 profileLevels, numProfileLevels, 352, 288, callbacks, appData, component),
54 mCodingType(codingType),
55 mFFmpegAlreadyInited(false),
56 mCodecAlreadyOpened(false),
60 mEOSStatus(INPUT_DATA_AVAILABLE),
61 mExtradataReady(false),
62 mIgnoreExtradata(false),
64 mSignalledError(false) {
66 ALOGD("SoftFFmpegVideo component: %s codingType=%d appData: %p", name, codingType, appData);
70 1024 * 1024 /* inputBufferSize */,
74 CHECK_EQ(initDecoder(codecID), (status_t)OK);
77 SoftFFmpegVideo::~SoftFFmpegVideo() {
78 ALOGV("~SoftFFmpegVideo");
80 if (mFFmpegAlreadyInited) {
85 void SoftFFmpegVideo::setDefaultCtx(AVCodecContext *avctx, const AVCodec *codec) {
88 avctx->workaround_bugs = 1;
90 if(avctx->lowres > codec->max_lowres){
91 ALOGW("The maximum value for lowres supported by the decoder is %d",
93 avctx->lowres= codec->max_lowres;
96 avctx->skip_frame = AVDISCARD_DEFAULT;
97 avctx->skip_idct = AVDISCARD_DEFAULT;
98 avctx->skip_loop_filter = AVDISCARD_ALL;
99 avctx->error_concealment = 3;
100 avctx->thread_count = 0;
102 if(avctx->lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
103 if (fast) avctx->flags2 |= CODEC_FLAG2_FAST;
104 if(codec->capabilities & CODEC_CAP_DR1)
105 avctx->flags |= CODEC_FLAG_EMU_EDGE;
108 status_t SoftFFmpegVideo::initDecoder(enum AVCodecID codecID) {
111 status = initFFmpeg();
115 mFFmpegAlreadyInited = true;
117 mCtx = avcodec_alloc_context3(NULL);
120 ALOGE("avcodec_alloc_context failed.");
124 mCtx->codec_type = AVMEDIA_TYPE_VIDEO;
125 mCtx->codec_id = codecID;
126 mCtx->extradata_size = 0;
127 mCtx->extradata = NULL;
128 mCtx->width = mWidth;
129 mCtx->height = mHeight;
133 void SoftFFmpegVideo::deInitDecoder() {
135 if (avcodec_is_open(mCtx)) {
136 avcodec_flush_buffers(mCtx);
138 if (mCtx->extradata) {
139 av_free(mCtx->extradata);
140 mCtx->extradata = NULL;
141 mCtx->extradata_size = 0;
143 if (mCodecAlreadyOpened) {
153 if (mImgConvertCtx) {
154 sws_freeContext(mImgConvertCtx);
155 mImgConvertCtx = NULL;
159 OMX_ERRORTYPE SoftFFmpegVideo::internalGetParameter(
160 OMX_INDEXTYPE index, OMX_PTR params) {
161 //ALOGV("internalGetParameter index:0x%x", index);
163 case OMX_IndexParamVideoWmv:
165 OMX_VIDEO_PARAM_WMVTYPE *profile =
166 (OMX_VIDEO_PARAM_WMVTYPE *)params;
168 if (profile->nPortIndex != kInputPortIndex) {
169 return OMX_ErrorUndefined;
172 profile->eFormat = OMX_VIDEO_WMVFormatUnused;
174 return OMX_ErrorNone;
177 case OMX_IndexParamVideoRv:
179 OMX_VIDEO_PARAM_RVTYPE *profile =
180 (OMX_VIDEO_PARAM_RVTYPE *)params;
182 if (profile->nPortIndex != kInputPortIndex) {
183 return OMX_ErrorUndefined;
186 profile->eFormat = OMX_VIDEO_RVFormatUnused;
188 return OMX_ErrorNone;
193 if (index != (OMX_INDEXTYPE)OMX_IndexParamVideoFFmpeg) {
194 return SoftVideoDecoderOMXComponent::internalGetParameter(index, params);
197 OMX_VIDEO_PARAM_FFMPEGTYPE *profile =
198 (OMX_VIDEO_PARAM_FFMPEGTYPE *)params;
200 if (profile->nPortIndex != kInputPortIndex) {
201 return OMX_ErrorUndefined;
204 profile->eCodecId = AV_CODEC_ID_NONE;
206 profile->nHeight = 0;
208 return OMX_ErrorNone;
213 OMX_ERRORTYPE SoftFFmpegVideo::isRoleSupported(
214 const OMX_PARAM_COMPONENTROLETYPE *roleParams) {
216 i < sizeof(kVideoComponents) / sizeof(kVideoComponents[0]);
218 if (strncmp((const char *)roleParams->cRole,
219 kVideoComponents[i].mRole, OMX_MAX_STRINGNAME_SIZE - 1) == 0) {
220 return OMX_ErrorNone;
223 ALOGE("unsupported role: %s", (const char *)roleParams->cRole);
224 return OMX_ErrorUndefined;
227 OMX_ERRORTYPE SoftFFmpegVideo::internalSetParameter(
228 OMX_INDEXTYPE index, const OMX_PTR params) {
229 //ALOGV("internalSetParameter index:0x%x", index);
231 case OMX_IndexParamStandardComponentRole:
233 const OMX_PARAM_COMPONENTROLETYPE *roleParams =
234 (const OMX_PARAM_COMPONENTROLETYPE *)params;
235 return isRoleSupported(roleParams);
238 case OMX_IndexParamPortDefinition:
240 OMX_PARAM_PORTDEFINITIONTYPE *newParams =
241 (OMX_PARAM_PORTDEFINITIONTYPE *)params;
242 OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &newParams->format.video;
243 OMX_PARAM_PORTDEFINITIONTYPE *def = &editPortInfo(newParams->nPortIndex)->mDef;
245 uint32_t oldWidth = def->format.video.nFrameWidth;
246 uint32_t oldHeight = def->format.video.nFrameHeight;
247 uint32_t newWidth = video_def->nFrameWidth;
248 uint32_t newHeight = video_def->nFrameHeight;
249 if (newWidth != oldWidth || newHeight != oldHeight) {
250 bool outputPort = (newParams->nPortIndex == kOutputPortIndex);
252 ALOGV("OMX_IndexParamPortDefinition (output) width=%d height=%d", newWidth, newHeight);
254 // only update (essentially crop) if size changes
258 updatePortDefinitions(true, true);
259 // reset buffer size based on frame size
260 newParams->nBufferSize = def->nBufferSize;
262 // For input port, we only set nFrameWidth and nFrameHeight. Buffer size
263 // is updated when configuring the output port using the max-frame-size,
264 // though client can still request a larger size.
265 ALOGV("OMX_IndexParamPortDefinition (input) width=%d height=%d", newWidth, newHeight);
266 def->format.video.nFrameWidth = newWidth;
267 def->format.video.nFrameHeight = newHeight;
268 mCtx->width = newWidth;
269 mCtx->height = newHeight;
272 return SoftVideoDecoderOMXComponent::internalSetParameter(index, params);
275 case OMX_IndexParamVideoWmv:
277 OMX_VIDEO_PARAM_WMVTYPE *profile =
278 (OMX_VIDEO_PARAM_WMVTYPE *)params;
280 if (profile->nPortIndex != kInputPortIndex) {
281 return OMX_ErrorUndefined;
284 if (profile->eFormat == OMX_VIDEO_WMVFormat7) {
285 mCtx->codec_id = AV_CODEC_ID_WMV1;
286 } else if (profile->eFormat == OMX_VIDEO_WMVFormat8) {
287 mCtx->codec_id = AV_CODEC_ID_WMV2;
288 } else if (profile->eFormat == OMX_VIDEO_WMVFormat9) {
289 mCtx->codec_id = AV_CODEC_ID_WMV3;
291 mCtx->codec_id = AV_CODEC_ID_VC1;
294 return OMX_ErrorNone;
297 case OMX_IndexParamVideoRv:
299 OMX_VIDEO_PARAM_RVTYPE *profile =
300 (OMX_VIDEO_PARAM_RVTYPE *)params;
302 if (profile->nPortIndex != kInputPortIndex) {
303 return OMX_ErrorUndefined;
306 if (profile->eFormat == OMX_VIDEO_RVFormatG2) {
307 mCtx->codec_id = AV_CODEC_ID_RV20;
308 } else if (profile->eFormat == OMX_VIDEO_RVFormat8) {
309 mCtx->codec_id = AV_CODEC_ID_RV30;
310 } else if (profile->eFormat == OMX_VIDEO_RVFormat9) {
311 mCtx->codec_id = AV_CODEC_ID_RV40;
313 ALOGE("unsupported rv codec: 0x%x", profile->eFormat);
314 return OMX_ErrorUndefined;
317 return OMX_ErrorNone;
322 if (index != (OMX_INDEXTYPE)OMX_IndexParamVideoFFmpeg) {
323 return SoftVideoDecoderOMXComponent::internalSetParameter(index, params);
326 OMX_VIDEO_PARAM_FFMPEGTYPE *profile =
327 (OMX_VIDEO_PARAM_FFMPEGTYPE *)params;
329 if (profile->nPortIndex != kInputPortIndex) {
330 return OMX_ErrorUndefined;
333 mCtx->codec_id = (enum AVCodecID)profile->eCodecId;
334 mCtx->width = profile->nWidth;
335 mCtx->height = profile->nHeight;
337 ALOGD("got OMX_IndexParamVideoFFmpeg, "
338 "eCodecId:%d(%s), width:%u, height:%u",
340 avcodec_get_name(mCtx->codec_id),
344 return OMX_ErrorNone;
349 int32_t SoftFFmpegVideo::handleExtradata() {
350 List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
351 BufferInfo *inInfo = *inQueue.begin();
352 OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
354 ALOGI("got extradata, ignore: %d, size: %u",
355 mIgnoreExtradata, inHeader->nFilledLen);
356 hexdump(inHeader->pBuffer + inHeader->nOffset, inHeader->nFilledLen);
358 if (mIgnoreExtradata) {
359 ALOGI("got extradata, size: %u, but ignore it", inHeader->nFilledLen);
361 if (!mExtradataReady) {
362 //if (mMode == MODE_H264)
363 //it is possible to receive multiple input buffer with OMX_BUFFERFLAG_CODECCONFIG flag.
364 //for example, H264, the first input buffer is SPS, and another is PPS!
365 int orig_extradata_size = mCtx->extradata_size;
366 mCtx->extradata_size += inHeader->nFilledLen;
367 mCtx->extradata = (uint8_t *)realloc(mCtx->extradata,
368 mCtx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
369 if (!mCtx->extradata) {
370 ALOGE("ffmpeg video decoder failed to alloc extradata memory.");
374 memcpy(mCtx->extradata + orig_extradata_size,
375 inHeader->pBuffer + inHeader->nOffset,
376 inHeader->nFilledLen);
377 memset(mCtx->extradata + mCtx->extradata_size, 0,
378 FF_INPUT_BUFFER_PADDING_SIZE);
382 inQueue.erase(inQueue.begin());
383 inInfo->mOwnedByUs = false;
384 notifyEmptyBufferDone(inHeader);
389 int32_t SoftFFmpegVideo::openDecoder() {
390 if (mCodecAlreadyOpened) {
394 if (!mExtradataReady) {
395 ALOGI("extradata is ready, size: %d", mCtx->extradata_size);
396 hexdump(mCtx->extradata, mCtx->extradata_size);
397 mExtradataReady = true;
400 //find decoder again as codec_id may have changed
401 mCtx->codec = avcodec_find_decoder(mCtx->codec_id);
403 ALOGE("ffmpeg video decoder failed to find codec");
404 return ERR_CODEC_NOT_FOUND;
407 setDefaultCtx(mCtx, mCtx->codec);
409 ALOGD("begin to open ffmpeg decoder(%s) now",
410 avcodec_get_name(mCtx->codec_id));
412 int err = avcodec_open2(mCtx, mCtx->codec, NULL);
414 ALOGE("ffmpeg video decoder failed to initialize. (%s)", av_err2str(err));
415 return ERR_DECODER_OPEN_FAILED;
417 mCodecAlreadyOpened = true;
419 ALOGD("open ffmpeg video decoder(%s) success",
420 avcodec_get_name(mCtx->codec_id));
422 mFrame = av_frame_alloc();
424 ALOGE("oom for video frame");
431 void SoftFFmpegVideo::initPacket(AVPacket *pkt,
432 OMX_BUFFERHEADERTYPE *inHeader) {
433 memset(pkt, 0, sizeof(AVPacket));
437 pkt->data = (uint8_t *)inHeader->pBuffer + inHeader->nOffset;
438 pkt->size = inHeader->nFilledLen;
439 pkt->pts = inHeader->nTimeStamp;
440 pkt->dts = inHeader->nTimeStamp;
444 pkt->pts = AV_NOPTS_VALUE;
448 if (pkt->pts != AV_NOPTS_VALUE)
450 ALOGV("pkt size:%d, pts:%lld", pkt->size, pkt->pts);
452 ALOGV("pkt size:%d, pts:N/A", pkt->size);
457 int32_t SoftFFmpegVideo::decodeVideo() {
458 int len = 0, err = 0;
460 int32_t ret = ERR_OK;
461 bool is_flush = (mEOSStatus != INPUT_DATA_AVAILABLE);
462 List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
463 BufferInfo *inInfo = NULL;
464 OMX_BUFFERHEADERTYPE *inHeader = NULL;
467 inInfo = *inQueue.begin();
468 CHECK(inInfo != NULL);
469 inHeader = inInfo->mHeader;
473 initPacket(&pkt, inHeader);
475 av_frame_unref(mFrame);
477 err = avcodec_decode_video2(mCtx, mFrame, &gotPic, &pkt);
478 av_packet_unref(&pkt);
481 ALOGE("ffmpeg video decoder failed to decode frame. (%d)", err);
482 //don't send error to OMXCodec, skip!
486 ALOGI("ffmpeg video decoder failed to get frame.");
487 //stop sending empty packets if the decoder is finished
488 if (is_flush && mCtx->codec->capabilities & CODEC_CAP_DELAY) {
499 inQueue.erase(inQueue.begin());
500 inInfo->mOwnedByUs = false;
501 notifyEmptyBufferDone(inHeader);
507 int32_t SoftFFmpegVideo::drainOneOutputBuffer() {
508 List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
509 BufferInfo *outInfo = *outQueue.begin();
510 OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
513 int64_t pts = AV_NOPTS_VALUE;
514 uint8_t *dst = outHeader->pBuffer;
516 uint32_t width = outputBufferWidth();
517 uint32_t height = outputBufferHeight();
519 memset(&pict, 0, sizeof(AVPicture));
521 pict.data[1] = dst + width * height;
522 pict.data[2] = pict.data[1] + (width / 2 * height / 2);
523 pict.linesize[0] = width;
524 pict.linesize[1] = width / 2;
525 pict.linesize[2] = width / 2;
527 ALOGV("drainOneOutputBuffer: frame_width=%d frame_height=%d width=%d height=%d ctx_width=%d ctx_height=%d", mFrame->width, mFrame->height, width, height, mCtx->width, mCtx->height);
529 int sws_flags = SWS_BICUBIC;
530 mImgConvertCtx = sws_getCachedContext(mImgConvertCtx,
531 mFrame->width, mFrame->height, (AVPixelFormat)mFrame->format, width, height,
532 AV_PIX_FMT_YUV420P, sws_flags, NULL, NULL, NULL);
533 if (mImgConvertCtx == NULL) {
534 ALOGE("Cannot initialize the conversion context");
535 return ERR_SWS_FAILED;
537 sws_scale(mImgConvertCtx, mFrame->data, mFrame->linesize,
538 0, height, pict.data, pict.linesize);
540 outHeader->nOffset = 0;
541 outHeader->nFilledLen = (outputBufferWidth() * outputBufferHeight() * 3) / 2;
542 outHeader->nFlags = 0;
543 if (mFrame->key_frame) {
544 outHeader->nFlags |= OMX_BUFFERFLAG_SYNCFRAME;
548 if (decoder_reorder_pts == -1) {
549 pts = av_frame_get_best_effort_timestamp(mFrame);
550 } else if (decoder_reorder_pts) {
551 pts = mFrame->pkt_pts;
553 pts = mFrame->pkt_dts;
556 if (pts == AV_NOPTS_VALUE) {
559 outHeader->nTimeStamp = pts; //FIXME pts is right???
562 ALOGV("mFrame pkt_pts: %lld pkt_dts: %lld used %lld", mFrame->pkt_pts, mFrame->pkt_dts, pts);
565 outQueue.erase(outQueue.begin());
566 outInfo->mOwnedByUs = false;
567 notifyFillBufferDone(outHeader);
572 void SoftFFmpegVideo::drainEOSOutputBuffer() {
573 List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
574 BufferInfo *outInfo = *outQueue.begin();
575 CHECK(outInfo != NULL);
576 outQueue.erase(outQueue.begin());
577 OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader;
579 ALOGD("ffmpeg video decoder fill eos outbuf");
581 outHeader->nTimeStamp = 0;
582 outHeader->nFilledLen = 0;
583 outHeader->nFlags = OMX_BUFFERFLAG_EOS;
585 outInfo->mOwnedByUs = false;
586 notifyFillBufferDone(outHeader);
588 mEOSStatus = OUTPUT_FRAMES_FLUSHED;
591 void SoftFFmpegVideo::drainAllOutputBuffers() {
592 List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
593 if (!mCodecAlreadyOpened) {
594 drainEOSOutputBuffer();
595 mEOSStatus = OUTPUT_FRAMES_FLUSHED;
599 if(!(mCtx->codec->capabilities & CODEC_CAP_DELAY)) {
600 drainEOSOutputBuffer();
601 mEOSStatus = OUTPUT_FRAMES_FLUSHED;
605 while (!outQueue.empty()) {
606 int32_t err = decodeVideo();
608 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
609 mSignalledError = true;
611 } else if (err == ERR_FLUSHED) {
612 drainEOSOutputBuffer();
615 CHECK_EQ(err, ERR_OK);
617 if (drainOneOutputBuffer() != ERR_OK) {
618 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
619 mSignalledError = true;
625 bool SoftFFmpegVideo::handlePortSettingsChange() {
626 CropSettingsMode crop = kCropUnSet;
627 uint32_t width = outputBufferWidth();
628 uint32_t height = outputBufferHeight();
629 if (width != (uint32_t)mCtx->width || height != (uint32_t)mCtx->height) {
631 if (mCropWidth != width || mCropHeight != height) {
635 mCropHeight = height;
640 bool portWillReset = false;
641 SoftVideoDecoderOMXComponent::handlePortSettingsChange(
642 &portWillReset, mCtx->width, mCtx->height, crop);
643 return portWillReset;
646 void SoftFFmpegVideo::onQueueFilled(OMX_U32 portIndex __unused) {
647 if (mSignalledError || mOutputPortSettingsChange != NONE) {
651 if (mEOSStatus == OUTPUT_FRAMES_FLUSHED) {
655 List<BufferInfo *> &inQueue = getPortQueue(kInputPortIndex);
656 List<BufferInfo *> &outQueue = getPortQueue(kOutputPortIndex);
658 while (((mEOSStatus != INPUT_DATA_AVAILABLE) || !inQueue.empty())
659 && !outQueue.empty()) {
661 if (mEOSStatus == INPUT_EOS_SEEN) {
662 drainAllOutputBuffers();
666 BufferInfo *inInfo = *inQueue.begin();
667 if (inInfo == NULL) {
670 OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader;
671 if (inHeader == NULL) {
675 if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) {
676 ALOGD("ffmpeg got codecconfig buffer");
677 if (handleExtradata() != ERR_OK) {
678 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
679 mSignalledError = true;
684 if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) {
685 mEOSStatus = INPUT_EOS_SEEN;
688 if (!mCodecAlreadyOpened) {
689 if (openDecoder() != ERR_OK) {
690 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
691 mSignalledError = true;
696 int32_t err = decodeVideo();
698 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
699 mSignalledError = true;
701 } else if (err == ERR_FLUSHED) {
702 drainEOSOutputBuffer();
704 } else if (err == ERR_NO_FRM) {
707 CHECK_EQ(err, ERR_OK);
710 if (handlePortSettingsChange()) {
711 ALOGV("PORT RESET w=%d h=%d", mCtx->width, mCtx->height);
715 if (drainOneOutputBuffer() != ERR_OK) {
716 notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL);
717 mSignalledError = true;
723 void SoftFFmpegVideo::onPortFlushCompleted(OMX_U32 portIndex) {
724 ALOGV("ffmpeg video decoder flush port(%u)", portIndex);
725 if (portIndex == kInputPortIndex) {
726 if (mCtx && avcodec_is_open(mCtx)) {
727 //Make sure that the next buffer output does not still
728 //depend on fragments from the last one decoded.
729 avcodec_flush_buffers(mCtx);
731 mEOSStatus = INPUT_DATA_AVAILABLE;
735 void SoftFFmpegVideo::onReset() {
737 SoftVideoDecoderOMXComponent::onReset();
738 mSignalledError = false;
739 mExtradataReady = false;
742 SoftOMXComponent* SoftFFmpegVideo::createSoftOMXComponent(
743 const char *name, const OMX_CALLBACKTYPE *callbacks,
744 OMX_PTR appData, OMX_COMPONENTTYPE **component) {
746 OMX_VIDEO_CODINGTYPE codingType = OMX_VIDEO_CodingAutoDetect;
747 char *componentRole = NULL;
748 enum AVCodecID codecID = AV_CODEC_ID_NONE;
750 for (size_t i = 0; i < kNumVideoComponents; ++i) {
751 if (!strcasecmp(name, kVideoComponents[i].mName)) {
752 componentRole = strdup(kVideoComponents[i].mRole);
753 codingType = kVideoComponents[i].mVideoCodingType;
754 codecID = kVideoComponents[i].mCodecID;
759 if (componentRole == NULL) {
763 if (!strcmp(name, "OMX.ffmpeg.mpeg4.decoder")) {
764 return new SoftFFmpegVideo(name, componentRole, codingType,
765 kM4VProfileLevels, ARRAY_SIZE(kM4VProfileLevels),
766 callbacks, appData, component, codecID);
769 return new SoftFFmpegVideo(name, componentRole, codingType,
771 callbacks, appData, component, codecID);
774 } // namespace android