Code: Select all
Error 1 Program 'C:\Documents and Settings\cagdas\Desktop\oooo\Project1\Project1\obj\Release\Project1.exe' does not contain a static 'Main' method suitable for an entry point Project1
Code: Select all
VLC.setVariable "conf::motiondetect-history", "5"
Code: Select all
vlc1.SetVlcObjectString(ObjectType.VLC_OBJECT_VOUT, ":motiondetect-history", "5");
Code: Select all
[DllImport("libvlc")]
static extern IntPtr libvlc_playlist_get_input(ref libvlc_instance_t libvlc, ref libvlc_exception_t p_exception);
[DllImport("libvlc")]
static extern void libvlc_input_free(IntPtr p_input);
[DllImport("libvlc")]
static extern int libvlc_video_get_width(IntPtr p_input, ref libvlc_exception_t p_exception);
[DllImport("libvlc")]
static extern int libvlc_video_get_height(IntPtr p_input, ref libvlc_exception_t p_exception);
public Size VideoSize
{
get
{
try
{
using(VlcPlaylistObject vpobj = new VlcPlaylistObject(this.vlcHandle))
{
if(vpobj.SubObject != IntPtr.Zero)
{
IntPtr p_input = libvlc_playlist_get_input(ref vpobj.libvlc, ref vpobj.exception);
if(vpobj.exception.WasExceptionRaised())
{
this.lastErrorMessage = Marshal.PtrToStringAnsi(vpobj.exception.psz_message);
}
else
{
try
{
int width = libvlc_video_get_width(p_input, ref vpobj.exception);
if(!vpobj.exception.WasExceptionRaised())
{
int height = libvlc_video_get_height(p_input, ref vpobj.exception);
if(!vpobj.exception.WasExceptionRaised())
{
return new Size(width, height);
}
}
}
finally
{
libvlc_input_free(p_input);
}
}
}
}
}
catch(Exception ex)
{
this.lastErrorMessage = ex.Message;
}
return new Size();
}
}
Code: Select all
enum CONFIG_ITEM : int
{
CONFIG_ITEM_STRING = 0x0010,
CONFIG_ITEM_FILE = 0x0020,
CONFIG_ITEM_MODULE = 0x0030,
CONFIG_ITEM_INTEGER = 0x0040,
CONFIG_ITEM_BOOL = 0x0050,
CONFIG_ITEM_FLOAT = 0x0060,
}
[StructLayout(LayoutKind.Sequential)]
struct module_config_t
{
public CONFIG_ITEM i_type;
}
[DllImport("libvlc")]
static extern IntPtr config_FindConfig(IntPtr vlc, String name);
[DllImport("libvlc")]
static extern void __config_PutInt(IntPtr vlc, String name, int value);
[DllImport("libvlc")]
static extern void __config_PutFloat(IntPtr vlc, String name, float value);
[DllImport("libvlc")]
static extern void __config_PutPsz(IntPtr vlc, String name, String value);
public VlcError SetConfigVariable(String name, String value)
{
using(VlcObject vlc = new VlcObject(this.vlcHandle, ObjectType.VLC_OBJECT_VLC))
{
if(IntPtr.Zero == vlc.SubObject)
{
return VlcError.NoObj;
}
IntPtr p_item = config_FindConfig(vlc.SubObject, name);
if(IntPtr.Zero == p_item)
{
return VlcError.NoVar;
}
else
{
try
{
module_config_t mod = (module_config_t)Marshal.PtrToStructure(p_item, typeof(module_config_t));
switch(mod.i_type)
{
case CONFIG_ITEM.CONFIG_ITEM_BOOL:
{
bool boolResult;
if(Boolean.TryParse(value, out boolResult))
{
__config_PutInt(vlc.SubObject, name, boolResult ? 1 : 0);
}
}
break;
case CONFIG_ITEM.CONFIG_ITEM_INTEGER:
{
int intResult;
if(Int32.TryParse(value, out intResult))
{
__config_PutInt(vlc.SubObject, name, intResult);
}
}
break;
case CONFIG_ITEM.CONFIG_ITEM_FLOAT:
{
float floatResult;
if(Single.TryParse(value, out floatResult))
{
__config_PutFloat(vlc.SubObject, name, floatResult);
}
}
break;
case CONFIG_ITEM.CONFIG_ITEM_STRING:
__config_PutPsz(vlc.SubObject, name, value);
break;
default:
return VlcError.NoVar;
}
}
catch(Exception e)
{
this.lastErrorMessage = e.Message;
return VlcError.Exception;
}
}
}
return VlcError.Success;
}
Users browsing this forum: No registered users and 2 guests