4 #include "bitspopup.inc"
16 // Mpeg2enc prototypes
17 void mpeg2enc_init_buffers();
18 int mpeg2enc(int argc
, char *argv
[]);
19 void mpeg2enc_set_w(int width
);
20 void mpeg2enc_set_h(int height
);
21 void mpeg2enc_set_rate(double rate
);
22 void mpeg2enc_set_input_buffers(int eof
, char *y
, char *u
, char *v
);
27 void toolame_init_buffers();
28 int toolame(int argc
, char **argv
);
29 int toolame_send_buffer(char *data
, int bytes
);
37 class FileMPEG
: public FileBase
40 FileMPEG(Asset
*asset
, File
*file
);
43 friend class FileMPEGVideo
;
44 friend class FileMPEGAudio
;
46 static void get_parameters(BC_WindowBase
*parent_window
,
48 BC_WindowBase
* &format_window
,
52 static int check_sig(Asset
*asset
);
53 int open_file(int rd
, int wr
);
55 int set_video_position(int64_t x
);
56 int set_audio_position(int64_t x
);
57 int write_samples(double **buffer
,
59 int write_frames(VFrame
***frames
, int len
);
61 int read_frame(VFrame
*frame
);
62 int read_samples(double *buffer
, int64_t len
);
63 int read_samples_float(float *buffer
, int64_t len
);
64 int prefer_samples_float();
66 // Direct copy routines
67 static int get_best_colormodel(Asset
*asset
, int driver
);
68 int colormodel_supported(int colormodel
);
69 // This file can copy frames directly from the asset
70 int can_copy_from(Edit
*edit
, int64_t position
);
71 static char *strtocompression(char *string
);
72 static char *compressiontostr(char *string
);
75 void to_streamchannel(int channel
, int &stream_out
, int &channel_out
);
76 int reset_parameters_derived();
77 // File descriptor for decoder
80 // Thread for video encoder
81 FileMPEGVideo
*video_out
;
82 // Command line for video encoder
83 ArrayList
<char*> vcommand_line
;
84 void append_vcommand_line(const char *string
);
86 // Thread for audio encoder
87 FileMPEGAudio
*audio_out
;
88 // Command line for audio encoder
89 ArrayList
<char*> acommand_line
;
90 void append_acommand_line(const char *string
);
93 // Temporary for color conversion
96 unsigned char *toolame_temp
;
97 int toolame_allocation
;
104 int lame_output_allocation
;
106 // Lame puts 0 before stream
109 lame_global_flags
*lame_global
;
113 class FileMPEGVideo
: public Thread
116 FileMPEGVideo(FileMPEG
*file
);
124 class FileMPEGAudio
: public Thread
127 FileMPEGAudio(FileMPEG
*file
);
136 class MPEGConfigAudioPopup
;
140 class MPEGConfigAudio
: public BC_Window
143 MPEGConfigAudio(BC_WindowBase
*parent_window
, Asset
*asset
);
146 int create_objects();
149 BC_WindowBase
*parent_window
;
150 MPEGABitrate
*bitrate
;
151 char string
[BCTEXTLEN
];
156 class MPEGLayer
: public BC_PopupMenu
159 MPEGLayer(int x
, int y
, MPEGConfigAudio
*gui
);
160 void create_objects();
162 static int string_to_layer(char *string
);
163 static char* layer_to_string(int derivative
);
165 MPEGConfigAudio
*gui
;
168 class MPEGABitrate
: public BC_PopupMenu
171 MPEGABitrate(int x
, int y
, MPEGConfigAudio
*gui
);
173 void create_objects();
174 void set_layer(int layer
);
177 static int string_to_bitrate(char *string
);
178 static char* bitrate_to_string(char *string
, int bitrate
);
180 MPEGConfigAudio
*gui
;
185 class MPEGFixedBitrate
;
186 class MPEGFixedQuant
;
188 class MPEGConfigVideo
: public BC_Window
191 MPEGConfigVideo(BC_WindowBase
*parent_window
,
195 int create_objects();
198 BC_WindowBase
*parent_window
;
200 MPEGFixedBitrate
*fixed_bitrate
;
201 MPEGFixedQuant
*fixed_quant
;
205 class MPEGDerivative
: public BC_PopupMenu
208 MPEGDerivative(int x
, int y
, MPEGConfigVideo
*gui
);
209 void create_objects();
211 static int string_to_derivative(char *string
);
212 static char* derivative_to_string(int derivative
);
214 MPEGConfigVideo
*gui
;
217 class MPEGColorModel
: public BC_PopupMenu
220 MPEGColorModel(int x
, int y
, MPEGConfigVideo
*gui
);
221 void create_objects();
223 static int string_to_cmodel(char *string
);
224 static char* cmodel_to_string(int cmodel
);
226 MPEGConfigVideo
*gui
;
229 class MPEGBitrate
: public BC_TextBox
232 MPEGBitrate(int x
, int y
, MPEGConfigVideo
*gui
);
234 MPEGConfigVideo
*gui
;
237 class MPEGQuant
: public BC_TumbleTextBox
240 MPEGQuant(int x
, int y
, MPEGConfigVideo
*gui
);
242 MPEGConfigVideo
*gui
;
245 class MPEGIFrameDistance
: public BC_TumbleTextBox
248 MPEGIFrameDistance(int x
, int y
, MPEGConfigVideo
*gui
);
250 MPEGConfigVideo
*gui
;
253 class MPEGFixedBitrate
: public BC_Radial
256 MPEGFixedBitrate(int x
, int y
, MPEGConfigVideo
*gui
);
258 MPEGConfigVideo
*gui
;
261 class MPEGFixedQuant
: public BC_Radial
264 MPEGFixedQuant(int x
, int y
, MPEGConfigVideo
*gui
);
266 MPEGConfigVideo
*gui
;
269 class MPEGSeqCodes
: public BC_CheckBox
272 MPEGSeqCodes(int x
, int y
, MPEGConfigVideo
*gui
);
274 MPEGConfigVideo
*gui
;