From c498f384a2f86e030ef2f5ea67bb986df3de9fe3 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 30 Nov 2004 20:12:58 +0000 Subject: [PATCH] Consistent naming of enums. Converted a couple of #define groups to enums. --- src/common/chapter_writer.cpp | 12 ++-- src/common/common.cpp | 26 ++++--- src/common/common.h | 25 ++++--- src/common/compression.cpp | 20 +++--- src/common/compression.h | 30 ++++---- src/common/dts_common.cpp | 28 ++++---- src/common/dts_common.h | 42 +++++------ src/common/tagwriter.cpp | 14 ++-- src/common/xml_element_mapping.cpp | 80 ++++++++++----------- src/common/xml_element_mapping.h | 6 +- src/common/xml_element_parser.cpp | 16 ++--- src/extract/mkvextract.cpp | 4 +- src/extract/mkvextract.h | 2 +- src/extract/tracks.cpp | 68 +++++++++--------- src/info/mkvinfo.cpp | 14 ++-- src/input/r_aac.cpp | 6 +- src/input/r_aac.h | 2 +- src/input/r_ac3.cpp | 6 +- src/input/r_ac3.h | 2 +- src/input/r_avi.cpp | 12 ++-- src/input/r_avi.h | 2 +- src/input/r_dts.cpp | 6 +- src/input/r_dts.h | 2 +- src/input/r_flac.cpp | 10 +-- src/input/r_flac.h | 2 +- src/input/r_matroska.cpp | 18 ++--- src/input/r_matroska.h | 2 +- src/input/r_mp3.cpp | 6 +- src/input/r_mp3.h | 2 +- src/input/r_mpeg.cpp | 8 +-- src/input/r_mpeg.h | 2 +- src/input/r_ogm.cpp | 14 ++-- src/input/r_ogm.h | 2 +- src/input/r_qtmp4.cpp | 14 ++-- src/input/r_qtmp4.h | 2 +- src/input/r_real.cpp | 12 ++-- src/input/r_real.h | 4 +- src/input/r_srt.cpp | 6 +- src/input/r_srt.h | 2 +- src/input/r_ssa.cpp | 6 +- src/input/r_ssa.h | 2 +- src/input/r_tta.cpp | 10 +-- src/input/r_tta.h | 2 +- src/input/r_vobsub.cpp | 8 +-- src/input/r_vobsub.h | 2 +- src/input/r_wav.cpp | 18 ++--- src/input/r_wav.h | 2 +- src/merge/cluster_helper.cpp | 6 +- src/merge/mkvmerge.cpp | 72 +++++++++---------- src/merge/mkvmerge.h | 50 +++++++------- src/merge/output_control.cpp | 107 +++++++++++++++-------------- src/merge/output_control.h | 17 ++--- src/merge/pr_generic.cpp | 18 ++--- src/merge/pr_generic.h | 71 +++++++++++-------- src/mmg/jobs.cpp | 24 +++---- src/mmg/jobs.h | 14 ++-- src/mmg/mmg.cpp | 20 +++--- src/mmg/tab_input.cpp | 32 ++++----- src/output/p_aac.cpp | 8 +-- src/output/p_aac.h | 2 +- src/output/p_ac3.cpp | 4 +- src/output/p_ac3.h | 2 +- src/output/p_dts.cpp | 8 +-- src/output/p_dts.h | 2 +- src/output/p_flac.cpp | 6 +- src/output/p_flac.h | 2 +- src/output/p_mp3.cpp | 4 +- src/output/p_mp3.h | 2 +- src/output/p_passthrough.cpp | 8 +-- src/output/p_passthrough.h | 2 +- src/output/p_pcm.cpp | 6 +- src/output/p_pcm.h | 2 +- src/output/p_realaudio.cpp | 10 +-- src/output/p_realaudio.h | 2 +- src/output/p_textsubs.cpp | 8 +-- src/output/p_textsubs.h | 2 +- src/output/p_tta.cpp | 4 +- src/output/p_tta.h | 2 +- src/output/p_video.cpp | 10 +-- src/output/p_video.h | 2 +- src/output/p_vobsub.cpp | 6 +- src/output/p_vobsub.h | 2 +- src/output/p_vorbis.cpp | 6 +- src/output/p_vorbis.h | 2 +- 84 files changed, 579 insertions(+), 547 deletions(-) diff --git a/src/common/chapter_writer.cpp b/src/common/chapter_writer.cpp index 764ff9288..4f816bbb4 100644 --- a/src/common/chapter_writer.cpp +++ b/src/common/chapter_writer.cpp @@ -253,7 +253,7 @@ write_xml_element_rec(int level, out->printf("<%s>", chapter_elements[elt_idx].name); switch (chapter_elements[elt_idx].type) { - case ebmlt_master: + case EBMLT_MASTER: out->printf("\n"); m = dynamic_cast(e); assert(m != NULL); @@ -277,25 +277,25 @@ write_xml_element_rec(int level, out->printf("\n", chapter_elements[elt_idx].name); break; - case ebmlt_uint: - case ebmlt_bool: + case EBMLT_UINT: + case EBMLT_BOOL: out->printf("%llu\n", uint64(*dynamic_cast(e)), chapter_elements[elt_idx].name); break; - case ebmlt_string: + case EBMLT_STRING: s = escape_xml(string(*dynamic_cast(e))); out->printf("%s\n", s.c_str(), chapter_elements[elt_idx].name); break; - case ebmlt_ustring: + case EBMLT_USTRING: s = UTFstring_to_cstrutf8(UTFstring(*static_cast (e)).c_str()); s = escape_xml(s); out->printf("%s\n", s.c_str(), chapter_elements[elt_idx].name); break; - case ebmlt_time: + case EBMLT_TIME: out->printf(FMT_TIMECODEN "\n", ARG_TIMECODEN(uint64(*dynamic_cast(e))), chapter_elements[elt_idx].name); diff --git a/src/common/common.cpp b/src/common/common.cpp index 5ef87613b..0775d1d13 100644 --- a/src/common/common.cpp +++ b/src/common/common.cpp @@ -695,23 +695,24 @@ static vector ru_numbers[4]; static bool random_seeded = false; void -clear_list_of_unique_uint32(int category) { +clear_list_of_unique_uint32(unique_id_category_e category) { int i; - assert((category >= -1) && (category <= 3)); + assert((category >= UNIQUE_ALL_IDS) && (category <= UNIQUE_ATTACHMENT_IDS)); if (category == UNIQUE_ALL_IDS) for (i = 0; i < 4; i++) - clear_list_of_unique_uint32(i); + clear_list_of_unique_uint32((unique_id_category_e)i); else ru_numbers[category].clear(); } bool is_unique_uint32(uint32_t number, - int category) { + unique_id_category_e category) { int i; - assert((category >= 0) && (category <= 3)); + assert((category >= UNIQUE_TRACK_IDS) && + (category <= UNIQUE_ATTACHMENT_IDS)); if (hack_engaged(ENGAGE_NO_VARIABLE_DATA)) return true; @@ -724,8 +725,9 @@ is_unique_uint32(uint32_t number, void add_unique_uint32(uint32_t number, - int category) { - assert((category >= 0) && (category <= 3)); + unique_id_category_e category) { + assert((category >= UNIQUE_TRACK_IDS) && + (category <= UNIQUE_ATTACHMENT_IDS)); if (hack_engaged(ENGAGE_NO_VARIABLE_DATA)) ru_numbers[category].push_back(ru_numbers[category].size() + 1); @@ -735,10 +737,11 @@ add_unique_uint32(uint32_t number, bool remove_unique_uint32(uint32_t number, - int category) { + unique_id_category_e category) { vector::iterator dit; - assert((category >= 0) && (category <= 3)); + assert((category >= UNIQUE_TRACK_IDS) && + (category <= UNIQUE_ATTACHMENT_IDS)); if (hack_engaged(ENGAGE_NO_VARIABLE_DATA)) return true; @@ -752,10 +755,11 @@ remove_unique_uint32(uint32_t number, } uint32_t -create_unique_uint32(int category) { +create_unique_uint32(unique_id_category_e category) { uint32_t rnumber, half; - assert((category >= 0) && (category <= 3)); + assert((category >= UNIQUE_TRACK_IDS) && + (category <= UNIQUE_ATTACHMENT_IDS)); if (hack_engaged(ENGAGE_NO_VARIABLE_DATA)) { ru_numbers[category].push_back(ru_numbers[category].size() + 1); diff --git a/src/common/common.h b/src/common/common.h index c75c27750..053dc3e20 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -169,17 +169,22 @@ from_utf8_c(int handle, string MTX_DLL_API to_utf8(int handle, const string &local); string MTX_DLL_API from_utf8(int handle, const string &utf8); -#define UNIQUE_ALL_IDS -1 -#define UNIQUE_TRACK_IDS 0 -#define UNIQUE_CHAPTER_IDS 1 -#define UNIQUE_EDITION_IDS 2 -#define UNIQUE_ATTACHMENT_IDS 3 +enum unique_id_category_e { + UNIQUE_ALL_IDS = -1, + UNIQUE_TRACK_IDS = 0, + UNIQUE_CHAPTER_IDS = 1, + UNIQUE_EDITION_IDS = 2, + UNIQUE_ATTACHMENT_IDS = 3 +}; -void MTX_DLL_API clear_list_of_unique_uint32(int category); -bool MTX_DLL_API is_unique_uint32(uint32_t number, int category); -void MTX_DLL_API add_unique_uint32(uint32_t number, int category); -bool MTX_DLL_API remove_unique_uint32(uint32_t number, int category); -uint32_t MTX_DLL_API create_unique_uint32(int category); +void MTX_DLL_API clear_list_of_unique_uint32(unique_id_category_e category); +bool MTX_DLL_API is_unique_uint32(uint32_t number, + unique_id_category_e category); +void MTX_DLL_API add_unique_uint32(uint32_t number, + unique_id_category_e category); +bool MTX_DLL_API remove_unique_uint32(uint32_t number, + unique_id_category_e category); +uint32_t MTX_DLL_API create_unique_uint32(unique_id_category_e category); void MTX_DLL_API safefree(void *p); #define safemalloc(s) _safemalloc(s, __FILE__, __LINE__) diff --git a/src/common/compression.cpp b/src/common/compression.cpp index 66b5ddb7c..25089d425 100644 --- a/src/common/compression.cpp +++ b/src/common/compression.cpp @@ -15,7 +15,7 @@ #include "compression.h" -const char *compression_schemes[] = { +const char *compression_methods[] = { "unspecified", "zlib", "bz2", "lzo", "none" }; @@ -245,32 +245,32 @@ compression_c::~compression_c() { } compression_c * -compression_c::create(int scheme) { - if ((scheme <= COMPRESSION_UNSPECIFIED) || - (scheme > COMPRESSION_NUM)) +compression_c::create(compression_method_e method) { + if ((method <= COMPRESSION_UNSPECIFIED) || + (method > COMPRESSION_NUM)) return NULL; - return create(compression_schemes[scheme]); + return create(compression_methods[method]); } compression_c * -compression_c::create(const char *scheme) { +compression_c::create(const char *method) { #if defined(HAVE_LZO1X_H) - if (!strcasecmp(scheme, compression_schemes[COMPRESSION_LZO])) + if (!strcasecmp(method, compression_methods[COMPRESSION_LZO])) return new lzo_compression_c(); #endif // HAVE_LZO1X_H #if defined(HAVE_ZLIB_H) - if (!strcasecmp(scheme, compression_schemes[COMPRESSION_ZLIB])) + if (!strcasecmp(method, compression_methods[COMPRESSION_ZLIB])) return new zlib_compression_c(); #endif // HAVE_ZLIB_H #if defined(HAVE_BZLIB_H) - if (!strcasecmp(scheme, compression_schemes[COMPRESSION_BZ2])) + if (!strcasecmp(method, compression_methods[COMPRESSION_BZ2])) return new bzlib_compression_c(); #endif // HAVE_BZLIB_H - if (!strcasecmp(scheme, "none")) + if (!strcasecmp(method, "none")) return new compression_c(COMPRESSION_NONE); return NULL; diff --git a/src/common/compression.h b/src/common/compression.h index a915d05d5..e12987ee1 100644 --- a/src/common/compression.h +++ b/src/common/compression.h @@ -19,29 +19,31 @@ #include "common.h" /* compression types */ -#define COMPRESSION_UNSPECIFIED 0 -#define COMPRESSION_ZLIB 1 -#define COMPRESSION_BZ2 2 -#define COMPRESSION_LZO 3 -#define COMPRESSION_NONE 4 -#define COMPRESSION_NUM 4 +enum compression_method_e { + COMPRESSION_UNSPECIFIED = 0, + COMPRESSION_ZLIB, + COMPRESSION_BZ2, + COMPRESSION_LZO, + COMPRESSION_NONE, + COMPRESSION_NUM = COMPRESSION_NONE +}; -extern const char *MTX_DLL_API xcompression_schemes[]; +extern const char *MTX_DLL_API xcompression_methods[]; class MTX_DLL_API compression_c { protected: - int scheme; + compression_method_e method; int64_t raw_size, compressed_size, items; public: - compression_c(int nscheme): - scheme(nscheme), raw_size(0), compressed_size(0), items(0) { + compression_c(compression_method_e _method): + method(_method), raw_size(0), compressed_size(0), items(0) { }; virtual ~compression_c(); - int get_scheme() { - return scheme; + compression_method_e get_method() { + return method; }; virtual unsigned char *decompress(unsigned char *buffer, int &size) { @@ -52,8 +54,8 @@ public: return (unsigned char *)safememdup(buffer, size); }; - static compression_c *create(int scheme); - static compression_c *create(const char *scheme); + static compression_c *create(compression_method_e method); + static compression_c *create(const char *method); }; #if defined(HAVE_LZO1X_H) diff --git a/src/common/dts_common.cpp b/src/common/dts_common.cpp index 545cf2645..d97b77987 100644 --- a/src/common/dts_common.cpp +++ b/src/common/dts_common.cpp @@ -115,8 +115,8 @@ find_dts_header(const unsigned char *buf, unsigned int t; bc.get_bits(1, t); - dts_header->frametype = (t)? dts_header_s::frametype_normal : - dts_header_s::frametype_termination; + dts_header->frametype = (t)? dts_header_s::FRAMETYPE_NORMAL : + dts_header_s::FRAMETYPE_TERMINATION; bc.get_bits(5, t); dts_header->deficit_sample_count = (t+1) % 32; @@ -166,14 +166,14 @@ find_dts_header(const unsigned char *buf, bc.get_bits(3, t); dts_header->extension_audio_descriptor = - (dts_header_s::extension_audio_descriptor_enum)t; + (dts_header_s::extension_audio_descriptor_e)t; bc.get_bit(dts_header->extended_coding); bc.get_bit(dts_header->audio_sync_word_in_sub_sub); bc.get_bits(2, t); - dts_header->lfe_type = (dts_header_s::lfe_type_enum)t; + dts_header->lfe_type = (dts_header_s::lfe_type_e)t; bc.get_bit(dts_header->predictor_history_flag); @@ -184,7 +184,7 @@ find_dts_header(const unsigned char *buf, bc.get_bits(1, t); dts_header->multirate_interpolator = - (dts_header_s::multirate_interpolator_enum)t; + (dts_header_s::multirate_interpolator_e)t; bc.get_bits(4, t); dts_header->encoder_software_revision = t; @@ -263,7 +263,7 @@ print_dts_header(const struct dts_header_s *h) { mxinfo("DTS Frame Header Information:\n"); mxinfo("Frame Type : "); - if (h->frametype == dts_header_s::frametype_normal) { + if (h->frametype == dts_header_s::FRAMETYPE_NORMAL) { mxinfo("normal"); } else { mxinfo("termination, deficit sample count = %u", @@ -311,13 +311,13 @@ print_dts_header(const struct dts_header_s *h) { mxinfo("Extended Coding : "); if (h->extended_coding) { switch (h->extension_audio_descriptor) { - case dts_header_s::extension_xch: + case dts_header_s::EXTENSION_XCH: mxinfo("Extra Channels"); break; - case dts_header_s::extension_x96k: + case dts_header_s::EXTENSION_X96K: mxinfo("Extended frequency (x96k)"); break; - case dts_header_s::extension_xch_x96k: + case dts_header_s::EXTENSION_XCH_X96K: mxinfo("Extra Channels and Extended frequency (x96k)"); break; default: @@ -333,16 +333,16 @@ print_dts_header(const struct dts_header_s *h) { mxinfo("Low Frequency Effects : "); switch (h->lfe_type) { - case dts_header_s::lfe_none: + case dts_header_s::LFE_NONE: mxinfo("none"); break; - case dts_header_s::lfe_128: + case dts_header_s::LFE_128: mxinfo("yes, interpolation factor 128"); break; - case dts_header_s::lfe_64: + case dts_header_s::LFE_64: mxinfo("yes, interpolation factor 64"); break; - case dts_header_s::lfe_invalid: + case dts_header_s::LFE_INVALID: mxinfo("Invalid"); break; } @@ -352,7 +352,7 @@ print_dts_header(const struct dts_header_s *h) { (h->predictor_history_flag)? "yes" : "no"); mxinfo("Multirate Interpolator : %s\n", - (h->multirate_interpolator == dts_header_s::mi_non_perfect)? + (h->multirate_interpolator == dts_header_s::MI_NON_PERFECT)? "non perfect" : "perfect"); mxinfo("Encoder Software Vers. : %u\n", diff --git a/src/common/dts_common.h b/src/common/dts_common.h index 02dda80a6..2f5d0883c 100644 --- a/src/common/dts_common.h +++ b/src/common/dts_common.h @@ -30,12 +30,12 @@ typedef struct dts_header_s { // --------------------------------------------------- - enum { + enum frametype_e { // Used to extremely precisely specify the end-of-stream (single PCM // sample resolution). - frametype_termination = 0, + FRAMETYPE_TERMINATION = 0, - frametype_normal + FRAMETYPE_NORMAL } frametype; // 0 for normal frames, 1 to 30 for termination frames. Number of PCM @@ -81,15 +81,15 @@ typedef struct dts_header_s { // if true, the source material was mastered in HDCD format bool hdcd_master; - enum extension_audio_descriptor_enum { - extension_xch = 0, // channel extension - extension_unknown1, - extension_x96k, // frequency extension - extension_xch_x96k, // both channel and frequency extension - extension_unknown4, - extension_unknown5, - extension_unknown6, - extension_unknown7 + enum extension_audio_descriptor_e { + EXTENSION_XCH = 0, // channel extension + EXTENSION_UNKNOWN1, + EXTENSION_X96K, // frequency extension + EXTENSION_XCH_X96K, // both channel and frequency extension + EXTENSION_UNKNOWN4, + EXTENSION_UNKNOWN5, + EXTENSION_UNKNOWN6, + EXTENSION_UNKNOWN7 } extension_audio_descriptor; // significant only if extended_coding == true // if true, extended coding data is placed after the core audio data @@ -99,13 +99,13 @@ typedef struct dts_header_s { // rather than in each sub-frame, only bool audio_sync_word_in_sub_sub; - enum lfe_type_enum { - lfe_none, - lfe_128, // 128 indicates the interpolation factor to reconstruct the + enum lfe_type_e { + LFE_NONE, + LFE_128, // 128 indicates the interpolation factor to reconstruct the // LFE channel - lfe_64, // 64 indicates the interpolation factor to reconstruct the + LFE_64, // 64 indicates the interpolation factor to reconstruct the // LFE channel - lfe_invalid + LFE_INVALID } lfe_type; // if true, past frames will be used to predict ADPCM values for the @@ -114,9 +114,9 @@ typedef struct dts_header_s { bool predictor_history_flag; // which FIR coefficients to use for sub-band reconstruction - enum multirate_interpolator_enum { - mi_non_perfect, - mi_perfect + enum multirate_interpolator_e { + MI_NON_PERFECT, + MI_PERFECT } multirate_interpolator; // 0 to 15 @@ -153,7 +153,7 @@ inline int get_dts_packet_length_in_core_samples(const struct dts_header_s int r; r = dts_header->num_pcm_sample_blocks * 32; - if (dts_header->frametype == dts_header_s::frametype_termination) + if (dts_header->frametype == dts_header_s::FRAMETYPE_TERMINATION) r -= dts_header->deficit_sample_count; return r; diff --git a/src/common/tagwriter.cpp b/src/common/tagwriter.cpp index 9dbf13e90..c07987fb1 100644 --- a/src/common/tagwriter.cpp +++ b/src/common/tagwriter.cpp @@ -115,7 +115,7 @@ write_xml_element_rec(int level, out->printf("<%s>", tag_elements[elt_idx].name); switch (tag_elements[elt_idx].type) { - case ebmlt_master: + case EBMLT_MASTER: out->printf("\n"); m = dynamic_cast(e); assert(m != NULL); @@ -138,31 +138,31 @@ write_xml_element_rec(int level, out->printf("\n", tag_elements[elt_idx].name); break; - case ebmlt_uint: - case ebmlt_bool: + case EBMLT_UINT: + case EBMLT_BOOL: out->printf("%llu\n", uint64(*dynamic_cast(e)), tag_elements[elt_idx].name); break; - case ebmlt_string: + case EBMLT_STRING: s = escape_xml(string(*dynamic_cast(e))); out->printf("%s\n", s.c_str(), tag_elements[elt_idx].name); break; - case ebmlt_ustring: + case EBMLT_USTRING: s = UTFstring_to_cstrutf8(UTFstring(*static_cast (e)).c_str()); s = escape_xml(s); out->printf("%s\n", s.c_str(), tag_elements[elt_idx].name); break; - case ebmlt_time: + case EBMLT_TIME: out->printf(FMT_TIMECODEN "\n", ARG_TIMECODEN(uint64(*dynamic_cast(e))), tag_elements[elt_idx].name); break; - case ebmlt_binary: + case EBMLT_BINARY: print_binary(level, tag_elements[elt_idx].name, e, out); break; diff --git a/src/common/xml_element_mapping.cpp b/src/common/xml_element_mapping.cpp index fc4bc182c..2620e9ae3 100644 --- a/src/common/xml_element_mapping.cpp +++ b/src/common/xml_element_mapping.cpp @@ -50,68 +50,68 @@ init_mapping_table(parser_element_t *table) { void xml_element_map_init() { static parser_element_t _chapter_elements[] = { - {"Chapters", ebmlt_master, 0, 0, 0, no_id, NULL, NULL, NULL}, + {"Chapters", EBMLT_MASTER, 0, 0, 0, no_id, NULL, NULL, NULL}, - {"EditionEntry", ebmlt_master, 1, 0, 0, no_id, NULL, NULL, NULL}, - {"EditionUID", ebmlt_uint, 2, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, - {"EditionFlagHidden", ebmlt_bool, 2, 0, 0, no_id, NULL, NULL, NULL}, - {"EditionProcessed", ebmlt_uint, 2, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"EditionEntry", EBMLT_MASTER, 1, 0, 0, no_id, NULL, NULL, NULL}, + {"EditionUID", EBMLT_UINT, 2, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, + {"EditionFlagHidden", EBMLT_BOOL, 2, 0, 0, no_id, NULL, NULL, NULL}, + {"EditionProcessed", EBMLT_UINT, 2, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, - {"EditionFlagDefault", ebmlt_bool, 2, 0, 0, no_id, NULL, NULL, NULL}, + {"EditionFlagDefault", EBMLT_BOOL, 2, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterAtom", ebmlt_master, 2, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterUID", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, - {"ChapterTimeStart", ebmlt_time, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterTimeEnd", ebmlt_time, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterFlagHidden", ebmlt_bool, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterFlagEnabled", ebmlt_bool, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterProcessedPrivate", ebmlt_binary, 3, 0, 0, no_id, NULL, NULL, + {"ChapterAtom", EBMLT_MASTER, 2, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterUID", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, + {"ChapterTimeStart", EBMLT_TIME, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterTimeEnd", EBMLT_TIME, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterFlagHidden", EBMLT_BOOL, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterFlagEnabled", EBMLT_BOOL, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterProcessedPrivate", EBMLT_BINARY, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterPhysicalEquiv", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, + {"ChapterPhysicalEquiv", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, - {"ChapterProcess", ebmlt_master, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterProcessTime", ebmlt_uint, 4, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterProcessCommand", ebmlt_binary, 4, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterProcess", EBMLT_MASTER, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterProcessTime", EBMLT_UINT, 4, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterProcessCommand", EBMLT_BINARY, 4, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterTrack", ebmlt_master, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterTrackNumber", ebmlt_uint, 4, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"ChapterTrack", EBMLT_MASTER, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterTrackNumber", EBMLT_UINT, 4, 0, NO_MAX_VALUE, no_id, NULL, NULL, NULL}, - {"ChapterDisplay", ebmlt_master, 3, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterString", ebmlt_ustring, 4, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterLanguage", ebmlt_string, 4, 0, 0, no_id, NULL, NULL, NULL}, - {"ChapterCountry", ebmlt_string, 4, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterDisplay", EBMLT_MASTER, 3, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterString", EBMLT_USTRING, 4, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterLanguage", EBMLT_STRING, 4, 0, 0, no_id, NULL, NULL, NULL}, + {"ChapterCountry", EBMLT_STRING, 4, 0, 0, no_id, NULL, NULL, NULL}, - {NULL, ebmlt_master, 0, 0, 0, EbmlId((uint32_t)0, 0), NULL, NULL, NULL} + {NULL, EBMLT_MASTER, 0, 0, 0, EbmlId((uint32_t)0, 0), NULL, NULL, NULL} }; static parser_element_t _tag_elements[] = { - {"Tags", ebmlt_master, 0, 0, 0, no_id, NULL, NULL, NULL}, + {"Tags", EBMLT_MASTER, 0, 0, 0, no_id, NULL, NULL, NULL}, - {"Tag", ebmlt_master, 1, 0, 0, no_id, NULL, NULL, NULL}, + {"Tag", EBMLT_MASTER, 1, 0, 0, no_id, NULL, NULL, NULL}, - {"Targets", ebmlt_master, 2, 0, 0, no_id, NULL, NULL, "TagTargets"}, - {"TrackUID", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"Targets", EBMLT_MASTER, 2, 0, 0, no_id, NULL, NULL, "TagTargets"}, + {"TrackUID", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, "TagTrackUID"}, - {"EditionUID", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"EditionUID", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, "TagEditionUID"}, - {"ChapterUID", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"ChapterUID", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, "TagChapterUID"}, - {"AttachmentUID", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"AttachmentUID", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, "TagAttachmentUID"}, - {"TargetType", ebmlt_string, 3, 0, 0, no_id, NULL, NULL, "TagTargetType"}, - {"TargetTypeValue", ebmlt_uint, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, + {"TargetType", EBMLT_STRING, 3, 0, 0, no_id, NULL, NULL, "TagTargetType"}, + {"TargetTypeValue", EBMLT_UINT, 3, 0, NO_MAX_VALUE, no_id, NULL, NULL, "TagTargetTypeValue"}, - {"Simple", ebmlt_master, 2, 0, 0, no_id, NULL, NULL, "TagSimple"}, - {"Name", ebmlt_ustring, 3, 0, 0, no_id, NULL, NULL, "TagName"}, - {"String", ebmlt_ustring, 3, 0, 0, no_id, NULL, NULL, "TagString"}, - {"Binary", ebmlt_binary, 3, 0, 0, no_id, NULL, NULL, "TagBinary"}, - {"TagLanguage", ebmlt_string, 3, 0, 0, no_id, NULL, NULL, "TagLanguage"}, - {"DefaultLanguage", ebmlt_bool, 3, 0, 1, no_id, NULL, NULL, "TagDefault"}, + {"Simple", EBMLT_MASTER, 2, 0, 0, no_id, NULL, NULL, "TagSimple"}, + {"Name", EBMLT_USTRING, 3, 0, 0, no_id, NULL, NULL, "TagName"}, + {"String", EBMLT_USTRING, 3, 0, 0, no_id, NULL, NULL, "TagString"}, + {"Binary", EBMLT_BINARY, 3, 0, 0, no_id, NULL, NULL, "TagBinary"}, + {"TagLanguage", EBMLT_STRING, 3, 0, 0, no_id, NULL, NULL, "TagLanguage"}, + {"DefaultLanguage", EBMLT_BOOL, 3, 0, 1, no_id, NULL, NULL, "TagDefault"}, - {NULL, ebmlt_master, 0, 0, 0, EbmlId((uint32_t)0, 0), NULL, NULL, NULL} + {NULL, EBMLT_MASTER, 0, 0, 0, EbmlId((uint32_t)0, 0), NULL, NULL, NULL} }; chapter_elements = _chapter_elements; diff --git a/src/common/xml_element_mapping.h b/src/common/xml_element_mapping.h index 2b500bde6..aad6247ac 100644 --- a/src/common/xml_element_mapping.h +++ b/src/common/xml_element_mapping.h @@ -24,15 +24,15 @@ using namespace libebml; typedef void (*parser_element_callback_t)(void *pdata); -enum ebml_type_t {ebmlt_master, ebmlt_int, ebmlt_uint, ebmlt_bool, - ebmlt_string, ebmlt_ustring, ebmlt_time, ebmlt_binary}; +enum ebml_type_e {EBMLT_MASTER, EBMLT_INT, EBMLT_UINT, EBMLT_BOOL, + EBMLT_STRING, EBMLT_USTRING, EBMLT_TIME, EBMLT_BINARY}; #define NO_MIN_VALUE -9223372036854775807ll-1 #define NO_MAX_VALUE 9223372036854775807ll typedef struct { const char *name; - ebml_type_t type; + ebml_type_e type; int level; int64_t min_value; int64_t max_value; diff --git a/src/common/xml_element_parser.cpp b/src/common/xml_element_parser.cpp index 5fad012ca..11d6bc7d8 100644 --- a/src/common/xml_element_parser.cpp +++ b/src/common/xml_element_parser.cpp @@ -264,7 +264,7 @@ add_new_element(parser_data_t *pdata, if (pdata->mapping[elt_idx].start_hook != NULL) pdata->mapping[elt_idx].start_hook(pdata); - pdata->data_allowed = pdata->mapping[elt_idx].type != ebmlt_master; + pdata->data_allowed = pdata->mapping[elt_idx].type != EBMLT_MASTER; (pdata->depth)++; } @@ -337,25 +337,25 @@ end_element(void *user_data, assert(found); switch (pdata->mapping[elt_idx].type) { - case ebmlt_master: + case EBMLT_MASTER: break; - case ebmlt_uint: + case EBMLT_UINT: el_get_uint(pdata, xmlp_pelt, pdata->mapping[elt_idx].min_value, false); break; - case ebmlt_bool: + case EBMLT_BOOL: el_get_uint(pdata, xmlp_pelt, 0, true); break; - case ebmlt_string: + case EBMLT_STRING: el_get_string(pdata, xmlp_pelt); break; - case ebmlt_ustring: + case EBMLT_USTRING: el_get_utf8string(pdata, xmlp_pelt); break; - case ebmlt_time: + case EBMLT_TIME: el_get_time(pdata, xmlp_pelt); break; - case ebmlt_binary: + case EBMLT_BINARY: el_get_binary(pdata, xmlp_pelt); break; default: diff --git a/src/extract/mkvextract.cpp b/src/extract/mkvextract.cpp index f0102a1af..c72bd46d4 100644 --- a/src/extract/mkvextract.cpp +++ b/src/extract/mkvextract.cpp @@ -104,10 +104,10 @@ find_track(int tid) { return NULL; } -char typenames[TYPEMAX + 1][20] = +char typenames[FILE_TYPE_MAX + 1][20] = {"unknown", "Ogg", "AVI", "WAV", "SRT", "MP3", "AC3", "chapter", "MicroDVD", "VobSub", "Matroska", "DTS", "AAC", "SSA/ASS", "RealMedia", "Quicktime/MP4", - "FLAC", "TTA"}; + "FLAC", "TTA", "MPEG ES"}; void usage() { diff --git a/src/extract/mkvextract.h b/src/extract/mkvextract.h index f8bc7ed78..a8a8dbba7 100644 --- a/src/extract/mkvextract.h +++ b/src/extract/mkvextract.h @@ -93,7 +93,7 @@ typedef struct { } kax_track_t; extern vector tracks; -extern char typenames[TYPEMAX + 1][20]; +extern char typenames[FILE_TYPE_MAX + 1][20]; extern bool no_variable_data; #define fits_parent(l, p) (l->GetElementPosition() < \ diff --git a/src/extract/tracks.cpp b/src/extract/tracks.cpp index 0132f22ec..1d910b241 100644 --- a/src/extract/tracks.cpp +++ b/src/extract/tracks.cpp @@ -174,7 +174,7 @@ check_output_files() { tracks[i].tid); continue; } - tracks[i].type = TYPEAVI; + tracks[i].type = FILE_TYPE_AVI; } else if (!strncmp(tracks[i].codec_id, "V_REAL/", 7)) { if ((tracks[i].v_width == 0) || (tracks[i].v_height == 0) || @@ -185,7 +185,7 @@ check_output_files() { tracks[i].tid); continue; } - tracks[i].type = TYPEREAL; + tracks[i].type = FILE_TYPE_REAL; } else { mxwarn(_("The extraction of video tracks is only supported for " @@ -202,7 +202,7 @@ check_output_files() { tracks[i].a_channels = 1; if (!strcmp(tracks[i].codec_id, MKV_A_VORBIS)) { - tracks[i].type = TYPEOGM; // Yeah, I know, I know... + tracks[i].type = FILE_TYPE_OGM; // Yeah, I know, I know... if (tracks[i].private_data == NULL) { mxwarn(_("Track ID %lld is missing some critical " "information. The track will be skipped.\n"), @@ -250,11 +250,11 @@ check_output_files() { offset - tracks[i].header_sizes[0] - tracks[i].header_sizes[1]; } else if (!strncmp(tracks[i].codec_id, MKV_A_MP3, 8)) - tracks[i].type = TYPEMP3; + tracks[i].type = FILE_TYPE_MP3; else if (!strcmp(tracks[i].codec_id, MKV_A_AC3)) - tracks[i].type = TYPEAC3; + tracks[i].type = FILE_TYPE_AC3; else if (!strcmp(tracks[i].codec_id, MKV_A_PCM)) { - tracks[i].type = TYPEWAV; // Yeah, I know, I know... + tracks[i].type = FILE_TYPE_WAV; // Yeah, I know, I know... if (tracks[i].a_bps == 0) { mxwarn(_("Track ID %lld is missing some critical " "information. The track will be skipped.\n"), @@ -321,7 +321,7 @@ check_output_files() { else tracks[i].aac_srate_idx = 11; - tracks[i].type = TYPEAAC; + tracks[i].type = FILE_TYPE_AAC; } else if (!strcmp(tracks[i].codec_id, MKV_A_DTS)) { mxwarn(_("Extraction of DTS is not supported - yet. " @@ -337,7 +337,7 @@ check_output_files() { continue; } - tracks[i].type = TYPEFLAC; + tracks[i].type = FILE_TYPE_FLAC; } else if (!strncmp(tracks[i].codec_id, "A_REAL/", 7)) { if ((tracks[i].private_data == NULL) || @@ -348,7 +348,7 @@ check_output_files() { continue; } - tracks[i].type = TYPEREAL; + tracks[i].type = FILE_TYPE_REAL; } else if (!strcmp(tracks[i].codec_id, MKV_A_TTA)) { if (tracks[i].a_bps == 0) { @@ -358,7 +358,7 @@ check_output_files() { continue; } - tracks[i].type = TYPETTA; + tracks[i].type = FILE_TYPE_TTA; } else { mxwarn(_("Unsupported CodecID '%s' for ID %lld. " @@ -370,12 +370,12 @@ check_output_files() { } else if (tracks[i].track_type == 's') { if (!strcmp(tracks[i].codec_id, MKV_S_TEXTUTF8) || !strcmp(tracks[i].codec_id, MKV_S_TEXTASCII)) - tracks[i].type = TYPESRT; + tracks[i].type = FILE_TYPE_SRT; else if (!strcmp(tracks[i].codec_id, MKV_S_TEXTSSA) || !strcmp(tracks[i].codec_id, MKV_S_TEXTASS) || !strcmp(tracks[i].codec_id, "S_SSA") || !strcmp(tracks[i].codec_id, "S_ASS")) - tracks[i].type = TYPESSA; + tracks[i].type = FILE_TYPE_SSA; else { mxwarn(_("Unsupported CodecID '%s' for ID %lld. " "The track will be skipped.\n"), tracks[i].codec_id, @@ -412,7 +412,7 @@ create_output_files() { // RIGHT NOW! Or I'll go insane... for (i = 0; i < tracks.size(); i++) { if (tracks[i].in_use) { - if (tracks[i].type == TYPEAVI) { + if (tracks[i].type == FILE_TYPE_AVI) { alBITMAPINFOHEADER *bih; char ccodec[5]; string writing_app; @@ -435,7 +435,7 @@ create_output_files() { mxinfo(_("Track ID %lld is being extracted to an AVI file '%s'.\n"), tracks[i].tid, tracks[i].out_name); - } else if (tracks[i].type == TYPEREAL) { + } else if (tracks[i].type == FILE_TYPE_REAL) { rmff_file_t *file; file = open_rmff_file(tracks[i].out_name); @@ -453,7 +453,7 @@ create_output_files() { rmff_set_track_data(tracks[i].rmtrack, "Audio", "audio/x-pn-realaudio"); - } else if (tracks[i].type == TYPETTA) { + } else if (tracks[i].type == FILE_TYPE_TTA) { string dummy_out_name; try { @@ -480,7 +480,7 @@ create_output_files() { tracks[i].tid, typenames[tracks[i].type], tracks[i].out_name); - if (tracks[i].type == TYPEOGM) { + if (tracks[i].type == FILE_TYPE_OGM) { ogg_packet op; if (no_variable_data) @@ -510,7 +510,7 @@ create_output_files() { flush_ogg_pages(tracks[i]); tracks[i].packetno = 3; - } else if (tracks[i].type == TYPEWAV) { + } else if (tracks[i].type == FILE_TYPE_WAV) { wave_header *wh = &tracks[i].wh; // Write the WAV header. @@ -530,11 +530,11 @@ create_output_files() { tracks[i].out->write(wh, sizeof(wave_header)); - } else if (tracks[i].type == TYPESRT) { + } else if (tracks[i].type == FILE_TYPE_SRT) { tracks[i].srt_num = 1; tracks[i].out->write_bom(tracks[i].sub_charset); - } else if (tracks[i].type == TYPESSA) { + } else if (tracks[i].type == FILE_TYPE_SSA) { char *s, *p1; unsigned char *pd; int bom_len; @@ -585,7 +585,7 @@ create_output_files() { sconv = from_utf8(tracks[i].conv_handle, sconv); tracks[i].out->puts_unl(sconv); - } else if (tracks[i].type == TYPEFLAC) { + } else if (tracks[i].type == FILE_TYPE_FLAC) { if (!tracks[i].embed_in_ogg) tracks[i].out->write(tracks[i].private_data, tracks[i].private_size); @@ -659,7 +659,7 @@ handle_data(KaxBlock *block, for (i = 0; i < block->NumberFrames(); i++) { DataBuffer &data = block->GetBuffer(i); switch (track->type) { - case TYPEAVI: + case FILE_TYPE_AVI: AVI_write_frame(track->avi, (char *)data.Buffer(), data.Size(), has_ref ? 0 : 1); if (iabs(block_duration / 1000000 - @@ -670,7 +670,7 @@ handle_data(KaxBlock *block, } break; - case TYPEOGM: + case FILE_TYPE_OGM: if (track->buffered_data != NULL) { ogg_packet op; @@ -695,7 +695,7 @@ handle_data(KaxBlock *block, break; - case TYPESRT: + case FILE_TYPE_SRT: if ((end == start) && !track->warning_printed) { mxwarn(_("Subtitle track %lld is missing some duration elements. " "Please check the resulting SRT file for entries that " @@ -741,7 +741,7 @@ handle_data(KaxBlock *block, safefree(s); break; - case TYPESSA: + case FILE_TYPE_SSA: if ((end == start) && !track->warning_printed) { mxwarn(_("Subtitle track %lld is missing some duration elements. " "Please check the resulting SSA/ASS file for entries that " @@ -825,7 +825,7 @@ handle_data(KaxBlock *block, break; - case TYPEAAC: + case FILE_TYPE_AAC: // Recreate the ADTS headers. What a fun. Like runing headlong into // a solid wall. But less painful. Well such is life, you know. // But then again I've just seen a beautiful girl walking by my @@ -884,7 +884,7 @@ handle_data(KaxBlock *block, break; - case TYPEFLAC: + case FILE_TYPE_FLAC: if (track->embed_in_ogg) { if (track->buffered_data != NULL) { ogg_packet op; @@ -914,7 +914,7 @@ handle_data(KaxBlock *block, break; - case TYPEREAL: + case FILE_TYPE_REAL: rmf_frame = rmff_allocate_frame(data.Size(), data.Buffer()); if (rmf_frame == NULL) mxerror(_("Memory for a RealAudio/RealVideo frame could not be " @@ -929,7 +929,7 @@ handle_data(KaxBlock *block, rmff_release_frame(rmf_frame); break; - case TYPETTA: + case FILE_TYPE_TTA: track->frame_sizes.push_back(data.Size()); if (block_duration > 0) track->last_duration = block_duration; @@ -957,11 +957,11 @@ close_files() { for (i = 0; i < tracks.size(); i++) { if (tracks[i].in_use) { switch (tracks[i].type) { - case TYPEAVI: + case FILE_TYPE_AVI: AVI_close(tracks[i].avi); break; - case TYPEOGM: + case FILE_TYPE_OGM: // Set the "end of stream" marker on the last packet, handle it // and flush all remaining Ogg pages. op.b_o_s = 0; @@ -980,7 +980,7 @@ close_files() { break; - case TYPEFLAC: + case FILE_TYPE_FLAC: if (tracks[i].embed_in_ogg) { // Set the "end of stream" marker on the last packet, handle it // and flush all remaining Ogg pages. @@ -1001,7 +1001,7 @@ close_files() { break; - case TYPEWAV: + case FILE_TYPE_WAV: // Fix the header with the real number of bytes written. tracks[i].out->setFilePointer(0); put_uint32(&tracks[i].wh.riff.len, tracks[i].bytes_written + 36); @@ -1011,7 +1011,7 @@ close_files() { break; - case TYPESSA: + case FILE_TYPE_SSA: // Sort the SSA lines according to their ReadOrder number and // write them. sort(tracks[i].ssa_lines.begin(), tracks[i].ssa_lines.end()); @@ -1023,7 +1023,7 @@ close_files() { break; - case TYPETTA: { + case FILE_TYPE_TTA: { mm_io_c *temp_file; tta_file_header_t tta_header; unsigned char *buffer; diff --git a/src/info/mkvinfo.cpp b/src/info/mkvinfo.cpp index baff652e7..147f41157 100644 --- a/src/info/mkvinfo.cpp +++ b/src/info/mkvinfo.cpp @@ -1658,7 +1658,7 @@ handle_elements_rec(EbmlStream *es, format = mapping[elt_idx].name; switch (mapping[elt_idx].type) { - case ebmlt_master: + case EBMLT_MASTER: show_element(e, level, format.c_str()); m = dynamic_cast(e); assert(m != NULL); @@ -1666,33 +1666,33 @@ handle_elements_rec(EbmlStream *es, handle_elements_rec(es, level + 1, elt_idx, (*m)[i], mapping); break; - case ebmlt_uint: - case ebmlt_bool: + case EBMLT_UINT: + case EBMLT_BOOL: format += ": %llu"; show_element(e, level, format.c_str(), uint64(*dynamic_cast(e))); break; - case ebmlt_string: + case EBMLT_STRING: format += ": %s"; show_element(e, level, format.c_str(), string(*dynamic_cast(e)).c_str()); break; - case ebmlt_ustring: + case EBMLT_USTRING: format += ": %s"; s = UTFstring_to_cstr(UTFstring(*static_cast (e)).c_str()); show_element(e, level, format.c_str(), s.c_str()); break; - case ebmlt_time: + case EBMLT_TIME: format += ": " FMT_TIMECODEN; show_element(e, level, format.c_str(), ARG_TIMECODEN(uint64(*dynamic_cast(e)))); break; - case ebmlt_binary: + case EBMLT_BINARY: format += ": %s"; s = format_binary(*static_cast(e)); show_element(e, level, format.c_str(), s.c_str()); diff --git a/src/input/r_aac.cpp b/src/input/r_aac.cpp index f5f8ebf66..3b48de215 100644 --- a/src/input/r_aac.cpp +++ b/src/input/r_aac.cpp @@ -160,7 +160,7 @@ aac_reader_c::guess_adts_version() { } } -file_status_t +file_status_e aac_reader_c::read(generic_packetizer_c *, bool) { int nread; @@ -168,14 +168,14 @@ aac_reader_c::read(generic_packetizer_c *, nread = mm_io->read(chunk, 4096); if (nread <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(chunk, nread, false); PTZR0->process(mem); bytes_processed += nread; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_aac.h b/src/input/r_aac.h index fece134d0..99bf4a9c6 100644 --- a/src/input/r_aac.h +++ b/src/input/r_aac.h @@ -38,7 +38,7 @@ public: aac_reader_c(track_info_c *nti) throw (error_c); virtual ~aac_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual int get_progress(); virtual void create_packetizer(int64_t id); diff --git a/src/input/r_ac3.cpp b/src/input/r_ac3.cpp index 28d417934..4cd25b010 100644 --- a/src/input/r_ac3.cpp +++ b/src/input/r_ac3.cpp @@ -75,7 +75,7 @@ ac3_reader_c::create_packetizer(int64_t) { (int64_t)0); } -file_status_t +file_status_e ac3_reader_c::read(generic_packetizer_c *, bool) { int nread; @@ -83,14 +83,14 @@ ac3_reader_c::read(generic_packetizer_c *, nread = mm_io->read(chunk, 4096); if (nread <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(chunk, nread, false); PTZR0->process(mem); bytes_processed += nread; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_ac3.h b/src/input/r_ac3.h index c4e4c0ef3..9104c9271 100644 --- a/src/input/r_ac3.h +++ b/src/input/r_ac3.h @@ -37,7 +37,7 @@ public: ac3_reader_c(track_info_c *nti) throw (error_c); virtual ~ac3_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizer(int64_t id); diff --git a/src/input/r_avi.cpp b/src/input/r_avi.cpp index 4447b3f91..3a76d8b59 100644 --- a/src/input/r_avi.cpp +++ b/src/input/r_avi.cpp @@ -376,7 +376,7 @@ avi_reader_c::is_keyframe(unsigned char *data, // {{{ FUNCTION avi_reader_c::read -file_status_t +file_status_e avi_reader_c::read(generic_packetizer_c *ptzr, bool force) { vector::const_iterator demuxer; @@ -474,10 +474,10 @@ avi_reader_c::read(generic_packetizer_c *ptzr, debug_leave("avi_reader_c::read (video)"); if (need_more_data) - return file_status_moredata; + return FILE_STATUS_MOREDATA; else { PTZR(vptzr)->flush(); - return file_status_done; + return FILE_STATUS_DONE; } } @@ -515,14 +515,14 @@ avi_reader_c::read(generic_packetizer_c *ptzr, debug_leave("avi_reader_c::read (audio)"); if (need_more_data) - return file_status_moredata; + return FILE_STATUS_MOREDATA; else { PTZR(demuxer->ptzr)->flush(); - return file_status_done; + return FILE_STATUS_DONE; } } - return file_status_done; + return FILE_STATUS_DONE; } // }}} diff --git a/src/input/r_avi.h b/src/input/r_avi.h index b7b3d97c9..e6ec06ddb 100644 --- a/src/input/r_avi.h +++ b/src/input/r_avi.h @@ -58,7 +58,7 @@ public: avi_reader_c(track_info_c *nti) throw (error_c); virtual ~avi_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizers(); diff --git a/src/input/r_dts.cpp b/src/input/r_dts.cpp index c5439f155..b9146e5e7 100644 --- a/src/input/r_dts.cpp +++ b/src/input/r_dts.cpp @@ -92,7 +92,7 @@ dts_reader_c::create_packetizer(int64_t) { print_dts_header(&dtsheader); } -file_status_t +file_status_e dts_reader_c::read(generic_packetizer_c *, bool) { int nread; @@ -100,14 +100,14 @@ dts_reader_c::read(generic_packetizer_c *, nread = mm_io->read(chunk, max_dts_packet_size); if (nread <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(chunk, nread, false); PTZR0->process(mem); bytes_processed += nread; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_dts.h b/src/input/r_dts.h index f063d5520..736db463e 100644 --- a/src/input/r_dts.h +++ b/src/input/r_dts.h @@ -38,7 +38,7 @@ public: dts_reader_c(track_info_c *nti) throw (error_c); virtual ~dts_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizer(int64_t id); diff --git a/src/input/r_flac.cpp b/src/input/r_flac.cpp index 754945924..174a90302 100644 --- a/src/input/r_flac.cpp +++ b/src/input/r_flac.cpp @@ -293,20 +293,20 @@ flac_reader_c::parse_file() { return metadata_parsed; } -file_status_t +file_status_e flac_reader_c::read(generic_packetizer_c *, bool) { unsigned char *buf; int samples_here; if (current_block == blocks.end()) - return file_status_done; + return FILE_STATUS_DONE; buf = (unsigned char *)safemalloc(current_block->len); file->setFilePointer(current_block->filepos); if (file->read(buf, current_block->len) != current_block->len) { safefree(buf); PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(buf, current_block->len, true); samples_here = flac_get_num_samples(buf, current_block->len, stream_info); @@ -316,9 +316,9 @@ flac_reader_c::read(generic_packetizer_c *, if (current_block == blocks.end()) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } - return file_status_moredata; + return FILE_STATUS_MOREDATA; } FLAC__SeekableStreamDecoderReadStatus diff --git a/src/input/r_flac.h b/src/input/r_flac.h index f3204eb7a..ee43a398d 100644 --- a/src/input/r_flac.h +++ b/src/input/r_flac.h @@ -51,7 +51,7 @@ public: flac_reader_c(track_info_c *nti) throw (error_c); virtual ~flac_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizer(int64_t id); diff --git a/src/input/r_matroska.cpp b/src/input/r_matroska.cpp index 1210c11e2..0e6910256 100644 --- a/src/input/r_matroska.cpp +++ b/src/input/r_matroska.cpp @@ -1492,8 +1492,8 @@ kax_reader_c::init_passthrough_packetizer(kax_track_t *t) { (t->v_pcright > 0) || (t->v_pcbottom > 0))) ptzr->set_video_pixel_cropping(t->v_pcleft, t->v_pctop, t->v_pcright, t->v_pcbottom); - if (ptzr->get_cue_creation() == CUES_UNSPECIFIED) - ptzr->set_cue_creation(CUES_IFRAMES); + if (ptzr->get_cue_creation() == CUE_STRATEGY_UNSPECIFIED) + ptzr->set_cue_creation( CUE_STRATEGY_IFRAMES); } else if (t->type == 'a') { ptzr->set_audio_sampling_freq(t->a_sfreq); @@ -1796,7 +1796,7 @@ kax_reader_c::create_packetizers() { // {{{ FUNCTION kax_reader_c::read() -file_status_t +file_status_e kax_reader_c::read(generic_packetizer_c *, bool force) { int upper_lvl_el, i, bgidx; @@ -1812,15 +1812,15 @@ kax_reader_c::read(generic_packetizer_c *, bool found_cluster, bref_found, fref_found; if (tracks.size() == 0) - return file_status_done; + return FILE_STATUS_DONE; l0 = segment; if (saved_l1 == NULL) // We're done. - return file_status_done; + return FILE_STATUS_DONE; if (!force && (get_queued_bytes() > 20 * 1024 * 1024)) - return file_status_holding; + return FILE_STATUS_HOLDING; debug_enter("kax_reader_c::read"); @@ -2012,16 +2012,16 @@ kax_reader_c::read(generic_packetizer_c *, } catch (exception ex) { mxwarn(PFX "exception caught\n"); flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } debug_leave("kax_reader_c::read"); if (found_cluster) - return file_status_moredata; + return FILE_STATUS_MOREDATA; else { flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } } diff --git a/src/input/r_matroska.h b/src/input/r_matroska.h index d31ba5dfe..46fd831af 100644 --- a/src/input/r_matroska.h +++ b/src/input/r_matroska.h @@ -194,7 +194,7 @@ public: kax_reader_c(track_info_c *nti) throw (error_c); virtual ~kax_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void set_headers(); diff --git a/src/input/r_mp3.cpp b/src/input/r_mp3.cpp index f8eb11c78..0b2ebc882 100644 --- a/src/input/r_mp3.cpp +++ b/src/input/r_mp3.cpp @@ -76,7 +76,7 @@ mp3_reader_c::create_packetizer(int64_t) { (int64_t)0); } -file_status_t +file_status_e mp3_reader_c::read(generic_packetizer_c *, bool) { int nread; @@ -84,14 +84,14 @@ mp3_reader_c::read(generic_packetizer_c *, nread = mm_io->read(chunk, 16384); if (nread <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(chunk, nread, false); PTZR0->process(mem); bytes_processed += nread; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_mp3.h b/src/input/r_mp3.h index 87d4bd696..bbedad768 100644 --- a/src/input/r_mp3.h +++ b/src/input/r_mp3.h @@ -37,7 +37,7 @@ public: mp3_reader_c(track_info_c *nti) throw (error_c); virtual ~mp3_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizer(int64_t tid); diff --git a/src/input/r_mpeg.cpp b/src/input/r_mpeg.cpp index 50d148689..9b2442484 100644 --- a/src/input/r_mpeg.cpp +++ b/src/input/r_mpeg.cpp @@ -153,20 +153,20 @@ mpeg_es_reader_c::create_packetizer(int64_t) { (int64_t)0); } -file_status_t +file_status_e mpeg_es_reader_c::read(generic_packetizer_c *, bool) { MPEGFrame *frame; if (!read_frame(m2v_parser, *mm_io)) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } frame = m2v_parser.ReadFrame(); if (!frame) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(frame->data, frame->size, true); @@ -178,7 +178,7 @@ mpeg_es_reader_c::read(generic_packetizer_c *, bytes_processed = mm_io->getFilePointer(); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } bool diff --git a/src/input/r_mpeg.h b/src/input/r_mpeg.h index d792e8585..89e562094 100644 --- a/src/input/r_mpeg.h +++ b/src/input/r_mpeg.h @@ -39,7 +39,7 @@ public: mpeg_es_reader_c(track_info_c *nti) throw (error_c); virtual ~mpeg_es_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizer(int64_t id); diff --git a/src/input/r_ogm.cpp b/src/input/r_ogm.cpp index d752e6da0..35d0e074e 100644 --- a/src/input/r_ogm.cpp +++ b/src/input/r_ogm.cpp @@ -381,7 +381,7 @@ ogm_reader_c::read_page(ogg_page *og) { } // Here EMOREDATA actually indicates success - a page has been read. - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -924,7 +924,7 @@ ogm_reader_c::read_headers() { done = false; while (!done) { // Make sure we have a page that we can work with. - if (read_page(&og) == file_status_done) + if (read_page(&og) == FILE_STATUS_DONE) return 0; // Is this the first page of a new stream? @@ -956,7 +956,7 @@ ogm_reader_c::read_headers() { /* * General reader. Read a page and hand it over for processing. */ -file_status_t +file_status_e ogm_reader_c::read(generic_packetizer_c *, bool) { int i; @@ -964,9 +964,9 @@ ogm_reader_c::read(generic_packetizer_c *, do { // Make sure we have a page that we can work with. - if (read_page(&og) == file_status_done) { + if (read_page(&og) == FILE_STATUS_DONE) { flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } // Is this the first page of a new stream? No, so process it normally. @@ -977,11 +977,11 @@ ogm_reader_c::read(generic_packetizer_c *, // Are there streams that have not finished yet? for (i = 0; i < sdemuxers.size(); i++) if (!sdemuxers[i]->eos && sdemuxers[i]->in_use) - return file_status_moredata; + return FILE_STATUS_MOREDATA; // No, we're done with this file. flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } int diff --git a/src/input/r_ogm.h b/src/input/r_ogm.h index 5d5123768..7ea6b5825 100644 --- a/src/input/r_ogm.h +++ b/src/input/r_ogm.h @@ -103,7 +103,7 @@ public: ogm_reader_c(track_info_c *nti) throw (error_c); virtual ~ogm_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizers(); virtual void create_packetizer(int64_t tid); diff --git a/src/input/r_qtmp4.cpp b/src/input/r_qtmp4.cpp index 7820cff97..1a42879e3 100644 --- a/src/input/r_qtmp4.cpp +++ b/src/input/r_qtmp4.cpp @@ -855,7 +855,7 @@ qtmp4_reader_c::handle_header_atoms(uint32_t parent, io->setFilePointer(target_pos); } -file_status_t +file_status_e qtmp4_reader_c::read(generic_packetizer_c *ptzr, bool force) { uint32_t i, k, frame, frame_size; @@ -920,7 +920,7 @@ qtmp4_reader_c::read(generic_packetizer_c *ptzr, safefree(buffer); flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } if ((dmx->pos + 1) < dmx->chunk_table_len) @@ -984,7 +984,7 @@ qtmp4_reader_c::read(generic_packetizer_c *ptzr, safefree(buffer); flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } frame_size += dmx->esds.decoder_config_len; } else { @@ -997,7 +997,7 @@ qtmp4_reader_c::read(generic_packetizer_c *ptzr, safefree(buffer); flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } } @@ -1010,16 +1010,16 @@ qtmp4_reader_c::read(generic_packetizer_c *ptzr, } if (chunks_left) - return file_status_moredata; + return FILE_STATUS_MOREDATA; else { flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } } flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } uint32_t diff --git a/src/input/r_qtmp4.h b/src/input/r_qtmp4.h index ea576a9c0..45bbe7ddc 100644 --- a/src/input/r_qtmp4.h +++ b/src/input/r_qtmp4.h @@ -120,7 +120,7 @@ public: qtmp4_reader_c(track_info_c *nti) throw (error_c); virtual ~qtmp4_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizers(); diff --git a/src/input/r_real.cpp b/src/input/r_real.cpp index 6e416b82a..846b0130a 100644 --- a/src/input/r_real.cpp +++ b/src/input/r_real.cpp @@ -392,7 +392,7 @@ real_reader_c::find_demuxer(int id) { return NULL; } -file_status_t +file_status_e real_reader_c::finish() { int i; int64_t dur; @@ -411,14 +411,14 @@ real_reader_c::finish() { flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } // }}} // {{{ FUNCTION real_reader_c::read() -file_status_t +file_status_e real_reader_c::read(generic_packetizer_c *, bool) { int size; @@ -428,7 +428,7 @@ real_reader_c::read(generic_packetizer_c *, rmff_frame_t *frame; if (done) - return file_status_done; + return FILE_STATUS_DONE; size = rmff_get_next_frame_size(file); if (size <= 0) { @@ -454,7 +454,7 @@ real_reader_c::read(generic_packetizer_c *, dmx = find_demuxer(frame->id); if (dmx == NULL) { rmff_release_frame(frame); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } if (dmx->track->type == RMFF_TRACK_TYPE_VIDEO) @@ -475,7 +475,7 @@ real_reader_c::read(generic_packetizer_c *, rmff_release_frame(frame); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void diff --git a/src/input/r_real.h b/src/input/r_real.h index 7fbb39ea4..2b456ebd1 100644 --- a/src/input/r_real.h +++ b/src/input/r_real.h @@ -68,7 +68,7 @@ public: real_reader_c(track_info_c *nti) throw (error_c); virtual ~real_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizers(); @@ -81,7 +81,7 @@ protected: virtual void parse_headers(); virtual real_demuxer_t *find_demuxer(int id); virtual void assemble_video_packet(real_demuxer_t *dmx, rmff_frame_t *frame); - virtual file_status_t finish(); + virtual file_status_e finish(); virtual bool get_rv_dimensions(unsigned char *buf, int size, uint32_t &width, uint32_t &height); virtual void set_dimensions(real_demuxer_t *dmx, unsigned char *buffer, diff --git a/src/input/r_srt.cpp b/src/input/r_srt.cpp index 3d912dc94..af8bd0fe4 100644 --- a/src/input/r_srt.cpp +++ b/src/input/r_srt.cpp @@ -224,15 +224,15 @@ srt_reader_c::parse_file() { subs.sort(); } -file_status_t +file_status_e srt_reader_c::read(generic_packetizer_c *, bool) { if (subs.empty()) - return file_status_done; + return FILE_STATUS_DONE; subs.process((textsubs_packetizer_c *)PTZR0); - return subs.empty() ? file_status_done : file_status_moredata; + return subs.empty() ? FILE_STATUS_DONE : FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_srt.h b/src/input/r_srt.h index 7623b3e83..adaac2d9f 100644 --- a/src/input/r_srt.h +++ b/src/input/r_srt.h @@ -35,7 +35,7 @@ public: virtual ~srt_reader_c(); virtual void parse_file(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizer(int64_t tid); virtual int get_progress(); diff --git a/src/input/r_ssa.cpp b/src/input/r_ssa.cpp index 5b803156b..ae3cb0e91 100644 --- a/src/input/r_ssa.cpp +++ b/src/input/r_ssa.cpp @@ -256,15 +256,15 @@ ssa_reader_c::parse_file() { subs.sort(); } -file_status_t +file_status_e ssa_reader_c::read(generic_packetizer_c *, bool) { if (subs.empty()) - return file_status_done; + return FILE_STATUS_DONE; subs.process((textsubs_packetizer_c *)PTZR0); - return subs.empty() ? file_status_done : file_status_moredata; + return subs.empty() ? FILE_STATUS_DONE : FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_ssa.h b/src/input/r_ssa.h index 6f8c15437..e9f9a7026 100644 --- a/src/input/r_ssa.h +++ b/src/input/r_ssa.h @@ -44,7 +44,7 @@ public: virtual ~ssa_reader_c(); virtual void parse_file(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizer(int64_t tid); virtual int get_progress(); diff --git a/src/input/r_tta.cpp b/src/input/r_tta.cpp index 3631b74b9..fd29aecd9 100644 --- a/src/input/r_tta.cpp +++ b/src/input/r_tta.cpp @@ -121,20 +121,20 @@ tta_reader_c::create_packetizer(int64_t) { (int64_t)0); } -file_status_t +file_status_e tta_reader_c::read(generic_packetizer_c *, bool) { unsigned char *buf; int nread; if (pos >= seek_points.size()) - return file_status_done; + return FILE_STATUS_DONE; buf = (unsigned char *)safemalloc(seek_points[pos]); nread = mm_io->read(buf, seek_points[pos]); if (nread <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } pos++; @@ -154,9 +154,9 @@ tta_reader_c::read(generic_packetizer_c *, bytes_processed += nread; if (pos >= seek_points.size()) - return file_status_done; + return FILE_STATUS_DONE; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_tta.h b/src/input/r_tta.h index ddef5d1c6..7394e9ba6 100644 --- a/src/input/r_tta.h +++ b/src/input/r_tta.h @@ -39,7 +39,7 @@ public: tta_reader_c(track_info_c *nti) throw (error_c); virtual ~tta_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual int get_progress(); virtual void identify(); virtual void create_packetizer(int64_t id); diff --git a/src/input/r_vobsub.cpp b/src/input/r_vobsub.cpp index a081731ad..823612f70 100644 --- a/src/input/r_vobsub.cpp +++ b/src/input/r_vobsub.cpp @@ -558,7 +558,7 @@ vobsub_reader_c::extract_one_spu_packet(int64_t timecode, return deliver(); } -file_status_t +file_status_e vobsub_reader_c::read(generic_packetizer_c *ptzr, bool force) { vobsub_track_c *track; @@ -572,7 +572,7 @@ vobsub_reader_c::read(generic_packetizer_c *ptzr, } if ((track == NULL) || (track->idx >= track->entries.size())) - return file_status_done; + return FILE_STATUS_DONE; id = i; sub_file->setFilePointer(track->entries[track->idx].position); @@ -583,9 +583,9 @@ vobsub_reader_c::read(generic_packetizer_c *ptzr, if (track->idx >= track->entries.size()) { flush_packetizers(); - return file_status_done; + return FILE_STATUS_DONE; } else - return file_status_moredata; + return FILE_STATUS_MOREDATA; } int diff --git a/src/input/r_vobsub.h b/src/input/r_vobsub.h index 3b0be5725..87d8612c7 100644 --- a/src/input/r_vobsub.h +++ b/src/input/r_vobsub.h @@ -73,7 +73,7 @@ public: vobsub_reader_c(track_info_c *nti) throw (error_c); virtual ~vobsub_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizers(); virtual void create_packetizer(int64_t tid); diff --git a/src/input/r_wav.cpp b/src/input/r_wav.cpp index 077b5e521..a8bc112ca 100644 --- a/src/input/r_wav.cpp +++ b/src/input/r_wav.cpp @@ -176,7 +176,7 @@ wav_reader_c::create_packetizer(int64_t) { } } -file_status_t +file_status_e wav_reader_c::read(generic_packetizer_c *, bool) { if (!is_dts) { @@ -185,7 +185,7 @@ wav_reader_c::read(generic_packetizer_c *, nread = mm_io->read(chunk, bps); if (nread <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } memory_c mem(chunk, nread, false); @@ -195,11 +195,11 @@ wav_reader_c::read(generic_packetizer_c *, if (nread != bps) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } else if (mm_io->eof()) - return file_status_done; + return FILE_STATUS_DONE; else - return file_status_moredata; + return FILE_STATUS_MOREDATA; } if (is_dts) { @@ -209,7 +209,7 @@ wav_reader_c::read(generic_packetizer_c *, if (rlen <= 0) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } if (dts_swap_bytes) { @@ -235,12 +235,12 @@ wav_reader_c::read(generic_packetizer_c *, if (rlen != max_dts_packet_size) { PTZR0->flush(); - return file_status_done; + return FILE_STATUS_DONE; } else - return file_status_moredata; + return FILE_STATUS_MOREDATA; } - return file_status_done; + return FILE_STATUS_DONE; } int diff --git a/src/input/r_wav.h b/src/input/r_wav.h index 30c3b760c..fd8bc6536 100644 --- a/src/input/r_wav.h +++ b/src/input/r_wav.h @@ -46,7 +46,7 @@ public: wav_reader_c(track_info_c *nti) throw (error_c); virtual ~wav_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false); + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false); virtual void identify(); virtual void create_packetizer(int64_t tid); diff --git a/src/merge/cluster_helper.cpp b/src/merge/cluster_helper.cpp index 21953ecfd..792351621 100644 --- a/src/merge/cluster_helper.cpp +++ b/src/merge/cluster_helper.cpp @@ -509,13 +509,13 @@ cluster_helper_c::render_cluster(ch_contents_t *clstr) { else if (write_cues && !added_to_cues) { // Update the cues (index table) either if cue entries for // I frames were requested and this is an I frame... - if (((source->get_cue_creation() == CUES_IFRAMES) && (pack->bref == -1)) + if (((source->get_cue_creation() == CUE_STRATEGY_IFRAMES) && (pack->bref == -1)) || // ... or if the user requested entries for all frames ... - (source->get_cue_creation() == CUES_ALL) || + (source->get_cue_creation() == CUE_STRATEGY_ALL) || // ... or if this is an audio track, there is no video track and the // last cue entry was created more than 2s ago. - ((source->get_cue_creation() == CUES_SPARSE) && + ((source->get_cue_creation() == CUE_STRATEGY_SPARSE) && (source->get_track_type() == track_audio) && (video_packetizer == NULL) && ((source->get_last_cue_timecode() < 0) || diff --git a/src/merge/mkvmerge.cpp b/src/merge/mkvmerge.cpp index 41956d32a..fc9bc208f 100644 --- a/src/merge/mkvmerge.cpp +++ b/src/merge/mkvmerge.cpp @@ -66,26 +66,26 @@ typedef struct { static int track_number = 1; file_type_t file_types[] = - {{"---", TYPEUNKNOWN, ""}, + {{"---", FILE_TYPE_UNKNOWN, ""}, {"demultiplexers:", -1, ""}, - {"aac ", TYPEAAC, "AAC (Advanced Audio Coding)"}, - {"ac3 ", TYPEAC3, "A/52 (aka AC3)"}, - {"avi ", TYPEAVI, "AVI (Audio/Video Interleaved)"}, - {"dts ", TYPEDTS, "DTS (Digital Theater System)"}, - {"mp2 ", TYPEMP3, "MPEG1 layer II audio (CBR and VBR/ABR)"}, - {"mp3 ", TYPEMP3, "MPEG1 layer III audio (CBR and VBR/ABR)"}, - {"mkv ", TYPEMATROSKA, "general Matroska files"}, - {"ogg ", TYPEOGM, "general OGG media stream, audio/video embedded in OGG"}, - {"mov ", TYPEQTMP4, "Quicktime/MP4 audio and video"}, - {"rm ", TYPEREAL, "RealMedia audio and video"}, - {"srt ", TYPESRT, "SRT text subtitles"}, - {"ssa ", TYPESSA, "SSA/ASS text subtitles"}, - {"idx ", TYPEVOBSUB, "VobSub subtitles"}, - {"wav ", TYPEWAV, "WAVE (uncompressed PCM)"}, + {"aac ", FILE_TYPE_AAC, "AAC (Advanced Audio Coding)"}, + {"ac3 ", FILE_TYPE_AC3, "A/52 (aka AC3)"}, + {"avi ", FILE_TYPE_AVI, "AVI (Audio/Video Interleaved)"}, + {"dts ", FILE_TYPE_DTS, "DTS (Digital Theater System)"}, + {"mp2 ", FILE_TYPE_MP3, "MPEG1 layer II audio (CBR and VBR/ABR)"}, + {"mp3 ", FILE_TYPE_MP3, "MPEG1 layer III audio (CBR and VBR/ABR)"}, + {"mkv ", FILE_TYPE_MATROSKA, "general Matroska files"}, + {"ogg ", FILE_TYPE_OGM, "general OGG media stream, audio/video embedded in OGG"}, + {"mov ", FILE_TYPE_QTMP4, "Quicktime/MP4 audio and video"}, + {"rm ", FILE_TYPE_REAL, "RealMedia audio and video"}, + {"srt ", FILE_TYPE_SRT, "SRT text subtitles"}, + {"ssa ", FILE_TYPE_SSA, "SSA/ASS text subtitles"}, + {"idx ", FILE_TYPE_VOBSUB, "VobSub subtitles"}, + {"wav ", FILE_TYPE_WAV, "WAVE (uncompressed PCM)"}, #if defined(HAVE_FLAC_FORMAT_H) - {"flac", TYPEFLAC, "FLAC lossless audio"}, + {"flac", FILE_TYPE_FLAC, "FLAC lossless audio"}, #endif - {"tta", TYPETTA, "TTA lossless audio"}, + {"tta", FILE_TYPE_TTA, "TTA lossless audio"}, {"output modules:", -1, ""}, {" ", -1, "AAC audio"}, {" ", -1, "AC3 audio"}, @@ -318,7 +318,7 @@ identify(const string &filename) { file.type = get_file_type(file.name); ti.fname = file.name; - if (file.type == TYPEUNKNOWN) + if (file.type == FILE_TYPE_UNKNOWN) mxerror(_("File %s has unknown type. Please have a look " "at the supported file types ('mkvmerge --list-types') and " "contact the author Moritz Bunkus if your " @@ -748,11 +748,11 @@ parse_cues(const string &s, s.c_str()); if (parts[1] == "all") - cues.cues = CUES_ALL; + cues.cues = CUE_STRATEGY_ALL; else if (parts[1] == "iframes") - cues.cues = CUES_IFRAMES; + cues.cues = CUE_STRATEGY_IFRAMES; else if (parts[1] == "none") - cues.cues = CUES_NONE; + cues.cues = CUE_STRATEGY_NONE; else mxerror(_("'%s' is an unsupported argument for --cues.\n"), s.c_str()); } @@ -763,7 +763,7 @@ parse_cues(const string &s, */ static void parse_compression(const string &s, - cue_creation_t &compression) { + compression_method_t &compression) { vector parts; // Extract the track number. @@ -781,21 +781,21 @@ parse_compression(const string &s, mxerror(_("Invalid compression option specified in '--compression %s'.\n"), s.c_str()); - compression.cues = -1; + compression.method = COMPRESSION_UNSPECIFIED; parts[1] = downcase(parts[1]); #ifdef HAVE_LZO1X_H if ((parts[1] == "lzo") || (parts[1] == "lzo1x")) - compression.cues = COMPRESSION_LZO; + compression.method = COMPRESSION_LZO; #endif if (parts[1] == "zlib") - compression.cues = COMPRESSION_ZLIB; + compression.method = COMPRESSION_ZLIB; #ifdef HAVE_BZLIB_H if ((parts[1] == "bz2") || (parts[1] == "bzlib")) - compression.cues = COMPRESSION_BZ2; + compression.method = COMPRESSION_BZ2; #endif if (parts[1] == "none") - compression.cues = COMPRESSION_NONE; - if (compression.cues == -1) + compression.method = COMPRESSION_NONE; + if (compression.method == COMPRESSION_UNSPECIFIED) mxerror(_("'%s' is an unsupported argument for --compression. Available " "compression methods are 'none' and 'zlib'.\n"), s.c_str()); } @@ -1467,14 +1467,14 @@ parse_args(vector &args) { if (no_next_arg) mxerror(_("'--timecode-scale' lacks its argument.\n")); - if (timecode_scale_mode != timecode_scale_mode_normal) + if (timecode_scale_mode != TIMECODE_SCALE_MODE_NORMAL) mxerror(_("'--timecode-scale' was used more than once.\n")); if (!parse_int(next_arg, temp)) mxerror(_("The argument to '--timecode-scale' must be a number.\n")); if (temp == -1) - timecode_scale_mode = timecode_scale_mode_auto; + timecode_scale_mode = TIMECODE_SCALE_MODE_AUTO; else { if ((temp > 10000000) || (temp < 1000)) mxerror(_("The given timecode scale factor is outside the valid " @@ -1482,7 +1482,7 @@ parse_args(vector &args) { "even if a video track is present').\n")); timecode_scale = temp; - timecode_scale_mode = timecode_scale_mode_fixed; + timecode_scale_mode = TIMECODE_SCALE_MODE_FIXED; } sit++; } @@ -1637,11 +1637,13 @@ parse_args(vector &args) { sit++; } else if ((this_arg == "--compression")) { + compression_method_t compression; + if (no_next_arg) mxerror(_("'--compression' lacks its argument.\n")); - parse_compression(next_arg, cues); - ti->compression_list->push_back(cues); + parse_compression(next_arg, compression); + ti->compression_list->push_back(compression); sit++; } else if ((this_arg == "--track-name")) { @@ -1721,14 +1723,14 @@ parse_args(vector &args) { file.type = get_file_type(file.name); ti->fname = from_utf8(cc_local_utf8, this_arg); - if (file.type == TYPEUNKNOWN) + if (file.type == FILE_TYPE_UNKNOWN) mxerror(_("The file '%s' has unknown type. Please have a look " "at the supported file types ('mkvmerge --list-types') and " "contact the author Moritz Bunkus if " "your file type is supported but not recognized " "properly.\n"), file.name); - if (file.type != TYPECHAPTERS) { + if (file.type != FILE_TYPE_CHAPTERS) { file.pack = NULL; file.ti = ti; file.done = false; diff --git a/src/merge/mkvmerge.h b/src/merge/mkvmerge.h index 4ec9d7c08..6e560fbbb 100644 --- a/src/merge/mkvmerge.h +++ b/src/merge/mkvmerge.h @@ -18,31 +18,35 @@ #include "pr_generic.h" -#define DISPLAYPRIORITY_HIGH 10 -#define DISPLAYPRIORITY_MEDIUM 5 -#define DISPLAYPRIORITY_LOW 1 +enum display_priority_e { + DISPLAYPRIORITY_LOW, + DISPLAYPRIORITY_MEDIUM, + DISPLAYPRIORITY_HIGH +}; /* file types */ -#define TYPEUNKNOWN 0 -#define TYPEOGM 1 -#define TYPEAVI 2 -#define TYPEWAV 3 -#define TYPESRT 4 -#define TYPEMP3 5 -#define TYPEAC3 6 -#define TYPECHAPTERS 7 -#define TYPEMICRODVD 8 -#define TYPEVOBSUB 9 -#define TYPEMATROSKA 10 -#define TYPEDTS 11 -#define TYPEAAC 12 -#define TYPESSA 13 -#define TYPEREAL 14 -#define TYPEQTMP4 15 -#define TYPEFLAC 16 -#define TYPETTA 17 -#define TYPEMPEG 18 -#define TYPEMAX 18 +enum file_type_e { + FILE_TYPE_UNKNOWN = 0, + FILE_TYPE_OGM, + FILE_TYPE_AVI, + FILE_TYPE_WAV, + FILE_TYPE_SRT, + FILE_TYPE_MP3, + FILE_TYPE_AC3, + FILE_TYPE_CHAPTERS, + FILE_TYPE_MICRODVD, + FILE_TYPE_VOBSUB, + FILE_TYPE_MATROSKA, + FILE_TYPE_DTS, + FILE_TYPE_AAC, + FILE_TYPE_SSA, + FILE_TYPE_REAL, + FILE_TYPE_QTMP4, + FILE_TYPE_FLAC, + FILE_TYPE_TTA, + FILE_TYPE_MPEG, + FILE_TYPE_MAX = FILE_TYPE_MPEG +}; int64_t create_track_number(generic_reader_c *reader, int64_t tid); diff --git a/src/merge/output_control.cpp b/src/merge/output_control.cpp index a4a171f41..636b3c791 100644 --- a/src/merge/output_control.cpp +++ b/src/merge/output_control.cpp @@ -124,7 +124,7 @@ int split_max_num_files = 65535; bool use_durations = false; double timecode_scale = TIMECODE_SCALE; -timecode_scale_mode_t timecode_scale_mode = timecode_scale_mode_normal; +timecode_scale_mode_e timecode_scale_mode = TIMECODE_SCALE_MODE_NORMAL; float video_fps = -1.0; int default_tracks[3], default_tracks_priority[3]; @@ -245,12 +245,13 @@ sighandler(int signum) { * Opens the input file and calls the \c probe_file function for each known * file reader class. Uses \c mm_text_io_c for subtitle probing. */ -int +file_type_e get_file_type(const string &filename) { mm_io_c *mm_io; mm_text_io_c *mm_text_io; uint64_t size; - int type, i; + file_type_e type; + int i; const int probe_sizes[] = {16 * 1024, 32 * 1024, 64 * 1024, 128 * 1024, 256 * 1024, 0}; @@ -268,40 +269,40 @@ get_file_type(const string &filename) { filename.c_str()); } - type = TYPEUNKNOWN; + type = FILE_TYPE_UNKNOWN; if (avi_reader_c::probe_file(mm_io, size)) - type = TYPEAVI; + type = FILE_TYPE_AVI; else if (kax_reader_c::probe_file(mm_io, size)) - type = TYPEMATROSKA; + type = FILE_TYPE_MATROSKA; else if (wav_reader_c::probe_file(mm_io, size)) - type = TYPEWAV; + type = FILE_TYPE_WAV; else if (ogm_reader_c::probe_file(mm_io, size)) - type = TYPEOGM; + type = FILE_TYPE_OGM; else if (flac_reader_c::probe_file(mm_io, size)) - type = TYPEFLAC; + type = FILE_TYPE_FLAC; else if (real_reader_c::probe_file(mm_io, size)) - type = TYPEREAL; + type = FILE_TYPE_REAL; else if (qtmp4_reader_c::probe_file(mm_io, size)) - type = TYPEQTMP4; + type = FILE_TYPE_QTMP4; else if (tta_reader_c::probe_file(mm_io, size)) - type = TYPETTA; + type = FILE_TYPE_TTA; else { - for (i = 0; (probe_sizes[i] != 0) && (type == TYPEUNKNOWN); i++) + for (i = 0; (probe_sizes[i] != 0) && (type == FILE_TYPE_UNKNOWN); i++) if (mp3_reader_c::probe_file(mm_io, size, probe_sizes[i], 5)) - type = TYPEMP3; + type = FILE_TYPE_MP3; else if (ac3_reader_c::probe_file(mm_io, size, probe_sizes[i], 5)) - type = TYPEAC3; + type = FILE_TYPE_AC3; } - if (type != TYPEUNKNOWN) + if (type != FILE_TYPE_UNKNOWN) ; else if (mp3_reader_c::probe_file(mm_io, size, 2 * 1024 * 1024, 10)) - type = TYPEMP3; + type = FILE_TYPE_MP3; else if (dts_reader_c::probe_file(mm_io, size)) - type = TYPEDTS; + type = FILE_TYPE_DTS; else if (aac_reader_c::probe_file(mm_io, size)) - type = TYPEAAC; + type = FILE_TYPE_AAC; else if (mpeg_es_reader_c::probe_file(mm_io, size)) - type = TYPEMPEG; + type = FILE_TYPE_MPEG; else { delete mm_io; @@ -317,13 +318,13 @@ get_file_type(const string &filename) { } if (srt_reader_c::probe_file(mm_text_io, size)) - type = TYPESRT; + type = FILE_TYPE_SRT; else if (ssa_reader_c::probe_file(mm_text_io, size)) - type = TYPESSA; + type = FILE_TYPE_SSA; else if (vobsub_reader_c::probe_file(mm_text_io, size)) - type = TYPEVOBSUB; + type = FILE_TYPE_VOBSUB; else - type = TYPEUNKNOWN; + type = FILE_TYPE_UNKNOWN; mm_io = mm_text_io; } @@ -381,7 +382,7 @@ add_packetizer_globally(generic_packetizer_c *packetizer) { memset(&pack, 0, sizeof(packetizer_t)); pack.packetizer = packetizer; pack.orig_packetizer = packetizer; - pack.status = file_status_moredata; + pack.status = FILE_STATUS_MOREDATA; pack.old_status = pack.status; pack.file = -1; foreach(file, files) @@ -417,10 +418,10 @@ set_timecode_scale() { highest_sample_rate = sample_rate; } - if (timecode_scale_mode != timecode_scale_mode_fixed) { + if (timecode_scale_mode != TIMECODE_SCALE_MODE_FIXED) { if (audio_present && (highest_sample_rate > 0) && (!video_present || - (timecode_scale_mode == timecode_scale_mode_auto))) { + (timecode_scale_mode == TIMECODE_SCALE_MODE_AUTO))) { int64_t max_ns_with_timecode_scale; timecode_scale = (double)1000000000.0 / (double)highest_sample_rate - @@ -470,7 +471,7 @@ render_headers(mm_io_c *rout) { kax_infos = &GetChild(*kax_segment); if ((video_packetizer == NULL) || - (timecode_scale_mode == timecode_scale_mode_auto)) + (timecode_scale_mode == TIMECODE_SCALE_MODE_AUTO)) kax_duration = new KaxMyDuration(EbmlFloat::FLOAT_64); else kax_duration = new KaxMyDuration(EbmlFloat::FLOAT_32); @@ -1061,54 +1062,54 @@ create_readers() { foreach(file, files) { try { switch (file->type) { - case TYPEMATROSKA: + case FILE_TYPE_MATROSKA: file->reader = new kax_reader_c(file->ti); break; - case TYPEOGM: + case FILE_TYPE_OGM: file->reader = new ogm_reader_c(file->ti); break; - case TYPEAVI: + case FILE_TYPE_AVI: file->reader = new avi_reader_c(file->ti); break; - case TYPEREAL: + case FILE_TYPE_REAL: file->reader = new real_reader_c(file->ti); break; - case TYPEWAV: + case FILE_TYPE_WAV: file->reader = new wav_reader_c(file->ti); break; - case TYPESRT: + case FILE_TYPE_SRT: file->reader = new srt_reader_c(file->ti); break; - case TYPEMP3: + case FILE_TYPE_MP3: file->reader = new mp3_reader_c(file->ti); break; - case TYPEAC3: + case FILE_TYPE_AC3: file->reader = new ac3_reader_c(file->ti); break; - case TYPEDTS: + case FILE_TYPE_DTS: file->reader = new dts_reader_c(file->ti); break; - case TYPEAAC: + case FILE_TYPE_AAC: file->reader = new aac_reader_c(file->ti); break; - case TYPESSA: + case FILE_TYPE_SSA: file->reader = new ssa_reader_c(file->ti); break; - case TYPEVOBSUB: + case FILE_TYPE_VOBSUB: file->reader = new vobsub_reader_c(file->ti); break; - case TYPEQTMP4: + case FILE_TYPE_QTMP4: file->reader = new qtmp4_reader_c(file->ti); break; #if defined(HAVE_FLAC_FORMAT_H) - case TYPEFLAC: + case FILE_TYPE_FLAC: file->reader = new flac_reader_c(file->ti); break; #endif - case TYPETTA: + case FILE_TYPE_TTA: file->reader = new tta_reader_c(file->ti); break; - case TYPEMPEG: + case FILE_TYPE_MPEG: file->reader = new mpeg_es_reader_c(file->ti); break; default: @@ -1581,7 +1582,7 @@ append_track(packetizer_t &ptzr, old_packetizer = ptzr.packetizer; ptzr.packetizer = *gptzr; ptzr.file = amap.src_file_id; - ptzr.status = file_status_moredata; + ptzr.status = FILE_STATUS_MOREDATA; // If we're dealing with a subtitle track or if the appending file contains // chapters then we have to do some magic. During splitting timecodes are @@ -1670,8 +1671,8 @@ append_tracks_maybe() { continue; if (!files[ptzr->orig_file].appended_to) continue; - if ((ptzr->status == file_status_moredata) || - (ptzr->status == file_status_holding)) + if ((ptzr->status == FILE_STATUS_MOREDATA) || + (ptzr->status == FILE_STATUS_HOLDING)) continue; foreach(amap, append_mapping) if ((amap->dst_file_id == ptzr->file) && @@ -1732,14 +1733,14 @@ main_loop() { // Step 1: Make sure a packet is available for each output // as long we haven't already processed the last one. foreach(ptzr, packetizers) { - if (ptzr->status == file_status_holding) - ptzr->status = file_status_moredata; + if (ptzr->status == FILE_STATUS_HOLDING) + ptzr->status = FILE_STATUS_MOREDATA; ptzr->old_status = ptzr->status; - while ((ptzr->pack == NULL) && (ptzr->status == file_status_moredata) && + while ((ptzr->pack == NULL) && (ptzr->status == FILE_STATUS_MOREDATA) && (ptzr->packetizer->packet_available() < 1)) ptzr->status = ptzr->packetizer->read(); - if ((ptzr->status != file_status_moredata) && - (ptzr->old_status == file_status_moredata)) + if ((ptzr->status != FILE_STATUS_MOREDATA) && + (ptzr->old_status == FILE_STATUS_MOREDATA)) ptzr->packetizer->force_duration_on_last_packet(); if (ptzr->pack == NULL) ptzr->pack = ptzr->packetizer->get_packet(); @@ -1747,7 +1748,7 @@ main_loop() { // Has this packetizer changed its status from "data available" to // "file done" during this loop? If so then decrease the number of // unfinished packetizers in the corresponding file structure. - if ((ptzr->status == file_status_done) && + if ((ptzr->status == FILE_STATUS_DONE) && (ptzr->old_status != ptzr->status)) { filelist_t &file = files[ptzr->file]; diff --git a/src/merge/output_control.h b/src/merge/output_control.h index 2e445fe76..012551c63 100644 --- a/src/merge/output_control.h +++ b/src/merge/output_control.h @@ -17,6 +17,7 @@ #include "os.h" +#include "mkvmerge.h" #include "pr_generic.h" namespace libmatroska { @@ -45,7 +46,7 @@ typedef struct { } append_spec_t; typedef struct packetizer_t { - file_status_t status, old_status; + file_status_e status, old_status; packet_t *pack; generic_packetizer_c *packetizer, *orig_packetizer; int64_t file, orig_file; @@ -60,7 +61,7 @@ typedef struct { typedef struct { char *name; - int type; + file_type_e type; packet_t *pack; @@ -95,10 +96,10 @@ typedef struct { int64_t track_id; } track_order_t; -enum timecode_scale_mode_t { - timecode_scale_mode_normal = 0, - timecode_scale_mode_fixed, - timecode_scale_mode_auto +enum timecode_scale_mode_e { + TIMECODE_SCALE_MODE_NORMAL = 0, + TIMECODE_SCALE_MODE_FIXED, + TIMECODE_SCALE_MODE_AUTO }; extern vector packetizers; @@ -110,7 +111,7 @@ extern vector append_mapping; extern string outfile; extern double timecode_scale; -extern timecode_scale_mode_t timecode_scale_mode; +extern timecode_scale_mode_e timecode_scale_mode; extern bitvalue_c *seguid_link_previous, *seguid_link_next; @@ -153,7 +154,7 @@ extern bool split_by_time; extern double timecode_scale; -int get_file_type(const string &filename); +file_type_e get_file_type(const string &filename); void create_readers(); void setup(); diff --git a/src/merge/pr_generic.cpp b/src/merge/pr_generic.cpp index bcf2c777c..a18573615 100644 --- a/src/merge/pr_generic.cpp +++ b/src/merge/pr_generic.cpp @@ -97,7 +97,7 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader, } // Let's see if the user has specified which cues he wants for this track. - ti->cues = CUES_UNSPECIFIED; + ti->cues = CUE_STRATEGY_UNSPECIFIED; for (i = 0; i < ti->cue_creations->size(); i++) { cc = &(*ti->cue_creations)[i]; if ((cc->id == ti->id) || (cc->id == -1)) { // -1 == all tracks @@ -149,9 +149,9 @@ generic_packetizer_c::generic_packetizer_c(generic_reader_c *nreader, // Let's see if the user has specified how this track should be compressed. ti->compression = COMPRESSION_UNSPECIFIED; for (i = 0; i < ti->compression_list->size(); i++) { - cc = &(*ti->compression_list)[i]; - if ((cc->id == ti->id) || (cc->id == -1)) { // -1 == all tracks - ti->compression = cc->cues; + compression_method_t &cm = (*ti->compression_list)[i]; + if ((cm.id == ti->id) || (cm.id == -1)) { // -1 == all tracks + ti->compression = cm.method; break; } } @@ -319,8 +319,8 @@ void generic_packetizer_c::set_track_type(int type) { htrack_type = type; - if ((type == track_audio) && (ti->cues == CUES_UNSPECIFIED)) - ti->cues = CUES_SPARSE; + if ((type == track_audio) && (ti->cues == CUE_STRATEGY_UNSPECIFIED)) + ti->cues = CUE_STRATEGY_SPARSE; if (type == track_audio) reader->num_audio_tracks++; else if (type == track_video) { @@ -1206,7 +1206,7 @@ track_info_c::track_info_c(): aspect_ratio_given(false), aspect_ratio_is_factor(false), display_dimensions_given(false), - cues(0), + cues(CUE_STRATEGY_NONE), default_track(false), tags_ptr(NULL), tags(NULL), @@ -1232,7 +1232,7 @@ track_info_c::track_info_c(): all_tags = new vector; aac_is_sbr = new vector; packet_delays = new vector; - compression_list = new vector; + compression_list = new vector; track_names = new vector; all_ext_timecodes = new vector; pixel_crop_list = new vector; @@ -1326,7 +1326,7 @@ track_info_c::operator =(const track_info_c &src) { packet_delay = src.packet_delay; packet_delays = new vector(*src.packet_delays); - compression_list = new vector(*src.compression_list); + compression_list = new vector(*src.compression_list); compression = src.compression; track_names = new vector(*src.track_names); diff --git a/src/merge/pr_generic.h b/src/merge/pr_generic.h index 60c97beaa..3a2d5a4a5 100644 --- a/src/merge/pr_generic.h +++ b/src/merge/pr_generic.h @@ -36,7 +36,7 @@ using namespace libmatroska; using namespace std; -// CUES_* control the creation of cue entries for a track. +// CUE_STRATEGY_* control the creation of cue entries for a track. // UNSPECIFIED: is used for command line parsing. // NONE: don't create any cue entries. // IFRAMES: Create cue entries for all I frames. @@ -44,11 +44,13 @@ using namespace std; // SPARSE: Create cue entries for I frames if no video track exists, but // create at most one cue entries every two seconds. Used for // audio only files. -#define CUES_UNSPECIFIED -1 -#define CUES_NONE 0 -#define CUES_IFRAMES 1 -#define CUES_ALL 2 -#define CUES_SPARSE 3 +enum cue_strategy_e { + CUE_STRATEGY_UNSPECIFIED = -1, + CUE_STRATEGY_NONE, + CUE_STRATEGY_IFRAMES, + CUE_STRATEGY_ALL, + CUE_STRATEGY_SPARSE +}; #define DEFTRACK_TYPE_AUDIO 0 #define DEFTRACK_TYPE_VIDEO 1 @@ -57,10 +59,10 @@ using namespace std; class generic_packetizer_c; class generic_reader_c; -enum file_status_t { - file_status_done = 0, - file_status_holding, - file_status_moredata +enum file_status_e { + FILE_STATUS_DONE = 0, + FILE_STATUS_HOLDING, + FILE_STATUS_MOREDATA }; class memory_c { @@ -110,10 +112,12 @@ typedef struct { int64_t id; } audio_sync_t; -#define DEFAULT_TRACK_PRIOIRTY_NONE 0 -#define DEFAULT_TRACK_PRIORITY_FROM_TYPE 10 -#define DEFAULT_TRACK_PRIORITY_FROM_SOURCE 50 -#define DEFAULT_TRACK_PRIORITY_CMDLINE 255 +enum default_track_priority_e { + DEFAULT_TRACK_PRIOIRTY_NONE = 0, + DEFAULT_TRACK_PRIORITY_FROM_TYPE = 10, + DEFAULT_TRACK_PRIORITY_FROM_SOURCE = 50, + DEFAULT_TRACK_PRIORITY_CMDLINE = 255 +}; #define FMT_FN "'%s': " #define FMT_TID "'%s' track %lld: " @@ -131,10 +135,17 @@ typedef struct { } packet_t; struct cue_creation_t { - int cues; + cue_strategy_e cues; int64_t id; - cue_creation_t(): cues(0), id(0) {} + cue_creation_t(): cues(CUE_STRATEGY_NONE), id(0) {} +}; + +struct compression_method_t { + compression_method_e method; + int64_t id; + + compression_method_t(): method(COMPRESSION_UNSPECIFIED), id(0) {} }; struct language_t { @@ -204,7 +215,7 @@ public: audio_sync_t async; // For this very track vector *cue_creations; // As given on the command line - int cues; // For this very track + cue_strategy_e cues; // For this very track vector *default_track_flags; // As given on the command line bool default_track; // For this very track @@ -224,8 +235,8 @@ public: vector *packet_delays; // As given on the command line int64_t packet_delay; // For this very track - vector *compression_list; // As given on the command line - int compression; // For this very track + vector *compression_list; // As given on the cmd line + compression_method_e compression; // For this very track vector *track_names; // As given on the command line string track_name; // For this very track @@ -284,7 +295,7 @@ public: generic_reader_c(track_info_c *nti); virtual ~generic_reader_c(); - virtual file_status_t read(generic_packetizer_c *ptzr, bool force = false) + virtual file_status_e read(generic_packetizer_c *ptzr, bool force = false) = 0; virtual void read_all(); virtual int get_progress() = 0; @@ -311,9 +322,11 @@ protected: virtual bool demuxing_requested(char type, int64_t id); }; -#define CAN_CONNECT_YES 0 -#define CAN_CONNECT_NO_FORMAT -1 -#define CAN_CONNECT_NO_PARAMETERS -2 +enum connection_result_e { + CAN_CONNECT_YES, + CAN_CONNECT_NO_FORMAT, + CAN_CONNECT_NO_PARAMETERS +}; class generic_packetizer_c { protected: @@ -342,7 +355,7 @@ protected: int hvideo_pixel_width, hvideo_pixel_height; int hvideo_display_width, hvideo_display_height; - int hcompression; + compression_method_e hcompression; compression_c *compressor; timecode_factory_c *timecode_factory; @@ -363,7 +376,7 @@ public: virtual bool contains_gap(); - virtual file_status_t read() { + virtual file_status_e read() { return reader->read(this); } virtual void reset() { @@ -405,10 +418,10 @@ public: virtual void dump_debug_info() = 0; - virtual void set_cue_creation(int create_cue_data) { + virtual void set_cue_creation(cue_strategy_e create_cue_data) { ti->cues = create_cue_data; } - virtual int get_cue_creation() { + virtual cue_strategy_e get_cue_creation() { return ti->cues; } virtual int64_t get_last_cue_timecode() { @@ -470,7 +483,7 @@ public: virtual void set_track_name(const string &name); - virtual void set_default_compression_method(int method) { + virtual void set_default_compression_method(compression_method_e method) { hcompression = method; } @@ -488,7 +501,7 @@ public: virtual void force_duration_on_last_packet(); virtual const char *get_format_name() = 0; - virtual int can_connect_to(generic_packetizer_c *src) = 0; + virtual connection_result_e can_connect_to(generic_packetizer_c *src) = 0; virtual void connect(generic_packetizer_c *src, int64_t _append_timecode_offset = -1); diff --git a/src/mmg/jobs.cpp b/src/mmg/jobs.cpp index ee932fe61..82c444a67 100644 --- a/src/mmg/jobs.cpp +++ b/src/mmg/jobs.cpp @@ -164,7 +164,7 @@ job_run_dialog::start_next_job() { "mkvmerge's command line option called '%s" "' (error code %d, %s)."), opt_file_name.c_str(), errno, wxUCS(strerror(errno))); - jobs[ndx].status = jobs_failed; + jobs[ndx].status = JOBS_FAILED; mdlg->save_job_queue(); if (process != NULL) { delete process; @@ -281,16 +281,16 @@ job_run_dialog::on_end_process(wxProcessEvent &evt) { ndx = jobs_to_start[current_job]; exit_code = evt.GetExitCode(); if (abort) { - jobs[ndx].status = jobs_aborted; + jobs[ndx].status = JOBS_ABORTED; status = "aborted"; } else if (exit_code == 0) { - jobs[ndx].status = jobs_done; + jobs[ndx].status = JOBS_DONE; status = "completed OK"; } else if (exit_code == 1) { - jobs[ndx].status = jobs_done_warnings; + jobs[ndx].status = JOBS_DONE_WARNINGS; status = "completed with warnings"; } else { - jobs[ndx].status = jobs_failed; + jobs[ndx].status = JOBS_FAILED; status = "failed"; } jobs[ndx].finished_on = time(NULL); @@ -488,10 +488,10 @@ job_dialog::create_list_item(int i) { dummy = lv_jobs->InsertItem(i, s); s.Printf(wxT("%s"), - jobs[i].status == jobs_pending ? wxT("pending") : - jobs[i].status == jobs_done ? wxT("done") : - jobs[i].status == jobs_done_warnings ? wxT("done/warnings") : - jobs[i].status == jobs_aborted ? wxT("aborted") : + jobs[i].status == JOBS_PENDING ? wxT("pending") : + jobs[i].status == JOBS_DONE ? wxT("done") : + jobs[i].status == JOBS_DONE_WARNINGS ? wxT("done/warnings") : + jobs[i].status == JOBS_ABORTED ? wxT("aborted") : wxT("failed")); lv_jobs->SetItem(dummy, 1, s); @@ -532,7 +532,7 @@ job_dialog::on_start(wxCommandEvent &evt) { vector jobs_to_start; for (i = 0; i < jobs.size(); i++) - if (jobs[i].status == jobs_pending) + if (jobs[i].status == JOBS_PENDING) jobs_to_start.push_back(i); if (jobs_to_start.size() == 0) return; @@ -669,7 +669,7 @@ job_dialog::on_reenable(wxCommandEvent &evt) { item = lv_jobs->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == -1) break; - jobs[item].status = jobs_pending; + jobs[item].status = JOBS_PENDING; lv_jobs->SetItem(item, 1, wxT("pending")); } @@ -685,7 +685,7 @@ job_dialog::on_disable(wxCommandEvent &evt) { item = lv_jobs->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); if (item == -1) break; - jobs[item].status = jobs_done; + jobs[item].status = JOBS_DONE; lv_jobs->SetItem(item, 1, wxT("done")); } diff --git a/src/mmg/jobs.h b/src/mmg/jobs.h index 5f87c6872..6e0826175 100644 --- a/src/mmg/jobs.h +++ b/src/mmg/jobs.h @@ -33,17 +33,17 @@ #define ID_JOBS_B_SAVE_LOG 17011 #define ID_JOBS_B_DISABLE 17012 -enum job_status_t { - jobs_pending, - jobs_done, - jobs_done_warnings, - jobs_aborted, - jobs_failed +enum job_status_e { + JOBS_PENDING, + JOBS_DONE, + JOBS_DONE_WARNINGS, + JOBS_ABORTED, + JOBS_FAILED }; typedef struct { int32_t id; - job_status_t status; + job_status_e status; int32_t added_on, started_on, finished_on; wxString *description, *log; } job_t; diff --git a/src/mmg/mmg.cpp b/src/mmg/mmg.cpp index e6c638b3c..d9a6aba6c 100644 --- a/src/mmg/mmg.cpp +++ b/src/mmg/mmg.cpp @@ -1549,7 +1549,7 @@ mmg_dialog::on_add_to_jobqueue(wxCommandEvent &evt) { if (last_job_id > 2000000000) last_job_id = 0; job.id = last_job_id; - job.status = jobs_pending; + job.status = JOBS_PENDING; job.added_on = wxGetLocalTime(); job.started_on = -1; job.finished_on = -1; @@ -1605,11 +1605,11 @@ mmg_dialog::load_job_queue() { job.id = value; cfg->Read(wxT("status"), &s); job.status = - s == wxT("pending") ? jobs_pending : - s == wxT("done") ? jobs_done : - s == wxT("done_warnings") ? jobs_done_warnings : - s == wxT("aborted") ? jobs_aborted : - jobs_failed; + s == wxT("pending") ? JOBS_PENDING : + s == wxT("done") ? JOBS_DONE : + s == wxT("done_warnings") ? JOBS_DONE_WARNINGS : + s == wxT("aborted") ? JOBS_ABORTED : + JOBS_FAILED; cfg->Read(wxT("added_on"), &value); job.added_on = value; cfg->Read(wxT("started_on"), &value); @@ -1649,10 +1649,10 @@ mmg_dialog::save_job_queue() { cfg->SetPath(s); cfg->Write(wxT("id"), jobs[i].id); cfg->Write(wxT("status"), - jobs[i].status == jobs_pending ? wxT("pending") : - jobs[i].status == jobs_done ? wxT("done") : - jobs[i].status == jobs_done_warnings ? wxT("done_warnings") : - jobs[i].status == jobs_aborted ? wxT("aborted") : + jobs[i].status == JOBS_PENDING ? wxT("pending") : + jobs[i].status == JOBS_DONE ? wxT("done") : + jobs[i].status == JOBS_DONE_WARNINGS ? wxT("done_warnings") : + jobs[i].status == JOBS_ABORTED ? wxT("aborted") : wxT("failed")); cfg->Write(wxT("added_on"), jobs[i].added_on); cfg->Write(wxT("started_on"), jobs[i].started_on); diff --git a/src/mmg/tab_input.cpp b/src/mmg/tab_input.cpp index 5a03c78b2..b90c6fb11 100644 --- a/src/mmg/tab_input.cpp +++ b/src/mmg/tab_input.cpp @@ -815,33 +815,33 @@ tab_input::add_file(const wxString &file_name) { info = output[i].Mid(pos + 11).AfterFirst(wxT('[')). BeforeLast(wxT(']')); if (container == wxT("AAC")) - file.container = TYPEAAC; + file.container = FILE_TYPE_AAC; else if (container == wxT("AC3")) - file.container = TYPEAC3; + file.container = FILE_TYPE_AC3; else if (container == wxT("AVI")) - file.container = TYPEAVI; + file.container = FILE_TYPE_AVI; else if (container == wxT("DTS")) - file.container = TYPEDTS; + file.container = FILE_TYPE_DTS; else if (container == wxT("Matroska")) - file.container = TYPEMATROSKA; + file.container = FILE_TYPE_MATROSKA; else if (container == wxT("MP2/MP3")) - file.container = TYPEMP3; + file.container = FILE_TYPE_MP3; else if (container == wxT("Ogg/OGM")) - file.container = TYPEOGM; + file.container = FILE_TYPE_OGM; else if (container == wxT("Quicktime/MP4")) - file.container = TYPEQTMP4; + file.container = FILE_TYPE_QTMP4; else if (container == wxT("RealMedia")) - file.container = TYPEREAL; + file.container = FILE_TYPE_REAL; else if (container == wxT("SRT")) - file.container = TYPESRT; + file.container = FILE_TYPE_SRT; else if (container == wxT("SSA/ASS")) - file.container = TYPESSA; + file.container = FILE_TYPE_SSA; else if (container == wxT("VobSub")) - file.container = TYPEVOBSUB; + file.container = FILE_TYPE_VOBSUB; else if (container == wxT("WAV")) - file.container = TYPEWAV; + file.container = FILE_TYPE_WAV; else - file.container = TYPEUNKNOWN; + file.container = FILE_TYPE_UNKNOWN; if (info.length() > 0) { args = split(info, wxU(" ")); @@ -871,7 +871,7 @@ tab_input::add_file(const wxString &file_name) { file.file_name = new wxString(file_name); mdlg->set_title_maybe(*file.title); - if ((file.container == TYPEOGM) && + if ((file.container == FILE_TYPE_OGM) && (video_track_name.length() > 0)) mdlg->set_title_maybe(video_track_name); mdlg->set_output_maybe(*file.file_name); @@ -1034,7 +1034,7 @@ tab_input::on_file_selected(wxCommandEvent &evt) { selected_track = -1; new_sel = lb_input_files->GetSelection(); f = &files[new_sel]; - if (f->container == TYPEMATROSKA) { + if (f->container == FILE_TYPE_MATROSKA) { st_file_options->Enable(true); cb_no_chapters->Enable(true); cb_no_attachments->Enable(true); diff --git a/src/output/p_aac.cpp b/src/output/p_aac.cpp index 205009b4a..9e3037288 100644 --- a/src/output/p_aac.cpp +++ b/src/output/p_aac.cpp @@ -196,7 +196,7 @@ aac_packetizer_c::process(memory_c &mem, if (needs_negative_displacement(duration)) { displace(-duration); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } while (needs_positive_displacement(duration)) { add_packet(mem, my_timecode + ti->async.displacement, duration); @@ -210,7 +210,7 @@ aac_packetizer_c::process(memory_c &mem, debug_leave("aac_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } byte_buffer.add(mem.data, mem.size); @@ -230,7 +230,7 @@ aac_packetizer_c::process(memory_c &mem, debug_leave("aac_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -239,7 +239,7 @@ aac_packetizer_c::dump_debug_info() { packet_queue.size(), byte_buffer.get_size()); } -int +connection_result_e aac_packetizer_c::can_connect_to(generic_packetizer_c *src) { aac_packetizer_c *asrc; diff --git a/src/output/p_aac.h b/src/output/p_aac.h index 42f88941d..0224fbaa8 100644 --- a/src/output/p_aac.h +++ b/src/output/p_aac.h @@ -46,7 +46,7 @@ public: virtual const char *get_format_name() { return "AAC"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); private: virtual unsigned char *get_aac_packet(unsigned long *header, diff --git a/src/output/p_ac3.cpp b/src/output/p_ac3.cpp index a5e593b34..a80b0dcd3 100644 --- a/src/output/p_ac3.cpp +++ b/src/output/p_ac3.cpp @@ -175,7 +175,7 @@ ac3_packetizer_c::process(memory_c &mem, debug_leave("ac3_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -184,7 +184,7 @@ ac3_packetizer_c::dump_debug_info() { packet_queue.size(), byte_buffer.get_size()); } -int +connection_result_e ac3_packetizer_c::can_connect_to(generic_packetizer_c *src) { ac3_packetizer_c *asrc; diff --git a/src/output/p_ac3.h b/src/output/p_ac3.h index cfab63eaa..a4f05288a 100644 --- a/src/output/p_ac3.h +++ b/src/output/p_ac3.h @@ -44,7 +44,7 @@ public: virtual const char *get_format_name() { return "AC3"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); protected: virtual unsigned char *get_ac3_packet(unsigned long *header, diff --git a/src/output/p_dts.cpp b/src/output/p_dts.cpp index cba477fef..9358e198d 100644 --- a/src/output/p_dts.cpp +++ b/src/output/p_dts.cpp @@ -167,8 +167,8 @@ void dts_packetizer_c::set_headers() { set_codec_id(MKV_A_DTS); set_audio_sampling_freq((float)first_header.core_sampling_frequency); - if ((first_header.lfe_type == dts_header_t::lfe_64) || - (first_header.lfe_type == dts_header_t::lfe_128)) + if ((first_header.lfe_type == dts_header_t::LFE_64) || + (first_header.lfe_type == dts_header_t::LFE_128)) set_audio_channels(first_header.audio_channels + 1); else set_audio_channels(first_header.audio_channels); @@ -214,7 +214,7 @@ dts_packetizer_c::process(memory_c &mem, debug_leave("dts_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -222,7 +222,7 @@ dts_packetizer_c::dump_debug_info() { mxdebug("dts_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e dts_packetizer_c::can_connect_to(generic_packetizer_c *src) { dts_packetizer_c *dsrc; diff --git a/src/output/p_dts.h b/src/output/p_dts.h index 46f346ea4..b368b13ee 100644 --- a/src/output/p_dts.h +++ b/src/output/p_dts.h @@ -50,7 +50,7 @@ public: virtual const char *get_format_name() { return "DTS"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); private: virtual void add_to_buffer(unsigned char *buf, int size); diff --git a/src/output/p_flac.cpp b/src/output/p_flac.cpp index 0f7c4fe05..a042cce39 100644 --- a/src/output/p_flac.cpp +++ b/src/output/p_flac.cpp @@ -103,14 +103,14 @@ flac_packetizer_c::process(memory_c &mem, "and is being skipped.\n"), ti->fname.c_str(), (int64_t)ti->id, num_packets + 1); debug_leave("flac_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } duration = duration * 1000000000ll / stream_info.sample_rate; add_packet(mem, timecode, duration); num_packets++; debug_leave("flac_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -118,7 +118,7 @@ flac_packetizer_c::dump_debug_info() { mxdebug("flac_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e flac_packetizer_c::can_connect_to(generic_packetizer_c *src) { flac_packetizer_c *fsrc; diff --git a/src/output/p_flac.h b/src/output/p_flac.h index d310042ac..878ecbc73 100644 --- a/src/output/p_flac.h +++ b/src/output/p_flac.h @@ -50,7 +50,7 @@ public: virtual const char *get_format_name() { return "Flac"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; #endif // HAVE_FLAC_STREAM_DECODER_H diff --git a/src/output/p_mp3.cpp b/src/output/p_mp3.cpp index 64594d1c9..3753166e8 100644 --- a/src/output/p_mp3.cpp +++ b/src/output/p_mp3.cpp @@ -217,7 +217,7 @@ mp3_packetizer_c::process(memory_c &mem, debug_leave("mp3_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -226,7 +226,7 @@ mp3_packetizer_c::dump_debug_info() { packet_queue.size(), byte_buffer.get_size()); } -int +connection_result_e mp3_packetizer_c::can_connect_to(generic_packetizer_c *src) { mp3_packetizer_c *msrc; diff --git a/src/output/p_mp3.h b/src/output/p_mp3.h index 825b7a9fd..1c894913a 100644 --- a/src/output/p_mp3.h +++ b/src/output/p_mp3.h @@ -45,7 +45,7 @@ public: virtual const char *get_format_name() { return "MP3"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); private: virtual unsigned char *get_mp3_packet(mp3_header_t *mp3header); diff --git a/src/output/p_passthrough.cpp b/src/output/p_passthrough.cpp index a906e7e98..69021646d 100644 --- a/src/output/p_passthrough.cpp +++ b/src/output/p_passthrough.cpp @@ -62,7 +62,7 @@ passthrough_packetizer_c::process(memory_c &mem, if ((duration > 0) && needs_negative_displacement(duration)) { displace(-duration); sync_to_keyframe = true; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } if ((duration > 0) && needs_positive_displacement(duration) && sync_complete_group) { @@ -77,7 +77,7 @@ passthrough_packetizer_c::process(memory_c &mem, } if (sync_to_keyframe && (bref != -1)) - return file_status_moredata; + return FILE_STATUS_MOREDATA; sync_to_keyframe = false; timecode = (int64_t)((timecode + ti->async.displacement) * ti->async.linear); duration = (int64_t)(duration * ti->async.linear); @@ -88,7 +88,7 @@ passthrough_packetizer_c::process(memory_c &mem, add_packet(mem, timecode, duration, duration_mandatory, bref, fref); debug_leave("passthrough_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -103,7 +103,7 @@ passthrough_packetizer_c::dump_debug_info() { packets_processed, bytes_processed, packet_queue.size()); } -int +connection_result_e passthrough_packetizer_c::can_connect_to(generic_packetizer_c *src) { passthrough_packetizer_c *psrc; diff --git a/src/output/p_passthrough.h b/src/output/p_passthrough.h index 16834794a..59836aede 100644 --- a/src/output/p_passthrough.h +++ b/src/output/p_passthrough.h @@ -44,7 +44,7 @@ public: virtual const char *get_format_name() { return "passthrough"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; #endif // __P_PASSTHROUGH_H diff --git a/src/output/p_pcm.cpp b/src/output/p_pcm.cpp index 506859c61..2feec42b0 100644 --- a/src/output/p_pcm.cpp +++ b/src/output/p_pcm.cpp @@ -103,7 +103,7 @@ pcm_packetizer_c::process(memory_c &mem, if (skip_bytes) { if (skip_bytes > mem.size) { skip_bytes -= mem.size; - return file_status_moredata; + return FILE_STATUS_MOREDATA; } mem.size -= skip_bytes; new_buf = &mem.data[skip_bytes]; @@ -123,7 +123,7 @@ pcm_packetizer_c::process(memory_c &mem, debug_leave("pcm_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -145,7 +145,7 @@ pcm_packetizer_c::dump_debug_info() { mxdebug("pcm_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e pcm_packetizer_c::can_connect_to(generic_packetizer_c *src) { pcm_packetizer_c *psrc; diff --git a/src/output/p_pcm.h b/src/output/p_pcm.h index 26c41d8aa..3542266fd 100644 --- a/src/output/p_pcm.h +++ b/src/output/p_pcm.h @@ -48,7 +48,7 @@ public: virtual const char *get_format_name() { return "PCM"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; #endif // __P_PCM_H diff --git a/src/output/p_realaudio.cpp b/src/output/p_realaudio.cpp index a20927132..7f90a8866 100644 --- a/src/output/p_realaudio.cpp +++ b/src/output/p_realaudio.cpp @@ -96,14 +96,14 @@ ra_packetizer_c::process(memory_c &mem, // skip_to_keyframe = false; // else { // displace(-duration); -// return file_status_moredata; +// return FILE_STATUS_MOREDATA; // } // } // if (needs_negative_displacement(duration)) { // skip_to_keyframe = true; // displace(-duration); -// return file_status_moredata; +// return FILE_STATUS_MOREDATA; // } else if (needs_positive_displacement(duration)) { // if (!buffer_until_keyframe) { // buffer_until_keyframe = true; @@ -134,7 +134,7 @@ ra_packetizer_c::process(memory_c &mem, // buffered_packets.push_back(mem.grab()); // buffered_timecodes.push_back(timecode); // buffered_durations.push_back(duration); -// return file_status_moredata; +// return FILE_STATUS_MOREDATA; // } // } @@ -143,14 +143,14 @@ ra_packetizer_c::process(memory_c &mem, debug_leave("ra_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void ra_packetizer_c::dump_debug_info() { } -int +connection_result_e ra_packetizer_c::can_connect_to(generic_packetizer_c *src) { ra_packetizer_c *psrc; diff --git a/src/output/p_realaudio.h b/src/output/p_realaudio.h index dff4e249b..aae491fff 100644 --- a/src/output/p_realaudio.h +++ b/src/output/p_realaudio.h @@ -49,7 +49,7 @@ public: virtual const char *get_format_name() { return "RealAudio"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); protected: virtual void dump_debug_info(); diff --git a/src/output/p_textsubs.cpp b/src/output/p_textsubs.cpp index 8ec01e5a5..52f30709b 100644 --- a/src/output/p_textsubs.cpp +++ b/src/output/p_textsubs.cpp @@ -84,14 +84,14 @@ textsubs_packetizer_c::process(memory_c &mem, end = (int64_t)(ti->async.linear * end); if (end < 0) - return file_status_moredata; + return FILE_STATUS_MOREDATA; else if (start < 0) start = 0; if (length < 0) { mxwarn("textsubs_packetizer: Ignoring an entry which starts after it ends." "\n"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } // Count the number of lines. @@ -138,7 +138,7 @@ textsubs_packetizer_c::process(memory_c &mem, add_packet(mem, start, length, true); } - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -146,7 +146,7 @@ textsubs_packetizer_c::dump_debug_info() { mxdebug("textsubs_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e textsubs_packetizer_c::can_connect_to(generic_packetizer_c *src) { textsubs_packetizer_c *psrc; diff --git a/src/output/p_textsubs.h b/src/output/p_textsubs.h index 812dd2a4d..eb7b23efb 100644 --- a/src/output/p_textsubs.h +++ b/src/output/p_textsubs.h @@ -47,7 +47,7 @@ public: virtual const char *get_format_name() { return "text subtitle"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; diff --git a/src/output/p_tta.cpp b/src/output/p_tta.cpp index 1da9b2b1d..50813b325 100644 --- a/src/output/p_tta.cpp +++ b/src/output/p_tta.cpp @@ -77,7 +77,7 @@ tta_packetizer_c::process(memory_c &mem, debug_leave("tta_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -85,7 +85,7 @@ tta_packetizer_c::dump_debug_info() { mxdebug("tta_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e tta_packetizer_c::can_connect_to(generic_packetizer_c *src) { tta_packetizer_c *psrc; diff --git a/src/output/p_tta.h b/src/output/p_tta.h index 592e67215..bea7c89b1 100644 --- a/src/output/p_tta.h +++ b/src/output/p_tta.h @@ -42,7 +42,7 @@ public: virtual const char *get_format_name() { return "TTA"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; #endif // __P_TTA_H diff --git a/src/output/p_video.cpp b/src/output/p_video.cpp index a80a4b951..013d0f3a3 100644 --- a/src/output/p_video.cpp +++ b/src/output/p_video.cpp @@ -48,8 +48,8 @@ video_packetizer_c::video_packetizer_c(generic_reader_c *nreader, frames_output = 0; bframes = nbframes; ref_timecode = -1; - if (get_cue_creation() == CUES_UNSPECIFIED) - set_cue_creation(CUES_IFRAMES); + if (get_cue_creation() == CUE_STRATEGY_UNSPECIFIED) + set_cue_creation( CUE_STRATEGY_IFRAMES); duration_shift = 0; bref_frame.type = '?'; fref_frame.type = '?'; @@ -195,7 +195,7 @@ video_packetizer_c::process(memory_c &mem, debug_leave("video_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } if (is_mpeg4 && !aspect_ratio_extracted) @@ -227,7 +227,7 @@ video_packetizer_c::process(memory_c &mem, debug_leave("video_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } video_packetizer_c::~video_packetizer_c() { @@ -344,7 +344,7 @@ video_packetizer_c::flush_frames(char next_frame, bref_frame.type = '?'; } -int +connection_result_e video_packetizer_c::can_connect_to(generic_packetizer_c *src) { video_packetizer_c *vsrc; diff --git a/src/output/p_video.h b/src/output/p_video.h index 92486f0a2..922844003 100644 --- a/src/output/p_video.h +++ b/src/output/p_video.h @@ -54,7 +54,7 @@ public: virtual const char *get_format_name() { return "video"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); protected: virtual void flush_frames(char next_frame = '?', bool flush_all = false); diff --git a/src/output/p_vobsub.cpp b/src/output/p_vobsub.cpp index f75531061..a08c78eb4 100644 --- a/src/output/p_vobsub.cpp +++ b/src/output/p_vobsub.cpp @@ -67,12 +67,12 @@ vobsub_packetizer_c::process(memory_c &mem, int64_t) { timecode += initial_displacement; if (timecode < 0) - return file_status_moredata; + return FILE_STATUS_MOREDATA; timecode = (int64_t)((float)timecode * ti->async.linear); add_packet(mem, timecode, duration, true); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -80,7 +80,7 @@ vobsub_packetizer_c::dump_debug_info() { mxdebug("vobsub_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e vobsub_packetizer_c::can_connect_to(generic_packetizer_c *src) { vobsub_packetizer_c *vsrc; diff --git a/src/output/p_vobsub.h b/src/output/p_vobsub.h index 4573d6751..6ad8e352f 100644 --- a/src/output/p_vobsub.h +++ b/src/output/p_vobsub.h @@ -44,7 +44,7 @@ public: virtual const char *get_format_name() { return "VobSub"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; #endif // __P_VOBSUB_H diff --git a/src/output/p_vorbis.cpp b/src/output/p_vorbis.cpp index 01c4f9e50..d35d9b00f 100644 --- a/src/output/p_vorbis.cpp +++ b/src/output/p_vorbis.cpp @@ -213,7 +213,7 @@ vorbis_packetizer_c::process(memory_c &mem, // If a negative sync value was used we may have to skip this packet. if (chosen_timecode < 0) { debug_leave("vorbis_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } mxverb(2, "Vorbis: samples_here at %lld (orig %lld expected %lld): %lld " @@ -224,7 +224,7 @@ vorbis_packetizer_c::process(memory_c &mem, debug_leave("vorbis_packetizer_c::process"); - return file_status_moredata; + return FILE_STATUS_MOREDATA; } void @@ -232,7 +232,7 @@ vorbis_packetizer_c::dump_debug_info() { mxdebug("vorbis_packetizer_c: queue: %d\n", packet_queue.size()); } -int +connection_result_e vorbis_packetizer_c::can_connect_to(generic_packetizer_c *src) { vorbis_packetizer_c *vsrc; diff --git a/src/output/p_vorbis.h b/src/output/p_vorbis.h index 89d9ca1ad..4f59b55af 100644 --- a/src/output/p_vorbis.h +++ b/src/output/p_vorbis.h @@ -51,7 +51,7 @@ public: virtual const char *get_format_name() { return "Vorbis"; } - virtual int can_connect_to(generic_packetizer_c *src); + virtual connection_result_e can_connect_to(generic_packetizer_c *src); }; #endif // __P_VORBIS_H