Added empty gstreamer video implementation
This commit is contained in:
1 parent
94ee25cd49
commit
2be1c021ce
12 files changed
+405
-2
No files matched your search
@@ -164,6 +164,8 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GstreamerAudio.h" />
|
||||
<ClInclude Include="GstreamerAudioStream.h" />
|
||||
<ClInclude Include="GstreamerVideo.h" />
|
||||
<ClInclude Include="GstreamerVideoStream.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
@@ -184,6 +186,8 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="GstreamerAudio.cpp" />
|
||||
<ClCompile Include="GstreamerAudioStream.cpp" />
|
||||
<ClCompile Include="GstreamerVideo.cpp" />
|
||||
<ClCompile Include="GstreamerVideoStream.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugWin|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DebugWin|x64'">Create</PrecompiledHeader>
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
<ClInclude Include="GstreamerAudio.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GstreamerVideo.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GstreamerVideoStream.h">
|
||||
<Filter>Headerdateien</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
@@ -41,5 +47,11 @@
|
||||
<ClCompile Include="GstreamerAudio.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GstreamerVideo.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="GstreamerVideoStream.cpp">
|
||||
<Filter>Quelldateien</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,133 @@
|
||||
#include "stdafx.h"
|
||||
#include "GstreamerVideo.h"
|
||||
#include "GstreamerVideoStream.h"
|
||||
|
||||
map<int, GstreamerVideoStream*> VideoStreams;
|
||||
queue<int> VideoIDs;
|
||||
|
||||
DllExport void SetVideoLogCallback (LogCallback Callback)
|
||||
{
|
||||
Log = Callback;
|
||||
}
|
||||
|
||||
DllExport bool InitVideo()
|
||||
{
|
||||
for(int i = 0; i < 1000; i++)
|
||||
{
|
||||
VideoIDs.push(i);
|
||||
}
|
||||
#if _WIN64
|
||||
SetDllDirectory(L".\\x64\\gstreamer");
|
||||
#else
|
||||
SetDllDirectory(L".\\x86\gstreamer");
|
||||
#endif
|
||||
|
||||
gst_init(NULL, NULL);
|
||||
GstRegistry* registry = gst_registry_get();
|
||||
|
||||
#if _WIN64
|
||||
gst_registry_scan_path(registry, ".\\x64\\gstreamer");
|
||||
#else
|
||||
gst_registry_scan_path(registry, ".\\x86\\gstreamer");
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DllExport void CloseAllVideos(void)
|
||||
{
|
||||
map<int, GstreamerVideoStream*>::iterator p;
|
||||
|
||||
for(p = VideoStreams.begin(); p != VideoStreams.end(); p++) {
|
||||
p->second->CloseVideo();
|
||||
}
|
||||
}
|
||||
|
||||
DllExport int LoadVideo(const wchar_t* Media)
|
||||
{
|
||||
GstreamerVideoStream *s = new GstreamerVideoStream(VideoIDs.front());
|
||||
VideoStreams.insert(pair<int, GstreamerVideoStream*> (VideoIDs.front(), s));
|
||||
VideoIDs.pop();
|
||||
return s->LoadVideo(Media);
|
||||
}
|
||||
|
||||
DllExport bool CloseVideo(int Stream)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
return it->second->CloseVideo();
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
DllExport int GetVideoNumStreams()
|
||||
{
|
||||
return VideoStreams.size();
|
||||
}
|
||||
|
||||
DllExport float GetVideoLength(int Stream)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
return it->second->GetVideoLength();
|
||||
}
|
||||
else return -1.0;
|
||||
}
|
||||
|
||||
DllExport UINT8* GetFrame(int Stream, float Time, float &VideoTime)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
return it->second->GetFrame(Time, VideoTime);
|
||||
}
|
||||
}
|
||||
|
||||
DllExport bool Skip(int Stream, float Start, float Gap)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
return it->second->Skip(Start, Gap);
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
DllExport void SetVideoLoop(int Stream, bool Loop)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
it->second->SetVideoLoop(Loop);
|
||||
}
|
||||
}
|
||||
|
||||
DllExport void PauseVideo(int Stream)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
it->second->PauseVideo();
|
||||
}
|
||||
}
|
||||
|
||||
DllExport void ResumeVideo(int Stream)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
it->second->ResumeVideo();
|
||||
}
|
||||
}
|
||||
|
||||
DllExport bool Finished(int Stream)
|
||||
{
|
||||
map<int,GstreamerVideoStream*>::iterator it = VideoStreams.find(Stream);
|
||||
if(it != VideoStreams.end())
|
||||
{
|
||||
return it->second->Finished();
|
||||
}
|
||||
else return true;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include "gst/gst.h"
|
||||
#define DllExport extern "C" __declspec(dllexport)
|
||||
|
||||
using namespace std;
|
||||
|
||||
typedef void (__stdcall * LogCallback)(const char* text);
|
||||
static LogCallback Log;
|
||||
|
||||
DllExport void SetVideoLogCallback(LogCallback Callback);
|
||||
|
||||
DllExport bool InitVideo();
|
||||
DllExport void CloseAllVideos();
|
||||
|
||||
DllExport int LoadVideo(const wchar_t* Media);
|
||||
DllExport bool CloseVideo(int StreamID);
|
||||
DllExport int GetVideoNumStreams();
|
||||
|
||||
DllExport float GetVideoLength(int StreamID);
|
||||
DllExport UINT8* GetFrame(int StreamID, float Time, float &VideoTime);
|
||||
DllExport bool Skip(int StreamID, float Start, float Gap);
|
||||
DllExport void SetVideoLoop(int StreamID, bool Loop);
|
||||
DllExport void PauseVideo(int StreamID);
|
||||
DllExport void ResumeVideo(int StreamID);
|
||||
|
||||
DllExport bool Finished(int StreamID);
|
||||
|
||||
void LogVideoError(const char* msg);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#include "stdafx.h"
|
||||
#include "GstreamerVideoStream.h"
|
||||
|
||||
|
||||
GstreamerVideoStream::GstreamerVideoStream(int ID)
|
||||
{
|
||||
this->ID = ID;
|
||||
}
|
||||
|
||||
|
||||
GstreamerVideoStream::~GstreamerVideoStream(void)
|
||||
{
|
||||
}
|
||||
|
||||
int GstreamerVideoStream::LoadVideo(const wchar_t* Filename)
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
|
||||
bool GstreamerVideoStream::CloseVideo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
float GstreamerVideoStream::GetVideoLength()
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
UINT8* GstreamerVideoStream::GetFrame(float Time, float &VideoTime)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GstreamerVideoStream::Skip(float Start, float Gap)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void GstreamerVideoStream::SetVideoLoop(bool Loop)
|
||||
{
|
||||
}
|
||||
|
||||
void GstreamerVideoStream::PauseVideo()
|
||||
{
|
||||
}
|
||||
|
||||
void GstreamerVideoStream::ResumeVideo()
|
||||
{
|
||||
}
|
||||
|
||||
bool GstreamerVideoStream::Finished()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "gst/gst.h"
|
||||
using namespace std;
|
||||
class GstreamerVideoStream
|
||||
{
|
||||
|
||||
public:
|
||||
int ID;
|
||||
|
||||
GstreamerVideoStream(int ID);
|
||||
~GstreamerVideoStream(void);
|
||||
|
||||
int LoadVideo(const wchar_t* VideoFileName);
|
||||
bool CloseVideo();
|
||||
|
||||
float GetVideoLength();
|
||||
UINT8* GetFrame(float Time, float &VideoTime);
|
||||
bool Skip(float Start, float Gap);
|
||||
void SetVideoLoop(bool Loop);
|
||||
void PauseVideo();
|
||||
void ResumeVideo();
|
||||
|
||||
bool Finished();
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user