6 #include "filesystem.h"
15 Asset::Asset() : ListItem<Asset>()
20 Asset::Asset(Asset &asset) : ListItem<Asset>()
26 Asset::Asset(const char *path) : ListItem<Asset>()
29 strcpy(this->path, path);
32 Asset::Asset(const int plugin_type, const char *plugin_title) : ListItem<Asset>()
39 if(index_offsets) delete [] index_offsets;
40 // Don't delete index buffer since it is shared with the index thread.
44 int Asset::init_values()
47 strcpy(folder, MEDIA_FOLDER);
49 // Has to be unknown for file probing to succeed
50 format = FILE_UNKNOWN;
67 strcpy(vcodec, QUICKTIME_YUV2);
68 strcpy(acodec, QUICKTIME_TWOS);
75 vorbis_min_bitrate = -1;
76 vorbis_bitrate = 128000;
77 vorbis_max_bitrate = -1;
88 vmpeg_iframe_distance = 45;
89 vmpeg_bframe_distance = 0;
90 vmpeg_progressive = 0;
92 vmpeg_bitrate = 1000000;
94 vmpeg_quantization = 15;
96 vmpeg_fix_bitrate = 0;
99 // Divx parameters. Defaults from encore2
100 divx_bitrate = 2000000;
102 divx_rc_reaction_ratio = 45;
103 divx_rc_reaction_period = 10;
104 divx_max_key_interval = 250;
105 divx_max_quantizer = 31;
106 divx_min_quantizer = 1;
109 divx_fix_bitrate = 1;
110 divx_use_deblocking = 1;
112 ms_bitrate = 1000000;
113 ms_bitrate_tolerance = 500000;
114 ms_quantization = 10;
130 int Asset::reset_index()
132 index_status = INDEX_NOTTESTED;
133 index_start = old_index_end = index_end = 0;
141 void Asset::copy_from(Asset *asset, int do_index)
143 copy_location(asset);
144 copy_format(asset, do_index);
147 void Asset::copy_location(Asset *asset)
149 strcpy(this->path, asset->path);
150 strcpy(this->folder, asset->folder);
153 void Asset::copy_format(Asset *asset, int do_index)
155 if(do_index) update_index(asset);
157 audio_data = asset->audio_data;
158 format = asset->format;
159 channels = asset->channels;
160 sample_rate = asset->sample_rate;
162 byte_order = asset->byte_order;
163 signed_ = asset->signed_;
164 header = asset->header;
165 dither = asset->dither;
166 mp3_bitrate = asset->mp3_bitrate;
167 use_header = asset->use_header;
170 video_data = asset->video_data;
171 layers = asset->layers;
172 frame_rate = asset->frame_rate;
173 width = asset->width;
174 height = asset->height;
175 strcpy(vcodec, asset->vcodec);
176 strcpy(acodec, asset->acodec);
178 this->audio_length = asset->audio_length;
179 this->video_length = asset->video_length;
182 ampeg_bitrate = asset->ampeg_bitrate;
183 ampeg_derivative = asset->ampeg_derivative;
186 vorbis_vbr = asset->vorbis_vbr;
187 vorbis_min_bitrate = asset->vorbis_min_bitrate;
188 vorbis_bitrate = asset->vorbis_bitrate;
189 vorbis_max_bitrate = asset->vorbis_max_bitrate;
193 jpeg_quality = asset->jpeg_quality;
196 vmpeg_iframe_distance = asset->vmpeg_iframe_distance;
197 vmpeg_bframe_distance = asset->vmpeg_bframe_distance;
198 vmpeg_progressive = asset->vmpeg_progressive;
199 vmpeg_denoise = asset->vmpeg_denoise;
200 vmpeg_bitrate = asset->vmpeg_bitrate;
201 vmpeg_derivative = asset->vmpeg_derivative;
202 vmpeg_quantization = asset->vmpeg_quantization;
203 vmpeg_cmodel = asset->vmpeg_cmodel;
204 vmpeg_fix_bitrate = asset->vmpeg_fix_bitrate;
205 vmpeg_seq_codes = asset->vmpeg_seq_codes;
208 divx_bitrate = asset->divx_bitrate;
209 divx_rc_period = asset->divx_rc_period;
210 divx_rc_reaction_ratio = asset->divx_rc_reaction_ratio;
211 divx_rc_reaction_period = asset->divx_rc_reaction_period;
212 divx_max_key_interval = asset->divx_max_key_interval;
213 divx_max_quantizer = asset->divx_max_quantizer;
214 divx_min_quantizer = asset->divx_min_quantizer;
215 divx_quantizer = asset->divx_quantizer;
216 divx_quality = asset->divx_quality;
217 divx_fix_bitrate = asset->divx_fix_bitrate;
218 divx_use_deblocking = asset->divx_use_deblocking;
220 ms_bitrate = asset->ms_bitrate;
221 ms_bitrate_tolerance = asset->ms_bitrate_tolerance;
222 ms_interlaced = asset->ms_interlaced;
223 ms_quantization = asset->ms_quantization;
224 ms_gop_size = asset->ms_gop_size;
225 ms_fix_bitrate = asset->ms_fix_bitrate;
228 png_use_alpha = asset->png_use_alpha;
231 int64_t Asset::get_index_offset(int channel)
233 if(channel < channels && index_offsets)
234 return index_offsets[channel];
239 Asset& Asset::operator=(Asset &asset)
241 copy_location(&asset);
247 int Asset::equivalent(Asset &asset,
251 int result = (!strcmp(asset.path, path) &&
252 format == asset.format);
254 if(test_audio && result)
256 result = (channels == asset.channels &&
257 sample_rate == asset.sample_rate &&
258 bits == asset.bits &&
259 byte_order == asset.byte_order &&
260 signed_ == asset.signed_ &&
261 header == asset.header &&
262 dither == asset.dither &&
263 !strcmp(acodec, asset.acodec));
267 if(test_video && result)
269 result = (layers == asset.layers &&
270 frame_rate == asset.frame_rate &&
271 width == asset.width &&
272 height == asset.height &&
273 !strcmp(vcodec, asset.vcodec));
279 int Asset::operator==(Asset &asset)
282 return equivalent(asset,
287 int Asset::operator!=(Asset &asset)
289 return !(*this == asset);
292 int Asset::test_path(const char *path)
294 if(!strcasecmp(this->path, path))
300 int Asset::test_plugin_title(const char *path)
304 int Asset::read(FileXML *file,
307 return read(0, file, expand_relative);
310 int Asset::read(ArrayList<PluginServer*> *plugindb,
316 // Check for relative path.
319 char new_path[BCTEXTLEN];
320 char asset_directory[BCTEXTLEN];
321 char input_directory[BCTEXTLEN];
324 strcpy(new_path, path);
325 fs.set_current_dir("");
327 fs.extract_dir(asset_directory, path);
330 if(!asset_directory[0])
332 fs.extract_dir(input_directory, file->filename);
334 // Input file has a path
335 if(input_directory[0])
337 sprintf(path, "%s/%s", input_directory, new_path);
345 result = file->read_tag();
348 if(file->tag.title_is("/ASSET"))
353 if(file->tag.title_is("AUDIO"))
358 if(file->tag.title_is("FORMAT"))
360 char *string = file->tag.get_property("TYPE");
361 format = File::strtoformat(plugindb, string);
363 file->tag.get_property("USE_HEADER", use_header);
366 if(file->tag.title_is("FOLDER"))
368 strcpy(folder, file->read_text());
371 if(file->tag.title_is("VIDEO"))
376 if(file->tag.title_is("INDEX"))
383 //printf("Asset::read 2\n");
387 int Asset::read_audio(FileXML *file)
389 channels = file->tag.get_property("CHANNELS", 2);
390 // This is loaded from the index file after the EDL but this
391 // should be overridable in the EDL.
392 if(!sample_rate) sample_rate = file->tag.get_property("RATE", 44100);
393 bits = file->tag.get_property("BITS", 16);
394 byte_order = file->tag.get_property("BYTE_ORDER", 1);
395 signed_ = file->tag.get_property("SIGNED", 1);
396 header = file->tag.get_property("HEADER", 0);
397 dither = file->tag.get_property("DITHER", 0);
399 audio_length = file->tag.get_property("AUDIO_LENGTH", 0);
401 file->tag.get_property("ACODEC", acodec);
405 ampeg_bitrate = file->tag.get_property("AMPEG_BITRATE", ampeg_bitrate);
406 ampeg_derivative = file->tag.get_property("AMPEG_DERIVATIVE", ampeg_derivative);
408 vorbis_vbr = file->tag.get_property("VORBIS_VBR", vorbis_vbr);
409 vorbis_min_bitrate = file->tag.get_property("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
410 vorbis_bitrate = file->tag.get_property("VORBIS_BITRATE", vorbis_bitrate);
411 vorbis_max_bitrate = file->tag.get_property("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
413 mp3_bitrate = file->tag.get_property("MP3_BITRATE", mp3_bitrate);
420 int Asset::read_video(FileXML *file)
422 height = file->tag.get_property("HEIGHT", height);
423 width = file->tag.get_property("WIDTH", width);
424 layers = file->tag.get_property("LAYERS", layers);
425 // This is loaded from the index file after the EDL but this
426 // should be overridable in the EDL.
427 if(!frame_rate) frame_rate = file->tag.get_property("FRAMERATE", frame_rate);
429 file->tag.get_property("VCODEC", vcodec);
431 video_length = file->tag.get_property("VIDEO_LENGTH", 0);
436 jpeg_quality = file->tag.get_property("JPEG_QUALITY", jpeg_quality);
441 vmpeg_iframe_distance = file->tag.get_property("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
442 vmpeg_bframe_distance = file->tag.get_property("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
443 vmpeg_progressive = file->tag.get_property("VMPEG_PROGRESSIVE", vmpeg_progressive);
444 vmpeg_denoise = file->tag.get_property("VMPEG_DENOISE", vmpeg_denoise);
445 vmpeg_bitrate = file->tag.get_property("VMPEG_BITRATE", vmpeg_bitrate);
446 vmpeg_derivative = file->tag.get_property("VMPEG_DERIVATIVE", vmpeg_derivative);
447 vmpeg_quantization = file->tag.get_property("VMPEG_QUANTIZATION", vmpeg_quantization);
448 vmpeg_cmodel = file->tag.get_property("VMPEG_CMODEL", vmpeg_cmodel);
449 vmpeg_fix_bitrate = file->tag.get_property("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
450 vmpeg_seq_codes = file->tag.get_property("VMPEG_SEQ_CODES", vmpeg_seq_codes);
453 divx_bitrate = file->tag.get_property("DIVX_BITRATE", divx_bitrate);
454 divx_rc_period = file->tag.get_property("DIVX_RC_PERIOD", divx_rc_period);
455 divx_rc_reaction_ratio = file->tag.get_property("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
456 divx_rc_reaction_period = file->tag.get_property("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
457 divx_max_key_interval = file->tag.get_property("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
458 divx_max_quantizer = file->tag.get_property("DIVX_MAX_QUANTIZER", divx_max_quantizer);
459 divx_min_quantizer = file->tag.get_property("DIVX_MIN_QUANTIZER", divx_min_quantizer);
460 divx_quantizer = file->tag.get_property("DIVX_QUANTIZER", divx_quantizer);
461 divx_quality = file->tag.get_property("DIVX_QUALITY", divx_quality);
462 divx_fix_bitrate = file->tag.get_property("DIVX_FIX_BITRATE", divx_fix_bitrate);
463 divx_use_deblocking = file->tag.get_property("DIVX_USE_DEBLOCKING", divx_use_deblocking);
465 ms_bitrate = file->tag.get_property("MS_BITRATE", ms_bitrate);
466 ms_bitrate_tolerance = file->tag.get_property("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
467 ms_interlaced = file->tag.get_property("MS_INTERLACED", ms_interlaced);
468 ms_quantization = file->tag.get_property("MS_QUANTIZATION", ms_quantization);
469 ms_gop_size = file->tag.get_property("MS_GOP_SIZE", ms_gop_size);
470 ms_fix_bitrate = file->tag.get_property("MS_FIX_BITRATE", ms_fix_bitrate);
474 png_use_alpha = file->tag.get_property("PNG_USE_ALPHA", png_use_alpha);
483 int Asset::read_index(FileXML *file)
485 if(index_offsets) delete [] index_offsets;
486 index_offsets = new int64_t[channels];
487 for(int i = 0; i < channels; i++) index_offsets[i] = 0;
489 int current_offset = 0;
492 index_zoom = file->tag.get_property("ZOOM", 1);
493 index_bytes = file->tag.get_property("BYTES", (int64_t)0);
497 result = file->read_tag();
500 if(file->tag.title_is("/INDEX"))
505 if(file->tag.title_is("OFFSET"))
507 if(current_offset < channels)
509 index_offsets[current_offset++] = file->tag.get_property("FLOAT", 0);
510 //printf("Asset::read_index %d %d\n", current_offset - 1, index_offsets[current_offset - 1]);
518 // Output path is the path of the output file if name truncation is desired.
519 // It is a "" if complete names should be used.
521 int Asset::write(FileXML *file,
531 int Asset::write(ArrayList<PluginServer*> *plugindb,
536 char new_path[BCTEXTLEN];
537 char asset_directory[BCTEXTLEN];
538 char output_directory[BCTEXTLEN];
541 // Make path relative
542 fs.extract_dir(asset_directory, path);
543 if(output_path && output_path[0])
544 fs.extract_dir(output_directory, output_path);
546 output_directory[0] = 0;
548 // Asset and EDL are in same directory. Extract just the name.
549 if(!strcmp(asset_directory, output_directory))
551 fs.extract_name(new_path, path);
555 strcpy(new_path, path);
558 file->tag.set_title("ASSET");
559 file->tag.set_property("SRC", new_path);
561 file->append_newline();
563 file->tag.set_title("FOLDER");
565 file->append_text(folder);
566 file->tag.set_title("/FOLDER");
568 file->append_newline();
570 // Write the format information
571 file->tag.set_title("FORMAT");
573 file->tag.set_property("TYPE",
574 File::formattostr(plugindb, format));
575 file->tag.set_property("USE_HEADER", use_header);
578 file->append_newline();
580 if(audio_data) write_audio(file);
581 if(video_data) write_video(file);
582 if(index_status == 0 && include_index) write_index(file); // index goes after source
584 file->tag.set_title("/ASSET");
586 file->append_newline();
590 int Asset::write_audio(FileXML *file)
592 file->tag.set_title("AUDIO");
593 file->tag.set_property("CHANNELS", channels);
594 file->tag.set_property("RATE", sample_rate);
595 file->tag.set_property("BITS", bits);
596 file->tag.set_property("BYTE_ORDER", byte_order);
597 file->tag.set_property("SIGNED", signed_);
598 file->tag.set_property("HEADER", header);
599 file->tag.set_property("DITHER", dither);
601 file->tag.set_property("ACODEC", acodec);
603 file->tag.set_property("AUDIO_LENGTH", audio_length);
608 file->tag.set_property("AMPEG_BITRATE", ampeg_bitrate);
609 file->tag.set_property("AMPEG_DERIVATIVE", ampeg_derivative);
611 file->tag.set_property("VORBIS_VBR", vorbis_vbr);
612 file->tag.set_property("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
613 file->tag.set_property("VORBIS_BITRATE", vorbis_bitrate);
614 file->tag.set_property("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
616 file->tag.set_property("MP3_BITRATE", mp3_bitrate);
622 file->append_newline();
626 int Asset::write_video(FileXML *file)
628 file->tag.set_title("VIDEO");
629 file->tag.set_property("HEIGHT", height);
630 file->tag.set_property("WIDTH", width);
631 file->tag.set_property("LAYERS", layers);
632 file->tag.set_property("FRAMERATE", frame_rate);
634 file->tag.set_property("VCODEC", vcodec);
636 file->tag.set_property("VIDEO_LENGTH", video_length);
640 file->tag.set_property("JPEG_QUALITY", jpeg_quality);
642 file->tag.set_property("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
643 file->tag.set_property("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
644 file->tag.set_property("VMPEG_PROGRESSIVE", vmpeg_progressive);
645 file->tag.set_property("VMPEG_DENOISE", vmpeg_denoise);
646 file->tag.set_property("VMPEG_BITRATE", vmpeg_bitrate);
647 file->tag.set_property("VMPEG_DERIVATIVE", vmpeg_derivative);
648 file->tag.set_property("VMPEG_QUANTIZATION", vmpeg_quantization);
649 file->tag.set_property("VMPEG_CMODEL", vmpeg_cmodel);
650 file->tag.set_property("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
651 file->tag.set_property("VMPEG_SEQ_CODES", vmpeg_seq_codes);
654 file->tag.set_property("DIVX_BITRATE", divx_bitrate);
655 file->tag.set_property("DIVX_RC_PERIOD", divx_rc_period);
656 file->tag.set_property("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
657 file->tag.set_property("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
658 file->tag.set_property("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
659 file->tag.set_property("DIVX_MAX_QUANTIZER", divx_max_quantizer);
660 file->tag.set_property("DIVX_MIN_QUANTIZER", divx_min_quantizer);
661 file->tag.set_property("DIVX_QUANTIZER", divx_quantizer);
662 file->tag.set_property("DIVX_QUALITY", divx_quality);
663 file->tag.set_property("DIVX_FIX_BITRATE", divx_fix_bitrate);
664 file->tag.set_property("DIVX_USE_DEBLOCKING", divx_use_deblocking);
667 file->tag.set_property("MS_BITRATE", ms_bitrate);
668 file->tag.set_property("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
669 file->tag.set_property("MS_INTERLACED", ms_interlaced);
670 file->tag.set_property("MS_QUANTIZATION", ms_quantization);
671 file->tag.set_property("MS_GOP_SIZE", ms_gop_size);
672 file->tag.set_property("MS_FIX_BITRATE", ms_fix_bitrate);
676 file->tag.set_property("PNG_USE_ALPHA", png_use_alpha);
683 file->append_newline();
687 int Asset::write_index(FileXML *file)
689 file->tag.set_title("INDEX");
690 file->tag.set_property("ZOOM", index_zoom);
691 file->tag.set_property("BYTES", index_bytes);
693 file->append_newline();
697 for(int i = 0; i < channels; i++)
699 file->tag.set_title("OFFSET");
700 file->tag.set_property("FLOAT", index_offsets[i]);
705 file->append_newline();
706 file->tag.set_title("/INDEX");
708 file->append_newline();
715 char* Asset::construct_param(char *param, char *prefix, char *return_value)
718 sprintf(return_value, "%s%s", prefix, param);
720 strcpy(return_value, param);
724 #define UPDATE_DEFAULT(x, y) defaults->update(construct_param(x, prefix, string), y);
725 #define GET_DEFAULT(x, y) defaults->get(construct_param(x, prefix, string), y);
727 void Asset::load_defaults(Defaults *defaults,
735 char string[BCTEXTLEN];
737 // Can't save codec here because it's specific to render, record, and effect.
738 // The codec has to be UNKNOWN for file probing to work.
742 GET_DEFAULT("PATH", path);
747 GET_DEFAULT("AUDIO_CODEC", acodec);
748 GET_DEFAULT("VIDEO_CODEC", vcodec);
753 format = GET_DEFAULT("FORMAT", format);
758 audio_data = GET_DEFAULT("AUDIO", 1);
759 video_data = GET_DEFAULT("VIDEO", 1);
764 bits = GET_DEFAULT("BITS", 16);
765 dither = GET_DEFAULT("DITHER", 0);
766 signed_ = GET_DEFAULT("SIGNED", 1);
767 byte_order = GET_DEFAULT("BYTE_ORDER", 1);
770 ampeg_bitrate = GET_DEFAULT("AMPEG_BITRATE", ampeg_bitrate);
771 ampeg_derivative = GET_DEFAULT("AMPEG_DERIVATIVE", ampeg_derivative);
773 vorbis_vbr = GET_DEFAULT("VORBIS_VBR", vorbis_vbr);
774 vorbis_min_bitrate = GET_DEFAULT("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
775 vorbis_bitrate = GET_DEFAULT("VORBIS_BITRATE", vorbis_bitrate);
776 vorbis_max_bitrate = GET_DEFAULT("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
778 mp3_bitrate = GET_DEFAULT("MP3_BITRATE", mp3_bitrate);
782 jpeg_quality = GET_DEFAULT("JPEG_QUALITY", jpeg_quality);
784 // MPEG format information
785 vmpeg_iframe_distance = GET_DEFAULT("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
786 vmpeg_bframe_distance = GET_DEFAULT("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
787 vmpeg_progressive = GET_DEFAULT("VMPEG_PROGRESSIVE", vmpeg_progressive);
788 vmpeg_denoise = GET_DEFAULT("VMPEG_DENOISE", vmpeg_denoise);
789 vmpeg_bitrate = GET_DEFAULT("VMPEG_BITRATE", vmpeg_bitrate);
790 vmpeg_derivative = GET_DEFAULT("VMPEG_DERIVATIVE", vmpeg_derivative);
791 vmpeg_quantization = GET_DEFAULT("VMPEG_QUANTIZATION", vmpeg_quantization);
792 vmpeg_cmodel = GET_DEFAULT("VMPEG_CMODEL", vmpeg_cmodel);
793 vmpeg_fix_bitrate = GET_DEFAULT("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
794 vmpeg_seq_codes = GET_DEFAULT("VMPEG_SEQ_CODES", vmpeg_seq_codes);
797 divx_bitrate = GET_DEFAULT("DIVX_BITRATE", divx_bitrate);
798 divx_rc_period = GET_DEFAULT("DIVX_RC_PERIOD", divx_rc_period);
799 divx_rc_reaction_ratio = GET_DEFAULT("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
800 divx_rc_reaction_period = GET_DEFAULT("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
801 divx_max_key_interval = GET_DEFAULT("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
802 divx_max_quantizer = GET_DEFAULT("DIVX_MAX_QUANTIZER", divx_max_quantizer);
803 divx_min_quantizer = GET_DEFAULT("DIVX_MIN_QUANTIZER", divx_min_quantizer);
804 divx_quantizer = GET_DEFAULT("DIVX_QUANTIZER", divx_quantizer);
805 divx_quality = GET_DEFAULT("DIVX_QUALITY", divx_quality);
806 divx_fix_bitrate = GET_DEFAULT("DIVX_FIX_BITRATE", divx_fix_bitrate);
807 divx_use_deblocking = GET_DEFAULT("DIVX_USE_DEBLOCKING", divx_use_deblocking);
809 ms_bitrate = GET_DEFAULT("MS_BITRATE", ms_bitrate);
810 ms_bitrate_tolerance = GET_DEFAULT("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
811 ms_interlaced = GET_DEFAULT("MS_INTERLACED", ms_interlaced);
812 ms_quantization = GET_DEFAULT("MS_QUANTIZATION", ms_quantization);
813 ms_gop_size = GET_DEFAULT("MS_GOP_SIZE", ms_gop_size);
814 ms_fix_bitrate = GET_DEFAULT("MS_FIX_BITRATE", ms_fix_bitrate);
817 png_use_alpha = GET_DEFAULT("PNG_USE_ALPHA", png_use_alpha);
820 void Asset::save_defaults(Defaults *defaults,
828 char string[BCTEXTLEN];
830 UPDATE_DEFAULT("PATH", path);
834 UPDATE_DEFAULT("FORMAT", format);
839 UPDATE_DEFAULT("AUDIO", audio_data);
840 UPDATE_DEFAULT("VIDEO", video_data);
845 UPDATE_DEFAULT("AUDIO_CODEC", acodec);
846 UPDATE_DEFAULT("VIDEO_CODEC", vcodec);
851 UPDATE_DEFAULT("BITS", bits);
852 UPDATE_DEFAULT("DITHER", dither);
853 UPDATE_DEFAULT("SIGNED", signed_);
854 UPDATE_DEFAULT("BYTE_ORDER", byte_order);
857 UPDATE_DEFAULT("AMPEG_BITRATE", ampeg_bitrate);
858 UPDATE_DEFAULT("AMPEG_DERIVATIVE", ampeg_derivative);
860 UPDATE_DEFAULT("VORBIS_VBR", vorbis_vbr);
861 UPDATE_DEFAULT("VORBIS_MIN_BITRATE", vorbis_min_bitrate);
862 UPDATE_DEFAULT("VORBIS_BITRATE", vorbis_bitrate);
863 UPDATE_DEFAULT("VORBIS_MAX_BITRATE", vorbis_max_bitrate);
865 UPDATE_DEFAULT("MP3_BITRATE", mp3_bitrate);
871 UPDATE_DEFAULT("JPEG_QUALITY", jpeg_quality);
873 // MPEG format information
874 UPDATE_DEFAULT("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance);
875 UPDATE_DEFAULT("VMPEG_BFRAME_DISTANCE", vmpeg_bframe_distance);
876 UPDATE_DEFAULT("VMPEG_PROGRESSIVE", vmpeg_progressive);
877 UPDATE_DEFAULT("VMPEG_DENOISE", vmpeg_denoise);
878 UPDATE_DEFAULT("VMPEG_BITRATE", vmpeg_bitrate);
879 UPDATE_DEFAULT("VMPEG_DERIVATIVE", vmpeg_derivative);
880 UPDATE_DEFAULT("VMPEG_QUANTIZATION", vmpeg_quantization);
881 UPDATE_DEFAULT("VMPEG_CMODEL", vmpeg_cmodel);
882 UPDATE_DEFAULT("VMPEG_FIX_BITRATE", vmpeg_fix_bitrate);
883 UPDATE_DEFAULT("VMPEG_SEQ_CODES", vmpeg_seq_codes);
887 UPDATE_DEFAULT("DIVX_BITRATE", divx_bitrate);
888 UPDATE_DEFAULT("DIVX_RC_PERIOD", divx_rc_period);
889 UPDATE_DEFAULT("DIVX_RC_REACTION_RATIO", divx_rc_reaction_ratio);
890 UPDATE_DEFAULT("DIVX_RC_REACTION_PERIOD", divx_rc_reaction_period);
891 UPDATE_DEFAULT("DIVX_MAX_KEY_INTERVAL", divx_max_key_interval);
892 UPDATE_DEFAULT("DIVX_MAX_QUANTIZER", divx_max_quantizer);
893 UPDATE_DEFAULT("DIVX_MIN_QUANTIZER", divx_min_quantizer);
894 UPDATE_DEFAULT("DIVX_QUANTIZER", divx_quantizer);
895 UPDATE_DEFAULT("DIVX_QUALITY", divx_quality);
896 UPDATE_DEFAULT("DIVX_FIX_BITRATE", divx_fix_bitrate);
897 UPDATE_DEFAULT("DIVX_USE_DEBLOCKING", divx_use_deblocking);
900 UPDATE_DEFAULT("MS_BITRATE", ms_bitrate);
901 UPDATE_DEFAULT("MS_BITRATE_TOLERANCE", ms_bitrate_tolerance);
902 UPDATE_DEFAULT("MS_INTERLACED", ms_interlaced);
903 UPDATE_DEFAULT("MS_QUANTIZATION", ms_quantization);
904 UPDATE_DEFAULT("MS_GOP_SIZE", ms_gop_size);
905 UPDATE_DEFAULT("MS_FIX_BITRATE", ms_fix_bitrate);
907 UPDATE_DEFAULT("PNG_USE_ALPHA", png_use_alpha);
918 int Asset::update_path(char *new_path)
920 strcpy(path, new_path);
924 void Asset::update_index(Asset *asset)
926 //printf("Asset::update_index 1 %d\n", index_status);
927 index_status = asset->index_status;
928 index_zoom = asset->index_zoom; // zoom factor of index data
929 index_start = asset->index_start; // byte start of index data in the index file
930 index_bytes = asset->index_bytes; // Total bytes in source file for comparison before rebuilding the index
931 index_end = asset->index_end;
932 old_index_end = asset->old_index_end; // values for index build
933 //printf("Asset::update_index 1\n");
937 delete [] index_offsets;
941 if(asset->index_offsets)
943 index_offsets = new int64_t[asset->channels];
944 //printf("Asset::update_index 1\n");
947 for(i = 0; i < asset->channels; i++)
949 index_offsets[i] = asset->index_offsets[i]; // offsets of channels in index file in floats
953 //printf("Asset::update_index 1\n");
954 index_buffer = asset->index_buffer; // pointer
955 //printf("Asset::update_index 2\n");
961 printf(" asset::dump\n");
962 printf(" %p %s\n", this, path);
963 printf(" index_status %d\n", index_status);
964 printf(" format %d\n", format);
965 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",
966 audio_data, channels, sample_rate, bits, byte_order, signed_, header, dither, acodec[0], acodec[1], acodec[2], acodec[3]);
967 printf(" audio_length %lld\n", audio_length);
968 printf(" video_data %d layers %d framerate %f width %d height %d vcodec %c%c%c%c\n",
969 video_data, layers, frame_rate, width, height, vcodec[0], vcodec[1], vcodec[2], vcodec[3]);
970 printf(" video_length %lld \n", video_length);