From c939331a6ccacc571c893646e209e99680a81aa5 Mon Sep 17 00:00:00 2001 From: Damien Plisson Date: Sat, 10 Apr 2010 09:31:41 +0000 Subject: 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! --- source/blender/makesrna/intern/CMakeLists.txt | 2 +- source/blender/makesrna/intern/Makefile | 1 + source/blender/makesrna/intern/SConscript | 1 + source/blender/makesrna/intern/rna_scene.c | 116 +++++++++++++++++++++++++- 4 files changed, 115 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna/intern') diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 58931165638..0e25160cdff 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -39,7 +39,7 @@ SET(SRC ../../../../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) diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile index 5afe55bb319..c26593100f8 100644 --- a/source/blender/makesrna/intern/Makefile +++ b/source/blender/makesrna/intern/Makefile @@ -46,6 +46,7 @@ endif CFLAGS += $(LEVEL_1_C_WARNINGS) CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include +CPPFLAGS += -I../../../../intern/audaspace/intern CPPFLAGS += -I../../blenlib CPPFLAGS += -I../../blenkernel CPPFLAGS += -I../../imbuf diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index b63a816edfb..d22a654db02 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -33,6 +33,7 @@ incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel' 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') diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index dd06d2df8e0..40027b16950 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -39,6 +39,7 @@ #ifdef WITH_QUICKTIME #include "quicktime_export.h" +#include "AUD_C-API.h" #endif #ifdef WITH_FFMPEG @@ -523,14 +524,14 @@ static int rna_RenderSettings_qtcodecsettings_codecType_get(PointerRNA *ptr) { 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 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon int i=1, totitem= 0; char id[5]; - for(i=0;irnatmpvalue; @@ -556,9 +557,48 @@ static EnumPropertyItem *rna_RenderSettings_qtcodecsettings_codecType_itemf(bCon RNA_enum_item_end(&item, &totitem); *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;irnatmpvalue; + 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,6 +1864,35 @@ static void rna_def_scene_render_data(BlenderRNA *brna) 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 @@ -2031,8 +2100,47 @@ static void rna_def_scene_render_data(BlenderRNA *brna) 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"); + RNA_def_property_ui_text(prop, "Audio Codec", "QuickTime audio codec type"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_samplerate", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audioSampleRate"); + RNA_def_property_enum_items(prop, quicktime_audio_samplerate_items); + RNA_def_property_ui_text(prop, "Smp Rate", "Sample Rate"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_bitdepth", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audioBitDepth"); + RNA_def_property_enum_items(prop, quicktime_audio_bitdepth_items); + RNA_def_property_ui_text(prop, "Bit Depth", "Bit Depth"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_resampling_hq", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "qtcodecsettings.audioCodecFlags", QTAUDIO_FLAG_RESAMPLE_NOHQ); + RNA_def_property_ui_text(prop, "HQ", "Use High Quality resampling algorithm"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_codec_isvbr", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_negative_sdna(prop, NULL, "qtcodecsettings.audioCodecFlags", QTAUDIO_FLAG_CODEC_ISCBR); + RNA_def_property_ui_text(prop, "VBR", "Use Variable Bit Rate compression (improves quality at same bitrate)"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "quicktime_audio_bitrate", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "qtcodecsettings.audioBitRate"); + RNA_def_property_enum_items(prop, quicktime_audio_bitrate_items); + RNA_def_property_ui_text(prop, "Bitrate", "Compressed audio bitrate"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); #endif +#endif #ifdef WITH_FFMPEG /* FFMPEG Video*/ -- cgit v1.2.3