11 #include "videodevice.inc"
17 #define _(String) gettext(String)
18 #define gettext_noop(String) String
19 #define N_(String) gettext_noop (String)
22 FileMPEG::FileMPEG(Asset *asset, File *file)
23 : FileBase(asset, file)
26 // May also be VMPEG or AMPEG if write status.
27 if(asset->format == FILE_UNKNOWN) asset->format = FILE_MPEG;
28 asset->byte_order = 0;
36 void FileMPEG::get_parameters(BC_WindowBase *parent_window,
38 BC_WindowBase* &format_window,
42 if(audio_options && asset->format == FILE_AMPEG)
44 MPEGConfigAudio *window = new MPEGConfigAudio(parent_window, asset);
45 format_window = window;
46 window->create_objects();
51 if(video_options && asset->format == FILE_VMPEG)
53 MPEGConfigVideo *window = new MPEGConfigVideo(parent_window, asset);
54 format_window = window;
55 window->create_objects();
61 int FileMPEG::check_sig(Asset *asset)
63 return mpeg3_check_sig(asset->path);
66 int FileMPEG::reset_parameters_derived()
74 toolame_allocation = 0;
81 lame_output_allocation = 0;
87 // Just create the Quicktime objects since this routine is also called
89 int FileMPEG::open_file(int rd, int wr)
94 //printf("FileMPEG::open_file: 1 %d %d %d\n", rd, wr, asset->format);
98 if(!(fd = mpeg3_open(asset->path)))
100 printf("FileMPEG::open_file %s\n", asset->path);
105 mpeg3_set_cpus(fd, file->cpus);
106 mpeg3_set_mmx(fd, 0);
108 asset->audio_data = mpeg3_has_audio(fd);
109 if(asset->audio_data)
112 for(int i = 0; i < mpeg3_total_astreams(fd); i++)
114 asset->channels += mpeg3_audio_channels(fd, i);
116 if(!asset->sample_rate)
117 asset->sample_rate = mpeg3_sample_rate(fd, 0);
118 asset->audio_length = mpeg3_audio_samples(fd, 0);
119 //printf("FileMPEG::open_file 1 %d\n", asset->audio_length);
122 asset->video_data = mpeg3_has_video(fd);
123 if(asset->video_data)
125 asset->layers = mpeg3_total_vstreams(fd);
126 asset->width = mpeg3_video_width(fd, 0);
127 asset->height = mpeg3_video_height(fd, 0);
128 asset->video_length = mpeg3_video_frames(fd, 0);
129 asset->vmpeg_cmodel = (mpeg3_colormodel(fd, 0) == MPEG3_YUV422P) ? 1 : 0;
130 if(!asset->frame_rate)
131 asset->frame_rate = mpeg3_frame_rate(fd, 0);
132 //printf("FileMPEG::open_file 2 %d\n", asset->video_length);
137 //printf("FileMPEG::open_file 2 %d\n", asset->video_length);
140 if(wr && asset->format == FILE_VMPEG)
142 char bitrate_string[BCTEXTLEN];
143 char quant_string[BCTEXTLEN];
144 char iframe_string[BCTEXTLEN];
146 sprintf(bitrate_string, "%d", asset->vmpeg_bitrate);
147 sprintf(quant_string, "%d", asset->vmpeg_quantization);
148 sprintf(iframe_string, "%d", asset->vmpeg_iframe_distance);
150 // Construct command line
153 append_vcommand_line("mpeg2enc");
154 append_vcommand_line(asset->vmpeg_derivative == 1 ? "-1" : "");
155 append_vcommand_line(asset->vmpeg_cmodel == 1 ? "-422" : "");
156 if(asset->vmpeg_fix_bitrate)
158 append_vcommand_line("-b");
159 append_vcommand_line(bitrate_string);
163 append_vcommand_line("-q");
164 append_vcommand_line(quant_string);
166 append_vcommand_line(!asset->vmpeg_fix_bitrate ? quant_string : "");
167 append_vcommand_line("-n");
168 append_vcommand_line(iframe_string);
169 append_vcommand_line(asset->vmpeg_progressive ? "-p" : "");
170 append_vcommand_line(asset->vmpeg_denoise ? "-d" : "");
171 append_vcommand_line(file->cpus <= 1 ? "-u" : "");
172 append_vcommand_line(asset->vmpeg_seq_codes ? "-g" : "");
173 append_vcommand_line(asset->path);
175 video_out = new FileMPEGVideo(this);
180 if(wr && asset->format == FILE_AMPEG)
182 char command_line[BCTEXTLEN];
183 char encoder_string[BCTEXTLEN];
184 char argument_string[BCTEXTLEN];
186 //printf("FileMPEG::open_file 1 %d\n", asset->ampeg_derivative);
187 encoder_string[0] = 0;
189 if(asset->ampeg_derivative == 2)
191 char string[BCTEXTLEN];
192 append_acommand_line("toolame");
193 append_acommand_line("-m");
194 append_acommand_line((asset->channels >= 2) ? "j" : "m");
195 sprintf(string, "%f", (float)asset->sample_rate / 1000);
196 append_acommand_line("-s");
197 append_acommand_line(string);
198 sprintf(string, "%d", asset->ampeg_bitrate);
199 append_acommand_line("-b");
200 append_acommand_line(string);
201 append_acommand_line("-");
202 append_acommand_line(asset->path);
204 audio_out = new FileMPEGAudio(this);
208 if(asset->ampeg_derivative == 3)
210 lame_global = lame_init();
211 lame_set_brate(lame_global, asset->ampeg_bitrate / 1000);
212 lame_set_quality(lame_global, 0);
213 lame_set_in_samplerate(lame_global,
215 if((result = lame_init_params(lame_global)) < 0)
217 printf(_("encode: lame_init_params returned %d\n"), result);
218 lame_close(lame_global);
222 if(!(lame_fd = fopen(asset->path, "w")))
224 perror("FileMPEG::open_file");
225 lame_close(lame_global);
231 printf("FileMPEG::open_file: ampeg_derivative=%d\n", asset->ampeg_derivative);
237 //printf("FileMPEG::open_file 100\n");
241 void FileMPEG::append_vcommand_line(const char *string)
245 char *argv = strdup(string);
246 vcommand_line.append(argv);
250 void FileMPEG::append_acommand_line(const char *string)
254 char *argv = strdup(string);
255 acommand_line.append(argv);
260 int FileMPEG::close_file()
262 //printf("FileMPEG::close_file 1\n");
270 // End of sequence signal
271 mpeg2enc_set_input_buffers(1, 0, 0, 0);
276 vcommand_line.remove_all_objects();
277 acommand_line.remove_all_objects();
281 toolame_send_buffer(0, 0);
287 lame_close(lame_global);
289 if(temp_frame) delete temp_frame;
290 if(toolame_temp) delete [] toolame_temp;
292 if(lame_temp[0]) delete [] lame_temp[0];
293 if(lame_temp[1]) delete [] lame_temp[1];
294 if(lame_output) delete [] lame_output;
295 if(lame_fd) fclose(lame_fd);
298 FileBase::close_file();
299 //printf("FileMPEG::close_file 100\n");
303 int FileMPEG::get_best_colormodel(Asset *asset, int driver)
305 //printf("FileMPEG::get_best_colormodel 1\n");
310 if(asset->vmpeg_cmodel == 0) return BC_YUV420P;
311 if(asset->vmpeg_cmodel == 1) return BC_YUV422P;
313 case PLAYBACK_X11_XV:
314 if(asset->vmpeg_cmodel == 0) return BC_YUV420P;
315 if(asset->vmpeg_cmodel == 1) return BC_YUV422P;
321 case PLAYBACK_FIREWIRE:
326 if(asset->vmpeg_cmodel == 0) return BC_YUV420P;
327 if(asset->vmpeg_cmodel == 1) return BC_YUV422P;
333 case CAPTURE_FIREWIRE:
337 //printf("FileMPEG::get_best_colormodel 100\n");
340 int FileMPEG::colormodel_supported(int colormodel)
346 int FileMPEG::can_copy_from(Edit *edit, int64_t position)
352 int FileMPEG::set_audio_position(int64_t sample)
358 to_streamchannel(file->current_channel, stream, channel);
360 //printf("FileMPEG::set_audio_position %d %d %d\n", sample, mpeg3_get_sample(fd, stream), last_sample);
361 if(sample != mpeg3_get_sample(fd, stream) &&
362 sample != last_sample)
364 if(sample >= 0 && sample < asset->audio_length)
366 //printf("FileMPEG::set_audio_position seeking stream %d\n", sample);
367 return mpeg3_set_sample(fd, sample, stream);
376 int FileMPEG::set_video_position(int64_t x)
379 if(x >= 0 && x < asset->video_length)
380 return mpeg3_set_frame(fd, x, file->current_layer);
386 int FileMPEG::write_samples(double **buffer, int64_t len)
390 //printf("FileMPEG::write_samples 1\n");
391 if(asset->ampeg_derivative == 2)
394 int channels = MIN(asset->channels, 2);
395 int64_t audio_size = len * channels * 2;
396 if(toolame_allocation < audio_size)
398 if(toolame_temp) delete [] toolame_temp;
399 toolame_temp = new unsigned char[audio_size];
400 toolame_allocation = audio_size;
403 for(int i = 0; i < channels; i++)
405 int16_t *output = ((int16_t*)toolame_temp) + i;
406 double *input = buffer[i];
407 for(int j = 0; j < len; j++)
409 int sample = (int)(*input * 0x7fff);
410 *output = (int16_t)(CLIP(sample, -0x8000, 0x7fff));
415 result = toolame_send_buffer((char*)toolame_temp, audio_size);
418 if(asset->ampeg_derivative == 3)
420 int channels = MIN(asset->channels, 2);
421 int64_t audio_size = len * channels;
422 if(!lame_global) return 1;
423 if(!lame_fd) return 1;
424 if(lame_allocation < audio_size)
426 if(lame_temp[0]) delete [] lame_temp[0];
427 if(lame_temp[1]) delete [] lame_temp[1];
428 lame_temp[0] = new float[audio_size];
429 lame_temp[1] = new float[audio_size];
430 lame_allocation = audio_size;
433 if(lame_output_allocation < audio_size * 4)
435 if(lame_output) delete [] lame_output;
436 lame_output_allocation = audio_size * 4;
437 lame_output = new char[lame_output_allocation];
440 for(int i = 0; i < channels; i++)
442 float *output = lame_temp[i];
443 double *input = buffer[i];
444 for(int j = 0; j < len; j++)
446 *output++ = *input++ * (float)32768;
450 result = lame_encode_buffer_float(lame_global,
452 (channels > 1) ? lame_temp[1] : lame_temp[0],
454 (unsigned char*)lame_output,
455 lame_output_allocation);
458 char *real_output = lame_output;
462 for(int i = 0; i < bytes; i++)
465 real_output = &lame_output[i];
471 if(bytes > 0 && lame_started)
473 result = !fwrite(real_output, 1, bytes, lame_fd);
475 perror("FileMPEG::write_samples");
487 int FileMPEG::write_frames(VFrame ***frames, int len)
493 int temp_w = (int)((asset->width + 15) / 16) * 16;
496 (asset->vmpeg_cmodel == 0) ? BC_YUV420P : BC_YUV422P;
499 // Height depends on progressiveness
500 if(asset->vmpeg_progressive || asset->vmpeg_derivative == 1)
501 temp_h = (int)((asset->height + 15) / 16) * 16;
503 temp_h = (int)((asset->height + 31) / 32) * 32;
505 //printf("FileMPEG::write_frames 1\n");
507 // Only 1 layer is supported in MPEG output
508 for(int i = 0; i < 1; i++)
510 for(int j = 0; j < len; j++)
512 VFrame *frame = frames[i][j];
516 if(frame->get_w() == temp_w &&
517 frame->get_h() == temp_h &&
518 frame->get_color_model() == output_cmodel)
520 mpeg2enc_set_input_buffers(0,
521 (char*)frame->get_y(),
522 (char*)frame->get_u(),
523 (char*)frame->get_v());
527 //printf("FileMPEG::write_frames 2\n");
529 (temp_frame->get_w() != temp_w ||
530 temp_frame->get_h() != temp_h ||
531 temp_frame->get_color_model() || output_cmodel))
536 //printf("FileMPEG::write_frames 3\n");
541 temp_frame = new VFrame(0,
547 cmodel_transfer(temp_frame->get_rows(),
563 frame->get_color_model(),
564 temp_frame->get_color_model(),
569 mpeg2enc_set_input_buffers(0,
570 (char*)temp_frame->get_y(),
571 (char*)temp_frame->get_u(),
572 (char*)temp_frame->get_v());
578 //printf("FileMPEG::write_frames 100\n");
584 int FileMPEG::read_frame(VFrame *frame)
590 //printf("FileMPEG::read_frame 1\n");
591 if(mpeg3_colormodel(fd, 0) == MPEG3_YUV420P)
592 src_cmodel = BC_YUV420P;
594 if(mpeg3_colormodel(fd, 0) == MPEG3_YUV422P)
595 src_cmodel = BC_YUV422P;
597 //printf("FileMPEG::read_frame 1 %p %d\n", frame, frame->get_color_model());
598 switch(frame->get_color_model())
605 case MPEG3_RGBA16161616:
607 frame->get_rows(), /* Array of pointers to the start of each output row */
608 0, /* Location in input frame to take picture */
612 asset->width, /* Dimensions of output_rows */
614 frame->get_color_model(), /* One of the color model #defines */
615 file->current_layer);
620 // Read these directly
621 if(frame->get_color_model() == src_cmodel)
623 mpeg3_read_yuvframe(fd,
624 (char*)frame->get_y(),
625 (char*)frame->get_u(),
626 (char*)frame->get_v(),
631 file->current_layer);
634 // Process through temp frame
637 mpeg3_read_yuvframe_ptr(fd,
641 file->current_layer);
642 cmodel_transfer(frame->get_rows(),
659 frame->get_color_model(),
664 //printf("FileMPEG::read_frame 2\n");
667 //for(int i = 0; i < frame->get_w() * 3 * 20; i++)
668 // ((u_int16_t*)frame->get_rows()[0])[i] = 0xffff;
669 //printf("FileMPEG::read_frame 100\n");
673 void FileMPEG::to_streamchannel(int channel, int &stream_out, int &channel_out)
675 for(stream_out = 0, channel_out = file->current_channel;
676 stream_out < mpeg3_total_astreams(fd) &&
677 channel_out >= mpeg3_audio_channels(fd, stream_out);
678 channel_out -= mpeg3_audio_channels(fd, stream_out), stream_out++)
682 int FileMPEG::read_samples(double *buffer, int64_t len)
686 // This is directed to a FileMPEGBuffer
687 float *temp_float = new float[len];
688 // Translate pure channel to a stream and a channel in the mpeg stream
690 to_streamchannel(file->current_channel, stream, channel);
694 //printf("FileMPEG::read_samples 1 current_sample=%ld len=%ld channel=%d\n", file->current_sample, len, channel);
697 file->current_sample,
700 temp_float, /* Pointer to pre-allocated buffer of floats */
701 0, /* Pointer to pre-allocated buffer of int16's */
702 channel, /* Channel to decode */
703 len, /* Number of samples to decode */
704 stream); /* Stream containing the channel */
707 // last_sample = file->current_sample;
708 for(int i = 0; i < len; i++) buffer[i] = temp_float[i];
710 delete [] temp_float;
711 //printf("FileMPEG::read_samples 100\n");
715 char* FileMPEG::strtocompression(char *string)
720 char* FileMPEG::compressiontostr(char *string)
731 FileMPEGVideo::FileMPEGVideo(FileMPEG *file)
735 mpeg2enc_init_buffers();
736 mpeg2enc_set_w(file->asset->width);
737 mpeg2enc_set_h(file->asset->height);
738 mpeg2enc_set_rate(file->asset->frame_rate);
741 FileMPEGVideo::~FileMPEGVideo()
746 void FileMPEGVideo::run()
748 mpeg2enc(file->vcommand_line.total, file->vcommand_line.values);
758 FileMPEGAudio::FileMPEGAudio(FileMPEG *file)
762 toolame_init_buffers();
765 FileMPEGAudio::~FileMPEGAudio()
770 void FileMPEGAudio::run()
772 file->toolame_result = toolame(file->acommand_line.total, file->acommand_line.values);
782 MPEGConfigAudio::MPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
783 : BC_Window(PROGRAM_NAME ": Audio Compression",
784 parent_window->get_abs_cursor_x(),
785 parent_window->get_abs_cursor_y(),
794 this->parent_window = parent_window;
798 MPEGConfigAudio::~MPEGConfigAudio()
802 int MPEGConfigAudio::create_objects()
808 add_tool(new BC_Title(x, y, _("Layer:")));
809 add_tool(layer = new MPEGLayer(x1, y, this));
810 layer->create_objects();
813 add_tool(new BC_Title(x, y, _("Kbits per second:")));
814 add_tool(bitrate = new MPEGABitrate(x1, y, this));
815 bitrate->create_objects();
818 add_subwindow(new BC_OKButton(this));
824 int MPEGConfigAudio::close_event()
836 MPEGLayer::MPEGLayer(int x, int y, MPEGConfigAudio *gui)
837 : BC_PopupMenu(x, y, 150, layer_to_string(gui->asset->ampeg_derivative))
842 void MPEGLayer::create_objects()
844 add_item(new BC_MenuItem(layer_to_string(2)));
845 add_item(new BC_MenuItem(layer_to_string(3)));
848 int MPEGLayer::handle_event()
850 gui->asset->ampeg_derivative = string_to_layer(get_text());
851 gui->bitrate->set_layer(gui->asset->ampeg_derivative);
855 int MPEGLayer::string_to_layer(char *string)
857 if(!strcasecmp(layer_to_string(2), string))
859 if(!strcasecmp(layer_to_string(3), string))
865 char* MPEGLayer::layer_to_string(int layer)
889 MPEGABitrate::MPEGABitrate(int x, int y, MPEGConfigAudio *gui)
893 bitrate_to_string(gui->string, gui->asset->ampeg_bitrate))
898 void MPEGABitrate::create_objects()
900 set_layer(gui->asset->ampeg_derivative);
903 void MPEGABitrate::set_layer(int layer)
912 add_item(new BC_MenuItem("160"));
913 add_item(new BC_MenuItem("192"));
914 add_item(new BC_MenuItem("224"));
915 add_item(new BC_MenuItem("256"));
916 add_item(new BC_MenuItem("320"));
917 add_item(new BC_MenuItem("384"));
921 add_item(new BC_MenuItem("8"));
922 add_item(new BC_MenuItem("16"));
923 add_item(new BC_MenuItem("24"));
924 add_item(new BC_MenuItem("32"));
925 add_item(new BC_MenuItem("40"));
926 add_item(new BC_MenuItem("48"));
927 add_item(new BC_MenuItem("56"));
928 add_item(new BC_MenuItem("64"));
929 add_item(new BC_MenuItem("80"));
930 add_item(new BC_MenuItem("96"));
931 add_item(new BC_MenuItem("112"));
932 add_item(new BC_MenuItem("128"));
933 add_item(new BC_MenuItem("144"));
934 add_item(new BC_MenuItem("160"));
935 add_item(new BC_MenuItem("192"));
936 add_item(new BC_MenuItem("224"));
937 add_item(new BC_MenuItem("256"));
938 add_item(new BC_MenuItem("320"));
942 int MPEGABitrate::handle_event()
944 gui->asset->ampeg_bitrate = string_to_bitrate(get_text());
948 int MPEGABitrate::string_to_bitrate(char *string)
954 char* MPEGABitrate::bitrate_to_string(char *string, int bitrate)
956 sprintf(string, "%d", bitrate);
968 MPEGConfigVideo::MPEGConfigVideo(BC_WindowBase *parent_window,
970 : BC_Window(PROGRAM_NAME ": Video Compression",
971 parent_window->get_abs_cursor_x(),
972 parent_window->get_abs_cursor_y(),
981 this->parent_window = parent_window;
985 MPEGConfigVideo::~MPEGConfigVideo()
989 int MPEGConfigVideo::create_objects()
994 MPEGDerivative *derivative;
995 MPEGColorModel *cmodel;
997 add_subwindow(new BC_Title(x, y + 5, _("Derivative:")));
998 add_subwindow(derivative = new MPEGDerivative(x1, y, this));
999 derivative->create_objects();
1002 add_subwindow(new BC_Title(x, y + 5, _("Bitrate:")));
1003 add_subwindow(new MPEGBitrate(x1, y, this));
1004 add_subwindow(fixed_bitrate = new MPEGFixedBitrate(x2, y, this));
1007 add_subwindow(new BC_Title(x, y, _("Quantization:")));
1008 MPEGQuant *quant = new MPEGQuant(x1, y, this);
1009 quant->create_objects();
1010 add_subwindow(fixed_quant = new MPEGFixedQuant(x2, y, this));
1013 add_subwindow(new BC_Title(x, y, _("I frame distance:")));
1014 MPEGIFrameDistance *iframe_distance =
1015 new MPEGIFrameDistance(x1, y, this);
1016 iframe_distance->create_objects();
1019 add_subwindow(new BC_Title(x, y, _("Color model:")));
1020 add_subwindow(cmodel = new MPEGColorModel(x1, y, this));
1021 cmodel->create_objects();
1024 // add_subwindow(new BC_Title(x, y, _("P frame distance:")));
1028 add_subwindow(new BC_CheckBox(x, y, &asset->vmpeg_progressive, _("Progressive frames")));
1030 add_subwindow(new BC_CheckBox(x, y, &asset->vmpeg_denoise, _("Denoise")));
1032 add_subwindow(new BC_CheckBox(x, y, &asset->vmpeg_seq_codes, _("Sequence start codes in every GOP")));
1034 add_subwindow(new BC_OKButton(this));
1040 int MPEGConfigVideo::close_event()
1048 MPEGDerivative::MPEGDerivative(int x, int y, MPEGConfigVideo *gui)
1049 : BC_PopupMenu(x, y, 150, derivative_to_string(gui->asset->vmpeg_derivative))
1054 void MPEGDerivative::create_objects()
1056 add_item(new BC_MenuItem(derivative_to_string(1)));
1057 add_item(new BC_MenuItem(derivative_to_string(2)));
1060 int MPEGDerivative::handle_event()
1062 gui->asset->vmpeg_derivative = string_to_derivative(get_text());
1066 int MPEGDerivative::string_to_derivative(char *string)
1068 if(!strcasecmp(derivative_to_string(1), string))
1070 if(!strcasecmp(derivative_to_string(2), string))
1076 char* MPEGDerivative::derivative_to_string(int derivative)
1097 MPEGBitrate::MPEGBitrate(int x, int y, MPEGConfigVideo *gui)
1098 : BC_TextBox(x, y, 100, 1, gui->asset->vmpeg_bitrate)
1104 int MPEGBitrate::handle_event()
1106 gui->asset->vmpeg_bitrate = atol(get_text());
1114 MPEGQuant::MPEGQuant(int x, int y, MPEGConfigVideo *gui)
1115 : BC_TumbleTextBox(gui,
1116 (int64_t)gui->asset->vmpeg_quantization,
1126 int MPEGQuant::handle_event()
1128 gui->asset->vmpeg_quantization = atol(get_text());
1132 MPEGFixedBitrate::MPEGFixedBitrate(int x, int y, MPEGConfigVideo *gui)
1133 : BC_Radial(x, y, gui->asset->vmpeg_fix_bitrate, _("Fixed bitrate"))
1138 int MPEGFixedBitrate::handle_event()
1141 gui->asset->vmpeg_fix_bitrate = 1;
1142 gui->fixed_quant->update(0);
1146 MPEGFixedQuant::MPEGFixedQuant(int x, int y, MPEGConfigVideo *gui)
1147 : BC_Radial(x, y, !gui->asset->vmpeg_fix_bitrate, _("Fixed quantization"))
1152 int MPEGFixedQuant::handle_event()
1155 gui->asset->vmpeg_fix_bitrate = 0;
1156 gui->fixed_bitrate->update(0);
1160 MPEGIFrameDistance::MPEGIFrameDistance(int x, int y, MPEGConfigVideo *gui)
1161 : BC_TumbleTextBox(gui,
1162 (int64_t)gui->asset->vmpeg_iframe_distance,
1172 int MPEGIFrameDistance::handle_event()
1174 gui->asset->vmpeg_iframe_distance = atol(get_text());
1179 MPEGColorModel::MPEGColorModel(int x, int y, MPEGConfigVideo *gui)
1180 : BC_PopupMenu(x, y, 150, cmodel_to_string(gui->asset->vmpeg_cmodel))
1185 void MPEGColorModel::create_objects()
1187 add_item(new BC_MenuItem(cmodel_to_string(0)));
1188 add_item(new BC_MenuItem(cmodel_to_string(1)));
1191 int MPEGColorModel::handle_event()
1193 gui->asset->vmpeg_cmodel = string_to_cmodel(get_text());
1197 int MPEGColorModel::string_to_cmodel(char *string)
1199 if(!strcasecmp(cmodel_to_string(0), string))
1201 if(!strcasecmp(cmodel_to_string(1), string))
1207 char* MPEGColorModel::cmodel_to_string(int cmodel)
1212 return _("YUV 4:2:0");
1216 return _("YUV 4:2:2");
1220 return _("YUV 4:2:0");