Merge "Report an error instead of waiting for EOS indefinitely in sf2."
diff --git a/media/libmedia_native/Android.mk b/media/libmedia_native/Android.mk
new file mode 100644
index 0000000..065a90f
--- /dev/null
+++ b/media/libmedia_native/Android.mk
@@ -0,0 +1,11 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES :=
+
+LOCAL_MODULE:= libmedia_native
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 09e4e45..e5ad4b7 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -746,6 +746,10 @@
             "audio_decoder.aac", "audio_encoder.aac" },
         { MEDIA_MIMETYPE_AUDIO_VORBIS,
             "audio_decoder.vorbis", "audio_encoder.vorbis" },
+        { MEDIA_MIMETYPE_AUDIO_G711_MLAW,
+            "audio_decoder.g711mlaw", "audio_encoder.g711mlaw" },
+        { MEDIA_MIMETYPE_AUDIO_G711_ALAW,
+            "audio_decoder.g711alaw", "audio_encoder.g711alaw" },
         { MEDIA_MIMETYPE_VIDEO_AVC,
             "video_decoder.avc", "video_encoder.avc" },
         { MEDIA_MIMETYPE_VIDEO_MPEG4,
@@ -855,10 +859,6 @@
         }
     }
 
-    if (err != OK) {
-        return err;
-    }
-
     int32_t maxInputSize;
     if (msg->findInt32("max-input-size", &maxInputSize)) {
         err = setMinBufferSize(kPortIndexInput, (size_t)maxInputSize);
@@ -2770,6 +2770,9 @@
     status_t err = mCodec->configureCodec(mime.c_str(), msg);
 
     if (err != OK) {
+        ALOGE("[%s] configureCodec returning error %d",
+              mCodec->mComponentName.c_str(), err);
+
         mCodec->signalError(OMX_ErrorUndefined, err);
         return false;
     }
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index b4cb1ab..f96a4df 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -2280,16 +2280,8 @@
                 mTextDriver = new TimedTextDriver(mListener);
             }
             // String values written in Parcel are UTF-16 values.
-            String16 uri16 = request.readString16();
-            const char *uri = NULL;
-            if (uri16 != NULL) {
-                uri = String8(uri16).string();
-            }
-            String16 mimeType16 = request.readString16();
-            const char *mimeType = NULL;
-            if (mimeType16 != NULL) {
-                mimeType = String8(mimeType16).string();
-            }
+            String8 uri(request.readString16());
+            String8 mimeType(request.readString16());
             return mTextDriver->addOutOfBandTextSource(uri, mimeType);
         }
         case INVOKE_ID_ADD_EXTERNAL_SOURCE_FD:
@@ -2301,12 +2293,7 @@
             int fd         = request.readFileDescriptor();
             off64_t offset = request.readInt64();
             size_t length  = request.readInt64();
-            String16 mimeType16 = request.readString16();
-            const char *mimeType = NULL;
-            if (mimeType16 != NULL) {
-                mimeType = String8(mimeType16).string();
-            }
-
+            String8 mimeType(request.readString16());
             return mTextDriver->addOutOfBandTextSource(
                     fd, offset, length, mimeType);
         }
diff --git a/media/libstagefright/MP3Extractor.cpp b/media/libstagefright/MP3Extractor.cpp
index 2215c07..69209b5 100644
--- a/media/libstagefright/MP3Extractor.cpp
+++ b/media/libstagefright/MP3Extractor.cpp
@@ -317,6 +317,13 @@
         mSeeker = VBRISeeker::CreateFromSource(mDataSource, post_id3_pos);
     }
 
+    if (mSeeker != NULL) {
+        // While it is safe to send the XING/VBRI frame to the decoder, this will
+        // result in an extra 1152 samples being output. The real first frame to
+        // decode is after the XING/VBRI frame, so skip there.
+        mFirstFramePos += frame_size;
+    }
+
     int64_t durationUs;
 
     if (mSeeker == NULL || !mSeeker->getDuration(&durationUs)) {
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 278e3a2..d5e6bec 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -1332,8 +1332,6 @@
             "audio_decoder.mp1", "audio_encoder.mp1" },
         { MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II,
             "audio_decoder.mp2", "audio_encoder.mp2" },
-        { MEDIA_MIMETYPE_AUDIO_MPEG,
-            "audio_decoder.mp3", "audio_encoder.mp3" },
         { MEDIA_MIMETYPE_AUDIO_AMR_NB,
             "audio_decoder.amrnb", "audio_encoder.amrnb" },
         { MEDIA_MIMETYPE_AUDIO_AMR_WB,
@@ -1342,6 +1340,10 @@
             "audio_decoder.aac", "audio_encoder.aac" },
         { MEDIA_MIMETYPE_AUDIO_VORBIS,
             "audio_decoder.vorbis", "audio_encoder.vorbis" },
+        { MEDIA_MIMETYPE_AUDIO_G711_MLAW,
+            "audio_decoder.g711mlaw", "audio_encoder.g711mlaw" },
+        { MEDIA_MIMETYPE_AUDIO_G711_ALAW,
+            "audio_decoder.g711alaw", "audio_encoder.g711alaw" },
         { MEDIA_MIMETYPE_VIDEO_AVC,
             "video_decoder.avc", "video_encoder.avc" },
         { MEDIA_MIMETYPE_VIDEO_MPEG4,
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 6ac5a83..bcba874 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -92,7 +92,7 @@
     }
 
     sp<VBRISeeker> seeker = new VBRISeeker;
-    seeker->mBasePos = post_id3_pos;
+    seeker->mBasePos = post_id3_pos + frameSize;
     seeker->mDurationUs = durationUs;
 
     off64_t offset = post_id3_pos;
diff --git a/media/libstagefright/XINGSeeker.cpp b/media/libstagefright/XINGSeeker.cpp
index e36d619..8c99c76 100644
--- a/media/libstagefright/XINGSeeker.cpp
+++ b/media/libstagefright/XINGSeeker.cpp
@@ -15,35 +15,13 @@
  */
 
 #include "include/XINGSeeker.h"
+#include "include/avc_utils.h"
 
 #include <media/stagefright/DataSource.h>
 #include <media/stagefright/Utils.h>
 
 namespace android {
 
-static bool parse_xing_header(
-        const sp<DataSource> &source, off64_t first_frame_pos,
-        int32_t *frame_number = NULL, int32_t *byte_number = NULL,
-        unsigned char *table_of_contents = NULL, bool *toc_is_valid = NULL,
-        int32_t *quality_indicator = NULL, int64_t *duration = NULL);
-
-// static
-sp<XINGSeeker> XINGSeeker::CreateFromSource(
-        const sp<DataSource> &source, off64_t first_frame_pos) {
-    sp<XINGSeeker> seeker = new XINGSeeker;
-
-    seeker->mFirstFramePos = first_frame_pos;
-
-    if (!parse_xing_header(
-                source, first_frame_pos,
-                NULL, &seeker->mSizeBytes, seeker->mTOC, &seeker->mTOCValid,
-                NULL, &seeker->mDurationUs)) {
-        return NULL;
-    }
-
-    return seeker;
-}
-
 XINGSeeker::XINGSeeker()
     : mDurationUs(-1),
       mSizeBytes(0) {
@@ -91,60 +69,50 @@
     return true;
 }
 
-static bool parse_xing_header(
-        const sp<DataSource> &source, off64_t first_frame_pos,
-        int32_t *frame_number, int32_t *byte_number,
-        unsigned char *table_of_contents, bool *toc_valid,
-        int32_t *quality_indicator,
-        int64_t *duration) {
-    if (frame_number) {
-        *frame_number = 0;
-    }
-    if (byte_number) {
-        *byte_number = 0;
-    }
-    if (toc_valid) {
-        *toc_valid = false;
-    }
-    if (quality_indicator) {
-        *quality_indicator = 0;
-    }
-    if (duration) {
-        *duration = 0;
-    }
+// static
+sp<XINGSeeker> XINGSeeker::CreateFromSource(
+        const sp<DataSource> &source, off64_t first_frame_pos) {
+    sp<XINGSeeker> seeker = new XINGSeeker;
+
+    seeker->mFirstFramePos = first_frame_pos;
+
+    ALOGI("xingseeker first frame pos: %lld", first_frame_pos);
+
+    seeker->mSizeBytes = 0;
+    seeker->mTOCValid = false;
+    seeker->mDurationUs = 0;
 
     uint8_t buffer[4];
     int offset = first_frame_pos;
     if (source->readAt(offset, &buffer, 4) < 4) { // get header
-        return false;
+        return NULL;
     }
     offset += 4;
 
-    uint8_t id, layer, sr_index, mode;
-    layer = (buffer[1] >> 1) & 3;
-    id = (buffer[1] >> 3) & 3;
-    sr_index = (buffer[2] >> 2) & 3;
-    mode = (buffer[3] >> 6) & 3;
-    if (layer == 0) {
-        return false;
+    int header = U32_AT(buffer);;
+    size_t xingframesize = 0;
+    int sampling_rate = 0;
+    int num_channels;
+    int samples_per_frame = 0;
+    if (!GetMPEGAudioFrameSize(header, &xingframesize, &sampling_rate, &num_channels,
+                               NULL, &samples_per_frame)) {
+        return NULL;
     }
-    if (id == 1) {
-        return false;
-    }
-    if (sr_index == 3) {
-        return false;
-    }
+    seeker->mFirstFramePos += xingframesize;
+
+    uint8_t version = (buffer[1] >> 3) & 3;
+
     // determine offset of XING header
-    if(id&1) { // mpeg1
-        if (mode != 3) offset += 32;
+    if(version & 1) { // mpeg1
+        if (num_channels != 1) offset += 32;
         else offset += 17;
-    } else { // mpeg2
-        if (mode != 3) offset += 17;
+    } else { // mpeg 2 or 2.5
+        if (num_channels != 1) offset += 17;
         else offset += 9;
     }
 
     if (source->readAt(offset, &buffer, 4) < 4) { // XING header ID
-        return false;
+        return NULL;
     }
     offset += 4;
     // Check XING ID
@@ -152,73 +120,50 @@
                 || (buffer[2] != 'n') || (buffer[3] != 'g')) {
         if ((buffer[0] != 'I') || (buffer[1] != 'n')
                     || (buffer[2] != 'f') || (buffer[3] != 'o')) {
-            return false;
+            return NULL;
         }
     }
 
     if (source->readAt(offset, &buffer, 4) < 4) { // flags
-        return false;
+        return NULL;
     }
     offset += 4;
     uint32_t flags = U32_AT(buffer);
 
     if (flags & 0x0001) {  // Frames field is present
         if (source->readAt(offset, buffer, 4) < 4) {
-             return false;
+             return NULL;
         }
-        if (frame_number) {
-           *frame_number = U32_AT(buffer);
-        }
-        int32_t frame = U32_AT(buffer);
-        // Samples per Frame: 1. index = MPEG Version ID, 2. index = Layer
-        const int samplesPerFrames[2][3] =
-        {
-            { 384, 1152, 576  }, // MPEG 2, 2.5: layer1, layer2, layer3
-            { 384, 1152, 1152 }, // MPEG 1: layer1, layer2, layer3
-        };
-        // sampling rates in hertz: 1. index = MPEG Version ID, 2. index = sampling rate index
-        const int samplingRates[4][3] =
-        {
-            { 11025, 12000, 8000,  },    // MPEG 2.5
-            { 0,     0,     0,     },    // reserved
-            { 22050, 24000, 16000, },    // MPEG 2
-            { 44100, 48000, 32000, }     // MPEG 1
-        };
-        if (duration) {
-            *duration = (int64_t)frame * samplesPerFrames[id&1][3-layer] * 1000000LL
-                / samplingRates[id][sr_index];
-        }
+        int32_t frames = U32_AT(buffer);
+        seeker->mDurationUs = (int64_t)frames * samples_per_frame * 1000000LL / sampling_rate;
         offset += 4;
     }
     if (flags & 0x0002) {  // Bytes field is present
-        if (byte_number) {
-            if (source->readAt(offset, buffer, 4) < 4) {
-                return false;
-            }
-            *byte_number = U32_AT(buffer);
+        if (source->readAt(offset, buffer, 4) < 4) {
+            return NULL;
         }
+        seeker->mSizeBytes = U32_AT(buffer);
         offset += 4;
     }
     if (flags & 0x0004) {  // TOC field is present
-        if (table_of_contents) {
-            if (source->readAt(offset + 1, table_of_contents, 99) < 99) {
-                return false;
-            }
-            if (toc_valid) {
-                *toc_valid = true;
-            }
+        if (source->readAt(offset + 1, seeker->mTOC, 99) < 99) {
+            return NULL;
         }
+        seeker->mTOCValid = true;
         offset += 100;
     }
+
+#if 0
     if (flags & 0x0008) {  // Quality indicator field is present
-        if (quality_indicator) {
-            if (source->readAt(offset, buffer, 4) < 4) {
-                return false;
-            }
-            *quality_indicator = U32_AT(buffer);
+        if (source->readAt(offset, buffer, 4) < 4) {
+            return NULL;
         }
+        // do something with the quality indicator
+        offset += 4;
     }
-    return true;
+#endif
+
+    return seeker;
 }
 
 }  // namespace android
diff --git a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
index 7602f2d..796caa4 100644
--- a/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/SoftAMR.cpp
@@ -236,6 +236,18 @@
             return OMX_ErrorNone;
         }
 
+        case OMX_IndexParamAudioPcm:
+        {
+            const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
+                (OMX_AUDIO_PARAM_PCMMODETYPE *)params;
+
+            if (pcmParams->nPortIndex != 1) {
+                return OMX_ErrorUndefined;
+            }
+
+            return OMX_ErrorNone;
+        }
+
         default:
             return SimpleSoftOMXComponent::internalSetParameter(index, params);
     }
diff --git a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp b/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
deleted file mode 100644
index 27d7e4d..0000000
--- a/media/libstagefright/codecs/amrnb/enc/AMRNBEncoder.cpp
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "AMRNBEncoder.h"
-
-#include "gsmamr_enc.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-static const int32_t kNumSamplesPerFrame = 160;
-static const int32_t kSampleRate = 8000;
-
-AMRNBEncoder::AMRNBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta)
-    : mSource(source),
-      mMeta(meta),
-      mStarted(false),
-      mBufferGroup(NULL),
-      mEncState(NULL),
-      mSidState(NULL),
-      mAnchorTimeUs(0),
-      mNumFramesOutput(0),
-      mInputBuffer(NULL),
-      mMode(MR475),
-      mNumInputSamples(0) {
-}
-
-AMRNBEncoder::~AMRNBEncoder() {
-    if (mStarted) {
-        stop();
-    }
-}
-
-static Mode PickModeFromBitrate(int32_t bps) {
-    if (bps <= 4750) {
-        return MR475;
-    } else if (bps <= 5150) {
-        return MR515;
-    } else if (bps <= 5900) {
-        return MR59;
-    } else if (bps <= 6700) {
-        return MR67;
-    } else if (bps <= 7400) {
-        return MR74;
-    } else if (bps <= 7950) {
-        return MR795;
-    } else if (bps <= 10200) {
-        return MR102;
-    } else {
-        return MR122;
-    }
-}
-
-status_t AMRNBEncoder::start(MetaData *params) {
-    if (mStarted) {
-        ALOGW("Call start() when encoder already started");
-        return OK;
-    }
-
-    mBufferGroup = new MediaBufferGroup;
-    mBufferGroup->add_buffer(new MediaBuffer(32));
-
-    CHECK_EQ(AMREncodeInit(
-                &mEncState, &mSidState, false /* dtx_enable */),
-             0);
-
-    status_t err = mSource->start(params);
-    if (err != OK) {
-        ALOGE("AudioSource is not available");
-        return err;
-    }
-
-    mAnchorTimeUs = 0;
-    mNumFramesOutput = 0;
-    mStarted = true;
-    mNumInputSamples = 0;
-
-    int32_t bitrate;
-    if (params && params->findInt32(kKeyBitRate, &bitrate)) {
-        mMode = PickModeFromBitrate(bitrate);
-    } else {
-        mMode = MR475;
-    }
-
-    return OK;
-}
-
-status_t AMRNBEncoder::stop() {
-    if (!mStarted) {
-        ALOGW("Call stop() when encoder has not started.");
-        return OK;
-    }
-
-    if (mInputBuffer) {
-        mInputBuffer->release();
-        mInputBuffer = NULL;
-    }
-
-    delete mBufferGroup;
-    mBufferGroup = NULL;
-
-    mSource->stop();
-
-    AMREncodeExit(&mEncState, &mSidState);
-    mEncState = mSidState = NULL;
-
-    mStarted = false;
-
-    return OK;
-}
-
-sp<MetaData> AMRNBEncoder::getFormat() {
-    sp<MetaData> srcFormat = mSource->getFormat();
-
-    mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_NB);
-
-    int64_t durationUs;
-    if (srcFormat->findInt64(kKeyDuration, &durationUs)) {
-        mMeta->setInt64(kKeyDuration, durationUs);
-    }
-
-    mMeta->setCString(kKeyDecoderComponent, "AMRNBEncoder");
-
-    return mMeta;
-}
-
-status_t AMRNBEncoder::read(
-        MediaBuffer **out, const ReadOptions *options) {
-    status_t err;
-
-    *out = NULL;
-
-    int64_t seekTimeUs;
-    ReadOptions::SeekMode mode;
-    CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode));
-    bool readFromSource = false;
-    int64_t wallClockTimeUs = -1;
-
-    while (mNumInputSamples < kNumSamplesPerFrame) {
-        if (mInputBuffer == NULL) {
-            err = mSource->read(&mInputBuffer, options);
-
-            if (err != OK) {
-                if (mNumInputSamples == 0) {
-                    return ERROR_END_OF_STREAM;
-                }
-                memset(&mInputFrame[mNumInputSamples],
-                       0,
-                       sizeof(int16_t)
-                            * (kNumSamplesPerFrame - mNumInputSamples));
-                mNumInputSamples = kNumSamplesPerFrame;
-                break;
-            }
-
-            size_t align = mInputBuffer->range_length() % sizeof(int16_t);
-            CHECK_EQ(align, 0);
-            readFromSource = true;
-
-            int64_t timeUs;
-            if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) {
-                wallClockTimeUs = timeUs;
-            }
-            if (mInputBuffer->meta_data()->findInt64(kKeyAnchorTime, &timeUs)) {
-                mAnchorTimeUs = timeUs;
-            }
-        } else {
-            readFromSource = false;
-        }
-
-        size_t copy =
-            (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
-
-        if (copy > mInputBuffer->range_length()) {
-            copy = mInputBuffer->range_length();
-        }
-
-        memcpy(&mInputFrame[mNumInputSamples],
-               (const uint8_t *)mInputBuffer->data()
-                    + mInputBuffer->range_offset(),
-               copy);
-
-        mNumInputSamples += copy / sizeof(int16_t);
-
-        mInputBuffer->set_range(
-                mInputBuffer->range_offset() + copy,
-                mInputBuffer->range_length() - copy);
-
-        if (mInputBuffer->range_length() == 0) {
-            mInputBuffer->release();
-            mInputBuffer = NULL;
-        }
-    }
-
-    MediaBuffer *buffer;
-    CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK);
-
-    uint8_t *outPtr = (uint8_t *)buffer->data();
-
-    Frame_Type_3GPP frameType;
-    int res = AMREncode(
-            mEncState, mSidState, (Mode)mMode,
-            mInputFrame, outPtr, &frameType, AMR_TX_WMF);
-
-    CHECK(res >= 0);
-    CHECK((size_t)res < buffer->size());
-
-    // Convert header byte from WMF to IETF format.
-    outPtr[0] = ((outPtr[0] << 3) | 4) & 0x7c;
-
-    buffer->set_range(0, res);
-
-    // Each frame of 160 samples is 20ms long.
-    int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
-    buffer->meta_data()->setInt64(
-            kKeyTime, mAnchorTimeUs + mediaTimeUs);
-
-    if (readFromSource && wallClockTimeUs != -1) {
-        buffer->meta_data()->setInt64(kKeyDriftTime,
-            mediaTimeUs - wallClockTimeUs);
-    }
-
-    ++mNumFramesOutput;
-
-    *out = buffer;
-
-    mNumInputSamples = 0;
-
-    return OK;
-}
-
-}  // namespace android
diff --git a/media/libstagefright/codecs/amrnb/enc/Android.mk b/media/libstagefright/codecs/amrnb/enc/Android.mk
index 21937bf..28246ae 100644
--- a/media/libstagefright/codecs/amrnb/enc/Android.mk
+++ b/media/libstagefright/codecs/amrnb/enc/Android.mk
@@ -2,7 +2,6 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
-        AMRNBEncoder.cpp \
 	src/amrencode.cpp \
  	src/autocorr.cpp \
  	src/c1035pf.cpp \
diff --git a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp b/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
deleted file mode 100644
index 7fd3a95..0000000
--- a/media/libstagefright/codecs/amrwbenc/AMRWBEncoder.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "AMRWBEncoder"
-#include <utils/Log.h>
-
-#include "AMRWBEncoder.h"
-#include "voAMRWB.h"
-#include "cmnMemory.h"
-
-#include <media/stagefright/foundation/ADebug.h>
-#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDefs.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-static const int32_t kNumSamplesPerFrame = 320;
-static const int32_t kBitsPerSample = 16;
-static const int32_t kInputBufferSize = (kBitsPerSample / 8) * kNumSamplesPerFrame;
-static const int32_t kSampleRate = 16000;
-static const int32_t kNumChannels = 1;
-
-AMRWBEncoder::AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta)
-    : mSource(source),
-      mMeta(meta),
-      mStarted(false),
-      mBufferGroup(NULL),
-      mInputBuffer(NULL),
-      mEncoderHandle(NULL),
-      mApiHandle(NULL),
-      mMemOperator(NULL),
-      mAnchorTimeUs(0),
-      mNumFramesOutput(0),
-      mNumInputSamples(0) {
-}
-
-static VOAMRWBMODE pickModeFromBitRate(int32_t bps) {
-    CHECK(bps >= 0);
-    if (bps <= 6600) {
-        return VOAMRWB_MD66;
-    } else if (bps <= 8850) {
-        return VOAMRWB_MD885;
-    } else if (bps <= 12650) {
-        return VOAMRWB_MD1265;
-    } else if (bps <= 14250) {
-        return VOAMRWB_MD1425;
-    } else if (bps <= 15850) {
-        return VOAMRWB_MD1585;
-    } else if (bps <= 18250) {
-        return VOAMRWB_MD1825;
-    } else if (bps <= 19850) {
-        return VOAMRWB_MD1985;
-    } else if (bps <= 23050) {
-        return VOAMRWB_MD2305;
-    }
-    return VOAMRWB_MD2385;
-}
-
-status_t AMRWBEncoder::initCheck() {
-    CHECK(mApiHandle == NULL && mEncoderHandle == NULL);
-    CHECK(mMeta->findInt32(kKeyBitRate, &mBitRate));
-
-    mApiHandle = new VO_AUDIO_CODECAPI;
-    CHECK(mApiHandle);
-
-    if (VO_ERR_NONE != voGetAMRWBEncAPI(mApiHandle)) {
-        ALOGE("Failed to get api handle");
-        return UNKNOWN_ERROR;
-    }
-
-    mMemOperator = new VO_MEM_OPERATOR;
-    CHECK(mMemOperator != NULL);
-    mMemOperator->Alloc = cmnMemAlloc;
-    mMemOperator->Copy = cmnMemCopy;
-    mMemOperator->Free = cmnMemFree;
-    mMemOperator->Set = cmnMemSet;
-    mMemOperator->Check = cmnMemCheck;
-
-    VO_CODEC_INIT_USERDATA userData;
-    memset(&userData, 0, sizeof(userData));
-    userData.memflag = VO_IMF_USERMEMOPERATOR;
-    userData.memData = (VO_PTR) mMemOperator;
-    if (VO_ERR_NONE != mApiHandle->Init(&mEncoderHandle, VO_AUDIO_CodingAMRWB, &userData)) {
-        ALOGE("Failed to init AMRWB encoder");
-        return UNKNOWN_ERROR;
-    }
-
-    // Configure AMRWB encoder$
-    VOAMRWBMODE mode = pickModeFromBitRate(mBitRate);
-    if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_MODE,  &mode)) {
-        ALOGE("Failed to set AMRWB encoder mode to %d", mode);
-        return UNKNOWN_ERROR;
-    }
-
-    VOAMRWBFRAMETYPE type = VOAMRWB_RFC3267;
-    if (VO_ERR_NONE != mApiHandle->SetParam(mEncoderHandle, VO_PID_AMRWB_FRAMETYPE, &type)) {
-        ALOGE("Failed to set AMRWB encoder frame type to %d", type);
-        return UNKNOWN_ERROR;
-    }
-
-    return OK;
-}
-
-AMRWBEncoder::~AMRWBEncoder() {
-    if (mStarted) {
-        stop();
-    }
-}
-
-status_t AMRWBEncoder::start(MetaData *params) {
-    if (mStarted) {
-        ALOGW("Call start() when encoder already started");
-        return OK;
-    }
-
-    mBufferGroup = new MediaBufferGroup;
-
-    // The largest buffer size is header + 477 bits
-    mBufferGroup->add_buffer(new MediaBuffer(1024));
-
-    CHECK_EQ((status_t)OK, initCheck());
-
-    mNumFramesOutput = 0;
-
-    status_t err = mSource->start(params);
-    if (err != OK) {
-        ALOGE("AudioSource is not available");
-        return err;
-    }
-    mStarted = true;
-
-    return OK;
-}
-
-status_t AMRWBEncoder::stop() {
-    if (!mStarted) {
-        ALOGW("Call stop() when encoder has not started");
-        return OK;
-    }
-
-    if (mInputBuffer) {
-        mInputBuffer->release();
-        mInputBuffer = NULL;
-    }
-
-    delete mBufferGroup;
-    mBufferGroup = NULL;
-
-
-    CHECK_EQ((VO_U32)VO_ERR_NONE, mApiHandle->Uninit(mEncoderHandle));
-    mEncoderHandle = NULL;
-
-    delete mApiHandle;
-    mApiHandle = NULL;
-
-    delete mMemOperator;
-    mMemOperator;
-
-    mStarted = false;
-
-    mSource->stop();
-    return OK;
-}
-
-sp<MetaData> AMRWBEncoder::getFormat() {
-    sp<MetaData> srcFormat = mSource->getFormat();
-
-    mMeta->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_AMR_WB);
-
-    int64_t durationUs;
-    if (srcFormat->findInt64(kKeyDuration, &durationUs)) {
-        mMeta->setInt64(kKeyDuration, durationUs);
-    }
-
-    mMeta->setCString(kKeyDecoderComponent, "AMRWBEncoder");
-
-    return mMeta;
-}
-
-status_t AMRWBEncoder::read(
-        MediaBuffer **out, const ReadOptions *options) {
-    status_t err;
-
-    *out = NULL;
-
-    int64_t seekTimeUs;
-    ReadOptions::SeekMode mode;
-    CHECK(options == NULL || !options->getSeekTo(&seekTimeUs, &mode));
-    bool readFromSource = false;
-    int64_t wallClockTimeUs = -1;
-
-    while (mNumInputSamples < kNumSamplesPerFrame) {
-        if (mInputBuffer == NULL) {
-            err = mSource->read(&mInputBuffer, options);
-
-            if (err != OK) {
-                if (mNumInputSamples == 0) {
-                    return ERROR_END_OF_STREAM;
-                }
-                memset(&mInputFrame[mNumInputSamples],
-                       0,
-                       sizeof(int16_t)
-                            * (kNumSamplesPerFrame - mNumInputSamples));
-                mNumInputSamples = 0;
-                break;
-            }
-
-            size_t align = mInputBuffer->range_length() % sizeof(int16_t);
-            CHECK_EQ(align, (size_t)0);
-
-            int64_t timeUs;
-            if (mInputBuffer->meta_data()->findInt64(kKeyDriftTime, &timeUs)) {
-                wallClockTimeUs = timeUs;
-            }
-            if (mInputBuffer->meta_data()->findInt64(kKeyAnchorTime, &timeUs)) {
-                mAnchorTimeUs = timeUs;
-            }
-            readFromSource = true;
-        } else {
-            readFromSource = false;
-        }
-
-        size_t copy =
-            (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
-
-        if (copy > mInputBuffer->range_length()) {
-            copy = mInputBuffer->range_length();
-        }
-
-        memcpy(&mInputFrame[mNumInputSamples],
-               (const uint8_t *)mInputBuffer->data()
-                    + mInputBuffer->range_offset(),
-               copy);
-
-        mInputBuffer->set_range(
-                mInputBuffer->range_offset() + copy,
-                mInputBuffer->range_length() - copy);
-
-        if (mInputBuffer->range_length() == 0) {
-            mInputBuffer->release();
-            mInputBuffer = NULL;
-        }
-
-        mNumInputSamples += copy / sizeof(int16_t);
-        if (mNumInputSamples >= kNumSamplesPerFrame) {
-            mNumInputSamples %= kNumSamplesPerFrame;
-            break;  // Get a whole input frame 640 bytes
-        }
-    }
-
-    VO_CODECBUFFER inputData;
-    memset(&inputData, 0, sizeof(inputData));
-    inputData.Buffer = (unsigned char*) mInputFrame;
-    inputData.Length = kInputBufferSize;
-    CHECK(VO_ERR_NONE == mApiHandle->SetInputData(mEncoderHandle,&inputData));
-
-    MediaBuffer *buffer;
-    CHECK_EQ(mBufferGroup->acquire_buffer(&buffer), (status_t)OK);
-    uint8_t *outPtr = (uint8_t *)buffer->data();
-
-    VO_CODECBUFFER outputData;
-    memset(&outputData, 0, sizeof(outputData));
-    VO_AUDIO_OUTPUTINFO outputInfo;
-    memset(&outputInfo, 0, sizeof(outputInfo));
-
-    VO_U32 ret = VO_ERR_NONE;
-    outputData.Buffer = outPtr;
-    outputData.Length = buffer->size();
-    ret = mApiHandle->GetOutputData(mEncoderHandle, &outputData, &outputInfo);
-    CHECK(ret == VO_ERR_NONE || ret == VO_ERR_INPUT_BUFFER_SMALL);
-
-    buffer->set_range(0, outputData.Length);
-    ++mNumFramesOutput;
-
-    int64_t mediaTimeUs = mNumFramesOutput * 20000LL;
-    buffer->meta_data()->setInt64(kKeyTime, mAnchorTimeUs + mediaTimeUs);
-    if (readFromSource && wallClockTimeUs != -1) {
-        buffer->meta_data()->setInt64(kKeyDriftTime, mediaTimeUs - wallClockTimeUs);
-    }
-
-    *out = buffer;
-    return OK;
-}
-
-}  // namespace android
diff --git a/media/libstagefright/codecs/amrwbenc/Android.mk b/media/libstagefright/codecs/amrwbenc/Android.mk
index 3a46ec8..d3c3041 100644
--- a/media/libstagefright/codecs/amrwbenc/Android.mk
+++ b/media/libstagefright/codecs/amrwbenc/Android.mk
@@ -5,7 +5,6 @@
 
 
 LOCAL_SRC_FILES := \
-	AMRWBEncoder.cpp \
 	src/autocorr.c \
 	src/az_isp.c \
 	src/bits.c \
diff --git a/media/libstagefright/codecs/g711/dec/SoftG711.cpp b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
index 32ef003..bcdd3c7 100644
--- a/media/libstagefright/codecs/g711/dec/SoftG711.cpp
+++ b/media/libstagefright/codecs/g711/dec/SoftG711.cpp
@@ -140,7 +140,7 @@
             OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams =
                 (OMX_AUDIO_PARAM_PCMMODETYPE *)params;
 
-            if (pcmParams->nPortIndex != 0) {
+            if (pcmParams->nPortIndex != 0 && pcmParams->nPortIndex != 1) {
                 return OMX_ErrorUndefined;
             }
 
@@ -148,7 +148,9 @@
                 return OMX_ErrorUndefined;
             }
 
-            mNumChannels = pcmParams->nChannels;
+            if(pcmParams->nPortIndex == 0) {
+                mNumChannels = pcmParams->nChannels;
+            }
 
             return OMX_ErrorNone;
         }
diff --git a/media/libstagefright/include/AACDecoder.h b/media/libstagefright/include/AACDecoder.h
deleted file mode 100644
index 886a3b7..0000000
--- a/media/libstagefright/include/AACDecoder.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AAC_DECODER_H_
-
-#define AAC_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct tPVMP4AudioDecoderExternal;
-
-namespace android {
-
-struct MediaBufferGroup;
-struct MetaData;
-
-struct AACDecoder : public MediaSource {
-    AACDecoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~AACDecoder();
-
-private:
-    sp<MetaData>    mMeta;
-    sp<MediaSource> mSource;
-    bool mStarted;
-
-    MediaBufferGroup *mBufferGroup;
-
-    tPVMP4AudioDecoderExternal *mConfig;
-    void *mDecoderBuf;
-    int64_t mAnchorTimeUs;
-    int64_t mNumSamplesOutput;
-    status_t mInitCheck;
-    int64_t  mNumDecodedBuffers;
-    int32_t  mUpsamplingFactor;
-
-    MediaBuffer *mInputBuffer;
-
-    status_t initCheck();
-    AACDecoder(const AACDecoder &);
-    AACDecoder &operator=(const AACDecoder &);
-};
-
-}  // namespace android
-
-#endif  // AAC_DECODER_H_
diff --git a/media/libstagefright/include/AMRNBDecoder.h b/media/libstagefright/include/AMRNBDecoder.h
deleted file mode 100644
index cf24eda..0000000
--- a/media/libstagefright/include/AMRNBDecoder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AMR_NB_DECODER_H_
-
-#define AMR_NB_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRNBDecoder : public MediaSource {
-    AMRNBDecoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~AMRNBDecoder();
-
-private:
-    sp<MediaSource> mSource;
-    bool mStarted;
-
-    MediaBufferGroup *mBufferGroup;
-
-    void *mState;
-    int64_t mAnchorTimeUs;
-    int64_t mNumSamplesOutput;
-
-    MediaBuffer *mInputBuffer;
-
-    AMRNBDecoder(const AMRNBDecoder &);
-    AMRNBDecoder &operator=(const AMRNBDecoder &);
-};
-
-}  // namespace android
-
-#endif  // AMR_NB_DECODER_H_
diff --git a/media/libstagefright/include/AMRNBEncoder.h b/media/libstagefright/include/AMRNBEncoder.h
deleted file mode 100644
index 71160e6..0000000
--- a/media/libstagefright/include/AMRNBEncoder.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AMR_NB_ENCODER_H_
-
-#define AMR_NB_ENCODER_H_
-
-#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/MetaData.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRNBEncoder : public MediaSource {
-    AMRNBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~AMRNBEncoder();
-
-private:
-    sp<MediaSource> mSource;
-    sp<MetaData>    mMeta;
-    bool mStarted;
-
-    MediaBufferGroup *mBufferGroup;
-
-    void *mEncState;
-    void *mSidState;
-    int64_t mAnchorTimeUs;
-    int64_t mNumFramesOutput;
-
-    MediaBuffer *mInputBuffer;
-    int mMode;
-
-    int16_t mInputFrame[160];
-    int32_t mNumInputSamples;
-
-    AMRNBEncoder(const AMRNBEncoder &);
-    AMRNBEncoder &operator=(const AMRNBEncoder &);
-};
-
-}  // namespace android
-
-#endif  // AMR_NB_ENCODER_H_
diff --git a/media/libstagefright/include/AMRWBDecoder.h b/media/libstagefright/include/AMRWBDecoder.h
deleted file mode 100644
index 927c51c..0000000
--- a/media/libstagefright/include/AMRWBDecoder.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AMR_WB_DECODER_H_
-
-#define AMR_WB_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct AMRWBDecoder : public MediaSource {
-    AMRWBDecoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~AMRWBDecoder();
-
-private:
-    sp<MediaSource> mSource;
-    bool mStarted;
-
-    MediaBufferGroup *mBufferGroup;
-
-    void *mState;
-    void *mDecoderBuf;
-    int16_t *mDecoderCookie;
-    int64_t mAnchorTimeUs;
-    int64_t mNumSamplesOutput;
-    int16_t mInputSampleBuffer[477];
-
-    MediaBuffer *mInputBuffer;
-
-    AMRWBDecoder(const AMRWBDecoder &);
-    AMRWBDecoder &operator=(const AMRWBDecoder &);
-};
-
-}  // namespace android
-
-#endif  // AMR_WB_DECODER_H_
diff --git a/media/libstagefright/include/AMRWBEncoder.h b/media/libstagefright/include/AMRWBEncoder.h
deleted file mode 100644
index f2d155f..0000000
--- a/media/libstagefright/include/AMRWBEncoder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AMR_WB_ENCODER_H
-#define AMR_WB_ENCODER_H
-
-#include <media/stagefright/MediaSource.h>
-#include <media/stagefright/MetaData.h>
-
-struct VO_AUDIO_CODECAPI;
-struct VO_MEM_OPERATOR;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-class AMRWBEncoder: public MediaSource {
-    public:
-        AMRWBEncoder(const sp<MediaSource> &source, const sp<MetaData> &meta);
-
-        virtual status_t start(MetaData *params);
-        virtual status_t stop();
-        virtual sp<MetaData> getFormat();
-        virtual status_t read(
-                MediaBuffer **buffer, const ReadOptions *options);
-
-
-    protected:
-        virtual ~AMRWBEncoder();
-
-    private:
-        sp<MediaSource>   mSource;
-        sp<MetaData>      mMeta;
-        bool              mStarted;
-        MediaBufferGroup *mBufferGroup;
-        MediaBuffer      *mInputBuffer;
-        status_t          mInitCheck;
-        int32_t           mBitRate;
-        void             *mEncoderHandle;
-        VO_AUDIO_CODECAPI *mApiHandle;
-        VO_MEM_OPERATOR  *mMemOperator;
-
-        int64_t mAnchorTimeUs;
-        int64_t mNumFramesOutput;
-
-        int16_t mInputFrame[320];
-        int32_t mNumInputSamples;
-
-        status_t initCheck();
-
-        AMRWBEncoder& operator=(const AMRWBEncoder &rhs);
-        AMRWBEncoder(const AMRWBEncoder& copy);
-
-};
-
-}
-
-#endif  //#ifndef AMR_WB_ENCODER_H
-
diff --git a/media/libstagefright/include/AVCDecoder.h b/media/libstagefright/include/AVCDecoder.h
deleted file mode 100644
index eb3b142..0000000
--- a/media/libstagefright/include/AVCDecoder.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef AVC_DECODER_H_
-
-#define AVC_DECODER_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-struct tagAVCHandle;
-
-namespace android {
-
-struct AVCDecoder : public MediaSource,
-                    public MediaBufferObserver {
-    AVCDecoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-    virtual void signalBufferReturned(MediaBuffer *buffer);
-
-protected:
-    virtual ~AVCDecoder();
-
-private:
-    sp<MediaSource> mSource;
-    bool mStarted;
-
-    sp<MetaData> mFormat;
-
-    Vector<MediaBuffer *> mCodecSpecificData;
-
-    tagAVCHandle *mHandle;
-    Vector<MediaBuffer *> mFrames;
-    MediaBuffer *mInputBuffer;
-
-    int64_t mAnchorTimeUs;
-    int64_t mNumSamplesOutput;
-    int64_t mPendingSeekTimeUs;
-    MediaSource::ReadOptions::SeekMode mPendingSeekMode;
-
-    int64_t mTargetTimeUs;
-
-    bool mSPSSeen;
-    bool mPPSSeen;
-
-    void addCodecSpecificData(const uint8_t *data, size_t size);
-
-    static int32_t ActivateSPSWrapper(
-            void *userData, unsigned int sizeInMbs, unsigned int numBuffers);
-
-    static int32_t BindFrameWrapper(
-            void *userData, int32_t index, uint8_t **yuv);
-
-    static void UnbindFrame(void *userData, int32_t index);
-
-    int32_t activateSPS(
-            unsigned int sizeInMbs, unsigned int numBuffers);
-
-    int32_t bindFrame(int32_t index, uint8_t **yuv);
-
-    void releaseFrames();
-
-    MediaBuffer *drainOutputBuffer();
-
-    AVCDecoder(const AVCDecoder &);
-    AVCDecoder &operator=(const AVCDecoder &);
-};
-
-}  // namespace android
-
-#endif  // AVC_DECODER_H_
diff --git a/media/libstagefright/include/G711Decoder.h b/media/libstagefright/include/G711Decoder.h
deleted file mode 100644
index 8b5143a..0000000
--- a/media/libstagefright/include/G711Decoder.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef G711_DECODER_H_
-
-#define G711_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct G711Decoder : public MediaSource {
-    G711Decoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~G711Decoder();
-
-private:
-    sp<MediaSource> mSource;
-    bool mStarted;
-    bool mIsMLaw;
-
-    MediaBufferGroup *mBufferGroup;
-
-    static void DecodeALaw(int16_t *out, const uint8_t *in, size_t inSize);
-    static void DecodeMLaw(int16_t *out, const uint8_t *in, size_t inSize);
-
-    G711Decoder(const G711Decoder &);
-    G711Decoder &operator=(const G711Decoder &);
-};
-
-}  // namespace android
-
-#endif  // G711_DECODER_H_
diff --git a/media/libstagefright/include/M4vH263Decoder.h b/media/libstagefright/include/M4vH263Decoder.h
deleted file mode 100644
index 7d73e30..0000000
--- a/media/libstagefright/include/M4vH263Decoder.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef M4V_H263_DECODER_H_
-
-#define M4V_H263_DECODER_H_
-
-#include <media/stagefright/MediaBuffer.h>
-#include <media/stagefright/MediaSource.h>
-
-struct tagvideoDecControls;
-
-namespace android {
-
-struct M4vH263Decoder : public MediaSource,
-                        public MediaBufferObserver {
-    M4vH263Decoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-    virtual void signalBufferReturned(MediaBuffer *buffer);
-
-protected:
-    virtual ~M4vH263Decoder();
-
-private:
-    sp<MediaSource> mSource;
-    bool mStarted;
-    int32_t mWidth, mHeight;
-
-    sp<MetaData> mFormat;
-
-    tagvideoDecControls *mHandle;
-    MediaBuffer *mFrames[2];
-    MediaBuffer *mInputBuffer;
-
-    int64_t mNumSamplesOutput;
-    int64_t mTargetTimeUs;
-
-    void allocateFrames(int32_t width, int32_t height);
-    void releaseFrames();
-
-    M4vH263Decoder(const M4vH263Decoder &);
-    M4vH263Decoder &operator=(const M4vH263Decoder &);
-};
-
-}  // namespace android
-
-#endif  // M4V_H263_DECODER_H_
diff --git a/media/libstagefright/include/MP3Decoder.h b/media/libstagefright/include/MP3Decoder.h
deleted file mode 100644
index 4086fb6..0000000
--- a/media/libstagefright/include/MP3Decoder.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef MP3_DECODER_H_
-
-#define MP3_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct tPVMP3DecoderExternal;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct MP3Decoder : public MediaSource {
-    MP3Decoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~MP3Decoder();
-
-private:
-    sp<MediaSource> mSource;
-    sp<MetaData> mMeta;
-    int32_t mNumChannels;
-
-    bool mStarted;
-
-    MediaBufferGroup *mBufferGroup;
-
-    tPVMP3DecoderExternal *mConfig;
-    void *mDecoderBuf;
-    int64_t mAnchorTimeUs;
-    int64_t mNumFramesOutput;
-
-    MediaBuffer *mInputBuffer;
-
-    void init();
-
-    MP3Decoder(const MP3Decoder &);
-    MP3Decoder &operator=(const MP3Decoder &);
-};
-
-}  // namespace android
-
-#endif  // MP3_DECODER_H_
diff --git a/media/libstagefright/include/VPXDecoder.h b/media/libstagefright/include/VPXDecoder.h
deleted file mode 100644
index 3b8362d..0000000
--- a/media/libstagefright/include/VPXDecoder.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef VPX_DECODER_H_
-
-#define VPX_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-#include <utils/Vector.h>
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct VPXDecoder : public MediaSource {
-    VPXDecoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~VPXDecoder();
-
-private:
-    sp<MediaSource> mSource;
-    bool mStarted;
-    int32_t mWidth, mHeight;
-    size_t mBufferSize;
-
-    void *mCtx;
-    MediaBufferGroup *mBufferGroup;
-
-    int64_t mTargetTimeUs;
-
-    sp<MetaData> mFormat;
-
-    VPXDecoder(const VPXDecoder &);
-    VPXDecoder &operator=(const VPXDecoder &);
-};
-
-}  // namespace android
-
-#endif  // VPX_DECODER_H_
-
diff --git a/media/libstagefright/include/VorbisDecoder.h b/media/libstagefright/include/VorbisDecoder.h
deleted file mode 100644
index 13e8b77..0000000
--- a/media/libstagefright/include/VorbisDecoder.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef VORBIS_DECODER_H_
-
-#define VORBIS_DECODER_H_
-
-#include <media/stagefright/MediaSource.h>
-
-struct vorbis_dsp_state;
-struct vorbis_info;
-
-namespace android {
-
-struct MediaBufferGroup;
-
-struct VorbisDecoder : public MediaSource {
-    VorbisDecoder(const sp<MediaSource> &source);
-
-    virtual status_t start(MetaData *params);
-    virtual status_t stop();
-
-    virtual sp<MetaData> getFormat();
-
-    virtual status_t read(
-            MediaBuffer **buffer, const ReadOptions *options);
-
-protected:
-    virtual ~VorbisDecoder();
-
-private:
-    enum {
-        kMaxNumSamplesPerBuffer = 8192 * 2
-    };
-
-    sp<MediaSource> mSource;
-    bool mStarted;
-
-    MediaBufferGroup *mBufferGroup;
-
-    int32_t mNumChannels;
-    int32_t mSampleRate;
-    int64_t mAnchorTimeUs;
-    int64_t mNumFramesOutput;
-    int32_t mNumFramesLeftOnPage;
-
-    vorbis_dsp_state *mState;
-    vorbis_info *mVi;
-
-    int decodePacket(MediaBuffer *packet, MediaBuffer *out);
-
-    VorbisDecoder(const VorbisDecoder &);
-    VorbisDecoder &operator=(const VorbisDecoder &);
-};
-
-}  // namespace android
-
-#endif  // VORBIS_DECODER_H_
-
diff --git a/media/libstagefright/omx/Android.mk b/media/libstagefright/omx/Android.mk
index f587a9c..083c7ef 100644
--- a/media/libstagefright/omx/Android.mk
+++ b/media/libstagefright/omx/Android.mk
@@ -5,7 +5,6 @@
 
 LOCAL_SRC_FILES:=                     \
         OMX.cpp                       \
-        OMXComponentBase.cpp          \
         OMXMaster.cpp                 \
         OMXNodeInstance.cpp           \
         SimpleSoftOMXComponent.cpp    \
diff --git a/media/libstagefright/omx/OMXComponentBase.cpp b/media/libstagefright/omx/OMXComponentBase.cpp
deleted file mode 100644
index 7d11dce..0000000
--- a/media/libstagefright/omx/OMXComponentBase.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "OMXComponentBase.h"
-
-#include <stdlib.h>
-
-#include <media/stagefright/foundation/ADebug.h>
-
-namespace android {
-
-OMXComponentBase::OMXComponentBase(
-        const OMX_CALLBACKTYPE *callbacks,
-        OMX_PTR appData)
-    : mCallbacks(callbacks),
-      mAppData(appData),
-      mComponentHandle(NULL) {
-}
-
-OMXComponentBase::~OMXComponentBase() {}
-
-void OMXComponentBase::setComponentHandle(OMX_COMPONENTTYPE *handle) {
-    CHECK(mComponentHandle == NULL);
-    mComponentHandle = handle;
-}
-
-void OMXComponentBase::postEvent(
-        OMX_EVENTTYPE event, OMX_U32 param1, OMX_U32 param2) {
-    (*mCallbacks->EventHandler)(
-            mComponentHandle, mAppData, event, param1, param2, NULL);
-}
-
-void OMXComponentBase::postFillBufferDone(OMX_BUFFERHEADERTYPE *bufHdr) {
-    (*mCallbacks->FillBufferDone)(mComponentHandle, mAppData, bufHdr);
-}
-
-void OMXComponentBase::postEmptyBufferDone(OMX_BUFFERHEADERTYPE *bufHdr) {
-    (*mCallbacks->EmptyBufferDone)(mComponentHandle, mAppData, bufHdr);
-}
-
-static OMXComponentBase *getBase(OMX_HANDLETYPE hComponent) {
-    return (OMXComponentBase *)
-        ((OMX_COMPONENTTYPE *)hComponent)->pComponentPrivate;
-}
-
-static OMX_ERRORTYPE SendCommandWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_COMMANDTYPE Cmd,
-        OMX_IN  OMX_U32 nParam1,
-        OMX_IN  OMX_PTR pCmdData) {
-    return getBase(hComponent)->sendCommand(Cmd, nParam1, pCmdData);
-}
-
-static OMX_ERRORTYPE GetParameterWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent, 
-        OMX_IN  OMX_INDEXTYPE nParamIndex,  
-        OMX_INOUT OMX_PTR pComponentParameterStructure) {
-    return getBase(hComponent)->getParameter(
-            nParamIndex, pComponentParameterStructure);
-}
-
-static OMX_ERRORTYPE SetParameterWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent, 
-        OMX_IN  OMX_INDEXTYPE nIndex,
-        OMX_IN  OMX_PTR pComponentParameterStructure) {
-    return getBase(hComponent)->getParameter(
-            nIndex, pComponentParameterStructure);
-}
-
-static OMX_ERRORTYPE GetConfigWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_INDEXTYPE nIndex, 
-        OMX_INOUT OMX_PTR pComponentConfigStructure) {
-    return getBase(hComponent)->getConfig(nIndex, pComponentConfigStructure);
-}
-
-static OMX_ERRORTYPE SetConfigWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_INDEXTYPE nIndex, 
-        OMX_IN  OMX_PTR pComponentConfigStructure) {
-    return getBase(hComponent)->setConfig(nIndex, pComponentConfigStructure);
-}
-
-static OMX_ERRORTYPE GetExtensionIndexWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_STRING cParameterName,
-        OMX_OUT OMX_INDEXTYPE* pIndexType) {
-    return getBase(hComponent)->getExtensionIndex(cParameterName, pIndexType);
-}
-
-static OMX_ERRORTYPE GetStateWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_OUT OMX_STATETYPE* pState) {
-    return getBase(hComponent)->getState(pState);
-}
-
-static OMX_ERRORTYPE UseBufferWrapper(
-        OMX_IN OMX_HANDLETYPE hComponent,
-        OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr,
-        OMX_IN OMX_U32 nPortIndex,
-        OMX_IN OMX_PTR pAppPrivate,
-        OMX_IN OMX_U32 nSizeBytes,
-        OMX_IN OMX_U8* pBuffer) {
-    return getBase(hComponent)->useBuffer(
-            ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
-}
-
-static OMX_ERRORTYPE AllocateBufferWrapper(
-        OMX_IN OMX_HANDLETYPE hComponent,
-        OMX_INOUT OMX_BUFFERHEADERTYPE** ppBuffer,
-        OMX_IN OMX_U32 nPortIndex,
-        OMX_IN OMX_PTR pAppPrivate,
-        OMX_IN OMX_U32 nSizeBytes) {
-    return getBase(hComponent)->allocateBuffer(
-            ppBuffer, nPortIndex, pAppPrivate, nSizeBytes);
-}
-
-static OMX_ERRORTYPE FreeBufferWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_U32 nPortIndex,
-        OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer) {
-    return getBase(hComponent)->freeBuffer(nPortIndex, pBuffer);
-}
-
-static OMX_ERRORTYPE EmptyThisBufferWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer) {
-    return getBase(hComponent)->emptyThisBuffer(pBuffer);
-}
-
-static OMX_ERRORTYPE FillThisBufferWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent,
-        OMX_IN  OMX_BUFFERHEADERTYPE* pBuffer) {
-    return getBase(hComponent)->fillThisBuffer(pBuffer);
-}
-
-static OMX_ERRORTYPE ComponentDeInitWrapper(
-        OMX_IN  OMX_HANDLETYPE hComponent) {
-    delete getBase(hComponent);
-    delete (OMX_COMPONENTTYPE *)hComponent;
-
-    return OMX_ErrorNone;
-}
-
-static OMX_ERRORTYPE ComponentRoleEnumWrapper(
-        OMX_IN OMX_HANDLETYPE hComponent,
-        OMX_OUT OMX_U8 *cRole,
-        OMX_IN OMX_U32 nIndex) {
-    return getBase(hComponent)->enumerateRoles(cRole, nIndex);
-}
-
-// static
-OMX_COMPONENTTYPE *OMXComponentBase::MakeComponent(OMXComponentBase *base) {
-    OMX_COMPONENTTYPE *result = new OMX_COMPONENTTYPE;
-
-    result->nSize = sizeof(OMX_COMPONENTTYPE);
-    result->nVersion.s.nVersionMajor = 1;
-    result->nVersion.s.nVersionMinor = 0;
-    result->nVersion.s.nRevision = 0;
-    result->nVersion.s.nStep = 0;
-    result->pComponentPrivate = base;
-    result->pApplicationPrivate = NULL;
-
-    result->GetComponentVersion = NULL;
-    result->SendCommand = SendCommandWrapper;
-    result->GetParameter = GetParameterWrapper;
-    result->SetParameter = SetParameterWrapper;
-    result->GetConfig = GetConfigWrapper;
-    result->SetConfig = SetConfigWrapper;
-    result->GetExtensionIndex = GetExtensionIndexWrapper;
-    result->GetState = GetStateWrapper;
-    result->ComponentTunnelRequest = NULL;
-    result->UseBuffer = UseBufferWrapper;
-    result->AllocateBuffer = AllocateBufferWrapper;
-    result->FreeBuffer = FreeBufferWrapper;
-    result->EmptyThisBuffer = EmptyThisBufferWrapper;
-    result->FillThisBuffer = FillThisBufferWrapper;
-    result->SetCallbacks = NULL;
-    result->ComponentDeInit = ComponentDeInitWrapper;
-    result->UseEGLImage = NULL;
-    result->ComponentRoleEnum = ComponentRoleEnumWrapper;
-
-    base->setComponentHandle(result);
-
-    return result;
-}
-
-}  // namespace android
diff --git a/media/libstagefright/omx/OMXComponentBase.h b/media/libstagefright/omx/OMXComponentBase.h
deleted file mode 100644
index fd0df0b..0000000
--- a/media/libstagefright/omx/OMXComponentBase.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OMX_COMPONENT_BASE_H_
-
-#define OMX_COMPONENT_BASE_H_
-
-#include <OMX_Component.h>
-
-namespace android {
-
-struct OMXComponentBase {
-    OMXComponentBase(
-            const OMX_CALLBACKTYPE *callbacks,
-            OMX_PTR appData);
-
-    virtual ~OMXComponentBase();
-
-    virtual OMX_ERRORTYPE sendCommand(
-            OMX_COMMANDTYPE cmd, OMX_U32 param, OMX_PTR cmdData) = 0;
-
-    virtual OMX_ERRORTYPE getParameter(
-            OMX_INDEXTYPE index, OMX_PTR params) = 0;
-
-    virtual OMX_ERRORTYPE setParameter(
-            OMX_INDEXTYPE index, const OMX_PTR params) = 0;
-
-    virtual OMX_ERRORTYPE getConfig(
-            OMX_INDEXTYPE index, OMX_PTR config) = 0;
-
-    virtual OMX_ERRORTYPE setConfig(
-            OMX_INDEXTYPE index, const OMX_PTR config) = 0;
-
-    virtual OMX_ERRORTYPE getExtensionIndex(
-            const OMX_STRING name, OMX_INDEXTYPE *index) = 0;
-
-    virtual OMX_ERRORTYPE useBuffer(
-            OMX_BUFFERHEADERTYPE **bufHdr,
-            OMX_U32 portIndex,
-            OMX_PTR appPrivate,
-            OMX_U32 size,
-            OMX_U8 *buffer) = 0;
-
-    virtual OMX_ERRORTYPE allocateBuffer(
-            OMX_BUFFERHEADERTYPE **bufHdr,
-            OMX_U32 portIndex,
-            OMX_PTR appPrivate,
-            OMX_U32 size) = 0;
-
-    virtual OMX_ERRORTYPE freeBuffer(
-            OMX_U32 portIndex,
-            OMX_BUFFERHEADERTYPE *buffer) = 0;
-
-    virtual OMX_ERRORTYPE emptyThisBuffer(OMX_BUFFERHEADERTYPE *buffer) = 0;
-    virtual OMX_ERRORTYPE fillThisBuffer(OMX_BUFFERHEADERTYPE *buffer) = 0;
-
-    virtual OMX_ERRORTYPE enumerateRoles(OMX_U8 *role, OMX_U32 index) = 0;
-
-    virtual OMX_ERRORTYPE getState(OMX_STATETYPE *state) = 0;
-
-    // Wraps a given OMXComponentBase instance into an OMX_COMPONENTTYPE
-    // as required by OpenMAX APIs.
-    static OMX_COMPONENTTYPE *MakeComponent(OMXComponentBase *base);
-
-protected:
-    void postEvent(OMX_EVENTTYPE event, OMX_U32 param1, OMX_U32 param2);
-    void postFillBufferDone(OMX_BUFFERHEADERTYPE *bufHdr);
-    void postEmptyBufferDone(OMX_BUFFERHEADERTYPE *bufHdr);
-
-private:
-    void setComponentHandle(OMX_COMPONENTTYPE *handle);
-
-    const OMX_CALLBACKTYPE *mCallbacks;
-    OMX_PTR mAppData;
-    OMX_COMPONENTTYPE *mComponentHandle;
-
-    OMXComponentBase(const OMXComponentBase &);
-    OMXComponentBase &operator=(const OMXComponentBase &);
-};
-
-}  // namespace android
-
-#endif  // OMX_COMPONENT_BASE_H_
diff --git a/media/libstagefright/timedtext/TimedTextDriver.cpp b/media/libstagefright/timedtext/TimedTextDriver.cpp
index ed83894..8ee15f8 100644
--- a/media/libstagefright/timedtext/TimedTextDriver.cpp
+++ b/media/libstagefright/timedtext/TimedTextDriver.cpp
@@ -175,7 +175,7 @@
     }
 
     sp<TimedTextSource> source;
-    if (strcasecmp(mimeType, MEDIA_MIMETYPE_TEXT_SUBRIP)) {
+    if (strcasecmp(mimeType, MEDIA_MIMETYPE_TEXT_SUBRIP) == 0) {
         source = TimedTextSource::CreateTimedTextSource(
                 dataSource, TimedTextSource::OUT_OF_BAND_FILE_SRT);
     }