コード例 #1
0
ファイル: OggEncoder.cs プロジェクト: teetow/teevegas
        /*	private void WriteOg(ogg_page og,Stream stdout)
         *      {
         *              byte[] ogheader = new byte[og.header_len];
         *              Marshal.Copy(og.header,ogheader,0,og.header_len);
         *              stdout.Write(ogheader,0,og.header_len);
         *              byte[] ogbody = new byte[og.body_len];
         *              Marshal.Copy(og.body,ogbody,0,og.body_len);
         *              stdout.Write(ogbody,0,og.body_len);
         *      }
         */

        private void WriteOg(IntPtr ogptr, Stream stdout)
        {
            var og = new ogg_page();

            //Marshal.PtrToStructure(ogptr,og);
            og.header     = Marshal.ReadIntPtr(ogptr);
            og.header_len = Marshal.ReadInt32(ogptr, 4);
            og.body       = Marshal.ReadIntPtr(ogptr, 8);
            og.body_len   = Marshal.ReadInt32(ogptr, 12);

            var ogheader = new byte[og.header_len];

            Marshal.Copy(og.header, ogheader, 0, og.header_len);
            stdout.Write(ogheader, 0, og.header_len);
            var ogbody = new byte[og.body_len];

            Marshal.Copy(og.body, ogbody, 0, og.body_len);
            stdout.Write(ogbody, 0, og.body_len);
        }
コード例 #2
0
ファイル: OggEncoder.cs プロジェクト: teetow/teevegas
		/*	private void WriteOg(ogg_page og,Stream stdout)
			{
				byte[] ogheader = new byte[og.header_len];
				Marshal.Copy(og.header,ogheader,0,og.header_len);
				stdout.Write(ogheader,0,og.header_len);
				byte[] ogbody = new byte[og.body_len];				
				Marshal.Copy(og.body,ogbody,0,og.body_len);
				stdout.Write(ogbody,0,og.body_len);
			}
		*/

		private void WriteOg(IntPtr ogptr, Stream stdout)
		{
			var og = new ogg_page();
			//Marshal.PtrToStructure(ogptr,og);
			og.header = Marshal.ReadIntPtr(ogptr);
			og.header_len = Marshal.ReadInt32(ogptr, 4);
			og.body = Marshal.ReadIntPtr(ogptr, 8);
			og.body_len = Marshal.ReadInt32(ogptr, 12);

			var ogheader = new byte[og.header_len];
			Marshal.Copy(og.header, ogheader, 0, og.header_len);
			stdout.Write(ogheader, 0, og.header_len);
			var ogbody = new byte[og.body_len];
			Marshal.Copy(og.body, ogbody, 0, og.body_len);
			stdout.Write(ogbody, 0, og.body_len);
		}