Guest - Testers are needed for the reworked CDateTime core component. See... https://forum.kodi.tv/showthread.php?tid=378981 (September 29) x
[WINDOWS] DirectX port development?
#1
is the conversion to directX completed yet? I'm in need of a DX surface to copy to Smile
Reply
#2
are you kidding? Stare
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply
#3
I think yuvalt just set up the branch so that interested developers could work towards a port.

I don't think much work has been done on it at all yet.

I'm sure this will make the use of DxVA much easier.

It sounded from your posts in the HW acceleration thread as if you had already figured out the secret to writing to a DX surface from the OpenGL build.

Is that not the case?

That's why rwparris is upset, I'm sure.
Reply
#4
no, before I was copying to an OpenGL texture, which fouled things up with the colors on controls, now I want to attempt to copy to a D3D surface, and see if the controls look more "normal", but alas, there are no D3D surfaces to be had.
Reply
#5
I have 3 inline decoders, ready to go. One is cuda based, and offers the most compatibility with file types(Mpeg2, Mpeg4, H.264, VC1). The next is DXVA based, and works best with VC1, and H.264 files, and the last is an inliner, for using multiple CPU's on dual and more core machines...

Dont get upset rwparris,
Code:
#include "VideoSource.h"

#include "FrameQueue.h"
#include "VideoParser.h"

#include <assert.h>

VideoSource::VideoSource(const std::string sFileName, FrameQueue * pFrameQueue): hVideoSource_(0)
{
            // fill in SourceData struct as much as we can
            // right now. Client must specify parser at a later point
            // to avoid crashes (see setParser() method).
    assert(0 != pFrameQueue);
    oSourceData_.hVideoParser = 0;
    oSourceData_.pFrameQueue = pFrameQueue;
    
    CUVIDSOURCEPARAMS oVideoSourceParameters;
            // Fill parameter struct
    memset(&oVideoSourceParameters, 0, sizeof(CUVIDSOURCEPARAMS));
    oVideoSourceParameters.pUserData = &oSourceData_;               // will be passed to data handlers
    oVideoSourceParameters.pfnVideoDataHandler = HandleVideoData;   // our local video-handler callback
    oVideoSourceParameters.pfnAudioDataHandler = 0;
            // now create the actual source
    CUresult oResult = cuvidCreateVideoSource(&hVideoSource_, sFileName.c_str(), &oVideoSourceParameters);
    assert(CUDA_SUCCESS == oResult);
}
    
VideoSource::~VideoSource()
{
    cuvidDestroyVideoSource(hVideoSource_);
}

void
VideoSource::ReloadVideo(const std::string sFileName, FrameQueue * pFrameQueue, VideoParser *pVideoParser)
{
            // fill in SourceData struct as much as we can right now. Client must specify parser at a later point
    assert(0 != pFrameQueue);
    oSourceData_.hVideoParser = pVideoParser->hParser_;
    oSourceData_.pFrameQueue  = pFrameQueue;

    cuvidDestroyVideoSource(hVideoSource_);

    CUVIDSOURCEPARAMS oVideoSourceParameters;
            // Fill parameter struct
    memset(&oVideoSourceParameters, 0, sizeof(CUVIDSOURCEPARAMS));
    oVideoSourceParameters.pUserData = &oSourceData_;               // will be passed to data handlers
    oVideoSourceParameters.pfnVideoDataHandler = HandleVideoData;   // our local video-handler callback
    oVideoSourceParameters.pfnAudioDataHandler = 0;
            // now create the actual source
    CUresult oResult = cuvidCreateVideoSource(&hVideoSource_, sFileName.c_str(), &oVideoSourceParameters);
    assert(CUDA_SUCCESS == oResult);
}


CUVIDEOFORMAT
VideoSource::format()
const
{
    CUVIDEOFORMAT oFormat;
    CUresult oResult = cuvidGetSourceVideoFormat(hVideoSource_, &oFormat, 0);
    assert(CUDA_SUCCESS == oResult);
    
    return oFormat;
}

void
VideoSource::getDimensions(unsigned int &width, unsigned int &height)
{
    CUVIDEOFORMAT rCudaVideoFormat=  format();

    width  = rCudaVideoFormat.coded_width;
    height = rCudaVideoFormat.coded_height;
}


void
VideoSource::setParser(VideoParser & rVideoParser)
{
    oSourceData_.hVideoParser = rVideoParser.hParser_;
}

void
VideoSource::start()
{
    CUresult oResult = cuvidSetVideoSourceState(hVideoSource_, cudaVideoState_Started);
    assert(CUDA_SUCCESS == oResult);
}

void
VideoSource::stop()
{
    CUresult oResult = cuvidSetVideoSourceState(hVideoSource_, cudaVideoState_Stopped);
    assert(CUDA_SUCCESS == oResult);
}

bool
VideoSource::isStarted()
{
    return (cuvidGetVideoSourceState(hVideoSource_) == cudaVideoState_Started);
}

int
VideoSource::HandleVideoData(void * pUserData, CUVIDSOURCEDATAPACKET * pPacket)
{
    VideoSourceData * pVideoSourceData = (VideoSourceData *)pUserData;
            // Parser calls back for decode & display within cuvidParseVideoData
    CUresult oResult = cuvidParseVideoData(pVideoSourceData->hVideoParser, pPacket);
    if ((pPacket->flags & CUVID_PKT_ENDOFSTREAM) || (oResult != CUDA_SUCCESS))
        pVideoSourceData->pFrameQueue->endDecode();
    
    return !pVideoSourceData->pFrameQueue->isEndOfDecode();
}

std::ostream &
operator << (std::ostream & rOutputStream, const CUVIDEOFORMAT & rCudaVideoFormat)
{
    rOutputStream << "VideoCodec: ";
    switch (rCudaVideoFormat.codec)
    {
        case cudaVideoCodec_MPEG1:
            rOutputStream << "MPEG 1\n";
        break;
        case cudaVideoCodec_MPEG2:
            rOutputStream << "MPEG 2\n";
        break;
        case cudaVideoCodec_MPEG4:
            rOutputStream << "MPEG 4\n";
        break;
        case cudaVideoCodec_VC1:
            rOutputStream << "VC 1\n";
        break;
        case cudaVideoCodec_H264:
            rOutputStream << "H.264\n";
        break;
        default:
            rOutputStream << "unknown\n";
    }
    rOutputStream << "Frame rate: " << rCudaVideoFormat.frame_rate.numerator << "/" << rCudaVideoFormat.frame_rate.denominator;
    rOutputStream << "fps ~ " << rCudaVideoFormat.frame_rate.numerator/static_cast<float>(rCudaVideoFormat.frame_rate.denominator) << "fps\n";
    rOutputStream << "Sequence format: ";
    if (rCudaVideoFormat.progressive_sequence)
        rOutputStream << "Progressive\n";
    else
        rOutputStream << "Interlaced\n";
    rOutputStream << "Coded frame size: [" << rCudaVideoFormat.coded_width << ", " << rCudaVideoFormat.coded_height << "]\n";
    rOutputStream << "Display area: [" << rCudaVideoFormat.display_area.left << ", " << rCudaVideoFormat.display_area.top;
    rOutputStream << ", " << rCudaVideoFormat.display_area.right << ", " << rCudaVideoFormat.display_area.bottom << "]\n";
    rOutputStream << "Chroma format: ";
    switch (rCudaVideoFormat.chroma_format)
    {
        case cudaVideoChromaFormat_Monochrome:
            rOutputStream << "Monochrome\n";
        break;
        case cudaVideoChromaFormat_420:
            rOutputStream << "4:2:0\n";
        break;
        case cudaVideoChromaFormat_422:
            rOutputStream << "4:2:2\n";
        break;
        case cudaVideoChromaFormat_444:
            rOutputStream << "4:4:4\n";
        break;
        default:
            rOutputStream << "unknown\n";
    }
    rOutputStream << "Bitrate: ";
    if (rCudaVideoFormat.bitrate == 0)
        rOutputStream << "unknown\n";
    else
        rOutputStream << rCudaVideoFormat.bitrate/1024 << "kBit/s\n";
    rOutputStream << "Aspect ratio: " << rCudaVideoFormat.display_aspect_ratio.x << ":" << rCudaVideoFormat.display_aspect_ratio.y << "\n";

    return rOutputStream;
}

came with the cuda examples... and with a few line changes, does exactly what me say for above cuda type.
Reply
#6
BrokenCodes,

Do you have the skillz/time to help with the DX port?

I believe the GUI is already ported (from JMarshall's work a few years back), we just need someone to work on porting the renderers to DX.

Alas, I have no idea how much work is involved in this. I imagine it's a lot, or it'd be done already.

-Wes
Reply
#7
is a simple blit / flip / or copy... same as sdl...
Reply
#8
Erm, we don't use SDL to render. How far under the hood have you been again?
Reply
#9
*** YAWN *** no sleep... I meant OpenGL...
Reply
#10
and the renderer is there aswell... just need some cleanup.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#11
as far back as which revision?
Reply
#12
initial branch for linuxport I'd imagine. Xbox tree had a win32 build option for skinning/scripting/etc.
Reply
#13
Trunk runs on win32 under directx, so linuxport is likely to as well, though I'm sure some of the directx code has been removed in some places (eg the screen setup stuff at the beginning of CApplication::Create())

Getting the UI side of it going should be a weekend's work, tops.

Getting it well abstracted so that you don't have a shitload (more) ifdefs than we do already will take longer, but is certainly required long-term.

Getting video playback going shouldn't take too long - there's a renderer for it sitting there ready to go - the API has likely changed a little, however.

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#14
@BrokenCodes, see => http://forum.xbmc.org/showthread.php?tid=23235

This is in the SVN trunk so checkout:
https://xbmc.svn.sourceforge.net/svnroot...trunk/XBMC

Wink
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#15
FYI, some progress is currently being made in the SVN:

http://trac.xbmc.org/timeline
Quote:Revision: 21540
http://xbmc.svn.sourceforge.net/xbmc/?re...0&view=rev
Author: jmarshallnz
Date: 2009-07-10 02:39:06 +0000 (Fri, 10 Jul 2009)

Log Message:
-----------
added: Projects for building a DirectX 9 version of XBMC, and an (extremely) basic window init routine.

Modified Paths:
--------------
branches/linuxport/XBMC/project/VS2008Express/UnrarXLib.vcproj
branches/linuxport/XBMC/project/VS2008Express/XBMC for Windows.sln
branches/linuxport/XBMC/project/VS2008Express/XBMC.vcproj
branches/linuxport/XBMC/project/VS2008Express/guilib.vcproj
branches/linuxport/XBMC/xbmc/win32/XBMC_PC.cpp
Quote: Revision: 21536
http://xbmc.svn.sourceforge.net/xbmc/?re...6&view=rev
Author: jmarshallnz
Date: 2009-07-10 00:52:04 +0000 (Fri, 10 Jul 2009)

Log Message:
-----------
changed: Moved DirectX code to DirectX 9.

Modified Paths:
--------------
branches/linuxport/XBMC/guilib/DirectXGraphics.cpp
branches/linuxport/XBMC/guilib/DirectXGraphics.h
branches/linuxport/XBMC/guilib/GUIFontTTF.cpp
branches/linuxport/XBMC/guilib/GUIFontTTF.h
branches/linuxport/XBMC/guilib/GUITextureD3D.cpp
branches/linuxport/XBMC/guilib/GraphicContext.cpp
branches/linuxport/XBMC/guilib/GraphicContext.h
branches/linuxport/XBMC/guilib/TextureManager.cpp
branches/linuxport/XBMC/guilib/gui3d.h
branches/linuxport/XBMC/xbmc/Application.cpp
branches/linuxport/XBMC/xbmc/ApplicationRenderer.cpp
branches/linuxport/XBMC/xbmc/ApplicationRenderer.h
branches/linuxport/XBMC/xbmc/GUIDialogVideoBookmarks.cpp
branches/linuxport/XBMC/xbmc/Picture.cpp
branches/linuxport/XBMC/xbmc/SlideShowPicture.cpp
branches/linuxport/XBMC/xbmc/Util.cpp
branches/linuxport/XBMC/xbmc/XBApplicationEx.cpp
branches/linuxport/XBMC/xbmc/XBApplicationEx.h
branches/linuxport/XBMC/xbmc/XBVideoConfig.cpp
branches/linuxport/XBMC/xbmc/XBVideoConfig.h
branches/linuxport/XBMC/xbmc/cores/DummyVideoPlayer.cpp
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/RenderManager.cpp
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/WinRenderManager.cpp
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/WinRenderer.cpp
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/WinRenderer.h
branches/linuxport/XBMC/xbmc/karaoke/karaokelyricscdg.cpp
branches/linuxport/XBMC/xbmc/karaoke/karaokelyricscdg.h
branches/linuxport/XBMC/xbmc/screensavers/DllScreenSaver.h
branches/linuxport/XBMC/xbmc/utils/Splash.cpp
Quote:Revision: 21531
http://xbmc.svn.sourceforge.net/xbmc/?re...1&view=rev
Author: jmarshallnz
Date: 2009-07-09 22:31:57 +0000 (Thu, 09 Jul 2009)

Log Message:
-----------
added: Add back the directx code for camera positioning.
changed: Guard access to m_screenSurface in a couple of spots.

Modified Paths:
--------------
branches/linuxport/XBMC/guilib/GraphicContext.cpp
Quote:Revision: 21525
http://xbmc.svn.sourceforge.net/xbmc/?re...5&view=rev
Author: jmarshallnz
Date: 2009-07-09 20:02:43 +0000 (Thu, 09 Jul 2009)

Log Message:
-----------
cleanup: Renderers were missing a few ifdef's.
changed: Bring the WinRenderer back in to the win32 build - not built under SDL/OpenGL.

Modified Paths:
--------------
branches/linuxport/XBMC/project/VS2008Express/XBMC.vcproj
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/RenderManager.cpp
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/RenderManager.h
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/WinRenderer.cpp
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/WinRenderer.h
branches/linuxport/XBMC/xbmc/cores/VideoRenderers/XBoxRenderer.h
Reply

Logout Mark Read Team Forum Stats Members Help
[WINDOWS] DirectX port development?1