mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
Converted track_info_t into a class and unified the duplication/freeing of its data.
This commit is contained in:
parent
b2d9833f2b
commit
adeda19e26
@ -69,7 +69,7 @@ int aac_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
#define INITCHUNKSIZE 16384
|
||||
#define SINITCHUNKSIZE "16384"
|
||||
|
||||
aac_reader_c::aac_reader_c(track_info_t *nti) throw (error_c):
|
||||
aac_reader_c::aac_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
int adif, i;
|
||||
aac_header_t aacheader;
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
bool emphasis_present;
|
||||
|
||||
public:
|
||||
aac_reader_c(track_info_t *nti) throw (error_c);
|
||||
aac_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~aac_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -62,7 +62,7 @@ int ac3_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
ac3_reader_c::ac3_reader_c(track_info_t *nti) throw (error_c):
|
||||
ac3_reader_c::ac3_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
int pos;
|
||||
ac3_header_t ac3header;
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
int64_t bytes_processed, size;
|
||||
|
||||
public:
|
||||
ac3_reader_c(track_info_t *nti) throw (error_c);
|
||||
ac3_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~ac3_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -72,7 +72,7 @@ private:
|
||||
int video_done, maxframes, is_divx, rederive_keyframes;
|
||||
|
||||
public:
|
||||
avi_reader_c(track_info_t *nti) throw (error_c);
|
||||
avi_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~avi_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -53,7 +53,7 @@ int dts_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
dts_reader_c::dts_reader_c(track_info_t *nti) throw (error_c):
|
||||
dts_reader_c::dts_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
int pos;
|
||||
dts_header_t dtsheader;
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
int64_t bytes_processed, size;
|
||||
|
||||
public:
|
||||
dts_reader_c(track_info_t *nti) throw (error_c);
|
||||
dts_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~dts_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -82,7 +82,7 @@ int flac_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
flac_reader_c::flac_reader_c(track_info_t *nti) throw (error_c):
|
||||
flac_reader_c::flac_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
unsigned char *buf;
|
||||
uint32_t size;
|
||||
|
@ -52,7 +52,7 @@ private:
|
||||
vector<flac_block_t>::iterator current_block;
|
||||
|
||||
public:
|
||||
flac_reader_c(track_info_t *nti) throw (error_c);
|
||||
flac_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~flac_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -115,7 +115,7 @@ int kax_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
|
||||
// {{{ C'TOR
|
||||
|
||||
kax_reader_c::kax_reader_c(track_info_t *nti) throw (error_c):
|
||||
kax_reader_c::kax_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
|
||||
title = "";
|
||||
@ -1231,23 +1231,24 @@ int kax_reader_c::read_headers() {
|
||||
void kax_reader_c::create_packetizers() {
|
||||
int i;
|
||||
kax_track_t *t;
|
||||
track_info_t nti;
|
||||
track_info_c *nti;
|
||||
|
||||
for (i = 0; i < tracks.size(); i++) {
|
||||
t = tracks[i];
|
||||
|
||||
memcpy(&nti, ti, sizeof(track_info_t));
|
||||
nti.private_data = (unsigned char *)t->private_data;
|
||||
nti.private_size = t->private_size;
|
||||
if (nti.default_track == 0)
|
||||
nti.default_track = t->default_track;
|
||||
if (nti.language == NULL)
|
||||
nti.language = t->language;
|
||||
if (nti.track_name == NULL)
|
||||
nti.track_name = t->track_name;
|
||||
nti = new track_info_c(*ti);
|
||||
nti->private_data =
|
||||
(unsigned char *)safememdup(t->private_data, t->private_size);
|
||||
nti->private_size = t->private_size;
|
||||
if (nti->default_track == 0)
|
||||
nti->default_track = t->default_track;
|
||||
if (nti->language == NULL)
|
||||
nti->language = safestrdup(t->language);
|
||||
if (nti->track_name == NULL)
|
||||
nti->track_name = safestrdup(t->track_name);
|
||||
|
||||
if (t->ok && demuxing_requested(t->type, t->tnum)) {
|
||||
nti.id = t->tnum; // ID for this track.
|
||||
nti->id = t->tnum; // ID for this track.
|
||||
switch (t->type) {
|
||||
|
||||
case 'v':
|
||||
@ -1257,8 +1258,8 @@ void kax_reader_c::create_packetizers() {
|
||||
t->packetizer = new video_packetizer_c(this, t->codec_id, t->v_frate,
|
||||
t->v_width,
|
||||
t->v_height,
|
||||
t->v_bframes, &nti);
|
||||
if (!nti.aspect_ratio_given) { // The user didn't set it.
|
||||
t->v_bframes, nti);
|
||||
if (!nti->aspect_ratio_given) { // The user didn't set it.
|
||||
if (t->v_dwidth != 0)
|
||||
t->packetizer->set_video_display_width(t->v_dwidth);
|
||||
if (t->v_dheight != 0)
|
||||
@ -1271,14 +1272,14 @@ void kax_reader_c::create_packetizers() {
|
||||
t->packetizer = new pcm_packetizer_c(this,
|
||||
(unsigned long)t->a_sfreq,
|
||||
t->a_channels, t->a_bps,
|
||||
&nti);
|
||||
nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the PCM output module for track ID %u.\n",
|
||||
t->tnum);
|
||||
} else if (t->a_formattag == 0x0055) {
|
||||
t->packetizer = new mp3_packetizer_c(this,
|
||||
(unsigned long)t->a_sfreq,
|
||||
t->a_channels, &nti);
|
||||
t->a_channels, nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the MPEG audio output module for track ID %u."
|
||||
"\n", t->tnum);
|
||||
@ -1293,7 +1294,7 @@ void kax_reader_c::create_packetizers() {
|
||||
bsid = 0;
|
||||
t->packetizer = new ac3_packetizer_c(this,
|
||||
(unsigned long)t->a_sfreq,
|
||||
t->a_channels, bsid, &nti);
|
||||
t->a_channels, bsid, nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the AC3 output module for track ID %u.\n",
|
||||
t->tnum);
|
||||
@ -1304,7 +1305,7 @@ void kax_reader_c::create_packetizers() {
|
||||
/*
|
||||
t->packetizer = new dts_packetizer_c(this,
|
||||
(unsigned long)t->a_sfreq,
|
||||
&nti);
|
||||
nti);
|
||||
*/
|
||||
} else if (t->a_formattag == 0xFFFE) {
|
||||
t->packetizer = new vorbis_packetizer_c(this,
|
||||
@ -1313,7 +1314,7 @@ void kax_reader_c::create_packetizers() {
|
||||
t->headers[1],
|
||||
t->header_sizes[1],
|
||||
t->headers[2],
|
||||
t->header_sizes[2], &nti);
|
||||
t->header_sizes[2], nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the Vorbis output module for track ID %u.\n",
|
||||
t->tnum);
|
||||
@ -1355,7 +1356,7 @@ void kax_reader_c::create_packetizers() {
|
||||
|
||||
t->packetizer = new aac_packetizer_c(this, id, profile,
|
||||
(unsigned long)t->a_sfreq,
|
||||
t->a_channels, &nti,
|
||||
t->a_channels, nti,
|
||||
false, true);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the AAC output module for track ID %u.\n",
|
||||
@ -1382,14 +1383,15 @@ void kax_reader_c::create_packetizers() {
|
||||
#if defined(HAVE_FLAC_FORMAT_H)
|
||||
} else if ((t->a_formattag == FOURCC('f', 'L', 'a', 'C')) ||
|
||||
(t->a_formattag == 0xf1ac)) {
|
||||
nti.private_data = NULL;
|
||||
nti.private_size = 0;
|
||||
safefree(nti->private_data);
|
||||
nti->private_data = NULL;
|
||||
nti->private_size = 0;
|
||||
if (t->a_formattag == FOURCC('f', 'L', 'a', 'C'))
|
||||
t->packetizer =
|
||||
new flac_packetizer_c(this, (int)t->a_sfreq, t->a_channels,
|
||||
t->a_bps,
|
||||
(unsigned char *)t->private_data,
|
||||
t->private_size, &nti);
|
||||
t->private_size, nti);
|
||||
else
|
||||
t->packetizer =
|
||||
new flac_packetizer_c(this, (int)t->a_sfreq, t->a_channels,
|
||||
@ -1397,7 +1399,7 @@ void kax_reader_c::create_packetizers() {
|
||||
((unsigned char *)t->private_data) +
|
||||
sizeof(alWAVEFORMATEX),
|
||||
t->private_size - sizeof(alWAVEFORMATEX),
|
||||
&nti);
|
||||
nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the FLAC output module for track ID %u.\n",
|
||||
t->tnum);
|
||||
@ -1416,7 +1418,7 @@ void kax_reader_c::create_packetizers() {
|
||||
if (!strcmp(t->codec_id, MKV_S_VOBSUB)) {
|
||||
t->packetizer =
|
||||
new vobsub_packetizer_c(this, t->private_data, t->private_size,
|
||||
false, &nti);
|
||||
false, nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the VobSub output module for track ID %u.\n",
|
||||
t->tnum);
|
||||
@ -1427,7 +1429,7 @@ void kax_reader_c::create_packetizers() {
|
||||
t->packetizer = new textsubs_packetizer_c(this, t->codec_id,
|
||||
t->private_data,
|
||||
t->private_size, false,
|
||||
true, &nti);
|
||||
true, nti);
|
||||
if (verbose)
|
||||
mxinfo("+-> Using the text subtitle output module for track ID "
|
||||
"%u.\n", t->tnum);
|
||||
@ -1446,6 +1448,8 @@ void kax_reader_c::create_packetizers() {
|
||||
"UID %u because it is already allocated for the new "
|
||||
"file.\n", t->tuid);
|
||||
}
|
||||
|
||||
delete nti;
|
||||
}
|
||||
|
||||
if (segment_title.length() == 0)
|
||||
|
@ -123,7 +123,7 @@ private:
|
||||
vector<kax_attachment_t> attachments;
|
||||
|
||||
public:
|
||||
kax_reader_c(track_info_t *nti) throw (error_c);
|
||||
kax_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~kax_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -68,7 +68,7 @@ int mp3_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
mp3_reader_c::mp3_reader_c(track_info_t *nti) throw (error_c):
|
||||
mp3_reader_c::mp3_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
int pos, ptr, buf_size;
|
||||
unsigned char buf[16384];
|
||||
|
@ -40,7 +40,7 @@ private:
|
||||
mp3_header_t mp3header;
|
||||
|
||||
public:
|
||||
mp3_reader_c(track_info_t *nti) throw (error_c);
|
||||
mp3_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~mp3_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -234,7 +234,7 @@ int ogm_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
* Opens the file for processing, initializes an ogg_sync_state used for
|
||||
* reading from an OGG stream.
|
||||
*/
|
||||
ogm_reader_c::ogm_reader_c(track_info_t *nti) throw (error_c):
|
||||
ogm_reader_c::ogm_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
|
||||
try {
|
||||
|
@ -103,7 +103,7 @@ private:
|
||||
int64_t file_size;
|
||||
|
||||
public:
|
||||
ogm_reader_c(track_info_t *nti) throw (error_c);
|
||||
ogm_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~ogm_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -80,7 +80,7 @@ int qtmp4_reader_c::probe_file(mm_io_c *in, int64_t size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
qtmp4_reader_c::qtmp4_reader_c(track_info_t *nti) throw (error_c) :
|
||||
qtmp4_reader_c::qtmp4_reader_c(track_info_c *nti) throw (error_c) :
|
||||
generic_reader_c(nti) {
|
||||
try {
|
||||
io = new mm_io_c(ti->fname, MODE_READ);
|
||||
|
@ -120,7 +120,7 @@ private:
|
||||
int main_dmx;
|
||||
|
||||
public:
|
||||
qtmp4_reader_c(track_info_t *nti) throw (error_c);
|
||||
qtmp4_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~qtmp4_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -140,7 +140,7 @@ int real_reader_c::probe_file(mm_io_c *io, int64_t size) {
|
||||
|
||||
// {{{ C'TOR
|
||||
|
||||
real_reader_c::real_reader_c(track_info_t *nti) throw (error_c):
|
||||
real_reader_c::real_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
|
||||
try {
|
||||
|
@ -72,7 +72,7 @@ private:
|
||||
bool done;
|
||||
|
||||
public:
|
||||
real_reader_c(track_info_t *nti) throw (error_c);
|
||||
real_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~real_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -65,7 +65,7 @@ int srt_reader_c::probe_file(mm_text_io_c *mm_io, int64_t) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
srt_reader_c::srt_reader_c(track_info_t *nti) throw (error_c):
|
||||
srt_reader_c::srt_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
bool is_utf8;
|
||||
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
int act_wchar;
|
||||
|
||||
public:
|
||||
srt_reader_c(track_info_t *nti) throw (error_c);
|
||||
srt_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~srt_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -62,7 +62,7 @@ int ssa_reader_c::probe_file(mm_text_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
ssa_reader_c::ssa_reader_c(track_info_t *nti) throw (error_c):
|
||||
ssa_reader_c::ssa_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
string line, global;
|
||||
int64_t old_pos;
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
int cc_utf8;
|
||||
|
||||
public:
|
||||
ssa_reader_c(track_info_t *nti) throw (error_c);
|
||||
ssa_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~ssa_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -85,7 +85,7 @@ int vobsub_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
vobsub_reader_c::vobsub_reader_c(track_info_t *nti) throw (error_c):
|
||||
vobsub_reader_c::vobsub_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
string sub_name, line;
|
||||
int len;
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
vector<vobsub_track_c *> tracks;
|
||||
|
||||
public:
|
||||
vobsub_reader_c(track_info_t *nti) throw (error_c);
|
||||
vobsub_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~vobsub_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
@ -111,7 +111,7 @@ int wav_reader_c::probe_file(mm_io_c *mm_io, int64_t size) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
wav_reader_c::wav_reader_c(track_info_t *nti) throw (error_c):
|
||||
wav_reader_c::wav_reader_c(track_info_c *nti) throw (error_c):
|
||||
generic_reader_c(nti) {
|
||||
int64_t size;
|
||||
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
bool is_dts;
|
||||
|
||||
public:
|
||||
wav_reader_c(track_info_t *nti) throw (error_c);
|
||||
wav_reader_c(track_info_c *nti) throw (error_c);
|
||||
virtual ~wav_reader_c();
|
||||
|
||||
virtual int read(generic_packetizer_c *ptzr);
|
||||
|
161
src/mkvmerge.cpp
161
src/mkvmerge.cpp
@ -110,7 +110,7 @@ typedef struct filelist_tag {
|
||||
|
||||
generic_reader_c *reader;
|
||||
|
||||
track_info_t *ti;
|
||||
track_info_c *ti;
|
||||
} filelist_t;
|
||||
|
||||
typedef struct {
|
||||
@ -636,7 +636,7 @@ static void parse_sync(char *s, audio_sync_t &async, const char *opt) {
|
||||
async.displacement = atoi(s);
|
||||
}
|
||||
|
||||
static void parse_aspect_ratio(char *s, const char *opt, track_info_t &ti) {
|
||||
static void parse_aspect_ratio(char *s, const char *opt, track_info_c &ti) {
|
||||
char *div, *c;
|
||||
float w, h;
|
||||
string orig = s;
|
||||
@ -678,7 +678,7 @@ static void parse_aspect_ratio(char *s, const char *opt, track_info_t &ti) {
|
||||
ti.display_properties->push_back(dprop);
|
||||
}
|
||||
|
||||
static void parse_display_dimensions(char *s, track_info_t &ti) {
|
||||
static void parse_display_dimensions(char *s, track_info_c &ti) {
|
||||
char *x, *c;
|
||||
string orig = s;
|
||||
int w, h;
|
||||
@ -906,7 +906,7 @@ static void parse_tags(char *s, tags_t &tags, const char *opt) {
|
||||
tags.file_name = s;
|
||||
}
|
||||
|
||||
static void parse_fourcc(char *s, const char *opt, track_info_t &ti) {
|
||||
static void parse_fourcc(char *s, const char *opt, track_info_c &ti) {
|
||||
char *c;
|
||||
string orig = s;
|
||||
fourcc_t fourcc;
|
||||
@ -1181,27 +1181,9 @@ static void create_readers() {
|
||||
// {{{ FUNCTION identify(const char *filename)
|
||||
|
||||
static void identify(const char *filename) {
|
||||
track_info_t ti;
|
||||
track_info_c ti;
|
||||
filelist_t *file;
|
||||
|
||||
memset(&ti, 0, sizeof(track_info_t));
|
||||
ti.audio_syncs = new vector<audio_sync_t>;
|
||||
ti.cue_creations = new vector<cue_creation_t>;
|
||||
ti.default_track_flags = new vector<int64_t>;
|
||||
ti.languages = new vector<language_t>;
|
||||
ti.sub_charsets = new vector<language_t>;
|
||||
ti.all_tags = new vector<tags_t>;
|
||||
ti.aspect_ratio = 0.0;
|
||||
ti.atracks = new vector<int64_t>;
|
||||
ti.vtracks = new vector<int64_t>;
|
||||
ti.stracks = new vector<int64_t>;
|
||||
ti.aac_is_sbr = new vector<int64_t>;
|
||||
ti.compression_list = new vector<cue_creation_t>;
|
||||
ti.track_names = new vector<language_t>;
|
||||
ti.all_ext_timecodes = new vector<language_t>;
|
||||
ti.all_fourccs = new vector<fourcc_t>;
|
||||
ti.display_properties = new vector<display_properties_t>;
|
||||
|
||||
file = (filelist_t *)safemalloc(sizeof(filelist_t));
|
||||
|
||||
file->name = safestrdup(filename);
|
||||
@ -1217,7 +1199,7 @@ static void identify(const char *filename) {
|
||||
file->fp = NULL;
|
||||
file->status = EMOREDATA;
|
||||
file->pack = NULL;
|
||||
file->ti = duplicate_track_info(&ti);
|
||||
file->ti = new track_info_c(ti);
|
||||
|
||||
files.push_back(file);
|
||||
|
||||
@ -1233,7 +1215,7 @@ static void identify(const char *filename) {
|
||||
// {{{ FUNCTION parse_args(int argc, char **argv)
|
||||
|
||||
static void parse_args(int argc, char **argv) {
|
||||
track_info_t ti;
|
||||
track_info_c *ti;
|
||||
int i, j, cc_command_line;
|
||||
filelist_t *file;
|
||||
char *s, *this_arg, *next_arg;
|
||||
@ -1245,23 +1227,7 @@ static void parse_args(int argc, char **argv) {
|
||||
tags_t tags;
|
||||
mm_io_c *io;
|
||||
|
||||
memset(&ti, 0, sizeof(track_info_t));
|
||||
ti.audio_syncs = new vector<audio_sync_t>;
|
||||
ti.cue_creations = new vector<cue_creation_t>;
|
||||
ti.default_track_flags = new vector<int64_t>;
|
||||
ti.languages = new vector<language_t>;
|
||||
ti.sub_charsets = new vector<language_t>;
|
||||
ti.all_tags = new vector<tags_t>;
|
||||
ti.aac_is_sbr = new vector<int64_t>;
|
||||
ti.aspect_ratio = 0.0;
|
||||
ti.atracks = new vector<int64_t>;
|
||||
ti.vtracks = new vector<int64_t>;
|
||||
ti.stracks = new vector<int64_t>;
|
||||
ti.compression_list = new vector<cue_creation_t>;
|
||||
ti.track_names = new vector<language_t>;
|
||||
ti.all_ext_timecodes = new vector<language_t>;
|
||||
ti.all_fourccs = new vector<fourcc_t>;
|
||||
ti.display_properties = new vector<display_properties_t>;
|
||||
ti = new track_info_c;
|
||||
attachment = (attachment_t *)safemalloc(sizeof(attachment_t));
|
||||
memset(attachment, 0, sizeof(attachment_t));
|
||||
memset(&tags, 0, sizeof(tags_t));
|
||||
@ -1607,13 +1573,13 @@ static void parse_args(int argc, char **argv) {
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--no-chapters")) {
|
||||
ti.no_chapters = true;
|
||||
ti->no_chapters = true;
|
||||
|
||||
} else if (!strcmp(this_arg, "--no-attachments")) {
|
||||
ti.no_attachments = true;
|
||||
ti->no_attachments = true;
|
||||
|
||||
} else if (!strcmp(this_arg, "--no-tags")) {
|
||||
ti.no_tags = true;
|
||||
ti->no_tags = true;
|
||||
|
||||
} else if (!strcmp(this_arg, "--dump-packets")) {
|
||||
if (next_arg == NULL)
|
||||
@ -1633,54 +1599,54 @@ static void parse_args(int argc, char **argv) {
|
||||
|
||||
// Options that apply to the next input file only.
|
||||
else if (!strcmp(this_arg, "-A") || !strcmp(this_arg, "--noaudio"))
|
||||
ti.no_audio = true;
|
||||
ti->no_audio = true;
|
||||
|
||||
else if (!strcmp(this_arg, "-D") || !strcmp(this_arg, "--novideo"))
|
||||
ti.no_video = true;
|
||||
ti->no_video = true;
|
||||
|
||||
else if (!strcmp(this_arg, "-S") || !strcmp(this_arg, "--nosubs"))
|
||||
ti.no_subs = true;
|
||||
ti->no_subs = true;
|
||||
|
||||
else if (!strcmp(this_arg, "-a") || !strcmp(this_arg, "--atracks")) {
|
||||
if (next_arg == NULL)
|
||||
mxerror("'%s' lacks the stream number(s).\n", this_arg);
|
||||
|
||||
parse_tracks(next_arg, ti.atracks, this_arg);
|
||||
parse_tracks(next_arg, ti->atracks, this_arg);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "-d") || !strcmp(this_arg, "--vtracks")) {
|
||||
if (next_arg == NULL)
|
||||
mxerror("'%s' lacks the stream number(s).\n", this_arg);
|
||||
|
||||
parse_tracks(next_arg, ti.vtracks, this_arg);
|
||||
parse_tracks(next_arg, ti->vtracks, this_arg);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "-s") || !strcmp(this_arg, "--stracks")) {
|
||||
if (next_arg == NULL)
|
||||
mxerror("'%s' lacks the stream number(s).\n", this_arg);
|
||||
|
||||
parse_tracks(next_arg, ti.stracks, this_arg);
|
||||
parse_tracks(next_arg, ti->stracks, this_arg);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "-f") || !strcmp(this_arg, "--fourcc")) {
|
||||
if (next_arg == NULL)
|
||||
mxerror("'%s' lacks the FourCC.\n", this_arg);
|
||||
|
||||
parse_fourcc(next_arg, this_arg, ti);
|
||||
parse_fourcc(next_arg, this_arg, *ti);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--aspect-ratio")) {
|
||||
if (next_arg == NULL)
|
||||
mxerror("'--aspect-ratio' lacks the aspect ratio.\n");
|
||||
|
||||
parse_aspect_ratio(next_arg, this_arg, ti);
|
||||
parse_aspect_ratio(next_arg, this_arg, *ti);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--display-dimensions")) {
|
||||
if (next_arg == NULL)
|
||||
mxerror("'--display-dimensions' lacks the dimensions.\n");
|
||||
|
||||
parse_display_dimensions(next_arg, ti);
|
||||
parse_display_dimensions(next_arg, *ti);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "-y") || !strcmp(this_arg, "--sync")) {
|
||||
@ -1688,7 +1654,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'%s' lacks the audio delay.\n", this_arg);
|
||||
|
||||
parse_sync(next_arg, async, this_arg);
|
||||
ti.audio_syncs->push_back(async);
|
||||
ti->audio_syncs->push_back(async);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--cues")) {
|
||||
@ -1696,7 +1662,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'--cues' lacks its argument.\n");
|
||||
|
||||
parse_cues(next_arg, cues);
|
||||
ti.cue_creations->push_back(cues);
|
||||
ti->cue_creations->push_back(cues);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--default-track")) {
|
||||
@ -1707,7 +1673,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("Invalid track ID specified in '%s %s'.\n", this_arg,
|
||||
next_arg);
|
||||
|
||||
ti.default_track_flags->push_back(id);
|
||||
ti->default_track_flags->push_back(id);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--language")) {
|
||||
@ -1715,7 +1681,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'--language' lacks its argument.\n");
|
||||
|
||||
parse_language(next_arg, lang, "language", "language", true);
|
||||
ti.languages->push_back(lang);
|
||||
ti->languages->push_back(lang);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--sub-charset")) {
|
||||
@ -1723,7 +1689,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'--sub-charset' lacks its argument.\n");
|
||||
|
||||
parse_sub_charset(next_arg, lang);
|
||||
ti.sub_charsets->push_back(lang);
|
||||
ti->sub_charsets->push_back(lang);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "-t") || !strcmp(this_arg, "--tags")) {
|
||||
@ -1731,7 +1697,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'%s' lacks its argument.\n", this_arg);
|
||||
|
||||
parse_tags(next_arg, tags, this_arg);
|
||||
ti.all_tags->push_back(tags);
|
||||
ti->all_tags->push_back(tags);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--aac-is-sbr")) {
|
||||
@ -1742,7 +1708,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("Invalid track ID specified in '%s %s'.\n", this_arg,
|
||||
next_arg);
|
||||
|
||||
ti.aac_is_sbr->push_back(id);
|
||||
ti->aac_is_sbr->push_back(id);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--compression")) {
|
||||
@ -1750,7 +1716,7 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'--compression' lacks its argument.\n");
|
||||
|
||||
parse_compression(next_arg, cues);
|
||||
ti.compression_list->push_back(cues);
|
||||
ti->compression_list->push_back(cues);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--track-name")) {
|
||||
@ -1759,7 +1725,7 @@ static void parse_args(int argc, char **argv) {
|
||||
|
||||
parse_language(next_arg, lang, "track-name", "track name", false);
|
||||
lang.language = to_utf8(cc_command_line, lang.language);
|
||||
ti.track_names->push_back(lang);
|
||||
ti->track_names->push_back(lang);
|
||||
i++;
|
||||
|
||||
} else if (!strcmp(this_arg, "--timecodes")) {
|
||||
@ -1767,27 +1733,27 @@ static void parse_args(int argc, char **argv) {
|
||||
mxerror("'--timecodes' lacks its argument.\n");
|
||||
|
||||
parse_language(next_arg, lang, "timecodes", "timecodes", false);
|
||||
ti.all_ext_timecodes->push_back(lang);
|
||||
ti->all_ext_timecodes->push_back(lang);
|
||||
i++;
|
||||
|
||||
}
|
||||
|
||||
// The argument is an input file.
|
||||
else {
|
||||
if ((ti.atracks->size() != 0) && ti.no_audio)
|
||||
if ((ti->atracks->size() != 0) && ti->no_audio)
|
||||
mxerror("'-A' and '-a' used on the same source file.\n");
|
||||
|
||||
if ((ti.vtracks->size() != 0) && ti.no_video)
|
||||
if ((ti->vtracks->size() != 0) && ti->no_video)
|
||||
mxerror("'-D' and '-d' used on the same source file.\n");
|
||||
|
||||
if ((ti.stracks->size() != 0) && ti.no_subs)
|
||||
if ((ti->stracks->size() != 0) && ti->no_subs)
|
||||
mxerror("'-S' and '-s' used on the same source file.\n");
|
||||
|
||||
file = (filelist_t *)safemalloc(sizeof(filelist_t));
|
||||
|
||||
file->name = this_arg;
|
||||
file->name = safestrdup(this_arg);
|
||||
file->type = get_type(file->name);
|
||||
ti.fname = this_arg;
|
||||
ti->fname = safestrdup(this_arg);
|
||||
|
||||
if (file->type == TYPEUNKNOWN)
|
||||
mxerror("File '%s' has unknown type. Please have a look "
|
||||
@ -1799,46 +1765,13 @@ static void parse_args(int argc, char **argv) {
|
||||
if (file->type != TYPECHAPTERS) {
|
||||
file->status = EMOREDATA;
|
||||
file->pack = NULL;
|
||||
file->ti = duplicate_track_info(&ti);
|
||||
file->ti = ti;
|
||||
|
||||
files.push_back(file);
|
||||
} else
|
||||
safefree(file);
|
||||
|
||||
delete ti.atracks;
|
||||
delete ti.vtracks;
|
||||
delete ti.stracks;
|
||||
delete ti.audio_syncs;
|
||||
delete ti.cue_creations;
|
||||
delete ti.default_track_flags;
|
||||
delete ti.languages;
|
||||
delete ti.sub_charsets;
|
||||
delete ti.all_tags;
|
||||
delete ti.aac_is_sbr;
|
||||
delete ti.compression_list;
|
||||
for (j = 0; j < ti.track_names->size(); j++)
|
||||
safefree((*ti.track_names)[j].language);
|
||||
delete ti.track_names;
|
||||
delete ti.all_ext_timecodes;
|
||||
delete ti.all_fourccs;
|
||||
delete ti.display_properties;
|
||||
memset(&ti, 0, sizeof(track_info_t));
|
||||
ti.audio_syncs = new vector<audio_sync_t>;
|
||||
ti.cue_creations = new vector<cue_creation_t>;
|
||||
ti.default_track_flags = new vector<int64_t>;
|
||||
ti.languages = new vector<language_t>;
|
||||
ti.sub_charsets = new vector<language_t>;
|
||||
ti.all_tags = new vector<tags_t>;
|
||||
ti.aac_is_sbr = new vector<int64_t>;
|
||||
ti.aspect_ratio = 0.0;
|
||||
ti.atracks = new vector<int64_t>;
|
||||
ti.vtracks = new vector<int64_t>;
|
||||
ti.stracks = new vector<int64_t>;
|
||||
ti.compression_list = new vector<cue_creation_t>;
|
||||
ti.track_names = new vector<language_t>;
|
||||
ti.all_ext_timecodes = new vector<language_t>;
|
||||
ti.all_fourccs = new vector<fourcc_t>;
|
||||
ti.display_properties = new vector<display_properties_t>;
|
||||
ti = new track_info_c;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1862,23 +1795,7 @@ static void parse_args(int argc, char **argv) {
|
||||
attachment_sizes_others += attachments[i]->size;
|
||||
}
|
||||
|
||||
delete ti.audio_syncs;
|
||||
delete ti.cue_creations;
|
||||
delete ti.default_track_flags;
|
||||
delete ti.languages;
|
||||
delete ti.sub_charsets;
|
||||
delete ti.all_tags;
|
||||
delete ti.aac_is_sbr;
|
||||
delete ti.atracks;
|
||||
delete ti.vtracks;
|
||||
delete ti.stracks;
|
||||
delete ti.compression_list;
|
||||
for (j = 0; j < ti.track_names->size(); j++)
|
||||
safefree((*ti.track_names)[j].language);
|
||||
delete ti.track_names;
|
||||
delete ti.all_ext_timecodes;
|
||||
delete ti.all_fourccs;
|
||||
delete ti.display_properties;
|
||||
delete ti;
|
||||
safefree(attachment);
|
||||
}
|
||||
|
||||
@ -2013,7 +1930,7 @@ static void cleanup() {
|
||||
|
||||
while (files.size()) {
|
||||
file = files[files.size() - 1];
|
||||
free_track_info(file->ti);
|
||||
delete file->ti;
|
||||
safefree(file);
|
||||
files.pop_back();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ using namespace libmatroska;
|
||||
aac_packetizer_c::aac_packetizer_c(generic_reader_c *nreader, int nid,
|
||||
int nprofile,
|
||||
unsigned long nsamples_per_sec,
|
||||
int nchannels, track_info_t *nti,
|
||||
int nchannels, track_info_c *nti,
|
||||
bool nemphasis_present,
|
||||
bool nheaderless)
|
||||
throw (error_c): generic_packetizer_c(nreader, nti) {
|
||||
|
@ -48,7 +48,7 @@ private:
|
||||
public:
|
||||
aac_packetizer_c(generic_reader_c *nreader, int nid, int nprofile,
|
||||
unsigned long nsamples_per_sec, int nchannels,
|
||||
track_info_t *nti, bool emphasis_present,
|
||||
track_info_c *nti, bool emphasis_present,
|
||||
bool nheaderless = false) throw (error_c);
|
||||
virtual ~aac_packetizer_c();
|
||||
|
||||
|
@ -33,7 +33,7 @@ using namespace libmatroska;
|
||||
|
||||
ac3_packetizer_c::ac3_packetizer_c(generic_reader_c *nreader,
|
||||
unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbsid, track_info_t *nti)
|
||||
int nchannels, int nbsid, track_info_c *nti)
|
||||
throw (error_c): generic_packetizer_c(nreader, nti) {
|
||||
packetno = 0;
|
||||
bytes_output = 0;
|
||||
@ -159,7 +159,7 @@ void ac3_packetizer_c::dump_debug_info() {
|
||||
ac3_bs_packetizer_c::ac3_bs_packetizer_c(generic_reader_c *nreader,
|
||||
unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbsid,
|
||||
track_info_t *nti)
|
||||
track_info_c *nti)
|
||||
throw (error_c): ac3_packetizer_c(nreader, nsamples_per_sec, nchannels,
|
||||
nbsid, nti) {
|
||||
bsb_present = false;
|
||||
|
@ -37,7 +37,7 @@ protected:
|
||||
|
||||
public:
|
||||
ac3_packetizer_c(generic_reader_c *nreader, unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbsid, track_info_t *nti)
|
||||
int nchannels, int nbsid, track_info_c *nti)
|
||||
throw (error_c);
|
||||
virtual ~ac3_packetizer_c();
|
||||
|
||||
@ -62,7 +62,7 @@ protected:
|
||||
public:
|
||||
ac3_bs_packetizer_c(generic_reader_c *nreader,
|
||||
unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbsid, track_info_t *nti)
|
||||
int nchannels, int nbsid, track_info_c *nti)
|
||||
throw (error_c);
|
||||
|
||||
protected:
|
||||
|
@ -86,7 +86,7 @@ bool operator!=(const dts_header_t &l, const dts_header_t &r) {
|
||||
|
||||
dts_packetizer_c::dts_packetizer_c(generic_reader_c *nreader,
|
||||
const dts_header_t &dtsheader,
|
||||
track_info_t *nti)
|
||||
track_info_c *nti)
|
||||
throw (error_c): generic_packetizer_c(nreader, nti) {
|
||||
//packetno = 0;
|
||||
samples_written = 0;
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
bool skipping_is_normal;
|
||||
|
||||
dts_packetizer_c(generic_reader_c *nreader, const dts_header_t &dts_header,
|
||||
track_info_t *nti) throw (error_c);
|
||||
track_info_c *nti) throw (error_c);
|
||||
virtual ~dts_packetizer_c();
|
||||
|
||||
virtual int process(unsigned char *buf, int size, int64_t timecode = -1,
|
||||
|
@ -43,7 +43,7 @@ flac_packetizer_c::flac_packetizer_c(generic_reader_c *nreader,
|
||||
int nsample_rate, int nchannels,
|
||||
int nbits_per_sample,
|
||||
unsigned char *nheader, int nl_header,
|
||||
track_info_t *nti)
|
||||
track_info_c *nti)
|
||||
throw (error_c): generic_packetizer_c(nreader, nti) {
|
||||
last_timecode = 0;
|
||||
sample_rate = nsample_rate;
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
flac_packetizer_c(generic_reader_c *nreader,
|
||||
int nsample_rate, int nchannels, int nbits_per_sample,
|
||||
unsigned char *nheader, int nl_header,
|
||||
track_info_t *nti) throw (error_c);
|
||||
track_info_c *nti) throw (error_c);
|
||||
virtual ~flac_packetizer_c();
|
||||
|
||||
virtual int process(unsigned char *data, int size, int64_t timecode = -1,
|
||||
|
@ -33,7 +33,7 @@ using namespace libmatroska;
|
||||
|
||||
mp3_packetizer_c::mp3_packetizer_c(generic_reader_c *nreader,
|
||||
unsigned long nsamples_per_sec,
|
||||
int nchannels, track_info_t *nti)
|
||||
int nchannels, track_info_c *nti)
|
||||
throw (error_c):
|
||||
generic_packetizer_c(nreader, nti), byte_buffer(128 * 1024) {
|
||||
samples_per_sec = nsamples_per_sec;
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
|
||||
public:
|
||||
mp3_packetizer_c(generic_reader_c *nreader, unsigned long nsamples_per_sec,
|
||||
int nchannels, track_info_t *nti)
|
||||
int nchannels, track_info_c *nti)
|
||||
throw (error_c);
|
||||
virtual ~mp3_packetizer_c();
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
using namespace libmatroska;
|
||||
|
||||
passthrough_packetizer_c::passthrough_packetizer_c(generic_reader_c *nreader,
|
||||
track_info_t *nti)
|
||||
track_info_c *nti)
|
||||
throw (error_c):
|
||||
generic_packetizer_c(nreader, nti) {
|
||||
packets_processed = 0;
|
||||
|
@ -32,7 +32,7 @@ private:
|
||||
bool sync_to_keyframe;
|
||||
|
||||
public:
|
||||
passthrough_packetizer_c(generic_reader_c *nreader, track_info_t *nti)
|
||||
passthrough_packetizer_c(generic_reader_c *nreader, track_info_c *nti)
|
||||
throw (error_c);
|
||||
|
||||
virtual int process(unsigned char *buf, int size, int64_t timecode = -1,
|
||||
|
@ -34,7 +34,7 @@ using namespace libmatroska;
|
||||
pcm_packetizer_c::pcm_packetizer_c(generic_reader_c *nreader,
|
||||
unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbits_per_sample,
|
||||
track_info_t *nti, bool nbig_endian)
|
||||
track_info_c *nti, bool nbig_endian)
|
||||
throw (error_c):
|
||||
generic_packetizer_c(nreader, nti) {
|
||||
packetno = 0;
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
|
||||
public:
|
||||
pcm_packetizer_c(generic_reader_c *nreader, unsigned long nsamples_per_sec,
|
||||
int nchannels, int nbits_per_sample, track_info_t *nti,
|
||||
int nchannels, int nbits_per_sample, track_info_c *nti,
|
||||
bool nbig_endian = false)
|
||||
throw (error_c);
|
||||
virtual ~pcm_packetizer_c();
|
||||
|
@ -34,7 +34,7 @@ textsubs_packetizer_c::textsubs_packetizer_c(generic_reader_c *nreader,
|
||||
const char *ncodec_id,
|
||||
const void *nglobal_data,
|
||||
int nglobal_size, bool nrecode,
|
||||
bool is_utf8, track_info_t *nti)
|
||||
bool is_utf8, track_info_c *nti)
|
||||
throw (error_c): generic_packetizer_c(nreader, nti) {
|
||||
packetno = 0;
|
||||
recode = nrecode;
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
public:
|
||||
textsubs_packetizer_c(generic_reader_c *nreader, const char *ncodec_id,
|
||||
const void *nglobal_data, int nglobal_size,
|
||||
bool nrecode, bool is_utf8, track_info_t *nti)
|
||||
bool nrecode, bool is_utf8, track_info_c *nti)
|
||||
throw (error_c);
|
||||
virtual ~textsubs_packetizer_c();
|
||||
|
||||
|
@ -40,7 +40,7 @@ video_packetizer_c::video_packetizer_c(generic_reader_c *nreader,
|
||||
const char *ncodec_id,
|
||||
double nfps, int nwidth,
|
||||
int nheight, bool nbframes,
|
||||
track_info_t *nti)
|
||||
track_info_c *nti)
|
||||
throw (error_c) : generic_packetizer_c(nreader, nti) {
|
||||
fps = nfps;
|
||||
width = nwidth;
|
||||
|
@ -41,7 +41,7 @@ private:
|
||||
public:
|
||||
video_packetizer_c(generic_reader_c *nreader, const char *ncodec_id,
|
||||
double nfps, int nwidth, int nheight, bool nbframes,
|
||||
track_info_t *nti)
|
||||
track_info_c *nti)
|
||||
throw (error_c);
|
||||
virtual ~video_packetizer_c();
|
||||
|
||||
|
@ -40,7 +40,7 @@ vobsub_packetizer_c::vobsub_packetizer_c(generic_reader_c *nreader,
|
||||
const void *nidx_data,
|
||||
int nidx_data_size,
|
||||
bool nextract_from_mpeg,
|
||||
track_info_t *nti) throw (error_c):
|
||||
track_info_c *nti) throw (error_c):
|
||||
generic_packetizer_c(nreader, nti) {
|
||||
|
||||
idx_data = (unsigned char *)safememdup(nidx_data, nidx_data_size);
|
||||
|
@ -37,7 +37,7 @@ private:
|
||||
public:
|
||||
vobsub_packetizer_c(generic_reader_c *nreader,
|
||||
const void *nidx_data, int nidx_data_size,
|
||||
bool nextract_from_mpeg, track_info_t *nti)
|
||||
bool nextract_from_mpeg, track_info_c *nti)
|
||||
throw (error_c);
|
||||
virtual ~vobsub_packetizer_c();
|
||||
|
||||
|
@ -43,7 +43,7 @@ vorbis_packetizer_c::vorbis_packetizer_c(generic_reader_c *nreader,
|
||||
unsigned char *d_comments,
|
||||
int l_comments,
|
||||
unsigned char *d_codecsetup,
|
||||
int l_codecsetup, track_info_t *nti)
|
||||
int l_codecsetup, track_info_c *nti)
|
||||
throw (error_c): generic_packetizer_c(nreader, nti) {
|
||||
int i;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
unsigned char *d_header, int l_header,
|
||||
unsigned char *d_comments, int l_comments,
|
||||
unsigned char *d_codecsetup, int l_codecsetup,
|
||||
track_info_t *nti) throw (error_c);
|
||||
track_info_c *nti) throw (error_c);
|
||||
virtual ~vorbis_packetizer_c();
|
||||
|
||||
virtual int process(unsigned char *data, int size, int64_t timecode = -1,
|
||||
|
@ -37,7 +37,7 @@
|
||||
using namespace std;
|
||||
|
||||
generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
track_info_t *nti) throw(error_c) {
|
||||
track_info_c *nti) throw(error_c) {
|
||||
int i;
|
||||
audio_sync_t *as;
|
||||
cue_creation_t *cc;
|
||||
@ -56,7 +56,7 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
duplicate_data = true;
|
||||
|
||||
track_entry = NULL;
|
||||
ti = duplicate_track_info(nti);
|
||||
ti = new track_info_c(*nti);
|
||||
free_refs = -1;
|
||||
enqueued_bytes = 0;
|
||||
safety_last_timecode = 0;
|
||||
@ -224,7 +224,7 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader,
|
||||
}
|
||||
|
||||
generic_packetizer_c::~generic_packetizer_c() {
|
||||
free_track_info(ti);
|
||||
delete ti;
|
||||
|
||||
safefree(hcodec_id);
|
||||
safefree(hcodec_private);
|
||||
@ -926,12 +926,12 @@ void generic_packetizer_c::displace(float by_ms) {
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
generic_reader_c::generic_reader_c(track_info_t *nti) {
|
||||
ti = duplicate_track_info(nti);
|
||||
generic_reader_c::generic_reader_c(track_info_c *nti) {
|
||||
ti = new track_info_c(*nti);
|
||||
}
|
||||
|
||||
generic_reader_c::~generic_reader_c() {
|
||||
free_track_info(ti);
|
||||
delete ti;
|
||||
}
|
||||
|
||||
bool generic_reader_c::demuxing_requested(char type, int64_t id) {
|
||||
@ -967,98 +967,168 @@ bool generic_reader_c::demuxing_requested(char type, int64_t id) {
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
track_info_t *duplicate_track_info(track_info_t *src) {
|
||||
track_info_t *dst;
|
||||
int i;
|
||||
track_info_c::track_info_c():
|
||||
initialized(true),
|
||||
id(0), fname(NULL),
|
||||
no_audio(false), no_video(false), no_subs(false),
|
||||
private_data(NULL), private_size(0),
|
||||
aspect_ratio(0.0), display_width(0), display_height(0),
|
||||
aspect_ratio_given(false), display_dimensions_given(false),
|
||||
cues(0), default_track(false), language(NULL), sub_charset(NULL),
|
||||
tags_ptr(NULL), tags(NULL),
|
||||
compression(COMPRESSION_NONE),
|
||||
track_name(NULL), ext_timecodes(NULL),
|
||||
no_chapters(false), no_attachments(false), no_tags(false) {
|
||||
atracks = new vector<int64_t>;
|
||||
vtracks = new vector<int64_t>;
|
||||
stracks = new vector<int64_t>;
|
||||
|
||||
if (src == NULL)
|
||||
return NULL;
|
||||
|
||||
dst = (track_info_t *)safememdup(src, sizeof(track_info_t));
|
||||
dst->fname = safestrdup(src->fname);
|
||||
dst->atracks = new vector<int64_t>(*src->atracks);
|
||||
dst->vtracks = new vector<int64_t>(*src->vtracks);
|
||||
dst->stracks = new vector<int64_t>(*src->stracks);
|
||||
dst->audio_syncs = new vector<audio_sync_t>(*src->audio_syncs);
|
||||
dst->cue_creations = new vector<cue_creation_t>(*src->cue_creations);
|
||||
dst->default_track_flags = new vector<int64_t>(*src->default_track_flags);
|
||||
dst->languages = new vector<language_t>(*src->languages);
|
||||
for (i = 0; i < src->languages->size(); i++)
|
||||
(*dst->languages)[i].language = safestrdup((*src->languages)[i].language);
|
||||
dst->language = safestrdup(src->language);
|
||||
dst->sub_charsets = new vector<language_t>(*src->sub_charsets);
|
||||
for (i = 0; i < src->sub_charsets->size(); i++)
|
||||
(*dst->sub_charsets)[i].language =
|
||||
safestrdup((*src->sub_charsets)[i].language);
|
||||
dst->sub_charset = safestrdup(src->sub_charset);
|
||||
dst->all_tags = new vector<tags_t>(*src->all_tags);
|
||||
for (i = 0; i < src->all_tags->size(); i++)
|
||||
(*dst->all_tags)[i].file_name = safestrdup((*src->all_tags)[i].file_name);
|
||||
dst->aac_is_sbr = new vector<int64_t>(*src->aac_is_sbr);
|
||||
dst->private_data = (unsigned char *)safememdup(src->private_data,
|
||||
src->private_size);
|
||||
dst->compression_list = new vector<cue_creation_t>(*src->compression_list);
|
||||
dst->track_names = new vector<language_t>(*src->track_names);
|
||||
for (i = 0; i < src->track_names->size(); i++)
|
||||
(*dst->track_names)[i].language =
|
||||
safestrdup((*src->track_names)[i].language);
|
||||
dst->track_name = safestrdup(src->track_name);
|
||||
dst->all_ext_timecodes = new vector<language_t>(*src->all_ext_timecodes);
|
||||
for (i = 0; i < src->all_ext_timecodes->size(); i++)
|
||||
(*dst->all_ext_timecodes)[i].language =
|
||||
safestrdup((*src->all_ext_timecodes)[i].language);
|
||||
dst->ext_timecodes = safestrdup(src->ext_timecodes);
|
||||
dst->tags = NULL;
|
||||
dst->all_fourccs = new vector<fourcc_t>(*src->all_fourccs);
|
||||
dst->fourcc[0] = 0;
|
||||
dst->display_properties =
|
||||
new vector<display_properties_t>(*src->display_properties);
|
||||
dst->aspect_ratio_given = false;
|
||||
dst->display_dimensions_given = false;
|
||||
|
||||
return dst;
|
||||
all_fourccs = new vector<fourcc_t>;
|
||||
memset(fourcc, 0, 5);
|
||||
display_properties = new vector<display_properties_t>;
|
||||
audio_syncs = new vector<audio_sync_t>;
|
||||
cue_creations = new vector<cue_creation_t>;
|
||||
default_track_flags = new vector<int64_t>;
|
||||
languages = new vector<language_t>;
|
||||
sub_charsets = new vector<language_t>;
|
||||
all_tags = new vector<tags_t>;
|
||||
aac_is_sbr = new vector<int64_t>;
|
||||
compression_list = new vector<cue_creation_t>;
|
||||
track_names = new vector<language_t>;
|
||||
all_ext_timecodes = new vector<language_t>;
|
||||
}
|
||||
|
||||
void free_track_info(track_info_t *ti) {
|
||||
int i;
|
||||
track_info_c::track_info_c(const track_info_c &src):
|
||||
initialized(false) {
|
||||
*this = src;
|
||||
}
|
||||
|
||||
if (ti == NULL)
|
||||
track_info_c::~track_info_c() {
|
||||
free_contents();
|
||||
}
|
||||
|
||||
void track_info_c::free_contents() {
|
||||
uint32_t i;
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
safefree(ti->fname);
|
||||
delete ti->atracks;
|
||||
delete ti->vtracks;
|
||||
delete ti->stracks;
|
||||
delete ti->audio_syncs;
|
||||
delete ti->cue_creations;
|
||||
delete ti->default_track_flags;
|
||||
for (i = 0; i < ti->languages->size(); i++)
|
||||
safefree((*ti->languages)[i].language);
|
||||
delete ti->languages;
|
||||
safefree(ti->language);
|
||||
for (i = 0; i < ti->sub_charsets->size(); i++)
|
||||
safefree((*ti->sub_charsets)[i].language);
|
||||
delete ti->sub_charsets;
|
||||
safefree(ti->sub_charset);
|
||||
for (i = 0; i < ti->all_tags->size(); i++)
|
||||
safefree((*ti->all_tags)[i].file_name);
|
||||
delete ti->all_tags;
|
||||
delete ti->aac_is_sbr;
|
||||
delete ti->compression_list;
|
||||
for (i = 0; i < ti->track_names->size(); i++)
|
||||
safefree((*ti->track_names)[i].language);
|
||||
delete ti->track_names;
|
||||
safefree(ti->track_name);
|
||||
for (i = 0; i < ti->all_ext_timecodes->size(); i++)
|
||||
safefree((*ti->all_ext_timecodes)[i].language);
|
||||
delete ti->all_ext_timecodes;
|
||||
safefree(ti->ext_timecodes);
|
||||
safefree(ti->private_data);
|
||||
if (ti->tags != NULL)
|
||||
delete ti->tags;
|
||||
delete ti->all_fourccs;
|
||||
delete ti->display_properties;
|
||||
safefree(ti);
|
||||
safefree(fname);
|
||||
delete atracks;
|
||||
delete vtracks;
|
||||
delete stracks;
|
||||
delete audio_syncs;
|
||||
delete cue_creations;
|
||||
delete default_track_flags;
|
||||
for (i = 0; i < languages->size(); i++)
|
||||
safefree((*languages)[i].language);
|
||||
delete languages;
|
||||
safefree(language);
|
||||
for (i = 0; i < sub_charsets->size(); i++)
|
||||
safefree((*sub_charsets)[i].language);
|
||||
delete sub_charsets;
|
||||
safefree(sub_charset);
|
||||
for (i = 0; i < all_tags->size(); i++)
|
||||
safefree((*all_tags)[i].file_name);
|
||||
delete all_tags;
|
||||
delete aac_is_sbr;
|
||||
delete compression_list;
|
||||
for (i = 0; i < track_names->size(); i++)
|
||||
safefree((*track_names)[i].language);
|
||||
delete track_names;
|
||||
safefree(track_name);
|
||||
for (i = 0; i < all_ext_timecodes->size(); i++)
|
||||
safefree((*all_ext_timecodes)[i].language);
|
||||
delete all_ext_timecodes;
|
||||
safefree(ext_timecodes);
|
||||
safefree(private_data);
|
||||
if (tags != NULL)
|
||||
delete tags;
|
||||
delete all_fourccs;
|
||||
delete display_properties;
|
||||
|
||||
initialized = false;
|
||||
}
|
||||
|
||||
track_info_c &track_info_c::operator =(const track_info_c &src) {
|
||||
uint32_t i;
|
||||
|
||||
free_contents();
|
||||
|
||||
id = src.id;
|
||||
fname = safestrdup(src.fname);
|
||||
|
||||
no_audio = src.no_audio;
|
||||
no_video = src.no_video;
|
||||
no_subs = src.no_subs;
|
||||
|
||||
atracks = new vector<int64_t>(*src.atracks);
|
||||
vtracks = new vector<int64_t>(*src.vtracks);
|
||||
stracks = new vector<int64_t>(*src.stracks);
|
||||
|
||||
private_size = src.private_size;
|
||||
private_data = (unsigned char *)safememdup(src.private_data, private_size);
|
||||
|
||||
all_fourccs = new vector<fourcc_t>(*src.all_fourccs);
|
||||
memcpy(fourcc, src.fourcc, 5);
|
||||
|
||||
display_properties =
|
||||
new vector<display_properties_t>(*src.display_properties);
|
||||
aspect_ratio = src.aspect_ratio;
|
||||
aspect_ratio_given = false;
|
||||
display_dimensions_given = false;
|
||||
|
||||
audio_syncs = new vector<audio_sync_t>(*src.audio_syncs);
|
||||
memcpy(&async, &src.async, sizeof(audio_sync_t));
|
||||
|
||||
cue_creations = new vector<cue_creation_t>(*src.cue_creations);
|
||||
cues = src.cues;
|
||||
|
||||
default_track_flags = new vector<int64_t>(*src.default_track_flags);
|
||||
default_track = src.default_track;
|
||||
|
||||
languages = new vector<language_t>(*src.languages);
|
||||
for (i = 0; i < src.languages->size(); i++)
|
||||
(*languages)[i].language = safestrdup((*src.languages)[i].language);
|
||||
language = safestrdup(src.language);
|
||||
|
||||
sub_charsets = new vector<language_t>(*src.sub_charsets);
|
||||
for (i = 0; i < src.sub_charsets->size(); i++)
|
||||
(*sub_charsets)[i].language =
|
||||
safestrdup((*src.sub_charsets)[i].language);
|
||||
sub_charset = safestrdup(src.sub_charset);
|
||||
|
||||
all_tags = new vector<tags_t>(*src.all_tags);
|
||||
for (i = 0; i < src.all_tags->size(); i++)
|
||||
(*all_tags)[i].file_name = safestrdup((*src.all_tags)[i].file_name);
|
||||
tags_ptr = src.tags_ptr;
|
||||
tags = NULL;
|
||||
// tags = src.tags;
|
||||
|
||||
aac_is_sbr = new vector<int64_t>(*src.aac_is_sbr);
|
||||
|
||||
compression_list = new vector<cue_creation_t>(*src.compression_list);
|
||||
compression = src.compression;
|
||||
|
||||
track_names = new vector<language_t>(*src.track_names);
|
||||
for (i = 0; i < src.track_names->size(); i++)
|
||||
(*track_names)[i].language =
|
||||
safestrdup((*src.track_names)[i].language);
|
||||
track_name = safestrdup(src.track_name);
|
||||
|
||||
all_ext_timecodes = new vector<language_t>(*src.all_ext_timecodes);
|
||||
for (i = 0; i < src.all_ext_timecodes->size(); i++)
|
||||
(*all_ext_timecodes)[i].language =
|
||||
safestrdup((*src.all_ext_timecodes)[i].language);
|
||||
ext_timecodes = safestrdup(src.ext_timecodes);
|
||||
|
||||
no_chapters = src.no_chapters;
|
||||
no_attachments = src.no_attachments;
|
||||
no_tags = src.no_tags;
|
||||
|
||||
initialized = true;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
struct ltstr {
|
||||
@ -1068,7 +1138,7 @@ struct ltstr {
|
||||
};
|
||||
static map<const char *, string, ltstr> pass_data;
|
||||
|
||||
void set_pass_data(track_info_t *ti, unsigned char *data, int size) {
|
||||
void set_pass_data(track_info_c *ti, unsigned char *data, int size) {
|
||||
string key, value;
|
||||
|
||||
key = string(ti->fname) + string("::") + to_string(ti->id);
|
||||
@ -1078,7 +1148,7 @@ void set_pass_data(track_info_t *ti, unsigned char *data, int size) {
|
||||
pass_data[key.c_str()] = value;
|
||||
}
|
||||
|
||||
unsigned char *retrieve_pass_data(track_info_t *ti, int &size) {
|
||||
unsigned char *retrieve_pass_data(track_info_c *ti, int &size) {
|
||||
map<const char *, string, ltstr>::iterator it;
|
||||
string key, value;
|
||||
unsigned char *data;
|
||||
|
@ -87,7 +87,10 @@ typedef struct {
|
||||
int64_t id;
|
||||
} fourcc_t;
|
||||
|
||||
typedef struct {
|
||||
class track_info_c {
|
||||
protected:
|
||||
bool initialized;
|
||||
public:
|
||||
// The track ID.
|
||||
int64_t id;
|
||||
|
||||
@ -138,7 +141,15 @@ typedef struct {
|
||||
char *ext_timecodes; // For this very track
|
||||
|
||||
bool no_chapters, no_attachments, no_tags;
|
||||
} track_info_t;
|
||||
|
||||
public:
|
||||
track_info_c();
|
||||
track_info_c(const track_info_c &src);
|
||||
virtual ~track_info_c();
|
||||
|
||||
track_info_c &operator =(const track_info_c &src);
|
||||
virtual void free_contents();
|
||||
};
|
||||
|
||||
class timecode_range_c {
|
||||
public:
|
||||
@ -158,7 +169,7 @@ protected:
|
||||
generic_reader_c *reader;
|
||||
bool duplicate_data;
|
||||
|
||||
track_info_t *ti;
|
||||
track_info_c *ti;
|
||||
int64_t initial_displacement;
|
||||
int64_t free_refs, enqueued_bytes, safety_last_timecode;
|
||||
|
||||
@ -191,7 +202,7 @@ protected:
|
||||
int ext_timecodes_version;
|
||||
|
||||
public:
|
||||
generic_packetizer_c(generic_reader_c *nreader, track_info_t *nti)
|
||||
generic_packetizer_c(generic_reader_c *nreader, track_info_c *nti)
|
||||
throw (error_c);
|
||||
virtual ~generic_packetizer_c();
|
||||
|
||||
@ -272,9 +283,9 @@ protected:
|
||||
|
||||
class generic_reader_c {
|
||||
protected:
|
||||
track_info_t *ti;
|
||||
track_info_c *ti;
|
||||
public:
|
||||
generic_reader_c(track_info_t *nti);
|
||||
generic_reader_c(track_info_c *nti);
|
||||
virtual ~generic_reader_c();
|
||||
virtual int read(generic_packetizer_c *ptzr) = 0;
|
||||
virtual int display_priority() = 0;
|
||||
@ -290,9 +301,9 @@ protected:
|
||||
virtual bool demuxing_requested(char type, int64_t id);
|
||||
};
|
||||
|
||||
track_info_t *duplicate_track_info(track_info_t *src);
|
||||
void free_track_info(track_info_t *ti);
|
||||
void set_pass_data(track_info_t *ti, unsigned char *data, int size);
|
||||
unsigned char *retrieve_pass_data(track_info_t *ti, int &size);
|
||||
track_info_c *duplicate_track_info(track_info_c *src);
|
||||
void free_track_info(track_info_c *ti);
|
||||
void set_pass_data(track_info_c *ti, unsigned char *data, int size);
|
||||
unsigned char *retrieve_pass_data(track_info_c *ti, int &size);
|
||||
|
||||
#endif // __PR_GENERIC_H
|
||||
|
Loading…
Reference in New Issue
Block a user