1 #include "library/ogg.hpp"
5 int main(int argc
, char** argv
)
8 std::cerr
<< "Filename needed." << std::endl
;
11 std::ifstream
s(argv
[1], std::ios_base::binary
);
13 std::cerr
<< "Can't open '" << argv
[1] << "'" << std::endl
;
16 ogg::stream_reader_iostreams
r(s
);
18 while(r
.get_page(p
)) {
19 std::cout
<< "Ogg page: Stream " << p
.get_stream() << " sequence " << p
.get_sequence()
20 << " Flags: " << (p
.get_continue() ? "CONTINUE " : "")
21 << (p
.get_bos() ? "BOS " : "") << (p
.get_eos() ? "EOS " : "")
22 << "granulepos=" << p
.get_granulepos() << std::endl
;
23 size_t pc
= p
.get_packet_count();
24 for(size_t i
= 0; i
< pc
; i
++) {
25 auto pp
= p
.get_packet(i
);
26 std::cout
<< "Packet #" << i
<< ": " << pp
.second
<< " bytes";
27 if(i
== 0 && p
.get_continue())
28 std::cout
<< " <continued>";
29 if(i
+ 1 == pc
&& p
.get_last_packet_incomplete())
30 std::cout
<< " <incomplete>";
31 std::cout
<< std::endl
;
34 std::cout
<< "End of Ogg stream." << std::endl
;