[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28112] trunk/blender: QTKit (OSX 64bit): Add audio export to Quicktime

Damien Plisson damien.plisson at yahoo.fr
Sat Apr 10 11:31:41 CEST 2010


Revision: 28112
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28112
Author:   damien78
Date:     2010-04-10 11:31:41 +0200 (Sat, 10 Apr 2010)

Log Message:
-----------
QTKit (OSX 64bit): Add audio export to Quicktime

Supports default OSX codecs : Linear PCM, Apple Lossless and AAC

Note that AAC codec doesn't support sample rates above 48kHz. If a python/rna guru knows how to easily enforce this limit, he is welcome!

Enjoy making Quicktime movies now with audio!

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/source/blender/makesdna/DNA_scene_types.h
    trunk/blender/source/blender/makesrna/SConscript
    trunk/blender/source/blender/makesrna/intern/CMakeLists.txt
    trunk/blender/source/blender/makesrna/intern/Makefile
    trunk/blender/source/blender/makesrna/intern/SConscript
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/quicktime/CMakeLists.txt
    trunk/blender/source/blender/quicktime/SConscript
    trunk/blender/source/blender/quicktime/apple/Makefile
    trunk/blender/source/blender/quicktime/apple/qtkit_export.m
    trunk/blender/source/blender/quicktime/apple/quicktime_export.c
    trunk/blender/source/blender/quicktime/quicktime_export.h

Modified: trunk/blender/release/scripts/ui/properties_render.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_render.py	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/release/scripts/ui/properties_render.py	2010-04-10 09:31:41 UTC (rev 28112)
@@ -362,15 +362,39 @@
 
         elif rd.file_format == 'QUICKTIME_CARBON':
             split = layout.split()
-            split.operator("scene.render_set_quicktime_codec")
+            split.operator("scene.render_data_set_quicktime_codec")
 
         elif rd.file_format == 'QUICKTIME_QTKIT':
             split = layout.split()
             col = split.column()
-            col.prop(rd, "quicktime_codec_type")
+            col.prop(rd, "quicktime_codec_type", text="Video Codec")
             col.prop(rd, "quicktime_codec_spatial_quality", text="Quality")
+            
+            #Audio
+            col.prop(rd,"quicktime_audiocodec_type", text="Audio Codec")
+            if rd.quicktime_audiocodec_type != 'No audio':
+                split = layout.split()
+                col = split.column()
+                if rd.quicktime_audiocodec_type == 'LPCM':
+                    col.prop(rd,"quicktime_audio_bitdepth", text="")
+                if wide_ui:
+                    col = split.column()
+                col.prop(rd,"quicktime_audio_samplerate", text="")
 
+                split = layout.split()
+                col = split.column()
+                if rd.quicktime_audiocodec_type == 'AAC':
+                    col.prop(rd,"quicktime_audio_bitrate")
+                if wide_ui:
+                    subsplit = split.split()
+                    col = subsplit.column()
+                if rd.quicktime_audiocodec_type == 'AAC':
+                    col.prop(rd,"quicktime_audio_codec_isvbr")
+                if wide_ui:
+                    col = subsplit.column()
+                col.prop(rd,"quicktime_audio_resampling_hq")
 
+
 class RENDER_PT_encoding(RenderButtonsPanel):
     bl_label = "Encoding"
     bl_default_closed = True

Modified: trunk/blender/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_scene_types.h	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/source/blender/makesdna/DNA_scene_types.h	2010-04-10 09:31:41 UTC (rev 28112)
@@ -104,6 +104,15 @@
 	int	minTemporalQuality; /* in 0-100 scale, to be translated in 0-1024 for qt use */
 	int	keyFrameRate;
 	int	bitRate;	/* bitrate in bps */
+	
+	/* Audio Codec settings */
+	int audiocodecType;
+	int audioSampleRate;
+	short audioBitDepth;
+	short audioChannels;
+	int audioCodecFlags;
+	int audioBitRate;
+	int pad1;
 } QuicktimeCodecSettings;
 
 typedef struct FFMpegCodecData {

Modified: trunk/blender/source/blender/makesrna/SConscript
===================================================================
--- trunk/blender/source/blender/makesrna/SConscript	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/source/blender/makesrna/SConscript	2010-04-10 09:31:41 UTC (rev 28112)
@@ -6,7 +6,7 @@
 o = SConscript('intern/SConscript')
 objs += o
 
-incs = '#/intern/guardedalloc ../blenkernel ../blenlib ../makesdna intern .'
+incs = '#/intern/guardedalloc #/intern/audaspace/intern ../blenkernel ../blenlib ../makesdna intern .'
 incs += ' ../windowmanager ../editors/include ../gpu ../imbuf ../ikplugin'
 incs += ' ../render/extern/include'
 

Modified: trunk/blender/source/blender/makesrna/intern/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/makesrna/intern/CMakeLists.txt	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/source/blender/makesrna/intern/CMakeLists.txt	2010-04-10 09:31:41 UTC (rev 28112)
@@ -39,7 +39,7 @@
 		../../../../intern/guardedalloc/intern/mallocn.c
 		../../../../intern/guardedalloc/intern/mmap_win.c)
 
-INCLUDE_DIRECTORIES(../../../../intern/guardedalloc .. ../../makesdna ../../blenkernel ../../blenlib ../../ikplugin ../../windowmanager ../../editors/include ../../gpu ../../imbuf ../../render/extern/include .)
+INCLUDE_DIRECTORIES(../../../../intern/audaspace/intern ../../../../intern/guardedalloc .. ../../makesdna ../../blenkernel ../../blenlib ../../ikplugin ../../windowmanager ../../editors/include ../../gpu ../../imbuf ../../render/extern/include .)
 FILE(GLOB INC_FILES ../*.h ../../makesdna/*.h)
 
 IF(NOT WITH_PYTHON)

Modified: trunk/blender/source/blender/makesrna/intern/Makefile
===================================================================
--- trunk/blender/source/blender/makesrna/intern/Makefile	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/source/blender/makesrna/intern/Makefile	2010-04-10 09:31:41 UTC (rev 28112)
@@ -46,6 +46,7 @@
 CFLAGS += $(LEVEL_1_C_WARNINGS)
 
 CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
+CPPFLAGS += -I../../../../intern/audaspace/intern
 CPPFLAGS += -I../../blenlib
 CPPFLAGS += -I../../blenkernel
 CPPFLAGS += -I../../imbuf

Modified: trunk/blender/source/blender/makesrna/intern/SConscript
===================================================================
--- trunk/blender/source/blender/makesrna/intern/SConscript	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/source/blender/makesrna/intern/SConscript	2010-04-10 09:31:41 UTC (rev 28112)
@@ -33,6 +33,7 @@
 incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin'
 incs += ' ../../windowmanager ../../editors/include'
 incs += ' ../../render/extern/include'
+incs += ' #/intern/audaspace/intern'
 
 if env['WITH_BF_OPENEXR']:
 	defs.append('WITH_OPENEXR')

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-04-10 08:04:13 UTC (rev 28111)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2010-04-10 09:31:41 UTC (rev 28112)
@@ -39,6 +39,7 @@
 
 #ifdef WITH_QUICKTIME
 #include "quicktime_export.h"
+#include "AUD_C-API.h"
 #endif
 
 #ifdef WITH_FFMPEG
@@ -523,14 +524,14 @@
 {
 	RenderData *rd= (RenderData*)ptr->data;
 	
-	return quicktime_rnatmpvalue_from_codectype(rd->qtcodecsettings.codecType);
+	return quicktime_rnatmpvalue_from_videocodectype(rd->qtcodecsettings.codecType);
 }
 
 static void rna_RenderSettings_qtcodecsettings_codecType_set(PointerRNA *ptr, int value)
 {
 	RenderData *rd= (RenderData*)ptr->data;
 
-	rd->qtcodecsettings.codecType = quicktime_codecType_from_rnatmpvalue(value);
+	rd->qtcodecsettings.codecType = quicktime_videocodecType_from_rnatmpvalue(value);
 }
 
 static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bContext *C, PointerRNA *ptr, int *free)
@@ -541,8 +542,8 @@
 	int i=1, totitem= 0;
 	char id[5];
 	
-	for(i=0;i<quicktime_get_num_codecs();i++) {
-		codecTypeDesc = quicktime_get_codecType_desc(i);
+	for(i=0;i<quicktime_get_num_videocodecs();i++) {
+		codecTypeDesc = quicktime_get_videocodecType_desc(i);
 		if (!codecTypeDesc) break;
 		
 		tmp.value= codecTypeDesc->rnatmpvalue;
@@ -557,8 +558,47 @@
 	*free= 1;
 	
 	return item;	
+}
+
+#ifdef USE_QTKIT
+static int rna_RenderSettings_qtcodecsettings_audiocodecType_get(PointerRNA *ptr)
+{
+	RenderData *rd= (RenderData*)ptr->data;
+	
+	return quicktime_rnatmpvalue_from_audiocodectype(rd->qtcodecsettings.audiocodecType);
+}
+
+static void rna_RenderSettings_qtcodecsettings_audiocodecType_set(PointerRNA *ptr, int value)
+{
+	RenderData *rd= (RenderData*)ptr->data;
+	
+	rd->qtcodecsettings.audiocodecType = quicktime_audiocodecType_from_rnatmpvalue(value);
+}
+
+static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_audiocodecType_itemf(bContext *C, PointerRNA *ptr, int *free)
+{
+	EnumPropertyItem *item= NULL;
+	EnumPropertyItem tmp = {0, "", 0, "", ""};
+	QuicktimeCodecTypeDesc *codecTypeDesc;
+	int i=1, totitem= 0;
+	
+	for(i=0;i<quicktime_get_num_audiocodecs();i++) {
+		codecTypeDesc = quicktime_get_audiocodecType_desc(i);
+		if (!codecTypeDesc) break;
+		
+		tmp.value= codecTypeDesc->rnatmpvalue;
+		tmp.identifier= codecTypeDesc->codecName; 
+		tmp.name= codecTypeDesc->codecName;
+		RNA_enum_item_add(&item, &totitem, &tmp);
+	}
+	
+	RNA_enum_item_end(&item, &totitem);
+	*free= 1;
+	
+	return item;	
 }	
 #endif
+#endif
 
 static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr)
 {
@@ -1824,7 +1864,36 @@
 	static EnumPropertyItem quicktime_codec_type_items[] = {
 		{0, "codec", 0, "codec", ""},
 		{0, NULL, 0, NULL, NULL}};
+	
+#ifdef USE_QTKIT
+	static EnumPropertyItem quicktime_audio_samplerate_items[] = {
+		{22050, "22050", 0, "22kHz", ""},
+		{44100, "44100", 0, "44.1kHz", ""},
+		{48000, "48000", 0, "48kHz", ""},
+		{88200, "88200", 0, "88.2kHz", ""},
+		{96000, "96000", 0, "96kHz", ""},
+		{192000, "192000", 0, "192kHz", ""},
+		{0, NULL, 0, NULL, NULL}};
+	
+	static EnumPropertyItem quicktime_audio_bitdepth_items[] = {
+		{AUD_FORMAT_U8, "8BIT", 0, "8bit", ""},
+		{AUD_FORMAT_S16, "16BIT", 0, "16bit", ""},
+		{AUD_FORMAT_S24, "24BIT", 0, "24bit", ""},
+		{AUD_FORMAT_S32, "32BIT", 0, "32bit", ""},
+		{AUD_FORMAT_FLOAT32, "FLOAT32", 0, "float32", ""},
+		{AUD_FORMAT_FLOAT64, "FLOAT64", 0, "float64", ""},
+		{0, NULL, 0, NULL, NULL}};
+	
+	static EnumPropertyItem quicktime_audio_bitrate_items[] = {
+		{64000, "64000", 0, "64kbps", ""},
+		{112000, "112000", 0, "112kpbs", ""},
+		{128000, "128000", 0, "128kbps", ""},
+		{192000, "192000", 0, "192kbps", ""},
+		{256000, "256000", 0, "256kbps", ""},
+		{320000, "320000", 0, "320kbps", ""},
+		{0, NULL, 0, NULL, NULL}};
 #endif
+#endif
 
 #ifdef WITH_FFMPEG
 	static EnumPropertyItem ffmpeg_format_items[] = {
@@ -2031,8 +2100,47 @@
 	RNA_def_property_int_sdna(prop, NULL, "qtcodecsettings.codecSpatialQuality");
 	RNA_def_property_range(prop, 0, 100);
 	RNA_def_property_ui_text(prop, "Spatial quality", "Intra-frame spatial quality level");
+	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+#ifdef USE_QTKIT
+	prop= RNA_def_property(srna, "quicktime_audiocodec_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audiocodecType");
+	RNA_def_property_enum_items(prop, quicktime_codec_type_items);
+	RNA_def_property_enum_funcs(prop, "rna_RenderSettings_qtcodecsettings_audiocodecType_get",
+								"rna_RenderSettings_qtcodecsettings_audiocodecType_set",
+								"rna_RenderSettings_qtcodecsettings_audiocodecType_itemf");

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list