Permalink
Browse files

[stagefright] Add advanced settings (dev) + remove GetTimeSize + Star…

…t blacklisting
  • Loading branch information...
1 parent 2d0256c commit 32e99c78388ae993112c18a889b9e89471a48691 @koying committed Feb 6, 2013
View
2 configure.in
@@ -1866,7 +1866,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 -lui"
+ LIBS+="-L${prefix}/opt/android-libs -lstdc++ -lutils -lcutils -lstagefright -lbinder -lui -lgui"
fi
fi
View
19 tools/android/depends/android-sources-ics/Makefile
@@ -7,7 +7,7 @@ INCLUDES += -I$(PREFIX)/opt/android-source/frameworks/base/include/media/stagefr
INCLUDES += -I$(PREFIX)/opt/android-source/system/core/include
INCLUDES += -I$(PREFIX)/opt/android-source/libhardware/include
-ANDROID_VERSION=ics
+ANDROID_VERSION=ics-mr0
ANDROID_SOURCE=android-source
ANDROID_LIBS=android-libs
@@ -16,23 +16,23 @@ all: .installed-$(PLATFORM)
.installed-$(PLATFORM): install-sources $(ANDROID_LIBS)
rm -rf $(PREFIX)/opt/$(ANDROID_LIBS)
mkdir -p $(PREFIX)/opt/$(ANDROID_LIBS)
- cp $(PLATFORM)/libstagefright.so $(PLATFORM)/libutils.so $(PLATFORM)/libbinder.so $(PLATFORM)/libcutils.so $(PLATFORM)/libui.so $(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)
touch $@
$(ANDROID_SOURCE):
echo "Fetching Android system headers"
- git clone --depth=1 --branch $(ANDROID_VERSION)-release git://github.com/CyanogenMod/android_frameworks_base.git $(ANDROID_SOURCE)/frameworks/base
- git clone --depth=1 --branch $(ANDROID_VERSION)-release git://github.com/CyanogenMod/android_system_core.git $(ANDROID_SOURCE)/system/core
- git clone --depth=1 --branch $(ANDROID_VERSION)-release git://github.com/CyanogenMod/android_hardware_libhardware.git $(ANDROID_SOURCE)/libhardware
+ git clone --depth=1 --branch $(ANDROID_VERSION) https://android.googlesource.com/platform/frameworks/base $(ANDROID_SOURCE)/frameworks/base
+ git clone --depth=1 --branch $(ANDROID_VERSION) https://android.googlesource.com/platform/system/core $(ANDROID_SOURCE)/system/core
+ git clone --depth=1 --branch $(ANDROID_VERSION) https://android.googlesource.com/platform/hardware/libhardware $(ANDROID_SOURCE)/libhardware
install-sources: $(ANDROID_SOURCE)
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
+$(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 $(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): install-sources
mkdir -p $(PLATFORM)
@@ -52,8 +52,11 @@ $(PLATFORM)/libcutils.so: $(PLATFORM) $(DEPS) 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 $(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)
+ rm -rf .installed-$(PLATFORM) $(ANDROID_SOURCE) $(PLATFORM) $(ANDROID_LIBS_ARCHIVE) $(ANDROID_LIBS)
distclean: clean
View
32 tools/android/depends/android-sources-ics/libgui.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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 <gui/SurfaceTexture.h>
+
+namespace android {
+
+status_t SurfaceTexture::updateTexImage()
+{
+ return 0;
+}
+
+void SurfaceTexture::getTransformMatrix(float mtx[16]) {}
+
+}
+
View
3 xbmc/DllPaths_generated_android.h.in
@@ -93,3 +93,6 @@
/* Android's libui for gralloc */
#define DLL_PATH_LIBUI "libui.so"
+
+/* Android's libs for stagefright */
+#define DLL_PATH_LIBBINDER "libbinder.so"
View
45 xbmc/android/activity/XBMCApp.cpp
@@ -53,6 +53,8 @@
#include <EGL/eglext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
+
+#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture"
#endif
#define GIGABYTES 1073741824
@@ -1133,45 +1135,38 @@ bool CXBMCApp::InitStagefrightSurface()
m_VideoTextureId = -1;
glGenTextures(1, &m_VideoTextureId);
-
- /*
- 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);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
CLog::Log(LOGDEBUG, ">>> texid: %d\n", m_VideoTextureId);
- glDisable(GL_TEXTURE_EXTERNAL_OES);
- */
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
jclass cSurfaceTexture = env->FindClass("android/graphics/SurfaceTexture");
jmethodID midSurfaceTextureCtor = env->GetMethodID(cSurfaceTexture, "<init>", "(I)V");
+ midSurfaceTextureRelease = env->GetMethodID(cSurfaceTexture, "release", "()V");
m_midUpdateTexImage = env->GetMethodID(cSurfaceTexture, "updateTexImage", "()V");
m_midGetTransformMatrix = env->GetMethodID(cSurfaceTexture, "getTransformMatrix", "([F)V");
jobject oSurfTexture = env->NewObject(cSurfaceTexture, midSurfaceTextureCtor, m_VideoTextureId);
- //jfieldID fidSurfaceTexture = env->GetFieldID(cSurfaceTexture, ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID, "I");
- //m_SurfaceTexture = (android::SurfaceTexture*)env->GetIntField(oSurfTexture, fidSurfaceTexture);
+ jfieldID fidSurfaceTexture = env->GetFieldID(cSurfaceTexture, ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID, "I");
+ m_SurfaceTexture = (android::SurfaceTexture*)env->GetIntField(oSurfTexture, fidSurfaceTexture);
env->DeleteLocalRef(cSurfaceTexture);
m_SurfTexture = env->NewGlobalRef(oSurfTexture);
env->DeleteLocalRef(oSurfTexture);
jclass cSurface = env->FindClass("android/view/Surface");
jmethodID midSurfaceCtor = env->GetMethodID(cSurface, "<init>", "(Landroid/graphics/SurfaceTexture;)V");
- jmethodID midSurfaceRelease = env->GetMethodID(cSurface, "release", "()V");
+ midSurfaceRelease = env->GetMethodID(cSurface, "release", "()V");
jobject oSurface = env->NewObject(cSurface, midSurfaceCtor, m_SurfTexture);
env->DeleteLocalRef(cSurface);
-
- m_VideoNativeWindow = ANativeWindow_fromSurface(env, oSurface);
-
- env->CallVoidMethod(oSurface, midSurfaceRelease);
+ m_Surface = env->NewGlobalRef(oSurface);
env->DeleteLocalRef(oSurface);
- glDisable(GL_TEXTURE_EXTERNAL_OES);
-
+ m_VideoNativeWindow = ANativeWindow_fromSurface(env, m_Surface);
+
DetachCurrentThread();
return true;
@@ -1187,18 +1182,16 @@ void CXBMCApp::UninitStagefrightSurface()
ANativeWindow_release(m_VideoNativeWindow);
m_VideoNativeWindow = NULL;
- /*
- m_SurfaceTexture.clear();
m_SurfaceTexture = NULL;
- */
- glDeleteTextures(1, &m_VideoTextureId);
- jclass cSurfaceTexture = env->GetObjectClass(m_SurfTexture);
- jmethodID midSurfaceTextureRelease = env->GetMethodID(cSurfaceTexture, "release", "()V");
+ env->CallVoidMethod(m_Surface, midSurfaceRelease);
+ env->DeleteGlobalRef(m_Surface);
+
env->CallVoidMethod(m_SurfTexture, midSurfaceTextureRelease);
- env->DeleteLocalRef(cSurfaceTexture);
env->DeleteGlobalRef(m_SurfTexture);
+ glDeleteTextures(1, &m_VideoTextureId);
+
DetachCurrentThread();
}
@@ -1210,8 +1203,6 @@ void CXBMCApp::UpdateStagefrightTexture()
env->CallVoidMethod(m_SurfTexture, m_midUpdateTexImage);
DetachCurrentThread();
-
-// m_SurfaceTexture->updateTexImage();
}
void CXBMCApp::GetStagefrightTransformMatrix(float* transformMatrix)
@@ -1229,8 +1220,6 @@ void CXBMCApp::GetStagefrightTransformMatrix(float* transformMatrix)
env->DeleteLocalRef(arr);
DetachCurrentThread();
-
-// m_SurfaceTexture->getTransformMatrix(transformMatrix);
}
#endif
View
11 xbmc/android/activity/XBMCApp.h
@@ -32,6 +32,12 @@
#include "xbmc.h"
#include "utils/GlobalsHandling.h"
+#ifdef HAVE_LIBSTAGEFRIGHT
+namespace android {
+ class SurfaceTexture;
+}
+#endif
+
// forward delares
class CAESinkAUDIOTRACK;
typedef struct _JNIEnv JNIEnv;
@@ -109,6 +115,7 @@ class CXBMCApp : public IActivityHandler
ANativeWindow* GetAndroidVideoWindow() const { return m_VideoNativeWindow;}
const unsigned int GetAndroidTexture() const { return m_VideoTextureId; }
+ android::SurfaceTexture* GetSurfaceTexture() const { return m_SurfaceTexture; }
#endif
protected:
@@ -168,9 +175,13 @@ class CXBMCApp : public IActivityHandler
#ifdef HAVE_LIBSTAGEFRIGHT
unsigned int m_VideoTextureId;
jobject m_SurfTexture;
+ jobject m_Surface;
jmethodID m_midUpdateTexImage;
jmethodID m_midGetTransformMatrix;
+ jmethodID midSurfaceTextureRelease;
+ jmethodID midSurfaceRelease;
ANativeWindow* m_VideoNativeWindow;
+ android::SurfaceTexture* m_SurfaceTexture;
#endif
void XBMC_Pause(bool pause);
View
1 xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp
@@ -262,6 +262,7 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne
{
case CODEC_ID_H264:
case CODEC_ID_MPEG4:
+ case CODEC_ID_MPEG2VIDEO:
case CODEC_ID_VC1:
case CODEC_ID_WMV3:
case CODEC_ID_VP3:
View
8 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecStageFright.cpp
@@ -55,7 +55,6 @@ bool CDVDVideoCodecStageFright::Open(CDVDStreamInfo &hints, CDVDCodecOptions &op
if (g_guiSettings.GetBool("videoplayer.usestagefright") && !hints.software)
{
m_convert_bitstream = false;
-
CLog::Log(LOGDEBUG,
"%s::%s - trying to open, codec(%d), profile(%d), level(%d)",
CLASSNAME, __func__, hints.codec, hints.profile, hints.level);
@@ -74,6 +73,9 @@ bool CDVDVideoCodecStageFright::Open(CDVDStreamInfo &hints, CDVDCodecOptions &op
m_convert_bitstream = m_converter->Open(hints.codec, (uint8_t *)hints.extradata, hints.extrasize, true);
break;
+ case CODEC_ID_MPEG2VIDEO:
+ m_pFormatName = "stf-mpeg2";
+ break;
case CODEC_ID_MPEG4:
m_pFormatName = "stf-mpeg4";
break;
@@ -188,12 +190,12 @@ void CDVDVideoCodecStageFright::SetSpeed(int iSpeed)
int CDVDVideoCodecStageFright::GetDataSize(void)
{
- return m_stf_decoder->GetDataSize();
+ return 0;
}
double CDVDVideoCodecStageFright::GetTimeSize(void)
{
- return m_stf_decoder->GetTimeSize();
+ return 0;
}
#endif
View
425 xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2012 Team XBMC
+ * Copyright (C) 2010-2013 Team XBMC
* http://www.xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
@@ -33,22 +33,26 @@
#include "utils/fastmemcpy.h"
#include "threads/Thread.h"
#include "threads/Event.h"
+#include "settings/AdvancedSettings.h"
#include "xbmc/guilib/FrameBufferObject.h"
#include "windowing/WindowingFactory.h"
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
#include <binder/ProcessState.h>
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <media/stagefright/MediaDefs.h>
#include <media/stagefright/OMXClient.h>
#include <media/stagefright/OMXCodec.h>
+#include <media/stagefright/foundation/ABuffer.h>
#include <utils/List.h>
#include <utils/RefBase.h>
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
+#include <gui/SurfaceTexture.h>
#include <new>
#include <map>
@@ -57,7 +61,7 @@
#define OMX_QCOM_COLOR_FormatYVU420SemiPlanar 0x7FA30C00
#define CLASSNAME "CStageFrightVideo"
-#define INBUFCOUNT 2
+#define INBUFCOUNT 16
#define NUMFBOTEX 4
// EGL extension functions
@@ -100,8 +104,8 @@ struct Frame
status_t status;
int32_t width, height;
int64_t pts;
- int duration;
ERenderFormat format;
+ EGLImageKHR eglimg;
MediaBuffer* medbuf;
};
@@ -114,7 +118,7 @@ class CStageFrightVideoPrivate : public MediaBufferObserver
: decode_thread(NULL), source(NULL), natwin(NULL)
, eglDisplay(EGL_NO_DISPLAY), eglSurface(EGL_NO_SURFACE), eglContext(EGL_NO_CONTEXT)
, eglInitialized(false)
- , mDataSize(0), mTimeSize(0), mPrevPts(-1)
+ , framecount(0)
, cur_frame(NULL), prev_frame(NULL)
, width(-1), height(-1)
, texwidth(-1), texheight(-1)
@@ -124,20 +128,30 @@ class CStageFrightVideoPrivate : public MediaBufferObserver
virtual void signalBufferReturned(MediaBuffer *buffer)
{
- mDataSize -= buffer->size();
}
MediaBuffer* getBuffer(size_t size)
{
int i=0;
for (; i<INBUFCOUNT; ++i)
- if (inbuf[i]->refcount() == 0)
+ if (inbuf[i]->refcount() == 0 && inbuf[i]->size() >= size)
break;
if (i == INBUFCOUNT)
- return NULL;
+ {
+ i = 0;
+ for (; i<INBUFCOUNT; ++i)
+ if (inbuf[i]->refcount() == 0)
+ break;
+ if (i == INBUFCOUNT)
+ return NULL;
+ inbuf[i]->setObserver(NULL);
+ inbuf[i]->release();
+ inbuf[i] = new MediaBuffer(size);
+ inbuf[i]->setObserver(this);
+ }
+
inbuf[i]->add_ref();
inbuf[i]->set_range(0, size);
- mDataSize += size;
return inbuf[i];
}
@@ -382,17 +396,15 @@ class CStageFrightVideoPrivate : public MediaBufferObserver
std::list< std::pair<EGLImageKHR, int> > busy_queue;
sp<MetaData> meta;
- List<Frame*> in_queue;
+ int64_t framecount;
+ map<int64_t, Frame*> in_queue;
+ map<int64_t, Frame*> out_queue;
pthread_mutex_t in_mutex;
pthread_cond_t in_condition;
pthread_mutex_t out_mutex;
pthread_cond_t out_condition;
pthread_mutex_t free_mutex;
- int mDataSize;
- int64_t mTimeSize;
- int64_t mPrevPts;
-
Frame *cur_frame;
Frame *prev_frame;
bool source_done;
@@ -449,7 +461,9 @@ class CStageFrightDecodeThread : public CThread
int32_t keyframe = 0;
int32_t unreadable = 0;
MediaSource::ReadOptions readopt;
+ // GLuint texid;
+ //SetPriority(THREAD_PRIORITY_ABOVE_NORMAL);
do
{
#if defined(DEBUG_VERBOSE)
@@ -465,6 +479,7 @@ class CStageFrightDecodeThread : public CThread
continue;
}
+ frame->eglimg = EGL_NO_IMAGE_KHR;
frame->medbuf = NULL;
if (p->resetting)
{
@@ -473,6 +488,7 @@ class CStageFrightDecodeThread : public CThread
}
frame->status = p->decoder->read(&frame->medbuf, &readopt);
readopt.clearSeekTo();
+
if (frame->status == OK)
{
if (!frame->medbuf->graphicBuffer().get()) // hw buffers
@@ -490,7 +506,10 @@ class CStageFrightDecodeThread : public CThread
}
else
frame->format = RENDER_FMT_EGLIMG;
+ }
+ if (frame->status == OK)
+ {
sp<MetaData> outFormat = p->decoder->getFormat();
outFormat->findInt32(kKeyWidth , &w);
outFormat->findInt32(kKeyHeight, &h);
@@ -529,7 +548,8 @@ class CStageFrightDecodeThread : public CThread
outFormat->findInt32(kKeyWidth , &p->width);
outFormat->findInt32(kKeyHeight, &p->height);
- if (!outFormat->findRect(kKeyCropRect, &cropLeft, &cropTop, &cropRight, &cropBottom))
+ cropLeft = cropTop = cropRight = cropBottom = 0;
+ if (!outFormat->findRect(kKeyCropRect, &cropLeft, &cropTop, &cropRight, &cropBottom))
{
p->x = 0;
p->y = 0;
@@ -547,9 +567,14 @@ class CStageFrightDecodeThread : public CThread
if (!outFormat->findInt32(kKeySliceHeight, &p->videoSliceHeight))
p->videoSliceHeight = p->height;
+#if defined(DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, ">>> new format col:%d, w:%d, h:%d, sw:%d, sh:%d, ctl:%d,%d; cbr:%d,%d\n", p->videoColorFormat, p->width, p->height, p->videoStride, p->videoSliceHeight, cropTop, cropLeft, cropBottom, cropRight);
+#endif
+
if (frame->medbuf)
frame->medbuf->release();
frame->medbuf = NULL;
+ free(frame);
continue;
}
else
@@ -561,20 +586,102 @@ class CStageFrightDecodeThread : public CThread
frame->medbuf = NULL;
}
- if (frame->status == OK && frame->format == RENDER_FMT_EGLIMG)
+ if (frame->format == RENDER_FMT_EGLIMG)
{
+ if (!p->eglInitialized)
+ {
+ p->InitializeEGL(frame->width, frame->height);
+ }
+ else if (p->texwidth != frame->width || p->texheight != frame->height)
+ {
+ p->UninitializeEGL();
+ p->InitializeEGL(frame->width, frame->height);
+ }
+
+ if (p->free_queue.empty())
+ {
+ CLog::Log(LOGERROR, "%s::%s - Error: No free output buffers\n", CLASSNAME, __func__);
+ if (frame->medbuf) {
+ frame->medbuf->release();
+ }
+ free(frame);
+ continue;;
+ }
+
android::GraphicBuffer* graphicBuffer = static_cast<android::GraphicBuffer*>(frame->medbuf->graphicBuffer().get() );
native_window_set_buffers_timestamp(p->natwin.get(), frame->pts * 1000);
int err = p->natwin.get()->queueBuffer(p->natwin.get(), graphicBuffer);
if (err == 0)
frame->medbuf->meta_data()->setInt32(kKeyRendered, 1);
frame->medbuf->release();
frame->medbuf = NULL;
+ g_xbmcapp.UpdateStagefrightTexture();
+ // g_xbmcapp.GetSurfaceTexture()->updateTexImage();
+
+ if (!p->drop_state)
+ {
+ // static const EGLint eglImgAttrs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE, EGL_NONE };
+ // EGLImageKHR img = eglCreateImageKHR(p->eglDisplay, EGL_NO_CONTEXT,
+ // EGL_NATIVE_BUFFER_ANDROID,
+ // (EGLClientBuffer)graphicBuffer->getNativeBuffer(),
+ // eglImgAttrs);
+
+ pthread_mutex_lock(&p->free_mutex);
+ std::list<std::pair<EGLImageKHR, int> >::iterator it = p->free_queue.begin();
+ int cur_slot = it->second;
+ pthread_mutex_unlock(&p->free_mutex);
+ p->fbo.BindToTexture(GL_TEXTURE_2D, p->slots[cur_slot].texid);
+ p->fbo.BeginRender();
+
+ glDisable(GL_DEPTH_TEST);
+ //glClear(GL_COLOR_BUFFER_BIT);
+
+ const GLfloat triangleVertices[] = {
+ -1.0f, 1.0f,
+ -1.0f, -1.0f,
+ 1.0f, -1.0f,
+ 1.0f, 1.0f,
+ };
+
+ glVertexAttribPointer(p->mPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, triangleVertices);
+ glEnableVertexAttribArray(p->mPositionHandle);
+
+ glUseProgram(p->mPgm);
+ glUniform1i(p->mTexSamplerHandle, 0);
+
+ // glGenTextures(1, &texid);
+ // glBindTexture(GL_TEXTURE_EXTERNAL_OES, texid);
+ // glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, img);
+
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, g_xbmcapp.GetAndroidTexture());
+
+ GLfloat texMatrix[16];
+ // const GLfloat texMatrix[] = {
+ // 1, 0, 0, 0,
+ // 0, -1, 0, 0,
+ // 0, 0, 1, 0,
+ // 0, 1, 0, 1
+ // };
+ g_xbmcapp.GetStagefrightTransformMatrix(texMatrix);
+ // g_xbmcapp.GetSurfaceTexture()->getTransformMatrix(texMatrix);
+ glUniformMatrix4fv(p->mTexMatrixHandle, 1, GL_FALSE, texMatrix);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
+ // glDeleteTextures(1, &texid);
+ // eglDestroyImageKHR(p->eglDisplay, img);
+ p->fbo.EndRender();
+
+ glBindTexture(GL_TEXTURE_2D, 0);
+
+ frame->eglimg = p->slots[cur_slot].eglimg;
+ }
}
- #if defined(DEBUG_VERBOSE)
+ #if defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "%s: >>> pushed OUT frame; w:%d, h:%d, dw:%d, dh:%d, kf:%d, ur:%d, tm:%d\n", CLASSNAME, w, h, dw, dh, keyframe, unreadable, XbmcThreads::SystemClockMillis() - time);
- #endif
+ #endif
pthread_mutex_lock(&p->out_mutex);
p->cur_frame = frame;
@@ -583,6 +690,10 @@ class CStageFrightDecodeThread : public CThread
pthread_mutex_unlock(&p->out_mutex);
}
while (!decode_done && !m_bStop);
+
+ if (p->eglInitialized)
+ p->UninitializeEGL();
+
}
};
@@ -644,12 +755,12 @@ class CustomSource : public MediaSource
return VC_ERROR;
}
- frame = *p->in_queue.begin();
+ std::map<int64_t,Frame*>::iterator it = p->in_queue.begin();
+ frame = it->second;
ret = frame->status;
*buffer = frame->medbuf;
- p->in_queue.erase(p->in_queue.begin());
- p->mTimeSize -= frame->duration;
+ p->in_queue.erase(it);
pthread_mutex_unlock(&p->in_mutex);
#if defined(DEBUG_VERBOSE)
@@ -700,22 +811,34 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
switch (hints.codec)
{
case CODEC_ID_H264:
+ if (g_advancedSettings.m_stagefrightConfig.useAVCcodec == 0)
+ return false;
mimetype = MEDIA_MIMETYPE_VIDEO_AVC;
if ( *(char*)hints.extradata == 1 )
p->meta->setData(kKeyAVCC, kTypeAVCC, hints.extradata, hints.extrasize);
break;
- // FIXME : Inconsistent on tegra3. Disable for now
- // case CODEC_ID_MPEG4:
- // mimetype = MEDIA_MIMETYPE_VIDEO_MPEG4;
- // break;
+ case CODEC_ID_MPEG4:
+ if (g_advancedSettings.m_stagefrightConfig.useMP4codec == 0)
+ return false;
+ mimetype = MEDIA_MIMETYPE_VIDEO_MPEG4;
+ break;
+ case CODEC_ID_MPEG2VIDEO:
+ if (g_advancedSettings.m_stagefrightConfig.useMPEG2codec == 0)
+ return false;
+ mimetype = MEDIA_MIMETYPE_VIDEO_MPEG2;
+ break;
case CODEC_ID_VP3:
case CODEC_ID_VP6:
case CODEC_ID_VP6F:
case CODEC_ID_VP8:
+ if (g_advancedSettings.m_stagefrightConfig.useVPXcodec == 0)
+ return false;
mimetype = MEDIA_MIMETYPE_VIDEO_VPX;
break;
case CODEC_ID_VC1:
case CODEC_ID_WMV3:
+ if (g_advancedSettings.m_stagefrightConfig.useVC1codec == 0)
+ return false;
mimetype = MEDIA_MIMETYPE_VIDEO_WMV;
break;
default:
@@ -739,37 +862,69 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
if (p->client->connect() != OK)
{
+ delete p->client;
+ p->client = NULL;
CLog::Log(LOGERROR, "%s::%s - %s\n", CLASSNAME, __func__,"Cannot connect OMX client");
goto fail;
}
- g_xbmcapp.InitStagefrightSurface();
+ p->natwin = NULL;
+ if (!g_advancedSettings.m_stagefrightConfig.useSwRenderer)
+ {
+ g_xbmcapp.InitStagefrightSurface();
+ p->natwin = g_xbmcapp.GetAndroidVideoWindow();
+ native_window_api_connect(p->natwin.get(), NATIVE_WINDOW_API_MEDIA);
+
+ if (!eglCreateImageKHR)
+ GETEXTENSION(PFNEGLCREATEIMAGEKHRPROC, eglCreateImageKHR);
+ if (!eglDestroyImageKHR)
+ GETEXTENSION(PFNEGLDESTROYIMAGEKHRPROC, eglDestroyImageKHR);
+ if (!glEGLImageTargetTexture2DOES)
+ GETEXTENSION(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC, glEGLImageTargetTexture2DOES);
+ }
- p->natwin = g_xbmcapp.GetAndroidVideoWindow();
p->decoder = OMXCodec::Create(p->client->interface(), p->meta,
false, p->source, NULL,
- OMXCodec::kHardwareCodecsOnly | OMXCodec::kClientNeedsFramebuffer,
- p->natwin);
+ OMXCodec::kHardwareCodecsOnly | (g_advancedSettings.m_stagefrightConfig.useSwRenderer ? OMXCodec::kClientNeedsFramebuffer : 0),
+ p->natwin
+ );
if (!(p->decoder != NULL && p->decoder->start() == OK))
{
- p->client->disconnect();
+ p->decoder = NULL;
goto fail;
}
outFormat = p->decoder->getFormat();
+
if (!outFormat->findInt32(kKeyWidth, &p->width) || !outFormat->findInt32(kKeyHeight, &p->height)
|| !outFormat->findInt32(kKeyColorFormat, &p->videoColorFormat))
- {
- p->client->disconnect();
goto fail;
- }
- if (!outFormat->findInt32(kKeyStride, &p->videoStride))
- p->videoStride = p->width;
- if (!outFormat->findInt32(kKeySliceHeight, &p->videoSliceHeight))
- p->videoSliceHeight = p->height;
+ const char *component;
+ if (outFormat->findCString(kKeyDecoderComponent, &component))
+ {
+ CLog::Log(LOGDEBUG, "%s::%s - component: %s\n", CLASSNAME, __func__, component);
+
+ //Blacklist
+ if (!strncmp(component, "OMX.Nvidia.mp4.decode", 21) && g_advancedSettings.m_stagefrightConfig.useMP4codec != 1)
+ {
+ // Has issues with some XVID encoded MP4. Only fails after actual decoding starts...
+ goto fail;
+
+ }
+ else if (!strncmp(component, "OMX.rk.", 7) && g_advancedSettings.m_stagefrightConfig.useAVCcodec != 1)
+ {
+ if (p->height % 16 != 0)
+ {
+ // Buggy. Hard crash on non MOD16 height videos
+ goto fail;
+
+ }
+ }
+ }
+ cropLeft = cropTop = cropRight = cropBottom = 0;
if (!outFormat->findRect(kKeyCropRect, &cropLeft, &cropTop, &cropRight, &cropBottom))
{
p->x = 0;
@@ -783,16 +938,17 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
p->height = cropBottom - cropTop + 1;
}
+ if (!outFormat->findInt32(kKeyStride, &p->videoStride))
+ p->videoStride = p->width;
+ if (!outFormat->findInt32(kKeySliceHeight, &p->videoSliceHeight))
+ p->videoSliceHeight = p->height;
+
for (int i=0; i<INBUFCOUNT; ++i)
{
- p->inbuf[i] = new MediaBuffer((p->width * p->height) *3 /2);
+ p->inbuf[i] = new MediaBuffer(300000);
p->inbuf[i]->setObserver(p);
}
- const char *component;
- if (outFormat->findCString(kKeyDecoderComponent, &component))
- CLog::Log(LOGDEBUG, "%s::%s - component: %s\n", CLASSNAME, __func__, component);
-
pthread_mutex_init(&p->in_mutex, NULL);
pthread_cond_init(&p->in_condition, NULL);
pthread_mutex_init(&p->out_mutex, NULL);
@@ -802,26 +958,24 @@ bool CStageFrightVideo::Open(CDVDStreamInfo &hints)
p->decode_thread = new CStageFrightDecodeThread(p);
p->decode_thread->Create(true /*autodelete*/);
- p->client->disconnect();
-
- if (!eglCreateImageKHR)
- {
- GETEXTENSION(PFNEGLCREATEIMAGEKHRPROC, eglCreateImageKHR);
- }
- if (!eglDestroyImageKHR)
- {
- GETEXTENSION(PFNEGLDESTROYIMAGEKHRPROC, eglDestroyImageKHR);
- }
- if (!glEGLImageTargetTexture2DOES)
- {
- GETEXTENSION(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC, glEGLImageTargetTexture2DOES);
- }
+#if defined(DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, ">>> format col:%d, w:%d, h:%d, sw:%d, sh:%d, ctl:%d,%d; cbr:%d,%d\n", p->videoColorFormat, p->width, p->height, p->videoStride, p->videoSliceHeight, cropTop, cropLeft, cropBottom, cropRight);
+#endif
return true;
fail:
+ if (p->decoder != 0)
+ p->decoder->stop();
if (p->client)
+ {
+ p->client->disconnect();
delete p->client;
+ }
+ if (p->decoder_component)
+ free(&p->decoder_component);
+ if (!g_advancedSettings.m_stagefrightConfig.useSwRenderer)
+ g_xbmcapp.UninitStagefrightSurface();
return false;
}
@@ -844,9 +998,10 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
return VC_ERROR;
frame->status = OK;
- //frame->pts = (dts != DVD_NOPTS_VALUE) ? pts_dtoi(dts) : ((pts != DVD_NOPTS_VALUE) ? pts_dtoi(pts) : 0);
- frame->pts = (pts != DVD_NOPTS_VALUE) ? pts_dtoi(pts) : ((dts != DVD_NOPTS_VALUE) ? pts_dtoi(dts) : 0);
- frame->duration = 0;
+ if (g_advancedSettings.m_stagefrightConfig.useInputDTS)
+ frame->pts = (dts != DVD_NOPTS_VALUE) ? pts_dtoi(dts) : ((pts != DVD_NOPTS_VALUE) ? pts_dtoi(pts) : 0);
+ else
+ frame->pts = (pts != DVD_NOPTS_VALUE) ? pts_dtoi(pts) : ((dts != DVD_NOPTS_VALUE) ? pts_dtoi(dts) : 0);
frame->medbuf = p->getBuffer(demuxer_bytes);
if (!frame->medbuf)
{
@@ -856,23 +1011,16 @@ int CStageFrightVideo::Decode(BYTE *pData, int iSize, double dts, double pts)
fast_memcpy(frame->medbuf->data(), demuxer_content, demuxer_bytes);
frame->medbuf->meta_data()->clear();
frame->medbuf->meta_data()->setInt64(kKeyTime, frame->pts);
-
- if (p->mPrevPts >= 0)
- {
- frame->duration = frame->pts - p->mPrevPts;
- p->mTimeSize += frame->duration;
- }
- if (frame->pts > 0)
- p->mPrevPts = frame->pts;
pthread_mutex_lock(&p->in_mutex);
- p->in_queue.push_back(frame);
+ p->framecount++;
+ p->in_queue.insert(std::pair<int64_t, Frame*>(p->framecount, frame));
pthread_cond_signal(&p->in_condition);
pthread_mutex_unlock(&p->in_mutex);
}
int ret = 0;
- if (p->inputBufferAvailable())
+ if (p->inputBufferAvailable() && p->in_queue.size() < INBUFCOUNT)
ret |= VC_BUFFER;
else
usleep(1000);
@@ -928,7 +1076,6 @@ bool CStageFrightVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture)
status = frame->status;
pDvdVideoPicture->format = frame->format;
- pDvdVideoPicture->pts = DVD_NOPTS_VALUE;
pDvdVideoPicture->dts = DVD_NOPTS_VALUE;
pDvdVideoPicture->pts = frame->pts;
pDvdVideoPicture->iWidth = frame->width;
@@ -954,112 +1101,49 @@ bool CStageFrightVideo::GetPicture(DVDVideoPicture* pDvdVideoPicture)
if (pDvdVideoPicture->format == RENDER_FMT_EGLIMG)
{
- if (!p->eglInitialized)
- {
- p->InitializeEGL(frame->width, frame->height);
- }
- else if (p->texwidth != frame->width || p->texheight != frame->height)
- {
- p->UninitializeEGL();
- p->InitializeEGL(frame->width, frame->height);
- }
-
- if (p->free_queue.empty())
- {
- CLog::Log(LOGERROR, "%s::%s - Error: No free output buffers\n", CLASSNAME, __func__);
- if (frame->medbuf) {
- frame->medbuf->release();
- }
- free(frame);
- p->cur_frame = NULL;
- pthread_cond_signal(&p->out_condition);
- pthread_mutex_unlock(&p->out_mutex);
- return false;
- }
-
- g_xbmcapp.UpdateStagefrightTexture();
-
- if (!p->drop_state)
- {
- pthread_mutex_lock(&p->free_mutex);
- std::list<std::pair<EGLImageKHR, int> >::iterator it = p->free_queue.begin();
- int cur_slot = it->second;
- pthread_mutex_unlock(&p->free_mutex);
- p->fbo.BindToTexture(GL_TEXTURE_2D, p->slots[cur_slot].texid);
- p->fbo.BeginRender();
-
- glDisable(GL_DEPTH_TEST);
- //glClear(GL_COLOR_BUFFER_BIT);
-
- const GLfloat triangleVertices[] = {
- -1.0f, 1.0f,
- -1.0f, -1.0f,
- 1.0f, -1.0f,
- 1.0f, 1.0f,
- };
-
- glVertexAttribPointer(p->mPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, triangleVertices);
- glEnableVertexAttribArray(p->mPositionHandle);
-
- glUseProgram(p->mPgm);
- glUniform1i(p->mTexSamplerHandle, 0);
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, g_xbmcapp.GetAndroidTexture());
-
- GLfloat texMatrix[16];
- g_xbmcapp.GetStagefrightTransformMatrix(texMatrix);
- glUniformMatrix4fv(p->mTexMatrixHandle, 1, GL_FALSE, texMatrix);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
-
- p->fbo.EndRender();
-
- pDvdVideoPicture->eglimg = p->slots[cur_slot].eglimg;
- glBindTexture(GL_TEXTURE_2D, 0);
-
- #if defined(DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, ">>> pic dts:%f, pts:%llu, img:%p, tm:%d\n", pDvdVideoPicture->dts, frame->pts, pDvdVideoPicture->eglimg, XbmcThreads::SystemClockMillis() - time);
- #endif
- }
- } else if (pDvdVideoPicture->format == RENDER_FMT_YUV420P)
+ pDvdVideoPicture->eglimg = frame->eglimg;
+ #if defined(DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, ">>> pic dts:%f, pts:%llu, img:%p, tm:%d\n", pDvdVideoPicture->dts, frame->pts, pDvdVideoPicture->eglimg, XbmcThreads::SystemClockMillis() - time);
+ #endif
+ }
+ else if (pDvdVideoPicture->format == RENDER_FMT_YUV420P)
{
pDvdVideoPicture->color_range = 0;
pDvdVideoPicture->color_matrix = 4;
- //unsigned int luma_pixels = frame->width * frame->height;
- //unsigned int chroma_pixels = luma_pixels/4;
+ unsigned int luma_pixels = frame->width * frame->height;
+ unsigned int chroma_pixels = luma_pixels/4;
BYTE* data = NULL;
if (frame->medbuf && !p->drop_state)
data = (BYTE*)((long)frame->medbuf->data() + frame->medbuf->range_offset());
switch (p->videoColorFormat)
{
case OMX_COLOR_FormatYUV420Planar:
- pDvdVideoPicture->iLineSize[0] = p->videoStride;
- pDvdVideoPicture->iLineSize[1] = p->videoStride / 2;
- pDvdVideoPicture->iLineSize[2] = p->videoStride / 2;
+ 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] + (p->videoStride * p->videoSliceHeight);
- pDvdVideoPicture->data[2] = pDvdVideoPicture->data[1] + (p->videoStride/2 * p->videoSliceHeight/2);
+ pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + luma_pixels;
+ pDvdVideoPicture->data[2] = pDvdVideoPicture->data[1] + chroma_pixels;
pDvdVideoPicture->data[3] = 0;
break;
case OMX_COLOR_FormatYUV420SemiPlanar:
case OMX_QCOM_COLOR_FormatYVU420SemiPlanar:
- pDvdVideoPicture->iLineSize[0] = p->videoStride;
- pDvdVideoPicture->iLineSize[1] = p->videoStride;
+ pDvdVideoPicture->iLineSize[0] = frame->width;
+ pDvdVideoPicture->iLineSize[1] = frame->width;
pDvdVideoPicture->iLineSize[2] = 0;
pDvdVideoPicture->iLineSize[3] = 0;
pDvdVideoPicture->data[0] = data;
- pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + (p->videoStride * p->videoSliceHeight);
- pDvdVideoPicture->data[2] = 0;
+ pDvdVideoPicture->data[1] = pDvdVideoPicture->data[0] + luma_pixels;
+ pDvdVideoPicture->data[2] = pDvdVideoPicture->data[1] + chroma_pixels;
pDvdVideoPicture->data[3] = 0;
break;
default:
CLog::Log(LOGERROR, "%s::%s - Unsupported color format(%d)\n", CLASSNAME, __func__,p->videoColorFormat);
}
#if defined(DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, ">>> pic pts:%f, data:%p, col:%d, w:%d, h:%d, tm:%d\n", pDvdVideoPicture->pts, data, p->videoColorFormat, p->videoStride, p->videoSliceHeight, XbmcThreads::SystemClockMillis() - time);
+ CLog::Log(LOGDEBUG, ">>> pic pts:%f, data:%p, col:%d, w:%d, h:%d, tm:%d\n", pDvdVideoPicture->pts, data, p->videoColorFormat, frame->width, frame->height, XbmcThreads::SystemClockMillis() - time);
#endif
}
@@ -1121,10 +1205,12 @@ void CStageFrightVideo::Close()
#if defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "Cleaning IN(%d)\n", p->in_queue.size());
#endif
+ std::map<int64_t,Frame*>::iterator it;
while (!p->in_queue.empty())
{
- frame = *p->in_queue.begin();
- p->in_queue.erase(p->in_queue.begin());
+ it = p->in_queue.begin();
+ frame = it->second;
+ p->in_queue.erase(it);
if (frame->medbuf)
frame->medbuf->release();
free(frame);
@@ -1135,8 +1221,8 @@ void CStageFrightVideo::Close()
delete p->client;
- g_xbmcapp.UninitStagefrightSurface();
- p->UninitializeEGL();
+ if (!g_advancedSettings.m_stagefrightConfig.useSwRenderer)
+ g_xbmcapp.UninitStagefrightSurface();
pthread_mutex_destroy(&p->in_mutex);
pthread_cond_destroy(&p->in_condition);
@@ -1160,18 +1246,19 @@ void CStageFrightVideo::Reset(void)
#endif
Frame* frame;
pthread_mutex_lock(&p->in_mutex);
+ std::map<int64_t,Frame*>::iterator it;
while (!p->in_queue.empty())
{
- frame = *p->in_queue.begin();
- p->in_queue.erase(p->in_queue.begin());
+ it = p->in_queue.begin();
+ frame = it->second;
+ p->in_queue.erase(it);
if (frame->medbuf)
frame->medbuf->release();
free(frame);
}
- p->mDataSize = 0;
- p->mTimeSize = 0;
- p->mPrevPts = -1;
p->resetting = true;
+ p->framecount = 0;
+
pthread_mutex_unlock(&p->in_mutex);
}
@@ -1191,22 +1278,6 @@ void CStageFrightVideo::SetSpeed(int iSpeed)
{
}
-int CStageFrightVideo::GetDataSize(void)
-{
-#if defined(DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, "%s::GetDataSize (%d)\n", CLASSNAME,p->mDataSize);
-#endif
- return p->mDataSize;
-}
-
-double CStageFrightVideo::GetTimeSize(void)
-{
-#if defined(DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, "%s::GetTimeSize (%llu)\n", CLASSNAME,p->mTimeSize);
-#endif
- return pts_itod(p->mTimeSize);
-}
-
/***************/
void CStageFrightVideo::LockBuffer(EGLImageKHR eglimg)
View
2 xbmc/cores/dvdplayer/DVDCodecs/Video/StageFrightVideo.h
@@ -42,8 +42,6 @@ class CStageFrightVideo
bool ClearPicture(DVDVideoPicture* pDvdVideoPicture);
void SetDropState(bool bDrop);
virtual void SetSpeed(int iSpeed);
- virtual int GetDataSize(void);
- virtual double GetTimeSize(void);
void LockBuffer(EGLImageKHR eglimg);
void ReleaseBuffer(EGLImageKHR eglimg);
View
20 xbmc/settings/AdvancedSettings.cpp
@@ -111,6 +111,14 @@ void CAdvancedSettings::Initialize()
m_DXVAForceProcessorRenderer = true;
m_DXVANoDeintProcForProgressive = false;
m_videoFpsDetect = 1;
+ m_stagefrightConfig.useAVCcodec = -1;
+ m_stagefrightConfig.useVC1codec = -1;
+ m_stagefrightConfig.useVPXcodec = -1;
+ m_stagefrightConfig.useMP4codec = -1;
+ m_stagefrightConfig.useMPEG2codec = -1;
+ m_stagefrightConfig.useSwRenderer = false;
+ m_stagefrightConfig.useInputDTS = false;
+
m_videoDefaultLatency = 0.0;
m_musicUseTimeSeeking = true;
@@ -497,6 +505,18 @@ void CAdvancedSettings::ParseSettingsFile(const CStdString &file)
XMLUtils::GetBoolean(pElement, "disablebackgrounddeinterlace", m_videoDisableBackgroundDeinterlace);
XMLUtils::GetInt(pElement, "useocclusionquery", m_videoCaptureUseOcclusionQuery, -1, 1);
+ TiXmlElement* pStagefrightElem = pElement->FirstChildElement("stagefright");
+ if (pStagefrightElem)
+ {
+ XMLUtils::GetInt(pStagefrightElem,"useavccodec",m_stagefrightConfig.useAVCcodec, -1, 1);
+ XMLUtils::GetInt(pStagefrightElem,"usevc1codec",m_stagefrightConfig.useVC1codec, -1, 1);
+ XMLUtils::GetInt(pStagefrightElem,"usevpxcodec",m_stagefrightConfig.useVPXcodec, -1, 1);
+ XMLUtils::GetInt(pStagefrightElem,"usemp4codec",m_stagefrightConfig.useMP4codec, -1, 1);
+ XMLUtils::GetInt(pStagefrightElem,"usempeg2codec",m_stagefrightConfig.useMPEG2codec, -1, 1);
+ XMLUtils::GetBoolean(pStagefrightElem,"useswrenderer",m_stagefrightConfig.useSwRenderer);
+ XMLUtils::GetBoolean(pStagefrightElem,"useinputdts",m_stagefrightConfig.useInputDTS);
+ }
+
TiXmlElement* pAdjustRefreshrate = pElement->FirstChildElement("adjustrefreshrate");
if (pAdjustRefreshrate)
{
View
12 xbmc/settings/AdvancedSettings.h
@@ -78,6 +78,17 @@ struct RefreshVideoLatency
float delay;
};
+struct StagefrightConfig
+{
+ int useAVCcodec;
+ int useVC1codec;
+ int useVPXcodec;
+ int useMP4codec;
+ int useMPEG2codec;
+ bool useSwRenderer;
+ bool useInputDTS;
+};
+
typedef std::vector<TVShowRegexp> SETTINGS_TVSHOWLIST;
class CAdvancedSettings
@@ -164,6 +175,7 @@ class CAdvancedSettings
bool m_DXVAForceProcessorRenderer;
bool m_DXVANoDeintProcForProgressive;
int m_videoFpsDetect;
+ StagefrightConfig m_stagefrightConfig;
CStdString m_videoDefaultPlayer;
CStdString m_videoDefaultDVDPlayer;

0 comments on commit 32e99c7

Please sign in to comment.