当前位置: 首页>>代码示例>>C#>>正文


C# csBuffer.readinit方法代码示例

本文整理汇总了C#中csogg.csBuffer.readinit方法的典型用法代码示例。如果您正苦于以下问题:C# csBuffer.readinit方法的具体用法?C# csBuffer.readinit怎么用?C# csBuffer.readinit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在csogg.csBuffer的用法示例。


在下文中一共展示了csBuffer.readinit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: blocksize

		//  static void v_writestring(csBuffer o, byte[] s){
		//    int i=0;
		//    while(s[i]!=0){
		//      o.write(s[i++],8);
		//    }
		//  }

		//  static void v_readstring(csBuffer o, byte[] buf, int bytes){
		//    int i=0
		//    while(bytes--!=0){
		//      buf[i++]=o.read(8);
		//    }
		//  }

		//  private csBuffer opb_blocksize=new csBuffer();
		public int blocksize(Packet op)
		{
			//codec_setup_info     *ci=vi->codec_setup;
			csBuffer opb=new csBuffer();
			//    synchronized(opb_blocksize){
			int mode;
 
			opb.readinit(op.packet_base, op.packet, op.bytes);

			/* Check the packet type */
			if(opb.read(1)!=0)
			{
				/* Oops.  This is not an audio data packet */
				return(OV_ENOTAUDIO);
			}
		{  
			int modebits=0;
			int v=modes;
			while(v>1)
			{
				modebits++;
				v = (int)((uint)v >> 1);
			}

			/* read our mode and pre/post windowsize */
			mode=opb.read(modebits);
		}
			if(mode==-1)return(OV_EBADPACKET);
			return(blocksizes[mode_param[mode].blockflag]);
			//    }
		}
开发者ID:mattcuba,项目名称:practicesharp,代码行数:46,代码来源:Info.cs

示例2: synthesis_headerin

		// The Vorbis header is in three packets; the initial small packet in
		// the first page that identifies basic parameters, a second packet
		// with bitstream comments and a third packet that holds the
		// codebook.

		public int synthesis_headerin(Comment vc, Packet op)
		{
			csBuffer opb=new csBuffer();

			if(op!=null)
			{  
				opb.readinit(op.packet_base, op.packet, op.bytes);

				// Which of the three types of header is this?
				// Also verify header-ness, vorbis
			{
				byte[] buffer=new byte[6];
				int packtype=opb.read(8);
				//memset(buffer,0,6);
				opb.read(buffer,6);
				if(buffer[0]!='v' || buffer[1]!='o' || buffer[2]!='r' ||
					buffer[3]!='b' || buffer[4]!='i' || buffer[5]!='s')
				{
					// not a vorbis header
					return(-1);
				}
				switch(packtype)
				{
					case 0x01: // least significant *bit* is read first
						if(op.b_o_s==0)
						{
							// Not the initial packet
							return(-1);
						}
						if(rate!=0)
						{
							// previously initialized info header
							return(-1);
						}
						return(unpack_info(opb));
					case 0x03: // least significant *bit* is read first
						if(rate==0)
						{
							// um... we didn't get the initial header
							return(-1);
						}
						return(vc.unpack(opb));
					case 0x05: // least significant *bit* is read first
						if(rate==0 || vc.vendor==null)
						{
							// um... we didn;t get the initial header or comments yet
							return(-1);
						}
						return(unpack_books(opb));
					default:
						// Not a valid vorbis header type
						//return(-1);
						break;
				}
			}
			}
			return(-1);
		}
开发者ID:mattcuba,项目名称:practicesharp,代码行数:63,代码来源:Info.cs


注:本文中的csogg.csBuffer.readinit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。