unsafe private bool SetOptions(IntPtr hwnd) { // VIDEO AVICOMPRESSOPTIONS opts = new AVICOMPRESSOPTIONS(); opts.fccType = 0; opts.fccHandler = 0; opts.dwKeyFrameEvery = 0; opts.dwQuality = 0; opts.dwFlags = 0; opts.dwBytesPerSecond = 0; opts.lpFormat = new IntPtr(0); opts.cbFormat = 0; opts.lpParms = new IntPtr(0); opts.cbParms = 0; opts.dwInterleaveEvery = 0; AVICOMPRESSOPTIONS * p = &opts; AVICOMPRESSOPTIONS **pp; pp = &p; IntPtr x = m_video; IntPtr *ptr_ps; ptr_ps = &x; if (AVISaveOptions(hwnd, 0, 1, ptr_ps, pp) == 0) { return(false); } int hr = AVIMakeCompressedStream(out m_video_compressed, m_video, ref opts, 0); if (hr != 0) { throw new AviException("AVIMakeCompressedStream; Video"); } m_strh_fcc = opts.fccHandler; #if DEBUG Console.WriteLine("AviWriterVfw+SetOptions"); Console.WriteLine(" opts.fccHandler=" + opts.fccHandler); #endif // TODO: AVISaveOptionsFree(...) BITMAPINFO bi = new BITMAPINFO(); bi.bmiHeader.biSize = 40; bi.bmiHeader.biWidth = (Int32)m_width; bi.bmiHeader.biHeight = (Int32)m_height; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 24; bi.bmiHeader.biCompression = 0; bi.bmiHeader.biSizeImage = m_stride * m_height; bi.bmiHeader.biXPelsPerMeter = 0; bi.bmiHeader.biYPelsPerMeter = 0; bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; hr = AVIStreamSetFormat(m_video_compressed, 0, ref bi, sizeof(BITMAPINFO)); if (hr != 0) { throw new AviException("AVIStreamSetFormat", hr); } #if DEBUG Console.WriteLine(" bi.bmiHeader.biCompression=" + bi.bmiHeader.biCompression); #endif return(true); }
private static extern int AVIStreamSetFormat( IntPtr aviStream, Int32 lPos, ref BITMAPINFO lpFormat, Int32 cbFormat);
public static unsafe uint ICCompressGetFormat( UInt32 hic, BITMAPINFO* lpbiInput, BITMAPINFO* lpbiOutput ) { return (uint)ICSendMessage( hic, ICM_COMPRESS_GET_FORMAT, (IntPtr)lpbiInput, (IntPtr)lpbiOutput ); }
public static unsafe uint ICCompressGetFormatSize( UInt32 hic, BITMAPINFO* lpbi ) { return ICCompressGetFormat( hic, lpbi, (BITMAPINFO*)0 ); }
public static unsafe extern int ICSeqCompressFrameStart( COMPVARS* pc, BITMAPINFO* lpbiIn );
private static extern int AVIStreamSetFormat( IntPtr aviStream, Int32 lPos, ref BITMAPINFO lpFormat, Int32 cbFormat );
unsafe private bool SetOptions( IntPtr hwnd ) { // VIDEO AVICOMPRESSOPTIONS opts = new AVICOMPRESSOPTIONS(); opts.fccType = 0; opts.fccHandler = 0; opts.dwKeyFrameEvery = 0; opts.dwQuality = 0; opts.dwFlags = 0; opts.dwBytesPerSecond = 0; opts.lpFormat = new IntPtr( 0 ); opts.cbFormat = 0; opts.lpParms = new IntPtr( 0 ); opts.cbParms = 0; opts.dwInterleaveEvery = 0; AVICOMPRESSOPTIONS* p = &opts; AVICOMPRESSOPTIONS** pp; pp = &p; IntPtr x = m_video; IntPtr* ptr_ps; ptr_ps = &x; if ( AVISaveOptions( hwnd, 0, 1, ptr_ps, pp ) == 0 ) { return false; } int hr = AVIMakeCompressedStream( out m_video_compressed, m_video, ref opts, 0 ); if ( hr != 0 ) { throw new AviException( "AVIMakeCompressedStream; Video" ); } m_strh_fcc = opts.fccHandler; #if DEBUG Console.WriteLine( "AviWriterVfw+SetOptions" ); Console.WriteLine( " opts.fccHandler=" + opts.fccHandler ); #endif // TODO: AVISaveOptionsFree(...) BITMAPINFO bi = new BITMAPINFO(); bi.bmiHeader.biSize = 40; bi.bmiHeader.biWidth = (Int32)m_width; bi.bmiHeader.biHeight = (Int32)m_height; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 24; bi.bmiHeader.biCompression = 0; bi.bmiHeader.biSizeImage = m_stride * m_height; bi.bmiHeader.biXPelsPerMeter = 0; bi.bmiHeader.biYPelsPerMeter = 0; bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; hr = AVIStreamSetFormat( m_video_compressed, 0, ref bi, sizeof( BITMAPINFO ) ); if ( hr != 0 ) { throw new AviException( "AVIStreamSetFormat", hr ); } #if DEBUG Console.WriteLine( " bi.bmiHeader.biCompression=" + bi.bmiHeader.biCompression ); #endif return true; }