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


C# Info.init方法代码示例

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


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

示例1: main

        static byte[] convbuffer = new byte[convsize]; // take 8k out of the data segment, not the stack

        #endregion Fields

        #region Methods

        public static void main(String[] arg)
        {
            //Stream output = File.OpenWrite("output.bin");
            var Name = "Output.ogg";
            var OutputBuffer = new MemoryStream();
            Stream input = null;
            //java.io.InputStream input=System.In;
            if (arg.Length > 0)
            {
                try
                {
                    Name = arg[0];
                    input = File.OpenRead(arg[0]);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e);
                }
            }
            else
            {
                throw (new NotImplementedException("aaaa"));
            }

            if (input == null) throw (new NotImplementedException("bbb"));

            var SyncState = new SyncState(); // sync and verify incoming physical bitstream
            var StreamState = new StreamState(); // take physical pages, weld into a logical stream of packets
            var Page = new Page(); // one Ogg bitstream page.  Vorbis packets are inside
            var Packet = new Packet(); // one raw packet of data for decode

            var Info = new Info(); // struct that stores all the static vorbis bitstream settings
            var Comment = new Comment(); // struct that stores all the bitstream user comments
            var DspState = new DspState(); // central working state for the packet->PCM decoder
            var Block = new Block(DspState); // local working space for packet->PCM decode

            byte[] buffer;
            int bytes = 0;

            // Decode setup

            SyncState.Init(); // Now we can read pages

            // we repeat if the bitstream is chained
            while (true)
            {
                int eos = 0;

                // grab some data at the head of the stream.  We want the first page
                // (which is guaranteed to be small and only contain the Vorbis
                // stream initial header) We need the first page to get the stream
                // serialno.

                // submit a 4k block to libvorbis' Ogg layer
                int index = SyncState.Buffer(4096);
                buffer = SyncState.Data;
                try
                {
                    bytes = input.Read(buffer, index, 4096);
                }
                catch (Exception e)
                {
                    Console.Error.WriteLine(e);
                    return;
                }
                SyncState.wrote(bytes);

                // Get the first page.
                int _result = SyncState.PageOut(Page);
                if (_result != 1)
                {
                    // have we simply run out of data?  If so, we're done.
                    if (bytes < 4096) break;

                    Console.WriteLine(bytes + "; " + _result);
                    //File.WriteAllBytes();
                    // error case.  Must not be Vorbis data
                    Console.Error.WriteLine("Input does not appear to be an Ogg bitstream.");
                    return;
                }

                // Get the serial number and set up the rest of decode.
                // serialno first; use it to set up a logical stream
                StreamState.Init(Page.serialno());

                // extract the initial header from the first page and verify that the
                // Ogg bitstream is in fact Vorbis data

                // I handle the initial header first instead of just having the code
                // read all three Vorbis headers at once because reading the initial
                // header is an easy way to identify a Vorbis bitstream and it's
                // useful to see that functionality seperated out.

                Info.init();
//.........这里部分代码省略.........
开发者ID:hermitdave,项目名称:nvorbis,代码行数:101,代码来源:DecodeExample.cs


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