Removed Gst Wrapper
This commit is contained in:
1 parent
e908f923e8
commit
dd6503c911
845 files changed
+1
-153684
No files matched your search
@@ -38,9 +38,6 @@ namespace Vocaluxe.Base
|
||||
case EVideoDecoder.FFmpeg:
|
||||
_VideoDecoder = new CVideoDecoderFFmpeg();
|
||||
break;
|
||||
case EVideoDecoder.Gstreamer:
|
||||
_VideoDecoder = new CVideoDecoderGstreamer();
|
||||
break;
|
||||
default:
|
||||
_VideoDecoder = new CVideoDecoderFFmpeg();
|
||||
break;
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe 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 Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Vocaluxe.Base;
|
||||
using Vocaluxe.Lib.Video.Gstreamer;
|
||||
using VocaluxeLib.Draw;
|
||||
|
||||
namespace Vocaluxe.Lib.Video
|
||||
{
|
||||
class CVideoDecoderGstreamer : IVideoDecoder
|
||||
{
|
||||
#region log
|
||||
private CGstreamerVideoWrapper.LogCallback _Log;
|
||||
|
||||
private void _LogHandler(string text)
|
||||
{
|
||||
CLog.LogError(text);
|
||||
}
|
||||
#endregion log
|
||||
|
||||
public bool Init()
|
||||
{
|
||||
bool retval = CGstreamerVideoWrapper.InitVideo();
|
||||
_Log = _LogHandler;
|
||||
//Really needed? CodeAnalysis complains
|
||||
//GC.SuppressFinalize(Log);
|
||||
CGstreamerVideoWrapper.SetVideoLogCallback(_Log);
|
||||
return retval;
|
||||
}
|
||||
|
||||
public void CloseAll()
|
||||
{
|
||||
CGstreamerVideoWrapper.CloseAllVideos();
|
||||
}
|
||||
|
||||
public int Load(string videoFileName)
|
||||
{
|
||||
int i = -1;
|
||||
try
|
||||
{
|
||||
var u = new Uri(videoFileName);
|
||||
i = CGstreamerVideoWrapper.LoadVideo(u.AbsoluteUri);
|
||||
return i;
|
||||
}
|
||||
catch (Exception) {}
|
||||
return i;
|
||||
}
|
||||
|
||||
public bool Close(int streamID)
|
||||
{
|
||||
return CGstreamerVideoWrapper.CloseVideo(streamID);
|
||||
}
|
||||
|
||||
public int GetNumStreams()
|
||||
{
|
||||
return CGstreamerVideoWrapper.GetVideoNumStreams();
|
||||
}
|
||||
|
||||
public float GetLength(int streamID)
|
||||
{
|
||||
return CGstreamerVideoWrapper.GetVideoLength(streamID);
|
||||
}
|
||||
|
||||
public bool GetFrame(int streamID, ref CTexture frame, float time, out float videoTime)
|
||||
{
|
||||
SManagedFrame managedFrame = CGstreamerVideoWrapper.GetFrame(streamID, time);
|
||||
videoTime = managedFrame.Videotime;
|
||||
|
||||
_UploadNewFrame(ref frame, ref managedFrame.Buffer, managedFrame.Width, managedFrame.Height);
|
||||
return frame != null;
|
||||
}
|
||||
|
||||
public bool Skip(int streamID, float start, float gap)
|
||||
{
|
||||
return CGstreamerVideoWrapper.Skip(streamID, start, gap);
|
||||
}
|
||||
|
||||
public void SetLoop(int streamID, bool loop)
|
||||
{
|
||||
CGstreamerVideoWrapper.SetVideoLoop(streamID, loop);
|
||||
}
|
||||
|
||||
public void Pause(int streamID)
|
||||
{
|
||||
CGstreamerVideoWrapper.PauseVideo(streamID);
|
||||
}
|
||||
|
||||
public void Resume(int streamID)
|
||||
{
|
||||
CGstreamerVideoWrapper.ResumeVideo(streamID);
|
||||
}
|
||||
|
||||
public bool Finished(int streamID)
|
||||
{
|
||||
return CGstreamerVideoWrapper.Finished(streamID);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
CGstreamerVideoWrapper.UpdateVideo();
|
||||
}
|
||||
|
||||
private void _UploadNewFrame(ref CTexture frame, ref byte[] data, int width, int height)
|
||||
{
|
||||
if (data == null)
|
||||
return;
|
||||
CDraw.UpdateOrAddTexture(ref frame, width, height, data);
|
||||
data = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe 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 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe 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 Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Vocaluxe.Lib.Video.Gstreamer
|
||||
{
|
||||
public struct SNativeFrame
|
||||
{
|
||||
// ReSharper disable UnassignedField.Global
|
||||
internal IntPtr Buffer;
|
||||
public int Size;
|
||||
public int Width;
|
||||
public int Height;
|
||||
public float Videotime;
|
||||
// ReSharper restore UnassignedField.Global
|
||||
}
|
||||
|
||||
public struct SManagedFrame
|
||||
{
|
||||
public byte[] Buffer;
|
||||
public int Width;
|
||||
public int Height;
|
||||
public float Videotime;
|
||||
}
|
||||
|
||||
public static class CGstreamerVideoWrapper
|
||||
{
|
||||
#region arch
|
||||
#if ARCH_X86
|
||||
#if WIN
|
||||
private const string _Dll = "x86\\gstreamer\\gstreamerhelper.dll";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ARCH_X64
|
||||
#if WIN
|
||||
private const string _Dll = "x64\\gstreamer\\gstreamerhelper.dll";
|
||||
#endif
|
||||
#endif
|
||||
#endregion arch
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
public delegate void LogCallback(string message);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void SetVideoLogCallback(LogCallback c);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool InitVideo();
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void CloseAllVideos();
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int LoadVideo(string videoFileName);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool CloseVideo(int streamID);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern int GetVideoNumStreams();
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern float GetVideoLength(int streamID);
|
||||
|
||||
[DllImport(_Dll, EntryPoint = "GetFrame", CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern SNativeFrame GetFrameNative(int streamID, float time);
|
||||
|
||||
public static SManagedFrame GetFrame(int streamID, float time)
|
||||
{
|
||||
SNativeFrame f = GetFrameNative(streamID, time);
|
||||
|
||||
byte[] buffer = null;
|
||||
|
||||
if (f.Size > 0)
|
||||
{
|
||||
buffer = new byte[f.Size];
|
||||
Marshal.Copy(f.Buffer, buffer, 0, f.Size);
|
||||
}
|
||||
|
||||
SManagedFrame m;
|
||||
m.Buffer = buffer;
|
||||
m.Height = f.Height;
|
||||
m.Videotime = f.Videotime;
|
||||
m.Width = f.Width;
|
||||
return m;
|
||||
}
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool Skip(int streamID, float start, float gap);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void SetVideoLoop(int streamID,
|
||||
[MarshalAs(UnmanagedType.U1)] bool loop);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void PauseVideo(int streamID);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
public static extern void ResumeVideo(int streamID);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool Finished(int streamID);
|
||||
|
||||
[DllImport(_Dll, CallingConvention = CallingConvention.Cdecl)]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
public static extern bool UpdateVideo();
|
||||
}
|
||||
}
|
||||
@@ -322,8 +322,6 @@
|
||||
<Compile Include="Lib\Sound\Record\IRecord.cs" />
|
||||
<Compile Include="Lib\Video\Acinerella\CAcinerella.cs" />
|
||||
<Compile Include="Lib\Video\CVideoDecoderFFmpeg.cs" />
|
||||
<Compile Include="Lib\Video\CVideoDecoderGstreamer.cs" />
|
||||
<Compile Include="Lib\Video\Gstreamer\CGstreamerVideoWrapper.cs" />
|
||||
<Compile Include="Lib\Video\IVideoDecoder.cs" />
|
||||
<Compile Include="Lib\Webcam\CAForgeNet.cs" />
|
||||
<Compile Include="Lib\Webcam\IWebcam.cs" />
|
||||
|
||||
Reference in new issue
Block a user