Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/quicktime')
-rw-r--r--source/blender/quicktime/apple/qtkit_export.m50
-rw-r--r--source/blender/quicktime/quicktime_export.h6
2 files changed, 44 insertions, 12 deletions
diff --git a/source/blender/quicktime/apple/qtkit_export.m b/source/blender/quicktime/apple/qtkit_export.m
index cbc76e26aa9..4214fa9ac32 100644
--- a/source/blender/quicktime/apple/qtkit_export.m
+++ b/source/blender/quicktime/apple/qtkit_export.m
@@ -219,10 +219,21 @@ static NSString *stringWithCodecType(int codecType)
return [NSString stringWithCString:str encoding:NSASCIIStringEncoding];
}
-void makeqtstring(RenderData *rd, char *string)
+void makeqtstring(RenderData *rd, char *string, bool preview)
{
+ int sfra, efra;
+
char txt[64];
+ if (preview) {
+ sfra = rd->psfra;
+ efra = rd->pefra;
+ }
+ else {
+ sfra = rd->sfra;
+ efra = rd->efra;
+ }
+
strcpy(string, rd->pic);
BLI_path_abs(string, G.main->name);
@@ -234,10 +245,21 @@ void makeqtstring(RenderData *rd, char *string)
}
}
-void filepath_qt(char *string, RenderData *rd)
+void filepath_qt(char *string, RenderData *rd, bool preview)
{
+ int sfra, efra;
+
if (string == NULL) return;
+ if (preview) {
+ sfra = rd->psfra;
+ efra = rd->pefra;
+ }
+ else {
+ sfra = rd->sfra;
+ efra = rd->efra;
+ }
+
strcpy(string, rd->pic);
BLI_path_abs(string, G.main->name);
@@ -245,13 +267,13 @@ void filepath_qt(char *string, RenderData *rd)
if (rd->scemode & R_EXTENSION) {
if (!BLI_testextensie(string, ".mov")) {
- BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
+ BLI_path_frame_range(string, sfra, efra, 4);
strcat(string, ".mov");
}
}
else {
if (BLI_path_frame_check_chars(string)) {
- BLI_path_frame_range(string, rd->sfra, rd->efra, 4);
+ BLI_path_frame_range(string, sfra, efra, 4);
}
}
}
@@ -312,16 +334,26 @@ static OSStatus AudioConverterInputCallback(AudioConverterRef inAudioConverter,
#pragma mark export functions
-int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, ReportList *reports)
+int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, ReportList *reports, bool preview)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSError *error;
char name[1024];
int success = 1;
OSStatus err = noErr;
+ int sfra, efra;
if (qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
+ if (preview) {
+ sfra = rd->psfra;
+ efra = rd->pefra;
+ }
+ else {
+ sfra = rd->sfra;
+ efra = rd->efra;
+ }
+
[QTMovie enterQTKitOnThread];
/* Check first if the QuickTime 7.2.1 initToWritableFile: method is available */
@@ -330,7 +362,7 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
success = 0;
}
else {
- makeqtstring(rd, name);
+ makeqtstring(rd, name, preview);
qtexport->filename = [[NSString alloc] initWithCString:name
encoding:[NSString defaultCStringEncoding]];
qtexport->movie = nil;
@@ -591,13 +623,13 @@ int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, R
specs.format = U.audioformat;
specs.rate = U.audiorate;
qtexport->audioInputDevice = AUD_openReadDevice(specs);
- AUD_playDevice(qtexport->audioInputDevice, scene->sound_scene, rd->sfra * rd->frs_sec_base / rd->frs_sec);
+ AUD_playDevice(qtexport->audioInputDevice, scene->sound_scene, sfra * rd->frs_sec_base / rd->frs_sec);
qtexport->audioOutputPktPos = 0;
qtexport->audioTotalExportedFrames = 0;
qtexport->audioTotalSavedFrames = 0;
- qtexport->audioLastFrame = (rd->efra - rd->sfra) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
+ qtexport->audioLastFrame = (efra - sfra) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
}
}
}
@@ -654,7 +686,7 @@ int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, in
UInt32 audioPacketsConverted;
// Upper limit on total exported audio frames for this particular video frame
- const UInt64 exportedAudioFrameLimit = (frame - rd->sfra) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
+ const UInt64 exportedAudioFrameLimit = (frame - start_frame) * qtexport->audioInputFormat.mSampleRate * rd->frs_sec_base / rd->frs_sec;
/* Append audio */
while (qtexport->audioTotalExportedFrames < exportedAudioFrameLimit) {
diff --git a/source/blender/quicktime/quicktime_export.h b/source/blender/quicktime/quicktime_export.h
index a499cd462b7..6709f87fb1c 100644
--- a/source/blender/quicktime/quicktime_export.h
+++ b/source/blender/quicktime/quicktime_export.h
@@ -56,10 +56,10 @@ struct ReportList;
struct Scene;
struct wmOperatorType;
-int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports); //for movie handle (BKE writeavi.c now)
+int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, struct ReportList *reports, bool preview); //for movie handle (BKE writeavi.c now)
int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
void end_qt(void);
-void filepath_qt(char *string, struct RenderData *rd);
+void filepath_qt(char *string, struct RenderData *rd, bool preview);
/*RNA helper functions */
void quicktime_verify_image_type(struct RenderData *rd, struct ImageFormatData *imf); //used by RNA for defaults values init, if needed
@@ -76,7 +76,7 @@ int quicktime_rnatmpvalue_from_audiocodectype(int codecType);
int quicktime_audiocodecType_from_rnatmpvalue(int rnatmpvalue);
void free_qtcomponentdata(void);
-void makeqtstring(struct RenderData *rd, char *string); //for playanim.c
+void makeqtstring(struct RenderData *rd, char *string, bool preview); //for playanim.c