private int dump_comments(Xiph.th_comment tc) { if (tc.user_comments != null) { for (int i = 0; i < tc.user_comments.Length; i++) { } } return(0); }
private bool LoadVideo() { this.op = new Xiph.ogg_packet(); this.og = new Xiph.ogg_page(); this.to = new Xiph.ogg_stream_state(); this.oy = new Xiph.ogg_sync_state(); this.ti = default(Xiph.th_info); this.tc = new Xiph.th_comment(); this.ts = null; this.fps = 0f; this.frame_in_sec = 0f; this.instream_pos = 0L; this.stateflag = 0; this.theora_p = 0; this.theora_processing_headers = 0; this.videobuf_time = 0.0; this.videobuf_ready = 0; this.videobuf_granulepos = -1L; this.rnd_frame = -1; this.rdy_frame = -1; this.cur_frame = -1; this.elapsedTimeSamples.Clear(); this.elapsedTimeTimestamps.Clear(); Xiph.ogg_sync_init(this.oy); Xiph.th_comment_init(this.tc); Xiph.th_info_init(ref this.ti); while (this.stateflag == 0) { if (this.buffer_data(this.instream, this.oy) == 0) { break; } while (Xiph.ogg_sync_pageout(this.oy, this.og) > 0) { Xiph.ogg_stream_state os = new Xiph.ogg_stream_state(); if (Xiph.ogg_page_bos(this.og) == 0) { this.queue_page(this.og); this.stateflag = 1; break; } Xiph.ogg_stream_init(os, Xiph.ogg_page_serialno(this.og)); Xiph.ogg_stream_pagein(os, this.og); int num = Xiph.ogg_stream_packetpeek(os, this.op); if (num == 1 && this.theora_p == 0 && (this.theora_processing_headers = Xiph.th_decode_headerin(ref this.ti, this.tc, ref this.ts, this.op)) >= 0) { this.to = Xiph.ogg_stream_clone(os); this.theora_p = 1; if (this.theora_processing_headers != 0) { Xiph.ogg_stream_packetout(this.to, null); } } else { Xiph.ogg_stream_clear(os); } } } while (this.theora_p != 0 && this.theora_processing_headers != 0) { int num2; while (this.theora_processing_headers != 0 && (num2 = Xiph.ogg_stream_packetpeek(this.to, this.op)) != 0) { if (num2 >= 0) { this.theora_processing_headers = Xiph.th_decode_headerin(ref this.ti, this.tc, ref this.ts, this.op); if (this.theora_processing_headers < 0) { this.error = "Error parsing Theora stream headers; corrupt stream?\n"; return(false); } if (this.theora_processing_headers > 0) { Xiph.ogg_stream_packetout(this.to, null); } this.theora_p++; } } if (this.theora_p == 0 || this.theora_processing_headers == 0) { break; } if (Xiph.ogg_sync_pageout(this.oy, this.og) > 0) { this.queue_page(this.og); } else if (this.buffer_data(this.instream, this.oy) == 0) { this.error = "End of file while searching for codec headers.\n"; return(false); } } if (this.theora_p != 0) { this.dump_comments(this.tc); this.td = Xiph.th_decode_alloc(this.ti, this.ts); this.info = string.Format("Ogg logical stream {0} is Theora {1}x{2} {3} fps video\nEncoded frame content is {4}x{5} with {6}x{7} offset\n", new object[] { this.to.serialno, this.ti.frame_width, this.ti.frame_height, this.ti.fps_numerator / this.ti.fps_denominator, this.ti.pic_width, this.ti.pic_height, this.ti.pic_x, this.ti.pic_y }); this.fps = this.ti.fps_numerator / this.ti.fps_denominator; this.frame_in_sec = 1f / this.fps; } else { Xiph.th_info_clear(ref this.ti); Xiph.th_comment_clear(this.tc); } Xiph.th_setup_free(this.ts); if (this.theora_p != 0) { this.open_video(); } this.stateflag = 0; while (Xiph.ogg_sync_pageout(this.oy, this.og) > 0) { this.queue_page(this.og); } this.colors_y_1 = new Color32[this.width * this.height]; this.colors_y_2 = new Color32[this.width * this.height]; this.colors_y = this.colors_y_1; this.colors_y_rnd = this.colors_y_2; while (this.theora_p != 0 && this.videobuf_ready == 0) { if (Xiph.ogg_stream_packetout(this.to, this.op) <= 0) { break; } if (Xiph.th_decode_packetin(this.td, this.op, ref this.videobuf_granulepos) >= 0) { this.videobuf_time = Xiph.th_granule_time(this.td.state, this.videobuf_granulepos); this.videobuf_ready = 1; } } this.loaded = true; return(true); }