update libaom via Andrew + 0006 patch LIBZMPEG
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / file.C
index 9828d6ec327527251fc5ef79bac7285bf3f34ddb..dbcd68899a5e150fe5e79d256fe0276fbefeb1f6 100644 (file)
@@ -26,6 +26,7 @@
 #include <stdarg.h>
 #include <ctype.h>
 #include <limits.h>
+#include <time.h>
 // work arounds (centos)
 #include <lzma.h>
 #ifndef INT64_MAX
@@ -173,10 +174,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,
@@ -542,9 +545,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);
@@ -1647,11 +1652,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 +1671,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);
 }