#include <stdarg.h>
#include <ctype.h>
#include <limits.h>
+#include <time.h>
// work arounds (centos)
#include <lzma.h>
#ifndef INT64_MAX
#include "filecr2.h"
#include "filedb.h"
#include "filedv.h"
+#include "filedpx.h"
#include "fileexr.h"
#include "fileffmpeg.h"
#include "fileflac.h"
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,
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:
case FILE_MPEG:
case FILE_FFMPEG:
return 1;
+ case FILE_DPX:
case FILE_EXR:
case FILE_JPEG:
case FILE_PNG:
"PNG",
"PPM",
"JPEG",
+#ifdef HAVE_GIFLIB
"GIF",
+#endif
+#ifdef HAVE_LIBDPX
+ "DPX",
+#endif
#ifdef HAVE_OPENEXR
"EXR",
#endif
"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]);
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);
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;
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);
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;
}
+// 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 ) {
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;
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
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);
#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);
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";
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";
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, '/');
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);
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);
}