Adjusted the content encoding handling to the final specs.

This commit is contained in:
Moritz Bunkus 2003-10-21 22:01:31 +00:00
parent 8fc4c7e1d7
commit c2240e6500
3 changed files with 102 additions and 90 deletions

View File

@ -1,3 +1,8 @@
2003-10-22 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: Adjusted the compression handling to the final content
encoding specs.
2003-10-19 Moritz Bunkus <moritz@bunkus.org> 2003-10-19 Moritz Bunkus <moritz@bunkus.org>
* mkvmerge: new feature: Implemented generic support for frame * mkvmerge: new feature: Implemented generic support for frame

View File

@ -528,10 +528,12 @@ void generic_packetizer_c::set_headers() {
hcompression = ti->compression; hcompression = ti->compression;
if ((hcompression != COMPRESSION_UNSPECIFIED) && if ((hcompression != COMPRESSION_UNSPECIFIED) &&
(hcompression != COMPRESSION_NONE)) { (hcompression != COMPRESSION_NONE)) {
KaxContentEncodings *c_encodings;
KaxContentEncoding *c_encoding; KaxContentEncoding *c_encoding;
KaxContentCompression *c_comp; KaxContentCompression *c_comp;
c_encoding = &GetChild<KaxContentEncoding>(*track_entry); c_encodings = &GetChild<KaxContentEncodings>(*track_entry);
c_encoding = &GetChild<KaxContentEncoding>(*c_encodings);
// First modification // First modification
*static_cast<EbmlUInteger *> *static_cast<EbmlUInteger *>
(&GetChild<KaxContentEncodingOrder>(*c_encoding)) = 0; (&GetChild<KaxContentEncodingOrder>(*c_encoding)) = 0;

View File

@ -798,6 +798,7 @@ int kax_reader_c::read_headers() {
KaxTrackLanguage *ktlanguage; KaxTrackLanguage *ktlanguage;
KaxTrackMinCache *ktmincache; KaxTrackMinCache *ktmincache;
KaxTrackName *ktname; KaxTrackName *ktname;
KaxContentEncodings *kcencodings;
int kcenc_idx; int kcenc_idx;
vector<kax_content_encoding_t>::iterator ce_ins_it; vector<kax_content_encoding_t>::iterator ce_ins_it;
@ -1009,104 +1010,108 @@ int kax_reader_c::read_headers() {
safefree(tmp); safefree(tmp);
} }
for (kcenc_idx = 0; kcenc_idx < ktentry->ListSize(); kcenc_idx++) { kcencodings = FINDFIRST(ktentry, KaxContentEncodings);
l3 = (*ktentry)[kcenc_idx]; if (kcencodings != NULL) {
if (EbmlId(*l3) == KaxContentEncoding::ClassInfos.GlobalId) { for (kcenc_idx = 0; kcenc_idx < kcencodings->ListSize();
KaxContentEncoding *kcenc; kcenc_idx++) {
KaxContentEncodingOrder *ce_order; l3 = (*kcencodings)[kcenc_idx];
KaxContentEncodingType *ce_type; if (EbmlId(*l3) == KaxContentEncoding::ClassInfos.GlobalId) {
KaxContentEncodingScope *ce_scope; KaxContentEncoding *kcenc;
KaxContentCompression *ce_comp; KaxContentEncodingOrder *ce_order;
KaxContentEncryption *ce_enc; KaxContentEncodingType *ce_type;
kax_content_encoding_t enc; KaxContentEncodingScope *ce_scope;
KaxContentCompression *ce_comp;
KaxContentEncryption *ce_enc;
kax_content_encoding_t enc;
memset(&enc, 0, sizeof(kax_content_encoding_t)); memset(&enc, 0, sizeof(kax_content_encoding_t));
kcenc = static_cast<KaxContentEncoding *>(l3); kcenc = static_cast<KaxContentEncoding *>(l3);
ce_order = FINDFIRST(kcenc, KaxContentEncodingOrder); ce_order = FINDFIRST(kcenc, KaxContentEncodingOrder);
if (ce_order != NULL) if (ce_order != NULL)
enc.order = uint32(*ce_order); enc.order = uint32(*ce_order);
ce_type = FINDFIRST(kcenc, KaxContentEncodingType); ce_type = FINDFIRST(kcenc, KaxContentEncodingType);
if (ce_type != NULL) if (ce_type != NULL)
enc.type = uint32(*ce_type); enc.type = uint32(*ce_type);
ce_scope = FINDFIRST(kcenc, KaxContentEncodingScope); ce_scope = FINDFIRST(kcenc, KaxContentEncodingScope);
if (ce_scope != NULL) if (ce_scope != NULL)
enc.scope = uint32(*ce_scope); enc.scope = uint32(*ce_scope);
else else
enc.scope = 1; enc.scope = 1;
ce_comp = FINDFIRST(kcenc, KaxContentCompression); ce_comp = FINDFIRST(kcenc, KaxContentCompression);
if (ce_comp != NULL) { if (ce_comp != NULL) {
KaxContentCompAlgo *cc_algo; KaxContentCompAlgo *cc_algo;
KaxContentCompSettings *cc_settings; KaxContentCompSettings *cc_settings;
cc_algo = FINDFIRST(ce_comp, KaxContentCompAlgo); cc_algo = FINDFIRST(ce_comp, KaxContentCompAlgo);
if (cc_algo != NULL) if (cc_algo != NULL)
enc.comp_algo = uint32(*cc_algo); enc.comp_algo = uint32(*cc_algo);
cc_settings = FINDFIRST(ce_comp, KaxContentCompSettings); cc_settings = FINDFIRST(ce_comp, KaxContentCompSettings);
if (cc_settings != NULL) { if (cc_settings != NULL) {
enc.comp_settings = enc.comp_settings =
(unsigned char *)safememdup(&binary(*cc_settings), (unsigned char *)safememdup(&binary(*cc_settings),
cc_settings->GetSize()); cc_settings->GetSize());
enc.comp_settings_len = cc_settings->GetSize(); enc.comp_settings_len = cc_settings->GetSize();
}
} }
ce_enc = FINDFIRST(kcenc, KaxContentEncryption);
if (ce_enc != NULL) {
KaxContentEncAlgo *ce_ealgo;
KaxContentEncKeyID *ce_ekeyid;
KaxContentSigAlgo *ce_salgo;
KaxContentSigHashAlgo *ce_shalgo;
KaxContentSigKeyID *ce_skeyid;
KaxContentSignature *ce_signature;
ce_ealgo = FINDFIRST(ce_enc, KaxContentEncAlgo);
if (ce_ealgo != NULL)
enc.enc_algo = uint32(*ce_ealgo);
ce_ekeyid = FINDFIRST(ce_enc, KaxContentEncKeyID);
if (ce_ekeyid != NULL) {
enc.enc_keyid =
(unsigned char *)safememdup(&binary(*ce_ekeyid),
ce_ekeyid->GetSize());
enc.enc_keyid_len = ce_ekeyid->GetSize();
}
ce_salgo = FINDFIRST(ce_enc, KaxContentSigAlgo);
if (ce_salgo != NULL)
enc.enc_algo = uint32(*ce_salgo);
ce_shalgo = FINDFIRST(ce_enc, KaxContentSigHashAlgo);
if (ce_shalgo != NULL)
enc.enc_algo = uint32(*ce_shalgo);
ce_skeyid = FINDFIRST(ce_enc, KaxContentSigKeyID);
if (ce_skeyid != NULL) {
enc.sig_keyid =
(unsigned char *)safememdup(&binary(*ce_skeyid),
ce_skeyid->GetSize());
enc.sig_keyid_len = ce_skeyid->GetSize();
}
ce_signature = FINDFIRST(ce_enc, KaxContentSignature);
if (ce_signature != NULL) {
enc.signature =
(unsigned char *)safememdup(&binary(*ce_signature),
ce_signature->GetSize());
enc.signature_len = ce_signature->GetSize();
}
}
ce_ins_it = track->c_encodings->begin();
while ((ce_ins_it != track->c_encodings->end()) &&
(enc.order <= (*ce_ins_it).order))
ce_ins_it++;
track->c_encodings->insert(ce_ins_it, enc);
} }
ce_enc = FINDFIRST(kcenc, KaxContentEncryption);
if (ce_enc != NULL) {
KaxContentEncAlgo *ce_ealgo;
KaxContentEncKeyID *ce_ekeyid;
KaxContentSigAlgo *ce_salgo;
KaxContentSigHashAlgo *ce_shalgo;
KaxContentSigKeyID *ce_skeyid;
KaxContentSignature *ce_signature;
ce_ealgo = FINDFIRST(ce_enc, KaxContentEncAlgo);
if (ce_ealgo != NULL)
enc.enc_algo = uint32(*ce_ealgo);
ce_ekeyid = FINDFIRST(ce_enc, KaxContentEncKeyID);
if (ce_ekeyid != NULL) {
enc.enc_keyid =
(unsigned char *)safememdup(&binary(*ce_ekeyid),
ce_ekeyid->GetSize());
enc.enc_keyid_len = ce_ekeyid->GetSize();
}
ce_salgo = FINDFIRST(ce_enc, KaxContentSigAlgo);
if (ce_salgo != NULL)
enc.enc_algo = uint32(*ce_salgo);
ce_shalgo = FINDFIRST(ce_enc, KaxContentSigHashAlgo);
if (ce_shalgo != NULL)
enc.enc_algo = uint32(*ce_shalgo);
ce_skeyid = FINDFIRST(ce_enc, KaxContentSigKeyID);
if (ce_skeyid != NULL) {
enc.sig_keyid =
(unsigned char *)safememdup(&binary(*ce_skeyid),
ce_skeyid->GetSize());
enc.sig_keyid_len = ce_skeyid->GetSize();
}
ce_signature = FINDFIRST(ce_enc, KaxContentSignature);
if (ce_signature != NULL) {
enc.signature =
(unsigned char *)safememdup(&binary(*ce_signature),
ce_signature->GetSize());
enc.signature_len = ce_signature->GetSize();
}
}
ce_ins_it = track->c_encodings->begin();
while ((ce_ins_it != track->c_encodings->end()) &&
(enc.order <= (*ce_ins_it).order))
ce_ins_it++;
track->c_encodings->insert(ce_ins_it, enc);
} }
} }