-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatroskaTagData.cpp
1985 lines (1742 loc) · 52.4 KB
/
MatroskaTagData.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Part of The TCMP Matroska CDL, a plugin to access extra features of Matroska files with TCMP
*
* MatroskaTagData.cpp
*
* Copyright (C) Jory Stone - June 2003
*
* The TCMP Matroska CDL is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* The TCMP Matroska CDL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with The TCMP Matroska CDL; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
/*!
\file MatroskaTagData.cpp
\version \$Id: MatroskaTagData.cpp,v 1.18 2004/03/08 07:56:51 jcsston Exp $
\brief This file deals mostly with the tag stuctures ;)
\author Jory Stone <jcsston @ toughguy.net>
Inspired by ;) John Cannon ([email protected]) (c) 2003
*/
#include "MatroskaTagData.h"
using namespace LIBEBML_NAMESPACE;
using namespace LIBMATROSKA_NAMESPACE;
using namespace MatroskaUtilsNamespace;
namespace MatroskaUtilsNamespace {
static MatroskaSimpleTagOfficalListEntry MatroskaSimpleTagOfficalList1[] =
{
{_T("ARCHIVAL_LOCATION"), _T("Indicates where the subject of the file is archived (same as the IARL tag in RIFF)")},
{_T("BIBLIOGRAPHY"), _T("")},
{_T("BITSPS"), _T("The average bits per second of the specified item. This is only the data in the Blocks, and excludes headers and any container overhead.")},
{_T("ENCODER"), _T("The software or hardware used to encode this item. (VirtualDubv2.1)")},
{_T("ENCODE_SETTINGS"), _T("A list of the settings used for encoding this item. No specific format.")},
{_T("FILE"), _T("The file that the item originated from. For example this track was encoded from the file 3_dt.vob.")},
{_T("FRAMESPS"), _T("The average frames per second of the specified item. This is typically the average number of Blocks per second. In the event that lacing is used, each laced chunk is to be counted as a seperate frame.")},
{_T("LANGUAGE"), _T("Specify the language of the track, in the ISO-639-2 form. If this is for a single track, the language must be set the same and the Track Language.")},
{_T("KEYWORDS"), _T("Keyword to the item, used for searching.")},
{_T("MOOD"), _T("A set of words indicating the mood of the item.")},
{_T("ORIGINAL_MEDIA_TYPE"), _T("Describes the original subject of the file, such as, \"computer image,\" \"drawing,\" \"lithograph,\" and so forth.")},
{_T("PLAY_COUNTER"), _T("The number of time the item has been played.")},
{_T("POPULARIMETER"), _T("A numeric value defining the how much a person likes the song. This is completey subjective.")},
{_T("PRODUCT"), _T("Specifies the name of the title the file was originally intended for, such as \"Encyclopedia of Pacific Northwest Geography.\"")},
{_T("RECORD_LOCATION"), _T("The countries corresponding to the string, same 2 octets as in Internet domains, or possibly ISO 3166.")},
{_T("SOURCE"), _T("Identifies the name of the person or organization who supplied the original subject of the file. For example, \"Trey Research.\"")},
{_T("SOURCE_FORM"), _T("Identifies the original form of the material that was digitized, such as \"slide,\" \"paper,\" \"map,\" and so forth. This is not necessarily the same as IMED.")},
{_T("SUBJECT"), _T("Describes the conbittents of the file, such as \"Aerial view of Seattle.\"")},
{_T("RATING"), _T("The ICRA rating. (Previously RSACi)")},
{_T("UNSYNCHRONISED_TEXT"), _T("Lyrics or subtitles that have no synchronization data.")},
{_T("GENRE"), _T("The genre.")},
{_T("AUDIO_GAIN"), _T("The gain to apply to reach 89db SPL on playback.")},
{_T("AUDIO_PEAK"), _T("The maximum absolute peak value of the item.")},
{_T("BPM"), _T("Contains the number of beats per minute in the main part of the audio. This is general.")},
{_T("DISC_TRACK"), _T("Track number in the original CD.")},
{_T("SET_PART"), _T("The total number of tracks on a disc.")},
{_T("INSTRUMENT"), _T("The instrument that is being used/played.")},
{_T("INITIAL_KEY"), _T("The initial key that a musical track starts in. The format is identical to ID3.")},
{_T("CAPTURE_DPI"), _T("Stores dots per inch setting of the digitizer used to produce the file, such as \"300.\"")},
{_T("CAPTURE_LIGHTNESS"), _T("Describes the changes in lightness settings on the digitizer required to produce the file. Note that the format of this information depends on hardware used.")},
{_T("CAPTURE_PALETTE_SETTING"), _T("Specifies the number of colors requested when digitizing an image, such as \"256.\"")},
{_T("CAPTURE_SHARPNESS"), _T("Identifies the changes in sharpness for the digitizer required to produce the file (the format depends on the hardware used).")},
{_T("CROPPED"), _T("Describes whether an image has been cropped and, if so, how it was cropped. For example, \"30 pixels lower right corner\".")},
{_T("ORIGINAL_DIMENSIONS"), _T("Dimensions. Specifies the size of the original subject of the file. For example, \"8.5 in h, 11 in w.\"")},
{_T("COMMENTS"), _T("Any comment related to the content.")},
{_T("FILE_PURCHASE"), _T("Information on where to purchase this file. This is akin to the WPAY tag in ID3.")},
{_T("ITEM_PURCHASE"), _T("Information on where to purchase this album. This is akin to the WCOM tag in ID3.")},
{_T("OWNER"), _T("Information on the purchase that occurred for this file. This is akin to the OWNE tag in ID3.")},
{_T("ADDRESS"), _T("The physical address of the entity. The address should include a country code.")},
{_T("URL"), _T("URL of the entity.")},
{_T("EMAIL"), _T("Email address of the entity.")},
{_T("CURRENCY"), _T("The currency type used to pay for the entity. Use ISO 4217 for the 3 letter currency code.")},
{_T("AMOUNT"), _T("The amount paid for entity.")},
{_T("DATE_ENCODING"), _T("The time that the encoding of this item was completed. This is akin to the TDEN tag in ID3.")},
{_T("DATE_RECORDING"), _T("The time that the recording began, and finished. This is akin to the TDRC tag in ID3.")},
{_T("DATE_RELEASE"), _T("The time that the item was originaly released. This is akin to the TDRL tag in ID3.")},
{_T("DATE_RELEASE_ORIGINAL"), _T("The time that the item was originaly released if it is a remake. This is akin to the TDOR tag in ID3.")},
{_T("DATE_TAGGING"), _T("The time that the tags were done for this item. This is akin to the TDTG tag in ID3.")},
{_T("DATE_DIGITIZING"), _T("The time that the item was tranfered to a digital medium. This is akin to the IDIT tag in RIFF.")},
{_T("DATE"), _T("The date the entity ocurred on or began.")},
{_T("DATE_END"), _T("The date the entity ended.")},
{_T("LYRICIST"), _T("The person that wrote the words/script for this item. This is akin to the TEXT tag in ID3.")},
{_T("COMPOSER"), _T("The name of the composer of this item. This is akin to the TCOM tag in ID3.")},
{_T("LEAD_PERFORMER"), _T("Lead Performer/Soloist(s). This is akin to the TPE1 tag in ID3.")},
{_T("BAND"), _T("Band/orchestra/accompaniment. This is akin to the TPE2 tag in ID3.")},
{_T("ORIGINAL_LYRICIST"), _T("Original lyricist(s)/text writer(s). This is akin to the TOLY tag in ID3.")},
{_T("ORIGINAL_PERFORMER"), _T("Original artist(s)/performer(s). This is akin to the TOPE tag in ID3.")},
{_T("ORIGINAL_TITLE"), _T("Original album/movie/show title. This is akin to the TOAL tag in ID3.")},
{_T("CONDUCTOR"), _T("Conductor/performer refinement. This is akin to the TPE3 tag in ID3.")},
{_T("MODIFIED_BY"), _T("Interpreted, remixed, or otherwise modified by. This is akin to the TPE4 tag in ID3.")},
{_T("DIRECTOR"), _T("This is akin to the IART tag in RIFF.")},
{_T("PRODUCED_BY"), _T("Produced by. This is akin to the IPRO tag in Extended RIFF.")},
{_T("CINEMATOGRAPHER"), _T("Cinematographer. This is akin to the ICNM tag in Extended RIFF.")},
{_T("PRODUCTION_DESIGNER"), _T("This is akin to the IPDS tag in Extended RIFF.")},
{_T("COSTUME_DESIGNER"), _T("This is akin to the ICDS tag in Extended RIFF.")},
{_T("PRODUCTION_STUDIO"), _T("This is akin to the ISTD tag in Extended RIFF.")},
{_T("DISTRIBUTED_BY"), _T("This is akin to the IDST tag in Extended RIFF.")},
{_T("COMMISSIONED_BY"), _T("This is akin to the ICMS tag in RIFF.")},
{_T("ENGINEER"), _T("This is akin to the IENG tag in RIFF.")},
{_T("EDITED_BY"), _T("This is akin to the IEDT tag in Extended RIFF.")},
{_T("ENCODED_BY"), _T("This is akin to the TENC tag in ID3.")},
{_T("RIPPED_BY"), _T("This is akin to the IRIP tag in Extended RIFF.")},
{_T("INVOLVED_PERSON"), _T("A very general tag for everyone else that wants to be listed. This is akin to the TMCL tag in ID3v2.4.")},
{_T("INTERNET_RADIO_STATION"), _T("This is akin to the TSRN tag in ID3v2.4.")},
{_T("PUBLISHER"), _T("This is akin to the TPUB tag in ID3.")},
{_T("ISRC"), _T("The International Standard Recording Code")},
{_T("ISBN"), _T("International Standard Book Number")},
{_T("CATALOG"), _T("Sometimes the EAN/UPC, often some letters followed by some numbers.")},
{_T("EAN"), _T("EAN-13 bar code identifier")},
{_T("UPC"), _T("UPC-A bar code identifier")},
{_T("LABEL_CODE"), _T("Typically printed as ________ (LC) xxxx) ~~~~~~~~ or _________ (LC) 0xxxx) ~~~~~~~~~ on CDs medias or covers, where xxxx is a 4-digit number.")},
{_T("LCCN"), _T("Library of Congress Control Number")},
{_T("COPYRIGHT"), _T("The copyright information as per the copyright holder. This is akin to the TCOP tag in ID3.")},
{_T("PRODUCTION_COPYRIGHT"), _T("The copyright information as per the production copyright holder. This is akin to the TPRO tag in ID3.")},
{_T("TERMS_OF_USE"), _T("The terms of use for this item. This is akin to the USER tag in ID3.")},
{_T("TITLE"), _T("The title of this item. In the case of a track, the MultiName element should be identical to the Name element. For example, for music you might label this \"Canon in D\", or for video's audio track you might use \"English 5.1\" This is akin to the TIT2 tag in ID3.")},
{_T("ALBUM"), _T("This is the name given to a grouping of tracks and/or chapters. For example, all video, audio, and subtitle tracks for a movie would be grouped under this and be given the name of the movie. All tracks for a particular CD would be grouped together under the title of the CD, or if all tracks for a CD were recorded as a single track, seperated by chapters, the same would apply. You could use this to label episode 3 of The Simpsons. This is akin to the TALB tag in ID3.")},
{_T("SET_TITLE"), _T("This would be used to label a set of ID 2. For example, season 13 of The Simpsons.")},
{_T("SERIES"), _T("This would be used to label a set of ID 3. For example, The Simpsons.")},
{_T("SUBTITLE"), _T("Sub Title of the entity.")},
{_T("EDITION"), _T("Edition name of the entity (\"director's cut\", \"original edit\", etc).")},
{NULL, NULL}
};
/*******************************************
* Begin Tag classes *
*******************************************/
MatroskaTagUID::MatroskaTagUID()
: std::vector<uint64>(1)
{
}
void MatroskaTagUID::Add(uint64 newUID)
{
if (at(0) == 0) {
at(0) = newUID;
return;
}
if (Find(newUID) != 0)
return;
push_back(newUID);
}
void MatroskaTagUID::Remove(uint64 deleteUID)
{
MatroskaTagUID::iterator itToDelete = begin();
while (itToDelete != end()){
if (deleteUID == *itToDelete) {
if (size() > 1)
erase(itToDelete);
else
at(0) = 0;
return;
}
itToDelete++;
}
}
uint64 &MatroskaTagUID::Find(uint64 uid)
{
static uint64 zeroValue = 0;
for (size_t u = 0; u < size(); u++)
if (at(u) == uid)
return at(u);
return zeroValue;
}
uint64 &MatroskaTagUID::operator = (uint64 newUID)
{
return at(0) = newUID;
}
MatroskaTagUID::operator uint64()
{
return at(0);
}
MatroskaTagMultiItemBase::MatroskaTagMultiItemBase() {
Type = 0;
};
bool MatroskaTagMultiItemBase::IsValid() {
if (Type == -1)
return false;
return true;
};
void MatroskaTagMultiItemBase::Invalidate() {
Type = -1;
};
MatroskaTagMultiCommentItem::MatroskaTagMultiCommentItem()
{
ODS("MatroskaTagMultiCommentItem::MatroskaTagMultiCommentItem()");
this->Comments = L"";
this->Language = "";
this->next_item = NULL;
};
MatroskaTagMultiCommercialItem::MatroskaTagMultiCommercialItem()
{
ODS("MatroskaTagMultiCommercialItem::MatroskaTagMultiCommercialItem()");
this->Address = L"";
this->Email = "";
this->URL = "";
this->PriceAmount = 0;
this->PriceCurrency = "";
this->PriceDate = 0;
this->next_item = NULL;
};
MatroskaTagMultiDateItem::MatroskaTagMultiDateItem()
{
ODS("MatroskaTagMultiDateItem::MatroskaTagMultiDateItem()");
this->DateBegin = 0;
this->DateEnd = 0;
this->next_item = NULL;
};
/*
void MatroskaTagMultiDateItem::SetBeginDate(const char *dateStr)
{
if (dateStr == NULL)
return;
objDateBegin = dateStr;
tm *new_date = new tm;
new_date->tm_hour = objDateBegin.GetHour();
new_date->tm_min = objDateBegin.GetMin();
new_date->tm_sec = objDateBegin.GetSeconds();
new_date->tm_mon = objDateBegin.GetMonth();
new_date->tm_mday = objDateBegin.GetDay();
new_date->tm_year = objDateBegin.GetYear();
DateBegin = _mktime64(new_date);
delete new_date;
};*/
MatroskaTagMultiEntityItem::MatroskaTagMultiEntityItem()
{
ODS("MatroskaTagMultiEntityItem::MatroskaTagMultiEntityItem()");
this->Address = L"";
this->Email = "";
this->URL = "";
this->Name = L"";
this->next_item = NULL;
};
MatroskaTagMultiIdentifierItem::MatroskaTagMultiIdentifierItem()
{
ODS("MatroskaTagMultiIdentifierItem::MatroskaTagMultiIdentifierItem()");
this->BinaryData = NULL;
this->BinaryData_Length = 0;
this->StringData = L"";
this->next_item = NULL;
};
MatroskaTagMultiLegalItem::MatroskaTagMultiLegalItem()
{
ODS("MatroskaTagMultiLegalItem::MatroskaTagMultiLegalItem()");
this->Address = L"";
this->URL = "";
this->next_item = NULL;
};
MatroskaTagMultiTitleItem::MatroskaTagMultiTitleItem()
{
ODS("MatroskaTagMultiTitleItem::MatroskaTagMultiTitleItem()");
this->Address = L"";
this->Email = "";
this->URL = "";
this->Name = L"";
this->Edition = L"";
this->SubTitle = L"";
this->Language = "";
this->next_item = NULL;
};
/************** MatroskaTagMultiComment Class **************/
MatroskaTagMultiComment::MatroskaTagMultiComment()
{
TRACE("MatroskaTagMultiComment::MatroskaTagMultiComment()");
first_item = NULL;
};
MatroskaTagMultiComment::~MatroskaTagMultiComment()
{
TRACE("MatroskaTagMultiComment::~MatroskaTagMultiComment()");
//I should free memory here
MatroskaTagMultiCommentItem *temp = NULL;
temp = first_item;
while (temp != NULL)
{
if (first_item != NULL)
{
first_item = first_item->next_item;
}
delete temp;
temp = first_item;
}
};
void MatroskaTagMultiComment::AddItem(MatroskaTagMultiCommentItem *new_item)
{
if (new_item != NULL) {
new_item->next_item = first_item;
first_item = new_item;
}
};
MatroskaTagMultiCommentItem *MatroskaTagMultiComment::FindTrackItemWithLang(char *language_id)
{
MatroskaTagMultiCommentItem *current = first_item;
while (current != NULL)
{
if (current->Language == language_id) {
return current;
}
//Keep searching
current = current->next_item;
}
return NULL;
};
int MatroskaTagMultiComment::GetMultiCommentCount()
{
MatroskaTagMultiCommentItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
item_count++;
//Keep going
current = current->next_item;
}
return item_count;
};
MatroskaTagMultiCommentItem *MatroskaTagMultiComment::GetItem(int requested_index)
{
MatroskaTagMultiCommentItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
if (requested_index == item_count)
return current;
//Keep searching
item_count++;
current = current->next_item;
}
return NULL;
};
/************** MatroskaTagMultiCommercial Class **************/
MatroskaTagMultiCommercial::MatroskaTagMultiCommercial()
{
TRACE("MatroskaTagMultiCommercial::MatroskaTagMultiCommercial()");
first_item = NULL;
};
MatroskaTagMultiCommercial::~MatroskaTagMultiCommercial()
{
TRACE("MatroskaTagMultiCommercial::~MatroskaTagMultiCommercial()");
//I should free memory here
MatroskaTagMultiCommercialItem *temp = NULL;
temp = first_item;
while (temp != NULL)
{
if (first_item != NULL)
{
first_item = first_item->next_item;
}
delete temp;
temp = first_item;
}
};
void MatroskaTagMultiCommercial::AddItem(MatroskaTagMultiCommercialItem *new_item)
{
if (new_item != NULL) {
new_item->next_item = first_item;
first_item = new_item;
}
};
MatroskaTagMultiCommercialItem *MatroskaTagMultiCommercial::FindTrackItemWithType(int type_id)
{
MatroskaTagMultiCommercialItem *current = first_item;
while (current != NULL)
{
if (current->Type == type_id) {
return current;
}
//Keep searching
current = current->next_item;
}
return NULL;
};
int MatroskaTagMultiCommercial::GetMultiCommercialCount()
{
MatroskaTagMultiCommercialItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
item_count++;
//Keep going
current = current->next_item;
}
return item_count;
};
MatroskaTagMultiCommercialItem *MatroskaTagMultiCommercial::GetItem(int requested_index)
{
MatroskaTagMultiCommercialItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
if (requested_index == item_count)
return current;
//Keep searching
item_count++;
current = current->next_item;
}
return NULL;
};
char *MatroskaTagMultiCommercial::ConvertTypeUIntToStr(uint16 type_id)
{
static char unknown_type_txt[32];
switch(type_id)
{
case KaxTagMultiCommercialType_FilePurchase:
return "File Purchase";
break;
case KaxTagMultiCommercialType_ItemPurchase:
return "Item Purchase";
break;
case KaxTagMultiCommercialType_Owner:
return "Owner";
break;
default:
snprintf(unknown_type_txt, 31, "Unknown Type (%u)", type_id);
return unknown_type_txt;
}
};
uint16 MatroskaTagMultiCommercial::ConvertTypeStrToUInt(char *type_str)
{
if (!stricmp("File Purchase", type_str)) {
return KaxTagMultiCommercialType_FilePurchase;
}else if (!stricmp("Item Purchase", type_str)) {
return KaxTagMultiCommercialType_ItemPurchase;
}else if (!stricmp("Owner", type_str)) {
return KaxTagMultiCommercialType_Owner;
}
return 0;
};
/************** MatroskaTagMultiDate Class **************/
MatroskaTagMultiDate::MatroskaTagMultiDate()
{
TRACE("MatroskaTagMultiDate::MatroskaTagMultiDate()");
first_item = NULL;
};
MatroskaTagMultiDate::~MatroskaTagMultiDate()
{
TRACE("MatroskaTagMultiDate::~MatroskaTagMultiDate()");
//I should free memory here
MatroskaTagMultiDateItem *temp = NULL;
temp = first_item;
while (temp != NULL)
{
if (first_item != NULL)
{
first_item = first_item->next_item;
}
delete temp;
temp = first_item;
}
};
void MatroskaTagMultiDate::AddItem(MatroskaTagMultiDateItem *new_item)
{
if (new_item != NULL) {
new_item->next_item = first_item;
first_item = new_item;
}
};
MatroskaTagMultiDateItem *MatroskaTagMultiDate::FindTrackItemWithType(int type_id)
{
MatroskaTagMultiDateItem *current = first_item;
while (current != NULL)
{
if (current->Type == type_id) {
return current;
}
//Keep searching
current = current->next_item;
}
return NULL;
};
int MatroskaTagMultiDate::GetMultiDateCount()
{
MatroskaTagMultiDateItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
item_count++;
//Keep going
current = current->next_item;
}
return item_count;
};
MatroskaTagMultiDateItem *MatroskaTagMultiDate::GetItem(int requested_index)
{
MatroskaTagMultiDateItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
if (requested_index == item_count)
return current;
//Keep searching
item_count++;
current = current->next_item;
}
return NULL;
};
char *MatroskaTagMultiDate::ConvertTypeUIntToStr(uint16 type_id)
{
switch(type_id)
{
case KaxTagMultiDateType_DigitizingDate:
return "Digitizing Date";
break;
case KaxTagMultiDateType_EncodingDate:
return "Encoding Date";
break;
case KaxTagMultiDateType_OriginalReleaseDate:
return "Original Release Date";
break;
case KaxTagMultiDateType_RecordingDate:
return "Recording Date";
break;
case KaxTagMultiDateType_ReleaseDate:
return "Release Date";
break;
case KaxTagMultiDateType_TaggingDate:
return "Tagging Date";
break;
default:
static char type_txt[65] = { 0 };//new char[strlen("Unknown Type (65000)")+1];
snprintf(type_txt, 64, "Unknown Type (%u)", type_id);
return type_txt;
}
};
uint16 MatroskaTagMultiDate::ConvertTypeStrToUInt(char *type_str)
{
if (!stricmp("Digitizing Date", type_str)) {
return KaxTagMultiDateType_DigitizingDate;
}else if (!stricmp("Encoding Date", type_str)) {
return KaxTagMultiDateType_EncodingDate;
}else if (!stricmp("Original Release Date", type_str)) {
return KaxTagMultiDateType_OriginalReleaseDate;
}else if (!stricmp("Recording Date", type_str)) {
return KaxTagMultiDateType_RecordingDate;
}else if (!stricmp("Release Date", type_str)) {
return KaxTagMultiDateType_ReleaseDate;
}else if (!stricmp("Tagging Date", type_str)) {
return KaxTagMultiDateType_TaggingDate;
}
return 0;
};
/************** MatroskaTagMultiEntity Class **************/
MatroskaTagMultiEntity::MatroskaTagMultiEntity()
{
TRACE("Multi-Entity List Created");
first_item = NULL;
};
MatroskaTagMultiEntity::~MatroskaTagMultiEntity()
{
TRACE("Multi-Entity List Deleted");
//I should free memory here
MatroskaTagMultiEntityItem *temp = NULL;
temp = first_item;
while (temp != NULL)
{
if (first_item != NULL)
{
first_item = first_item->next_item;
}
delete temp;
temp = first_item;
}
};
void MatroskaTagMultiEntity::AddItem(MatroskaTagMultiEntityItem *new_item)
{
if (new_item != NULL) {
new_item->next_item = first_item;
first_item = new_item;
}
};
MatroskaTagMultiEntityItem *MatroskaTagMultiEntity::FindTrackItemWithType(int type_id)
{
MatroskaTagMultiEntityItem *current = first_item;
while (current != NULL)
{
if (current->Type == type_id) {
return current;
}
//Keep searching
current = current->next_item;
}
return NULL;
};
int MatroskaTagMultiEntity::GetMultiEntityCount()
{
MatroskaTagMultiEntityItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
item_count++;
//Keep going
current = current->next_item;
}
return item_count;
};
MatroskaTagMultiEntityItem *MatroskaTagMultiEntity::GetItem(int requested_index)
{
MatroskaTagMultiEntityItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
if (requested_index == item_count)
return current;
//Keep searching
item_count++;
current = current->next_item;
}
return NULL;
};
char *MatroskaTagMultiEntity::ConvertTypeUIntToStr(uint16 type_id)
{
switch(type_id)
{
case KaxTagMultiEntitiesType_BandOrchestraAccompaniment:
return "Band/Orchestra/Accompaniment";
break;
case KaxTagMultiEntitiesType_Cinematographer:
return "Cinematographer";
break;
case KaxTagMultiEntitiesType_CommissionedBy:
return "Commissioned By";
break;
case KaxTagMultiEntitiesType_Composer:
return "Composer";
break;
case KaxTagMultiEntitiesType_ConductorPerformerRefinement:
return "Conductor/Performer/Refinement";
break;
case KaxTagMultiEntitiesType_CostumeDesigner:
return "Costume Designer";
break;
case KaxTagMultiEntitiesType_Director:
return "Director";
break;
case KaxTagMultiEntitiesType_DistributedBy:
return "Distributed By";
break;
case KaxTagMultiEntitiesType_EditedBy:
return "Edited By";
break;
case KaxTagMultiEntitiesType_EncodedBy:
return "Encoded By";
break;
case KaxTagMultiEntitiesType_Engineer:
return "Engineer";
break;
case KaxTagMultiEntitiesType_InternetRadioStationName:
return "Internet Radio Station Name";
break;
case KaxTagMultiEntitiesType_InterpretedRemixedBy:
return "Interpreted/Remixed By";
break;
case KaxTagMultiEntitiesType_InvolvedPeopleList:
return "Involved People List";
break;
case KaxTagMultiEntitiesType_LeadPerformerSoloist:
return "Lead Performer/Soloist";
break;
case KaxTagMultiEntitiesType_LyricistTextWriter:
return "Lyricist Text Writer";
break;
case KaxTagMultiEntitiesType_OriginalAlbumMovieShowTitle:
return "Original Album/Movie/Show Title";
break;
case KaxTagMultiEntitiesType_OriginalArtistPerformer:
return "Original Artist/Performer";
break;
case KaxTagMultiEntitiesType_OriginalLyricistTextWriter:
return "Original Lyricist Text Writer";
break;
case KaxTagMultiEntitiesType_ProducedBy:
return "Produced By";
break;
case KaxTagMultiEntitiesType_ProductionDesigner:
return "Production Designer";
break;
case KaxTagMultiEntitiesType_ProductionStudio:
return "Production Studio";
break;
case KaxTagMultiEntitiesType_Publisher:
return "Publisher";
break;
case KaxTagMultiEntitiesType_RippedBy:
return "Ripped By";
break;
default:
char *type_txt = new char[strlen("Unknown Type (65000)")+1];
sprintf(type_txt, "Unknown Type (%u)", type_id);
return type_txt;
}
};
uint16 MatroskaTagMultiEntity::ConvertTypeStrToUInt(char *type_str)
{
if (!stricmp("Ripped By", type_str)) {
return KaxTagMultiEntitiesType_RippedBy;
}else if (!stricmp("Band/Orchestra/Accompaniment", type_str)) {
return KaxTagMultiEntitiesType_BandOrchestraAccompaniment;
}else if (!stricmp("Cinematographer", type_str)) {
return KaxTagMultiEntitiesType_Cinematographer;
}else if (!stricmp("Commissioned By", type_str)) {
return KaxTagMultiEntitiesType_CommissionedBy;
}else if (!stricmp("Composer", type_str)) {
return KaxTagMultiEntitiesType_Composer;
}else if (!stricmp("Conductor/Performer/Refinement", type_str)) {
return KaxTagMultiEntitiesType_ConductorPerformerRefinement;
}else if (!stricmp("Costume Designer", type_str)) {
return KaxTagMultiEntitiesType_CostumeDesigner;
}else if (!stricmp("Director", type_str)) {
return KaxTagMultiEntitiesType_Director;
}else if (!stricmp("Distributed By", type_str)) {
return KaxTagMultiEntitiesType_DistributedBy;
}else if (!stricmp("Edited By", type_str)) {
return KaxTagMultiEntitiesType_EditedBy;
}else if (!stricmp("Encoded By", type_str)) {
return KaxTagMultiEntitiesType_EncodedBy;
}else if (!stricmp("Engineer", type_str)) {
return KaxTagMultiEntitiesType_Engineer;
}else if (!stricmp("Internet Radio Station Name", type_str)) {
return KaxTagMultiEntitiesType_InternetRadioStationName;
}else if (!stricmp("Interpreted/Remixed By", type_str)) {
return KaxTagMultiEntitiesType_InterpretedRemixedBy;
}else if (!stricmp("Involved People List", type_str)) {
return KaxTagMultiEntitiesType_InvolvedPeopleList;
}else if (!stricmp("Lead Performer/Soloist", type_str)) {
return KaxTagMultiEntitiesType_LeadPerformerSoloist;
}else if (!stricmp("Lyricist Text Writer", type_str)) {
return KaxTagMultiEntitiesType_LyricistTextWriter;
}else if (!stricmp("Original Album/Movie/Show Title", type_str)) {
return KaxTagMultiEntitiesType_OriginalAlbumMovieShowTitle;
}else if (!stricmp("Original Artist/Performer", type_str)) {
return KaxTagMultiEntitiesType_OriginalArtistPerformer;
}else if (!stricmp("Original Lyricist Text Writer", type_str)) {
return KaxTagMultiEntitiesType_OriginalLyricistTextWriter;
}else if (!stricmp("Produced By", type_str)) {
return KaxTagMultiEntitiesType_ProducedBy;
}else if (!stricmp("Production Designer", type_str)) {
return KaxTagMultiEntitiesType_ProductionDesigner;
}else if (!stricmp("Production Studio", type_str)) {
return KaxTagMultiEntitiesType_ProductionStudio;
}else if (!stricmp("Publisher", type_str)) {
return KaxTagMultiEntitiesType_Publisher;
}else if (!stricmp("Ripped By", type_str)) {
return KaxTagMultiEntitiesType_RippedBy;
}
return 0;
};
/************** MatroskaTagMultiIdentifier Class **************/
MatroskaTagMultiIdentifier::MatroskaTagMultiIdentifier()
{
TRACE("Multi-Identifier List Created");
first_item = NULL;
};
MatroskaTagMultiIdentifier::~MatroskaTagMultiIdentifier()
{
TRACE("Multi-Identifier List Deleted");
//I should free memory here
MatroskaTagMultiIdentifierItem *temp = NULL;
temp = first_item;
while (temp != NULL)
{
if (first_item != NULL)
{
first_item = first_item->next_item;
}
delete temp;
temp = first_item;
}
};
void MatroskaTagMultiIdentifier::AddItem(MatroskaTagMultiIdentifierItem *new_item)
{
if (new_item != NULL) {
new_item->next_item = first_item;
first_item = new_item;
}
};
MatroskaTagMultiIdentifierItem *MatroskaTagMultiIdentifier::FindTrackItemWithType(int type_id)
{
MatroskaTagMultiIdentifierItem *current = first_item;
while (current != NULL)
{
if (current->Type == type_id) {
return current;
}
//Keep searching
current = current->next_item;
}
return NULL;
};
int MatroskaTagMultiIdentifier::GetMultiIdentifierCount()
{
MatroskaTagMultiIdentifierItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
item_count++;
//Keep going
current = current->next_item;
}
return item_count;
};
MatroskaTagMultiIdentifierItem *MatroskaTagMultiIdentifier::GetItem(int requested_index)
{
MatroskaTagMultiIdentifierItem *current = first_item;
int item_count = 0;
while (current != NULL)
{
if (requested_index == item_count)
return current;
//Keep searching
item_count++;
current = current->next_item;
}
return NULL;
};
char *MatroskaTagMultiIdentifier::ConvertTypeUIntToStr(uint16 type_id)
{
switch(type_id)
{
case KaxTagMultiIdentifierType_Catalog:
return "Catalog";
break;
case KaxTagMultiIdentifierType_CDIdentifier:
return "CD Identifier";
break;
case KaxTagMultiIdentifierType_EAN:
return "EAN";
break;
case KaxTagMultiIdentifierType_ISBN:
return "ISBN";
break;
case KaxTagMultiIdentifierType_ISRC:
return "ISRC";
break;
case KaxTagMultiIdentifierType_LabelCode:
return "Label Code";
break;
case KaxTagMultiIdentifierType_LCCN:
return "LCCN";
break;
case KaxTagMultiIdentifierType_UniqueFileIdentifier:
return "Unique File Identifier";
break;
case KaxTagMultiIdentifierType_UPC:
return "UPC";
break;
default:
char *type_txt = new char[strlen("Unknown Type (65000)")+1];
sprintf(type_txt, "Unknown Type (%u)", type_id);
return type_txt;
}
};
uint16 MatroskaTagMultiIdentifier::ConvertTypeStrToUInt(char *type_str)
{
if (!stricmp("Catalog", type_str)) {
return KaxTagMultiIdentifierType_Catalog;
}else if (!stricmp("CD Identifier", type_str)) {
return KaxTagMultiIdentifierType_CDIdentifier;
}else if (!stricmp("EAN", type_str)) {
return KaxTagMultiIdentifierType_EAN;
}else if (!stricmp("ISBN", type_str)) {
return KaxTagMultiIdentifierType_ISBN;
}else if (!stricmp("ISRC", type_str)) {
return KaxTagMultiIdentifierType_ISRC;
}else if (!stricmp("Label Code", type_str)) {
return KaxTagMultiIdentifierType_LabelCode;
}else if (!stricmp("LCCN", type_str)) {
return KaxTagMultiIdentifierType_LCCN;
}else if (!stricmp("Unique File Identifier", type_str)) {
return KaxTagMultiIdentifierType_UniqueFileIdentifier;
}else if (!stricmp("UPC", type_str)) {
return KaxTagMultiIdentifierType_UPC;
}
return 0;
};
/************** MatroskaTagMultiLegal Class **************/
MatroskaTagMultiLegal::MatroskaTagMultiLegal()