OSDN Git Service

stagefright: Trivial FFMPEG fixes
authorSteve Kondik <steve@cyngn.com>
Wed, 28 Sep 2016 10:44:50 +0000 (03:44 -0700)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 15 May 2018 09:01:27 +0000 (17:01 +0800)
 * Ensure our codecs are never touched for encoders
 * Don't duplicate InitOMXParams, use utility class

Change-Id: Icde45b4d8b844fdb52b4f11a862ecb57059d17c0

media/libstagefright/ACodec.cpp
media/libstagefright/FFMPEGSoftCodec.cpp

index 27bd318..e34923b 100644 (file)
@@ -3823,11 +3823,7 @@ status_t ACodec::setupVideoEncoder(
     OMX_VIDEO_CODINGTYPE compressionFormat;
     err = GetVideoCodingTypeFromMime(mime, &compressionFormat);
 
-    err = FFMPEGSoftCodec::setVideoFormat(err,
-                msg, mime, mOMX, mOMXNode, mIsEncoder, &compressionFormat,
-                mComponentName.c_str());
     if (err != OK) {
-        ALOGE("Not a supported video mime type: %s", mime);
         return err;
     }
 
@@ -4939,7 +4935,7 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
 
                 default:
                 {
-                    if (!strncmp(mComponentName.c_str(), "OMX.ffmpeg.", 11)) {
+                    if (!mIsEncoder && !strncmp(mComponentName.c_str(), "OMX.ffmpeg.", 11)) {
                         err = FFMPEGSoftCodec::getVideoPortFormat(portIndex,
                                 (int)videoDef->eCompressionFormat, notify, mOMX, mOMXNode);
                         if (err == OK) {
@@ -5074,7 +5070,7 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
 
                 case OMX_AUDIO_CodingFLAC:
                 {
-                    if (!strncmp(mComponentName.c_str(), "OMX.ffmpeg.", 11)) {
+                    if (!mIsEncoder && !strncmp(mComponentName.c_str(), "OMX.ffmpeg.", 11)) {
                         err = FFMPEGSoftCodec::getAudioPortFormat(portIndex,
                                 (int)audioDef->eEncoding, notify, mOMX, mOMXNode);
                         if (err != OK) {
@@ -5237,7 +5233,7 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp<AMessage> &notify) {
                 }
 
                 default:
-                    if (!strncmp(mComponentName.c_str(), "OMX.ffmpeg.", 11)) {
+                    if (!mIsEncoder && !strncmp(mComponentName.c_str(), "OMX.ffmpeg.", 11)) {
                         err = FFMPEGSoftCodec::getAudioPortFormat(portIndex,
                                 (int)audioDef->eEncoding, notify, mOMX, mOMXNode);
                     }
index 1ba12b8..547b2fb 100644 (file)
@@ -28,6 +28,7 @@
 #include <media/stagefright/foundation/ABitReader.h>
 
 #include <media/stagefright/FFMPEGSoftCodec.h>
+#include <media/stagefright/omx/OMXUtils.h>
 
 #include <media/stagefright/ACodec.h>
 #include <media/stagefright/MediaCodecList.h>
@@ -190,15 +191,6 @@ void FFMPEGSoftCodec::convertMessageToMetaDataFF(
 }
 
 
-template<class T>
-static void InitOMXParams(T *params) {
-    params->nSize = sizeof(T);
-    params->nVersion.s.nVersionMajor = 1;
-    params->nVersion.s.nVersionMinor = 0;
-    params->nVersion.s.nRevision = 0;
-    params->nVersion.s.nStep = 0;
-}
-
 const char* FFMPEGSoftCodec::overrideComponentName(
         uint32_t /*quirks*/, const sp<MetaData> &meta, const char *mime, bool isEncoder) {
     const char* componentName = NULL;