ogg: checked the packetno of the OpusTags packet

This commit is contained in:
Frédéric Mangano
2016-03-02 15:53:21 +01:00
parent b4dc544031
commit 4f1070f272
3 changed files with 13 additions and 3 deletions

View File

@ -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();

View File

@ -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<ogg::Stream> 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.

BIN
tests/samples/beep.ogg Normal file

Binary file not shown.