2 #include "awindowgui.inc"
9 #include "filesystem.h"
10 #include "indexfile.h"
11 #include "quicktime.h"
12 #include "mainsession.h"
13 #include "threadindexer.h"
16 Assets::Assets(EDL *edl) : List<Asset>()
26 int Assets::load(ArrayList<PluginServer*> *plugindb,
32 //printf("Assets::load 1\n");
35 result = file->read_tag();
38 if(file->tag.title_is("/ASSETS"))
43 if(file->tag.title_is("ASSET"))
45 //printf("Assets::load 2\n");
46 char *path = file->tag.get_property("SRC");
47 //printf("Assets::load 3\n");
48 Asset new_asset(path ? path : SILENCE);
49 //printf("Assets::load 4\n");
50 new_asset.read(plugindb, file);
51 //printf("Assets::load 5\n");
53 //printf("Assets::load 6\n");
57 //printf("Assets::load 7\n");
61 int Assets::save(ArrayList<PluginServer*> *plugindb, FileXML *file, char *path)
63 file->tag.set_title("ASSETS");
65 file->append_newline();
67 for(Asset* current = first; current; current = NEXT)
69 current->write(plugindb,
75 file->tag.set_title("/ASSETS");
77 file->append_newline();
78 file->append_newline();
82 Assets& Assets::operator=(Assets &assets)
84 while(last) delete last;
86 for(Asset *current = assets.first; current; current = NEXT)
89 append(new_asset = new Asset);
90 new_asset->copy_from(current, 1);
97 void Assets::update_index(Asset *asset)
99 for(Asset* current = first; current; current = NEXT)
101 if(current->test_path(asset->path))
103 current->update_index(asset);
108 Asset* Assets::update(Asset *asset)
112 for(Asset* current = first; current; current = NEXT)
114 // Asset already exists.
115 if(current->test_path(asset->path))
121 // Asset doesn't exist.
122 Asset *asset_copy = new Asset(*asset);
127 int Assets::delete_all()
136 Asset* Assets::update(const char *path)
138 Asset* current = first;
142 if(current->test_path(path))
149 return append(new Asset(path));
152 Asset* Assets::get_asset(const char *filename)
154 Asset* current = first;
159 //printf("Assets::get_asset %p %s\n", filename, filename);
160 if(current->test_path(filename))
165 current = current->next;
171 Asset* Assets::remove_asset(Asset *asset)
177 int Assets::number_of(Asset *asset)
182 for(i = 0, current = first; current && current != asset; i++, current = NEXT)
188 Asset* Assets::asset_number(int number)
193 for(i = 0, current = first; i < number && current; i++, current = NEXT)
199 int Assets::update_old_filename(char *old_filename, char *new_filename)
201 for(Asset* current = first; current; current = NEXT)
203 if(!strcmp(current->path, old_filename))
205 current->update_path(new_filename);
214 for(Asset *current = first; current; current = NEXT)
222 // ==========================================================
224 Asset::Asset() : ListItem<Asset>()
229 Asset::Asset(Asset &asset) : ListItem<Asset>()
235 Asset::Asset(const char *path) : ListItem<Asset>()
238 strcpy(this->path, path);
241 Asset::Asset(const int plugin_type, const char *plugin_title) : ListItem<Asset>()
248 if(index_offsets) delete [] index_offsets;
249 // Don't delete index buffer since it is shared with the index thread.
253 int Asset::init_values()
256 strcpy(folder, MEDIA_FOLDER);
257 // format = FILE_MOV;
258 // Has to be unknown for file probing to succeed
259 format = FILE_UNKNOWN;
276 strcpy(vcodec, QUICKTIME_YUV2);
277 strcpy(acodec, QUICKTIME_TWOS);
281 ampeg_derivative = 3;
284 vorbis_min_bitrate = -1;
285 vorbis_bitrate = 128000;
286 vorbis_max_bitrate = -1;
288 mp3_bitrate = 256000;
297 vmpeg_iframe_distance = 45;
298 vmpeg_bframe_distance = 0;
299 vmpeg_progressive = 0;
301 vmpeg_bitrate = 1000000;
302 vmpeg_derivative = 1;
303 vmpeg_quantization = 15;
305 vmpeg_fix_bitrate = 0;
308 // Divx parameters. Defaults from encore2
309 divx_bitrate = 2000000;
311 divx_rc_reaction_ratio = 45;
312 divx_rc_reaction_period = 10;
313 divx_max_key_interval = 250;
314 divx_max_quantizer = 31;
315 divx_min_quantizer = 1;
318 divx_fix_bitrate = 1;
319 divx_use_deblocking = 1;
321 ms_bitrate = 1000000;
322 ms_bitrate_tolerance = 500000;
323 ms_quantization = 10;
339 int Asset::reset_index()
341 index_status = INDEX_NOTTESTED;
342 index_start = old_index_end = index_end = 0;
350 void Asset::copy_from(Asset *asset, int do_index)
352 copy_location(asset);
353 copy_format(asset, do_index);
356 void Asset::copy_location(Asset *asset)
358 strcpy(this->path, asset->path);
359 strcpy(this->folder, asset->folder);
362 void Asset::copy_format(Asset *asset, int do_index)
364 if(do_index) update_index(asset);
366 audio_data = asset->audio_data;
367 format = asset->format;
368 channels = asset->channels;
369 sample_rate = asset->sample_rate;
371 byte_order = asset->byte_order;
372 signed_ = asset->signed_;
373 header = asset->header;
374 dither = asset->dither;
375 mp3_bitrate = asset->mp3_bitrate;
376 use_header = asset->use_header;
379 video_data = asset->video_data;
380 layers = asset->layers;
381 frame_rate = asset->frame_rate;
382 width = asset->width;
383 height = asset->height;
384 strcpy(vcodec, asset->vcodec);
385 strcpy(acodec, asset->acodec);
387 this->audio_length = asset->audio_length;
388 this->video_length = asset->video_length;
391 ampeg_bitrate = asset->ampeg_bitrate;
392 ampeg_derivative = asset->ampeg_derivative;
395 vorbis_vbr = asset->vorbis_vbr;
396 vorbis_min_bitrate = asset->vorbis_min_bitrate;
397 vorbis_bitrate = asset->vorbis_bitrate;
398 vorbis_max_bitrate = asset->vorbis_max_bitrate;
402 jpeg_quality = asset->jpeg_quality;
405 vmpeg_iframe_distance = asset->vmpeg_iframe_distance;
406 vmpeg_bframe_distance = asset->vmpeg_bframe_distance;
407 vmpeg_progressive = asset->vmpeg_progressive;
408 vmpeg_denoise = asset->vmpeg_denoise;
409 vmpeg_bitrate = asset->vmpeg_bitrate;
410 vmpeg_derivative = asset->vmpeg_derivative;
411 vmpeg_quantization = asset->vmpeg_quantization;
412 vmpeg_cmodel = asset->vmpeg_cmodel;
413 vmpeg_fix_bitrate = asset->vmpeg_fix_bitrate;
414 vmpeg_seq_codes = asset->vmpeg_seq_codes;
417 divx_bitrate = asset->divx_bitrate;
418 divx_rc_period = asset->divx_rc_period;
419 divx_rc_reaction_ratio = asset->divx_rc_reaction_ratio;
420 divx_rc_reaction_period = asset->divx_rc_reaction_period;
421 divx_max_key_interval = asset->divx_max_key_interval;
422 divx_max_quantizer = asset->divx_max_quantizer;
423 divx_min_quantizer = asset->divx_min_quantizer;
424 divx_quantizer = asset->divx_quantizer;
425 divx_quality = asset->divx_quality;
426 divx_fix_bitrate = asset->divx_fix_bitrate;
427 divx_use_deblocking = asset->divx_use_deblocking;
429 ms_bitrate = asset->ms_bitrate;
430 ms_bitrate_tolerance = asset->ms_bitrate_tolerance;
431 ms_interlaced = asset->ms_interlaced;
432 ms_quantization = asset->ms_quantization;
433 ms_gop_size = asset->ms_gop_size;
434 ms_fix_bitrate = asset->ms_fix_bitrate;
437 png_use_alpha = asset->png_use_alpha;
440 int64_t Asset::get_index_offset(int channel)
442 if(channel < channels && index_offsets)
443 return index_offsets[channel];
448 Asset& Asset::operator=(Asset &asset)
450 copy_location(&asset);
456 int Asset::equivalent(Asset &asset,
460 int result = (!strcmp(asset.path, path) &&
461 format == asset.format);
463 if(test_audio && result)
465 result = (channels == asset.channels &&
466 sample_rate == asset.sample_rate &&
467 bits == asset.bits &&
468 byte_order == asset.byte_order &&
469 signed_ == asset.signed_ &&
470 header == asset.header &&
471 dither == asset.dither &&
472 !strcmp(acodec, asset.acodec));
476 if(test_video && result)
478 result = (layers == asset.layers &&
479 frame_rate == asset.frame_rate &&
480 width == asset.width &&
481 height == asset.height &&
482 !strcmp(vcodec, asset.vcodec));
488 int Asset::operator==(Asset &asset)
491 return equivalent(asset,
496 int Asset::operator!=(Asset &asset)
498 return !(*this == asset);
501 int Asset::test_path(const char *path)
503 if(!strcasecmp(this->path, path))
509 int Asset::test_plugin_title(const char *path)
513 int Asset::read(ArrayList<PluginServer*> *plugindb, FileXML *file)
517 // Check for relative path.
519 strcpy(new_path, path);
520 char asset_directory[1024], input_directory[1024];
522 fs.set_current_dir("");
524 fs.extract_dir(asset_directory, path);
526 //printf("Asset::read 1\n");
528 if(!asset_directory[0])
530 fs.extract_dir(input_directory, file->filename);
531 //printf("Asset::read 2 %s %s\n", input_directory, new_path);
533 // Input file has a path
534 if(input_directory[0])
536 sprintf(path, "%s/%s", input_directory, new_path);
542 result = file->read_tag();
545 if(file->tag.title_is("/ASSET"))
550 if(file->tag.title_is("AUDIO"))
555 if(file->tag.title_is("FORMAT"))
557 char *string = file->tag.get_property("TYPE");
558 format = File::strtoformat(plugindb, string);
560 file->tag.get_property("USE_HEADER", use_header);
563 if(file->tag.title_is("FOLDER"))
565 strcpy(folder, file->read_text());
568 if(file->tag.title_is("VIDEO"))
573 if(file->tag.title_is("INDEX"))
580 //printf("Asset::read 2\n");
584 int Asset::read_audio(FileXML *file)
586 channels = file->tag.get_property("CHANNELS", 2);
587 // This is loaded from the index file after the EDL but this
588 // should be overridable in the EDL.
589 if(!sample_rate) sample_rate = file->tag.get_property("RATE", 44100);
590 bits = file->tag.get_property("BITS", 16);
591 byte_order = file->tag.get_property("BYTE_ORDER", 1);
592 signed_ = file->tag.get_property("SIGNED", 1);
593 header = file->tag.get_property("HEADER", 0);
594 dither = file->tag.get_property("DITHER", 0);
596 audio_length = file->tag.get_property("AUDIO_LENGTH", 0);
598 file->tag.get_property("ACODEC", acodec);
602 ampeg_bitrate = file->tag.get_property("AMPEG_BITRATE", ampeg_bitrate);
603 ampeg_derivative = file->tag.get_property("AMPEG_DERIVATIVE", ampeg_derivative);
605 vorbis_vbr = file->tag.get_property("VORBIS_VBR", vorbis_vbr);
606 vorbis_min_bitrate = file->tag.get_property("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
607 vorbis_bitrate = file->tag.get_property("VORBIS_BITRATE", vorbis_bitrate);
608 vorbis_max_bitrate = file->tag.get_property("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
610 mp3_bitrate = file->tag.get_property("MP3_BITRATE", mp3_bitrate);
617 int Asset::read_video(FileXML *file)
619 height = file->tag.get_property("HEIGHT", height);
620 width = file->tag.get_property("WIDTH", width);
621 layers = file->tag.get_property("LAYERS", layers);
622 // This is loaded from the index file after the EDL but this
623 // should be overridable in the EDL.
624 if(!frame_rate) frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
626 file->tag.get_property("VCODEC", vcodec);
628 video_length = file->tag.get_property("VIDEO_LENGTH", 0);
633 jpeg_quality = file->tag.get_property("JPEG_QUALITY", jpeg_quality);
638 vmpeg_iframe_distance = file->tag.get_property("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
639 vmpeg_bframe_distance = file->tag.get_property("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
640 vmpeg_progressive = file->tag.get_property("VMPEG_PROGRESSIVE", vmpeg_progressive);
641 vmpeg_denoise = file->tag.get_property("VMPEG_DENOISE", vmpeg_denoise);
642 vmpeg_bitrate = file->tag.get_property("VMPEG_BITRATE", vmpeg_bitrate);
643 vmpeg_derivative = file->tag.get_property("VMPEG_DERIVATIVE", vmpeg_derivative);
644 vmpeg_quantization = file->tag.get_property("VMPEG_QUANTIZATION", vmpeg_quantization);
645 vmpeg_cmodel = file->tag.get_property("VMPEG_CMODEL", vmpeg_cmodel);
646 vmpeg_fix_bitrate = file->tag.get_property("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
647 vmpeg_seq_codes = file->tag.get_property("VMPEG_SEQ_CODES", vmpeg_seq_codes);
650 divx_bitrate = file->tag.get_property("DIVX_BITRATE", divx_bitrate);
651 divx_rc_period = file->tag.get_property("DIVX_RC_PERIOD", divx_rc_period);
652 divx_rc_reaction_ratio = file->tag.get_property("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
653 divx_rc_reaction_period = file->tag.get_property("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
654 divx_max_key_interval = file->tag.get_property("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
655 divx_max_quantizer = file->tag.get_property("DIVX_MAX_QUANTIZER", divx_max_quantizer);
656 divx_min_quantizer = file->tag.get_property("DIVX_MIN_QUANTIZER", divx_min_quantizer);
657 divx_quantizer = file->tag.get_property("DIVX_QUANTIZER", divx_quantizer);
658 divx_quality = file->tag.get_property("DIVX_QUALITY", divx_quality);
659 divx_fix_bitrate = file->tag.get_property("DIVX_FIX_BITRATE", divx_fix_bitrate);
660 divx_use_deblocking = file->tag.get_property("DIVX_USE_DEBLOCKING", divx_use_deblocking);
662 ms_bitrate = file->tag.get_property("MS_BITRATE", ms_bitrate);
663 ms_bitrate_tolerance = file->tag.get_property("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
664 ms_interlaced = file->tag.get_property("MS_INTERLACED", ms_interlaced);
665 ms_quantization = file->tag.get_property("MS_QUANTIZATION", ms_quantization);
666 ms_gop_size = file->tag.get_property("MS_GOP_SIZE", ms_gop_size);
667 ms_fix_bitrate = file->tag.get_property("MS_FIX_BITRATE", ms_fix_bitrate);
671 png_use_alpha = file->tag.get_property("PNG_USE_ALPHA", png_use_alpha);
680 int Asset::read_index(FileXML *file)
682 if(index_offsets) delete [] index_offsets;
683 index_offsets = new int64_t[channels];
684 for(int i = 0; i < channels; i++) index_offsets[i] = 0;
686 int current_offset = 0;
689 index_zoom = file->tag.get_property("ZOOM", 1);
690 index_bytes = file->tag.get_property("BYTES", (int64_t)0);
694 result = file->read_tag();
697 if(file->tag.title_is("/INDEX"))
702 if(file->tag.title_is("OFFSET"))
704 if(current_offset < channels)
706 index_offsets[current_offset++] = file->tag.get_property("FLOAT", 0);
707 //printf("Asset::read_index %d %d\n", current_offset - 1, index_offsets[current_offset - 1]);
715 // Output path is the path of the output file if name truncation is desired.
716 // It is a "" if complete names should be used.
718 int Asset::write(ArrayList<PluginServer*> *plugindb,
724 char asset_directory[1024], output_directory[1024];
727 // Make path relative
728 fs.extract_dir(asset_directory, path);
729 if(output_path && output_path[0])
730 fs.extract_dir(output_directory, output_path);
732 output_directory[0] = 0;
734 if(!strcmp(asset_directory, output_directory))
736 fs.extract_name(new_path, path);
740 strcpy(new_path, path);
743 file->tag.set_title("ASSET");
744 file->tag.set_property("SRC", new_path);
746 file->append_newline();
748 file->tag.set_title("FOLDER");
750 file->append_text(folder);
751 file->tag.set_title("/FOLDER");
753 file->append_newline();
755 // Write the format information
756 file->tag.set_title("FORMAT");
759 file->tag.set_property("TYPE",
760 File::formattostr(plugindb, format));
761 file->tag.set_property("USE_HEADER", use_header);
765 file->append_newline();
767 if(audio_data) write_audio(file);
768 if(video_data) write_video(file);
769 if(index_status == 0 && include_index) write_index(file); // index goes after source
771 file->tag.set_title("/ASSET");
773 file->append_newline();
777 int Asset::write_audio(FileXML *file)
779 file->tag.set_title("AUDIO");
780 file->tag.set_property("CHANNELS", channels);
781 file->tag.set_property("RATE", sample_rate);
782 file->tag.set_property("BITS", bits);
783 file->tag.set_property("BYTE_ORDER", byte_order);
784 file->tag.set_property("SIGNED", signed_);
785 file->tag.set_property("HEADER", header);
786 file->tag.set_property("DITHER", dither);
788 file->tag.set_property("ACODEC", acodec);
790 file->tag.set_property("AUDIO_LENGTH", audio_length);
795 file->tag.set_property("AMPEG_BITRATE", ampeg_bitrate);
796 file->tag.set_property("AMPEG_DERIVATIVE", ampeg_derivative);
798 file->tag.set_property("VORBIS_VBR", vorbis_vbr);
799 file->tag.set_property("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
800 file->tag.set_property("VORBIS_BITRATE", vorbis_bitrate);
801 file->tag.set_property("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
803 file->tag.set_property("MP3_BITRATE", mp3_bitrate);
809 file->append_newline();
813 int Asset::write_video(FileXML *file)
815 file->tag.set_title("VIDEO");
816 file->tag.set_property("HEIGHT", height);
817 file->tag.set_property("WIDTH", width);
818 file->tag.set_property("LAYERS", layers);
819 file->tag.set_property("FRAMERATE", frame_rate);
821 file->tag.set_property("VCODEC", vcodec);
823 file->tag.set_property("VIDEO_LENGTH", video_length);
827 file->tag.set_property("JPEG_QUALITY", jpeg_quality);
829 file->tag.set_property("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
830 file->tag.set_property("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
831 file->tag.set_property("VMPEG_PROGRESSIVE", vmpeg_progressive);
832 file->tag.set_property("VMPEG_DENOISE", vmpeg_denoise);
833 file->tag.set_property("VMPEG_BITRATE", vmpeg_bitrate);
834 file->tag.set_property("VMPEG_DERIVATIVE", vmpeg_derivative);
835 file->tag.set_property("VMPEG_QUANTIZATION", vmpeg_quantization);
836 file->tag.set_property("VMPEG_CMODEL", vmpeg_cmodel);
837 file->tag.set_property("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
838 file->tag.set_property("VMPEG_SEQ_CODES", vmpeg_seq_codes);
841 file->tag.set_property("DIVX_BITRATE", divx_bitrate);
842 file->tag.set_property("DIVX_RC_PERIOD", divx_rc_period);
843 file->tag.set_property("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
844 file->tag.set_property("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
845 file->tag.set_property("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
846 file->tag.set_property("DIVX_MAX_QUANTIZER", divx_max_quantizer);
847 file->tag.set_property("DIVX_MIN_QUANTIZER", divx_min_quantizer);
848 file->tag.set_property("DIVX_QUANTIZER", divx_quantizer);
849 file->tag.set_property("DIVX_QUALITY", divx_quality);
850 file->tag.set_property("DIVX_FIX_BITRATE", divx_fix_bitrate);
851 file->tag.set_property("DIVX_USE_DEBLOCKING", divx_use_deblocking);
854 file->tag.set_property("MS_BITRATE", ms_bitrate);
855 file->tag.set_property("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
856 file->tag.set_property("MS_INTERLACED", ms_interlaced);
857 file->tag.set_property("MS_QUANTIZATION", ms_quantization);
858 file->tag.set_property("MS_GOP_SIZE", ms_gop_size);
859 file->tag.set_property("MS_FIX_BITRATE", ms_fix_bitrate);
863 file->tag.set_property("PNG_USE_ALPHA", png_use_alpha);
870 file->append_newline();
874 int Asset::write_index(FileXML *file)
876 file->tag.set_title("INDEX");
877 file->tag.set_property("ZOOM", index_zoom);
878 file->tag.set_property("BYTES", index_bytes);
880 file->append_newline();
884 for(int i = 0; i < channels; i++)
886 file->tag.set_title("OFFSET");
887 file->tag.set_property("FLOAT", index_offsets[i]);
892 file->append_newline();
893 file->tag.set_title("/INDEX");
895 file->append_newline();
902 char* Asset::construct_param(char *param, char *prefix, char *return_value)
905 sprintf(return_value, "%s%s", prefix, param);
907 strcpy(return_value, param);
911 #define UPDATE_DEFAULT(x, y) defaults->update(construct_param(x, prefix, string), y);
912 #define GET_DEFAULT(x, y) defaults->get(construct_param(x, prefix, string), y);
914 void Asset::load_defaults(Defaults *defaults,
918 char string[BCTEXTLEN];
920 // Can't save codec here because it's specific to render, record, and effect.
921 // The codec has to be UNKNOWN for file probing to work.
925 GET_DEFAULT("PATH", path);
926 format = GET_DEFAULT("FORMAT", format);
927 GET_DEFAULT("AUDIO_CODEC", acodec);
929 ampeg_bitrate = GET_DEFAULT("AMPEG_BITRATE", ampeg_bitrate);
930 ampeg_derivative = GET_DEFAULT("AMPEG_DERIVATIVE", ampeg_derivative);
932 vorbis_vbr = GET_DEFAULT("VORBIS_VBR", vorbis_vbr);
933 vorbis_min_bitrate = GET_DEFAULT("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
934 vorbis_bitrate = GET_DEFAULT("VORBIS_BITRATE", vorbis_bitrate);
935 vorbis_max_bitrate = GET_DEFAULT("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
937 mp3_bitrate = GET_DEFAULT("MP3_BITRATE", mp3_bitrate);
940 // Can't save codec here because it's specific to render, record, and effect
941 if(do_codecs) GET_DEFAULT("VIDEO_CODEC", vcodec);
943 jpeg_quality = GET_DEFAULT("JPEG_QUALITY", jpeg_quality);
945 // MPEG format information
946 vmpeg_iframe_distance = GET_DEFAULT("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
947 vmpeg_bframe_distance = GET_DEFAULT("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
948 vmpeg_progressive = GET_DEFAULT("VMPEG_PROGRESSIVE", vmpeg_progressive);
949 vmpeg_denoise = GET_DEFAULT("VMPEG_DENOISE", vmpeg_denoise);
950 vmpeg_bitrate = GET_DEFAULT("VMPEG_BITRATE", vmpeg_bitrate);
951 vmpeg_derivative = GET_DEFAULT("VMPEG_DERIVATIVE", vmpeg_derivative);
952 vmpeg_quantization = GET_DEFAULT("VMPEG_QUANTIZATION", vmpeg_quantization);
953 vmpeg_cmodel = GET_DEFAULT("VMPEG_CMODEL", vmpeg_cmodel);
954 vmpeg_fix_bitrate = GET_DEFAULT("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
955 vmpeg_seq_codes = GET_DEFAULT("VMPEG_SEQ_CODES", vmpeg_seq_codes);
958 divx_bitrate = GET_DEFAULT("DIVX_BITRATE", divx_bitrate);
959 divx_rc_period = GET_DEFAULT("DIVX_RC_PERIOD", divx_rc_period);
960 divx_rc_reaction_ratio = GET_DEFAULT("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
961 divx_rc_reaction_period = GET_DEFAULT("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
962 divx_max_key_interval = GET_DEFAULT("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
963 divx_max_quantizer = GET_DEFAULT("DIVX_MAX_QUANTIZER", divx_max_quantizer);
964 divx_min_quantizer = GET_DEFAULT("DIVX_MIN_QUANTIZER", divx_min_quantizer);
965 divx_quantizer = GET_DEFAULT("DIVX_QUANTIZER", divx_quantizer);
966 divx_quality = GET_DEFAULT("DIVX_QUALITY", divx_quality);
967 divx_fix_bitrate = GET_DEFAULT("DIVX_FIX_BITRATE", divx_fix_bitrate);
968 divx_use_deblocking = GET_DEFAULT("DIVX_USE_DEBLOCKING", divx_use_deblocking);
970 ms_bitrate = GET_DEFAULT("MS_BITRATE", ms_bitrate);
971 ms_bitrate_tolerance = GET_DEFAULT("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
972 ms_interlaced = GET_DEFAULT("MS_INTERLACED", ms_interlaced);
973 ms_quantization = GET_DEFAULT("MS_QUANTIZATION", ms_quantization);
974 ms_gop_size = GET_DEFAULT("MS_GOP_SIZE", ms_gop_size);
975 ms_fix_bitrate = GET_DEFAULT("MS_FIX_BITRATE", ms_fix_bitrate);
978 png_use_alpha = GET_DEFAULT("PNG_USE_ALPHA", png_use_alpha);
981 void Asset::save_defaults(Defaults *defaults, char *prefix)
983 char string[BCTEXTLEN];
985 UPDATE_DEFAULT("PATH", path);
986 UPDATE_DEFAULT("FORMAT", format);
987 UPDATE_DEFAULT("AUDIO_CODEC", acodec);
988 UPDATE_DEFAULT("AMPEG_BITRATE", ampeg_bitrate);
989 UPDATE_DEFAULT("AMPEG_DERIVATIVE", ampeg_derivative);
991 UPDATE_DEFAULT("VORBIS_VBR", vorbis_vbr);
992 UPDATE_DEFAULT("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
993 UPDATE_DEFAULT("VORBIS_BITRATE", vorbis_bitrate);
994 UPDATE_DEFAULT("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
996 UPDATE_DEFAULT("MP3_BITRATE", mp3_bitrate);
1001 UPDATE_DEFAULT("VIDEO_CODEC", vcodec);
1003 UPDATE_DEFAULT("JPEG_QUALITY", jpeg_quality);
1005 // MPEG format information
1006 UPDATE_DEFAULT("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
1007 UPDATE_DEFAULT("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
1008 UPDATE_DEFAULT("VMPEG_PROGRESSIVE", vmpeg_progressive);
1009 UPDATE_DEFAULT("VMPEG_DENOISE", vmpeg_denoise);
1010 UPDATE_DEFAULT("VMPEG_BITRATE", vmpeg_bitrate);
1011 UPDATE_DEFAULT("VMPEG_DERIVATIVE", vmpeg_derivative);
1012 UPDATE_DEFAULT("VMPEG_QUANTIZATION", vmpeg_quantization);
1013 UPDATE_DEFAULT("VMPEG_CMODEL", vmpeg_cmodel);
1014 UPDATE_DEFAULT("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
1015 UPDATE_DEFAULT("VMPEG_SEQ_CODES", vmpeg_seq_codes);
1019 UPDATE_DEFAULT("DIVX_BITRATE", divx_bitrate);
1020 UPDATE_DEFAULT("DIVX_RC_PERIOD", divx_rc_period);
1021 UPDATE_DEFAULT("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
1022 UPDATE_DEFAULT("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
1023 UPDATE_DEFAULT("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
1024 UPDATE_DEFAULT("DIVX_MAX_QUANTIZER", divx_max_quantizer);
1025 UPDATE_DEFAULT("DIVX_MIN_QUANTIZER", divx_min_quantizer);
1026 UPDATE_DEFAULT("DIVX_QUANTIZER", divx_quantizer);
1027 UPDATE_DEFAULT("DIVX_QUALITY", divx_quality);
1028 UPDATE_DEFAULT("DIVX_FIX_BITRATE", divx_fix_bitrate);
1029 UPDATE_DEFAULT("DIVX_USE_DEBLOCKING", divx_use_deblocking);
1032 UPDATE_DEFAULT("MS_BITRATE", ms_bitrate);
1033 UPDATE_DEFAULT("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
1034 UPDATE_DEFAULT("MS_INTERLACED", ms_interlaced);
1035 UPDATE_DEFAULT("MS_QUANTIZATION", ms_quantization);
1036 UPDATE_DEFAULT("MS_GOP_SIZE", ms_gop_size);
1037 UPDATE_DEFAULT("MS_FIX_BITRATE", ms_fix_bitrate);
1039 UPDATE_DEFAULT("PNG_USE_ALPHA", png_use_alpha);
1050 int Asset::update_path(char *new_path)
1052 strcpy(path, new_path);
1056 void Asset::update_index(Asset *asset)
1058 //printf("Asset::update_index 1 %d\n", index_status);
1059 index_status = asset->index_status;
1060 index_zoom = asset->index_zoom; // zoom factor of index data
1061 index_start = asset->index_start; // byte start of index data in the index file
1062 index_bytes = asset->index_bytes; // Total bytes in source file for comparison before rebuilding the index
1063 index_end = asset->index_end;
1064 old_index_end = asset->old_index_end; // values for index build
1065 //printf("Asset::update_index 1\n");
1069 delete [] index_offsets;
1073 if(asset->index_offsets)
1075 index_offsets = new int64_t[asset->channels];
1076 //printf("Asset::update_index 1\n");
1079 for(i = 0; i < asset->channels; i++)
1081 index_offsets[i] = asset->index_offsets[i]; // offsets of channels in index file in floats
1085 //printf("Asset::update_index 1\n");
1086 index_buffer = asset->index_buffer; // pointer
1087 //printf("Asset::update_index 2\n");
1093 printf(" asset::dump\n");
1094 printf(" %p %s\n", this, path);
1095 printf(" index_status %d\n", index_status);
1096 printf(" format %d\n", format);
1097 printf(" audio_data %d channels %d samplerate %d bits %d byte_order %d signed %d header %d dither %d acodec %c%c%c%c\n",
1098 audio_data, channels, sample_rate, bits, byte_order, signed_, header, dither, acodec[0], acodec[1], acodec[2], acodec[3]);
1099 printf(" audio_length %lld\n", audio_length);
1100 printf(" video_data %d layers %d framerate %f width %d height %d vcodec %c%c%c%c\n",
1101 video_data, layers, frame_rate, width, height, vcodec[0], vcodec[1], vcodec[2], vcodec[3]);
1102 printf(" video_length %lld \n", video_length);