1 #pragma once
2 
3 #ifndef _QT_MOVIE_H_
4 #define _QT_MOVIE_H_
5 
6 /**************************************************************
7 This APIs permit to handle MACINTOSH QUICKTIME movies.
8 They are intended only for creation; viewing and updating movies
9 is not currently supported.
10 Moreover, image insertion is not permitted; only appending.
11 To view .mov file, use quicktime tools  present on both NT(movieplayer)
12 and IRIX(movieplayer, moviemaker) platform.
13 The .mov created are cross-platform
14 **************************************************************/
15 
16 #include "toonz4.6/toonz.h"
17 #include "tsound.h"
18 
19 #undef TNZAPI
20 #ifdef TNZ_IS_IMAGELIB
21 #define TNZAPI TNZ_EXPORT_API
22 #else
23 #define TNZAPI TNZ_IMPORT_API
24 #endif
25 
26 #undef TNZAPI2
27 #ifdef TNZ_IS_COMMONLIB
28 #define TNZAPI2 TNZ_EXPORT_API
29 #else
30 #define TNZAPI2 TNZ_IMPORT_API
31 #endif
32 
33 /*opaque definition for the movie object*/
34 
35 typedef struct TNZMOVIE_DATA *TNZMOVIE;
36 
37 typedef struct _RASTER *MY_RASTER; /*to avoid raster.h inclusion */
38 
39 /* Warning: TNZMOVIE_TYPE makes sense only on NT; on IRIX is always RGBX*/
40 
41 typedef enum TNZMOVIE_TYPE {
42   TM_RGBX_TYPE = 0,
43   TM_RGB16_TYPE,
44   TM_RGB8_TYPE,
45   TM_BW_TYPE,
46   TM_HOW_MANY_TYPE
47 } TNZMOVIE_TYPE;
48 
49 typedef enum TNZMOVIE_QUALITY {
50   TM_MIN_QUALITY = 0,
51   TM_LOW_QUALITY,
52   TM_NORMAL_QUALITY,
53   TM_HIGH_QUALITY,
54   TM_MAX_QUALITY,
55   TM_LOSSLESS_QUALITY,
56   TM_HOW_MANY_QUALITY
57 } TNZMOVIE_QUALITY;
58 
59 #ifdef WIN32
60 typedef int TNZMOVIE_COMPRESSION;
61 #else
62 typedef enum TNZMOVIE_COMPRESSION {
63   TM_JPG_COMPRESSION = 0,
64   TM_VIDEO_COMPRESSION,
65   TM_ANIM_COMPRESSION,
66   TM_CINEPAK_COMPRESSION,
67   TM_HOW_MANY_COMPRESSION
68 } TNZMOVIE_COMPRESSION;
69 
70 #endif
71 
72 typedef unsigned long CodecQ;
73 typedef unsigned long CodecType;
74 /*---------------------------------------------------------------------------*/
75 
76 TNZAPI2 TBOOL tnz_movies_available(void);
77 TNZAPI2 TBOOL tnz_avi_available(void);
78 
79 TNZAPI2 TBOOL get_movie_codec_info(char ***quality_string, int *numQ, int *defQ,
80                                    char ***compression_string, int *numC,
81                                    int *defC);
82 
83 /*
84 #ifdef WIN32
85 TNZAPI2 TBOOL get_movie_codec_val(char *quality_string,     ULONG *quality_val,
86                                   char *compression_string,  ULONG
87 *compression_val);
88 #else
89 */
90 TNZAPI2 TBOOL get_movie_codec_val(char *quality_string,
91                                   TNZMOVIE_QUALITY *quality_val,
92                                   char *compression_string,
93                                   TNZMOVIE_COMPRESSION *compression_val);
94 
95 /*
96 #endif
97 */
98 
99 #ifndef WIN32
100 TNZAPI2 TBOOL get_movie_codec_info(char ***quality_string, int *numQ, int *defQ,
101                                    char ***compression_string, int *numC,
102                                    int *defC);
103 
104 #endif
105 
106 TNZAPI2 CodecQ tm_get_quality(int quality);
107 TNZAPI2 CodecType tm_get_compression(int compression);
108 
109 /**************************************************************
110 This function creates and open a new movie, ready to append images;
111   NIL is returned on error; Remember to use tm_close
112   when finished!!!
113 **************************************************************/
114 
115 /*---------------------------------------------------------------------------*/
116 
117 TNZAPI TNZMOVIE tm_create(char *fullpathname, TBOOL do_overwrite_file,
118                           TNZMOVIE_TYPE type, int rate, int lx, int ly,
119                           TNZMOVIE_QUALITY quality,
120                           TNZMOVIE_COMPRESSION compression);
121 
122 /**************************************************************
123 Warning: raster lx and ly must be the same of  the movie.
124 Raster is converted to the suitable format(cloning it)
125 **************************************************************/
126 
127 TNZAPI TBOOL tm_append_raster(TNZMOVIE movie, MY_RASTER r);
128 
129 /**************************************************************
130 Append a .wav(NT) or .aiff(IRIX) audio file to the movie.
131 The length of the resulting movie is forced to be equal to the video track,
132 so any overflowing audio is truncated. For this reason, is adviced to add
133 the audio when the video part has been completely added.
134 The position can be a negative value too;
135 If 'position' is >0, the audio track is added beginning from video frame
136 'position'.
137 If 'position' is <0, the audio is added starting from audio frame 'position',
138 at the beginning of video track.
139 **************************************************************/
140 
141 TNZAPI TBOOL tm_add_audio_track(TNZMOVIE movie, char *audiofullpathname,
142                                 int img_offs, int audio_offs, int frames,
143                                 TS_STRACK audioTrack);
144 
145 TNZAPI TBOOL tm_close(TNZMOVIE movie);
146 
147 #endif
148