diff --git a/src/ogg.cc b/src/ogg.cc index 0acf493..e87acb6 100644 --- a/src/ogg.cc +++ b/src/ogg.cc @@ -265,7 +265,7 @@ void ogg::Encoder::write_tags(int streamno, const Tags &tags) op.b_o_s = 0; op.e_o_s = 0; op.granulepos = 0; - op.packetno = 1; // TODO ensure it's not 2 + op.packetno = 1; // checked on a file from ffmpeg std::string data = render_opustags(tags); op.bytes = data.size(); diff --git a/tests/ogg_test.cc b/tests/ogg_test.cc index c31f855..bc2da04 100644 --- a/tests/ogg_test.cc +++ b/tests/ogg_test.cc @@ -5,7 +5,7 @@ using namespace opustags; -TEST_CASE("decoding a single-stream file", "[ogg]") +TEST_CASE("decoding a single-stream Ogg Opus file", "[ogg]") { std::ifstream src("../tests/samples/mystery.ogg"); ogg::Decoder dec(src); @@ -29,8 +29,18 @@ TEST_CASE("decoding garbage", "[ogg]") REQUIRE_THROWS(dec.read_page()); } +TEST_CASE("decoding an Ogg Vorbis file", "[ogg]") +{ + std::ifstream src("../tests/samples/beep.ogg"); + ogg::Decoder dec(src); + + std::shared_ptr s = dec.read_page(); + REQUIRE(s != nullptr); + REQUIRE(s->state == ogg::RAW_READY); + REQUIRE(s->type == ogg::UNKNOWN_STREAM); +} + // TODO decoding a multi-stream file -// TODO decoding a vorbis ogg stream // Encoding is trickier, and might as well be done in actions_test.cc, given // opustags::edit_tags covers all of Encoder's regular code. diff --git a/tests/samples/beep.ogg b/tests/samples/beep.ogg new file mode 100644 index 0000000..9d56fd8 Binary files /dev/null and b/tests/samples/beep.ogg differ