From 18a0d770aed0d3f862fe66491e90b33397ca5cf2 Mon Sep 17 00:00:00 2001 From: Chris Double Date: Tue, 11 Dec 2012 09:52:46 +1300 Subject: [PATCH] Bug 817478 - Part1: omx plugin changes for sony device support - r=cpeterson --HG-- extra : rebase_source : fa7730805d5b47803226e43c6aab3d6dd074aadf --- content/media/plugins/MediaPluginHost.cpp | 17 ++++- .../include/ics/stagefright/DataSource.h | 11 +++ media/omx-plugin/include/ics/update.patch | 21 +++++- media/omx-plugin/include/ics/update.sh | 2 +- media/omx-plugin/sony/Makefile.in | 67 +++++++++++++++++++ media/omx-plugin/sony/OmxPluginHoneycomb.cpp | 10 +++ media/omx-plugin/sony/OmxPluginSony.cpp | 9 +++ 7 files changed, 134 insertions(+), 3 deletions(-) create mode 100644 media/omx-plugin/sony/Makefile.in create mode 100644 media/omx-plugin/sony/OmxPluginHoneycomb.cpp create mode 100644 media/omx-plugin/sony/OmxPluginSony.cpp diff --git a/content/media/plugins/MediaPluginHost.cpp b/content/media/plugins/MediaPluginHost.cpp index 7f339245333..1b16fe70e86 100644 --- a/content/media/plugins/MediaPluginHost.cpp +++ b/content/media/plugins/MediaPluginHost.cpp @@ -152,7 +152,22 @@ static const char* GetOmxLibraryName() ALOG("Android Release Version is: %s", NS_LossyConvertUTF16toASCII(release_version).get()); } - if (version == 13 || version == 12 || version == 11) { + nsAutoString device; + rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("device"), device); + if (NS_SUCCEEDED(rv)) { + ALOG("Android Device is: %s", NS_LossyConvertUTF16toASCII(device).get()); + } + + if (version == 15 && + (device.Find("LT28", false) == 0 || + device.Find("LT26", false) == 0 || + device.Find("LT22", false) == 0 || + device.Find("IS12", false) == 0 || + device.Find("MT27", false) == 0)) { + // Sony Ericsson devices running ICS + return "lib/libomxpluginsony.so"; + } + else if (version == 13 || version == 12 || version == 11) { return "lib/libomxpluginhc.so"; } else if (version == 10 && release_version >= NS_LITERAL_STRING("2.3.6")) { diff --git a/media/omx-plugin/include/ics/stagefright/DataSource.h b/media/omx-plugin/include/ics/stagefright/DataSource.h index 870d80571db..81ef632415f 100644 --- a/media/omx-plugin/include/ics/stagefright/DataSource.h +++ b/media/omx-plugin/include/ics/stagefright/DataSource.h @@ -66,6 +66,17 @@ public: return 0; } +#if defined(MOZ_ANDROID_SONY_WORKAROUND) +private: + // Sony ICS devices have extra virtual methods in DataSource. + // The dummy methods below fill these vtable positions. + virtual void foo1() { abort(); } + virtual void foo2() { abort(); } + virtual void foo3() { abort(); } + virtual void foo4() { abort(); } +public: +#endif + virtual status_t reconnectAtOffset(off64_t offset) { return ERROR_UNSUPPORTED; } diff --git a/media/omx-plugin/include/ics/update.patch b/media/omx-plugin/include/ics/update.patch index 802c6404ad1..691c5506de2 100644 --- a/media/omx-plugin/include/ics/update.patch +++ b/media/omx-plugin/include/ics/update.patch @@ -1,5 +1,5 @@ diff --git a/media/omx-plugin/include/ics/stagefright/DataSource.h b/media/omx-plugin/include/ics/stagefright/DataSource.h -index 870d805..713af92 100644 +index 81ef632..713af92 100644 --- a/media/omx-plugin/include/ics/stagefright/DataSource.h +++ b/media/omx-plugin/include/ics/stagefright/DataSource.h @@ -28,16 +28,12 @@ @@ -20,3 +20,22 @@ index 870d805..713af92 100644 public: enum Flags { kWantsPrefetching = 1, +@@ -66,17 +62,6 @@ public: + return 0; + } + +-#if defined(MOZ_ANDROID_SONY_WORKAROUND) +-private: +- // Sony ICS devices have extra virtual methods in DataSource. +- // The dummy methods below fill these vtable positions. +- virtual void foo1() { abort(); } +- virtual void foo2() { abort(); } +- virtual void foo3() { abort(); } +- virtual void foo4() { abort(); } +-public: +-#endif +- + virtual status_t reconnectAtOffset(off64_t offset) { + return ERROR_UNSUPPORTED; + } + diff --git a/media/omx-plugin/include/ics/update.sh b/media/omx-plugin/include/ics/update.sh index 809c0df8c9c..9ccc989aa22 100644 --- a/media/omx-plugin/include/ics/update.sh +++ b/media/omx-plugin/include/ics/update.sh @@ -58,4 +58,4 @@ cp $1/frameworks/base/include/ui/GraphicBuffer.h ./ui/GraphicBuffer.h cp $1/hardware/libhardware/include/hardware/hardware.h ./hardware/hardware.h cp $1/hardware/libhardware/include/hardware/gralloc.h ./hardware/gralloc.h cp $1/hardware/libhardware/include/hardware/fb.h ./hardware/fb.h -patch -R -p5 +#include "../OmxPlugin.cpp" diff --git a/media/omx-plugin/sony/OmxPluginSony.cpp b/media/omx-plugin/sony/OmxPluginSony.cpp new file mode 100644 index 00000000000..8afbd9d4ed5 --- /dev/null +++ b/media/omx-plugin/sony/OmxPluginSony.cpp @@ -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_ICS +#define MOZ_ANDROID_SONY_WORKAROUND +#include "../OmxPlugin.cpp"