10 #include "mwindow.inc"
12 #include "videodevice.inc"
19 FileMPEG::FileMPEG(Asset *asset, File *file)
20 : FileBase(asset, file)
23 // May also be VMPEG or AMPEG if write status.
24 if(asset->format == FILE_UNKNOWN) asset->format = FILE_MPEG;
25 asset->byte_order = 0;
33 void FileMPEG::get_parameters(BC_WindowBase *parent_window,
35 BC_WindowBase* &format_window,
39 if(audio_options && asset->format == FILE_AMPEG)
41 MPEGConfigAudio *window = new MPEGConfigAudio(parent_window, asset);
42 format_window = window;
43 window->create_objects();
48 if(video_options && asset->format == FILE_VMPEG)
50 MPEGConfigVideo *window = new MPEGConfigVideo(parent_window, asset);
51 format_window = window;
52 window->create_objects();
58 int FileMPEG::check_sig(Asset *asset)
60 return mpeg3_check_sig(asset->path);
63 int FileMPEG::reset_parameters_derived()
71 toolame_allocation = 0;
78 lame_output_allocation = 0;
84 // Just create the Quicktime objects since this routine is also called
86 int FileMPEG::open_file(int rd, int wr)
94 if(!(fd = mpeg3_open(asset->path)))
96 printf("FileMPEG::open_file %s\n", asset->path);
101 mpeg3_set_cpus(fd, file->cpus);
102 mpeg3_set_mmx(fd, 0);
104 asset->audio_data = mpeg3_has_audio(fd);
105 if(asset->audio_data)
108 for(int i = 0; i < mpeg3_total_astreams(fd); i++)
110 asset->channels += mpeg3_audio_channels(fd, i);
112 if(!asset->sample_rate)
113 asset->sample_rate = mpeg3_sample_rate(fd, 0);
114 asset->audio_length = mpeg3_audio_samples(fd, 0);
117 asset->video_data = mpeg3_has_video(fd);
118 if(asset->video_data)
120 asset->layers = mpeg3_total_vstreams(fd);
121 asset->width = mpeg3_video_width(fd, 0);
122 asset->height = mpeg3_video_height(fd, 0);
123 asset->video_length = mpeg3_video_frames(fd, 0);
124 asset->vmpeg_cmodel = (mpeg3_colormodel(fd, 0) == MPEG3_YUV422P) ? 1 : 0;
125 if(!asset->frame_rate)
126 asset->frame_rate = mpeg3_frame_rate(fd, 0);
133 if(wr && asset->format == FILE_VMPEG)
135 char bitrate_string[BCTEXTLEN];
136 char quant_string[BCTEXTLEN];
137 char iframe_string[BCTEXTLEN];
139 sprintf(bitrate_string, "%d", asset->vmpeg_bitrate);
140 sprintf(quant_string, "%d", asset->vmpeg_quantization);
141 sprintf(iframe_string, "%d", asset->vmpeg_iframe_distance);
143 // Construct command line
146 append_vcommand_line("mpeg2enc");
149 if(asset->aspect_ratio > 0)
151 append_vcommand_line("-a");
152 if(EQUIV(asset->aspect_ratio, 1.333))
153 append_vcommand_line("2");
155 if(EQUIV(asset->aspect_ratio, 1.777))
156 append_vcommand_line("3");
158 if(EQUIV(asset->aspect_ratio, 2.11))
159 append_vcommand_line("4");
162 append_vcommand_line(asset->vmpeg_derivative == 1 ? "-1" : "");
163 append_vcommand_line(asset->vmpeg_cmodel == 1 ? "-422" : "");
164 if(asset->vmpeg_fix_bitrate)
166 append_vcommand_line("-b");
167 append_vcommand_line(bitrate_string);
171 append_vcommand_line("-q");
172 append_vcommand_line(quant_string);
174 append_vcommand_line(!asset->vmpeg_fix_bitrate ? quant_string : "");
175 append_vcommand_line("-n");
176 append_vcommand_line(iframe_string);
177 append_vcommand_line(asset->vmpeg_progressive ? "-p" : "");
178 append_vcommand_line(asset->vmpeg_denoise ? "-d" : "");
179 append_vcommand_line(file->cpus <= 1 ? "-u" : "");
180 append_vcommand_line(asset->vmpeg_seq_codes ? "-g" : "");
181 append_vcommand_line(asset->path);
183 video_out = new FileMPEGVideo(this);
188 if(wr && asset->format == FILE_AMPEG)
190 char command_line[BCTEXTLEN];
191 char encoder_string[BCTEXTLEN];
192 char argument_string[BCTEXTLEN];
194 //printf("FileMPEG::open_file 1 %d\n", asset->ampeg_derivative);
195 encoder_string[0] = 0;
197 if(asset->ampeg_derivative == 2)
199 char string[BCTEXTLEN];
200 append_acommand_line("toolame");
201 append_acommand_line("-m");
202 append_acommand_line((asset->channels >= 2) ? "j" : "m");
203 sprintf(string, "%f", (float)asset->sample_rate / 1000);
204 append_acommand_line("-s");
205 append_acommand_line(string);
206 sprintf(string, "%d", asset->ampeg_bitrate);
207 append_acommand_line("-b");
208 append_acommand_line(string);
209 append_acommand_line("-");
210 append_acommand_line(asset->path);
212 audio_out = new FileMPEGAudio(this);
216 if(asset->ampeg_derivative == 3)
218 lame_global = lame_init();
219 lame_set_brate(lame_global, asset->ampeg_bitrate / 1000);
220 lame_set_quality(lame_global, 0);
221 lame_set_in_samplerate(lame_global,
223 if((result = lame_init_params(lame_global)) < 0)
225 printf(_("encode: lame_init_params returned %d\n"), result);
226 lame_close(lame_global);
230 if(!(lame_fd = fopen(asset->path, "w")))
232 perror("FileMPEG::open_file");
233 lame_close(lame_global);
239 printf("FileMPEG::open_file: ampeg_derivative=%d\n", asset->ampeg_derivative);
245 //printf("FileMPEG::open_file 100\n");
249 void FileMPEG::append_vcommand_line(const char *string)
253 char *argv = strdup(string);
254 vcommand_line.append(argv);
258 void FileMPEG::append_acommand_line(const char *string)
262 char *argv = strdup(string);
263 acommand_line.append(argv);
268 int FileMPEG::close_file()
270 //printf("FileMPEG::close_file 1\n");
278 // End of sequence signal
279 mpeg2enc_set_input_buffers(1, 0, 0, 0);
284 vcommand_line.remove_all_objects();
285 acommand_line.remove_all_objects();
289 toolame_send_buffer(0, 0);
295 lame_close(lame_global);
297 if(temp_frame) delete temp_frame;
298 if(toolame_temp) delete [] toolame_temp;
300 if(lame_temp[0]) delete [] lame_temp[0];
301 if(lame_temp[1]) delete [] lame_temp[1];
302 if(lame_output) delete [] lame_output;
303 if(lame_fd) fclose(lame_fd);
306 FileBase::close_file();
307 //printf("FileMPEG::close_file 100\n");
311 int FileMPEG::get_best_colormodel(Asset *asset, int driver)
313 //printf("FileMPEG::get_best_colormodel 1\n");
318 if(asset->vmpeg_cmodel == 0) return BC_YUV420P;
319 if(asset->vmpeg_cmodel == 1) return BC_YUV422P;
321 case PLAYBACK_X11_XV:
322 if(asset->vmpeg_cmodel == 0) return BC_YUV420P;
323 if(asset->vmpeg_cmodel == 1) return BC_YUV422P;
329 case PLAYBACK_DV1394:
330 case PLAYBACK_FIREWIRE:
335 if(asset->vmpeg_cmodel == 0) return BC_YUV420P;
336 if(asset->vmpeg_cmodel == 1) return BC_YUV422P;
342 case CAPTURE_FIREWIRE:
346 //printf("FileMPEG::get_best_colormodel 100\n");
349 int FileMPEG::colormodel_supported(int colormodel)
355 int FileMPEG::can_copy_from(Edit *edit, int64_t position)
361 int FileMPEG::set_audio_position(int64_t sample)
367 to_streamchannel(file->current_channel, stream, channel);
369 //printf("FileMPEG::set_audio_position %d %d %d\n", sample, mpeg3_get_sample(fd, stream), last_sample);
370 if(sample != mpeg3_get_sample(fd, stream) &&
371 sample != last_sample)
373 if(sample >= 0 && sample < asset->audio_length)
375 //printf("FileMPEG::set_audio_position seeking stream %d\n", sample);
376 return mpeg3_set_sample(fd, sample, stream);
385 int FileMPEG::set_video_position(int64_t x)
388 if(x >= 0 && x < asset->video_length)
390 mpeg3_set_frame(fd, x, file->current_layer);
397 int FileMPEG::write_samples(double **buffer, int64_t len)
401 //printf("FileMPEG::write_samples 1\n");
402 if(asset->ampeg_derivative == 2)
405 int channels = MIN(asset->channels, 2);
406 int64_t audio_size = len * channels * 2;
407 if(toolame_allocation < audio_size)
409 if(toolame_temp) delete [] toolame_temp;
410 toolame_temp = new unsigned char[audio_size];
411 toolame_allocation = audio_size;
414 for(int i = 0; i < channels; i++)
416 int16_t *output = ((int16_t*)toolame_temp) + i;
417 double *input = buffer[i];
418 for(int j = 0; j < len; j++)
420 int sample = (int)(*input * 0x7fff);
421 *output = (int16_t)(CLIP(sample, -0x8000, 0x7fff));
426 result = toolame_send_buffer((char*)toolame_temp, audio_size);
429 if(asset->ampeg_derivative == 3)
431 int channels = MIN(asset->channels, 2);
432 int64_t audio_size = len * channels;
433 if(!lame_global) return 1;
434 if(!lame_fd) return 1;
435 if(lame_allocation < audio_size)
437 if(lame_temp[0]) delete [] lame_temp[0];
438 if(lame_temp[1]) delete [] lame_temp[1];
439 lame_temp[0] = new float[audio_size];
440 lame_temp[1] = new float[audio_size];
441 lame_allocation = audio_size;
444 if(lame_output_allocation < audio_size * 4)
446 if(lame_output) delete [] lame_output;
447 lame_output_allocation = audio_size * 4;
448 lame_output = new char[lame_output_allocation];
451 for(int i = 0; i < channels; i++)
453 float *output = lame_temp[i];
454 double *input = buffer[i];
455 for(int j = 0; j < len; j++)
457 *output++ = *input++ * (float)32768;
461 result = lame_encode_buffer_float(lame_global,
463 (channels > 1) ? lame_temp[1] : lame_temp[0],
465 (unsigned char*)lame_output,
466 lame_output_allocation);
469 char *real_output = lame_output;
473 for(int i = 0; i < bytes; i++)
476 real_output = &lame_output[i];
482 if(bytes > 0 && lame_started)
484 result = !fwrite(real_output, 1, bytes, lame_fd);
486 perror("FileMPEG::write_samples");
498 int FileMPEG::write_frames(VFrame ***frames, int len)
504 int temp_w = (int)((asset->width + 15) / 16) * 16;
507 (asset->vmpeg_cmodel == 0) ? BC_YUV420P : BC_YUV422P;
510 // Height depends on progressiveness
511 if(asset->vmpeg_progressive || asset->vmpeg_derivative == 1)
512 temp_h = (int)((asset->height + 15) / 16) * 16;
514 temp_h = (int)((asset->height + 31) / 32) * 32;
516 //printf("FileMPEG::write_frames 1\n");
518 // Only 1 layer is supported in MPEG output
519 for(int i = 0; i < 1; i++)
521 for(int j = 0; j < len; j++)
523 VFrame *frame = frames[i][j];
527 if(frame->get_w() == temp_w &&
528 frame->get_h() == temp_h &&
529 frame->get_color_model() == output_cmodel)
531 mpeg2enc_set_input_buffers(0,
532 (char*)frame->get_y(),
533 (char*)frame->get_u(),
534 (char*)frame->get_v());
538 //printf("FileMPEG::write_frames 2\n");
540 (temp_frame->get_w() != temp_w ||
541 temp_frame->get_h() != temp_h ||
542 temp_frame->get_color_model() || output_cmodel))
547 //printf("FileMPEG::write_frames 3\n");
552 temp_frame = new VFrame(0,
558 cmodel_transfer(temp_frame->get_rows(),
574 frame->get_color_model(),
575 temp_frame->get_color_model(),
580 mpeg2enc_set_input_buffers(0,
581 (char*)temp_frame->get_y(),
582 (char*)temp_frame->get_u(),
583 (char*)temp_frame->get_v());
589 //printf("FileMPEG::write_frames 100\n");
595 int FileMPEG::read_frame(VFrame *frame)
601 //printf("FileMPEG::read_frame 1\n");
602 if(mpeg3_colormodel(fd, 0) == MPEG3_YUV420P)
603 src_cmodel = BC_YUV420P;
605 if(mpeg3_colormodel(fd, 0) == MPEG3_YUV422P)
606 src_cmodel = BC_YUV422P;
608 //printf("FileMPEG::read_frame 1 %p %d\n", frame, frame->get_color_model());
609 switch(frame->get_color_model())
616 case MPEG3_RGBA16161616:
618 frame->get_rows(), /* Array of pointers to the start of each output row */
619 0, /* Location in input frame to take picture */
623 asset->width, /* Dimensions of output_rows */
625 frame->get_color_model(), /* One of the color model #defines */
626 file->current_layer);
631 // Read these directly
632 if(frame->get_color_model() == src_cmodel)
634 mpeg3_read_yuvframe(fd,
635 (char*)frame->get_y(),
636 (char*)frame->get_u(),
637 (char*)frame->get_v(),
642 file->current_layer);
645 // Process through temp frame
648 mpeg3_read_yuvframe_ptr(fd,
652 file->current_layer);
655 cmodel_transfer(frame->get_rows(),
672 frame->get_color_model(),
678 //printf("FileMPEG::read_frame 2\n");
681 //for(int i = 0; i < frame->get_w() * 3 * 20; i++)
682 // ((u_int16_t*)frame->get_rows()[0])[i] = 0xffff;
683 //printf("FileMPEG::read_frame 100\n");
687 void FileMPEG::to_streamchannel(int channel, int &stream_out, int &channel_out)
689 for(stream_out = 0, channel_out = file->current_channel;
690 stream_out < mpeg3_total_astreams(fd) &&
691 channel_out >= mpeg3_audio_channels(fd, stream_out);
692 channel_out -= mpeg3_audio_channels(fd, stream_out), stream_out++)
696 int FileMPEG::read_samples(double *buffer, int64_t len)
700 // This is directed to a FileMPEGBuffer
701 float *temp_float = new float[len];
702 // Translate pure channel to a stream and a channel in the mpeg stream
704 to_streamchannel(file->current_channel, stream, channel);
708 //printf("FileMPEG::read_samples 1 current_sample=%ld len=%ld channel=%d\n", file->current_sample, len, channel);
711 file->current_sample,
714 temp_float, /* Pointer to pre-allocated buffer of floats */
715 0, /* Pointer to pre-allocated buffer of int16's */
716 channel, /* Channel to decode */
717 len, /* Number of samples to decode */
718 stream); /* Stream containing the channel */
721 // last_sample = file->current_sample;
722 for(int i = 0; i < len; i++) buffer[i] = temp_float[i];
724 delete [] temp_float;
725 //printf("FileMPEG::read_samples 100\n");
729 int FileMPEG::prefer_samples_float()
734 int FileMPEG::read_samples_float(float *buffer, int64_t len)
738 // Translate pure channel to a stream and a channel in the mpeg stream
740 to_streamchannel(file->current_channel, stream, channel);
743 //printf("FileMPEG::read_samples 1 current_sample=%ld len=%ld channel=%d\n", file->current_sample, len, channel);
746 file->current_sample,
749 buffer, /* Pointer to pre-allocated buffer of floats */
750 0, /* Pointer to pre-allocated buffer of int16's */
751 channel, /* Channel to decode */
752 len, /* Number of samples to decode */
753 stream); /* Stream containing the channel */
756 // last_sample = file->current_sample;
758 //printf("FileMPEG::read_samples 100\n");
764 char* FileMPEG::strtocompression(char *string)
769 char* FileMPEG::compressiontostr(char *string)
780 FileMPEGVideo::FileMPEGVideo(FileMPEG *file)
784 mpeg2enc_init_buffers();
785 mpeg2enc_set_w(file->asset->width);
786 mpeg2enc_set_h(file->asset->height);
787 mpeg2enc_set_rate(file->asset->frame_rate);
790 FileMPEGVideo::~FileMPEGVideo()
795 void FileMPEGVideo::run()
797 printf("FileMPEGVideo::run ");
798 for(int i = 0; i < file->vcommand_line.total; i++)
799 printf("%s ", file->vcommand_line.values[i]);
801 mpeg2enc(file->vcommand_line.total, file->vcommand_line.values);
811 FileMPEGAudio::FileMPEGAudio(FileMPEG *file)
815 toolame_init_buffers();
818 FileMPEGAudio::~FileMPEGAudio()
823 void FileMPEGAudio::run()
825 file->toolame_result = toolame(file->acommand_line.total, file->acommand_line.values);
835 MPEGConfigAudio::MPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
836 : BC_Window(PROGRAM_NAME ": Audio Compression",
837 parent_window->get_abs_cursor_x(1),
838 parent_window->get_abs_cursor_y(1),
847 this->parent_window = parent_window;
851 MPEGConfigAudio::~MPEGConfigAudio()
855 int MPEGConfigAudio::create_objects()
861 add_tool(new BC_Title(x, y, _("Layer:")));
862 add_tool(layer = new MPEGLayer(x1, y, this));
863 layer->create_objects();
866 add_tool(new BC_Title(x, y, _("Kbits per second:")));
867 add_tool(bitrate = new MPEGABitrate(x1, y, this));
868 bitrate->create_objects();
871 add_subwindow(new BC_OKButton(this));
877 int MPEGConfigAudio::close_event()
889 MPEGLayer::MPEGLayer(int x, int y, MPEGConfigAudio *gui)
890 : BC_PopupMenu(x, y, 150, layer_to_string(gui->asset->ampeg_derivative))
895 void MPEGLayer::create_objects()
897 add_item(new BC_MenuItem(layer_to_string(2)));
898 add_item(new BC_MenuItem(layer_to_string(3)));
901 int MPEGLayer::handle_event()
903 gui->asset->ampeg_derivative = string_to_layer(get_text());
904 gui->bitrate->set_layer(gui->asset->ampeg_derivative);
908 int MPEGLayer::string_to_layer(char *string)
910 if(!strcasecmp(layer_to_string(2), string))
912 if(!strcasecmp(layer_to_string(3), string))
918 char* MPEGLayer::layer_to_string(int layer)
942 MPEGABitrate::MPEGABitrate(int x, int y, MPEGConfigAudio *gui)
946 bitrate_to_string(gui->string, gui->asset->ampeg_bitrate))
951 void MPEGABitrate::create_objects()
953 set_layer(gui->asset->ampeg_derivative);
956 void MPEGABitrate::set_layer(int layer)
965 add_item(new BC_MenuItem("160"));
966 add_item(new BC_MenuItem("192"));
967 add_item(new BC_MenuItem("224"));
968 add_item(new BC_MenuItem("256"));
969 add_item(new BC_MenuItem("320"));
970 add_item(new BC_MenuItem("384"));
974 add_item(new BC_MenuItem("8"));
975 add_item(new BC_MenuItem("16"));
976 add_item(new BC_MenuItem("24"));
977 add_item(new BC_MenuItem("32"));
978 add_item(new BC_MenuItem("40"));
979 add_item(new BC_MenuItem("48"));
980 add_item(new BC_MenuItem("56"));
981 add_item(new BC_MenuItem("64"));
982 add_item(new BC_MenuItem("80"));
983 add_item(new BC_MenuItem("96"));
984 add_item(new BC_MenuItem("112"));
985 add_item(new BC_MenuItem("128"));
986 add_item(new BC_MenuItem("144"));
987 add_item(new BC_MenuItem("160"));
988 add_item(new BC_MenuItem("192"));
989 add_item(new BC_MenuItem("224"));
990 add_item(new BC_MenuItem("256"));
991 add_item(new BC_MenuItem("320"));
995 int MPEGABitrate::handle_event()
997 gui->asset->ampeg_bitrate = string_to_bitrate(get_text());
1001 int MPEGABitrate::string_to_bitrate(char *string)
1003 return atol(string);
1007 char* MPEGABitrate::bitrate_to_string(char *string, int bitrate)
1009 sprintf(string, "%d", bitrate);
1021 MPEGConfigVideo::MPEGConfigVideo(BC_WindowBase *parent_window,
1023 : BC_Window(PROGRAM_NAME ": Video Compression",
1024 parent_window->get_abs_cursor_x(1),
1025 parent_window->get_abs_cursor_y(1),
1034 this->parent_window = parent_window;
1035 this->asset = asset;
1038 MPEGConfigVideo::~MPEGConfigVideo()
1042 int MPEGConfigVideo::create_objects()
1047 MPEGDerivative *derivative;
1048 MPEGColorModel *cmodel;
1050 add_subwindow(new BC_Title(x, y + 5, _("Derivative:")));
1051 add_subwindow(derivative = new MPEGDerivative(x1, y, this));
1052 derivative->create_objects();
1055 add_subwindow(new BC_Title(x, y + 5, _("Bitrate:")));
1056 add_subwindow(new MPEGBitrate(x1, y, this));
1057 add_subwindow(fixed_bitrate = new MPEGFixedBitrate(x2, y, this));
1060 add_subwindow(new BC_Title(x, y, _("Quantization:")));
1061 MPEGQuant *quant = new MPEGQuant(x1, y, this);
1062 quant->create_objects();
1063 add_subwindow(fixed_quant = new MPEGFixedQuant(x2, y, this));
1066 add_subwindow(new BC_Title(x, y, _("I frame distance:")));
1067 MPEGIFrameDistance *iframe_distance =
1068 new MPEGIFrameDistance(x1, y, this);
1069 iframe_distance->create_objects();
1072 add_subwindow(new BC_Title(x, y, _("Color model:")));
1073 add_subwindow(cmodel = new MPEGColorModel(x1, y, this));
1074 cmodel->create_objects();
1077 // add_subwindow(new BC_Title(x, y, _("P frame distance:")));
1081 add_subwindow(new BC_CheckBox(x, y, &asset->vmpeg_progressive, _("Progressive frames")));
1083 add_subwindow(new BC_CheckBox(x, y, &asset->vmpeg_denoise, _("Denoise")));
1085 add_subwindow(new BC_CheckBox(x, y, &asset->vmpeg_seq_codes, _("Sequence start codes in every GOP")));
1087 add_subwindow(new BC_OKButton(this));
1093 int MPEGConfigVideo::close_event()
1101 MPEGDerivative::MPEGDerivative(int x, int y, MPEGConfigVideo *gui)
1102 : BC_PopupMenu(x, y, 150, derivative_to_string(gui->asset->vmpeg_derivative))
1107 void MPEGDerivative::create_objects()
1109 add_item(new BC_MenuItem(derivative_to_string(1)));
1110 add_item(new BC_MenuItem(derivative_to_string(2)));
1113 int MPEGDerivative::handle_event()
1115 gui->asset->vmpeg_derivative = string_to_derivative(get_text());
1119 int MPEGDerivative::string_to_derivative(char *string)
1121 if(!strcasecmp(derivative_to_string(1), string))
1123 if(!strcasecmp(derivative_to_string(2), string))
1129 char* MPEGDerivative::derivative_to_string(int derivative)
1150 MPEGBitrate::MPEGBitrate(int x, int y, MPEGConfigVideo *gui)
1151 : BC_TextBox(x, y, 100, 1, gui->asset->vmpeg_bitrate)
1157 int MPEGBitrate::handle_event()
1159 gui->asset->vmpeg_bitrate = atol(get_text());
1167 MPEGQuant::MPEGQuant(int x, int y, MPEGConfigVideo *gui)
1168 : BC_TumbleTextBox(gui,
1169 (int64_t)gui->asset->vmpeg_quantization,
1179 int MPEGQuant::handle_event()
1181 gui->asset->vmpeg_quantization = atol(get_text());
1185 MPEGFixedBitrate::MPEGFixedBitrate(int x, int y, MPEGConfigVideo *gui)
1186 : BC_Radial(x, y, gui->asset->vmpeg_fix_bitrate, _("Fixed bitrate"))
1191 int MPEGFixedBitrate::handle_event()
1194 gui->asset->vmpeg_fix_bitrate = 1;
1195 gui->fixed_quant->update(0);
1199 MPEGFixedQuant::MPEGFixedQuant(int x, int y, MPEGConfigVideo *gui)
1200 : BC_Radial(x, y, !gui->asset->vmpeg_fix_bitrate, _("Fixed quantization"))
1205 int MPEGFixedQuant::handle_event()
1208 gui->asset->vmpeg_fix_bitrate = 0;
1209 gui->fixed_bitrate->update(0);
1213 MPEGIFrameDistance::MPEGIFrameDistance(int x, int y, MPEGConfigVideo *gui)
1214 : BC_TumbleTextBox(gui,
1215 (int64_t)gui->asset->vmpeg_iframe_distance,
1225 int MPEGIFrameDistance::handle_event()
1227 gui->asset->vmpeg_iframe_distance = atol(get_text());
1232 MPEGColorModel::MPEGColorModel(int x, int y, MPEGConfigVideo *gui)
1233 : BC_PopupMenu(x, y, 150, cmodel_to_string(gui->asset->vmpeg_cmodel))
1238 void MPEGColorModel::create_objects()
1240 add_item(new BC_MenuItem(cmodel_to_string(0)));
1241 add_item(new BC_MenuItem(cmodel_to_string(1)));
1244 int MPEGColorModel::handle_event()
1246 gui->asset->vmpeg_cmodel = string_to_cmodel(get_text());
1250 int MPEGColorModel::string_to_cmodel(char *string)
1252 if(!strcasecmp(cmodel_to_string(0), string))
1254 if(!strcasecmp(cmodel_to_string(1), string))
1260 char* MPEGColorModel::cmodel_to_string(int cmodel)
1265 return _("YUV 4:2:0");
1269 return _("YUV 4:2:2");
1273 return _("YUV 4:2:0");