X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Ffile.C;h=03941d9a0fceb32a38067e3d8bd82420c2034c92;hp=dbcd68899a5e150fe5e79d256fe0276fbefeb1f6;hb=HEAD;hpb=c57aa3e2800e06f890e644dc54c9e0bba6d0851a diff --git a/cinelerra-5.1/cinelerra/file.C b/cinelerra-5.1/cinelerra/file.C index dbcd6889..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 @@ -45,6 +46,7 @@ #include "filecr2.h" #include "filedb.h" #include "filedv.h" +#include "filedpx.h" #include "fileexr.h" #include "fileffmpeg.h" #include "fileflac.h" @@ -210,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: @@ -246,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; @@ -278,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: @@ -378,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 @@ -390,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]); @@ -455,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); @@ -463,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; @@ -582,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; @@ -658,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 ) { @@ -1262,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; @@ -1306,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 @@ -1317,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); @@ -1398,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); @@ -1533,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"; @@ -1583,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"; @@ -1609,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, '/');