4 #include "bitspopup.inc"
17 // Mpeg2enc prototypes
18 void mpeg2enc_init_buffers();
19 int mpeg2enc(int argc
, char *argv
[]);
20 void mpeg2enc_set_w(int width
);
21 void mpeg2enc_set_h(int height
);
22 void mpeg2enc_set_rate(double rate
);
23 void mpeg2enc_set_input_buffers(int eof
, char *y
, char *u
, char *v
);
28 void toolame_init_buffers();
29 int toolame(int argc
, char **argv
);
30 int toolame_send_buffer(char *data
, int bytes
);
38 class FileMPEG
: public FileBase
41 FileMPEG(Asset
*asset
, File
*file
);
44 friend class FileMPEGVideo
;
45 friend class FileMPEGAudio
;
47 static void get_parameters(BC_WindowBase
*parent_window
,
49 BC_WindowBase
* &format_window
,
53 static int check_sig(Asset
*asset
);
54 int open_file(int rd
, int wr
);
56 int set_video_position(int64_t x
);
57 int set_audio_position(int64_t x
);
58 int write_samples(double **buffer
,
60 int write_frames(VFrame
***frames
, int len
);
62 int read_frame(VFrame
*frame
);
63 int read_samples(double *buffer
, int64_t len
);
65 // Direct copy routines
66 static int get_best_colormodel(Asset
*asset
, int driver
);
67 int colormodel_supported(int colormodel
);
68 // This file can copy frames directly from the asset
69 int can_copy_from(Edit
*edit
, int64_t position
);
70 static char *strtocompression(char *string
);
71 static char *compressiontostr(char *string
);
74 void to_streamchannel(int channel
, int &stream_out
, int &channel_out
);
75 int reset_parameters_derived();
76 // File descriptor for decoder
79 // Thread for video encoder
80 FileMPEGVideo
*video_out
;
81 // Command line for video encoder
82 ArrayList
<char*> vcommand_line
;
83 void append_vcommand_line(const char *string
);
85 // Thread for audio encoder
86 FileMPEGAudio
*audio_out
;
87 // Command line for audio encoder
88 ArrayList
<char*> acommand_line
;
89 void append_acommand_line(const char *string
);
92 // Temporary for color conversion
95 unsigned char *toolame_temp
;
96 int toolame_allocation
;
103 int lame_output_allocation
;
105 // Lame puts 0 before stream
108 lame_global_flags
*lame_global
;
112 class FileMPEGVideo
: public Thread
115 FileMPEGVideo(FileMPEG
*file
);
123 class FileMPEGAudio
: public Thread
126 FileMPEGAudio(FileMPEG
*file
);
135 class MPEGConfigAudioPopup
;
139 class MPEGConfigAudio
: public BC_Window
142 MPEGConfigAudio(BC_WindowBase
*parent_window
, Asset
*asset
);
145 int create_objects();
148 BC_WindowBase
*parent_window
;
149 MPEGABitrate
*bitrate
;
150 char string
[BCTEXTLEN
];
155 class MPEGLayer
: public BC_PopupMenu
158 MPEGLayer(int x
, int y
, MPEGConfigAudio
*gui
);
159 void create_objects();
161 static int string_to_layer(char *string
);
162 static char* layer_to_string(int derivative
);
164 MPEGConfigAudio
*gui
;
167 class MPEGABitrate
: public BC_PopupMenu
170 MPEGABitrate(int x
, int y
, MPEGConfigAudio
*gui
);
172 void create_objects();
173 void set_layer(int layer
);
176 static int string_to_bitrate(char *string
);
177 static char* bitrate_to_string(char *string
, int bitrate
);
179 MPEGConfigAudio
*gui
;
184 class MPEGFixedBitrate
;
185 class MPEGFixedQuant
;
187 class MPEGConfigVideo
: public BC_Window
190 MPEGConfigVideo(BC_WindowBase
*parent_window
,
194 int create_objects();
197 BC_WindowBase
*parent_window
;
199 MPEGFixedBitrate
*fixed_bitrate
;
200 MPEGFixedQuant
*fixed_quant
;
204 class MPEGDerivative
: public BC_PopupMenu
207 MPEGDerivative(int x
, int y
, MPEGConfigVideo
*gui
);
208 void create_objects();
210 static int string_to_derivative(char *string
);
211 static char* derivative_to_string(int derivative
);
213 MPEGConfigVideo
*gui
;
216 class MPEGColorModel
: public BC_PopupMenu
219 MPEGColorModel(int x
, int y
, MPEGConfigVideo
*gui
);
220 void create_objects();
222 static int string_to_cmodel(char *string
);
223 static char* cmodel_to_string(int cmodel
);
225 MPEGConfigVideo
*gui
;
228 class MPEGBitrate
: public BC_TextBox
231 MPEGBitrate(int x
, int y
, MPEGConfigVideo
*gui
);
233 MPEGConfigVideo
*gui
;
236 class MPEGQuant
: public BC_TumbleTextBox
239 MPEGQuant(int x
, int y
, MPEGConfigVideo
*gui
);
241 MPEGConfigVideo
*gui
;
244 class MPEGIFrameDistance
: public BC_TumbleTextBox
247 MPEGIFrameDistance(int x
, int y
, MPEGConfigVideo
*gui
);
249 MPEGConfigVideo
*gui
;
252 class MPEGFixedBitrate
: public BC_Radial
255 MPEGFixedBitrate(int x
, int y
, MPEGConfigVideo
*gui
);
257 MPEGConfigVideo
*gui
;
260 class MPEGFixedQuant
: public BC_Radial
263 MPEGFixedQuant(int x
, int y
, MPEGConfigVideo
*gui
);
265 MPEGConfigVideo
*gui
;
268 class MPEGSeqCodes
: public BC_CheckBox
271 MPEGSeqCodes(int x
, int y
, MPEGConfigVideo
*gui
);
273 MPEGConfigVideo
*gui
;