00001 #include "asset.h"
00002 #include "bcsignals.h"
00003 #include "bitspopup.h"
00004 #include "byteorder.h"
00005 #include "condition.h"
00006 #include "edit.h"
00007 #include "file.h"
00008 #include "filemov.h"
00009 #include "guicast.h"
00010 #include "language.h"
00011 #include "mutex.h"
00012 #include "mwindow.inc"
00013 #include "vframe.h"
00014 #include "videodevice.inc"
00015 #include "mainerror.h"
00016
00017 #include <unistd.h>
00018 #include <libdv/dv.h>
00019
00020 #if 0
00021 N_("MPEG-4")
00022 N_("Dual H.264")
00023 N_("Dual MPEG-4")
00024 N_("H.264")
00025 N_("H.263")
00026 N_("Microsoft MPEG-4")
00027 N_("DV")
00028 N_("PNG")
00029 N_("PNG with Alpha")
00030 N_("Uncompressed RGB")
00031 N_("Uncompressed RGBA")
00032 N_("YUV 4:2:0 Planar")
00033 N_("Component Y'CbCr 8-bit 4:2:2 (yuv2)")
00034 N_("Component Y'CbCr 8-bit 4:2:2 (2vuy)")
00035 N_("YUV 4:1:1 Packed")
00036 N_("Component Y'CbCr 8-bit 4:4:4")
00037 N_("Component Y'CbCrA 8-bit 4:4:4:4")
00038 N_("Component Y'CbCr 10-bit 4:4:4")
00039 N_("JPEG Photo")
00040 N_("Motion JPEG A")
00041
00042
00043 N_("Twos complement")
00044 N_("Unsigned")
00045 N_("IMA-4")
00046 N_("U-Law")
00047 N_("Vorbis")
00048 N_("MP3")
00049 N_("MPEG-4 Audio")
00050 #endif
00051
00052 #define DIVX_NAME "MPEG-4"
00053 #define HV64_NAME "Dual H.264"
00054 #define MP4V_NAME "MPEG-4 Video"
00055 #define H264_NAME "H.264"
00056 #define H263_NAME "H.263"
00057 #define HV60_NAME "Dual MPEG-4"
00058 #define DIV3_NAME "Microsoft MPEG-4"
00059 #define DV_NAME "DV"
00060 #define PNG_NAME "PNG"
00061 #define PNGA_NAME "PNG with Alpha"
00062 #define RGB_NAME "Uncompressed RGB"
00063 #define RGBA_NAME "Uncompressed RGBA"
00064 #define YUV420_NAME "YUV 4:2:0 Planar"
00065 #define YUV422_NAME "Component Y'CbCr 8-bit 4:2:2 (yuv2)"
00066 #define TWOVUY_NAME "Component Y'CbCr 8-bit 4:2:2 (2vuy)"
00067 #define YUV411_NAME "YUV 4:1:1 Packed"
00068 #define YUV444_NAME "Component Y'CbCr 8-bit 4:4:4"
00069 #define YUVA4444_NAME "Component Y'CbCrA 8-bit 4:4:4:4"
00070 #define YUV444_10BIT_NAME "Component Y'CbCr 10-bit 4:4:4"
00071 #define QTJPEG_NAME "JPEG Photo"
00072 #define MJPA_NAME "Motion JPEG A"
00073
00074 #define TWOS_NAME "Twos complement"
00075 #define RAW_NAME "Unsigned"
00076 #define IMA4_NAME "IMA-4"
00077 #define ULAW_NAME "U-Law"
00078
00079 #define MP3_NAME "MP3"
00080 #define MP4A_NAME "MPEG-4 Audio"
00081 #define VORBIS_NAME "OGG Vorbis"
00082
00083
00084
00085
00086
00087 FileMOV::FileMOV(Asset *asset, File *file)
00088 : FileBase(asset, file)
00089 {
00090 reset_parameters();
00091 if(asset->format == FILE_UNKNOWN)
00092 asset->format = FILE_MOV;
00093 asset->byte_order = 0;
00094 suffix_number = 0;
00095 threadframe_lock = new Mutex("FileMOV::threadframe_lock");
00096 }
00097
00098 FileMOV::~FileMOV()
00099 {
00100 SET_TRACE
00101 close_file();
00102 SET_TRACE
00103 delete threadframe_lock;
00104 SET_TRACE
00105 }
00106
00107 void FileMOV::get_parameters(BC_WindowBase *parent_window,
00108 Asset *asset,
00109 BC_WindowBase* &format_window,
00110 int audio_options,
00111 int video_options,
00112 char *locked_compressor)
00113 {
00114 fix_codecs(asset);
00115 if(audio_options)
00116 {
00117 MOVConfigAudio *window = new MOVConfigAudio(parent_window, asset);
00118 format_window = window;
00119 window->create_objects();
00120 window->run_window();
00121 delete window;
00122 }
00123 else
00124 if(video_options)
00125 {
00126 MOVConfigVideo *window = new MOVConfigVideo(parent_window,
00127 asset,
00128 locked_compressor);
00129 format_window = window;
00130 window->create_objects();
00131 window->run_window();
00132 delete window;
00133 }
00134 }
00135
00136 void FileMOV::fix_codecs(Asset *asset)
00137 {
00138 if(!strcasecmp(asset->vcodec, QUICKTIME_DV) ||
00139 !strcasecmp(asset->vcodec, QUICKTIME_DVSD) ||
00140 !strcasecmp(asset->vcodec, QUICKTIME_DVCP))
00141 {
00142
00143 if (asset->format == FILE_AVI)
00144 strcpy (asset->vcodec, QUICKTIME_DVSD);
00145 else if (asset->format == FILE_MOV && asset->height == 576)
00146 strcpy (asset->vcodec, QUICKTIME_DVCP);
00147 else if (asset->format == FILE_MOV && asset->height == 480)
00148 strcpy (asset->vcodec, QUICKTIME_DV);
00149 }
00150 }
00151
00152
00153 int FileMOV::check_codec_params(Asset *asset)
00154 {
00155 if(!strcasecmp(asset->vcodec, QUICKTIME_DV) ||
00156 !strcasecmp(asset->vcodec, QUICKTIME_DVSD) ||
00157 !strcasecmp(asset->vcodec, QUICKTIME_DVCP))
00158 {
00159
00160 if (!(asset->height == 576 && asset->width == 720) &&
00161 !(asset->height == 480 && asset->width == 720))
00162 {
00163 eprintf("DV in Quicktime container does not support following resolution: %ix%i\nAllowed resolutions are 720x576 (PAL) and 720x480 (NTSC)\n", asset->width, asset->height);
00164 return 1;
00165 }
00166 }
00167 return 0;
00168 }
00169
00170 int FileMOV::check_sig(Asset *asset)
00171 {
00172 return quicktime_check_sig(asset->path);
00173 }
00174
00175
00176 int FileMOV::reset_parameters_derived()
00177 {
00178 fd = 0;
00179 prev_track = 0;
00180 quicktime_atracks = 0;
00181 quicktime_vtracks = 0;
00182 depth = 24;
00183 threads = 0;
00184 frames_correction = 0;
00185 samples_correction = 0;
00186 temp_float = 0;
00187 temp_allocated = 0;
00188 }
00189
00190
00191
00192
00193 int FileMOV::open_file(int rd, int wr)
00194 {
00195
00196 this->rd = rd;
00197 this->wr = wr;
00198
00199 if(suffix_number == 0) strcpy(prefix_path, asset->path);
00200
00201 if(!(fd = quicktime_open(asset->path, rd, wr)))
00202 {
00203 eprintf("Error while opening file \"%s\". \n%m\n", asset->path);
00204 return 1;
00205 }
00206
00207 quicktime_set_cpus(fd, file->cpus);
00208
00209 if(rd) format_to_asset();
00210
00211 if(wr)
00212 {
00213 asset_to_format();
00214 if (check_codec_params(asset))
00215 return 1;
00216 }
00217
00218 quicktime_set_parameter(fd, "divx_use_deblocking", &asset->divx_use_deblocking);
00219
00220
00221 quicktime_set_frame_start(fd, asset->tcstart);
00222
00223 return 0;
00224 }
00225
00226 int FileMOV::close_file()
00227 {
00228
00229 if(fd)
00230 {
00231 if(wr) quicktime_set_framerate(fd, asset->frame_rate);
00232 quicktime_close(fd);
00233 }
00234
00235
00236 if(threads)
00237 {
00238 for(int i = 0; i < file->cpus; i++)
00239 {
00240 threads[i]->stop_encoding();
00241 delete threads[i];
00242 }
00243 delete [] threads;
00244 threads = 0;
00245 }
00246
00247
00248 threadframes.remove_all_objects();
00249
00250
00251 if(temp_float)
00252 {
00253 for(int i = 0; i < asset->channels; i++)
00254 delete [] temp_float[i];
00255 delete [] temp_float;
00256 }
00257
00258
00259 reset_parameters();
00260 FileBase::close_file();
00261
00262 return 0;
00263 }
00264
00265 void FileMOV::set_frame_start(int64_t offset)
00266 {
00267 quicktime_set_frame_start(fd, offset);
00268 }
00269
00270 void FileMOV::asset_to_format()
00271 {
00272 if(!fd) return;
00273 char audio_codec[5];
00274
00275 fix_codecs(asset);
00276
00277
00278 quicktime_set_copyright(fd, _("Made with Cinelerra for Linux"));
00279 quicktime_set_info(fd, "Quicktime for Linux");
00280
00281 if(asset->audio_data)
00282 {
00283 quicktime_atracks = quicktime_set_audio(fd,
00284 asset->channels,
00285 asset->sample_rate,
00286 asset->bits,
00287 asset->acodec);
00288 quicktime_set_parameter(fd, "vorbis_vbr", &asset->vorbis_vbr);
00289 quicktime_set_parameter(fd, "vorbis_min_bitrate", &asset->vorbis_min_bitrate);
00290 quicktime_set_parameter(fd, "vorbis_bitrate", &asset->vorbis_bitrate);
00291 quicktime_set_parameter(fd, "vorbis_max_bitrate", &asset->vorbis_max_bitrate);
00292 quicktime_set_parameter(fd, "mp3_bitrate", &asset->mp3_bitrate);
00293 quicktime_set_parameter(fd, "mp4a_bitrate", &asset->mp4a_bitrate);
00294 }
00295
00296 if(asset->video_data)
00297 {
00298 char string[16];
00299
00300 if(!strcmp(asset->vcodec, MOV_RGBA))
00301 {
00302 strcpy(string, QUICKTIME_RAW);
00303 depth = 32;
00304 }
00305 else
00306 if(!strcmp(asset->vcodec, MOV_PNGA))
00307 {
00308 strcpy(string, QUICKTIME_PNG);
00309 depth = 32;
00310 }
00311 else
00312 if(!strcmp(asset->vcodec, QUICKTIME_YUVA4444))
00313 {
00314 strcpy(string, asset->vcodec);
00315 depth = 32;
00316 }
00317 else
00318 {
00319 strcpy(string, asset->vcodec);
00320 depth = 24;
00321 }
00322
00323
00324 quicktime_vtracks = quicktime_set_video(fd,
00325 asset->layers,
00326 asset->width,
00327 asset->height,
00328 asset->frame_rate,
00329 string);
00330
00331
00332
00333 for(int i = 0; i < asset->layers; i++)
00334 quicktime_set_depth(fd, depth, i);
00335
00336 quicktime_set_parameter(fd, "jpeg_quality", &asset->jpeg_quality);
00337
00338
00339 quicktime_set_parameter(fd, "divx_bitrate", &asset->divx_bitrate);
00340 quicktime_set_parameter(fd, "divx_rc_period", &asset->divx_rc_period);
00341 quicktime_set_parameter(fd, "divx_rc_reaction_ratio", &asset->divx_rc_reaction_ratio);
00342 quicktime_set_parameter(fd, "divx_rc_reaction_period", &asset->divx_rc_reaction_period);
00343 quicktime_set_parameter(fd, "divx_max_key_interval", &asset->divx_max_key_interval);
00344 quicktime_set_parameter(fd, "divx_max_quantizer", &asset->divx_max_quantizer);
00345 quicktime_set_parameter(fd, "divx_min_quantizer", &asset->divx_min_quantizer);
00346 quicktime_set_parameter(fd, "divx_quantizer", &asset->divx_quantizer);
00347 quicktime_set_parameter(fd, "divx_quality", &asset->divx_quality);
00348 quicktime_set_parameter(fd, "divx_fix_bitrate", &asset->divx_fix_bitrate);
00349
00350 quicktime_set_parameter(fd, "ffmpeg_bitrate", &asset->ms_bitrate);
00351 quicktime_set_parameter(fd, "ffmpeg_bitrate_tolerance", &asset->ms_bitrate_tolerance);
00352 quicktime_set_parameter(fd, "ffmpeg_interlaced", &asset->ms_interlaced);
00353 quicktime_set_parameter(fd, "ffmpeg_quantizer", &asset->ms_quantization);
00354 quicktime_set_parameter(fd, "ffmpeg_gop_size", &asset->ms_gop_size);
00355 quicktime_set_parameter(fd, "ffmpeg_fix_bitrate", &asset->ms_fix_bitrate);
00356
00357 quicktime_set_parameter(fd, "h264_bitrate", &asset->h264_bitrate);
00358 quicktime_set_parameter(fd, "h264_quantizer", &asset->h264_quantizer);
00359 quicktime_set_parameter(fd, "h264_fix_bitrate", &asset->h264_fix_bitrate);
00360
00361
00362 }
00363
00364 if(wr && asset->format == FILE_AVI)
00365 {
00366 quicktime_set_avi(fd, 1);
00367 }
00368 }
00369
00370
00371 void FileMOV::format_to_asset()
00372 {
00373 if(!fd) return;
00374
00375 if(quicktime_is_avi(fd)) asset->format = FILE_AVI;
00376 asset->audio_data = quicktime_has_audio(fd);
00377 if(asset->audio_data)
00378 {
00379 asset->channels = 0;
00380 int qt_tracks = quicktime_audio_tracks(fd);
00381 for(int i = 0; i < qt_tracks; i++)
00382 asset->channels += quicktime_track_channels(fd, i);
00383
00384 if(!asset->sample_rate)
00385 asset->sample_rate = quicktime_sample_rate(fd, 0);
00386 asset->bits = quicktime_audio_bits(fd, 0);
00387 asset->audio_length = quicktime_audio_length(fd, 0);
00388 strncpy(asset->acodec, quicktime_audio_compressor(fd, 0), 4);
00389 }
00390
00391
00392 if(quicktime_has_video(fd) && quicktime_supported_video(fd, 0))
00393 asset->video_data = 1;
00394
00395 if(asset->video_data)
00396 {
00397 depth = quicktime_video_depth(fd, 0);
00398 asset->layers = quicktime_video_tracks(fd);
00399 asset->width = quicktime_video_width(fd, 0);
00400 asset->height = quicktime_video_height(fd, 0);
00401 asset->video_length = quicktime_video_length(fd, 0);
00402
00403 if(!asset->frame_rate)
00404 asset->frame_rate = quicktime_frame_rate(fd, 0);
00405 if(!asset->interlace_mode)
00406 asset->interlace_mode = quicktime_video_interlacemode(fd, 0);
00407
00408 strncpy(asset->vcodec, quicktime_video_compressor(fd, 0), 4);
00409
00410
00411
00412 if(match4(asset->vcodec, QUICKTIME_DV))
00413 {
00414 char tc[12];
00415 dv_decoder_t *tmp_decoder = dv_decoder_new(0,0,0);
00416 VFrame *frame = new VFrame(0, 0, 0, BC_COMPRESSED);
00417
00418 read_frame(frame);
00419 set_video_position(0);
00420
00421 if(dv_parse_header(tmp_decoder, frame->get_data()) > -1)
00422 {
00423 dv_parse_packs(tmp_decoder, frame->get_data());
00424 dv_get_timestamp(tmp_decoder, tc);
00425
00426
00427 float seconds = Units::text_to_seconds(tc,
00428 1,
00429 TIME_HMSF,
00430 asset->frame_rate,
00431 0);
00432
00433
00434 if (asset->tcstart == 0)
00435 asset->tcstart = int64_t(seconds * asset->frame_rate);
00436 }
00437 delete frame;
00438 dv_decoder_free(tmp_decoder);
00439
00440 }
00441
00442
00443 }
00444 }
00445
00446 int64_t FileMOV::get_memory_usage()
00447 {
00448 if(rd && fd)
00449 {
00450 int64_t result = quicktime_memory_usage(fd);
00451
00452 return result;
00453 }
00454 return 0;
00455 }
00456
00457 int FileMOV::colormodel_supported(int colormodel)
00458 {
00459 return colormodel;
00460 }
00461
00462 int FileMOV::get_best_colormodel(Asset *asset, int driver)
00463 {
00464 switch(driver)
00465 {
00466 case PLAYBACK_X11:
00467 return BC_RGB888;
00468 break;
00469 case PLAYBACK_X11_XV:
00470 case PLAYBACK_ASYNCHRONOUS:
00471 if(match4(asset->vcodec, QUICKTIME_YUV420)) return BC_YUV420P;
00472 if(match4(asset->vcodec, QUICKTIME_YUV422)) return BC_YUV422;
00473 if(match4(asset->vcodec, QUICKTIME_2VUY)) return BC_YUV422;
00474 if(match4(asset->vcodec, QUICKTIME_JPEG)) return BC_YUV420P;
00475 if(match4(asset->vcodec, QUICKTIME_MJPA)) return BC_YUV422P;
00476 if(match4(asset->vcodec, QUICKTIME_DV)) return BC_YUV422;
00477 if(match4(asset->vcodec, QUICKTIME_DVSD)) return BC_YUV422;
00478 if(match4(asset->vcodec, QUICKTIME_HV60)) return BC_YUV420P;
00479 if(match4(asset->vcodec, QUICKTIME_DIVX)) return BC_YUV420P;
00480 if(match4(asset->vcodec, QUICKTIME_DVCP)) return BC_YUV422;
00481 if(match4(asset->vcodec, QUICKTIME_DVSD)) return BC_YUV422;
00482 if(match4(asset->vcodec, QUICKTIME_MP4V)) return BC_YUV420P;
00483 if(match4(asset->vcodec, QUICKTIME_H263)) return BC_YUV420P;
00484 if(match4(asset->vcodec, QUICKTIME_H264)) return BC_YUV420P;
00485 if(match4(asset->vcodec, QUICKTIME_HV64)) return BC_YUV420P;
00486 if(match4(asset->vcodec, QUICKTIME_DIV3) ||
00487 match4(asset->vcodec, QUICKTIME_SVQ3)) return BC_YUV420P;
00488 break;
00489 case PLAYBACK_X11_GL:
00490 if(match4(asset->vcodec, QUICKTIME_YUV420) ||
00491 match4(asset->vcodec, QUICKTIME_YUV422) ||
00492 match4(asset->vcodec, QUICKTIME_2VUY) ||
00493 match4(asset->vcodec, QUICKTIME_JPEG) ||
00494 match4(asset->vcodec, QUICKTIME_MJPA) ||
00495 match4(asset->vcodec, QUICKTIME_DV) ||
00496 match4(asset->vcodec, QUICKTIME_DVCP) ||
00497 match4(asset->vcodec, QUICKTIME_DVSD) ||
00498 match4(asset->vcodec, QUICKTIME_HV60) ||
00499 match4(asset->vcodec, QUICKTIME_DIVX) ||
00500 match4(asset->vcodec, QUICKTIME_DVSD) ||
00501 match4(asset->vcodec, QUICKTIME_MP4V) ||
00502 match4(asset->vcodec, QUICKTIME_H263) ||
00503 match4(asset->vcodec, QUICKTIME_H264) ||
00504 match4(asset->vcodec, QUICKTIME_HV64) ||
00505 match4(asset->vcodec, QUICKTIME_DIV3) ||
00506 match4(asset->vcodec, QUICKTIME_DVSD)) return BC_YUV888;
00507 break;
00508 case PLAYBACK_DV1394:
00509 case PLAYBACK_FIREWIRE:
00510 if(match4(asset->vcodec, QUICKTIME_DV) ||
00511 match4(asset->vcodec, QUICKTIME_DVSD) ||
00512 match4(asset->vcodec, QUICKTIME_DVCP)) return BC_COMPRESSED;
00513 return BC_YUV422P;
00514 break;
00515 case PLAYBACK_LML:
00516 case PLAYBACK_BUZ:
00517 if(match4(asset->vcodec, QUICKTIME_MJPA))
00518 return BC_COMPRESSED;
00519 else
00520 return BC_YUV422P;
00521 break;
00522 case VIDEO4LINUX:
00523 case VIDEO4LINUX2:
00524 if(!strncasecmp(asset->vcodec, QUICKTIME_YUV420, 4)) return BC_YUV422;
00525 else
00526 if(!strncasecmp(asset->vcodec, QUICKTIME_YUV422, 4)) return BC_YUV422;
00527 else
00528 if(!strncasecmp(asset->vcodec, QUICKTIME_YUV411, 4)) return BC_YUV411P;
00529 else
00530 if(!strncasecmp(asset->vcodec, QUICKTIME_JPEG, 4)) return BC_YUV420P;
00531 else
00532 if(!strncasecmp(asset->vcodec, QUICKTIME_MJPA, 4)) return BC_YUV422P;
00533 else
00534 if(!strncasecmp(asset->vcodec, QUICKTIME_HV60, 4)) return BC_YUV420P;
00535 else
00536 if(!strncasecmp(asset->vcodec, QUICKTIME_DIVX, 4)) return BC_YUV420P;
00537 else
00538 if(!strncasecmp(asset->vcodec, QUICKTIME_H263, 4)) return BC_YUV420P;
00539 else
00540 if(!strncasecmp(asset->vcodec, QUICKTIME_DIV3, 4)) return BC_YUV420P;
00541 break;
00542 case CAPTURE_BUZ:
00543 case CAPTURE_LML:
00544 case VIDEO4LINUX2JPEG:
00545 if(!strncasecmp(asset->vcodec, QUICKTIME_MJPA, 4))
00546 return BC_COMPRESSED;
00547 else
00548 return BC_YUV422;
00549 break;
00550 case CAPTURE_FIREWIRE:
00551 case CAPTURE_IEC61883:
00552 if(!strncasecmp(asset->vcodec, QUICKTIME_DV, 4) ||
00553 !strncasecmp(asset->vcodec, QUICKTIME_DVSD, 4) ||
00554 !strncasecmp(asset->vcodec, QUICKTIME_DVCP, 4))
00555 return BC_COMPRESSED;
00556 else
00557 return BC_YUV422;
00558 break;
00559 }
00560 return BC_RGB888;
00561 }
00562
00563 int FileMOV::can_copy_from(Edit *edit, int64_t position)
00564 {
00565 if(!fd) return 0;
00566
00567
00568 if(edit->asset->format == FILE_JPEG_LIST &&
00569 match4(this->asset->vcodec, QUICKTIME_JPEG))
00570 return 1;
00571 else
00572 if((edit->asset->format == FILE_MOV ||
00573 edit->asset->format == FILE_AVI))
00574 {
00575
00576 if(match4(edit->asset->vcodec, this->asset->vcodec))
00577 return 1;
00578
00579
00580 int is_edit_dv = 0;
00581 int is_this_dv = 0;
00582 if (match4(edit->asset->vcodec, QUICKTIME_DV) ||
00583 match4(edit->asset->vcodec, QUICKTIME_DVSD) ||
00584 match4(edit->asset->vcodec, QUICKTIME_DVCP))
00585 is_edit_dv = 1;
00586 if (match4(this->asset->vcodec, QUICKTIME_DV) ||
00587 match4(this->asset->vcodec, QUICKTIME_DVSD) ||
00588 match4(this->asset->vcodec, QUICKTIME_DVCP))
00589 is_this_dv = 1;
00590 if (is_this_dv && is_edit_dv)
00591 return 1;
00592 }
00593 else
00594 if(edit->asset->format == FILE_RAWDV)
00595 {
00596 if(match4(this->asset->vcodec, QUICKTIME_DV) ||
00597 match4(this->asset->vcodec, QUICKTIME_DVSD) ||
00598 match4(this->asset->vcodec, QUICKTIME_DVCP))
00599 return 1;
00600 }
00601
00602
00603 return 0;
00604 }
00605
00606
00607 int64_t FileMOV::get_audio_length()
00608 {
00609 if(!fd) return 0;
00610 int64_t result = quicktime_audio_length(fd, 0) + samples_correction;
00611
00612 return result;
00613 }
00614
00615 int FileMOV::set_audio_position(int64_t x)
00616 {
00617 if(!fd) return 1;
00618
00619 if(x >= 0 && x < asset->audio_length)
00620 return quicktime_set_audio_position(fd, x, 0);
00621 else
00622 return 1;
00623 }
00624
00625 int FileMOV::set_video_position(int64_t x)
00626 {
00627 if(!fd) return 1;
00628 if(x >= 0 && x < asset->video_length)
00629 {
00630 int result = quicktime_set_video_position(fd, x, file->current_layer);
00631 return result;
00632 }else
00633 return 1;
00634 }
00635
00636
00637 void FileMOV::new_audio_temp(int64_t len)
00638 {
00639 if(temp_allocated && temp_allocated < len)
00640 {
00641 for(int i = 0; i < asset->channels; i++)
00642 delete [] temp_float[i];
00643 delete [] temp_float;
00644 temp_allocated = 0;
00645 }
00646
00647 if(!temp_allocated)
00648 {
00649 temp_allocated = len;
00650 temp_float = new float*[asset->channels];
00651 for(int i = 0; i < asset->channels; i++)
00652 temp_float[i] = new float[len];
00653 }
00654 }
00655
00656
00657
00658 int FileMOV::write_samples(double **buffer, int64_t len)
00659 {
00660 int i, j;
00661 int64_t bytes;
00662 int result = 0, track_channels = 0;
00663 int chunk_size;
00664
00665 if(!fd) return 0;
00666
00667 if(quicktime_supported_audio(fd, 0))
00668 {
00669
00670
00671 new_audio_temp(len);
00672
00673
00674 for(i = 0; i < asset->channels; i++)
00675 {
00676 for(j = 0; j < len; j++)
00677 {
00678 temp_float[i][j] = buffer[i][j];
00679 }
00680 }
00681
00682
00683
00684 float **channel_ptr;
00685 channel_ptr = new float*[asset->channels];
00686
00687 for(j = 0; j < len && !result; )
00688 {
00689 chunk_size = asset->sample_rate;
00690 if(j + chunk_size > len) chunk_size = len - j;
00691
00692 for(i = 0; i < asset->channels; i++)
00693 {
00694 channel_ptr[i] = &temp_float[i][j];
00695 }
00696
00697 result = quicktime_encode_audio(fd, 0, channel_ptr, chunk_size);
00698 j += asset->sample_rate;
00699 }
00700
00701 delete [] channel_ptr;
00702 }
00703 return result;
00704 }
00705
00706 int FileMOV::write_frames(VFrame ***frames, int len)
00707 {
00708
00709 int i, j, k, result = 0;
00710 int default_compressor = 1;
00711 if(!fd) return 0;
00712
00713 for(i = 0; i < asset->layers && !result; i++)
00714 {
00715
00716
00717
00718
00719
00720
00721 if(frames[i][0]->get_color_model() == BC_COMPRESSED)
00722 {
00723 default_compressor = 0;
00724 for(j = 0; j < len && !result; j++)
00725 {
00726 VFrame *frame = frames[i][j];
00727
00728
00729
00730
00731
00732
00733 if(!strcmp(asset->vcodec, QUICKTIME_DIVX) ||
00734 !strcmp(asset->vcodec, QUICKTIME_H263) ||
00735 !strcmp(asset->vcodec, QUICKTIME_HV60))
00736 {
00737 if(quicktime_mpeg4_is_key(frame->get_data(),
00738 frame->get_compressed_size(),
00739 asset->vcodec))
00740 quicktime_insert_keyframe(fd, file->current_frame + j, i);
00741
00742
00743
00744 if(!(file->current_frame + j) &&
00745 !quicktime_mpeg4_has_vol(frame->get_data()))
00746 {
00747 VFrame *temp_frame = new VFrame;
00748
00749 temp_frame->allocate_compressed_data(frame->get_compressed_size() +
00750 0xff);
00751 int bytes = quicktime_mpeg4_write_vol(temp_frame->get_data(),
00752 asset->width,
00753 asset->height,
00754 60000,
00755 asset->frame_rate);
00756 memcpy(temp_frame->get_data() + bytes,
00757 frame->get_data(),
00758 frame->get_compressed_size());
00759 temp_frame->set_compressed_size(frame->get_compressed_size() + bytes);
00760
00761 result = quicktime_write_frame(fd,
00762 temp_frame->get_data(),
00763 temp_frame->get_compressed_size(),
00764 i);
00765
00766 delete temp_frame;
00767
00768
00769 }
00770 else
00771 {
00772 result = quicktime_write_frame(fd,
00773 frame->get_data(),
00774 frame->get_compressed_size(),
00775 i);
00776 }
00777 }
00778 else
00779
00780 if(!strcmp(asset->vcodec, QUICKTIME_H264) ||
00781 !strcmp(asset->vcodec, QUICKTIME_HV64) ||
00782 !strcmp(asset->vcodec, QUICKTIME_MP4V))
00783 {
00784 if(frame->get_keyframe() || file->current_frame + j == 0)
00785 quicktime_insert_keyframe(fd, file->current_frame + j, i);
00786
00787
00788 result = quicktime_write_frame(fd,
00789 frame->get_data(),
00790 frame->get_compressed_size(),
00791 i);
00792 }
00793 else
00794 if(!strcmp(asset->vcodec, QUICKTIME_DIV3))
00795 {
00796 if(quicktime_mpeg4_is_key(frame->get_data(),
00797 frame->get_compressed_size(),
00798 asset->vcodec))
00799 quicktime_insert_keyframe(fd, file->current_frame + j, i);
00800 result = quicktime_write_frame(fd,
00801 frame->get_data(),
00802 frame->get_compressed_size(),
00803 i);
00804 }
00805 else
00806 if(!strcmp(asset->vcodec, QUICKTIME_MJPA))
00807 {
00808 long field2_offset;
00809
00810
00811 if(frame->get_compressed_allocated() - frame->get_compressed_size() < 0x100)
00812 frame->allocate_compressed_data(frame->get_compressed_size() + 0x100);
00813
00814 unsigned char *data = frame->get_data();
00815 long data_size = frame->get_compressed_size();
00816 long data_allocated = frame->get_compressed_allocated();
00817
00818
00819 if(data_size)
00820 {
00821 if(asset->format == FILE_MOV)
00822 {
00823 mjpeg_insert_quicktime_markers(&data,
00824 &data_size,
00825 &data_allocated,
00826 2,
00827 &field2_offset);
00828 }
00829 else
00830 {
00831 mjpeg_insert_avi_markers(&data,
00832 &data_size,
00833 &data_allocated,
00834 2,
00835 &field2_offset);
00836 }
00837 frame->set_compressed_size(data_size);
00838 result = quicktime_write_frame(fd,
00839 frame->get_data(),
00840 frame->get_compressed_size(),
00841 i);
00842 }
00843 else
00844 {
00845 eprintf("data_size=%d\n", data_size);
00846 }
00847 }
00848 else
00849 result = quicktime_write_frame(fd,
00850 frame->get_data(),
00851 frame->get_compressed_size(),
00852 i);
00853
00854
00855 }
00856 }
00857 else
00858 if(match4(asset->vcodec, QUICKTIME_YUV420) ||
00859 match4(asset->vcodec, QUICKTIME_2VUY) ||
00860 match4(asset->vcodec, QUICKTIME_YUV422) ||
00861 match4(asset->vcodec, QUICKTIME_RAW))
00862 {
00863
00864 default_compressor = 0;
00865 for(j = 0; j < len && !result; j++)
00866 {
00867 VFrame *frame = frames[i][j];
00868
00869 quicktime_set_cmodel(fd, frame->get_color_model());
00870 if(cmodel_is_planar(frame->get_color_model()))
00871 {
00872 unsigned char *planes[3];
00873 planes[0] = frame->get_y();
00874 planes[1] = frame->get_u();
00875 planes[2] = frame->get_v();
00876 result = quicktime_encode_video(fd, planes, i);
00877 }
00878 else
00879 {
00880 result = quicktime_encode_video(fd, frame->get_rows(), i);
00881
00882 }
00883
00884 }
00885 }
00886 else
00887 if(file->cpus > 1 &&
00888 (match4(asset->vcodec, QUICKTIME_JPEG) ||
00889 match4(asset->vcodec, QUICKTIME_MJPA)))
00890 {
00891 default_compressor = 0;
00892
00893 ThreadStruct *threadframe;
00894 int fields = match4(asset->vcodec, QUICKTIME_MJPA) ? 2 : 1;
00895
00896
00897 if(!threads)
00898 {
00899 threads = new FileMOVThread*[file->cpus];
00900 for(j = 0; j < file->cpus; j++)
00901 {
00902 threads[j] = new FileMOVThread(this, fields);
00903 threads[j]->start_encoding();
00904 }
00905 }
00906
00907
00908
00909
00910 while(threadframes.total < len)
00911 {
00912 threadframes.append(threadframe = new ThreadStruct);
00913 }
00914
00915
00916 for(j = 0; j < len; j++)
00917 {
00918 VFrame *frame = frames[i][j];
00919 threadframes.values[j]->input = frame;
00920 threadframes.values[j]->completion_lock->lock("FileMOV::write_frames 1");
00921 }
00922 total_threadframes = len;
00923 current_threadframe = 0;
00924
00925
00926 for(j = 0; j < file->cpus; j++)
00927 {
00928 threads[j]->encode_buffer();
00929 }
00930
00931
00932
00933 for(j = 0; j < len; j++)
00934 {
00935 threadframes.values[j]->completion_lock->lock("FileMOV::write_frames 1");
00936 threadframes.values[j]->completion_lock->unlock();
00937 if(!result)
00938 {
00939 result = quicktime_write_frame(fd,
00940 threadframes.values[j]->output,
00941 threadframes.values[j]->output_size,
00942 i);
00943 }
00944 }
00945 }
00946
00947 if(default_compressor)
00948 {
00949
00950
00951 for(j = 0; j < len && !result; j++)
00952 {
00953
00954 VFrame *frame = frames[i][j];
00955 quicktime_set_cmodel(fd, frame->get_color_model());
00956
00957 if(cmodel_is_planar(frame->get_color_model()))
00958 {
00959 unsigned char *planes[3];
00960 planes[0] = frame->get_y();
00961 planes[1] = frame->get_u();
00962 planes[2] = frame->get_v();
00963 result = quicktime_encode_video(fd, planes, i);
00964 }
00965 else
00966 {
00967 result = quicktime_encode_video(fd, frame->get_rows(), i);
00968 }
00969 }
00970 }
00971
00972 }
00973
00974
00975
00976 return result;
00977 }
00978
00979
00980
00981 int FileMOV::read_frame(VFrame *frame)
00982 {
00983 if(!fd) return 1;
00984 int result = 0;
00985
00986 switch(frame->get_color_model())
00987 {
00988 case BC_COMPRESSED:
00989 frame->allocate_compressed_data(quicktime_frame_size(fd, file->current_frame, file->current_layer));
00990 frame->set_compressed_size(quicktime_frame_size(fd, file->current_frame, file->current_layer));
00991 frame->set_keyframe((quicktime_get_keyframe_before(fd,
00992 file->current_frame,
00993 file->current_layer) == file->current_frame));
00994
00995 result = !quicktime_read_frame(fd,
00996 frame->get_data(),
00997 file->current_layer);
00998 break;
00999
01000
01001 case BC_YUV420P:
01002 case BC_YUV422P:
01003 {
01004 unsigned char *row_pointers[3];
01005 row_pointers[0] = frame->get_y();
01006 row_pointers[1] = frame->get_u();
01007 row_pointers[2] = frame->get_v();
01008
01009 quicktime_set_cmodel(fd, frame->get_color_model());
01010 result = quicktime_decode_video(fd,
01011 row_pointers,
01012 file->current_layer);
01013 }
01014 break;
01015
01016
01017 default:
01018 quicktime_set_cmodel(fd, frame->get_color_model());
01019 result = quicktime_decode_video(fd,
01020 frame->get_rows(),
01021 file->current_layer);
01022
01023 break;
01024 }
01025 if (result)
01026 {
01027 eprintf("quicktime_read_frame/quicktime_decode_video failed, result:\n");
01028 }
01029
01030
01031
01032 return result;
01033 }
01034
01035
01036
01037 int64_t FileMOV::compressed_frame_size()
01038 {
01039 if(!fd) return 0;
01040 return quicktime_frame_size(fd, file->current_frame, file->current_layer);
01041 }
01042
01043 int FileMOV::read_compressed_frame(VFrame *buffer)
01044 {
01045 int64_t result;
01046 if(!fd) return 0;
01047
01048 result = quicktime_read_frame(fd, buffer->get_data(), file->current_layer);
01049 buffer->set_compressed_size(result);
01050 buffer->set_keyframe((quicktime_get_keyframe_before(fd,
01051 file->current_frame,
01052 file->current_layer) == file->current_frame));
01053 result = !result;
01054 return result;
01055 }
01056
01057 int FileMOV::write_compressed_frame(VFrame *buffer)
01058 {
01059 int result = 0;
01060 if(!fd) return 0;
01061
01062 result = quicktime_write_frame(fd,
01063 buffer->get_data(),
01064 buffer->get_compressed_size(),
01065 file->current_layer);
01066 return result;
01067 }
01068
01069
01070
01071 int FileMOV::read_raw(VFrame *frame,
01072 float in_x1, float in_y1, float in_x2, float in_y2,
01073 float out_x1, float out_y1, float out_x2, float out_y2,
01074 int use_float, int interpolate)
01075 {
01076 int64_t i, color_channels, result = 0;
01077 if(!fd) return 0;
01078
01079 quicktime_set_video_position(fd, file->current_frame, file->current_layer);
01080
01081 switch(frame->get_color_model())
01082 {
01083 case BC_RGB888:
01084 result = quicktime_decode_video(fd, frame->get_rows(), file->current_layer);
01085 break;
01086 case BC_RGBA8888:
01087 break;
01088 case BC_RGB161616:
01089 break;
01090 case BC_RGBA16161616:
01091 break;
01092 case BC_YUV888:
01093 break;
01094 case BC_YUVA8888:
01095 break;
01096 case BC_YUV161616:
01097 break;
01098 case BC_YUVA16161616:
01099 break;
01100 case BC_YUV420P:
01101 break;
01102 }
01103 return result;
01104 }
01105
01106
01107 int FileMOV::read_samples(double *buffer, int64_t len)
01108 {
01109 int qt_track, qt_channel;
01110
01111 if(!fd) return 0;
01112
01113 if(quicktime_track_channels(fd, 0) > file->current_channel &&
01114 quicktime_supported_audio(fd, 0))
01115 {
01116
01117
01118 new_audio_temp(len);
01119
01120
01121 if(quicktime_decode_audio(fd, 0, temp_float[0], len, file->current_channel))
01122 {
01123 eprintf("quicktime_decode_audio failed\n");
01124 return 1;
01125 }
01126 else
01127 {
01128 for(int i = 0; i < len; i++) buffer[i] = temp_float[0][i];
01129 }
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139 }
01140
01141 return 0;
01142 }
01143
01144
01145 char* FileMOV::strtocompression(char *string)
01146 {
01147 if(!strcasecmp(string, _(DIVX_NAME))) return QUICKTIME_DIVX;
01148 if(!strcasecmp(string, _(H264_NAME))) return QUICKTIME_H264;
01149 if(!strcasecmp(string, _(HV64_NAME))) return QUICKTIME_HV64;
01150 if(!strcasecmp(string, _(MP4V_NAME))) return QUICKTIME_MP4V;
01151 if(!strcasecmp(string, _(H263_NAME))) return QUICKTIME_H263;
01152 if(!strcasecmp(string, _(HV60_NAME))) return QUICKTIME_HV60;
01153 if(!strcasecmp(string, _(DIV3_NAME))) return QUICKTIME_DIV3;
01154
01155
01156
01157 if(!strcasecmp(string, _(DV_NAME))) return QUICKTIME_DV;
01158 if(!strcasecmp(string, _(PNG_NAME))) return QUICKTIME_PNG;
01159 if(!strcasecmp(string, _(PNGA_NAME))) return MOV_PNGA;
01160 if(!strcasecmp(string, _(RGB_NAME))) return QUICKTIME_RAW;
01161 if(!strcasecmp(string, _(RGBA_NAME))) return MOV_RGBA;
01162 if(!strcasecmp(string, _(QTJPEG_NAME))) return QUICKTIME_JPEG;
01163 if(!strcasecmp(string, _(MJPA_NAME))) return QUICKTIME_MJPA;
01164 if(!strcasecmp(string, _(YUV420_NAME))) return QUICKTIME_YUV420;
01165 if(!strcasecmp(string, _(YUV411_NAME))) return QUICKTIME_YUV411;
01166 if(!strcasecmp(string, _(YUV422_NAME))) return QUICKTIME_YUV422;
01167 if(!strcasecmp(string, _(TWOVUY_NAME))) return QUICKTIME_2VUY;
01168 if(!strcasecmp(string, _(YUV444_NAME))) return QUICKTIME_YUV444;
01169 if(!strcasecmp(string, _(YUVA4444_NAME))) return QUICKTIME_YUVA4444;
01170 if(!strcasecmp(string, _(YUV444_10BIT_NAME))) return QUICKTIME_YUV444_10bit;
01171
01172 if(!strcasecmp(string, _(TWOS_NAME))) return QUICKTIME_TWOS;
01173 if(!strcasecmp(string, _(RAW_NAME))) return QUICKTIME_RAW;
01174 if(!strcasecmp(string, _(IMA4_NAME))) return QUICKTIME_IMA4;
01175 if(!strcasecmp(string, _(ULAW_NAME))) return QUICKTIME_ULAW;
01176 if(!strcasecmp(string, _(MP3_NAME))) return QUICKTIME_MP3;
01177 if(!strcasecmp(string, _(MP4A_NAME))) return QUICKTIME_MP4A;
01178 if(!strcasecmp(string, _(VORBIS_NAME))) return QUICKTIME_VORBIS;
01179
01180
01181
01182 return QUICKTIME_RAW;
01183 }
01184
01185 char* FileMOV::compressiontostr(char *string)
01186 {
01187 if(match4(string, QUICKTIME_H263)) return _(H263_NAME);
01188 if(match4(string, QUICKTIME_H264)) return _(H264_NAME);
01189 if(match4(string, QUICKTIME_HV64)) return _(HV64_NAME);
01190 if(match4(string, QUICKTIME_DIVX)) return _(DIVX_NAME);
01191 if(match4(string, QUICKTIME_MP4V)) return _(MP4V_NAME);
01192 if(match4(string, QUICKTIME_HV60)) return _(HV60_NAME);
01193 if(match4(string, QUICKTIME_DIV3)) return _(DIV3_NAME);
01194 if(match4(string, QUICKTIME_DV)) return _(DV_NAME);
01195 if(match4(string, QUICKTIME_DVCP)) return _(DV_NAME);
01196 if(match4(string, QUICKTIME_DVSD)) return _(DV_NAME);
01197 if(match4(string, MOV_PNGA)) return _(PNGA_NAME);
01198 if(match4(string, QUICKTIME_RAW)) return _(RGB_NAME);
01199 if(match4(string, MOV_RGBA)) return _(RGBA_NAME);
01200 if(match4(string, QUICKTIME_JPEG)) return _(QTJPEG_NAME);
01201 if(match4(string, QUICKTIME_MJPA)) return _(MJPA_NAME);
01202 if(match4(string, QUICKTIME_YUV420)) return _(YUV420_NAME);
01203 if(match4(string, QUICKTIME_YUV411)) return _(YUV411_NAME);
01204 if(match4(string, QUICKTIME_YUV422)) return _(YUV422_NAME);
01205 if(match4(string, QUICKTIME_2VUY)) return _(TWOVUY_NAME);
01206 if(match4(string, QUICKTIME_YUV444)) return _(YUV444_NAME);
01207 if(match4(string, QUICKTIME_YUVA4444)) return _(YUVA4444_NAME);
01208 if(match4(string, QUICKTIME_YUV444_10bit)) return _(YUV444_10BIT_NAME);
01209
01210
01211
01212
01213
01214 if(match4(string, QUICKTIME_TWOS)) return _(TWOS_NAME);
01215 if(match4(string, QUICKTIME_RAW)) return _(RAW_NAME);
01216 if(match4(string, QUICKTIME_IMA4)) return _(IMA4_NAME);
01217 if(match4(string, QUICKTIME_ULAW)) return _(ULAW_NAME);
01218 if(match4(string, QUICKTIME_MP3)) return _(MP3_NAME);
01219 if(match4(string, QUICKTIME_MP4A)) return _(MP4A_NAME);
01220 if(match4(string, QUICKTIME_VORBIS)) return _(VORBIS_NAME);
01221
01222
01223
01224 return _("Unknown");
01225 }
01226
01227
01228
01229
01230
01231 ThreadStruct::ThreadStruct()
01232 {
01233 input = 0;
01234 output = 0;
01235 output_allocated = 0;
01236 output_size = 0;
01237 completion_lock = new Condition(1, "ThreadStruct::completion_lock");
01238 }
01239
01240 ThreadStruct::~ThreadStruct()
01241 {
01242 if(output) delete [] output;
01243 delete completion_lock;
01244 }
01245
01246 void ThreadStruct::load_output(mjpeg_t *mjpeg)
01247 {
01248 if(output_allocated < mjpeg_output_size(mjpeg))
01249 {
01250 delete [] output;
01251 output = 0;
01252 }
01253 if(!output)
01254 {
01255 output_allocated = mjpeg_output_size(mjpeg);
01256 output = new unsigned char[output_allocated];
01257 }
01258
01259 output_size = mjpeg_output_size(mjpeg);
01260 memcpy(output, mjpeg_output_buffer(mjpeg), output_size);
01261 }
01262
01263
01264 FileMOVThread::FileMOVThread(FileMOV *filemov, int fields) : Thread()
01265 {
01266 this->filemov = filemov;
01267 this->fields = fields;
01268 mjpeg = 0;
01269 input_lock = new Condition(1, "FileMOVThread::input_lock");
01270 }
01271
01272 FileMOVThread::~FileMOVThread()
01273 {
01274 delete input_lock;
01275 }
01276
01277 int FileMOVThread::start_encoding()
01278 {
01279 mjpeg = mjpeg_new(filemov->asset->width,
01280 filemov->asset->height,
01281 fields);
01282 mjpeg_set_quality(mjpeg, filemov->asset->jpeg_quality);
01283 mjpeg_set_float(mjpeg, 0);
01284 done = 0;
01285 set_synchronous(1);
01286 input_lock->lock("FileMOVThread::start_encoding");
01287 start();
01288 }
01289
01290 int FileMOVThread::stop_encoding()
01291 {
01292 done = 1;
01293 input_lock->unlock();
01294 join();
01295 if(mjpeg) mjpeg_delete(mjpeg);
01296 }
01297
01298 int FileMOVThread::encode_buffer()
01299 {
01300 input_lock->unlock();
01301 }
01302
01303 void FileMOVThread::run()
01304 {
01305 while(!done)
01306 {
01307 input_lock->lock("FileMOVThread::run");
01308
01309 if(!done)
01310 {
01311
01312 filemov->threadframe_lock->lock("FileMOVThread::stop_encoding");
01313 if(filemov->current_threadframe < filemov->total_threadframes)
01314 {
01315
01316 input_lock->unlock();
01317 threadframe = filemov->threadframes.values[filemov->current_threadframe];
01318 VFrame *frame = threadframe->input;
01319
01320 filemov->current_threadframe++;
01321 filemov->threadframe_lock->unlock();
01322
01323 mjpeg_compress(mjpeg,
01324 frame->get_rows(),
01325 frame->get_y(),
01326 frame->get_u(),
01327 frame->get_v(),
01328 frame->get_color_model(),
01329 1);
01330
01331 if(fields > 1)
01332 {
01333 unsigned char *data = mjpeg_output_buffer(mjpeg);
01334 long data_size = mjpeg_output_size(mjpeg);
01335 long data_allocated = mjpeg_output_allocated(mjpeg);
01336 long field2_offset;
01337
01338 if(filemov->asset->format == FILE_MOV)
01339 {
01340 mjpeg_insert_quicktime_markers(&data,
01341 &data_size,
01342 &data_allocated,
01343 2,
01344 &field2_offset);
01345 }
01346 else
01347 {
01348 mjpeg_insert_avi_markers(&data,
01349 &data_size,
01350 &data_allocated,
01351 2,
01352 &field2_offset);
01353 }
01354 mjpeg_set_output_size(mjpeg, data_size);
01355 }
01356 threadframe->load_output(mjpeg);
01357 threadframe->completion_lock->unlock();
01358 }
01359 else
01360 filemov->threadframe_lock->unlock();
01361 }
01362 }
01363 }
01364
01365
01366
01367
01368
01369
01370 MOVConfigAudio::MOVConfigAudio(BC_WindowBase *parent_window, Asset *asset)
01371 : BC_Window(PROGRAM_NAME ": Audio Compression",
01372 parent_window->get_abs_cursor_x(1),
01373 parent_window->get_abs_cursor_y(1),
01374 350,
01375 250)
01376 {
01377 this->parent_window = parent_window;
01378 this->asset = asset;
01379 compression_popup = 0;
01380 reset();
01381 }
01382
01383 MOVConfigAudio::~MOVConfigAudio()
01384 {
01385 if(compression_popup) delete compression_popup;
01386 if(bits_popup) delete bits_popup;
01387 compression_items.remove_all_objects();
01388 }
01389
01390
01391 void MOVConfigAudio::reset()
01392 {
01393 bits_popup = 0;
01394 bits_title = 0;
01395 dither = 0;
01396 vorbis_min_bitrate = 0;
01397 vorbis_bitrate = 0;
01398 vorbis_max_bitrate = 0;
01399 vorbis_vbr = 0;
01400 mp3_bitrate = 0;
01401 mp4a_bitrate = 0;
01402 mp4a_quantqual = 0;
01403 }
01404
01405 int MOVConfigAudio::create_objects()
01406 {
01407 int x = 10, y = 10;
01408
01409
01410 if(asset->format == FILE_MOV)
01411 {
01412 compression_items.append(new BC_ListBoxItem(_(TWOS_NAME)));
01413 compression_items.append(new BC_ListBoxItem(_(RAW_NAME)));
01414 compression_items.append(new BC_ListBoxItem(_(IMA4_NAME)));
01415 compression_items.append(new BC_ListBoxItem(_(MP3_NAME)));
01416 compression_items.append(new BC_ListBoxItem(_(ULAW_NAME)));
01417 compression_items.append(new BC_ListBoxItem(_(VORBIS_NAME)));
01418 compression_items.append(new BC_ListBoxItem(_(MP4A_NAME)));
01419 }
01420 else
01421 {
01422 compression_items.append(new BC_ListBoxItem(_(TWOS_NAME)));
01423 compression_items.append(new BC_ListBoxItem(_(MP3_NAME)));
01424 compression_items.append(new BC_ListBoxItem(_(VORBIS_NAME)));
01425 compression_items.append(new BC_ListBoxItem(_(MP4A_NAME)));
01426 }
01427
01428 add_tool(new BC_Title(x, y, _("Compression:")));
01429 y += 25;
01430 compression_popup = new MOVConfigAudioPopup(this, x, y);
01431 compression_popup->create_objects();
01432
01433 update_parameters();
01434
01435 add_subwindow(new BC_OKButton(this));
01436 return 0;
01437 }
01438
01439 void MOVConfigAudio::update_parameters()
01440 {
01441 int x = 10, y = 70;
01442 if(bits_title) delete bits_title;
01443 if(bits_popup) delete bits_popup;
01444 if(dither) delete dither;
01445 if(vorbis_min_bitrate) delete vorbis_min_bitrate;
01446 if(vorbis_bitrate) delete vorbis_bitrate;
01447 if(vorbis_max_bitrate) delete vorbis_max_bitrate;
01448 if(vorbis_vbr) delete vorbis_vbr;
01449 if(mp3_bitrate) delete mp3_bitrate;
01450 delete mp4a_bitrate;
01451 delete mp4a_quantqual;
01452
01453 reset();
01454
01455
01456
01457 if(!strcasecmp(asset->acodec, QUICKTIME_TWOS) ||
01458 !strcasecmp(asset->acodec, QUICKTIME_RAW))
01459 {
01460 add_subwindow(bits_title = new BC_Title(x, y, _("Bits per channel:")));
01461 bits_popup = new BitsPopup(this,
01462 x + 150,
01463 y,
01464 &asset->bits,
01465 0,
01466 0,
01467 0,
01468 0,
01469 0);
01470 bits_popup->create_objects();
01471 y += 40;
01472 add_subwindow(dither = new BC_CheckBox(x, y, &asset->dither, _("Dither")));
01473 }
01474 else
01475 if(!strcasecmp(asset->acodec, QUICKTIME_IMA4))
01476 {
01477 }
01478 else
01479 if(!strcasecmp(asset->acodec, QUICKTIME_MP3))
01480 {
01481 mp3_bitrate = new MOVConfigAudioNum(this,
01482 _("Bitrate:"),
01483 x,
01484 y,
01485 &asset->mp3_bitrate);
01486 mp3_bitrate->set_increment(1000);
01487 mp3_bitrate->create_objects();
01488 }
01489 else
01490 if(!strcasecmp(asset->acodec, QUICKTIME_ULAW))
01491 {
01492 }
01493 else
01494 if(!strcasecmp(asset->acodec, QUICKTIME_VORBIS))
01495 {
01496 add_subwindow(vorbis_vbr = new MOVConfigAudioToggle(this,
01497 _("Variable bitrate"),
01498 x,
01499 y,
01500 &asset->vorbis_vbr));
01501 y += 35;
01502 vorbis_min_bitrate = new MOVConfigAudioNum(this,
01503 _("Min bitrate:"),
01504 x,
01505 y,
01506 &asset->vorbis_min_bitrate);
01507 vorbis_min_bitrate->set_increment(1000);
01508 y += 30;
01509 vorbis_bitrate = new MOVConfigAudioNum(this,
01510 _("Avg bitrate:"),
01511 x,
01512 y,
01513 &asset->vorbis_bitrate);
01514 vorbis_bitrate->set_increment(1000);
01515 y += 30;
01516 vorbis_max_bitrate = new MOVConfigAudioNum(this,
01517 _("Max bitrate:"),
01518 x,
01519 y,
01520 &asset->vorbis_max_bitrate);
01521 vorbis_max_bitrate->set_increment(1000);
01522
01523
01524
01525 vorbis_min_bitrate->create_objects();
01526 vorbis_bitrate->create_objects();
01527 vorbis_max_bitrate->create_objects();
01528 }
01529 else
01530 if(!strcasecmp(asset->acodec, QUICKTIME_MP4A))
01531 {
01532 mp4a_bitrate = new MOVConfigAudioNum(this,
01533 _("Bitrate:"),
01534 x,
01535 y,
01536 &asset->mp4a_bitrate);
01537 mp4a_bitrate->set_increment(1000);
01538 mp4a_bitrate->create_objects();
01539
01540 y += 30;
01541 mp4a_quantqual = new MOVConfigAudioNum(this,
01542 _("Quantization Quality (%):"),
01543 x,
01544 y,
01545 &asset->mp4a_quantqual);
01546 mp4a_quantqual->set_increment(1);
01547 mp4a_quantqual->create_objects();
01548 }
01549 }
01550
01551 int MOVConfigAudio::close_event()
01552 {
01553 set_done(0);
01554 return 1;
01555 }
01556
01557
01558
01559
01560
01561 MOVConfigAudioToggle::MOVConfigAudioToggle(MOVConfigAudio *popup,
01562 char *title_text,
01563 int x,
01564 int y,
01565 int *output)
01566 : BC_CheckBox(x, y, *output, title_text)
01567 {
01568 this->popup = popup;
01569 this->output = output;
01570 }
01571 int MOVConfigAudioToggle::handle_event()
01572 {
01573 *output = get_value();
01574 return 1;
01575 }
01576
01577
01578
01579
01580
01581 MOVConfigAudioNum::MOVConfigAudioNum(MOVConfigAudio *popup, char *title_text, int x, int y, int *output)
01582 : BC_TumbleTextBox(popup,
01583 (int64_t)*output,
01584 (int64_t)-1,
01585 (int64_t)25000000,
01586 popup->get_w() - 150,
01587 y,
01588 100)
01589 {
01590 this->popup = popup;
01591 this->title_text = title_text;
01592 this->output = output;
01593 this->x = x;
01594 this->y = y;
01595 }
01596
01597 MOVConfigAudioNum::~MOVConfigAudioNum()
01598 {
01599 if(!popup->get_deleting()) delete title;
01600 }
01601
01602 void MOVConfigAudioNum::create_objects()
01603 {
01604 popup->add_subwindow(title = new BC_Title(x, y, title_text));
01605 BC_TumbleTextBox::create_objects();
01606 }
01607
01608 int MOVConfigAudioNum::handle_event()
01609 {
01610 *output = atol(get_text());
01611 return 1;
01612 }
01613
01614
01615
01616
01617
01618
01619
01620
01621 MOVConfigAudioPopup::MOVConfigAudioPopup(MOVConfigAudio *popup, int x, int y)
01622 : BC_PopupTextBox(popup,
01623 &popup->compression_items,
01624 FileMOV::compressiontostr(popup->asset->acodec),
01625 x,
01626 y,
01627 300,
01628 300)
01629 {
01630 this->popup = popup;
01631 }
01632
01633 int MOVConfigAudioPopup::handle_event()
01634 {
01635 strcpy(popup->asset->acodec, FileMOV::strtocompression(get_text()));
01636 popup->update_parameters();
01637 return 1;
01638 }
01639
01640
01641
01642
01643
01644
01645
01646
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656 MOVConfigVideo::MOVConfigVideo(BC_WindowBase *parent_window,
01657 Asset *asset,
01658 char *locked_compressor)
01659 : BC_Window(PROGRAM_NAME ": Video Compression",
01660 parent_window->get_abs_cursor_x(1),
01661 parent_window->get_abs_cursor_y(1),
01662 420,
01663 420)
01664 {
01665 this->parent_window = parent_window;
01666 this->asset = asset;
01667 this->locked_compressor = locked_compressor;
01668 compression_popup = 0;
01669
01670 reset();
01671 }
01672
01673 MOVConfigVideo::~MOVConfigVideo()
01674 {
01675 if(compression_popup) delete compression_popup;
01676 compression_items.remove_all_objects();
01677 }
01678
01679 int MOVConfigVideo::create_objects()
01680 {
01681 int x = 10, y = 10;
01682
01683 if(asset->format == FILE_MOV)
01684 {
01685 compression_items.append(new BC_ListBoxItem(_(H264_NAME)));
01686 compression_items.append(new BC_ListBoxItem(_(HV64_NAME)));
01687
01688 compression_items.append(new BC_ListBoxItem(_(MP4V_NAME)));
01689 compression_items.append(new BC_ListBoxItem(_(HV60_NAME)));
01690 compression_items.append(new BC_ListBoxItem(_(DIV3_NAME)));
01691 compression_items.append(new BC_ListBoxItem(_(DV_NAME)));
01692 compression_items.append(new BC_ListBoxItem(_(QTJPEG_NAME)));
01693 compression_items.append(new BC_ListBoxItem(_(MJPA_NAME)));
01694 compression_items.append(new BC_ListBoxItem(_(PNG_NAME)));
01695 compression_items.append(new BC_ListBoxItem(_(PNGA_NAME)));
01696 compression_items.append(new BC_ListBoxItem(_(RGB_NAME)));
01697 compression_items.append(new BC_ListBoxItem(_(RGBA_NAME)));
01698 compression_items.append(new BC_ListBoxItem(_(YUV420_NAME)));
01699 compression_items.append(new BC_ListBoxItem(_(YUV422_NAME)));
01700 compression_items.append(new BC_ListBoxItem(_(TWOVUY_NAME)));
01701 compression_items.append(new BC_ListBoxItem(_(YUV444_NAME)));
01702 compression_items.append(new BC_ListBoxItem(_(YUVA4444_NAME)));
01703 compression_items.append(new BC_ListBoxItem(_(YUV444_10BIT_NAME)));
01704 }
01705 else
01706 {
01707 compression_items.append(new BC_ListBoxItem(_(H264_NAME)));
01708 compression_items.append(new BC_ListBoxItem(_(HV64_NAME)));
01709
01710 compression_items.append(new BC_ListBoxItem(_(MP4V_NAME)));
01711 compression_items.append(new BC_ListBoxItem(_(HV60_NAME)));
01712 compression_items.append(new BC_ListBoxItem(_(DIV3_NAME)));
01713 compression_items.append(new BC_ListBoxItem(_(DV_NAME)));
01714 compression_items.append(new BC_ListBoxItem(_(QTJPEG_NAME)));
01715 compression_items.append(new BC_ListBoxItem(_(MJPA_NAME)));
01716 compression_items.append(new BC_ListBoxItem(_(PNG_NAME)));
01717 }
01718
01719 add_subwindow(new BC_Title(x, y, _("Compression:")));
01720 y += 25;
01721
01722 if(!locked_compressor)
01723 {
01724 compression_popup = new MOVConfigVideoPopup(this, x, y);
01725 compression_popup->create_objects();
01726 }
01727 else
01728 {
01729 add_subwindow(new BC_Title(x,
01730 y,
01731 FileMOV::compressiontostr(locked_compressor),
01732 MEDIUMFONT,
01733 RED,
01734 0));
01735 }
01736 y += 40;
01737
01738 param_x = x;
01739 param_y = y;
01740 update_parameters();
01741
01742 add_subwindow(new BC_OKButton(this));
01743 return 0;
01744 }
01745
01746 int MOVConfigVideo::close_event()
01747 {
01748 set_done(0);
01749 return 1;
01750 }
01751
01752
01753 void MOVConfigVideo::reset()
01754 {
01755 jpeg_quality = 0;
01756 jpeg_quality_title = 0;
01757
01758 divx_bitrate = 0;
01759 divx_rc_period = 0;
01760 divx_rc_reaction_ratio = 0;
01761 divx_rc_reaction_period = 0;
01762 divx_max_key_interval = 0;
01763 divx_max_quantizer = 0;
01764 divx_min_quantizer = 0;
01765 divx_quantizer = 0;
01766 divx_quality = 0;
01767 divx_fix_bitrate = 0;
01768 divx_fix_quant = 0;
01769
01770 h264_bitrate = 0;
01771 h264_quantizer = 0;
01772 h264_fix_bitrate = 0;
01773 h264_fix_quant = 0;
01774
01775 ms_bitrate = 0;
01776 ms_bitrate_tolerance = 0;
01777 ms_quantization = 0;
01778 ms_interlaced = 0;
01779 ms_gop_size = 0;
01780 ms_fix_bitrate = 0;
01781 ms_fix_quant = 0;
01782 }
01783
01784 void MOVConfigVideo::update_parameters()
01785 {
01786 if(jpeg_quality)
01787 {
01788 delete jpeg_quality_title;
01789 delete jpeg_quality;
01790 }
01791
01792 if(divx_bitrate) delete divx_bitrate;
01793 if(divx_rc_period) delete divx_rc_period;
01794 if(divx_rc_reaction_ratio) delete divx_rc_reaction_ratio;
01795 if(divx_rc_reaction_period) delete divx_rc_reaction_period;
01796 if(divx_max_key_interval) delete divx_max_key_interval;
01797 if(divx_max_quantizer) delete divx_max_quantizer;
01798 if(divx_min_quantizer) delete divx_min_quantizer;
01799 if(divx_quantizer) delete divx_quantizer;
01800 if(divx_quality) delete divx_quality;
01801 if(divx_fix_quant) delete divx_fix_quant;
01802 if(divx_fix_bitrate) delete divx_fix_bitrate;
01803
01804 if(ms_bitrate) delete ms_bitrate;
01805 if(ms_bitrate_tolerance) delete ms_bitrate_tolerance;
01806 if(ms_interlaced) delete ms_interlaced;
01807 if(ms_quantization) delete ms_quantization;
01808 if(ms_gop_size) delete ms_gop_size;
01809 if(ms_fix_bitrate) delete ms_fix_bitrate;
01810 if(ms_fix_quant) delete ms_fix_quant;
01811
01812 delete h264_bitrate;
01813 delete h264_quantizer;
01814 delete h264_fix_bitrate;
01815 delete h264_fix_quant;
01816
01817 reset();
01818
01819
01820 char *vcodec = asset->vcodec;
01821 if(locked_compressor) vcodec = locked_compressor;
01822
01823
01824
01825 if(!strcmp(vcodec, QUICKTIME_H264) ||
01826 !strcmp(vcodec, QUICKTIME_HV64))
01827 {
01828 int x = param_x, y = param_y;
01829 h264_bitrate = new MOVConfigVideoNum(this,
01830 _("Bitrate:"),
01831 x,
01832 y,
01833 &asset->h264_bitrate);
01834 h264_bitrate->set_increment(1000000);
01835 h264_bitrate->create_objects();
01836 add_subwindow(h264_fix_bitrate = new MOVConfigVideoFixBitrate(x + 260,
01837 y,
01838 &asset->h264_fix_bitrate,
01839 1));
01840 y += 30;
01841 h264_quantizer = new MOVConfigVideoNum(this,
01842 _("Quantization:"),
01843 x,
01844 y,
01845 0,
01846 51,
01847 &asset->h264_quantizer);
01848 h264_quantizer->create_objects();
01849 add_subwindow(h264_fix_quant = new MOVConfigVideoFixQuant(x + 260,
01850 y,
01851 &asset->h264_fix_bitrate,
01852 0));
01853 h264_fix_bitrate->opposite = h264_fix_quant;
01854 h264_fix_quant->opposite = h264_fix_bitrate;
01855 }
01856 else
01857
01858 if(!strcmp(vcodec, QUICKTIME_MP4V) ||
01859 !strcmp(vcodec, QUICKTIME_DIV3))
01860 {
01861 int x = param_x, y = param_y;
01862 ms_bitrate = new MOVConfigVideoNum(this,
01863 _("Bitrate:"),
01864 x,
01865 y,
01866 &asset->ms_bitrate);
01867 ms_bitrate->set_increment(1000000);
01868 ms_bitrate->create_objects();
01869 add_subwindow(ms_fix_bitrate = new MOVConfigVideoFixBitrate(x + 260,
01870 y,
01871 &asset->ms_fix_bitrate,
01872 1));
01873 y += 30;
01874
01875 ms_bitrate_tolerance = new MOVConfigVideoNum(this,
01876 _("Bitrate tolerance:"),
01877 x,
01878 y,
01879 &asset->ms_bitrate_tolerance);
01880 ms_bitrate_tolerance->create_objects();
01881 y += 30;
01882 ms_quantization = new MOVConfigVideoNum(this,
01883 _("Quantization:"),
01884 x,
01885 y,
01886 &asset->ms_quantization);
01887 ms_quantization->create_objects();
01888 add_subwindow(ms_fix_quant = new MOVConfigVideoFixQuant(x + 260,
01889 y,
01890 &asset->ms_fix_bitrate,
01891 0));
01892 ms_fix_bitrate->opposite = ms_fix_quant;
01893 ms_fix_quant->opposite = ms_fix_bitrate;
01894
01895
01896 y += 30;
01897 add_subwindow(ms_interlaced = new MOVConfigVideoCheckBox(_("Interlaced"),
01898 x,
01899 y,
01900 &asset->ms_interlaced));
01901 y += 30;
01902 ms_gop_size = new MOVConfigVideoNum(this,
01903 _("Keyframe interval:"),
01904 x,
01905 y,
01906 &asset->ms_gop_size);
01907 ms_gop_size->create_objects();
01908 }
01909 else
01910
01911 if(!strcmp(vcodec, QUICKTIME_DIVX) ||
01912 !strcmp(vcodec, QUICKTIME_H263) ||
01913 !strcmp(vcodec, QUICKTIME_HV60))
01914 {
01915 int x = param_x, y = param_y;
01916 divx_bitrate = new MOVConfigVideoNum(this,
01917 _("Bitrate:"),
01918 x,
01919 y,
01920 &asset->divx_bitrate);
01921 divx_bitrate->set_increment(1000000);
01922 divx_bitrate->create_objects();
01923 add_subwindow(divx_fix_bitrate =
01924 new MOVConfigVideoFixBitrate(x + 260,
01925 y,
01926 &asset->divx_fix_bitrate,
01927 1));
01928 y += 30;
01929 divx_quantizer = new MOVConfigVideoNum(this,
01930 _("Quantizer:"),
01931 x,
01932 y,
01933 &asset->divx_quantizer);
01934 divx_quantizer->create_objects();
01935 add_subwindow(divx_fix_quant =
01936 new MOVConfigVideoFixQuant(x + 260,
01937 y,
01938 &asset->divx_fix_bitrate,
01939 0));
01940 divx_fix_quant->opposite = divx_fix_bitrate;
01941 divx_fix_bitrate->opposite = divx_fix_quant;
01942 y += 30;
01943 divx_rc_period = new MOVConfigVideoNum(this,
01944 _("RC Period:"),
01945 x,
01946 y,
01947 &asset->divx_rc_period);
01948 divx_rc_period->create_objects();
01949 y += 30;
01950 divx_rc_reaction_ratio = new MOVConfigVideoNum(this,
01951 _("Reaction Ratio:"),
01952 x,
01953 y,
01954 &asset->divx_rc_reaction_ratio);
01955 divx_rc_reaction_ratio->create_objects();
01956 y += 30;
01957 divx_rc_reaction_period = new MOVConfigVideoNum(this,
01958 _("Reaction Period:"),
01959 x,
01960 y,
01961 &asset->divx_rc_reaction_period);
01962 divx_rc_reaction_period->create_objects();
01963 y += 30;
01964 divx_max_key_interval = new MOVConfigVideoNum(this,
01965 _("Max Key Interval:"),
01966 x,
01967 y,
01968 &asset->divx_max_key_interval);
01969 divx_max_key_interval->create_objects();
01970 y += 30;
01971 divx_max_quantizer = new MOVConfigVideoNum(this,
01972 _("Max Quantizer:"),
01973 x,
01974 y,
01975 &asset->divx_max_quantizer);
01976 divx_max_quantizer->create_objects();
01977 y += 30;
01978 divx_min_quantizer = new MOVConfigVideoNum(this,
01979 _("Min Quantizer:"),
01980 x,
01981 y,
01982 &asset->divx_min_quantizer);
01983 divx_min_quantizer->create_objects();
01984 y += 30;
01985 divx_quality = new MOVConfigVideoNum(this,
01986 _("Quality:"),
01987 x,
01988 y,
01989 &asset->divx_quality);
01990 divx_quality->create_objects();
01991 }
01992 else
01993 if(!strcmp(vcodec, QUICKTIME_JPEG) ||
01994 !strcmp(vcodec, QUICKTIME_MJPA))
01995 {
01996 add_subwindow(jpeg_quality_title = new BC_Title(param_x, param_y, _("Quality:")));
01997 add_subwindow(jpeg_quality = new BC_ISlider(param_x + 80,
01998 param_y,
01999 0,
02000 200,
02001 200,
02002 0,
02003 100,
02004 asset->jpeg_quality,
02005 0,
02006 0,
02007 &asset->jpeg_quality));
02008 }
02009 }
02010
02011
02012
02013
02014
02015 MOVConfigVideoNum::MOVConfigVideoNum(MOVConfigVideo *popup, char *title_text, int x, int y, int *output)
02016 : BC_TumbleTextBox(popup,
02017 (int64_t)*output,
02018 (int64_t)1,
02019 (int64_t)25000000,
02020 x + 130,
02021 y,
02022 100)
02023 {
02024 this->popup = popup;
02025 this->title_text = title_text;
02026 this->output = output;
02027 this->x = x;
02028 this->y = y;
02029 }
02030
02031 MOVConfigVideoNum::MOVConfigVideoNum(MOVConfigVideo *popup,
02032 char *title_text,
02033 int x,
02034 int y,
02035 int min,
02036 int max,
02037 int *output)
02038 : BC_TumbleTextBox(popup,
02039 (int64_t)*output,
02040 (int64_t)min,
02041 (int64_t)max,
02042 x + 130,
02043 y,
02044 100)
02045 {
02046 this->popup = popup;
02047 this->title_text = title_text;
02048 this->output = output;
02049 this->x = x;
02050 this->y = y;
02051 }
02052
02053 MOVConfigVideoNum::~MOVConfigVideoNum()
02054 {
02055 if(!popup->get_deleting()) delete title;
02056 }
02057
02058 void MOVConfigVideoNum::create_objects()
02059 {
02060 popup->add_subwindow(title = new BC_Title(x, y, title_text));
02061 BC_TumbleTextBox::create_objects();
02062 }
02063
02064 int MOVConfigVideoNum::handle_event()
02065 {
02066 *output = atol(get_text());
02067 return 1;
02068 }
02069
02070
02071
02072
02073
02074
02075
02076 MOVConfigVideoCheckBox::MOVConfigVideoCheckBox(char *title_text, int x, int y, int *output)
02077 : BC_CheckBox(x, y, *output, title_text)
02078 {
02079 this->output = output;
02080 }
02081
02082 int MOVConfigVideoCheckBox::handle_event()
02083 {
02084 *output = get_value();
02085 return 1;
02086 }
02087
02088
02089
02090
02091
02092
02093 MOVConfigVideoFixBitrate::MOVConfigVideoFixBitrate(int x,
02094 int y,
02095 int *output,
02096 int value)
02097 : BC_Radial(x,
02098 y,
02099 *output == value,
02100 _("Fix bitrate"))
02101 {
02102 this->output = output;
02103 this->value = value;
02104 }
02105
02106 int MOVConfigVideoFixBitrate::handle_event()
02107 {
02108 *output = value;
02109 opposite->update(0);
02110 return 1;
02111 }
02112
02113
02114
02115
02116
02117
02118 MOVConfigVideoFixQuant::MOVConfigVideoFixQuant(int x,
02119 int y,
02120 int *output,
02121 int value)
02122 : BC_Radial(x,
02123 y,
02124 *output == value,
02125 _("Fix quantization"))
02126 {
02127 this->output = output;
02128 this->value = value;
02129 }
02130
02131 int MOVConfigVideoFixQuant::handle_event()
02132 {
02133 *output = value;
02134 opposite->update(0);
02135 return 1;
02136 }
02137
02138
02139
02140
02141
02142 MOVConfigVideoPopup::MOVConfigVideoPopup(MOVConfigVideo *popup, int x, int y)
02143 : BC_PopupTextBox(popup,
02144 &popup->compression_items,
02145 FileMOV::compressiontostr(popup->asset->vcodec),
02146 x,
02147 y,
02148 300,
02149 300)
02150 {
02151 this->popup = popup;
02152 }
02153
02154 int MOVConfigVideoPopup::handle_event()
02155 {
02156 strcpy(popup->asset->vcodec, FileMOV::strtocompression(get_text()));
02157 popup->update_parameters();
02158 return 1;
02159 }
02160
02161
02162
02163
02164
02165
02166
02167
02168