mirror of
https://github.com/fmang/opustags.git
synced 2025-07-14 04:55:52 +02:00
tags handler: signal start_of_stream and end_of_file
end_of_file is the old end_of_stream issue #6
This commit is contained in:
@ -16,6 +16,7 @@ void opustags::list_tags(ogg::Decoder &dec, ITagsHandler &handler, bool full)
|
||||
case ogg::HEADER_READY:
|
||||
stream_count++;
|
||||
sequence_numbers[s->stream.serialno] = stream_count;
|
||||
handler.start_of_stream(stream_count, s->type);
|
||||
if (!handler.relevant(stream_count))
|
||||
s->downgrade();
|
||||
remaining_streams++;
|
||||
@ -32,7 +33,7 @@ void opustags::list_tags(ogg::Decoder &dec, ITagsHandler &handler, bool full)
|
||||
// we want our optimization to be transparent to the TagsHandler
|
||||
}
|
||||
}
|
||||
handler.end_of_stream();
|
||||
handler.end_of_file();
|
||||
}
|
||||
|
||||
void opustags::edit_tags(
|
||||
@ -50,6 +51,7 @@ void opustags::edit_tags(
|
||||
case ogg::HEADER_READY:
|
||||
stream_count++;
|
||||
sequence_numbers[s->stream.serialno] = stream_count;
|
||||
handler.start_of_stream(stream_count, s->type);
|
||||
if (!handler.relevant(stream_count))
|
||||
s->downgrade(); // makes it UNKNOWN
|
||||
if (s->type == ogg::UNKNOWN_STREAM) {
|
||||
@ -77,5 +79,5 @@ void opustags::edit_tags(
|
||||
;
|
||||
}
|
||||
}
|
||||
handler.end_of_stream();
|
||||
handler.end_of_file();
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace ogg
|
||||
};
|
||||
|
||||
enum StreamType {
|
||||
UNKNOWN_STREAM,
|
||||
UNKNOWN_STREAM = 0,
|
||||
OPUS_STREAM,
|
||||
};
|
||||
|
||||
|
@ -31,14 +31,20 @@ namespace opustags {
|
||||
// return value would abort any further processing.
|
||||
virtual bool done() = 0;
|
||||
|
||||
// Signals the end of the stream.
|
||||
// Signals a new stream was found.
|
||||
// The meaning of type is in ogg::StreamType, but all you should assume
|
||||
// is that when type is null (UNKNOWN_STREAM), list or edit won't be
|
||||
// called.
|
||||
virtual void start_of_stream(const int streamno, const int type) {}
|
||||
|
||||
// Signals the end of the file (and all the streams).
|
||||
// If after this function is called, done() returns false, it's an
|
||||
// error. However, it would be better to raise the error inside
|
||||
// end_of_stream().
|
||||
// For example, if you expect to find the stream #1 and reach the
|
||||
// end-of-stream before finding it, better tell the user that you
|
||||
// didn't do what he expected.
|
||||
virtual void end_of_stream() {}
|
||||
virtual void end_of_file() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user