Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wip

  • Loading branch information...
commit 732fde88a57fb105fafeed863e6588ce80cc8af1 1 parent b4acffa
@koying authored
Showing with 1,373 additions and 133 deletions.
  1. +3 −0  Makefile.include.in
  2. +1 −1  configure.in
  3. +53 −0 tools/android/depends/android-sources-jb/Makefile
  4. +43 −0 tools/android/depends/android-sources-jb/libbinder.cpp
  5. +25 −0 tools/android/depends/android-sources-jb/libcutils.c
  6. +30 −0 tools/android/depends/android-sources-jb/libgui.cpp
  7. +380 −0 tools/android/depends/android-sources-jb/libstagefright.cpp
  8. +33 −0 tools/android/depends/android-sources-jb/libui.cpp
  9. +333 −0 tools/android/depends/android-sources-jb/libutils.cpp
  10. +1 −1  xbmc/android/activity/Makefile.in
  11. +74 −10 xbmc/android/activity/XBMCApp.cpp
  12. +25 −2 xbmc/android/activity/XBMCApp.h
  13. +3 −3 xbmc/android/activity/android_main.cpp
  14. +127 −4 xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
  15. +10 −1 xbmc/cores/VideoRenderers/LinuxRendererGLES.h
  16. +1 −0  xbmc/cores/VideoRenderers/RenderFormats.h
  17. +5 −0 xbmc/cores/VideoRenderers/RenderManager.cpp
  18. +4 −1 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h
  19. +1 −1  xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
  20. +216 −107 xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideo.cpp
  21. +1 −1  xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideo.h
  22. +3 −0  xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
  23. +1 −1  xbmc/input/TouchInput.h
View
3  Makefile.include.in
@@ -33,6 +33,9 @@ CXXFLAGS+=@CXXFLAGS@
CFLAGS+=@CFLAGS@
LDFLAGS+=@LDFLAGS@
INCLUDES+=-I@abs_top_srcdir@/lib
+ifeq (@USE_LIBSTAGEFRIGHT@,1)
+INCLUDES += -I${prefix}/opt/android-source/frameworks/native/include -I${prefix}/opt/android-source/frameworks/av/include -I${prefix}/opt/android-source/system/core/include -I${prefix}/opt/android-source/frameworks/av/media/libstagefright -I${prefix}/opt/android-source/frameworks/native/include/media/openmax -I${prefix}/opt/android-source/frameworks/av/media/libstagefright -I${prefix}/opt/android-source/libhardware/include
+endif
INCLUDES+=-I@abs_top_srcdir@/xbmc
INCLUDES+=$(sort @INCLUDES@)
ifneq (@USE_EXTERNAL_FFMPEG@,1)
View
2  configure.in
@@ -1824,7 +1824,7 @@ fi
if test "$target_platform" = "target_android" ; then
if test "$use_libstagefright" = "yes"; then
USE_LIBSTAGEFRIGHT=1; AC_DEFINE([HAVE_LIBSTAGEFRIGHT],[1],["Define to 1 if libstagefright is enabled"])
- LIBS+="-L${prefix}/opt/android-libs -lstdc++ -lutils -lcutils -lbinder -lstagefright -lgui"
+ LIBS+="-L${prefix}/opt/android-libs -lstdc++ -lutils -lcutils -lbinder -lstagefright -lui -lgui"
fi
fi
View
53 tools/android/depends/android-sources-jb/Makefile
@@ -0,0 +1,53 @@
+include ../Makefile.include
+DEPS= ../Makefile.include Makefile
+INCLUDES+=-I$(PREFIX)/opt/android-source/frameworks/native/include -I$(PREFIX)/opt/android-source/frameworks/av/include -I$(PREFIX)/opt/android-source/system/core/include -I$(PREFIX)/opt/android-source/frameworks/av/media/libstagefright -I$(PREFIX)/opt/android-source/frameworks/native/include/media/openmax -I$(PREFIX)/opt/android-source/frameworks/av/media/libstagefright -I$(PREFIX)/opt/android-source/libhardware/include
+
+ANDROID_VERSION=jb
+ANDROID_SOURCE=android-source
+ANDROID_LIBS=android-libs
+
+all: .installed-$(PLATFORM)
+
+.installed-$(PLATFORM): $(ANDROID_SOURCE) $(ANDROID_LIBS)
+ touch $@
+
+$(ANDROID_SOURCE):
+ echo "Fetching Android system headers"
+ git clone --depth=1 --branch $(ANDROID_VERSION)-release https://android.googlesource.com/platform/frameworks/native $(ANDROID_SOURCE)/frameworks/native
+ git clone --depth=1 --branch $(ANDROID_VERSION)-release https://android.googlesource.com/platform/frameworks/av $(ANDROID_SOURCE)/frameworks/av
+ git clone --depth=1 --branch $(ANDROID_VERSION)-release https://android.googlesource.com/platform/system/core $(ANDROID_SOURCE)/system/core
+ git clone --depth=1 --branch $(ANDROID_VERSION)-release https://android.googlesource.com/platform/hardware/libhardware $(ANDROID_SOURCE)/libhardware
+ mkdir -p $(PREFIX)/opt
+ rm -f $(PREFIX)/opt/$(ANDROID_SOURCE)
+ ln -s $(CURDIR)/$(ANDROID_SOURCE) $(PREFIX)/opt/$(ANDROID_SOURCE)
+
+$(ANDROID_LIBS): $(PLATFORM)/libstagefright.so $(PLATFORM)/libutils.so $(PLATFORM)/libbinder.so $(PLATFORM)/libcutils.so $(PLATFORM)/libui.so $(PLATFORM)/libgui.so
+ mkdir -p $(PREFIX)/opt/$(ANDROID_LIBS)
+ cp $(PLATFORM)/libstagefright.so $(PLATFORM)/libutils.so $(PLATFORM)/libbinder.so $(PLATFORM)/libcutils.so $(PLATFORM)/libui.so $(PLATFORM)/libgui.so $(PREFIX)/opt/$(ANDROID_LIBS)
+
+$(PLATFORM):
+ mkdir -p $(PLATFORM)
+
+$(PLATFORM)/libstagefright.so: $(PLATFORM) $(DEPS) libstagefright.cpp
+ $(CXX) -Wno-multichar -fno-exceptions -fno-rtti $(INCLUDES) -DHAVE_PTHREADS -shared -o $(PLATFORM)/libstagefright.so libstagefright.cpp
+
+$(PLATFORM)/libutils.so: $(PLATFORM) $(DEPS) libutils.cpp
+ $(CXX) -Wno-multichar -fno-exceptions -fno-rtti $(INCLUDES) -shared -o $(PLATFORM)/libutils.so libutils.cpp
+
+$(PLATFORM)/libbinder.so: $(PLATFORM) $(DEPS) libbinder.cpp
+ $(CXX) -Wno-multichar -fno-exceptions -fno-rtti $(INCLUDES) -shared -o $(PLATFORM)/libbinder.so libbinder.cpp
+
+$(PLATFORM)/libcutils.so: $(PLATFORM) $(DEPS) libcutils.c
+ $(CXX) -Wno-multichar -fno-exceptions -fno-rtti $(INCLUDES) -shared -o $(PLATFORM)/libcutils.so libcutils.c
+
+$(PLATFORM)/libui.so: $(PLATFORM) $(DEPS) libui.cpp
+ $(CXX) -Wno-multichar -fno-exceptions -fno-rtti $(INCLUDES) -shared -o $(PLATFORM)/libui.so libui.cpp
+
+$(PLATFORM)/libgui.so: $(PLATFORM) $(DEPS) libgui.cpp
+ $(CXX) -Wno-multichar -fno-exceptions -fno-rtti -fpermissive $(INCLUDES) -shared -o $(PLATFORM)/libgui.so libgui.cpp
+
+clean:
+ rm -f $(PREFIX)/opt/$(ANDROID_SOURCE)
+ rm -rf .installed-$(PLATFORM) $(ANDROID_SOURCE) $(PLATFORM) $(ANDROID_LIBS_ARCHIVE)
+
+distclean: clean
View
43 tools/android/depends/android-sources-jb/libbinder.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010-2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+// ---------------------------------------------------------------------------
+
+#include <binder/ProcessState.h>
+
+namespace android {
+
+sp<ProcessState> ProcessState::self()
+{
+}
+
+void ProcessState::startThreadPool()
+{
+}
+
+ProcessState::ProcessState()
+{
+}
+
+ProcessState::~ProcessState()
+{
+}
+
+}; // namespace android
View
25 tools/android/depends/android-sources-jb/libcutils.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010-2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <cutils/atomic.h>
+
+int32_t android_atomic_dec(volatile int32_t* addr) {
+ return 0;
+}
View
30 tools/android/depends/android-sources-jb/libgui.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2010-2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <ui/PixelFormat.h>
+#include <gui/IGraphicBufferAlloc.h>
+#include <gui/SurfaceTexture.h>
+#include <gui/SurfaceTextureClient.h>
+
+using namespace android;
+
+SurfaceTexture::SurfaceTexture(unsigned int, bool, unsigned int, bool, const android::sp<android::BufferQueue>&) {}
+SurfaceTextureClient::SurfaceTextureClient(android::sp<android::ISurfaceTexture> const&) {}
+
View
380 tools/android/depends/android-sources-jb/libstagefright.cpp
@@ -0,0 +1,380 @@
+/*
+ * Copyright (C) 2010-2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#define STAGEFRIGHT_EXPORT __attribute__ ((visibility ("default")))
+#include <media/stagefright/foundation/ABuffer.h>
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MetaData.h>
+#include <media/stagefright/MediaBuffer.h>
+#include <media/stagefright/MediaBufferGroup.h>
+#include <media/stagefright/MediaDefs.h>
+#include <media/stagefright/MediaExtractor.h>
+#include <media/stagefright/OMXClient.h>
+#include <media/stagefright/OMXCodec.h>
+#include <utils/List.h>
+#include <utils/RefBase.h>
+
+#include <media/stagefright/MediaDefs.h>
+
+namespace android {
+
+const char *MEDIA_MIMETYPE_IMAGE_JPEG = "image/jpeg";
+
+const char *MEDIA_MIMETYPE_VIDEO_VPX = "video/x-vnd.on2.vp8";
+const char *MEDIA_MIMETYPE_VIDEO_AVC = "video/avc";
+const char *MEDIA_MIMETYPE_VIDEO_MPEG4 = "video/mp4v-es";
+const char *MEDIA_MIMETYPE_VIDEO_H263 = "video/3gpp";
+const char *MEDIA_MIMETYPE_VIDEO_MPEG2 = "video/mpeg2";
+const char *MEDIA_MIMETYPE_VIDEO_RAW = "video/raw";
+
+const char *MEDIA_MIMETYPE_AUDIO_AMR_NB = "audio/3gpp";
+const char *MEDIA_MIMETYPE_AUDIO_AMR_WB = "audio/amr-wb";
+const char *MEDIA_MIMETYPE_AUDIO_MPEG = "audio/mpeg";
+const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_I = "audio/mpeg-L1";
+const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II = "audio/mpeg-L2";
+const char *MEDIA_MIMETYPE_AUDIO_AAC = "audio/mp4a-latm";
+const char *MEDIA_MIMETYPE_AUDIO_QCELP = "audio/qcelp";
+const char *MEDIA_MIMETYPE_AUDIO_VORBIS = "audio/vorbis";
+const char *MEDIA_MIMETYPE_AUDIO_G711_ALAW = "audio/g711-alaw";
+const char *MEDIA_MIMETYPE_AUDIO_G711_MLAW = "audio/g711-mlaw";
+const char *MEDIA_MIMETYPE_AUDIO_RAW = "audio/raw";
+const char *MEDIA_MIMETYPE_AUDIO_FLAC = "audio/flac";
+const char *MEDIA_MIMETYPE_AUDIO_AAC_ADTS = "audio/aac-adts";
+
+const char *MEDIA_MIMETYPE_CONTAINER_MPEG4 = "video/mpeg4";
+const char *MEDIA_MIMETYPE_CONTAINER_WAV = "audio/wav";
+const char *MEDIA_MIMETYPE_CONTAINER_OGG = "application/ogg";
+const char *MEDIA_MIMETYPE_CONTAINER_MATROSKA = "video/x-matroska";
+const char *MEDIA_MIMETYPE_CONTAINER_MPEG2TS = "video/mp2ts";
+const char *MEDIA_MIMETYPE_CONTAINER_AVI = "video/avi";
+const char *MEDIA_MIMETYPE_CONTAINER_MPEG2PS = "video/mp2p";
+
+const char *MEDIA_MIMETYPE_CONTAINER_WVM = "video/wvm";
+#ifdef QCOM_HARDWARE
+const char *MEDIA_MIMETYPE_AUDIO_EVRC = "audio/evrc";
+
+const char *MEDIA_MIMETYPE_VIDEO_WMV = "video/x-ms-wmv";
+const char *MEDIA_MIMETYPE_AUDIO_WMA = "audio/x-ms-wma";
+const char *MEDIA_MIMETYPE_CONTAINER_ASF = "video/x-ms-asf";
+const char *MEDIA_MIMETYPE_VIDEO_DIVX = "video/divx";
+const char *MEDIA_MIMETYPE_AUDIO_AC3 = "audio/ac3";
+const char *MEDIA_MIMETYPE_CONTAINER_AAC = "audio/aac";
+const char *MEDIA_MIMETYPE_CONTAINER_QCP = "audio/vnd.qcelp";
+const char *MEDIA_MIMETYPE_VIDEO_DIVX311 = "video/divx311";
+const char *MEDIA_MIMETYPE_VIDEO_DIVX4 = "video/divx4";
+const char *MEDIA_MIMETYPE_CONTAINER_MPEG2 = "video/mp2";
+const char *MEDIA_MIMETYPE_CONTAINER_3G2 = "video/3g2";
+#endif
+const char *MEDIA_MIMETYPE_TEXT_3GPP = "text/3gpp-tt";
+
+MetaData::MetaData() {
+}
+
+MetaData::MetaData(const MetaData &from) {
+}
+
+MetaData::~MetaData() {
+}
+
+void MetaData::clear() {
+}
+
+bool MetaData::remove(uint32_t key) {
+ return false;
+}
+
+bool MetaData::setCString(uint32_t key, const char *value) {
+ return false;
+}
+
+bool MetaData::setInt32(uint32_t key, int32_t value) {
+ return false;
+}
+
+bool MetaData::setInt64(uint32_t key, int64_t value) {
+ return false;
+}
+
+bool MetaData::setFloat(uint32_t key, float value) {
+ return false;
+}
+
+bool MetaData::setPointer(uint32_t key, void *value) {
+ return false;
+}
+
+bool MetaData::setRect(
+ uint32_t key,
+ int32_t left, int32_t top,
+ int32_t right, int32_t bottom) {
+ return false;
+}
+
+bool MetaData::findCString(uint32_t key, const char **value) {
+ return false;
+}
+
+bool MetaData::findInt32(uint32_t key, int32_t *value) {
+ return false;
+}
+
+bool MetaData::findInt64(uint32_t key, int64_t *value) {
+ return false;
+}
+
+bool MetaData::findFloat(uint32_t key, float *value) {
+ return false;
+}
+
+bool MetaData::findPointer(uint32_t key, void **value) {
+ return false;
+}
+
+bool MetaData::findRect(
+ uint32_t key,
+ int32_t *left, int32_t *top,
+ int32_t *right, int32_t *bottom) {
+ return false;
+}
+
+bool MetaData::setData(
+ uint32_t key, uint32_t type, const void *data, size_t size) {
+ return false;
+}
+
+bool MetaData::findData(uint32_t key, uint32_t *type,
+ const void **data, size_t *size) const {
+ return false;
+}
+
+MetaData::typed_data::typed_data()
+ : mType(0),
+ mSize(0) {
+}
+
+MetaData::typed_data::~typed_data() {
+}
+
+MetaData::typed_data::typed_data(const typed_data &from)
+ : mType(from.mType),
+ mSize(0) {
+}
+
+MetaData::typed_data &MetaData::typed_data::operator=(
+ const MetaData::typed_data &from) {
+ return *this;
+}
+
+void MetaData::typed_data::clear() {
+}
+
+void MetaData::typed_data::setData(
+ uint32_t type, const void *data, size_t size) {
+}
+
+void MetaData::typed_data::getData(
+ uint32_t *type, const void **data, size_t *size) const {
+}
+
+void MetaData::typed_data::allocateStorage(size_t size) {
+}
+
+void MetaData::typed_data::freeStorage() {
+}
+
+MediaBuffer::MediaBuffer(void *data, size_t size)
+{}
+
+MediaBuffer::MediaBuffer(size_t size)
+{}
+
+MediaBuffer::MediaBuffer(const sp<GraphicBuffer>& graphicBuffer)
+{}
+
+MediaBuffer::MediaBuffer(const sp<ABuffer> &buffer)
+{}
+
+void MediaBuffer::release() {
+}
+
+void MediaBuffer::claim() {
+}
+
+void MediaBuffer::add_ref() {
+}
+
+void *MediaBuffer::data() const {
+ return 0;
+}
+
+size_t MediaBuffer::size() const {
+ return 0;
+}
+
+size_t MediaBuffer::range_offset() const {
+ return 0;
+}
+
+size_t MediaBuffer::range_length() const {
+ return 0;
+}
+
+void MediaBuffer::set_range(size_t offset, size_t length) {
+}
+
+sp<GraphicBuffer> MediaBuffer::graphicBuffer() const {
+}
+
+sp<MetaData> MediaBuffer::meta_data() {
+}
+
+void MediaBuffer::reset() {
+}
+
+MediaBuffer::~MediaBuffer() {
+}
+
+void MediaBuffer::setObserver(MediaBufferObserver *observer) {
+}
+
+void MediaBuffer::setNextBuffer(MediaBuffer *buffer) {
+}
+
+MediaBuffer *MediaBuffer::nextBuffer() {
+ return 0;
+}
+
+int MediaBuffer::refcount() const {
+ return 0;
+}
+
+MediaBuffer *MediaBuffer::clone() {
+ return 0;
+}
+
+MediaBufferGroup::MediaBufferGroup() {}
+
+MediaBufferGroup::~MediaBufferGroup() {}
+
+void MediaBufferGroup::add_buffer(MediaBuffer *buffer) {
+}
+
+status_t MediaBufferGroup::acquire_buffer(MediaBuffer **out) {
+ return OK;
+}
+
+void MediaBufferGroup::signalBufferReturned(MediaBuffer *) {
+}
+
+MediaSource::MediaSource() {}
+
+MediaSource::~MediaSource() {}
+
+MediaSource::MediaSource(const MediaSource &) {}
+
+MediaSource& MediaSource::operator=(const MediaSource &) {}
+
+MediaSource::ReadOptions::ReadOptions() {
+}
+
+void MediaSource::ReadOptions::reset() {
+}
+
+void MediaSource::ReadOptions::setSeekTo(int64_t time_us, SeekMode mode) {
+}
+
+void MediaSource::ReadOptions::clearSeekTo() {
+}
+
+bool MediaSource::ReadOptions::getSeekTo(
+ int64_t *time_us, SeekMode *mode) const {
+ return false;
+}
+
+void MediaSource::ReadOptions::setLateBy(int64_t lateness_us) {
+}
+
+int64_t MediaSource::ReadOptions::getLateBy() const {
+ return 0;
+}
+
+status_t
+DataSource::getSize(off64_t *size)
+{
+ return 0;
+}
+
+String8
+DataSource::getMIMEType() const
+{
+ return String8();
+}
+
+void
+DataSource::RegisterDefaultSniffers()
+{
+}
+
+sp<MediaExtractor>
+MediaExtractor::Create(const sp<DataSource> &source, const char *mime)
+{
+ return 0;
+}
+
+sp<MediaSource>
+OMXCodec::Create(
+ const sp<IOMX> &omx,
+ const sp<MetaData> &meta, bool createEncoder,
+ const sp<MediaSource> &source,
+ const char *matchComponentName,
+ uint32_t flags,
+ const sp<ANativeWindow> &nativeWindow)
+{
+ return 0;
+}
+
+OMXClient::OMXClient()
+{
+}
+
+status_t OMXClient::connect()
+{
+ return OK;
+}
+
+void OMXClient::disconnect()
+{
+}
+
+class __attribute__ ((visibility ("default"))) UnknownDataSource : public DataSource {
+public:
+UnknownDataSource();
+
+virtual status_t initCheck() const { return 0; }
+virtual ssize_t readAt(off64_t offset, void *data, size_t size) { return 0; }
+virtual status_t getSize(off64_t *size) { return 0; }
+
+virtual ~UnknownDataSource() { }
+};
+
+UnknownDataSource foo;
+
+UnknownDataSource::UnknownDataSource() { }
+}
View
33 tools/android/depends/android-sources-jb/libui.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010-2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <ui/FramebufferNativeWindow.h>
+#include <ui/GraphicBuffer.h>
+#include <EGL/egl.h>
+
+using namespace android;
+
+EGLNativeWindowType android_createDisplaySurface(void) {}
+
+ANativeWindowBuffer* GraphicBuffer::getNativeBuffer() const
+{
+ return NULL;
+}
+
+
View
333 tools/android/depends/android-sources-jb/libutils.cpp
@@ -0,0 +1,333 @@
+/*
+ * Copyright (C) 2010-2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "utils/RefBase.h"
+#include "utils/String16.h"
+#include "utils/String8.h"
+#include "utils/VectorImpl.h"
+#include "utils/Unicode.h"
+
+extern "C" {
+
+int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2)
+{
+ return 0;
+}
+
+}
+
+namespace android {
+RefBase::RefBase() : mRefs(0)
+{
+}
+
+RefBase::~RefBase()
+{
+}
+
+void RefBase::incStrong(const void *id) const
+{
+}
+
+void RefBase::decStrong(const void *id) const
+{
+}
+
+void RefBase::onFirstRef()
+{
+}
+
+void RefBase::onLastStrongRef(const void* id)
+{
+}
+
+bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id)
+{
+ return false;
+}
+
+void RefBase::onLastWeakRef(void const* id)
+{
+}
+
+String16::String16()
+{
+}
+
+String16::String16(String16 const&)
+{
+}
+
+String16::String16(char const*)
+{
+}
+
+String16::~String16()
+{
+}
+
+String8::String8()
+{
+}
+
+String8::~String8()
+{
+}
+
+VectorImpl::VectorImpl(size_t itemSize, uint32_t flags)
+ : mFlags(flags), mItemSize(itemSize)
+{
+}
+
+VectorImpl::VectorImpl(const VectorImpl& rhs)
+ : mFlags(rhs.mFlags), mItemSize(rhs.mItemSize)
+{
+}
+
+VectorImpl::~VectorImpl()
+{
+}
+
+VectorImpl& VectorImpl::operator = (const VectorImpl& rhs)
+{
+}
+
+void* VectorImpl::editArrayImpl()
+{
+}
+
+size_t VectorImpl::capacity() const
+{
+ return 0;
+}
+
+ssize_t VectorImpl::insertVectorAt(const VectorImpl& vector, size_t index)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::appendVector(const VectorImpl& vector)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::insertArrayAt(const void* array, size_t index, size_t length)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::appendArray(const void* array, size_t length)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::insertAt(size_t index, size_t numItems)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::insertAt(const void* item, size_t index, size_t numItems)
+{
+ return 0;
+}
+
+static int sortProxy(const void* lhs, const void* rhs, void* func)
+{
+ return 0;
+}
+
+status_t VectorImpl::sort(VectorImpl::compar_t cmp)
+{
+ return 0;
+}
+
+status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state)
+{
+ return 0;
+}
+
+void VectorImpl::pop()
+{
+}
+
+void VectorImpl::push()
+{
+}
+
+void VectorImpl::push(const void* item)
+{
+}
+
+ssize_t VectorImpl::add()
+{
+ return 0;
+}
+
+ssize_t VectorImpl::add(const void* item)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::replaceAt(size_t index)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::replaceAt(const void* prototype, size_t index)
+{
+ return 0;
+}
+
+ssize_t VectorImpl::removeItemsAt(size_t index, size_t count)
+{
+ return 0;
+}
+
+void VectorImpl::finish_vector()
+{
+}
+
+void VectorImpl::clear()
+{
+}
+
+void* VectorImpl::editItemLocation(size_t index)
+{
+ return 0;
+}
+
+const void* VectorImpl::itemLocation(size_t index) const
+{
+ return 0;
+}
+
+ssize_t VectorImpl::setCapacity(size_t new_capacity)
+{
+ return 0;
+}
+
+void VectorImpl::release_storage()
+{
+}
+
+void* VectorImpl::_grow(size_t where, size_t amount)
+{
+ return 0;
+}
+
+void VectorImpl::_shrink(size_t where, size_t amount)
+{
+}
+
+size_t VectorImpl::itemSize() const {
+ return 0;
+}
+
+void VectorImpl::_do_construct(void* storage, size_t num) const
+{
+}
+
+void VectorImpl::_do_destroy(void* storage, size_t num) const
+{
+}
+
+void VectorImpl::_do_copy(void* dest, const void* from, size_t num) const
+{
+}
+
+void VectorImpl::_do_splat(void* dest, const void* item, size_t num) const {
+}
+
+void VectorImpl::_do_move_forward(void* dest, const void* from, size_t num) const {
+}
+
+void VectorImpl::_do_move_backward(void* dest, const void* from, size_t num) const {
+}
+
+void VectorImpl::reservedVectorImpl1() { }
+void VectorImpl::reservedVectorImpl2() { }
+void VectorImpl::reservedVectorImpl3() { }
+void VectorImpl::reservedVectorImpl4() { }
+void VectorImpl::reservedVectorImpl5() { }
+void VectorImpl::reservedVectorImpl6() { }
+void VectorImpl::reservedVectorImpl7() { }
+void VectorImpl::reservedVectorImpl8() { }
+
+/*****************************************************************************/
+
+SortedVectorImpl::SortedVectorImpl(size_t itemSize, uint32_t flags)
+ : VectorImpl(itemSize, flags)
+{
+}
+
+SortedVectorImpl::SortedVectorImpl(const VectorImpl& rhs)
+: VectorImpl(rhs)
+{
+}
+
+SortedVectorImpl::~SortedVectorImpl()
+{
+}
+
+ssize_t SortedVectorImpl::indexOf(const void* item) const
+{
+ return 0;
+}
+
+size_t SortedVectorImpl::orderOf(const void* item) const
+{
+ return 0;
+}
+
+ssize_t SortedVectorImpl::_indexOrderOf(const void* item, size_t* order) const
+{
+ return 0;
+}
+
+ssize_t SortedVectorImpl::add(const void* item)
+{
+ return 0;
+}
+
+ssize_t SortedVectorImpl::merge(const VectorImpl& vector)
+{
+ return 0;
+}
+
+ssize_t SortedVectorImpl::merge(const SortedVectorImpl& vector)
+{
+ return 0;
+}
+
+ssize_t SortedVectorImpl::remove(const void* item)
+{
+ return 0;
+}
+
+void SortedVectorImpl::reservedSortedVectorImpl1() { };
+void SortedVectorImpl::reservedSortedVectorImpl2() { };
+void SortedVectorImpl::reservedSortedVectorImpl3() { };
+void SortedVectorImpl::reservedSortedVectorImpl4() { };
+void SortedVectorImpl::reservedSortedVectorImpl5() { };
+void SortedVectorImpl::reservedSortedVectorImpl6() { };
+void SortedVectorImpl::reservedSortedVectorImpl7() { };
+void SortedVectorImpl::reservedSortedVectorImpl8() { };
+
+}
View
2  xbmc/android/activity/Makefile.in
@@ -13,7 +13,7 @@ SRCS += AndroidFeatures.cpp
SRCS += AndroidKey.cpp
SRCS += AndroidTouch.cpp
SRCS += AndroidMouse.cpp
-SRCS += GraphicBuffer.cpp
+#SRCS += GraphicBuffer.cpp
SRCS += EventLoop.cpp
SRCS += XBMCApp.cpp
View
84 xbmc/android/activity/XBMCApp.cpp
@@ -18,6 +18,8 @@
*
*/
+#include "system.h"
+
#include <sstream>
#include <unistd.h>
@@ -59,18 +61,9 @@ void* thread_run(void* obj)
ANativeActivity *CXBMCApp::m_activity = NULL;
ANativeWindow* CXBMCApp::m_window = NULL;
-CXBMCApp::CXBMCApp(ANativeActivity *nativeActivity)
+CXBMCApp::CXBMCApp()
: m_wakeLock(NULL)
{
- m_activity = nativeActivity;
-
- if (m_activity == NULL)
- {
- android_printf("CXBMCApp: invalid ANativeActivity instance");
- exit(1);
- return;
- }
-
m_state.appState = Uninitialized;
if (pthread_mutex_init(&m_state.mutex, NULL) != 0)
@@ -80,7 +73,18 @@ CXBMCApp::CXBMCApp(ANativeActivity *nativeActivity)
exit(1);
return;
}
+}
+void CXBMCApp::SetActivity(ANativeActivity *nativeActivity)
+{
+ m_activity = nativeActivity;
+
+ if (m_activity == NULL)
+ {
+ android_printf("CXBMCApp: invalid ANativeActivity instance");
+ exit(1);
+ return;
+ }
}
CXBMCApp::~CXBMCApp()
@@ -975,3 +979,63 @@ bool CXBMCApp::GetStorageUsage(const std::string &path, std::string &usage)
usage = fmt.str();
return true;
}
+
+#ifdef HAVE_LIBSTAGEFRIGHT
+bool CXBMCApp::InitStagefright()
+{
+ if (m_VideoNativeWindow != NULL)
+ return true;
+
+ if (m_activity == NULL)
+ return false;
+
+ JNIEnv *env = NULL;
+ AttachCurrentThread(&env);
+
+ glEnable(GL_TEXTURE_EXTERNAL_OES);
+ glGenTextures(1, &m_VideoTextureId);
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, m_VideoTextureId);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ CLog::Log(LOGDEBUG, ">>> texid: %d\n", m_VideoTextureId);
+
+ m_SurfTexture = new android::SurfaceTexture(m_VideoTextureId);
+ if (!m_SurfTexture.get())
+ {
+ CLog::Log(LOGERROR, "%s\n", "Cannot instantiate surface texture");
+ }
+ m_Surface = new android::SurfaceTextureClient(m_SurfTexture);
+ if (!m_Surface.get())
+ {
+ CLog::Log(LOGERROR, "%s\n", "Cannot instantiate surface texture client");
+ }
+ m_VideoNativeWindow = m_Surface;
+
+ glDisable(GL_TEXTURE_EXTERNAL_OES);
+
+ DetachCurrentThread();
+
+ return true;
+}
+
+void CXBMCApp::UninitStagefright()
+{
+ if (m_activity == NULL)
+ return;
+
+ JNIEnv *env = NULL;
+ AttachCurrentThread(&env);
+
+ m_VideoNativeWindow.clear();
+ m_Surface.clear();
+ m_SurfTexture.clear();
+ glDeleteTextures(1, &m_VideoTextureId);
+
+ m_VideoNativeWindow = NULL;
+ m_Surface = NULL;
+ m_SurfTexture = NULL;
+
+ DetachCurrentThread();
+}
+#endif
View
27 xbmc/android/activity/XBMCApp.h
@@ -24,13 +24,17 @@
#include <string>
#include <vector>
+#ifdef HAVE_LIBSTAGEFRIGHT
+#include <gui/SurfaceTexture.h>
+#include <gui/SurfaceTextureClient.h>
+#endif
#include <android/native_activity.h>
#include "IActivityHandler.h"
#include "IInputHandler.h"
#include "xbmc.h"
-
+#include "utils/GlobalsHandling.h"
// forward delares
class CAESinkAUDIOTRACK;
@@ -53,7 +57,8 @@ struct androidPackage
class CXBMCApp : public IActivityHandler
{
public:
- CXBMCApp(ANativeActivity *nativeActivity);
+ CXBMCApp();
+ void SetActivity(ANativeActivity *nativeActivity);
virtual ~CXBMCApp();
bool isValid() { return m_activity != NULL; }
@@ -97,6 +102,15 @@ class CXBMCApp : public IActivityHandler
static bool GetStorageUsage(const std::string &path, std::string &usage);
static int GetDPI();
+
+#ifdef HAVE_LIBSTAGEFRIGHT
+ bool InitStagefright();
+ void UninitStagefright();
+
+ const android::sp<android::SurfaceTexture>& GetAndroidSurfaceTexture() const { return m_SurfTexture;}
+ const android::sp<ANativeWindow>& GetAndroidVideoWindow() const { return m_VideoNativeWindow;}
+#endif
+
protected:
// limit who can access AttachCurrentThread/DetachCurrentThread
friend class CAESinkAUDIOTRACK;
@@ -149,9 +163,18 @@ class CXBMCApp : public IActivityHandler
void setAppState(AppState state);
static ANativeWindow* m_window;
+#ifdef HAVE_LIBSTAGEFRIGHT
+ GLuint m_VideoTextureId;
+ android::sp<android::SurfaceTexture> m_SurfTexture;
+ android::sp<android::SurfaceTextureClient> m_Surface;
+ android::sp<ANativeWindow> m_VideoNativeWindow;
+#endif
void XBMC_Pause(bool pause);
void XBMC_Stop();
bool XBMC_DestroyDisplay();
bool XBMC_SetupDisplay();
};
+
+XBMC_GLOBAL_REF(CXBMCApp,g_xbmcapp);
+#define g_xbmcapp XBMC_GLOBAL_USE(CXBMCApp)
View
6 xbmc/android/activity/android_main.cpp
@@ -160,11 +160,11 @@ extern void android_main(struct android_app* state)
setup_env(state);
CEventLoop eventLoop(state);
- CXBMCApp xbmcApp(state->activity);
- if (xbmcApp.isValid())
+ g_xbmcapp.SetActivity(state->activity);
+ if (g_xbmcapp.isValid())
{
IInputHandler inputHandler;
- eventLoop.run(xbmcApp, inputHandler);
+ eventLoop.run(g_xbmcapp, inputHandler);
}
else
CXBMCApp::android_printf("android_main: setup failed");
View
131 xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
@@ -59,6 +59,26 @@
#ifdef TARGET_DARWIN_IOS
#include "osx/DarwinUtils.h"
#endif
+#if defined(HAVE_LIBSTAGEFRIGHT)
+#include "android/activity/XBMCApp.h"
+
+// EGL extension functions
+static PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
+static PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
+static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
+#define GETEXTENSION(type, ext) \
+do \
+{ \
+ ext = (type) eglGetProcAddress(#ext); \
+ if (!ext) \
+ { \
+ CLog::Log(LOGERROR, "CLinuxRendererGLES::%s - ERROR getting proc addr of " #ext "\n", __func__); \
+ } \
+} while (0);
+
+#define EGL_NATIVE_BUFFER_ANDROID 0x3140
+#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#endif
using namespace Shaders;
@@ -85,6 +105,9 @@ CLinuxRendererGLES::CLinuxRendererGLES()
#ifdef HAVE_VIDEOTOOLBOXDECODER
m_buffers[i].cvBufferRef = NULL;
#endif
+#if defined(HAVE_LIBSTAGEFRIGHT)
+ m_buffers[i].texture_id = -1;
+#endif
}
m_renderMethod = RENDER_GLSL;
@@ -112,10 +135,29 @@ CLinuxRendererGLES::CLinuxRendererGLES()
m_dllSwScale = new DllSwScale;
m_sw_context = NULL;
+
+#ifdef HAVE_LIBSTAGEFRIGHT
+ g_xbmcapp.InitStagefright();
+ if (!eglCreateImageKHR)
+ {
+ GETEXTENSION(PFNEGLCREATEIMAGEKHRPROC, eglCreateImageKHR);
+ }
+ if (!eglDestroyImageKHR)
+ {
+ GETEXTENSION(PFNEGLDESTROYIMAGEKHRPROC, eglDestroyImageKHR);
+ }
+ if (!glEGLImageTargetTexture2DOES)
+ {
+ GETEXTENSION(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC, glEGLImageTargetTexture2DOES);
+ }
+#endif
}
CLinuxRendererGLES::~CLinuxRendererGLES()
{
+#ifdef HAVE_LIBSTAGEFRIGHT
+ g_xbmcapp.UninitStagefright();
+#endif
UnInit();
for (int i = 0; i < NUM_BUFFERS; i++)
delete m_eventTexturesDone[i];
@@ -220,6 +262,10 @@ int CLinuxRendererGLES::GetImage(YV12Image *image, int source, bool readonly)
{
return source;
}
+ if ( m_renderMethod & RENDER_TEXTURE )
+ {
+ return source;
+ }
#ifdef HAVE_VIDEOTOOLBOXDECODER
if (m_renderMethod & RENDER_CVREF )
{
@@ -523,6 +569,9 @@ unsigned int CLinuxRendererGLES::PreInit()
#ifdef HAVE_VIDEOTOOLBOXDECODER
m_formats.push_back(RENDER_FMT_CVBREF);
#endif
+#ifdef HAVE_LIBSTAGEFRIGHT
+ m_formats.push_back(RENDER_FMT_TEXTURE);
+#endif
// setup the background colour
m_clearColour = (float)(g_advancedSettings.m_videoBlackBarColour & 0xff) / 0xff;
@@ -622,6 +671,12 @@ void CLinuxRendererGLES::LoadShaders(int field)
m_renderMethod = RENDER_OMXEGL;
break;
}
+ else if (m_format == RENDER_FMT_TEXTURE)
+ {
+ CLog::Log(LOGNOTICE, "GL: Using TEXTURE render method");
+ m_renderMethod = RENDER_TEXTURE;
+ break;
+ }
else if (m_format == RENDER_FMT_BYPASS)
{
CLog::Log(LOGNOTICE, "GL: Using BYPASS render method");
@@ -805,6 +860,11 @@ void CLinuxRendererGLES::Render(DWORD flags, int index)
RenderOpenMax(index, m_currentField);
VerifyGLState();
}
+ else if (m_renderMethod & RENDER_TEXTURE)
+ {
+ RenderTexture(index, m_currentField);
+ VerifyGLState();
+ }
else if (m_renderMethod & RENDER_CVREF)
{
RenderCoreVideoRef(index, m_currentField);
@@ -1175,11 +1235,9 @@ void CLinuxRendererGLES::RenderSoftware(int index, int field)
VerifyGLState();
}
-void CLinuxRendererGLES::RenderOpenMax(int index, int field)
+void CLinuxRendererGLES::RenderTexture(GLuint textureId)
{
-#if defined(HAVE_LIBOPENMAX)
- GLuint textureId = m_buffers[index].openMaxBuffer->texture_id;
-
+#if defined(HAVE_LIBOPENMAX) || defined(HAVE_LIBSTAGEFRIGHT)
glDisable(GL_DEPTH_TEST);
// Y
@@ -1241,6 +1299,56 @@ void CLinuxRendererGLES::RenderOpenMax(int index, int field)
#endif
}
+void CLinuxRendererGLES::RenderOpenMax(int index, int field)
+{
+#if defined(HAVE_LIBOPENMAX)
+ GLuint textureId = m_buffers[index].openMaxBuffer->texture_id;
+ RenderTexture(textureId);
+#endif
+}
+
+void CLinuxRendererGLES::RenderTexture(int index, int field)
+{
+#if defined(HAVE_LIBSTAGEFRIGHT)
+ g_xbmcapp.GetAndroidSurfaceTexture()->updateTexImage();
+
+ android::sp<android::GraphicBuffer> activeBuffer = g_xbmcapp.GetAndroidSurfaceTexture()->getCurrentBuffer();
+
+ if(!activeBuffer.get())
+ return;
+
+ int glerr;
+
+ EGLint eglImgAttrs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE, EGL_NONE };
+ EGLImageKHR eglimg = eglCreateImageKHR(eglGetDisplay(EGL_DEFAULT_DISPLAY), EGL_NO_CONTEXT,
+ EGL_NATIVE_BUFFER_ANDROID,
+ (EGLClientBuffer)activeBuffer.get()->getNativeBuffer(),
+ eglImgAttrs);
+ if ((glerr = glGetError()) != 0)
+ CLog::Log(LOGERROR, ">>> eglCreateImageKHR error(%d)\n", glerr);
+
+ GLuint textureId;
+ glActiveTexture(GL_TEXTURE0);
+ glGenTextures(1, &textureId);
+ glBindTexture(GL_TEXTURE_2D, textureId);
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, eglimg);
+ if ((glerr = glGetError()) != 0)
+ CLog::Log(LOGERROR, ">>> glEGLImageTargetTexture2DOES error(%d)\n", glerr);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ eglDestroyImageKHR(eglGetDisplay(EGL_DEFAULT_DISPLAY), eglimg);
+ if ((glerr = glGetError()) != 0)
+ CLog::Log(LOGERROR, ">>> eglDestroyImageKHR error(%d)\n", glerr);
+
+ RenderTexture(textureId);
+
+ glDeleteTextures(1, &textureId);
+
+#endif
+}
+
void CLinuxRendererGLES::RenderCoreVideoRef(int index, int field)
{
#ifdef HAVE_VIDEOTOOLBOXDECODER
@@ -1373,6 +1481,8 @@ void CLinuxRendererGLES::UploadYV12Texture(int source)
#if defined(HAVE_LIBOPENMAX)
if (!(im->flags&IMAGE_FLAG_READY) || m_buffers[source].openMaxBuffer)
+#elif defined(HAVE_LIBSTAGEFRIGHT)
+ if (!(im->flags&IMAGE_FLAG_READY) || m_buffers[source].texture_id >= 0)
#else
if (!(im->flags&IMAGE_FLAG_READY))
#endif
@@ -1914,6 +2024,9 @@ bool CLinuxRendererGLES::Supports(EINTERLACEMETHOD method)
if(m_renderMethod & RENDER_OMXEGL)
return false;
+ if(m_renderMethod & RENDER_TEXTURE)
+ return false;
+
if(m_renderMethod & RENDER_CVREF)
return false;
@@ -1962,6 +2075,9 @@ EINTERLACEMETHOD CLinuxRendererGLES::AutoInterlaceMethod()
if(m_renderMethod & RENDER_OMXEGL)
return VS_INTERLACEMETHOD_NONE;
+ if(m_renderMethod & RENDER_TEXTURE)
+ return VS_INTERLACEMETHOD_NONE;
+
if(m_renderMethod & RENDER_CVREF)
return VS_INTERLACEMETHOD_NONE;
@@ -1990,6 +2106,13 @@ void CLinuxRendererGLES::AddProcessor(struct __CVBuffer *cvBufferRef)
CVBufferRetain(buf.cvBufferRef);
}
#endif
+#ifdef HAVE_LIBSTAGEFRIGHT
+void CLinuxRendererGLES::AddProcessor(GLuint texture_id)
+{
+ YUVBUFFER &buf = m_buffers[NextYV12Texture()];
+ buf.texture_id = texture_id;
+}
+#endif
#endif
View
11 xbmc/cores/VideoRenderers/LinuxRendererGLES.h
@@ -86,7 +86,8 @@ enum RenderMethod
RENDER_POT = 0x010,
RENDER_OMXEGL = 0x040,
RENDER_CVREF = 0x080,
- RENDER_BYPASS = 0x100
+ RENDER_BYPASS = 0x100,
+ RENDER_TEXTURE = 0x101
};
enum RenderQuality
@@ -158,6 +159,9 @@ class CLinuxRendererGLES : public CBaseRenderer
#ifdef HAVE_VIDEOTOOLBOXDECODER
virtual void AddProcessor(struct __CVBuffer *cvBufferRef);
#endif
+#ifdef HAVE_LIBSTAGEFRIGHT
+ virtual void AddProcessor(GLuint texture_id);
+#endif
protected:
virtual void Render(DWORD flags, int index);
@@ -193,7 +197,9 @@ class CLinuxRendererGLES : public CBaseRenderer
void RenderSinglePass(int index, int field); // single pass glsl renderer
void RenderSoftware(int index, int field); // single pass s/w yuv2rgb renderer
void RenderOpenMax(int index, int field); // OpenMAX rgb texture
+ void RenderTexture(int index, int field); // rgb texture
void RenderCoreVideoRef(int index, int field); // CoreVideo reference
+ void RenderTexture(GLuint textureId); // rgb texture
CFrameBufferObject m_fbo;
@@ -249,6 +255,9 @@ class CLinuxRendererGLES : public CBaseRenderer
#ifdef HAVE_VIDEOTOOLBOXDECODER
struct __CVBuffer *cvBufferRef;
#endif
+#ifdef HAVE_LIBSTAGEFRIGHT
+ GLuint texture_id;
+#endif
};
View
1  xbmc/cores/VideoRenderers/RenderFormats.h
@@ -34,6 +34,7 @@ enum ERenderFormat {
RENDER_FMT_OMXEGL,
RENDER_FMT_CVBREF,
RENDER_FMT_BYPASS,
+ RENDER_FMT_TEXTURE,
};
#endif
View
5 xbmc/cores/VideoRenderers/RenderManager.cpp
@@ -844,6 +844,11 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic)
else if(pic.format == RENDER_FMT_VAAPI)
m_pRenderer->AddProcessor(*pic.vaapi);
#endif
+#ifdef HAVE_LIBSTAGEFRIGHT
+ else if(pic.format == RENDER_FMT_TEXTURE)
+ m_pRenderer->AddProcessor(pic.texture_id);
+#endif
+
m_pRenderer->ReleaseImage(index, false);
return index;
View
5 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodec.h 100755 → 100644
@@ -50,7 +50,6 @@ struct DVDVideoPicture
struct {
BYTE* data[4]; // [4] = alpha channel, currently not used
int iLineSize[4]; // [4] = alpha channel, currently not used
- void* stdcontext;
};
struct {
DXVA::CSurfaceContext* context;
@@ -70,6 +69,10 @@ struct DVDVideoPicture
struct {
struct __CVBuffer *cvBufferRef;
};
+
+ struct {
+ unsigned int texture_id;
+ };
};
unsigned int iFlags;
View
2  xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in
@@ -25,7 +25,7 @@ endif
ifeq (@USE_LIBSTAGEFRIGHT@,1)
SRCS += StageFrightVideo.cpp
SRCS += DVDVideoCodecStageFright.cpp
-INCLUDES += -I${prefix}/opt/android-source/frameworks/base/include -I${prefix}/opt/android-source/frameworks/base/native/include -I${prefix}/opt/android-source/system/core/include -I${prefix}/opt/android-source/frameworks/base/media/libstagefright -I${prefix}/opt/android-source/frameworks/base/include/media/stagefright/openmax -I${prefix}/opt/android-source/frameworks/base/media/libstagefright -I${prefix}/opt/android-source/libhardware/include
+INCLUDES += -I${prefix}/opt/android-source/frameworks/native/include -I${prefix}/opt/android-source/frameworks/av/include -I${prefix}/opt/android-source/system/core/include -I${prefix}/opt/android-source/frameworks/av/media/libstagefright -I${prefix}/opt/android-source/frameworks/native/include/media/openmax -I${prefix}/opt/android-source/frameworks/av/media/libstagefright -I${prefix}/opt/android-source/libhardware/include
endif
LIB=Video.a
View
323 xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideo.cpp
@@ -18,34 +18,13 @@
*
*/
/***************************************************************************/
-/*
- * Interface to the Android Stagefright library for
- * H/W accelerated H.264 decoding
- *
- * Copyright (C) 2011 Mohamed Naufal
- * Copyright (C) 2011 Martin Storsjö
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
#include "system.h"
#include "StageFrightVideo.h"
+#include "android/activity/XBMCApp.h"
+#include "guilib/GraphicContext.h"
#include "DVDClock.h"
#include "threads/Event.h"
#include "utils/log.h"
@@ -54,15 +33,16 @@
#include <binder/ProcessState.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaBufferGroup.h>
-#include <media/stagefright/MediaDebug.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/OMXClient.h>
#include <media/stagefright/OMXCodec.h>
#include <utils/List.h>
#include <utils/RefBase.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <ui/GraphicBuffer.h>
#include <gui/SurfaceTexture.h>
#include <gui/SurfaceTextureClient.h>
-#include <EGL/egl.h>
#include <new>
#include <map>
@@ -120,18 +100,24 @@ class StagefrightContext : public MediaBufferObserver
return buf;
}
- sp<MediaSource> *source;
+ sp<MetaData> meta;
+ sp<MediaSource> source;
List<Frame*> in_queue;
pthread_mutex_t in_mutex;
pthread_cond_t condition;
-
+
Frame *cur_frame;
Frame *prev_frame;
bool source_done;
+ int x, y;
+ int width, height;
OMXClient *client;
- sp<MediaSource> *decoder;
+ sp<MediaSource> decoder;
const char *decoder_component;
+ int videoColorFormat;
+ int videoStride;
+ int videoSliceHeight;
bool drop_state;
#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
@@ -217,6 +203,8 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
CLog::Log(LOGDEBUG, "%s::Open\n", CLASSNAME);
#endif
+ CSingleLock lock(g_graphicsContext);
+
// stagefright crashes with null size. Trap this...
if (!hints.width || !hints.height)
{
@@ -247,30 +235,29 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
break;
}
- sp<MetaData> meta, outFormat;
- int32_t colorFormat = 0;
-
m_context = new StagefrightContext;
m_context->width = hints.width;
m_context->height = hints.height;
- meta = new MetaData;
- if (meta == NULL)
+ sp<MetaData> outFormat;
+ int32_t cropLeft, cropTop, cropRight, cropBottom;
+
+ m_context->meta = new MetaData;
+ if (m_context->meta == NULL)
{
goto fail;
}
- meta->setCString(kKeyMIMEType, mimetype);
- meta->setInt32(kKeyWidth, m_context->width);
- meta->setInt32(kKeyHeight, m_context->height);
- meta->setData(kKeyAVCC, kTypeAVCC, hints.extradata, hints.extrasize);
+ m_context->meta->setCString(kKeyMIMEType, mimetype);
+ m_context->meta->setInt32(kKeyWidth, m_context->width);
+ m_context->meta->setInt32(kKeyHeight, m_context->height);
+ m_context->meta->setData(kKeyAVCC, kTypeAVCC, hints.extradata, hints.extrasize);
android::ProcessState::self()->startThreadPool();
- m_context->source = new sp<MediaSource>();
- *m_context->source = new CustomSource(m_context, meta);
+ m_context->source = new CustomSource(m_context, m_context->meta);
m_context->client = new OMXClient;
- if (m_context->source == NULL || !m_context->client)
+ if (m_context->source == NULL || m_context->client == NULL)
{
goto fail;
}
@@ -280,36 +267,57 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Cannot connect OMX client");
goto fail;
}
+
+ m_context->decoder = OMXCodec::Create(m_context->client->interface(), m_context->meta,
+ false, m_context->source, NULL,
+ OMXCodec::kHardwareCodecsOnly,
+ g_xbmcapp.GetAndroidVideoWindow());
- m_context->decoder = new sp<MediaSource>();
- *m_context->decoder = OMXCodec::Create(m_context->client->interface(), meta,
- false, *m_context->source, NULL,
- OMXCodec::kClientNeedsFramebuffer | OMXCodec::kHardwareCodecsOnly,
- m_context->mNatWindow);
- if (!((*m_context->decoder != NULL) && ((*m_context->decoder)->start() == OK)))
+ if (!(m_context->decoder != NULL && m_context->decoder->start() == OK))
{
- CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Cannot start decoder");
m_context->client->disconnect();
goto fail;
}
- outFormat = (*m_context->decoder)->getFormat();
- outFormat->findInt32(kKeyColorFormat, &colorFormat);
- if (colorFormat != OMX_COLOR_FormatYUV420Planar)
+ outFormat = m_context->decoder->getFormat();
+ if (!outFormat->findInt32(kKeyWidth, &m_context->width) || !outFormat->findInt32(kKeyHeight, &m_context->height)
+ || !outFormat->findInt32(kKeyColorFormat, &m_context->videoColorFormat))
{
- CLog::Log(LOGERROR, "%s::%s - %s: %d\n", CLASSNAME, __func__,"Unsupported color format",colorFormat);
+ m_context->client->disconnect();
+ goto fail;
+ }
+ if (m_context->videoColorFormat != OMX_COLOR_FormatYUV420Planar &&
+ m_context->videoColorFormat != OMX_COLOR_FormatYUV420SemiPlanar &&
+ m_context->videoColorFormat != OMX_QCOM_COLOR_FormatYVU420SemiPlanar)
+ {
+ CLog::Log(LOGERROR, "%s::%s - %s: %d\n", CLASSNAME, __func__,"Unsupported color format",m_context->videoColorFormat);
m_context->client->disconnect();
goto fail;
}
- outFormat->findCString(kKeyDecoderComponent, &m_context->decoder_component);
-#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, "%s::%s - Decoder: %s\n", CLASSNAME, __func__,m_context->decoder_component);
-#endif
-
+ if (!outFormat->findInt32(kKeyStride, &m_context->videoStride))
+ m_context->videoStride = m_context->width;
+ if (!outFormat->findInt32(kKeySliceHeight, &m_context->videoSliceHeight))
+ m_context->videoSliceHeight = m_context->height;
+
+ if (!outFormat->findRect(kKeyCropRect, &cropLeft, &cropTop, &cropRight, &cropBottom))
+ {
+ m_context->x = 0;
+ m_context->y = 0;
+ }
+ else
+ {
+ m_context->x = cropLeft;
+ m_context->y = cropTop;
+ m_context->width = cropRight - cropLeft + 1;
+ m_context->height = cropBottom - cropTop + 1;
+ }
+
pthread_mutex_init(&m_context->in_mutex, NULL);
pthread_cond_init(&m_context->condition, NULL);
+ m_context->client->disconnect();
+
return true;
fail:
@@ -317,6 +325,7 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
return false;
}
+/*** Decode ***/
int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
{
#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
@@ -331,7 +340,9 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
int demuxer_bytes = iSize;
uint8_t *demuxer_content = pData;
int ret = VC_BUFFER;
-
+ int32_t keyframe = 0;
+ int32_t unreadable = 0;
+
if (demuxer_content)
{
frame = (Frame*)malloc(sizeof(Frame));
@@ -362,6 +373,8 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
if (m_context->in_queue.size() < MINBUFIN)
return ret;
+ /* Output */
+
#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
time = XbmcThreads::SystemClockMillis();
CLog::Log(LOGDEBUG, "%s: >>> Handling frame\n", CLASSNAME);
@@ -374,20 +387,37 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
}
frame->medbuf = NULL;
- frame->status = (*m_context->decoder)->read(&frame->medbuf);
+ frame->status = m_context->decoder->read(&frame->medbuf);
if (frame->status == INFO_FORMAT_CHANGED)
{
+ sp<MetaData> outFormat = m_context->decoder->getFormat();
+
+ outFormat->findInt32(kKeyColorFormat, &m_context->videoColorFormat);
+ if (!outFormat->findInt32(kKeyStride, &m_context->videoStride))
+ m_context->videoStride = m_context->width;
+ if (!outFormat->findInt32(kKeySliceHeight, &m_context->videoSliceHeight))
+ m_context->videoSliceHeight = m_context->height;
+
if (frame->medbuf)
frame->medbuf->release();
free(frame);
m_context->cur_frame = NULL;
return ret;
}
- else if (frame->status == OK)
+ if (frame->status == OK)
{
- sp<MetaData> outFormat = (*m_context->decoder)->getFormat();
+ if (!frame->medbuf)
+ return ret;
+
+ sp<MetaData> outFormat = m_context->decoder->getFormat();
outFormat->findInt32(kKeyWidth , &w);
outFormat->findInt32(kKeyHeight, &h);
+
+ if (!outFormat->findInt32(kKeyIsSyncFrame, &keyframe))
+ keyframe = 0;
+ if (!outFormat->findInt32(kKeyIsUnreadable, &unreadable))
+ unreadable = 0;
+
frame->pts = 0;
// The OMX.SEC decoder doesn't signal the modified width/height
@@ -402,15 +432,50 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
}
frame->width = w;
frame->height = h;
- if (frame->medbuf)
- {
- frame->medbuf->meta_data()->findInt64(kKeyTime, &(frame->pts));
- if (m_context->drop_state)
+ frame->medbuf->meta_data()->findInt64(kKeyTime, &(frame->pts));
+ if (m_context->drop_state)
+ {
+ frame->medbuf->release();
+ frame->medbuf = NULL;
+ }
+ else if (!frame->medbuf->graphicBuffer().get()) // hw buffers
+ {
+ if (frame->medbuf->range_length() == 0)
{
frame->medbuf->release();
frame->medbuf = NULL;
+ return ret;
}
- }
+ }
+ }
+ else if (frame->status == INFO_FORMAT_CHANGED)
+ {
+ int32_t cropLeft, cropTop, cropRight, cropBottom;
+ sp<MetaData> outFormat = m_context->decoder->getFormat();
+
+ if (!outFormat->findRect(kKeyCropRect, &cropLeft, &cropTop, &cropRight, &cropBottom))
+ {
+ m_context->x = 0;
+ m_context->y = 0;
+ }
+ else
+ {
+ m_context->x = cropLeft;
+ m_context->y = cropTop;
+ m_context->width = cropRight - cropLeft + 1;
+ m_context->height = cropBottom - cropTop + 1;
+ }
+ outFormat->findInt32(kKeyColorFormat, &m_context->videoColorFormat);
+ if (!outFormat->findInt32(kKeyStride, &m_context->videoStride))
+ m_context->videoStride = m_context->width;
+ if (!outFormat->findInt32(kKeySliceHeight, &m_context->videoSliceHeight))
+ m_context->videoSliceHeight = m_context->height;
+
+ if (frame->medbuf)
+ frame->medbuf->release();
+ free(frame);
+ m_context->cur_frame = NULL;
+ return ret;
}
else
{
@@ -424,7 +489,7 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
m_context->cur_frame = frame;
#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, "%s: >>> pushed OUT frame; tm:%d\n", CLASSNAME,XbmcThreads::SystemClockMillis() - time);
+ CLog::Log(LOGDEBUG, "%s: >>> pushed OUT frame; tm:%d, kf:%d, ur:%d\n", CLASSNAME,XbmcThreads::SystemClockMillis() - time, keyframe, unreadable);
#endif
if (m_context->cur_frame)
@@ -433,6 +498,21 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
return ret;
}
+bool CStageFrightVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture)
+{
+#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, "%s::ClearPicture\n", CLASSNAME);
+#endif
+ if (m_context->prev_frame) {
+ if (m_context->prev_frame->medbuf)
+ m_context->prev_frame->medbuf->release();
+ free(m_context->prev_frame);
+ m_context->prev_frame = NULL;
+ }
+
+ return true;
+}
+
bool CStageFrightVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture)
{
#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
@@ -440,7 +520,6 @@ bool CStageFrightVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture)
CLog::Log(LOGDEBUG, "%s::GetPicture\n", CLASSNAME);
#endif
- bool ret = true;
status_t status;
if (!m_context->cur_frame)
@@ -460,53 +539,79 @@ bool CStageFrightVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture)
return false;
}
- pDvdVideoPicture->format = RENDER_FMT_YUV420P;
+ pDvdVideoPicture->format = RENDER_FMT_BYPASS;
pDvdVideoPicture->pts = DVD_NOPTS_VALUE;
pDvdVideoPicture->dts = DVD_NOPTS_VALUE;
- pDvdVideoPicture->color_range = 0;
- pDvdVideoPicture->color_matrix = 4;
- pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED;
pDvdVideoPicture->iWidth = frame->width;
pDvdVideoPicture->iHeight = frame->height;
pDvdVideoPicture->iDisplayWidth = frame->width;
pDvdVideoPicture->iDisplayHeight = frame->height;
+ pDvdVideoPicture->iFlags = DVP_FLAG_ALLOCATED;
pDvdVideoPicture->pts = pts_itod(frame->pts);
-#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, ">>> pic pts:%f, data:%p, tm:%d\n", pDvdVideoPicture->pts, frame->medbuf, XbmcThreads::SystemClockMillis() - time);
-#endif
-
- unsigned int luma_pixels = frame->width * frame->height;
- unsigned int chroma_pixels = luma_pixels/4;
- BYTE* data = NULL;
+
if (frame->medbuf)
- data = (BYTE*)(frame->medbuf->data() + frame->medbuf->range_offset());
- pDvdVideoPicture->iLineSize[0] = frame->width;
- pDvdVideoPicture->iLineSize[1] = frame->width / 2;
- pDvdVideoPicture->iLineSize[2] = frame->width / 2;
- pDvdVideoPicture->iLineSize[3] = 0;
- pDvdVideoPicture->data[0] = data;
- pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + (frame->width * frame->height);
- pDvdVideoPicture->data[2] = pDvdVideoPicture->data[1] + (frame->width/2 * frame->height/2);
- pDvdVideoPicture->data[3] = 0;
-
- pDvdVideoPicture->iFlags |= data == NULL ? DVP_FLAG_DROPPED : 0;
- m_context->prev_frame = m_context->cur_frame;
- m_context->cur_frame = NULL;
-
- return true;
-}
+ {
+ if (frame->medbuf->graphicBuffer() != 0)
+ {
+ pDvdVideoPicture->format = RENDER_FMT_TEXTURE;
-bool CStageFrightVideo::ClearPicture(DVDVideoPicture* pDvdVideoPicture)
-{
-#if defined(STAGEFRIGHT_DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, "%s::ClearPicture\n", CLASSNAME);
-#endif
- if (m_context->prev_frame) {
- if (m_context->prev_frame->medbuf)
- m_context->prev_frame->medbuf->release();
- free(m_context->prev_frame);
- m_context->prev_frame = NULL;
+ android::GraphicBuffer* graphicBuffer = static_cast<android::GraphicBuffer*>(frame->medbuf->graphicBuffer().get() );
+ ANativeWindow* nativeWindow = static_cast<ANativeWindow*>(g_xbmcapp.GetAndroidVideoWindow().get());
+ int err = nativeWindow->queueBuffer(nativeWindow, graphicBuffer);
+ if (err == 0)
+ frame->medbuf->meta_data()->setInt32(kKeyRendered, 1);
+ frame->medbuf->release();
+ frame->medbuf = NULL;
+
+ #if defined(STAGEFRIGHT_DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, ">>> pic pts:%f, textured, tm:%d\n", pDvdVideoPicture->pts, XbmcThreads::SystemClockMillis() - time);
+ #endif
+ }
+ else
+ {
+ pDvdVideoPicture->format = RENDER_FMT_YUV420P;
+ pDvdVideoPicture->color_range = 0;
+ pDvdVideoPicture->color_matrix = 4;
+ #if defined(STAGEFRIGHT_DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, ">>> pic pts:%f, data:%p, tm:%d\n", pDvdVideoPicture->pts, frame->medbuf, XbmcThreads::SystemClockMillis() - time);
+ #endif
+
+ unsigned int luma_pixels = frame->width * frame->height;
+ unsigned int chroma_pixels = luma_pixels/4;
+ BYTE* data = NULL;
+ if (frame->medbuf)
+ data = (BYTE*)(frame->medbuf->data() + frame->medbuf->range_offset());
+ switch (m_context->videoColorFormat)
+ {
+ case OMX_COLOR_FormatYUV420Planar:
+ pDvdVideoPicture->iLineSize[0] = m_context->videoStride;
+ pDvdVideoPicture->iLineSize[1] = m_context->videoStride / 2;
+ pDvdVideoPicture->iLineSize[2] = m_context->videoStride / 2;
+ pDvdVideoPicture->iLineSize[3] = 0;
+ pDvdVideoPicture->data[0] = data;
+ pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + (m_context->videoStride * m_context->videoSliceHeight);
+ pDvdVideoPicture->data[2] = pDvdVideoPicture->data[1] + (m_context->videoStride/2 * m_context->videoSliceHeight/2);
+ pDvdVideoPicture->data[3] = 0;
+ break;
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ case OMX_QCOM_COLOR_FormatYVU420SemiPlanar:
+ pDvdVideoPicture->iLineSize[0] = m_context->videoStride;
+ pDvdVideoPicture->iLineSize[1] = m_context->videoStride;
+ pDvdVideoPicture->iLineSize[2] = 0;
+ pDvdVideoPicture->iLineSize[3] = 0;
+ pDvdVideoPicture->data[0] = data;
+ pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + (m_context->videoStride * m_context->videoSliceHeight);
+ pDvdVideoPicture->data[2] = 0;
+ pDvdVideoPicture->data[3] = 0;
+ break;
+ }
+ }
}
+ else
+ pDvdVideoPicture->iFlags |= DVP_FLAG_DROPPED;
+
+ m_context->prev_frame = m_context->cur_frame;
+ m_context->cur_frame = NULL;
return true;
}
@@ -544,15 +649,19 @@ void CStageFrightVideo::Close()
free(m_context->prev_frame);
}
- (*m_context->decoder)->stop();
+ m_context->decoder->stop();
m_context->client->disconnect();
if (m_context->decoder_component)
free(&m_context->decoder_component);
+ //delete m_context->decoder;
delete m_context->client;
- delete m_context->decoder;
- delete m_context->source;
+ //delete m_context->source;
+ //delete m_context->surface;
+ //delete m_context->texture;
+
+ //glDeleteTextures(1, &m_context->texture_id);
pthread_mutex_destroy(&m_context->in_mutex);
pthread_cond_destroy(&m_context->condition);
View
2  xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideo.h
@@ -39,7 +39,7 @@ class CStageFrightVideo
bool GetPicture(DVDVideoPicture *pDvdVideoPicture);
bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
void SetDropState(bool bDrop);
-
+
private:
StagefrightContext* m_context;
};
View
3  xbmc/cores/dvdplayer/DVDPlayerVideo.cpp
@@ -1121,6 +1121,9 @@ int CDVDPlayerVideo::OutputPicture(const DVDVideoPicture* src, double pts)
case RENDER_FMT_OMXEGL:
formatstr = "OMXEGL";
break;
+ case RENDER_FMT_TEXTURE:
+ formatstr = "TEXTURE";
+ break;
case RENDER_FMT_CVBREF:
formatstr = "BGRA";
break;
View
2  xbmc/input/TouchInput.h
@@ -21,7 +21,7 @@
#include "threads/CriticalSection.h"
#include "threads/Timer.h"
-#include "utils/Vector.h"
+#include "xbmc/utils/Vector.h"
#define TOUCH_MAX_POINTERS 2
Please sign in to comment.
Something went wrong with that request. Please try again.