mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-24 20:01:53 +00:00
Preparations for file appending: Added a "force" parameter to the the reader's read() call. If force is true then the reader must read packets for each packetizer that hasn't been finished yet (otherwise a reader may return EHOLDING if a specific packetizer has a lot of data queued). Also ptzr may be NULL in this case.
This commit is contained in:
parent
47de897341
commit
e60cb009ef
@ -168,7 +168,8 @@ aac_reader_c::guess_adts_version() {
|
||||
}
|
||||
|
||||
int
|
||||
aac_reader_c::read(generic_packetizer_c *) {
|
||||
aac_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int nread;
|
||||
|
||||
nread = mm_io->read(chunk, 4096);
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
aac_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~aac_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -106,7 +106,8 @@ ac3_reader_c::create_packetizer(int64_t) {
|
||||
}
|
||||
|
||||
int
|
||||
ac3_reader_c::read(generic_packetizer_c *) {
|
||||
ac3_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int nread;
|
||||
|
||||
nread = mm_io->read(chunk, 4096);
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
ac3_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~ac3_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -355,7 +355,8 @@ avi_reader_c::is_keyframe(unsigned char *data,
|
||||
// {{{ FUNCTION avi_reader_c::read
|
||||
|
||||
int
|
||||
avi_reader_c::read(generic_packetizer_c *ptzr) {
|
||||
avi_reader_c::read(generic_packetizer_c *ptzr,
|
||||
bool force) {
|
||||
vector<avi_demuxer_t>::iterator demuxer;
|
||||
int key, last_frame, frames_read, size;
|
||||
long nread;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
avi_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~avi_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -100,7 +100,8 @@ dts_reader_c::create_packetizer(int64_t) {
|
||||
}
|
||||
|
||||
int
|
||||
dts_reader_c::read(generic_packetizer_c *) {
|
||||
dts_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int nread;
|
||||
|
||||
nread = mm_io->read(chunk, max_dts_packet_size);
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
dts_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~dts_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -207,7 +207,8 @@ flac_reader_c::parse_file() {
|
||||
}
|
||||
|
||||
int
|
||||
flac_reader_c::read(generic_packetizer_c *) {
|
||||
flac_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
unsigned char *buf;
|
||||
|
||||
if (current_block == blocks.end())
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
flac_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~flac_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizer(int64_t id);
|
||||
|
||||
|
@ -1695,7 +1695,8 @@ kax_reader_c::create_packetizers() {
|
||||
// {{{ FUNCTION kax_reader_c::read()
|
||||
|
||||
int
|
||||
kax_reader_c::read(generic_packetizer_c *) {
|
||||
kax_reader_c::read(generic_packetizer_c *,
|
||||
bool force) {
|
||||
int upper_lvl_el, i, bgidx;
|
||||
// Elements for different levels
|
||||
EbmlElement *l0 = NULL, *l1 = NULL, *l2 = NULL;
|
||||
|
@ -137,7 +137,7 @@ public:
|
||||
kax_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~kax_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
|
@ -81,7 +81,8 @@ mp3_reader_c::create_packetizer(int64_t) {
|
||||
}
|
||||
|
||||
int
|
||||
mp3_reader_c::read(generic_packetizer_c *) {
|
||||
mp3_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int nread;
|
||||
|
||||
nread = mm_io->read(chunk, 16384);
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
mp3_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~mp3_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizer(int64_t tid);
|
||||
|
||||
|
@ -1032,7 +1032,8 @@ ogm_reader_c::read_headers() {
|
||||
* General reader. Read a page and hand it over for processing.
|
||||
*/
|
||||
int
|
||||
ogm_reader_c::read(generic_packetizer_c *) {
|
||||
ogm_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int i;
|
||||
ogg_page og;
|
||||
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
ogm_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~ogm_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizers();
|
||||
virtual void create_packetizer(int64_t tid);
|
||||
|
@ -819,7 +819,8 @@ qtmp4_reader_c::handle_header_atoms(uint32_t parent,
|
||||
}
|
||||
|
||||
int
|
||||
qtmp4_reader_c::read(generic_packetizer_c *ptzr) {
|
||||
qtmp4_reader_c::read(generic_packetizer_c *ptzr,
|
||||
bool force) {
|
||||
uint32_t i, k, frame, frame_size;
|
||||
qtmp4_demuxer_t *dmx;
|
||||
bool chunks_left, is_keyframe;
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
qtmp4_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~qtmp4_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -420,7 +420,8 @@ real_reader_c::finish() {
|
||||
// {{{ FUNCTION real_reader_c::read()
|
||||
|
||||
int
|
||||
real_reader_c::read(generic_packetizer_c *) {
|
||||
real_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int size;
|
||||
unsigned char *chunk;
|
||||
real_demuxer_t *dmx;
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
real_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~real_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -107,7 +107,8 @@ srt_reader_c::create_packetizer(int64_t) {
|
||||
#define STATE_TIME 3
|
||||
|
||||
int
|
||||
srt_reader_c::read(generic_packetizer_c *) {
|
||||
srt_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
int64_t start, end;
|
||||
char *chunk;
|
||||
subtitles_c subs;
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
srt_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~srt_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizer(int64_t tid);
|
||||
|
||||
|
@ -228,7 +228,8 @@ ssa_reader_c::recode_text(vector<string> &fields) {
|
||||
}
|
||||
|
||||
int
|
||||
ssa_reader_c::read(generic_packetizer_c *) {
|
||||
ssa_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
string line, stime, orig_line, comma;
|
||||
int i, num;
|
||||
int64_t start, end;
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
ssa_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~ssa_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizer(int64_t tid);
|
||||
|
||||
|
@ -115,7 +115,8 @@ tta_reader_c::create_packetizer(int64_t) {
|
||||
}
|
||||
|
||||
int
|
||||
tta_reader_c::read(generic_packetizer_c *) {
|
||||
tta_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
unsigned char *buf;
|
||||
int nread;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
tta_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~tta_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void identify();
|
||||
|
@ -530,7 +530,8 @@ vobsub_reader_c::extract_one_spu_packet(int64_t timecode,
|
||||
}
|
||||
|
||||
int
|
||||
vobsub_reader_c::read(generic_packetizer_c *ptzr) {
|
||||
vobsub_reader_c::read(generic_packetizer_c *ptzr,
|
||||
bool force) {
|
||||
vobsub_track_c *track;
|
||||
uint32_t i, id;
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
vobsub_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~vobsub_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizers();
|
||||
virtual void create_packetizer(int64_t tid);
|
||||
|
@ -167,7 +167,8 @@ wav_reader_c::create_packetizer(int64_t) {
|
||||
}
|
||||
|
||||
int
|
||||
wav_reader_c::read(generic_packetizer_c *) {
|
||||
wav_reader_c::read(generic_packetizer_c *,
|
||||
bool) {
|
||||
if (!is_dts) {
|
||||
int nread;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
wav_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~wav_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false);
|
||||
virtual void identify();
|
||||
virtual void create_packetizer(int64_t tid);
|
||||
|
||||
|
@ -1107,6 +1107,13 @@ generic_reader_c::~generic_reader_c() {
|
||||
delete ti;
|
||||
}
|
||||
|
||||
int
|
||||
generic_reader_c::read_all() {
|
||||
while (read(NULL, true) != 0)
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
generic_reader_c::demuxing_requested(char type,
|
||||
int64_t id) {
|
||||
|
@ -258,7 +258,8 @@ public:
|
||||
generic_reader_c(track_info_c *nti);
|
||||
virtual ~generic_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr) = 0;
|
||||
virtual int read(generic_packetizer_c *ptzr, bool force = false) = 0;
|
||||
virtual int read_all();
|
||||
virtual int display_priority();
|
||||
virtual void display_progress(bool final = false);
|
||||
virtual void set_headers();
|
||||
|
Loading…
Reference in New Issue
Block a user