X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ffile.C;h=90ad489f76a3307314789cab03035426f4d6e374;hb=dc5a5d807e75a138eb7534c91e685734c654e93e;hp=9828d6ec327527251fc5ef79bac7285bf3f34ddb;hpb=2441cb0cb7f655fad2f76c982f2ac93897d09dbe;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index 9828d6ec..90ad489f 100644 --- a/cinelerra-5.1/cinelerra/file.C +++ b/cinelerra-5.1/cinelerra/file.C @@ -1,6 +1,7 @@ /* * CINELERRA * Copyright (C) 2010 Adam Williams + * Copyright (C) 2003-2016 Cinelerra CV contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +27,7 @@ #include #include #include +#include // work arounds (centos) #include #ifndef INT64_MAX @@ -44,6 +46,7 @@ #include "filecr2.h" #include "filedb.h" #include "filedv.h" +#include "filedpx.h" #include "fileexr.h" #include "fileffmpeg.h" #include "fileflac.h" @@ -173,10 +176,12 @@ int File::get_options(FormatTools *format, format_completion->lock("File::get_options"); switch( asset->format ) { #ifdef HAVE_CIN_3RDPARTY +#ifdef HAVE_LIBZMPEG case FILE_AC3: FileAC3::get_parameters(parent_window, asset, format_window, audio_options, video_options, edl); break; #endif +#endif #ifdef HAVE_DV case FILE_RAWDV: FileDV::get_parameters(parent_window, asset, format_window, @@ -207,6 +212,13 @@ int File::get_options(FormatTools *format, FileJPEG::get_parameters(parent_window, asset, format_window, audio_options, video_options, edl); break; +#ifdef HAVE_LIBDPX + case FILE_DPX: + case FILE_DPX_LIST: + FileDPX::get_parameters(parent_window, asset, format_window, + audio_options, video_options, edl); + break; +#endif #ifdef HAVE_OPENEXR case FILE_EXR: case FILE_EXR_LIST: @@ -243,6 +255,10 @@ int File::get_options(FormatTools *format, FileOGG::get_parameters(parent_window, asset, format_window, audio_options, video_options, edl); break; + case FILE_VORBIS: + FileVorbis::get_parameters(parent_window, asset, format_window, + audio_options, video_options, edl); + break; #endif default: break; @@ -275,6 +291,7 @@ int File::can_scale_input(Asset *asset) case FILE_MPEG: case FILE_FFMPEG: return 1; + case FILE_DPX: case FILE_EXR: case FILE_JPEG: case FILE_PNG: @@ -375,7 +392,12 @@ const char *File::default_probes[] = { "PNG", "PPM", "JPEG", +#ifdef HAVE_GIFLIB "GIF", +#endif +#ifdef HAVE_LIBDPX + "DPX", +#endif #ifdef HAVE_OPENEXR "EXR", #endif @@ -387,9 +409,11 @@ const char *File::default_probes[] = { "OGG", "Vorbis", #endif +#ifdef HAVE_LIBZMPEG "MPEG", +#endif "EDL", - "FFMPEG_Late", + "FFMPEG_Late", }; const int File::nb_probes = sizeof(File::default_probes)/sizeof(File::default_probes[0]); @@ -452,6 +476,7 @@ int File::probe() file = new FileJPEG(this->asset, this); return FILE_OK; } +#ifdef HAVE_GIFLIB if( !strcmp(pref->name,"GIF") ) { // GIF file if( FileGIFList::check_sig(this->asset) ) file = new FileGIFList(this->asset, this); @@ -460,6 +485,14 @@ int File::probe() else continue; return FILE_OK; } +#endif +#ifdef HAVE_LIBDPX + if( !strcmp(pref->name,"DPX") ) { // DPX file + if( !FileDPX::check_sig(this->asset, data) ) continue; + file = new FileDPX(this->asset, this); + return FILE_OK; + } +#endif #ifdef HAVE_OPENEXR if( !strcmp(pref->name,"EXR") ) { // EXR file if( !FileEXR::check_sig(this->asset, data)) continue; @@ -542,9 +575,11 @@ int File::open_file(Preferences *preferences, break; } // format already determined #ifdef HAVE_CIN_3RDPARTY +#ifdef HAVE_LIBZMPEG case FILE_AC3: file = new FileAC3(this->asset, this); break; +#endif #endif case FILE_SCENE: file = new FileScene(this->asset, this); @@ -577,20 +612,27 @@ int File::open_file(Preferences *preferences, case FILE_JPEG_LIST: file = new FileJPEG(this->asset, this); break; - +#ifdef HAVE_GIFLIB case FILE_GIF: file = new FileGIF(this->asset, this); break; case FILE_GIF_LIST: file = new FileGIFList(this->asset, this); break; - +#endif +#ifdef HAVE_LIBDPX + case FILE_DPX: + case FILE_DPX_LIST: + file = new FileDPX(this->asset, this); + break; +#endif #ifdef HAVE_OPENEXR case FILE_EXR: case FILE_EXR_LIST: file = new FileEXR(this->asset, this); break; #endif + case FILE_FLAC: file = new FileFLAC(this->asset, this); break; @@ -653,6 +695,17 @@ int File::open_file(Preferences *preferences, } +// If file type is a list verify that all files match in dimensions. +// Should be done only after the file open function has been performed +// Reason: although this function checks if file exists or not but +// it has no way of relaying this information back and if this function +// is called before open_file the program may accidently interpret file +// not found as file size don't match + if( !file->verify_file_list() ) { + delete file; file = 0; + return FILE_SIZE_DONT_MATCH; + } + // Set extra writing parameters to mandatory settings. if( wr ) { @@ -1257,6 +1310,8 @@ int File::strtoformat(const char *format) if( !strcasecmp(format, _(TIFF_LIST_NAME)) ) return FILE_TIFF_LIST; if( !strcasecmp(format, _(JPEG_NAME)) ) return FILE_JPEG; if( !strcasecmp(format, _(JPEG_LIST_NAME)) ) return FILE_JPEG_LIST; + if( !strcasecmp(format, _(DPX_NAME)) ) return FILE_DPX; + if( !strcasecmp(format, _(DPX_LIST_NAME)) ) return FILE_DPX_LIST; if( !strcasecmp(format, _(EXR_NAME)) ) return FILE_EXR; if( !strcasecmp(format, _(EXR_LIST_NAME)) ) return FILE_EXR_LIST; if( !strcasecmp(format, _(FLAC_NAME)) ) return FILE_FLAC; @@ -1301,6 +1356,8 @@ const char* File::formattostr(int format) case FILE_FLAC: return _(FLAC_NAME); case FILE_GIF: return _(GIF_NAME); case FILE_GIF_LIST: return _(GIF_LIST_NAME); + case FILE_DPX: return _(DPX_NAME); + case FILE_DPX_LIST: return _(DPX_LIST_NAME); case FILE_EXR: return _(EXR_NAME); case FILE_EXR_LIST: return _(EXR_LIST_NAME); #ifdef HAVE_LIBZMPEG @@ -1312,8 +1369,10 @@ const char* File::formattostr(int format) case FILE_TGA_LIST: return _(TGA_LIST_NAME); case FILE_TIFF: return _(TIFF_NAME); case FILE_TIFF_LIST: return _(TIFF_LIST_NAME); +#ifdef HAVE_OGG case FILE_OGG: return _(OGG_NAME); case FILE_VORBIS: return _(VORBIS_NAME); +#endif case FILE_RAWDV: return _(RAWDV_NAME); case FILE_FFMPEG: return _(FFMPEG_NAME); case FILE_DB: return _(DBASE_NAME); @@ -1393,6 +1452,10 @@ int File::get_best_colormodel(Asset *asset, int driver) #endif case FILE_JPEG: case FILE_JPEG_LIST: return FileJPEG::get_best_colormodel(asset, driver); +#ifdef HAVE_LIBDPX + case FILE_DPX: + case FILE_DPX_LIST: return FileDPX::get_best_colormodel(asset, driver); +#endif #ifdef HAVE_OPENEXR case FILE_EXR: case FILE_EXR_LIST: return FileEXR::get_best_colormodel(asset, driver); @@ -1528,7 +1591,9 @@ const char* File::get_tag(int format) case FILE_AU: return "au"; case FILE_RAWDV: return "dv"; case FILE_DB: return "db"; + case FILE_DPX: return "dpx"; case FILE_EXR: return "exr"; + case FILE_DPX_LIST: return "dpxs"; case FILE_EXR_LIST: return "exrs"; case FILE_FLAC: return "flac"; case FILE_JPEG: return "jpg"; @@ -1578,6 +1643,8 @@ const char* File::get_prefix(int format) case FILE_PNG_LIST: return "PNG_LIST"; case FILE_PPM_LIST: return "PPM_LIST"; case FILE_AC3: return "AC3"; + case FILE_DPX: return "DPX"; + case FILE_DPX_LIST: return "DPX_LIST"; case FILE_EXR: return "EXR"; case FILE_EXR_LIST: return "EXR_LIST"; case FILE_CR2: return "CR2"; @@ -1604,7 +1671,14 @@ int File::record_fd() void File::get_exe_path(char *result, char *bnp) { // Get executable path, basename +#if !defined(__FreeBSD__) int len = readlink("/proc/self/exe", result, BCTEXTLEN-1); +#else + char exe_path[BCTEXTLEN]; + sprintf(exe_path,"/proc/%d/file",getpid()); + int len = readlink(exe_path, result, BCTEXTLEN-1); +#endif + if( len >= 0 ) { result[len] = 0; char *ptr = strrchr(result, '/'); @@ -1647,11 +1721,15 @@ void File::setenv_path(const char *var, const char *path, int overwrite) getenv_path(env_path, path); setenv(var, env_path, overwrite); } - -void File::init_cin_path() +/** +* @brief Set various environment variables to pass constant values to +* forks, shell scripts, and other parts of CinGG. +*/ +void File::init_cin_env_vars() { - char env_path[BCTEXTLEN], env_pkg[BCTEXTLEN]; -// these values are advertised for forks/shell scripts + char env_path[BCTEXTLEN], env_pkg[BCTEXTLEN], build_name[32], dateTimeText[32]; + struct stat st; + struct tm *dateTime; get_exe_path(env_path, env_pkg); setenv_path("CIN_PATH", env_path, 1); setenv_path("CIN_PKG", env_pkg, 1); @@ -1662,5 +1740,12 @@ void File::init_cin_path() setenv_path("CIN_LADSPA", LADSPA_DIR, 0); setenv_path("CIN_LOCALE", LOCALE_DIR, 0); setenv_path("CIN_BROWSER", CIN_BROWSER, 0); +// Create env_var CINGG_BUILD for use when running as AppImage + stat(env_path, &st); + dateTime = gmtime(&st.st_mtime); + strftime(dateTimeText, sizeof(dateTimeText), "%Y%m%d_%H%M%S", dateTime); + snprintf(build_name, sizeof(build_name), "CINGG_%s", dateTimeText); + build_name[sizeof(build_name) - 1] = 0; + setenv_path("CINGG_BUILD", build_name, 1); }