1 /*  Copyright (c) MediaArea.net SARL. All Rights Reserved.
2  *
3  *  Use of this source code is governed by a BSD-style license that can
4  *  be found in the License.html file in the root of the source tree.
5  */
6 
7 /*Structures for MediaInfo events */
8 
9 #ifndef MediaInfo_EventsH
10 #define MediaInfo_EventsH
11 
12 #ifdef __cplusplus
13 #include <stdlib.h>
14 #include <string.h>
15 #include <sstream>
16 #endif //__cplusplus
17 
18 /***************************************************************************/
19 /* Platforms (from libzen)                                                 */
20 /***************************************************************************/
21 
22 /*-------------------------------------------------------------------------*/
23 /*Win32*/
24 #if defined(__NT__) || defined(_WIN32) || defined(WIN32)
25     #ifndef WIN32
26         #define WIN32
27     #endif
28     #ifndef _WIN32
29         #define _WIN32
30     #endif
31     #ifndef __WIN32__
32         #define __WIN32__ 1
33     #endif
34 #endif
35 
36 /*-------------------------------------------------------------------------*/
37 /*Win64*/
38 #if defined(_WIN64) || defined(WIN64)
39     #ifndef WIN64
40         #define WIN64
41     #endif
42     #ifndef _WIN64
43         #define _WIN64
44     #endif
45     #ifndef __WIN64__
46         #define __WIN64__ 1
47     #endif
48 #endif
49 
50 /*-------------------------------------------------------------------------*/
51 /*Windows*/
52 #if defined(WIN32) || defined(WIN64)
53     #ifndef WINDOWS
54         #define WINDOWS
55     #endif
56     #ifndef _WINDOWS
57         #define _WINDOWS
58     #endif
59     #ifndef __WINDOWS__
60         #define __WINDOWS__ 1
61     #endif
62 #endif
63 
64 /*-------------------------------------------------------------------------*/
65 /*Unix (Linux, HP, Sun, BeOS...)*/
66 #if defined(UNIX) || defined(_UNIX) || defined(__UNIX__) \
67     || defined(__unix) || defined(__unix__) \
68     || defined(____SVR4____) || defined(__LINUX__) || defined(__sgi) \
69     || defined(__hpux) || defined(sun) || defined(__SUN__) || defined(_AIX) \
70     || defined(__EMX__) || defined(__VMS) || defined(__BEOS__)
71     #ifndef UNIX
72         #define UNIX
73     #endif
74     #ifndef _UNIX
75         #define _UNIX
76     #endif
77     #ifndef __UNIX__
78         #define __UNIX__ 1
79     #endif
80 #endif
81 
82 /*-------------------------------------------------------------------------*/
83 /*MacOS Classic*/
84 #if defined(macintosh)
85     #ifndef MACOS
86         #define MACOS
87     #endif
88     #ifndef _MACOS
89         #define _MACOS
90     #endif
91     #ifndef __MACOS__
92         #define __MACOS__ 1
93     #endif
94 #endif
95 
96 /*-------------------------------------------------------------------------*/
97 /*MacOS X*/
98 #if defined(__APPLE__) && defined(__MACH__)
99     #ifndef MACOSX
100         #define MACOSX
101     #endif
102     #ifndef _MACOSX
103         #define _MACOSX
104     #endif
105     #ifndef __MACOSX__
106         #define __MACOSX__ 1
107     #endif
108 #endif
109 
110 /*Test of targets*/
111 #if defined(WINDOWS) && defined(UNIX) && defined(MACOS) && defined(MACOSX)
112     #pragma message Multiple platforms???
113 #endif
114 
115 #if !defined(WIN32) && !defined(UNIX) && !defined(MACOS) && !defined(MACOSX)
116     #pragma message No known platforms, assume default
117 #endif
118 
119 /*-------------------------------------------------------------------------*/
120 /*8-bit int                                                                */
121 #if UCHAR_MAX==0xff
122     #undef  MAXTYPE_INT
123     #define MAXTYPE_INT 8
124     typedef signed   char       MediaInfo_int8s;
125     typedef unsigned char       MediaInfo_int8u;
126 #else
127     #pragma message This machine has no 8-bit integertype?
128 #endif
129 
130 /*-------------------------------------------------------------------------*/
131 /*16-bit int                                                               */
132 #if UINT_MAX == 0xffff
133     #undef  MAXTYPE_INT
134     #define MAXTYPE_INT 16
135     typedef signed   int        MediaInfo_int16s;
136     typedef unsigned int        MediaInfo_int16u;
137 #elif USHRT_MAX == 0xffff
138     #undef  MAXTYPE_INT
139     #define MAXTYPE_INT 16
140     typedef signed   short      MediaInfo_int16s;
141     typedef unsigned short      MediaInfo_int16u;
142 #else
143     #pragma message This machine has no 16-bit integertype?
144 #endif
145 
146 /*-------------------------------------------------------------------------*/
147 /*32-bit int                                                               */
148 #if UINT_MAX == 0xfffffffful
149     #undef  MAXTYPE_INT
150     #define MAXTYPE_INT 32
151     typedef signed   int        MediaInfo_int32s;
152     typedef unsigned int        MediaInfo_int32u;
153 #elif ULONG_MAX == 0xfffffffful
154     #undef  MAXTYPE_INT
155     #define MAXTYPE_INT 32
156     typedef signed   long       MediaInfo_int32s;
157     typedef unsigned long       MediaInfo_int32u;
158 #elif USHRT_MAX == 0xfffffffful
159     #undef  MAXTYPE_INT
160     #define MAXTYPE_INT 32
161     typedef signed   short      MediaInfo_int32s;
162     typedef unsigned short      MediaInfo_int32u;
163 #else
164     #pragma message This machine has no 32-bit integer type?
165 #endif
166 
167 /*-------------------------------------------------------------------------*/
168 /*64-bit int                                                               */
169 #if defined(__MINGW32__) || defined(__CYGWIN32__) || defined(__UNIX__) || defined(__MACOSX__)
170     #undef  MAXTYPE_INT
171     #define MAXTYPE_INT 64
172     typedef unsigned long long  MediaInfo_int64u;
173     typedef   signed long long  MediaInfo_int64s;
174 #elif defined(__WIN32__) || defined(_WIN32)
175     #undef  MAXTYPE_INT
176     #define MAXTYPE_INT 64
177     typedef unsigned __int64    MediaInfo_int64u;
178     typedef   signed __int64    MediaInfo_int64s;
179 #else
180     #pragma message This machine has no 64-bit integer type?
181 #endif
182 /*-------------------------------------------------------------------------*/
183 
184 
185 /***************************************************************************/
186 /* The callback function                                                   */
187 /***************************************************************************/
188 
189 #if !defined(__WINDOWS__) && !defined(__stdcall)
190     #define __stdcall
191 #endif //!defined(__WINDOWS__)
192 
193 #ifdef __cplusplus
194 extern "C"
195 {
196 #endif /* __cplusplus */
197 
198     typedef void (__stdcall MediaInfo_Event_CallBackFunction)(unsigned char* Data_Content, size_t Data_Size, void* UserHandler);
199 
200 #ifdef __cplusplus
201 }
202 #endif /* __cplusplus */
203 
204 /***************************************************************************/
205 /* EventCode management                                                    */
206 /***************************************************************************/
207 
208 #define MediaInfo_EventCode_Create(ParserID, EventID, EventVersion) \
209   (  ((MediaInfo_int32u)ParserID    )<<24 \
210    | ((MediaInfo_int32u)EventID     )<< 8 \
211    | ((MediaInfo_int32u)EventVersion)    )
212 
213 /***************************************************************************/
214 /* Global                                                                  */
215 /***************************************************************************/
216 
217 /*-------------------------------------------------------------------------*/
218 /* Time code                                                               */
219 typedef struct MediaInfo_time_code
220 {
221     MediaInfo_int8u     Hours;
222     MediaInfo_int8u     Minutes;
223     MediaInfo_int8u     Seconds;
224     MediaInfo_int8u     Frames;
225     MediaInfo_int8u     FramesPerSecond;
226     MediaInfo_int8u     DropFrame; //0= No, 1=Yes
227     MediaInfo_int8u     Reserved[2];
228 } MediaInfo_time_code;
229 
230 /*-------------------------------------------------------------------------*/
231 /* Generic                                                                 */
232 #define MEDIAINFO_EVENT_GENERIC \
233     MediaInfo_int32u        EventCode; \
234     MediaInfo_int32u        ReservedI32; \
235     size_t                  EventSize; \
236     size_t                  StreamIDs_Size; \
237     MediaInfo_int64u        StreamIDs[16]; \
238     MediaInfo_int8u         StreamIDs_Width[16]; \
239     MediaInfo_int8u         ParserIDs[16]; \
240     MediaInfo_int64u        StreamOffset; \
241     MediaInfo_int64u        FrameNumber; \
242     MediaInfo_int64u        PCR; \
243     MediaInfo_int64u        PTS; \
244     MediaInfo_int64u        DTS; \
245     MediaInfo_int64u        DUR; \
246     MediaInfo_int64u        FrameNumber_PresentationOrder; \
247     MediaInfo_int64u        ReservedI64[1]; \
248     MediaInfo_time_code     TimeCode_Container; \
249     MediaInfo_time_code     TimeCode_SDTI; \
250     MediaInfo_time_code     TimeCode_RawStream; \
251     MediaInfo_time_code     ReservedT[5]; \
252 
253 typedef struct MediaInfo_Event_Generic
254 {
255     MEDIAINFO_EVENT_GENERIC
256 } MediaInfo_Event_Generic;
257 
258 /*-------------------------------------------------------------------------*/
259 /* MediaInfo_Event_Log_0                                                   */
260 #define MediaInfo_Event_Log 0x0F00
261 struct MediaInfo_Event_Log_0
262 {
263     MEDIAINFO_EVENT_GENERIC
264     MediaInfo_int8u         Type;
265     MediaInfo_int8u         Severity;
266     MediaInfo_int8u         Reserved2;
267     MediaInfo_int8u         Reserved3;
268     MediaInfo_int32u        MessageCode;
269     MediaInfo_int32u        Reserved4;
270     const wchar_t*          MessageString;
271     const wchar_t*          MessageStringU;
272     const char*             MessageStringA;
273 };
274 
275 /*-------------------------------------------------------------------------*/
276 /* Demux                                                                   */
277 #define MediaInfo_Event_Global_Demux 0xAF00
278 enum MediaInfo_Event_Global_Demux_0_contenttype
279 {
280     MediaInfo_Event_Global_Demux_0_ContentType_MainStream,
281     MediaInfo_Event_Global_Demux_0_ContentType_SubStream,
282     MediaInfo_Event_Global_Demux_0_ContentType_Header,
283     MediaInfo_Event_Global_Demux_0_ContentType_Synchro
284 };
285 
286 struct MediaInfo_Event_Global_Demux_4
287 {
288     MEDIAINFO_EVENT_GENERIC
289     MediaInfo_int8u         Content_Type; /*MediaInfo_Event_Global_Demux_0_contenttype*/
290     size_t                  Content_Size;
291     const MediaInfo_int8u*  Content;
292     MediaInfo_int64u        Flags; /*bit0=random_access*/
293     size_t                  Offsets_Size;
294     const MediaInfo_int64u* Offsets_Stream; /* From the begin of the stream */
295     const MediaInfo_int64u* Offsets_Content; /* From the begin of the demuxed content */
296     size_t                  OriginalContent_Size; /* In case of decoded content inside MediaInfo, OriginalContent contain the not-decoded stream */
297     const MediaInfo_int8u*  OriginalContent; /* In case of decoded content inside MediaInfo, OriginalContent contain the not-decoded stream */
298 };
299 
300 /*-------------------------------------------------------------------------*/
301 /* Simple text                                                             */
302 #define MediaInfo_Event_Global_SimpleText 0xAF01
303 struct MediaInfo_Event_Global_SimpleText_0
304 {
305     MEDIAINFO_EVENT_GENERIC
306     const wchar_t*      Content;
307     MediaInfo_int8u     Flags;
308     MediaInfo_int8u     MuxingMode;
309     MediaInfo_int8u     Service;
310     MediaInfo_int32u    Row_Max;
311     MediaInfo_int32u    Column_Max;
312     wchar_t**           Row_Values; //First indice is the row number, second indice is the column number. Row ends with \0
313     MediaInfo_int8u**   Row_Attributes;
314 };
315 
316 /*-------------------------------------------------------------------------*/
317 /* BytesRead                                                               */
318 #define MediaInfo_Event_Global_BytesRead 0xAF02
319 struct MediaInfo_Event_Global_BytesRead_0
320 {
321     MEDIAINFO_EVENT_GENERIC
322     size_t                  Content_Size;
323     const MediaInfo_int8u*  Content;
324 };
325 
326 /*-------------------------------------------------------------------------*/
327 /* Decoded                                                                 */
328 #define MediaInfo_Event_Global_Decoded 0xAF03
329 
330 struct MediaInfo_Event_Global_Decoded_0
331 {
332     MEDIAINFO_EVENT_GENERIC
333     size_t                  Content_Size;
334     const MediaInfo_int8u*  Content;
335     MediaInfo_int64u        Flags;
336 };
337 
338 /*-------------------------------------------------------------------------*/
339 /* AttachedFile                                                            */
340 #define MediaInfo_Event_Global_AttachedFile 0xAF04
341 
342 struct MediaInfo_Event_Global_AttachedFile_0
343 {
344     MEDIAINFO_EVENT_GENERIC
345     size_t                  Content_Size;
346     const MediaInfo_int8u*  Content;
347     MediaInfo_int64u        Flags;
348     const char*             Name;
349     const char*             MimeType;
350     const char*             Description;
351 };
352 
353 /*-------------------------------------------------------------------------*/
354 /* MediaInfo_Event_Video_SliceInfo_0                                       */
355 #define MediaInfo_Event_Video_SliceInfo 0x7801
356 struct MediaInfo_Event_Video_SliceInfo_0
357 {
358     MEDIAINFO_EVENT_GENERIC
359     MediaInfo_int64u        FieldPosition;
360     MediaInfo_int64u        SlicePosition;
361     MediaInfo_int8u         SliceType;
362     MediaInfo_int64u        Flags;
363 };
364 
365 /***************************************************************************/
366 /* General                                                                 */
367 /***************************************************************************/
368 
369 #define MediaInfo_Parser_None           0x00
370 #define MediaInfo_Parser_General        0x00
371 #define MediaInfo_Parser_Global         0x00
372 #define MediaInfo_Parser_Video          0x01
373 
374 /*-------------------------------------------------------------------------*/
375 /* SubFile_Missing                                                         */
376 #define MediaInfo_Event_General_SubFile_Missing 0x1F01
377 struct MediaInfo_Event_General_SubFile_Missing_0
378 {
379     MEDIAINFO_EVENT_GENERIC
380     const char*             FileName_Relative;
381     const wchar_t*          FileName_Relative_Unicode;
382     const char*             FileName_Absolute;
383     const wchar_t*          FileName_Absolute_Unicode;
384 };
385 
386 /*-------------------------------------------------------------------------*/
387 /* Start                                                                   */
388 #define MediaInfo_Event_General_Start 0x7001
389 struct MediaInfo_Event_General_Start_0
390 {
391     MEDIAINFO_EVENT_GENERIC
392     MediaInfo_int64u        Stream_Size;
393     const char*             FileName;
394     const wchar_t*          FileName_Unicode;
395 };
396 
397 /*-------------------------------------------------------------------------*/
398 /* End                                                                     */
399 #define MediaInfo_Event_General_End 0x7002
400 struct MediaInfo_Event_General_End_0
401 {
402     MEDIAINFO_EVENT_GENERIC
403     MediaInfo_int64u        Stream_Bytes_Analyzed;
404     MediaInfo_int64u        Stream_Size;
405     MediaInfo_int64u        Stream_Bytes_Padding;
406     MediaInfo_int64u        Stream_Bytes_Junk;
407 };
408 
409 /*-------------------------------------------------------------------------*/
410 /* Parser_Selected                                                         */
411 #define MediaInfo_Event_General_Parser_Selected 0x7003
412 struct MediaInfo_Event_General_Parser_Selected_0
413 {
414     MEDIAINFO_EVENT_GENERIC
415     char                    Name[16];
416 };
417 
418 /*-------------------------------------------------------------------------*/
419 /* Move request                                                            */
420 #define MediaInfo_Event_General_Move_Request 0x7004
421 struct MediaInfo_Event_General_Move_Request_0
422 {
423     MEDIAINFO_EVENT_GENERIC
424 };
425 
426 /*-------------------------------------------------------------------------*/
427 /* Move done                                                               */
428 #define MediaInfo_Event_General_Move_Done 0x7005
429 struct MediaInfo_Event_General_Move_Done_0
430 {
431     MEDIAINFO_EVENT_GENERIC
432 };
433 
434 /*-------------------------------------------------------------------------*/
435 /* SubFile_Start                                                           */
436 #define MediaInfo_Event_General_SubFile_Start 0x7006
437 struct MediaInfo_Event_General_SubFile_Start_0
438 {
439     MEDIAINFO_EVENT_GENERIC
440     const char*             FileName_Relative;
441     const wchar_t*          FileName_Relative_Unicode;
442     const char*             FileName_Absolute;
443     const wchar_t*          FileName_Absolute_Unicode;
444 };
445 
446 /*-------------------------------------------------------------------------*/
447 /* SubFile_End                                                             */
448 #define MediaInfo_Event_General_SubFile_End 0x7007
449 struct MediaInfo_Event_General_SubFile_End_0
450 {
451     MEDIAINFO_EVENT_GENERIC
452 };
453 
454 /*-------------------------------------------------------------------------*/
455 /* WaitForMoreData_Start                                                   */
456 #define MediaInfo_Event_General_WaitForMoreData_Start 0x7008
457 struct MediaInfo_Event_General_WaitForMoreData_Start_0
458 {
459     MEDIAINFO_EVENT_GENERIC
460     double                  Duration_Max;       //In seconds
461 };
462 /*-------------------------------------------------------------------------*/
463 /* WaitForMoreData_End                                                     */
464 #define MediaInfo_Event_General_WaitForMoreData_End 0x7009
465 struct MediaInfo_Event_General_WaitForMoreData_End_0
466 {
467     MEDIAINFO_EVENT_GENERIC
468     double                  Duration_Max;       //In seconds
469     double                  Duration_Actual;    //In seconds
470     MediaInfo_int8u         Flags;              //bit 0: Outcome (1 is giving up)
471 };
472 
473 /***************************************************************************/
474 /* MPEG-TS / BDAV / TSP                                                    */
475 /***************************************************************************/
476 
477 #define MediaInfo_Parser_SideCar        0x72
478 
479 /***************************************************************************/
480 /* MPEG-TS / BDAV / TSP                                                    */
481 /***************************************************************************/
482 
483 #define MediaInfo_Parser_MpegTs         0x01
484 
485 /***************************************************************************/
486 /* MPEG-PS                                                                 */
487 /***************************************************************************/
488 
489 #define MediaInfo_Parser_MpegPs         0x02
490 #define MediaInfo_Parser_MpegPs_Ext     0x70
491 
492 /***************************************************************************/
493 /* DV / DIF                                                                 */
494 /***************************************************************************/
495 
496 #define MediaInfo_Parser_DvDif          0x03
497 
498 /*-------------------------------------------------------------------------*/
499 /* Analysis                                                                */
500 #define MediaInfo_Event_DvDif_Analysis_Frame 0xB001
501 struct MediaInfo_Event_DvDif_Analysis_Frame_0
502 {
503     MediaInfo_int32u        EventCode;
504     MediaInfo_int32u        TimeCode;
505     MediaInfo_int32u        RecordedDateTime1;
506     MediaInfo_int16u        RecordedDateTime2;
507     MediaInfo_int8u         Arb;
508     MediaInfo_int8u         Verbosity;
509     const char*             Errors;
510 };
511 struct MediaInfo_Event_DvDif_Analysis_Frame_1
512 {
513     MEDIAINFO_EVENT_GENERIC
514     MediaInfo_int32u        TimeCode;
515     MediaInfo_int32u        RecordedDateTime1;
516     MediaInfo_int16u        RecordedDateTime2Buggy;
517     MediaInfo_int8u         Arb;
518     MediaInfo_int8u         Verbosity;
519     const char*             Errors;
520     size_t                  Video_STA_Errors_Count;
521     size_t*                 Video_STA_Errors;
522     size_t                  Audio_Data_Errors_Count;
523     size_t*                 Audio_Data_Errors;
524     MediaInfo_int32u        Captions_Errors; // bit 0 = parity issue
525     MediaInfo_int32u        Coherency_Flags; // bit 0 = no pack sub, bit 1 = no pack vid, bit 2 = no pack aud, bit 3 = no data vid, bit 4 = no data aud, bit 5 = no vid source/control, bit 6 = no aud source/control
526     MediaInfo_int16u        RecordedDateTime2;
527     size_t                  BlockStatus_Count;
528     const MediaInfo_int8u*  BlockStatus;
529     MediaInfo_int32u        AbstBf;
530 };
531 
532 /*-------------------------------------------------------------------------*/
533 /* Change in the stream config                                             */
534 #define MediaInfo_Event_DvDif_Change 0xB002
535 struct MediaInfo_Event_DvDif_Change_0
536 {
537     MEDIAINFO_EVENT_GENERIC
538     MediaInfo_int32u        Width;
539     MediaInfo_int32u        Height;
540     MediaInfo_int32u        VideoChromaSubsampling; // -1=unknown, 0=411, 1=420, 2=422
541     MediaInfo_int32u        VideoScanType; // -1=unknown
542     MediaInfo_int32u        VideoRatio_N;
543     MediaInfo_int32u        VideoRatio_D;
544     MediaInfo_int32u        VideoRate_N;
545     MediaInfo_int32u        VideoRate_D;
546     MediaInfo_int32u        AudioRate_N;
547     MediaInfo_int32u        AudioRate_D;
548     MediaInfo_int32u        AudioChannels;
549     MediaInfo_int32u        AudioBitDepth;
550     MediaInfo_int32u        Captions_Flags; // bit 0 = present
551 };
552 
553 /***************************************************************************/
554 /* CDXA                                                                    */
555 /***************************************************************************/
556 
557 #define MediaInfo_Parser_Cdxa           0x04
558 
559 /***************************************************************************/
560 /* FLV                                                                     */
561 /***************************************************************************/
562 
563 #define MediaInfo_Parser_Flv            0x06
564 
565 /***************************************************************************/
566 /* GXF                                                                     */
567 /***************************************************************************/
568 
569 #define MediaInfo_Parser_Gxf            0x07
570 
571 /***************************************************************************/
572 /* Matroska                                                                */
573 /***************************************************************************/
574 
575 #define MediaInfo_Parser_Matroska       0x08
576 
577 /***************************************************************************/
578 /* MPEG-4                                                                  */
579 /***************************************************************************/
580 
581 #define MediaInfo_Parser_Mpeg4          0x09
582 #define MediaInfo_Parser_Mpeg4_Desc     0x71
583 
584 /***************************************************************************/
585 /* MXF                                                                     */
586 /***************************************************************************/
587 
588 #define MediaInfo_Parser_Mxf            0x0A
589 
590 /***************************************************************************/
591 /* OGG                                                                     */
592 /***************************************************************************/
593 
594 #define MediaInfo_Parser_Ogg            0x0B
595 
596 /***************************************************************************/
597 /* RIFF                                                                    */
598 /***************************************************************************/
599 
600 #define MediaInfo_Parser_Riff           0x0C
601 
602 /***************************************************************************/
603 /* WM                                                                      */
604 /***************************************************************************/
605 
606 #define MediaInfo_Parser_Wm             0x0D
607 
608 /***************************************************************************/
609 /* LXF                                                                     */
610 /***************************************************************************/
611 
612 #define MediaInfo_Parser_Lxf            0x0E
613 
614 /***************************************************************************/
615 /* HLS                                                                     */
616 /***************************************************************************/
617 
618 #define MediaInfo_Parser_Hls            0x60
619 
620 /***************************************************************************/
621 /* HLS Index                                                               */
622 /***************************************************************************/
623 
624 #define MediaInfo_Parser_HlsIndex       0x61
625 
626 /***************************************************************************/
627 /* Internet Streaming Media                                                */
628 /***************************************************************************/
629 
630 #define MediaInfo_Parser_Ism            0x62
631 
632 /***************************************************************************/
633 /* DASH MPD                                                                */
634 /***************************************************************************/
635 
636 #define MediaInfo_Parser_DashMpd        0x63
637 
638 /***************************************************************************/
639 /* HDS F4M                                                                 */
640 /***************************************************************************/
641 
642 #define MediaInfo_Parser_HdsF4m         0x64
643 
644 /***************************************************************************/
645 /* DCP Composition Asset Map                                               */
646 /***************************************************************************/
647 
648 #define MediaInfo_Parser_DcpAm          0x65
649 
650 /***************************************************************************/
651 /* DCP Composition Playlist                                                */
652 /***************************************************************************/
653 
654 #define MediaInfo_Parser_DcpCpl         0x66
655 
656 /***************************************************************************/
657 /* DCP Package List                                                        */
658 /***************************************************************************/
659 
660 #define MediaInfo_Parser_DcpPkl         0x67
661 
662 /***************************************************************************/
663 /* DCP Output List                                                        */
664 /***************************************************************************/
665 
666 #define MediaInfo_Parser_DcpOpl         0x68
667 
668 /***************************************************************************/
669 /* Pro Tools session 10                                                    */
670 /***************************************************************************/
671 
672 #define MediaInfo_Parser_Ptx            0x69
673 
674 /***************************************************************************/
675 /* AAF                                                                     */
676 /***************************************************************************/
677 
678 #define MediaInfo_Parser_Aaf            0x6A
679 
680 /***************************************************************************/
681 /* DXW                                                                     */
682 /***************************************************************************/
683 
684 #define MediaInfo_Parser_Dxw            0x6B
685 
686 /***************************************************************************/
687 /* MediaInfo XML                                                           */
688 /***************************************************************************/
689 
690 #define MediaInfo_Parser_MiXml          0x6C
691 
692 /***************************************************************************/
693 /* MPEG Video                                                              */
694 /***************************************************************************/
695 
696 #define MediaInfo_Parser_Mpegv          0x80
697 
698 /***************************************************************************/
699 /* AVC                                                                     */
700 /***************************************************************************/
701 
702 #define MediaInfo_Parser_Avc            0x81
703 
704 /***************************************************************************/
705 /* AVC                                                                     */
706 /***************************************************************************/
707 
708 #define MediaInfo_Parser_Hevc            0x83
709 
710 /***************************************************************************/
711 /* VC-1                                                                    */
712 /***************************************************************************/
713 
714 #define MediaInfo_Parser_Vc1            0x82
715 
716 /***************************************************************************/
717 /* Active Format Description (AFD)                                         */
718 /***************************************************************************/
719 
720 #define MediaInfo_Parser_Afd            0x83
721 
722 /***************************************************************************/
723 /* Bar Data                                                                */
724 /***************************************************************************/
725 
726 #define MediaInfo_Parser_BarData        0x84
727 
728 /***************************************************************************/
729 /* MPEG-4 Visual                                                           */
730 /***************************************************************************/
731 
732 #define MediaInfo_Parser_Mpeg4v         0x85
733 
734 /***************************************************************************/
735 /* DTS                                                                     */
736 /***************************************************************************/
737 
738 #define MediaInfo_Parser_Dts            0xA0
739 
740 /***************************************************************************/
741 /* AC-3                                                                    */
742 /***************************************************************************/
743 
744 #define MediaInfo_Parser_Ac3            0xA1
745 
746 /***************************************************************************/
747 /* AAC                                                                     */
748 /***************************************************************************/
749 
750 #define MediaInfo_Parser_Aac            0xA2
751 
752 /***************************************************************************/
753 /* MPEG Audio                                                              */
754 /***************************************************************************/
755 
756 #define MediaInfo_Parser_Mpega          0xA3
757 
758 /***************************************************************************/
759 /* PCM                                                                     */
760 /***************************************************************************/
761 
762 #define MediaInfo_Parser_Pcm            0xA4
763 
764 /***************************************************************************/
765 /* AES-3                                                                   */
766 /***************************************************************************/
767 
768 #define MediaInfo_Parser_Aes3           0xA5
769 
770 /***************************************************************************/
771 /* Dolby E                                                                 */
772 /***************************************************************************/
773 
774 #define MediaInfo_Parser_DolbyE         0xA6
775 
776 /***************************************************************************/
777 /* Channel grouping intermediate module                                    */
778 /***************************************************************************/
779 
780 #define MediaInfo_Parser_ChannelGrouping 0xA7
781 
782 /***************************************************************************/
783 /* JPEG                                                                    */
784 /***************************************************************************/
785 
786 #define MediaInfo_Parser_Jpeg           0xC0
787 
788 /***************************************************************************/
789 /* CEA-608 (formely IEA-608)                                               */
790 /***************************************************************************/
791 
792 #define MediaInfo_Parser_Eia608         0xF0
793 
794 /*-------------------------------------------------------------------------*/
795 /* MediaInfo_Event_Eia608_Content                                          */
796 #define MediaInfo_Event_Eia608_CC_Content 0xA000
797 struct MediaInfo_Event_Eia608_CC_Content_0
798 {
799     MEDIAINFO_EVENT_GENERIC
800     MediaInfo_int8u     Field;
801     MediaInfo_int8u     MuxingMode;
802     MediaInfo_int8u     Service;
803     wchar_t             Row_Values[15][33]; /*offset 32 is for \0*/
804     MediaInfo_int8u     Row_Attributes[15][32];
805 };
806 
807 /***************************************************************************/
808 /* DTVCC Transport (CEA-708, formely IEA-708)                              */
809 /***************************************************************************/
810 
811 #define MediaInfo_Parser_DtvccTransport 0xF1
812 #define MediaInfo_Parser_Eia708         0xF1 /*Deprecated*/
813 
814 /***************************************************************************/
815 /* DTVCC Caption (CEA-708, formely IEA-708)                                */
816 /***************************************************************************/
817 
818 #define MediaInfo_Parser_DtvccCaption   0xF2
819 
820 /*-------------------------------------------------------------------------*/
821 /* MediaInfo_Event_DtvccCaption_Content_Minimal                            */
822 #define MediaInfo_Event_DtvccCaption_Content_Minimal 0xA000
823 struct MediaInfo_Event_DtvccCaption_Content_Minimal_0
824 {
825     MEDIAINFO_EVENT_GENERIC
826     MediaInfo_int8u     MuxingMode;
827     MediaInfo_int8u     Service;
828     wchar_t             Row_Values[15][65]; /*offset 32 (4:3) or 42 (16:9) is for \0, reserving data after 42 for future extensions*/
829     MediaInfo_int8u     Row_Attributes[15][64];
830 };
831 
832 /*-------------------------------------------------------------------------*/
833 /* MediaInfo_Event_DtvccCaption_Window_Content_Minimal                     */
834 #define MediaInfo_Event_DtvccCaption_Window_Content_Minimal 0xA001
835 struct MediaInfo_Event_DtvccCaption_Window_Content_Minimal_0
836 {
837     MEDIAINFO_EVENT_GENERIC
838     MediaInfo_int8u     MuxingMode;
839     MediaInfo_int8u     Service;
840     MediaInfo_int8u     Window;
841     wchar_t             Row_Values[15][33]; /*offset 32 is for \0*/
842     MediaInfo_int8u     Row_Attributes[15][32];
843 };
844 
845 /***************************************************************************/
846 /* CDP                                                                     */
847 /***************************************************************************/
848 
849 #define MediaInfo_Parser_Cdp            0xF3
850 
851 /***************************************************************************/
852 /* DVD CC                                                                  */
853 /***************************************************************************/
854 
855 #define MediaInfo_Parser_DvdCc          0xF4
856 
857 /***************************************************************************/
858 /* SCTE 20                                                                 */
859 /***************************************************************************/
860 
861 #define MediaInfo_Parser_Scte20         0xF5
862 
863 /***************************************************************************/
864 /* DVB Subtitle                                                            */
865 /***************************************************************************/
866 
867 #define MediaInfo_Parser_DvbSubtitle    0xF6
868 
869 /***************************************************************************/
870 /* Teletext                                                                */
871 /***************************************************************************/
872 
873 #define MediaInfo_Parser_Teletext       0xF7
874 
875 /***************************************************************************/
876 /* SCC                                                                     */
877 /***************************************************************************/
878 
879 #define MediaInfo_Parser_Scc            0xF8
880 
881 /***************************************************************************/
882 /* ARIB STD B24/B37                                                        */
883 /***************************************************************************/
884 
885 #define MediaInfo_Parser_AribStdB24B37  0xF9
886 
887 /***************************************************************************/
888 /* TTML                                                                    */
889 /***************************************************************************/
890 
891 #define MediaInfo_Parser_Ttml           0xFA
892 
893 /***************************************************************************/
894 /* SubRip                                                                  */
895 /***************************************************************************/
896 
897 #define MediaInfo_Parser_SubRip         0xFB
898 
899 /***************************************************************************/
900 /* N19                                                                     */
901 /***************************************************************************/
902 
903 #define MediaInfo_Parser_N19            0xFC
904 
905 /***************************************************************************/
906 /* SDP                                                                     */
907 /***************************************************************************/
908 
909 #define MediaInfo_Parser_Sdp            0xFD
910 
911 /*-------------------------------------------------------------------------*/
912 /* Utilities                                                               */
913 /*-------------------------------------------------------------------------*/
914 
915 // Flags: bit 0 = has ID containing 2 numbers (e.g. 0x00010002, main ID is 1 and subID is 2)
916 #define MediaInfo_ID_FromEvent_int MediaInfo_ID_FromEvent_intA
MediaInfo_ID_FromEvent_intA(MediaInfo_Event_Generic * Event,int)917 inline MediaInfo_int64u MediaInfo_ID_FromEvent_intA (MediaInfo_Event_Generic* Event, int) // Flags)
918 {
919     if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_MpegPs && Event->ParserIDs[1]==MediaInfo_Parser_MpegPs_Ext)   // DVD-Video
920         return (Event->StreamIDs[0]<<16) | Event->StreamIDs[1];
921     if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_HdsF4m && Event->StreamIDs_Width[1])                          // HDS F4M having more than one stream per referenced file
922         return Event->StreamIDs[0]<<16 | Event->StreamIDs[1];
923     if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_HlsIndex)                                                     // HLS Index
924     {
925         if (Event->ParserIDs[1]==MediaInfo_Parser_Hls)
926             return (Event->StreamIDs[0]<<16) | Event->StreamIDs[2];
927         else
928             return (Event->StreamIDs[0]<<16) | Event->StreamIDs[1];
929     }
930     if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_Hls)                                                          // HLS Sequence
931         return Event->StreamIDs[1];
932     if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_Ism && Event->StreamIDs_Width[1])                             // ISM having more than one stream per referenced file
933         return Event->StreamIDs[0]<<16 | Event->StreamIDs[1];
934     if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_Dxw && Event->ParserIDs[1]==MediaInfo_Parser_MpegTs)          // DXW with MPEG-TS
935         return (Event->StreamIDs[0]<<16) | Event->StreamIDs[1];
936     if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_DcpAm)                                                        // DCP/IMF AM
937         return (Event->StreamIDs[0]<<24) | (Event->StreamIDs[1]<<16) | Event->StreamIDs[2];
938     if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_DcpPkl)                                                       // DCP/IMF PKL
939         return (Event->StreamIDs[0]<<24) | (Event->StreamIDs[1]<<16) | Event->StreamIDs[2];
940     if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_DcpCpl)                                                       // DCP/IMF CPL
941         return (Event->StreamIDs[0]<<16) | Event->StreamIDs[1];
942     if (Event->StreamIDs_Size)
943         return Event->StreamIDs[0];
944     return (MediaInfo_int64u)-1; // No identifier
945 }
946 
947 #ifdef __cplusplus
948 #define MediaInfo_ID_FromEvent_string MediaInfo_ID_FromEvent_stringA
MediaInfo_ID_FromEvent_stringA(MediaInfo_Event_Generic * Event,int)949 inline std::string MediaInfo_ID_FromEvent_stringA (MediaInfo_Event_Generic* Event, int) // Flags)
950 {
951     std::stringstream ToReturn;
952 
953     if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_MpegPs && Event->ParserIDs[1]==MediaInfo_Parser_MpegPs_Ext)        // DVD-Video
954     {
955         ToReturn<<Event->StreamIDs[0];
956         ToReturn<<'-';
957         ToReturn<<Event->StreamIDs[1];
958     }
959     else if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_HdsF4m && Event->StreamIDs_Width[1])                          // HDS F4M having more than one stream per referenced file
960     {
961         ToReturn<<Event->StreamIDs[0];
962         ToReturn<<'-';
963         ToReturn<<Event->StreamIDs[1];
964     }
965     else if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_HlsIndex)                                                     // HLS Index
966     {
967         ToReturn<<Event->StreamIDs[0];
968         ToReturn<<'-';
969         if (Event->ParserIDs[1]==MediaInfo_Parser_Hls)
970             ToReturn<<Event->StreamIDs[2];
971         else
972             ToReturn<<Event->StreamIDs[1];
973     }
974     else if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_Hls)                                                          // HLS Sequence
975     {
976         ToReturn<<Event->StreamIDs[1];
977     }
978     else if (Event->StreamIDs_Size>=2 && Event->ParserIDs[0]==MediaInfo_Parser_Ism && Event->StreamIDs_Width[1])                             // ISM having more than one stream per referenced file
979     {
980         ToReturn<<Event->StreamIDs[0];
981         ToReturn<<'-';
982         ToReturn<<Event->StreamIDs[1];
983     }
984     else if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_Dxw && Event->ParserIDs[1]==MediaInfo_Parser_MpegTs)          // DXW with MPEG-TS
985     {
986         ToReturn<<Event->StreamIDs[0];
987         ToReturn<<'-';
988         ToReturn<<Event->StreamIDs[1];
989     }
990     else if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_DcpAm)                                                        // DCP/IMF AM
991     {
992         ToReturn<<Event->StreamIDs[0];
993         ToReturn<<'-';
994         ToReturn<<Event->StreamIDs[1];
995         ToReturn<<'-';
996         ToReturn<<Event->StreamIDs[2];
997     }
998     else if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_DcpPkl)                                                       // DCP/IMF PKL
999     {
1000         ToReturn<<Event->StreamIDs[0];
1001         ToReturn<<'-';
1002         ToReturn<<Event->StreamIDs[1];
1003         ToReturn<<'-';
1004         ToReturn<<Event->StreamIDs[2];
1005     }
1006     else if (Event->StreamIDs_Size>=3 && Event->ParserIDs[0]==MediaInfo_Parser_DcpCpl)                                                       // DCP/IMF CPL
1007     {
1008         ToReturn<<Event->StreamIDs[0];
1009         ToReturn<<'-';
1010         ToReturn<<Event->StreamIDs[1];
1011     }
1012     else if (Event->StreamIDs_Size)
1013     {
1014         ToReturn<<Event->StreamIDs[0];
1015     }
1016     return ToReturn.str();
1017 }
1018 #endif //__cplusplus
1019 
1020 #define MediaInfo_ID_FromGet_int MediaInfo_ID_FromGet_intA
MediaInfo_ID_FromGet_intA(const char * ID,const char * ContainerFormat,const char * MuxingMode)1021 inline MediaInfo_int64u MediaInfo_ID_FromGet_intA (const char* ID, const char* ContainerFormat, const char* MuxingMode)
1022 {
1023     MediaInfo_int64u ToReturn;
1024     const char* SubID;
1025 
1026     ToReturn=(MediaInfo_int64u)atoi(ID);
1027     SubID= strchr(ID, '-');
1028     if (SubID)
1029     {
1030         MediaInfo_int64u ToReturn2;
1031 
1032         ToReturn2=atoi(SubID+1);
1033 
1034         SubID= strchr(SubID+1, '-');
1035         if (SubID)
1036         {
1037             MediaInfo_int64u ToReturn3;
1038 
1039             ToReturn3=atoi(SubID+1);
1040             if (strcmp(ContainerFormat, "DCP AM")==0                                            // DCP AM
1041              || strcmp(ContainerFormat, "DCP PKL")==0                                           // DCP PKL
1042              || strcmp(ContainerFormat, "IMF AM")==0                                            // IMF AM
1043              || strcmp(ContainerFormat, "IMF PKL")==0)                                          // IMF PKL
1044                 ToReturn=(ToReturn<<24) | (ToReturn2<<16) | ToReturn3;
1045         }
1046         else if (
1047             strcmp(MuxingMode, "DVD-Video")==0                                                  // DVD-Video
1048          || strcmp(ContainerFormat, "HDS F4M")==0                                               // HDS F4M having more than one stream per referenced file
1049          || (strcmp(ContainerFormat, "HLS")==0 && strstr(MuxingMode, "HLS")==MuxingMode)        // HLS Index
1050          || (strcmp(ContainerFormat, "HLS")==0 && strstr(MuxingMode, "MPEG-TS")==MuxingMode)    // HLS Index
1051          || strcmp(ContainerFormat, "ISM")==0                                                   // ISM having more than one stream per referenced file
1052          || (strcmp(ContainerFormat, "DXW")==0 && strstr(MuxingMode, "MPEG-TS")==MuxingMode)    // DXW with MPEG-TS
1053          || strcmp(ContainerFormat, "DCP CPL")==0                                               // DCP CPL
1054          || strcmp(ContainerFormat, "IMF CPL")==0)                                              // IMF CPL
1055             ToReturn=(ToReturn<<16) | ToReturn2;
1056     }
1057 
1058     return ToReturn;
1059 }
1060 
1061 #endif //MediaInfo_EventsH
1062