Bug 805700 - Part1: omx plugin changes for Honeycomb support - r=cpeterson

--HG--
extra : rebase_source : 3b36cfa2d5b25db4b1a66727f4349f71a6e2a7db
This commit is contained in:
Chris Double 2012-11-30 16:05:37 +13:00
parent 47e9ce6db5
commit 0ccbd5da7f
8 changed files with 184 additions and 5 deletions

View File

@ -152,7 +152,10 @@ static const char* GetOmxLibraryName()
ALOG("Android Release Version is: %s", NS_LossyConvertUTF16toASCII(release_version).get());
}
if (version == 10 && release_version >= NS_LITERAL_STRING("2.3.6")) {
if (version == 13 || version == 12 || version == 11) {
return "lib/libomxpluginhc.so";
}
else if (version == 10 && release_version >= NS_LITERAL_STRING("2.3.6")) {
// Gingerbread versions from 2.3.6 and above have a different DataSource
// layout to those on 2.3.5 and below.
return "lib/libomxplugingb.so";

View File

@ -0,0 +1,67 @@
# 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 = omxpluginhc
MODULE_NAME = omxpluginhc
LIBRARY_NAME = omxpluginhc
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
CPPSRCS = \
OmxPluginHoneycomb.cpp \
$(NULL)
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$(srcdir)/../../../content/media/plugins \
$(NULL)
EXTRA_DSO_LDOPTS += \
-L$(DEPTH)/media/omx-plugin/lib/gb/libutils \
-lutils \
-L$(DEPTH)/media/omx-plugin/lib/hc/libstagefright \
-lstagefright \
$(NULL)
INCLUDES += \
-I$(srcdir)/../include/gb \
-I$(srcdir)/../include/gb/media/stagefright/openmax \
$(NULL)
libs:: $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX)
$(INSTALL) $< $(DEPTH)/dist/bin
libs:: $(PROGRAMS)

View File

@ -0,0 +1,10 @@
/* -*- 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 off64_t
#define MOZ_ANDROID_GB
#define MOZ_ANDROID_HC
#include <ui/egl/android_natives.h>
#include "../OmxPlugin.cpp"

View File

@ -25,6 +25,9 @@
#include <utils/List.h>
#include <utils/RefBase.h>
#include <utils/threads.h>
#if defined(MOZ_ANDROID_HC)
#include <utils/String8.h>
#endif
#if !defined(STAGEFRIGHT_EXPORT)
#define STAGEFRIGHT_EXPORT
@ -58,7 +61,7 @@ public:
virtual ssize_t readAt(MOZ_STAGEFRIGHT_OFF_T offset, void *data, size_t size) = 0;
// Convenience methods:
bool getUInt16(off_t offset, uint16_t *x);
bool getUInt16(MOZ_STAGEFRIGHT_OFF_T offset, uint16_t *x);
// May return ERROR_UNSUPPORTED.
virtual status_t getSize(MOZ_STAGEFRIGHT_OFF_T *size);
@ -81,6 +84,17 @@ public:
static void RegisterSniffer(SnifferFunc func);
static void RegisterDefaultSniffers();
#if defined(MOZ_ANDROID_HC)
virtual void* DrmInitialization() {
return NULL;
}
virtual void getDrmInfo(void **handle, void **client) {};
virtual String8 getUri() {
return String8();
}
#endif
protected:
virtual ~DataSource() {}

View File

@ -18,6 +18,9 @@
#define OMX_CODEC_H_
#if defined(MOZ_ANDROID_HC)
#include <android/native_window.h>
#endif
#include <media/IOMX.h>
#include <media/stagefright/MediaBuffer.h>
#include <media/stagefright/MediaSource.h>
@ -44,7 +47,12 @@ struct OMXCodec : public MediaSource,
const sp<MetaData> &meta, bool createEncoder,
const sp<MediaSource> &source,
const char *matchComponentName = NULL,
uint32_t flags = 0);
uint32_t flags = 0
#if defined(MOZ_ANDROID_HC)
,const sp<ANativeWindow> &nativeWindow = NULL
#endif
);
static void setComponentRole(
const sp<IOMX> &omx, IOMX::node_id node, bool isEncoder,

View File

@ -18,6 +18,10 @@
#include "stagefright/OMXCodec.h"
#include "stagefright/OMXClient.h"
#if defined(MOZ_ANDROID_HC)
#include <android/native_window.h>
#endif
namespace android {
MOZ_EXPORT void MediaBuffer::release()
{
@ -83,7 +87,7 @@ MOZ_EXPORT sp<DataSource> DataSource::CreateFromURI(
}
MOZ_EXPORT bool DataSource::getUInt16(off_t offset, uint16_t *x)
MOZ_EXPORT bool DataSource::getUInt16(MOZ_STAGEFRIGHT_OFF_T offset, uint16_t *x)
{
return false;
}
@ -107,7 +111,12 @@ MOZ_EXPORT sp<MediaSource> OMXCodec::Create(
const sp<MetaData> &meta, bool createEncoder,
const sp<MediaSource> &source,
const char *matchComponentName,
uint32_t flags)
uint32_t flags
#if defined(MOZ_ANDROID_HC)
,const sp<ANativeWindow> &nativeWindow
#endif
)
{
return 0;
}

View File

@ -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 = libandroidstagefrighthc
MODULE_NAME = libandroidstagefrighthc
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)

View File

@ -0,0 +1,9 @@
/* -*- 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 off64_t
#define MOZ_ANDROID_HC
#define MOZ_ANDROID_GB
#include "../../gb/libstagefright/libstagefright.cpp"