jd1990
30th June 2011, 20:59
hi everyone.
well, I have got to do work AvisynthWrapper.cs but when i try to change of frames I get this error
http://i53.tinypic.com/24mffhj.jpg
dunno what it can be :(
Does someone know what this error means?
here the code what i'm using
public partial class Form1 : Form
{
private Bitmap bitmap = null;
private AviSynthClip asc = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// string filename = @"C:\Users\Administrador\Documents\test\test.avs";
char c = '"';
string p1= @"C:\Users\Administrador\Documents\x264\dgindexnv\DGDecodeNV.dll";
string p2 = @"C:\Users\Administrador\Documents\MTVNHD.dgi";
string parce = "loadplugin("+c+p1+c+")" + Environment.NewLine + "DGSource("+c+p2+c+")";
AviSynthScriptEnvironment asse = new AviSynthScriptEnvironment();
asc = asse.ParseScript(parce);
int suma = Convert.ToInt32(textBox1.Text) + 1;
textBox1.Text = suma.ToString() ;
bitmap = ReadFrameBitmap(asc, suma);
pictureBox1.Image = bitmap;
pictureBox1.Width = asc.VideoWidth;
pictureBox1.Height = asc.VideoHeight;
}
public Bitmap ReadFrameBitmap(AviSynthClip asc, int position)
{
Bitmap bmp = null;
try
{
bmp = new Bitmap(asc.VideoWidth, asc.VideoHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
bmp.PixelFormat);
try
{
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Read data
asc.ReadFrame(ptr, bmpData.Stride, position);
}
finally
{
// Unlock the bits.
bmp.UnlockBits(bmpData);
}
bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
return bmp;
}
catch (Exception)
{
if (bmp != null) bmp.Dispose();
throw;
}
}
}
plz help me!!
well, I have got to do work AvisynthWrapper.cs but when i try to change of frames I get this error
http://i53.tinypic.com/24mffhj.jpg
dunno what it can be :(
Does someone know what this error means?
here the code what i'm using
public partial class Form1 : Form
{
private Bitmap bitmap = null;
private AviSynthClip asc = null;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// string filename = @"C:\Users\Administrador\Documents\test\test.avs";
char c = '"';
string p1= @"C:\Users\Administrador\Documents\x264\dgindexnv\DGDecodeNV.dll";
string p2 = @"C:\Users\Administrador\Documents\MTVNHD.dgi";
string parce = "loadplugin("+c+p1+c+")" + Environment.NewLine + "DGSource("+c+p2+c+")";
AviSynthScriptEnvironment asse = new AviSynthScriptEnvironment();
asc = asse.ParseScript(parce);
int suma = Convert.ToInt32(textBox1.Text) + 1;
textBox1.Text = suma.ToString() ;
bitmap = ReadFrameBitmap(asc, suma);
pictureBox1.Image = bitmap;
pictureBox1.Width = asc.VideoWidth;
pictureBox1.Height = asc.VideoHeight;
}
public Bitmap ReadFrameBitmap(AviSynthClip asc, int position)
{
Bitmap bmp = null;
try
{
bmp = new Bitmap(asc.VideoWidth, asc.VideoHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
// Lock the bitmap's bits.
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite,
bmp.PixelFormat);
try
{
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Read data
asc.ReadFrame(ptr, bmpData.Stride, position);
}
finally
{
// Unlock the bits.
bmp.UnlockBits(bmpData);
}
bmp.RotateFlip(RotateFlipType.Rotate180FlipX);
return bmp;
}
catch (Exception)
{
if (bmp != null) bmp.Dispose();
throw;
}
}
}
plz help me!!