X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fasset.C;h=ec82d0e9e6ead12eb2d7e245f161a5579303b35b;hp=fd17a1422a89b9bfdcca138e25f47ab5085b9f85;hb=09ccfde5a1fd65069f69b37490462b7ccf38a336;hpb=101d92b4c50a831fb00edd65df57de41b408c7b6 diff --git a/cinelerra-5.1/cinelerra/asset.C b/cinelerra-5.1/cinelerra/asset.C index fd17a142..ec82d0e9 100644 --- a/cinelerra-5.1/cinelerra/asset.C +++ b/cinelerra-5.1/cinelerra/asset.C @@ -72,7 +72,6 @@ int Asset::init_values() path[0] = 0; // Has to be unknown for file probing to succeed format = FILE_UNKNOWN; - fformat[0] = 0; bits = 0; byte_order = 0; signed_ = 0; @@ -84,11 +83,15 @@ int Asset::init_values() strcpy(vcodec, ""); strcpy(acodec, ""); + strcpy(fformat,"mp4"); ff_audio_options[0] = 0; - ff_video_options[0] = 0; + ff_sample_format[0] = 0; ff_audio_bitrate = 0; + ff_audio_quality = -1; + ff_video_options[0] = 0; + ff_pixel_format[0] = 0; ff_video_bitrate = 0; - ff_video_quality = 0; + ff_video_quality = -1; jpeg_quality = 80; aspect_ratio = -1; @@ -96,6 +99,7 @@ int Asset::init_values() interlace_mode = ILACE_MODE_UNDETECTED; interlace_fixmethod = ILACE_FIXMETHOD_NONE; + mp3_bitrate = 224; ampeg_bitrate = 256; ampeg_derivative = 3; @@ -128,15 +132,17 @@ int Asset::init_values() ac3_bitrate = 128; png_use_alpha = 0; + exr_use_alpha = 0; exr_compression = 0; tiff_cmodel = 0; tiff_compression = 0; + mov_sphere = 0; + jpeg_sphere = 0; use_header = 1; id = EDL::next_id(); - reset_timecode(); return 0; } @@ -175,17 +181,6 @@ void Asset::boundaries() //printf("Asset::boundaries %d %d %f\n", __LINE__, sample_rate, frame_rate); } -int Asset::reset_timecode() -{ - strcpy(reel_name, "cin0000"); - reel_number = 0; - tcstart = 0; - tcend = 0; - tcformat = 0; - - return 0; -} - void Asset::copy_from(Asset *asset, int do_index) { copy_location(asset); @@ -231,8 +226,11 @@ void Asset::copy_format(Asset *asset, int do_index) strcpy(acodec, asset->acodec); strcpy(ff_audio_options, asset->ff_audio_options); - strcpy(ff_video_options, asset->ff_video_options); + strcpy(ff_sample_format, asset->ff_sample_format); ff_audio_bitrate = asset->ff_audio_bitrate; + ff_audio_quality = asset->ff_audio_quality; + strcpy(ff_video_options, asset->ff_video_options); + strcpy(ff_pixel_format, asset->ff_pixel_format); ff_video_bitrate = asset->ff_video_bitrate; ff_video_quality = asset->ff_video_quality; @@ -282,12 +280,10 @@ void Asset::copy_format(Asset *asset, int do_index) tiff_cmodel = asset->tiff_cmodel; tiff_compression = asset->tiff_compression; - - strcpy(reel_name, asset->reel_name); - reel_number = asset->reel_number; - tcstart = asset->tcstart; - tcend = asset->tcend; - tcformat = asset->tcformat; + + + mov_sphere = asset->mov_sphere; + jpeg_sphere = asset->jpeg_sphere; } int64_t Asset::get_index_offset(int channel) @@ -332,21 +328,23 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl) if( out_path ) { if( *apath != '/' ) { char *cp = cstrcat(2, out_path, apath); - delete [] apath; apath = cp; + delete [] apath; apath = FileSystem::basepath(cp); + delete [] cp; } if( *tpath != '/' ) { char *cp = cstrcat(2, out_path, tpath); - delete [] tpath; tpath = cp; + delete [] tpath; tpath = FileSystem::basepath(cp); + delete [] cp; } } - if( strcmp(apath, tpath) ) result = 1; + if( strcmp(apath, tpath) ) result = 0; delete [] apath; delete [] tpath; delete [] out_path; } - if(result && format == FILE_FFMPEG) - result = !strcmp(fformat, asset.fformat); + if(result && format == FILE_FFMPEG && strcmp(fformat, asset.fformat) ) + result = 0; if(test_audio && result) { @@ -360,8 +358,9 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl) !strcmp(acodec, asset.acodec)); if(result && format == FILE_FFMPEG) result = !strcmp(ff_audio_options, asset.ff_audio_options) && - ff_audio_bitrate == asset.ff_audio_bitrate; - + !strcmp(ff_sample_format, asset.ff_sample_format) && + ff_audio_bitrate == asset.ff_audio_bitrate && + ff_audio_quality == asset.ff_audio_quality; } @@ -376,13 +375,11 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl) width == asset.width && height == asset.height && !strcmp(vcodec, asset.vcodec) && - strcmp(reel_name, asset.reel_name) == 0 && - reel_number == asset.reel_number && - tcstart == asset.tcstart && - tcend == asset.tcend && - tcformat == asset.tcformat); + mov_sphere == asset.mov_sphere && + jpeg_sphere == asset.jpeg_sphere); if(result && format == FILE_FFMPEG) result = !strcmp(ff_video_options, asset.ff_video_options) && + !strcmp(ff_pixel_format, asset.ff_pixel_format) && ff_video_bitrate == asset.ff_video_bitrate && ff_video_quality == asset.ff_video_quality; } @@ -462,9 +459,7 @@ int Asset::read(FileXML *file, else if(file->tag.title_is("FOLDER")) { - const char *string = file->tag.get_property("NUMBER"); - awindow_folder = string ? atoi(string) : - AWindowGUI::folder_number(file->read_text()); + awindow_folder = file->tag.get_property("NUMBER", AW_MEDIA_FOLDER); } else if(file->tag.title_is("VIDEO")) @@ -505,13 +500,6 @@ int Asset::read_audio(FileXML *file) audio_length = file->tag.get_property("AUDIO_LENGTH", (int64_t)0); acodec[0] = 0; file->tag.get_property("ACODEC", acodec); - - if(!video_data) - { - tcstart = 0; - tcend = audio_length; - tcformat = 0; - } return 0; } @@ -533,6 +521,8 @@ int Asset::read_video(FileXML *file) file->tag.get_property("VCODEC", vcodec); video_length = file->tag.get_property("VIDEO_LENGTH", (int64_t)0); + mov_sphere = file->tag.get_property("MOV_SPHERE", 0); + jpeg_sphere = file->tag.get_property("JPEG_SPHERE", 0); single_frame = file->tag.get_property("SINGLE_FRAME", (int64_t)0); interlace_autofixoption = file->tag.get_property("INTERLACE_AUTOFIX",0); @@ -543,12 +533,6 @@ int Asset::read_video(FileXML *file) ilacefixmethod_to_xmltext(string, ILACE_FIXMETHOD_NONE); interlace_fixmethod = ilacefixmethod_from_xmltext(file->tag.get_property("INTERLACE_FIXMETHOD",string), ILACE_FIXMETHOD_NONE); - file->tag.get_property("REEL_NAME", reel_name); - reel_number = file->tag.get_property("REEL_NUMBER", reel_number); - tcstart = file->tag.get_property("TCSTART", tcstart); - tcend = file->tag.get_property("TCEND", tcend); - tcformat = file->tag.get_property("TCFORMAT", tcformat); - return 0; } @@ -694,6 +678,8 @@ int Asset::write_video(FileXML *file) file->tag.set_property("VCODEC", vcodec); file->tag.set_property("VIDEO_LENGTH", video_length); + file->tag.set_property("MOV_SPHERE", mov_sphere); + file->tag.set_property("JPEG_SPHERE", jpeg_sphere); file->tag.set_property("SINGLE_FRAME", single_frame); file->tag.set_property("INTERLACE_AUTOFIX", interlace_autofixoption); @@ -704,13 +690,6 @@ int Asset::write_video(FileXML *file) ilacefixmethod_to_xmltext(string, interlace_fixmethod); file->tag.set_property("INTERLACE_FIXMETHOD", string); - - file->tag.set_property("REEL_NAME", reel_name); - file->tag.set_property("REEL_NUMBER", reel_number); - file->tag.set_property("TCSTART", tcstart); - file->tag.set_property("TCEND", tcend); - file->tag.set_property("TCFORMAT", tcformat); - file->append_tag(); if(video_data) file->tag.set_title("/VIDEO"); @@ -821,8 +800,11 @@ void Asset::load_defaults(BC_Hash *defaults, theora_keyframe_force_frequency = GET_DEFAULT("THEORA_FORCE_KEYFRAME_FREQUENCY", theora_keyframe_force_frequency); GET_DEFAULT("FF_AUDIO_OPTIONS", ff_audio_options); + GET_DEFAULT("FF_SAMPLE_FORMAT", ff_sample_format); ff_audio_bitrate = GET_DEFAULT("FF_AUDIO_BITRATE", ff_audio_bitrate); + ff_audio_quality = GET_DEFAULT("FF_AUDIO_QUALITY", ff_audio_quality); GET_DEFAULT("FF_VIDEO_OPTIONS", ff_video_options); + GET_DEFAULT("FF_PIXEL_FORMAT", ff_pixel_format); ff_video_bitrate = GET_DEFAULT("FF_VIDEO_BITRATE", ff_video_bitrate); ff_video_quality = GET_DEFAULT("FF_VIDEO_QUALITY", ff_video_quality); @@ -865,12 +847,8 @@ void Asset::load_defaults(BC_Hash *defaults, tiff_cmodel = GET_DEFAULT("TIFF_CMODEL", tiff_cmodel); tiff_compression = GET_DEFAULT("TIFF_COMPRESSION", tiff_compression); - GET_DEFAULT("REEL_NAME", reel_name); - reel_number = GET_DEFAULT("REEL_NUMBER", reel_number); - tcstart = GET_DEFAULT("TCSTART", tcstart); - tcend = GET_DEFAULT("TCEND", tcend); - tcformat = GET_DEFAULT("TCFORMAT", tcformat); - + mov_sphere = GET_DEFAULT("MOV_SPHERE", mov_sphere); + jpeg_sphere = GET_DEFAULT("JPEG_SPHERE", jpeg_sphere); boundaries(); } @@ -916,8 +894,11 @@ void Asset::save_defaults(BC_Hash *defaults, UPDATE_DEFAULT("VORBIS_MAX_BITRATE", vorbis_max_bitrate); UPDATE_DEFAULT("FF_AUDIO_OPTIONS", ff_audio_options); + UPDATE_DEFAULT("FF_SAMPLE_FORMAT", ff_sample_format); UPDATE_DEFAULT("FF_AUDIO_BITRATE", ff_audio_bitrate); + UPDATE_DEFAULT("FF_AUDIO_QUALITY", ff_audio_quality); UPDATE_DEFAULT("FF_VIDEO_OPTIONS", ff_video_options); + UPDATE_DEFAULT("FF_PIXEL_FORMAT", ff_pixel_format); UPDATE_DEFAULT("FF_VIDEO_BITRATE", ff_video_bitrate); UPDATE_DEFAULT("FF_VIDEO_QUALITY", ff_video_quality); @@ -958,8 +939,16 @@ void Asset::save_defaults(BC_Hash *defaults, UPDATE_DEFAULT("EXR_COMPRESSION", exr_compression); UPDATE_DEFAULT("TIFF_CMODEL", tiff_cmodel); UPDATE_DEFAULT("TIFF_COMPRESSION", tiff_compression); + + + + UPDATE_DEFAULT("MOV_SPHERE", mov_sphere); + UPDATE_DEFAULT("JPEG_SPHERE", jpeg_sphere); } + + + if(do_bits) { UPDATE_DEFAULT("BITS", bits); @@ -990,12 +979,6 @@ void Asset::save_defaults(BC_Hash *defaults, UPDATE_DEFAULT("SINGLE_FRAME", single_frame); } - - UPDATE_DEFAULT("REEL_NAME", reel_name); - UPDATE_DEFAULT("REEL_NUMBER", reel_number); - UPDATE_DEFAULT("TCSTART", tcstart); - UPDATE_DEFAULT("TCEND", tcend); - UPDATE_DEFAULT("TCFORMAT", tcformat); } @@ -1014,8 +997,11 @@ int Asset::dump(FILE *fp) fprintf(fp," format %d\n", format); fprintf(fp," fformat=\"%s\"\n", fformat); fprintf(fp," ff_audio_options=\"%s\"\n", ff_audio_options); + fprintf(fp," ff_sample_format=\"%s\"\n", ff_sample_format); fprintf(fp," ff_audio_bitrate=%d\n", ff_audio_bitrate); + fprintf(fp," ff_audio_quality=%d\n", ff_audio_quality); fprintf(fp," ff_video_options=\"%s\"\n", ff_video_options); + fprintf(fp," ff_pixel_format=\"%s\"\n", ff_pixel_format); fprintf(fp," ff_video_bitrate=%d\n", ff_video_bitrate); fprintf(fp," ff_video_quality=%d\n", ff_video_quality); fprintf(fp," audio_data %d channels %d samplerate %d bits %d" @@ -1029,11 +1015,8 @@ int Asset::dump(FILE *fp) " height %d vcodec %4.4s aspect_ratio %f ilace_mode %s\n", video_data, layers, program, frame_rate, width, height, vcodec, aspect_ratio,string); - fprintf(fp," reel_name %s reel_number %i tcstart %jd tcend %jd tcf %d\n", - reel_name, reel_number, tcstart, tcend, tcformat); fprintf(fp," video_length %jd repeat %d\n", video_length, single_frame); - - + printf(" mov_sphere=%d jpeg_sphere=%d\n", mov_sphere, jpeg_sphere); return 0; } @@ -1112,23 +1095,3 @@ double Asset::total_length_framealigned(double fps) return 0; } -int Asset::set_timecode(char *tc, int format, int end) -{ - int hr, min, sec; - - hr = ((int) tc[0] - 48) * 10 + (int) tc[1] - 48; - min = ((int) tc[3] - 48) * 10 + (int) tc[4] - 48; - sec = ((int) tc[6] - 48) * 10 + (int) tc[7] - 48; - - // This needs to be modified to handle drop-frame - - if(end) - tcend = (int64_t) (((hr * 3600) + (min * 60) + sec) * frame_rate); - else - tcstart = (int64_t) (((hr * 3600) + (min * 60) + sec) * frame_rate); - - tcformat = format; - return 0; -} - -