| 1 | /** |
| 2 | * \file t/oggdump.cc |
| 3 | * |
| 4 | * Dump brief information about the pages containted in an Ogg file. |
| 5 | * |
| 6 | * This tool is not build by default or installed, and is mainly meant to help understand how Ogg |
| 7 | * files are built, and to debug. |
| 8 | */ |
| 9 | |
| 10 | #include <opustags.h>cxx . . $ `<file>/src/opustags.h`/ |
| 11 | |
| 12 | #include <iostream> |
| 13 | #include <string.h> |
| 14 | |
| 15 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char** argv) |
| 16 | { |
| 17 | if (argc != 2) { |
| 18 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Usage: oggdump FILE\n"; |
| 19 | return 1; |
| 20 | } |
| 21 | otcxx . . $ ot/::filecxx . . $ ot/file# input = fopencxx . . $ ot/file#file(8d4262d45fc644ab).(argv[1], "r"); |
| 22 | if (input ==cxx . . $ std/`operator==`(e445595a98297a59). nullptr) { |
| 23 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Error opening '" <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). argv[1] <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "': " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 24 | return 1; |
| 25 | } |
| 26 | otcxx . . $ ot/::ogg_readercxx . . $ ot/ogg_reader# readercxx . . $ ot/ogg_reader#ogg_reader(8d4262d45fc644ab).(input.getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).()); |
| 27 | otcxx . . $ ot/::statuscxx . . $ ot/status# rccxx . . $ ot/status#status(570d951ce3a7f975).; |
| 28 | while ((rc = reader.read_page()) == otcxx . . $ ot/::stcxx . . $ ot/st#::okcxx . . $ ot/st#ok.) { |
| 29 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Stream " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). ogg_page_serialno(&reader.pagecxx . . $ ot/ogg_reader#page.) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " |
| 30 | "page #" <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). ogg_page_pageno(&reader.pagecxx . . $ ot/ogg_reader#page.) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", " |
| 31 | <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). ogg_page_packets(&reader.pagecxx . . $ ot/ogg_reader#page.) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " packet(s)"; |
| 32 | if (ogg_page_bos(&reader.pagecxx . . $ ot/ogg_reader#page.)) stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", BoS"; |
| 33 | if (ogg_page_eos(&reader.pagecxx . . $ ot/ogg_reader#page.)) stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", EoS"; |
| 34 | if (ogg_page_continued(&reader.pagecxx . . $ ot/ogg_reader#page.)) stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", continued"; |
| 35 | stdcxx . . $ std/::coutcxx . . $ std/cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 36 | } |
| 37 | if (rc != ot::st::ok && rc != ot::st::end_of_stream) { |
| 38 | stdcxx . . $ std/::cerrcxx . . $ std/cerr. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "error: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). rc.messagecxx . . $ ot/status#message. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n"; |
| 39 | return 1; |
| 40 | } |
| 41 | return 0; |
| 42 | } |