Example #1
0
			public void PopulateBITMAPINFOHEADER32(ref Win32.BITMAPINFOHEADER bmih)
			{
				bmih.Init();
				bmih.biPlanes = 1;
				bmih.biBitCount = 32;
				bmih.biHeight = height;
				bmih.biWidth = width;
				bmih.biSizeImage = (uint)(4 * width * height);
			}
Example #2
0
			public void PopulateWAVEFORMATEX(ref Win32.WAVEFORMATEX wfex)
			{
				int bytes = 0;
				if (a_bits == 16) bytes = 2;
				else if (a_bits == 8) bytes = 1;
				else throw new InvalidOperationException("only 8/16 bits audio are supported by AviWriter and you chose: " + a_bits);
				if (a_channels == 1) { }
				else if (a_channels == 2) { }
				else throw new InvalidOperationException("only 1/2 channels audio are supported by AviWriter and you chose: " + a_channels);

				wfex.Init();
				wfex.nBlockAlign = (ushort)(bytes * a_channels);
				wfex.nChannels = (ushort)a_channels;
				wfex.wBitsPerSample = (ushort)a_bits;
				wfex.wFormatTag = Win32.WAVE_FORMAT_PCM;
				wfex.nSamplesPerSec = (uint)a_samplerate;
				wfex.nAvgBytesPerSec = (uint)(wfex.nBlockAlign * a_samplerate);
			}
Example #3
0
 public void PopulateBITMAPINFOHEADER24(ref Win32.BITMAPINFOHEADER bmih)
 {
     bmih.Init();
     bmih.biPlanes = 1;
     bmih.biBitCount = 24;
     bmih.biHeight = height;
     //pad up width so that we end up with multiple of 4 bytes
     pitch = width * 3;
     pitch = (pitch + 3) & ~3;
     pitch_add = pitch - width * 3;
     bmih.biWidth = width;
     bmih.biSizeImage = (uint)(pitch * height);
 }