зеркало из https://github.com/mozilla/pjs.git
Bug 584259 - Add support for StereoMode element. r=roc a=roc
This commit is contained in:
Родитель
12427715a2
Коммит
749af95755
|
@ -148,6 +148,7 @@ VideoData* VideoData::Create(nsVideoInfo& aInfo,
|
|||
data.mPicX = aInfo.mPicture.x;
|
||||
data.mPicY = aInfo.mPicture.y;
|
||||
data.mPicSize = gfxIntSize(aInfo.mPicture.width, aInfo.mPicture.height);
|
||||
data.mStereoMode = aInfo.mStereoMode;
|
||||
|
||||
videoImage->SetData(data); // Copies buffer
|
||||
return v.forget();
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
mAudioRate(0),
|
||||
mAudioChannels(0),
|
||||
mFrame(0,0),
|
||||
mStereoMode(mozilla::layers::STEREO_MODE_MONO),
|
||||
mHasAudio(PR_FALSE),
|
||||
mHasVideo(PR_FALSE)
|
||||
{}
|
||||
|
@ -82,6 +83,9 @@ public:
|
|||
// Used to seek to the start of the media.
|
||||
PRInt64 mDataOffset;
|
||||
|
||||
// Indicates the frame layout for single track stereo videos.
|
||||
mozilla::layers::StereoMode mStereoMode;
|
||||
|
||||
// PR_TRUE if we have an active audio bitstream.
|
||||
PRPackedBool mHasAudio;
|
||||
|
||||
|
|
|
@ -43,8 +43,11 @@
|
|||
#include "nsWebMReader.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "nsTimeRanges.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
// Un-comment to enable logging of seek bisections.
|
||||
//#define SEEK_LOGGING
|
||||
|
@ -268,6 +271,45 @@ nsresult nsWebMReader::ReadMetadata()
|
|||
mInfo.mPicture.height = params.height;
|
||||
}
|
||||
|
||||
switch (params.stereo_mode) {
|
||||
case NESTEGG_VIDEO_MONO:
|
||||
mInfo.mStereoMode = STEREO_MODE_MONO;
|
||||
break;
|
||||
case NESTEGG_VIDEO_STEREO_LEFT_RIGHT:
|
||||
mInfo.mStereoMode = STEREO_MODE_LEFT_RIGHT;
|
||||
break;
|
||||
case NESTEGG_VIDEO_STEREO_BOTTOM_TOP:
|
||||
mInfo.mStereoMode = STEREO_MODE_BOTTOM_TOP;
|
||||
break;
|
||||
case NESTEGG_VIDEO_STEREO_TOP_BOTTOM:
|
||||
mInfo.mStereoMode = STEREO_MODE_TOP_BOTTOM;
|
||||
break;
|
||||
case NESTEGG_VIDEO_STEREO_RIGHT_LEFT:
|
||||
mInfo.mStereoMode = STEREO_MODE_RIGHT_LEFT;
|
||||
break;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
PRInt32 forceStereoMode;
|
||||
if (NS_SUCCEEDED(prefs->GetIntPref("media.webm.force_stereo_mode", &forceStereoMode))) {
|
||||
switch (forceStereoMode) {
|
||||
case 1:
|
||||
mInfo.mStereoMode = STEREO_MODE_LEFT_RIGHT;
|
||||
break;
|
||||
case 2:
|
||||
mInfo.mStereoMode = STEREO_MODE_RIGHT_LEFT;
|
||||
break;
|
||||
case 3:
|
||||
mInfo.mStereoMode = STEREO_MODE_TOP_BOTTOM;
|
||||
break;
|
||||
case 4:
|
||||
mInfo.mStereoMode = STEREO_MODE_BOTTOM_TOP;
|
||||
break;
|
||||
default:
|
||||
mInfo.mStereoMode = STEREO_MODE_MONO;
|
||||
}
|
||||
}
|
||||
|
||||
// mDataOffset is not used by the WebM backend.
|
||||
// See bug 566779 for a suggestion to refactor
|
||||
// and remove it.
|
||||
|
|
|
@ -46,6 +46,14 @@
|
|||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
enum StereoMode {
|
||||
STEREO_MODE_MONO,
|
||||
STEREO_MODE_LEFT_RIGHT,
|
||||
STEREO_MODE_RIGHT_LEFT,
|
||||
STEREO_MODE_BOTTOM_TOP,
|
||||
STEREO_MODE_TOP_BOTTOM
|
||||
};
|
||||
|
||||
/**
|
||||
* A class representing a buffer of pixel data. The data can be in one
|
||||
* of various formats including YCbCr.
|
||||
|
@ -277,6 +285,7 @@ public:
|
|||
PRUint32 mPicX;
|
||||
PRUint32 mPicY;
|
||||
gfxIntSize mPicSize;
|
||||
StereoMode mStereoMode;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -176,17 +176,35 @@ ImageLayerD3D9::RenderLayer()
|
|||
|
||||
mD3DManager->SetShaderMode(DeviceManagerD3D9::YCBCRLAYER);
|
||||
|
||||
/*
|
||||
* Send 3d control data and metadata
|
||||
*/
|
||||
if (mD3DManager->Is3DEnabled() && mD3DManager->GetNv3DVUtils()) {
|
||||
mD3DManager->GetNv3DVUtils()->SendNv3DVControl(STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE);
|
||||
if (yuvImage->mData.mStereoMode != STEREO_MODE_MONO) {
|
||||
Nv_Stereo_Mode mode;
|
||||
switch (yuvImage->mData.mStereoMode) {
|
||||
case STEREO_MODE_LEFT_RIGHT:
|
||||
mode = NV_STEREO_MODE_LEFT_RIGHT;
|
||||
break;
|
||||
case STEREO_MODE_RIGHT_LEFT:
|
||||
mode = NV_STEREO_MODE_RIGHT_LEFT;
|
||||
break;
|
||||
case STEREO_MODE_BOTTOM_TOP:
|
||||
mode = NV_STEREO_MODE_BOTTOM_TOP;
|
||||
break;
|
||||
case STEREO_MODE_TOP_BOTTOM:
|
||||
mode = NV_STEREO_MODE_TOP_BOTTOM;
|
||||
break;
|
||||
}
|
||||
|
||||
nsRefPtr<IDirect3DSurface9> renderTarget;
|
||||
device()->GetRenderTarget(0, getter_AddRefs(renderTarget));
|
||||
mD3DManager->GetNv3DVUtils()->SendNv3DVMetaData((unsigned int)yuvImage->mSize.width,
|
||||
(unsigned int)yuvImage->mSize.height, (HANDLE)(yuvImage->mYTexture), (HANDLE)(renderTarget));
|
||||
}
|
||||
/*
|
||||
* Send 3d control data and metadata
|
||||
*/
|
||||
if (mD3DManager->GetNv3DVUtils()) {
|
||||
mD3DManager->GetNv3DVUtils()->SendNv3DVControl(mode, true, FIREFOX_3DV_APP_HANDLE);
|
||||
|
||||
nsRefPtr<IDirect3DSurface9> renderTarget;
|
||||
device()->GetRenderTarget(0, getter_AddRefs(renderTarget));
|
||||
mD3DManager->GetNv3DVUtils()->SendNv3DVMetaData((unsigned int)yuvImage->mSize.width,
|
||||
(unsigned int)yuvImage->mSize.height, (HANDLE)(yuvImage->mYTexture), (HANDLE)(renderTarget));
|
||||
}
|
||||
}
|
||||
|
||||
device()->SetTexture(0, yuvImage->mYTexture);
|
||||
device()->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
|
||||
|
|
|
@ -42,8 +42,6 @@
|
|||
#include "ImageLayerD3D9.h"
|
||||
#include "ColorLayerD3D9.h"
|
||||
#include "CanvasLayerD3D9.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "gfxWindowsPlatform.h"
|
||||
#include "nsIGfxInfo.h"
|
||||
|
||||
|
@ -57,7 +55,6 @@ namespace layers {
|
|||
DeviceManagerD3D9 *LayerManagerD3D9::mDefaultDeviceManager = nsnull;
|
||||
|
||||
LayerManagerD3D9::LayerManagerD3D9(nsIWidget *aWidget)
|
||||
: mIs3DEnabled(PR_FALSE)
|
||||
{
|
||||
mWidget = aWidget;
|
||||
mCurrentCallbackInfo.Callback = NULL;
|
||||
|
@ -72,10 +69,6 @@ LayerManagerD3D9::~LayerManagerD3D9()
|
|||
PRBool
|
||||
LayerManagerD3D9::Initialize()
|
||||
{
|
||||
/* Check the user preference for whether 3d video is enabled or not */
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||
prefs->GetBoolPref("gfx.3d_video.enabled", &mIs3DEnabled);
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
PRInt32 status;
|
||||
|
|
|
@ -175,11 +175,6 @@ public:
|
|||
*/
|
||||
Nv3DVUtils *GetNv3DVUtils() { return mDeviceManager ? mDeviceManager->GetNv3DVUtils() : NULL; }
|
||||
|
||||
/**
|
||||
* Indicate whether 3D is enabled or not
|
||||
*/
|
||||
PRBool Is3DEnabled() { return mIs3DEnabled; }
|
||||
|
||||
static void OnDeviceManagerDestroy(DeviceManagerD3D9 *aDeviceManager) {
|
||||
if(aDeviceManager == mDefaultDeviceManager)
|
||||
mDefaultDeviceManager = nsnull;
|
||||
|
@ -212,9 +207,6 @@ private:
|
|||
/* Callback info for current transaction */
|
||||
CallbackInfo mCurrentCallbackInfo;
|
||||
|
||||
/* Flag that indicates whether 3D is enabled or not*/
|
||||
PRBool mIs3DEnabled;
|
||||
|
||||
/*
|
||||
* Region we're clipping our current drawing to.
|
||||
*/
|
||||
|
|
|
@ -133,7 +133,7 @@ Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown)
|
|||
if (!rv)
|
||||
return;
|
||||
|
||||
rv = m3DVStreaming->Nv3DVControl(STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE);
|
||||
rv = m3DVStreaming->Nv3DVControl(NV_STEREO_MODE_RIGHT_LEFT, true, FIREFOX_3DV_APP_HANDLE);
|
||||
NS_ASSERTION(rv, "Nv3DVStreaming Nv3DVControl failed!");
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown)
|
|||
* calls from ImageLayerD3D9 to the 3DV COM object
|
||||
*/
|
||||
void
|
||||
Nv3DVUtils::SendNv3DVControl(Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle)
|
||||
Nv3DVUtils::SendNv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle)
|
||||
{
|
||||
if (!m3DVStreaming)
|
||||
return;
|
||||
|
|
|
@ -47,13 +47,13 @@ namespace layers {
|
|||
|
||||
#define FIREFOX_3DV_APP_HANDLE 0xECB992B6
|
||||
|
||||
typedef enum _Stereo_Mode {
|
||||
STEREO_MODE_LEFT_RIGHT = 0,
|
||||
STEREO_MODE_RIGHT_LEFT = 1,
|
||||
STEREO_MODE_TOP_BOTTOM = 2,
|
||||
STEREO_MODE_BOTTOM_TOP = 3,
|
||||
STEREO_MODE_LAST = 4
|
||||
} Stereo_Mode;
|
||||
enum Nv_Stereo_Mode {
|
||||
NV_STEREO_MODE_LEFT_RIGHT = 0,
|
||||
NV_STEREO_MODE_RIGHT_LEFT = 1,
|
||||
NV_STEREO_MODE_TOP_BOTTOM = 2,
|
||||
NV_STEREO_MODE_BOTTOM_TOP = 3,
|
||||
NV_STEREO_MODE_LAST = 4
|
||||
};
|
||||
|
||||
class INv3DVStreaming : public IUnknown {
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
virtual bool Nv3DVInitialize() = 0;
|
||||
virtual bool Nv3DVRelease() = 0;
|
||||
virtual bool Nv3DVSetDevice(IUnknown* pDevice) = 0;
|
||||
virtual bool Nv3DVControl(Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle) = 0;
|
||||
virtual bool Nv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle) = 0;
|
||||
virtual bool Nv3DVMetaData(DWORD dwWidth, DWORD dwHeight, HANDLE hSrcLuma, HANDLE hDst) = 0;
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
|||
* Send Stereo Control Information. Used mainly to re-route
|
||||
* calls from ImageLayerD3D9 to the 3DV COM object
|
||||
*/
|
||||
void SendNv3DVControl(Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle);
|
||||
void SendNv3DVControl(Nv_Stereo_Mode eStereoMode, bool bEnableStereo, DWORD dw3DVAppHandle);
|
||||
|
||||
/*
|
||||
* Send Stereo Metadata. Used mainly to re-route calls
|
||||
|
|
|
@ -189,8 +189,6 @@ pref("gfx.color_management.mode", 2);
|
|||
pref("gfx.color_management.display_profile", "");
|
||||
pref("gfx.color_management.rendering_intent", 0);
|
||||
|
||||
pref("gfx.3d_video.enabled", false);
|
||||
|
||||
pref("gfx.downloadable_fonts.enabled", true);
|
||||
pref("gfx.downloadable_fonts.sanitize", true);
|
||||
#ifdef XP_MACOSX
|
||||
|
|
Загрузка…
Ссылка в новой задаче