diff options
-rw-r--r-- | source/blender/quicktime/apple/quicktime_export.c | 15 | ||||
-rw-r--r-- | source/blender/quicktime/apple/quicktime_import.c | 48 | ||||
-rw-r--r-- | source/blender/quicktime/quicktime_import.h | 2 |
3 files changed, 61 insertions, 4 deletions
diff --git a/source/blender/quicktime/apple/quicktime_export.c b/source/blender/quicktime/apple/quicktime_export.c index ec9d9a4f1d6..a55a6ab3e36 100644 --- a/source/blender/quicktime/apple/quicktime_export.c +++ b/source/blender/quicktime/apple/quicktime_export.c @@ -65,9 +65,12 @@ DONE: #include "MEM_guardedalloc.h" #include "render.h" +#include "quicktime_import.h" #include "quicktime_export.h" #ifdef _WIN32 +#include <stdio.h> +#include "BLI_winstuff.h" #include <FixMath.h> #include <QTML.h> #include <TextUtils.h> @@ -497,6 +500,9 @@ void start_qt(void) { #ifdef __APPLE__ int myFile; FSRef myRef; +#else + char *qtname; + FILE *myFile = NULL; #endif if(qte == NULL) qte = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport"); @@ -522,9 +528,10 @@ void start_qt(void) { sframe = (G.scene->r.sfra); makeqtstring(name); - sprintf(theFullPath, "%s", name); #ifdef __APPLE__ + sprintf(theFullPath, "%s", name); + /* hack: create an empty file to make FSPathMakeRef() happy */ myFile = open(theFullPath, O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRUSR|S_IWUSR); if (myFile < 0) { @@ -537,6 +544,10 @@ void start_qt(void) { err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &qte->theSpec, NULL); CheckError(err, "FsGetCatalogInfoRef error"); #else + qtname = get_valid_qtname(name); + sprintf(theFullPath, "%s", qtname); + MEM_freeN(qtname); + CopyCStringToPascal(theFullPath, qte->qtfilename); err = FSMakeFSSpec(0, 0L, qte->qtfilename, &qte->theSpec); #endif @@ -549,7 +560,7 @@ void start_qt(void) { &qte->theMovie ); CheckError(err, "CreateMovieFile error"); - printf("Created QuickTime movie: %s\n", name); + printf("Created QuickTime movie: %s\n", qtname); QT_CreateMyVideoTrack(); } diff --git a/source/blender/quicktime/apple/quicktime_import.c b/source/blender/quicktime/apple/quicktime_import.c index 4530921aefe..e5359a8b4c0 100644 --- a/source/blender/quicktime/apple/quicktime_import.c +++ b/source/blender/quicktime/apple/quicktime_import.c @@ -37,6 +37,7 @@ #include "IMB_anim.h" #include "BLO_sys_types.h" #include "BKE_global.h" +#include "BLI_dynstr.h" #ifdef __APPLE__ #include <QuickTime/Movies.h> @@ -99,6 +100,37 @@ void quicktime_exit(void) } +#ifdef _WIN32 +char *get_valid_qtname(char *name) +{ + TCHAR Buffer[MAX_PATH]; + DWORD dwRet; + char *qtname; + DynStr *ds= BLI_dynstr_new(); + + dwRet = GetCurrentDirectory(MAX_PATH, Buffer); + + if(name[1] != ':') { + char drive[2]; + + drive[0] = Buffer[0]; + drive[1] = '\0'; + + BLI_dynstr_append(ds, drive); + BLI_dynstr_append(ds, ":"); + BLI_dynstr_append(ds, name); + } else { + BLI_dynstr_append(ds, name); + } + + qtname= BLI_dynstr_get_cstring(ds); + BLI_dynstr_free(ds); + + return qtname; +} +#endif /* _WIN32 */ + + int anim_is_quicktime (char *name) { FSSpec theFSSpec; @@ -111,6 +143,7 @@ int anim_is_quicktime (char *name) FInfo myFinderInfo; FSRef myRef; #else + char *qtname; Str255 dst; #endif OSErr err = noErr; @@ -129,11 +162,16 @@ int anim_is_quicktime (char *name) if(QTIME_DEBUG) printf("qt: checking as movie\n"); - sprintf(theFullPath, "%s", name); #ifdef __APPLE__ + sprintf(theFullPath, "%s", name); + err = FSPathMakeRef(theFullPath, &myRef, 0); err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL); #else + qtname = get_valid_qtname(name); + sprintf(theFullPath, "%s", qtname); + MEM_freeN(qtname); + CopyCStringToPascal(theFullPath, dst); err = FSMakeFSSpec(0, 0L, dst, &theFSSpec); #endif @@ -349,6 +387,7 @@ int startquicktime (struct anim *anim) #ifdef __APPLE__ FSRef myRef; #else + char *qtname; Str255 dst; #endif @@ -361,12 +400,17 @@ int startquicktime (struct anim *anim) } if(QTIME_DEBUG) printf("qt: attempting to load as movie %s\n", anim->name); - sprintf(theFullPath, "%s", anim->name); #ifdef __APPLE__ + sprintf(theFullPath, "%s", anim->name); + err = FSPathMakeRef(theFullPath, &myRef, 0); err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &theFSSpec, NULL); #else + qtname = get_valid_qtname(anim->name); + sprintf(theFullPath, "%s", qtname); + MEM_freeN(qtname); + CopyCStringToPascal(theFullPath, dst); FSMakeFSSpec(0, 0L, dst, &theFSSpec); #endif diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h index a99827eb2f3..39434a92a85 100644 --- a/source/blender/quicktime/quicktime_import.h +++ b/source/blender/quicktime/quicktime_import.h @@ -85,6 +85,8 @@ typedef struct _QuicktimeMovie { int have_gw; //ugly } QuicktimeMovie; +char *get_valid_qtname(char *name); + // quicktime movie import functions |