Quicktime(Carbon/win32) : add operator to raise the "compression settings" quicktime...
authorDamien Plisson <damien.plisson@yahoo.fr>
Wed, 2 Dec 2009 14:39:49 +0000 (14:39 +0000)
committerDamien Plisson <damien.plisson@yahoo.fr>
Wed, 2 Dec 2009 14:39:49 +0000 (14:39 +0000)
release/scripts/ui/properties_render.py
source/blender/editors/render/SConscript
source/blender/editors/render/render_ops.c
source/blender/quicktime/CMakeLists.txt
source/blender/quicktime/SConscript
source/blender/quicktime/apple/quicktime_export.c
source/blender/quicktime/quicktime_export.h

index 35f5255..aa04e27 100644 (file)
@@ -344,6 +344,10 @@ class RENDER_PT_output(RenderButtonsPanel):
             split = layout.split()
             split.prop(rd, "tiff_bit")
 
+        elif rd.file_format == 'QUICKTIME_CARBON':
+            split = layout.split()
+            split.operator("scene.render_data_set_quicktime_codec")
+
         elif rd.file_format == 'QUICKTIME_QTKIT':
             split = layout.split()
             col = split.column()
index b1b1165..575f988 100644 (file)
@@ -16,4 +16,12 @@ if env['OURPLATFORM'] == 'linux2':
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
     incs += ' ' + env['BF_PTHREADS_INC']
 
-env.BlenderLib ( 'bf_editors_render', sources, Split(incs), [], libtype=['core'], priority=[45] )
+
+if env['WITH_BF_QUICKTIME']:
+    incs += ' ../../quicktime'
+    env.Append(CFLAGS=['-DWITH_QUICKTIME'])
+
+if env['USE_QTKIT']:
+   env.Append(CFLAGS=['-DUSE_QTKIT'])
+
+env.BlenderLib ( 'bf_editors_render', sources, Split(incs), [], libtype=['core'], priority=[45])
index 8c0c1b1..3e1643f 100644 (file)
 
 #include "render_intern.h" // own include
 
+#if (defined(WITH_QUICKTIME) && !defined(USE_QTKIT))
+#include "quicktime_export.h"
+#endif
+
 /***************************** render ***********************************/
 
 void ED_operatortypes_render(void)
@@ -52,6 +56,10 @@ void ED_operatortypes_render(void)
        WM_operatortype_append(SCENE_OT_render_layer_add);
        WM_operatortype_append(SCENE_OT_render_layer_remove);
 
+#if (defined(WITH_QUICKTIME) && !defined(USE_QTKIT))
+       WM_operatortype_append(SCENE_OT_render_data_set_quicktime_codec);
+#endif
+       
        WM_operatortype_append(TEXTURE_OT_slot_move);
 }
 
index 14589ca..7df589b 100644 (file)
@@ -34,6 +34,7 @@ SET(INC
        .
        ../quicktime
        ../makesdna
+       ../makesrna
        ../../../intern/guardedalloc
        ../blenlib
        ../blenkernel
@@ -43,6 +44,7 @@ SET(INC
        ../blenloader
        ../render/extern/include
        ../include
+       ../windowmanager
 )
 
 SET(INC ${INC} ${QUICKTIME_INC})
index 1f9847d..549b3cf 100644 (file)
@@ -13,6 +13,8 @@ else:
 incs  = ['.',
                 '../quicktime',
                 '../makesdna',
+                '../makesrna',
+                '../windowmanager',
                 '#/intern/guardedalloc',
                 '../blenlib',
                 '../blenkernel',
index c6c412a..dea170d 100644 (file)
 #if defined(_WIN32) || defined(__APPLE__)
 
 #include "DNA_scene_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
 
 #include "BKE_global.h"
 #include "BKE_scene.h"
+#include "BKE_context.h"
 
 #include "BLI_blenlib.h"
 
@@ -730,10 +735,50 @@ int get_qtcodec_settings(RenderData *rd)
        return err;
 }
 
-int request_qtcodec_settings(RenderData *rd)
+static int request_qtcodec_settings(bContext *C, wmOperator *op)
 {
        OSErr   err = noErr;
+       Scene *scene = CTX_data_scene(C);
+       RenderData *rd = &scene->r;
 
+       // erase any existing codecsetting
+       if(qtdata) {
+               if(qtdata->theComponent) CloseComponent(qtdata->theComponent);
+               free_qtcomponentdata();
+       }
+       
+       // allocate new
+       qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeComponentData");
+       qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
+       
+       // get previous selected codecsetting, from qtatom or detailed settings
+       if(rd->qtcodecdata && rd->qtcodecdata->cdParms) {
+               QT_GetCodecSettingsFromScene(rd);
+       } else {
+               SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
+               SCGetInfo(qtdata->theComponent, scSpatialSettingsType,  &qtdata->gSpatialSettings);
+               SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
+               
+               qtdata->gSpatialSettings.codecType = rd->qtcodecsettings.codecType;
+               qtdata->gSpatialSettings.codec = (CodecComponent)rd->qtcodecsettings.codec;      
+               qtdata->gSpatialSettings.spatialQuality = (rd->qtcodecsettings.codecSpatialQuality * codecLosslessQuality) /100;
+               qtdata->gTemporalSettings.temporalQuality = (rd->qtcodecsettings.codecTemporalQuality * codecLosslessQuality) /100;
+               qtdata->gTemporalSettings.keyFrameRate = rd->qtcodecsettings.keyFrameRate;
+               qtdata->gTemporalSettings.frameRate = ((float)(rd->frs_sec << 16) / rd->frs_sec_base);
+               qtdata->aDataRateSetting.dataRate = rd->qtcodecsettings.bitRate;
+               qtdata->gSpatialSettings.depth = rd->qtcodecsettings.colorDepth;
+               qtdata->aDataRateSetting.minSpatialQuality = (rd->qtcodecsettings.minSpatialQuality * codecLosslessQuality) / 100;
+               qtdata->aDataRateSetting.minTemporalQuality = (rd->qtcodecsettings.minTemporalQuality * codecLosslessQuality) / 100;
+               
+               qtdata->aDataRateSetting.frameDuration = rd->frs_sec;           
+               
+               err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType,   &qtdata->gTemporalSettings);
+               CheckError(err, "SCSetInfo1 error");
+               err = SCSetInfo(qtdata->theComponent, scSpatialSettingsType,    &qtdata->gSpatialSettings);
+               CheckError(err, "SCSetInfo2 error");
+               err = SCSetInfo(qtdata->theComponent, scDataRateSettingsType,   &qtdata->aDataRateSetting);
+               CheckError(err, "SCSetInfo3 error");
+       }
                // put up the dialog box - it needs to be called from the main thread
        err = SCRequestSequenceSettings(qtdata->theComponent);
  
@@ -802,6 +847,27 @@ int request_qtcodec_settings(RenderData *rd)
        return 1;
 }
 
+static int ED_operator_setqtcodec(bContext *C)
+{
+       return G.have_quicktime != FALSE;
+}
+
+
+void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot)
+{
+       /* identifiers */
+    ot->name= "Change codec";
+    ot->description= "Change Quicktime codec Settings";
+    ot->idname= "SCENE_OT_render_data_set_quicktime_codec";
+       
+    /* api callbacks */
+    ot->exec= request_qtcodec_settings;
+    ot->poll= ED_operator_setqtcodec;
+       
+    /* flags */
+    ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
 #endif /* _WIN32 || __APPLE__ */
 #endif /* WITH_QUICKTIME */
 
index 61153ff..69f6796 100644 (file)
@@ -44,6 +44,7 @@ typedef struct QuicktimeCodecTypeDesc {
 // quicktime movie output functions
 struct RenderData;
 struct Scene;
+struct wmOperatorType;
 
 void start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty);       //for movie handle (BKE writeavi.c now)
 void append_qt(struct RenderData *rd, int frame, int *pixels, int rectx, int recty);
@@ -57,7 +58,7 @@ int quicktime_rnatmpvalue_from_codectype(int codecType);
 int quicktime_codecType_from_rnatmpvalue(int rnatmpvalue);
 
 #ifndef USE_QTKIT
-int request_qtcodec_settings(struct RenderData *rd); //Raise quicktime standard dialog to request codec settings
+void SCENE_OT_render_data_set_quicktime_codec(struct wmOperatorType *ot); //Operator to raise quicktime standard dialog to request codec settings
 #endif