Bug 787228 - Part4: Add libstagefright stub libraries for Gingerbread - r=cpeterson
new file mode 100644
--- /dev/null
+++ b/media/omx-plugin/lib/gb/libstagefright/Makefile.in
@@ -0,0 +1,59 @@
+# Copyright 2012 Mozilla Foundation and Mozilla contributors
+#
+# 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.
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = libandroidstagefrightgb
+MODULE_NAME = libandroidstagefrightgb
+LIBRARY_NAME = stagefright
+FORCE_SHARED_LIB = 1
+
+# Don't use STL wrappers; this isn't Gecko code
+STL_FLAGS =
+
+# must link statically with the CRT; this isn't Gecko code
+USE_STATIC_LIBS = 1
+
+# Need to custom install OMX media plugin
+NO_DIST_INSTALL = 1
+NO_INSTALL = 1
+
+ifneq ($(MOZ_WIDGET_TOOLKIT),gonk)
+CPPSRCS = \
+ libstagefright.cpp \
+ $(NULL)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+ifdef GNU_CXX
+# Turn off C++ 11 features due to conflicts with Android OS headers and char16_t definition
+CXXFLAGS += -std=gnu++98
+endif
+
+INCLUDES += \
+ -I$(topsrcdir)/media/omx-plugin/include/gb \
+ -I$(topsrcdir)/media/omx-plugin/include/gb/media/stagefright/openmax \
+ $(NULL)
+
+EXTRA_DSO_LDOPTS += \
+ -L$(DEPTH)/media/omx-plugin/lib/gb/libutils \
+ -lutils \
+ $(NULL)
+
+
new file mode 100644
--- /dev/null
+++ b/media/omx-plugin/lib/gb/libstagefright/libstagefright.cpp
@@ -0,0 +1,142 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include "mozilla/Types.h"
+#define STAGEFRIGHT_EXPORT __attribute__ ((visibility ("default")))
+#include "stagefright/DataSource.h"
+#include "media/stagefright/MediaBuffer.h"
+#include "stagefright/MediaExtractor.h"
+#include "media/stagefright/MediaSource.h"
+#include "stagefright/MetaData.h"
+#include "media/stagefright/openmax/OMX_Types.h"
+#include "media/stagefright/openmax/OMX_Index.h"
+#include "media/stagefright/openmax/OMX_IVCommon.h"
+#include "media/stagefright/openmax/OMX_Video.h"
+#include "media/stagefright/openmax/OMX_Core.h"
+#include "stagefright/OMXCodec.h"
+#include "stagefright/OMXClient.h"
+
+namespace android {
+MOZ_EXPORT void MediaBuffer::release()
+{
+}
+
+MOZ_EXPORT size_t MediaBuffer::range_offset() const
+{
+ return 0;
+}
+
+MOZ_EXPORT size_t MediaBuffer::range_length() const
+{
+ return 0;
+}
+
+MOZ_EXPORT sp<MetaData> MediaBuffer::meta_data()
+{
+ return 0;
+}
+
+MOZ_EXPORT void* MediaBuffer::data() const
+{
+ return 0;
+}
+
+MOZ_EXPORT size_t MediaBuffer::size() const
+{
+ return 0;
+}
+
+MOZ_EXPORT bool MetaData::findInt32(uint32_t key, int32_t *value)
+{
+ return false;
+}
+
+MOZ_EXPORT bool MetaData::findInt64(uint32_t key, int64_t *value)
+{
+ return false;
+}
+
+MOZ_EXPORT bool MetaData::findPointer(uint32_t key, void **value)
+{
+ return false;
+}
+
+MOZ_EXPORT bool MetaData::findCString(uint32_t key, const char **value)
+{
+ return false;
+}
+
+MOZ_EXPORT MediaSource::ReadOptions::ReadOptions()
+{
+}
+
+MOZ_EXPORT void MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode)
+{
+}
+
+MOZ_EXPORT sp<DataSource> DataSource::CreateFromURI(
+ const char *uri,
+ const KeyedVector<String8, String8> *headers) {
+ return 0;
+}
+
+
+MOZ_EXPORT bool DataSource::getUInt16(off_t offset, uint16_t *x)
+{
+ return false;
+}
+
+MOZ_EXPORT status_t DataSource::getSize(MOZ_STAGEFRIGHT_OFF_T *size)
+{
+ return 0;
+}
+
+MOZ_EXPORT void DataSource::RegisterDefaultSniffers()
+{
+}
+
+MOZ_EXPORT sp<MediaExtractor> MediaExtractor::Create(const sp<DataSource> &source, const char *mime)
+{
+ return 0;
+}
+
+MOZ_EXPORT sp<MediaSource> OMXCodec::Create(
+ const sp<IOMX> &omx,
+ const sp<MetaData> &meta, bool createEncoder,
+ const sp<MediaSource> &source,
+ const char *matchComponentName,
+ uint32_t flags)
+{
+ return 0;
+}
+
+MOZ_EXPORT OMXClient::OMXClient()
+{
+}
+
+MOZ_EXPORT status_t OMXClient::connect()
+{
+ return OK;
+}
+
+MOZ_EXPORT void OMXClient::disconnect()
+{
+}
+
+class __attribute__ ((visibility ("default"))) UnknownDataSource : public DataSource {
+public:
+UnknownDataSource();
+
+virtual status_t initCheck() const { return 0; }
+virtual ssize_t readAt(MOZ_STAGEFRIGHT_OFF_T offset, void *data, size_t size) { return 0; }
+virtual status_t getSize(MOZ_STAGEFRIGHT_OFF_T *size) { return 0; }
+
+virtual ~UnknownDataSource() { }
+};
+
+UnknownDataSource foo;
+
+MOZ_EXPORT UnknownDataSource::UnknownDataSource() { }
+}
new file mode 100644
--- /dev/null
+++ b/media/omx-plugin/lib/gb/libutils/Makefile.in
@@ -0,0 +1,52 @@
+# Copyright 2012 Mozilla Foundation and Mozilla contributors
+#
+# 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.
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = libandroidutilsgb
+MODULE_NAME = libandroidutilsgb
+LIBRARY_NAME = utils
+FORCE_SHARED_LIB = 1
+
+# Don't use STL wrappers; this isn't Gecko code
+STL_FLAGS =
+
+# must link statically with the CRT; this isn't Gecko code
+USE_STATIC_LIBS = 1
+
+# Need to custom install OMX media plugin
+NO_DIST_INSTALL = 1
+NO_INSTALL = 1
+
+ifneq ($(MOZ_WIDGET_TOOLKIT),gonk)
+CPPSRCS = \
+ libutils.cpp \
+ $(NULL)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+ifdef GNU_CXX
+# Turn off C++ 11 features due to conflicts with Android OS headers and char16_t definition
+CXXFLAGS += -std=gnu++98
+endif
+
+INCLUDES += \
+ -I$(topsrcdir)/media/omx-plugin/include/gb \
+ -I$(topsrcdir)/media/omx-plugin/include/gb/media/stagefright/openmax \
+ $(NULL)
new file mode 100644
--- /dev/null
+++ b/media/omx-plugin/lib/gb/libutils/libutils.cpp
@@ -0,0 +1,60 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include "mozilla/Types.h"
+#include "utils/RefBase.h"
+#include "utils/String16.h"
+#include "utils/String8.h"
+
+namespace android {
+MOZ_EXPORT RefBase::RefBase() : mRefs(0)
+{
+}
+
+MOZ_EXPORT RefBase::~RefBase()
+{
+}
+
+MOZ_EXPORT void RefBase::incStrong(const void *id) const
+{
+}
+
+MOZ_EXPORT void RefBase::decStrong(const void *id) const
+{
+}
+
+MOZ_EXPORT void RefBase::onFirstRef()
+{
+}
+
+MOZ_EXPORT void RefBase::onLastStrongRef(const void* id)
+{
+}
+
+MOZ_EXPORT bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id)
+{
+ return false;
+}
+
+MOZ_EXPORT void RefBase::onLastWeakRef(void const* id)
+{
+}
+
+MOZ_EXPORT String16::String16(char const*)
+{
+}
+
+MOZ_EXPORT String16::~String16()
+{
+}
+
+MOZ_EXPORT String8::String8()
+{
+}
+
+MOZ_EXPORT String8::~String8()
+{
+}
+}
new file mode 100644
--- /dev/null
+++ b/media/omx-plugin/lib/gb235/libstagefright/Makefile.in
@@ -0,0 +1,59 @@
+# Copyright 2012 Mozilla Foundation and Mozilla contributors
+#
+# 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.
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = libandroidstagefrightgb234
+MODULE_NAME = libandroidstagefrightgb234
+LIBRARY_NAME = stagefright
+FORCE_SHARED_LIB = 1
+
+# Don't use STL wrappers; this isn't Gecko code
+STL_FLAGS =
+
+# must link statically with the CRT; this isn't Gecko code
+USE_STATIC_LIBS = 1
+
+# Need to custom install OMX media plugin
+NO_DIST_INSTALL = 1
+NO_INSTALL = 1
+
+ifneq ($(MOZ_WIDGET_TOOLKIT),gonk)
+CPPSRCS = \
+ libstagefright.cpp \
+ $(NULL)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+ifdef GNU_CXX
+# Turn off C++ 11 features due to conflicts with Android OS headers and char16_t definition
+CXXFLAGS += -std=gnu++98
+endif
+
+INCLUDES += \
+ -I$(topsrcdir)/media/omx-plugin/include/gb \
+ -I$(topsrcdir)/media/omx-plugin/include/gb/media/stagefright/openmax \
+ $(NULL)
+
+EXTRA_DSO_LDOPTS += \
+ -L$(DEPTH)/media/omx-plugin/lib/gb/libutils \
+ -lutils \
+ $(NULL)
+
+
new file mode 100644
--- /dev/null
+++ b/media/omx-plugin/lib/gb235/libstagefright/libstagefright.cpp
@@ -0,0 +1,8 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+#define MOZ_STAGEFRIGHT_OFF_T off_t
+#define MOZ_ANDROID_GB
+#include "../../gb/libstagefright/libstagefright.cpp"