Change OMXCodec::Create to return an sp<MediaSource> instead of an sp<OMXCodec>, this is more general and does not sacrifice any functionality as the remaining OMXCodec APIs are not meant to be public anyway.
diff --git a/cmds/stagefright/audioloop.cpp b/cmds/stagefright/audioloop.cpp
index 70ab559..3788e73 100644
--- a/cmds/stagefright/audioloop.cpp
+++ b/cmds/stagefright/audioloop.cpp
@@ -38,12 +38,12 @@
meta->setInt32(kKeyMaxInputSize, maxInputSize);
}
- sp<OMXCodec> encoder = OMXCodec::Create(
+ sp<MediaSource> encoder = OMXCodec::Create(
client.interface(),
meta, true /* createEncoder */,
source);
- sp<OMXCodec> decoder = OMXCodec::Create(
+ sp<MediaSource> decoder = OMXCodec::Create(
client.interface(),
meta, false /* createEncoder */,
encoder);
diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp
index a31a5c0..2ec0b70 100644
--- a/cmds/stagefright/record.cpp
+++ b/cmds/stagefright/record.cpp
@@ -154,7 +154,7 @@
sp<MetaData> meta = source->getFormat();
- sp<OMXCodec> decoder = OMXCodec::Create(
+ sp<MediaSource> decoder = OMXCodec::Create(
client.interface(), meta, false /* createEncoder */, source);
int width, height;
@@ -173,7 +173,7 @@
enc_meta->setInt32(kKeyWidth, width);
enc_meta->setInt32(kKeyHeight, height);
- sp<OMXCodec> encoder =
+ sp<MediaSource> encoder =
OMXCodec::Create(
client.interface(), enc_meta, true /* createEncoder */, decoder);
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 4199252..351763c 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -33,7 +33,7 @@
enum CreationFlags {
kPreferSoftwareCodecs = 1,
};
- static sp<OMXCodec> Create(
+ static sp<MediaSource> Create(
const sp<IOMX> &omx,
const sp<MetaData> &meta, bool createEncoder,
const sp<MediaSource> &source,
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 670f748..7c77214 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -274,7 +274,7 @@
}
// static
-sp<OMXCodec> OMXCodec::Create(
+sp<MediaSource> OMXCodec::Create(
const sp<IOMX> &omx,
const sp<MetaData> &meta, bool createEncoder,
const sp<MediaSource> &source,