2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2003-04-28 02:15:46 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2003-04-28 02:15:46 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2003-04-28 02:15:46 +00:00
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is written by Rob Haarsma (phase)
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Stefan Gartner (sgefant)
|
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2003-04-28 02:15:46 +00:00
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:01:38 +00:00
|
|
|
/** \file blender/quicktime/apple/quicktime_export.c
|
|
|
|
|
* \ingroup quicktime
|
2012-04-30 14:24:11 +00:00
|
|
|
*
|
|
|
|
|
* Code to create QuickTime Movies with Blender
|
2011-02-27 20:01:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#ifdef WITH_QUICKTIME
|
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
OS X Makefiles:
* added some new variables (mostly the same as with scons):
- USE_COCOA: use Cocoa for ghost (defaults to true)
- MACOSX_ARCHITECTURE: can be ppc, ppc64, i386, x86_64. By default this is the host architecture
(ppc for PowerPC Macs, i386 for Intel Macs). In theory this allows to cross compile blender for
a different architecture, though cross compilation only works on Intel Macs, because makesdna
and makesrna are built for the target architecture.
For a 64 bit build, set MACOSX_ARCHITECTURE to x86_64 (Intel) or ppc64 (PowerPC).
- MACOSX_MIN_VERS: minimum OS X version to run blender on (10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_DEPLOYMENT_TARGET: needed by the linker to create an Application targeted for a specific
OS version (defaults to 10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_SDK: path to a specific SDK. currently not used
- USE_QTKIT: use QTKit instead of QuickTime (defaults to true for 64 bit builds, as using QTKit
is mandatory in that case))
* use the same compiler flags as scons
* default compiler now is gcc-4.0 when building for 10.4 and gcc-4.2 when building for 10.5
* extract $(LCGDIR)/release/python_$(MACOSX_ARCHITECTURE).zip to Application bundle. This might
break building on 10.4, to fix that, rename $(LCGDIR)/release/python.zip
When compiling blender, only MACOSX_ARCHITECTURE might be of interest, as it allows doing 64 bit
builds (or 32 bit PowerPC builds on Intel). All other variables are then set to reasonable defaults.
For current users of the Makefile system, this commit shouldn't change much.
2010-01-03 20:35:13 +00:00
|
|
|
#ifndef USE_QTKIT
|
2003-04-28 02:15:46 +00:00
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
#include "DNA_scene_types.h"
|
2009-12-02 14:39:49 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
2010-03-24 16:23:42 +00:00
|
|
|
#include "WM_api.h"
|
|
|
|
|
#include "WM_types.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
#include "BKE_context.h"
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "BKE_global.h"
|
2010-10-18 07:01:46 +00:00
|
|
|
#include "BKE_main.h"
|
2009-12-22 15:20:31 +00:00
|
|
|
#include "BKE_report.h"
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "BKE_scene.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "BLI_blenlib.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "BLO_sys_types.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "IMB_imbuf.h"
|
|
|
|
|
#include "IMB_imbuf_types.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "MEM_guardedalloc.h"
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
|
2004-12-10 01:28:28 +00:00
|
|
|
#include "quicktime_import.h"
|
2003-04-28 02:15:46 +00:00
|
|
|
#include "quicktime_export.h"
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
#include <QTML.h>
|
2003-05-02 13:36:56 +00:00
|
|
|
#include <Movies.h>
|
2006-08-17 23:52:58 +00:00
|
|
|
#include <QuickTimeComponents.h>
|
2005-01-11 10:58:58 +00:00
|
|
|
#include <TextUtils.h>
|
2010-11-06 16:09:12 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <memory.h>
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2004-01-08 16:26:30 +00:00
|
|
|
/* evil */
|
|
|
|
|
#ifndef __AIFF__
|
|
|
|
|
#define __AIFF__
|
|
|
|
|
#endif
|
2003-05-02 13:36:56 +00:00
|
|
|
#include <QuickTime/Movies.h>
|
2006-08-17 23:52:58 +00:00
|
|
|
#include <QuickTime/QuickTimeComponents.h>
|
2003-04-28 02:15:46 +00:00
|
|
|
#include <fcntl.h> /* open() */
|
|
|
|
|
#include <unistd.h> /* close() */
|
|
|
|
|
#include <sys/stat.h> /* file permissions */
|
|
|
|
|
#endif /* __APPLE__ */
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
#define kMyCreatorType FOUR_CHAR_CODE('TVOD')
|
|
|
|
|
#define kTrackStart 0
|
|
|
|
|
#define kMediaStart 0
|
|
|
|
|
|
|
|
|
|
static void QT_StartAddVideoSamplesToMedia(const Rect *trackFrame, int rectx, int recty, struct ReportList *reports);
|
|
|
|
|
static void QT_DoAddVideoSamplesToMedia(int frame, int *pixels, int rectx, int recty, struct ReportList *reports);
|
|
|
|
|
static void QT_EndAddVideoSamplesToMedia(void);
|
|
|
|
|
static void QT_CreateMyVideoTrack(int rectx, int recty, struct ReportList *reports);
|
|
|
|
|
static void QT_EndCreateMyVideoTrack(struct ReportList *reports);
|
2009-12-22 15:20:31 +00:00
|
|
|
static void check_renderbutton_framerate(struct RenderData *rd, struct ReportList *reports);
|
|
|
|
|
static int get_qtcodec_settings(struct RenderData *rd, struct ReportList *reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
typedef struct QuicktimeExport {
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
FSSpec theSpec;
|
|
|
|
|
short resRefNum;
|
|
|
|
|
Str255 qtfilename;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
Media theMedia;
|
|
|
|
|
Movie theMovie;
|
|
|
|
|
Track theTrack;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
GWorldPtr theGWorld;
|
|
|
|
|
PixMapHandle thePixMap;
|
|
|
|
|
ImageDescription **anImageDescription;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
ImBuf *ibuf; /* imagedata for Quicktime's Gworld */
|
|
|
|
|
ImBuf *ibuf2; /* copy of renderdata, to be Y-flipped */
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
} QuicktimeExport;
|
|
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
typedef struct QuicktimeComponentData {
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
ComponentInstance theComponent;
|
2003-04-28 02:15:46 +00:00
|
|
|
SCTemporalSettings gTemporalSettings;
|
|
|
|
|
SCSpatialSettings gSpatialSettings;
|
|
|
|
|
SCDataRateSettings aDataRateSetting;
|
2012-05-12 16:11:34 +00:00
|
|
|
TimeValue duration;
|
|
|
|
|
long kVideoTimeScale;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
} QuicktimeComponentData;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
static struct QuicktimeExport *qtexport;
|
|
|
|
|
static struct QuicktimeComponentData *qtdata;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
static int sframe;
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2009-12-02 11:23:11 +00:00
|
|
|
/* RNA functions */
|
|
|
|
|
|
2010-04-10 09:31:41 +00:00
|
|
|
static QuicktimeCodecTypeDesc qtVideoCodecList[] = {
|
2009-12-02 11:23:11 +00:00
|
|
|
{kRawCodecType, 1, "Uncompressed"},
|
|
|
|
|
{kJPEGCodecType, 2, "JPEG"},
|
|
|
|
|
{kMotionJPEGACodecType, 3, "M-JPEG A"},
|
|
|
|
|
{kMotionJPEGBCodecType, 4, "M-JPEG B"},
|
|
|
|
|
{kDVCPALCodecType, 5, "DV PAL"},
|
|
|
|
|
{kDVCNTSCCodecType, 6, "DV/DVCPRO NTSC"},
|
|
|
|
|
{kDVCPROHD720pCodecType, 7, "DVCPRO HD 720p"},
|
|
|
|
|
{kDVCPROHD1080i50CodecType, 8, "DVCPRO HD 1080i50"},
|
|
|
|
|
{kDVCPROHD1080i60CodecType, 9, "DVCPRO HD 1080i60"},
|
|
|
|
|
{kMPEG4VisualCodecType, 10, "MPEG4"},
|
|
|
|
|
{kH263CodecType, 11, "H.263"},
|
|
|
|
|
{kH264CodecType, 12, "H.264"},
|
2012-05-12 16:11:34 +00:00
|
|
|
{0, 0, NULL}
|
|
|
|
|
};
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2010-04-10 09:31:41 +00:00
|
|
|
static int qtVideoCodecCount = 12;
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
int quicktime_get_num_videocodecs()
|
|
|
|
|
{
|
2010-04-10 09:31:41 +00:00
|
|
|
return qtVideoCodecCount;
|
2009-12-02 11:23:11 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
QuicktimeCodecTypeDesc *quicktime_get_videocodecType_desc(int indexValue)
|
2012-02-25 16:49:59 +00:00
|
|
|
{
|
2012-05-12 16:11:34 +00:00
|
|
|
if ((indexValue >= 0) && (indexValue < qtVideoCodecCount))
|
2010-04-10 09:31:41 +00:00
|
|
|
return &qtVideoCodecList[indexValue];
|
2009-12-02 11:23:11 +00:00
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
int quicktime_rnatmpvalue_from_videocodectype(int codecType)
|
|
|
|
|
{
|
2009-12-02 11:23:11 +00:00
|
|
|
int i;
|
2012-05-12 16:11:34 +00:00
|
|
|
for (i = 0; i < qtVideoCodecCount; i++) {
|
2010-04-10 09:31:41 +00:00
|
|
|
if (qtVideoCodecList[i].codecType == codecType)
|
|
|
|
|
return qtVideoCodecList[i].rnatmpvalue;
|
2009-12-02 11:23:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
int quicktime_videocodecType_from_rnatmpvalue(int rnatmpvalue)
|
|
|
|
|
{
|
2009-12-02 11:23:11 +00:00
|
|
|
int i;
|
2012-05-12 16:11:34 +00:00
|
|
|
for (i = 0; i < qtVideoCodecCount; i++) {
|
2010-04-10 09:31:41 +00:00
|
|
|
if (qtVideoCodecList[i].rnatmpvalue == rnatmpvalue)
|
|
|
|
|
return qtVideoCodecList[i].codecType;
|
2009-12-02 11:23:11 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
return 0;
|
2009-12-02 11:23:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
static void CheckError(OSErr err, char *msg, ReportList *reports)
|
2005-01-11 10:58:58 +00:00
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (err != noErr) {
|
2009-12-22 15:20:31 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "%s: %d", msg, err);
|
|
|
|
|
}
|
2005-01-11 10:58:58 +00:00
|
|
|
}
|
|
|
|
|
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2009-12-23 11:49:07 +00:00
|
|
|
static OSErr QT_SaveCodecSettingsToScene(RenderData *rd, ReportList *reports)
|
2003-05-21 01:21:07 +00:00
|
|
|
{
|
2012-05-12 16:11:34 +00:00
|
|
|
QTAtomContainer myContainer = NULL;
|
|
|
|
|
ComponentResult myErr = noErr;
|
|
|
|
|
Ptr myPtr;
|
|
|
|
|
long mySize = 0;
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
CodecInfo ci;
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
QuicktimeCodecData *qcd = rd->qtcodecdata;
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* check if current scene already has qtcodec settings, and clear them */
|
2003-05-21 01:21:07 +00:00
|
|
|
if (qcd) {
|
|
|
|
|
free_qtcodecdata(qcd);
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2009-01-04 14:14:06 +00:00
|
|
|
qcd = rd->qtcodecdata = MEM_callocN(sizeof(QuicktimeCodecData), "QuicktimeCodecData");
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* obtain all current codec settings */
|
2012-05-12 16:11:34 +00:00
|
|
|
SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
|
|
|
|
SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
|
|
|
|
SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* retreive codecdata from quicktime in a atomcontainer */
|
2005-01-11 10:58:58 +00:00
|
|
|
myErr = SCGetSettingsAsAtomContainer(qtdata->theComponent, &myContainer);
|
2003-05-21 01:21:07 +00:00
|
|
|
if (myErr != noErr) {
|
2012-10-13 15:44:50 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Quicktime: SCGetSettingsAsAtomContainer failed");
|
2003-05-21 01:21:07 +00:00
|
|
|
goto bail;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* get the size of the atomcontainer */
|
2003-05-21 01:21:07 +00:00
|
|
|
mySize = GetHandleSize((Handle)myContainer);
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* lock and convert the atomcontainer to a *valid* pointer */
|
2003-05-21 01:21:07 +00:00
|
|
|
QTLockContainer(myContainer);
|
2003-05-21 21:42:36 +00:00
|
|
|
myPtr = *(Handle)myContainer;
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* copy the Quicktime data into the blender qtcodecdata struct */
|
2003-05-21 01:21:07 +00:00
|
|
|
if (myPtr) {
|
|
|
|
|
qcd->cdParms = MEM_mallocN(mySize, "qt.cdParms");
|
|
|
|
|
memcpy(qcd->cdParms, myPtr, mySize);
|
|
|
|
|
qcd->cdSize = mySize;
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
GetCodecInfo(&ci, qtdata->gSpatialSettings.codecType, 0);
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-10-13 15:44:50 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Quicktime: QT_SaveCodecSettingsToScene failed");
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QTUnlockContainer(myContainer);
|
|
|
|
|
|
|
|
|
|
bail:
|
|
|
|
|
if (myContainer != NULL)
|
|
|
|
|
QTDisposeAtomContainer(myContainer);
|
|
|
|
|
|
|
|
|
|
return((OSErr)myErr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-12-23 11:49:07 +00:00
|
|
|
static OSErr QT_GetCodecSettingsFromScene(RenderData *rd, ReportList *reports)
|
2003-05-21 01:21:07 +00:00
|
|
|
{
|
2012-05-12 16:11:34 +00:00
|
|
|
Handle myHandle = NULL;
|
|
|
|
|
ComponentResult myErr = noErr;
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
QuicktimeCodecData *qcd = rd->qtcodecdata;
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* if there is codecdata in the blendfile, convert it to a Quicktime handle */
|
2003-05-21 01:21:07 +00:00
|
|
|
if (qcd) {
|
|
|
|
|
myHandle = NewHandle(qcd->cdSize);
|
2012-04-29 17:11:40 +00:00
|
|
|
PtrToHand(qcd->cdParms, &myHandle, qcd->cdSize);
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* restore codecsettings to the quicktime component */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qcd->cdParms && qcd->cdSize) {
|
2005-01-11 10:58:58 +00:00
|
|
|
myErr = SCSetSettingsFromAtomContainer((GraphicsExportComponent)qtdata->theComponent, (QTAtomContainer)myHandle);
|
2003-05-21 01:21:07 +00:00
|
|
|
if (myErr != noErr) {
|
2012-10-13 15:44:50 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Quicktime: SCSetSettingsFromAtomContainer failed");
|
2003-05-21 01:21:07 +00:00
|
|
|
goto bail;
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* update runtime codecsettings for use with the codec dialog */
|
2012-05-12 16:11:34 +00:00
|
|
|
SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Fill the render QuicktimeCodecSettigns struct */
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
|
|
|
|
|
|
|
|
|
|
rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
|
|
|
|
|
rd->qtcodecsettings.codec = (int)qtdata->gSpatialSettings.codec;
|
|
|
|
|
rd->qtcodecsettings.colorDepth = qtdata->gSpatialSettings.depth;
|
|
|
|
|
rd->qtcodecsettings.codecSpatialQuality = (qtdata->gSpatialSettings.spatialQuality * 100) / codecLosslessQuality;
|
|
|
|
|
|
|
|
|
|
rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
|
|
|
|
|
rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
|
|
|
|
|
rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-10-13 15:44:50 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Quicktime: QT_GetCodecSettingsFromScene failed");
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
|
|
|
|
bail:
|
|
|
|
|
if (myHandle != NULL)
|
|
|
|
|
DisposeHandle(myHandle);
|
|
|
|
|
|
|
|
|
|
return((OSErr)myErr);
|
|
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
static OSErr QT_AddUserDataTextToMovie(Movie theMovie, char *theText, OSType theType)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
2012-05-12 16:11:34 +00:00
|
|
|
UserData myUserData = NULL;
|
|
|
|
|
Handle myHandle = NULL;
|
|
|
|
|
long myLength = strlen(theText);
|
|
|
|
|
OSErr myErr = noErr;
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* get the movie's user data list */
|
2005-01-11 10:58:58 +00:00
|
|
|
myUserData = GetMovieUserData(theMovie);
|
|
|
|
|
if (myUserData == NULL)
|
|
|
|
|
return(paramErr);
|
2012-07-07 22:51:57 +00:00
|
|
|
|
|
|
|
|
/* copy the specified text into a new handle */
|
2005-01-11 10:58:58 +00:00
|
|
|
myHandle = NewHandleClear(myLength);
|
|
|
|
|
if (myHandle == NULL)
|
|
|
|
|
return(MemError());
|
|
|
|
|
|
|
|
|
|
BlockMoveData(theText, *myHandle, myLength);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* add the data to the movie's user data */
|
2005-01-11 10:58:58 +00:00
|
|
|
myErr = AddUserDataText(myUserData, myHandle, theType, 1, (short)GetScriptManagerVariable(smRegionCode));
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* clean up */
|
2005-01-11 10:58:58 +00:00
|
|
|
DisposeHandle(myHandle);
|
|
|
|
|
return(myErr);
|
|
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
static void QT_CreateMyVideoTrack(int rectx, int recty, ReportList *reports)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
|
|
|
|
OSErr err = noErr;
|
|
|
|
|
Rect trackFrame;
|
2005-02-19 10:46:52 +00:00
|
|
|
// MatrixRecord myMatrix;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
trackFrame.top = 0;
|
|
|
|
|
trackFrame.left = 0;
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
trackFrame.bottom = recty;
|
|
|
|
|
trackFrame.right = rectx;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
qtexport->theTrack = NewMovieTrack(qtexport->theMovie,
|
|
|
|
|
FixRatio(trackFrame.right, 1),
|
|
|
|
|
FixRatio(trackFrame.bottom, 1),
|
|
|
|
|
0);
|
2012-04-29 17:11:40 +00:00
|
|
|
CheckError(GetMoviesError(), "NewMovieTrack error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
// SetIdentityMatrix(&myMatrix);
|
|
|
|
|
// ScaleMatrix(&myMatrix, fixed1, Long2Fix(-1), 0, 0);
|
|
|
|
|
// TranslateMatrix(&myMatrix, 0, Long2Fix(trackFrame.bottom));
|
|
|
|
|
// SetMovieMatrix(qtexport->theMovie, &myMatrix);
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
qtexport->theMedia = NewTrackMedia(qtexport->theTrack,
|
|
|
|
|
VideoMediaType,
|
|
|
|
|
qtdata->kVideoTimeScale,
|
|
|
|
|
nil,
|
|
|
|
|
0);
|
2012-04-29 17:11:40 +00:00
|
|
|
CheckError(GetMoviesError(), "NewTrackMedia error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = BeginMediaEdits(qtexport->theMedia);
|
2012-04-29 17:11:40 +00:00
|
|
|
CheckError(err, "BeginMediaEdits error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
QT_StartAddVideoSamplesToMedia(&trackFrame, rectx, recty, reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
static void QT_EndCreateMyVideoTrack(ReportList *reports)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
|
|
|
|
OSErr err = noErr;
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
QT_EndAddVideoSamplesToMedia();
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = EndMediaEdits(qtexport->theMedia);
|
2012-04-29 17:11:40 +00:00
|
|
|
CheckError(err, "EndMediaEdits error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = InsertMediaIntoTrack(qtexport->theTrack,
|
|
|
|
|
kTrackStart, /* track start time */
|
|
|
|
|
kMediaStart, /* media start time */
|
|
|
|
|
GetMediaDuration(qtexport->theMedia),
|
|
|
|
|
fixed1);
|
2012-04-29 17:11:40 +00:00
|
|
|
CheckError(err, "InsertMediaIntoTrack error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
static void QT_StartAddVideoSamplesToMedia(const Rect *trackFrame, int rectx, int recty, ReportList *reports)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
2008-04-12 13:49:00 +00:00
|
|
|
SCTemporalSettings gTemporalSettings;
|
2003-04-28 02:15:46 +00:00
|
|
|
OSErr err = noErr;
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
qtexport->ibuf = IMB_allocImBuf(rectx, recty, 32, IB_rect);
|
|
|
|
|
qtexport->ibuf2 = IMB_allocImBuf(rectx, recty, 32, IB_rect);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = NewGWorldFromPtr(&qtexport->theGWorld,
|
|
|
|
|
k32ARGBPixelFormat,
|
|
|
|
|
trackFrame,
|
|
|
|
|
NULL, NULL, 0,
|
|
|
|
|
(Ptr)qtexport->ibuf->rect,
|
|
|
|
|
rectx * 4);
|
|
|
|
|
CheckError(err, "NewGWorldFromPtr error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
qtexport->thePixMap = GetGWorldPixMap(qtexport->theGWorld);
|
|
|
|
|
LockPixels(qtexport->thePixMap);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
SCDefaultPixMapSettings(qtdata->theComponent, qtexport->thePixMap, true);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* workaround for crash with H.264, which requires an upgrade to
|
|
|
|
|
* the new callback based api for proper encoding, but that's not
|
|
|
|
|
* really compatible with rendering out frames sequentially */
|
2008-04-12 13:49:00 +00:00
|
|
|
gTemporalSettings = qtdata->gTemporalSettings;
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtdata->gSpatialSettings.codecType == kH264CodecType) {
|
|
|
|
|
if (gTemporalSettings.temporalQuality != codecMinQuality) {
|
2012-10-19 16:43:10 +00:00
|
|
|
BKE_report(reports, RPT_WARNING, "Only minimum quality compression supported for Quicktime H.264");
|
2008-04-12 13:49:00 +00:00
|
|
|
gTemporalSettings.temporalQuality = codecMinQuality;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &gTemporalSettings);
|
|
|
|
|
SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
|
|
|
|
SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
err = SCCompressSequenceBegin(qtdata->theComponent, qtexport->thePixMap, NULL, &qtexport->anImageDescription);
|
2012-05-12 16:11:34 +00:00
|
|
|
CheckError(err, "SCCompressSequenceBegin error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
static void QT_DoAddVideoSamplesToMedia(int frame, int *pixels, int rectx, int recty, ReportList *reports)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
2012-05-12 16:11:34 +00:00
|
|
|
OSErr err = noErr;
|
|
|
|
|
Rect imageRect;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
int index;
|
|
|
|
|
int boxsize;
|
2005-02-19 10:46:52 +00:00
|
|
|
unsigned char *from, *to;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
short syncFlag;
|
|
|
|
|
long dataSize;
|
|
|
|
|
Handle compressedData;
|
|
|
|
|
Ptr myPtr;
|
2005-02-19 10:46:52 +00:00
|
|
|
|
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* copy and flip renderdata */
|
2012-05-12 16:11:34 +00:00
|
|
|
memcpy(qtexport->ibuf2->rect, pixels, 4 * rectx * recty);
|
2005-02-19 10:46:52 +00:00
|
|
|
IMB_flipy(qtexport->ibuf2);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* get pointers to parse bitmapdata */
|
2005-01-11 10:58:58 +00:00
|
|
|
myPtr = GetPixBaseAddr(qtexport->thePixMap);
|
|
|
|
|
imageRect = (**qtexport->thePixMap).bounds;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-02-19 10:46:52 +00:00
|
|
|
from = (unsigned char *) qtexport->ibuf2->rect;
|
|
|
|
|
to = (unsigned char *) myPtr;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* parse RGBA bitmap into Quicktime's ARGB GWorld */
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
boxsize = rectx * recty;
|
2012-05-12 16:11:34 +00:00
|
|
|
for (index = 0; index < boxsize; index++) {
|
2005-02-19 10:46:52 +00:00
|
|
|
to[0] = from[3];
|
|
|
|
|
to[1] = from[0];
|
|
|
|
|
to[2] = from[1];
|
|
|
|
|
to[3] = from[2];
|
2012-05-12 16:11:34 +00:00
|
|
|
to += 4, from += 4;
|
2005-02-19 10:46:52 +00:00
|
|
|
}
|
2005-01-12 11:03:25 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
err = SCCompressSequenceFrame(qtdata->theComponent,
|
2012-05-12 16:11:34 +00:00
|
|
|
qtexport->thePixMap,
|
|
|
|
|
&imageRect,
|
|
|
|
|
&compressedData,
|
|
|
|
|
&dataSize,
|
|
|
|
|
&syncFlag);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCCompressSequenceFrame error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
err = AddMediaSample(qtexport->theMedia,
|
2012-05-12 16:11:34 +00:00
|
|
|
compressedData,
|
|
|
|
|
0,
|
|
|
|
|
dataSize,
|
|
|
|
|
qtdata->duration,
|
|
|
|
|
(SampleDescriptionHandle)qtexport->anImageDescription,
|
|
|
|
|
1,
|
|
|
|
|
syncFlag,
|
|
|
|
|
NULL);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "AddMediaSample error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
static void QT_EndAddVideoSamplesToMedia(void)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
2005-01-11 10:58:58 +00:00
|
|
|
SCCompressSequenceEnd(qtdata->theComponent);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
UnlockPixels(qtexport->thePixMap);
|
2005-02-19 10:46:52 +00:00
|
|
|
if (qtexport->theGWorld)
|
2012-05-12 16:11:34 +00:00
|
|
|
DisposeGWorld(qtexport->theGWorld);
|
2005-02-19 10:46:52 +00:00
|
|
|
|
|
|
|
|
if (qtexport->ibuf)
|
|
|
|
|
IMB_freeImBuf(qtexport->ibuf);
|
|
|
|
|
|
|
|
|
|
if (qtexport->ibuf2)
|
|
|
|
|
IMB_freeImBuf(qtexport->ibuf2);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
void filepath_qt(char *string, RenderData *rd)
|
|
|
|
|
{
|
2003-04-28 02:15:46 +00:00
|
|
|
char txt[64];
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
if (string == 0) return;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
strcpy(string, rd->pic);
|
2010-10-18 06:41:16 +00:00
|
|
|
BLI_path_abs(string, G.main->name);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
2006-01-23 22:05:47 +00:00
|
|
|
BLI_make_existing_file(string);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-04-02 15:36:57 +00:00
|
|
|
if (BLI_strcasecmp(string + strlen(string) - 4, ".mov")) {
|
2012-04-29 17:11:40 +00:00
|
|
|
sprintf(txt, "%04d-%04d.mov", (rd->sfra), (rd->efra));
|
2003-04-28 02:15:46 +00:00
|
|
|
strcat(string, txt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
int start_qt(struct Scene *scene, struct RenderData *rd, int rectx, int recty, ReportList *reports)
|
|
|
|
|
{
|
2003-04-28 02:15:46 +00:00
|
|
|
OSErr err = noErr;
|
|
|
|
|
|
|
|
|
|
char name[2048];
|
|
|
|
|
char theFullPath[255];
|
|
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2012-05-12 16:11:34 +00:00
|
|
|
int myFile;
|
|
|
|
|
FSRef myRef;
|
2004-12-10 01:28:28 +00:00
|
|
|
#else
|
2012-05-12 16:11:34 +00:00
|
|
|
char *qtname;
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
2012-05-12 16:11:34 +00:00
|
|
|
int success = 1;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtexport == NULL) qtexport = MEM_callocN(sizeof(QuicktimeExport), "QuicktimeExport");
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtdata) {
|
|
|
|
|
if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
|
2005-01-11 10:58:58 +00:00
|
|
|
free_qtcomponentdata();
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeCodecDataExt");
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rd->qtcodecdata == NULL || rd->qtcodecdata->cdParms == NULL) {
|
2009-12-22 15:20:31 +00:00
|
|
|
get_qtcodec_settings(rd, reports);
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2005-01-11 10:58:58 +00:00
|
|
|
qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
QT_GetCodecSettingsFromScene(rd, reports);
|
|
|
|
|
check_renderbutton_framerate(rd, reports);
|
2003-05-21 01:21:07 +00:00
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-12-22 12:01:32 +00:00
|
|
|
sframe = (rd->sfra);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2010-01-08 13:52:38 +00:00
|
|
|
filepath_qt(name, rd);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2009-12-22 12:01:32 +00:00
|
|
|
EnterMoviesOnThread(0);
|
2013-03-14 10:39:18 +00:00
|
|
|
strcpy(theFullPath, name);
|
2009-12-22 12:01:32 +00:00
|
|
|
|
|
|
|
|
/* hack: create an empty file to make FSPathMakeRef() happy */
|
2012-05-12 16:11:34 +00:00
|
|
|
myFile = open(theFullPath, O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRUSR | S_IWUSR);
|
2009-12-22 12:01:32 +00:00
|
|
|
if (myFile < 0) {
|
2012-10-19 16:43:10 +00:00
|
|
|
BKE_report(reports, RPT_ERROR, "Error while creating movie file!");
|
2009-12-22 12:01:32 +00:00
|
|
|
/* do something? */
|
|
|
|
|
}
|
|
|
|
|
close(myFile);
|
|
|
|
|
err = FSPathMakeRef((const UInt8 *)theFullPath, &myRef, 0);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "FsPathMakeRef error", reports);
|
2009-12-22 12:01:32 +00:00
|
|
|
err = FSGetCatalogInfo(&myRef, kFSCatInfoNone, NULL, NULL, &qtexport->theSpec, NULL);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "FsGetCatalogInfoRef error", reports);
|
2005-02-19 10:46:52 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef _WIN32
|
2009-12-22 12:01:32 +00:00
|
|
|
qtname = get_valid_qtname(name);
|
2013-03-14 10:39:18 +00:00
|
|
|
strcpy(theFullPath, qtname);
|
2009-12-22 12:01:32 +00:00
|
|
|
strcpy(name, qtname);
|
|
|
|
|
MEM_freeN(qtname);
|
|
|
|
|
|
|
|
|
|
CopyCStringToPascal(theFullPath, qtexport->qtfilename);
|
|
|
|
|
err = FSMakeFSSpec(0, 0L, qtexport->qtfilename, &qtexport->theSpec);
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = CreateMovieFile(&qtexport->theSpec,
|
|
|
|
|
kMyCreatorType,
|
|
|
|
|
smCurrentScript,
|
|
|
|
|
createMovieFileDeleteCurFile | createMovieFileDontCreateResFile,
|
|
|
|
|
&qtexport->resRefNum,
|
|
|
|
|
&qtexport->theMovie);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "CreateMovieFile error", reports);
|
2009-12-22 12:01:32 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (err != noErr) {
|
2009-12-22 12:01:32 +00:00
|
|
|
BKE_reportf(reports, RPT_ERROR, "Unable to create Quicktime movie: %s", name);
|
2012-05-12 16:11:34 +00:00
|
|
|
success = 0;
|
2009-12-02 11:23:11 +00:00
|
|
|
#ifdef __APPLE__
|
2009-12-22 12:01:32 +00:00
|
|
|
ExitMoviesOnThread();
|
2009-12-02 11:23:11 +00:00
|
|
|
#endif
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-10-13 15:44:50 +00:00
|
|
|
/* printf("Created QuickTime movie: %s\n", name); */
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
QT_CreateMyVideoTrack(rectx, recty, reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
2009-12-22 12:01:32 +00:00
|
|
|
|
|
|
|
|
return success;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-02-13 20:47:29 +00:00
|
|
|
int append_qt(struct RenderData *rd, int start_frame, int frame, int *pixels, int rectx, int recty, ReportList *reports)
|
2011-12-30 07:55:15 +00:00
|
|
|
{
|
2009-12-22 15:20:31 +00:00
|
|
|
QT_DoAddVideoSamplesToMedia(frame, pixels, rectx, recty, reports);
|
|
|
|
|
return 1;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
void end_qt(void)
|
|
|
|
|
{
|
2003-04-28 02:15:46 +00:00
|
|
|
OSErr err = noErr;
|
2005-01-12 10:18:47 +00:00
|
|
|
short resId = movieInDataForkResID;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtexport->theMovie) {
|
2009-12-22 15:20:31 +00:00
|
|
|
QT_EndCreateMyVideoTrack(NULL);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = AddMovieResource(qtexport->theMovie, qtexport->resRefNum, &resId, qtexport->qtfilename);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "AddMovieResource error", NULL);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-11 10:58:58 +00:00
|
|
|
err = QT_AddUserDataTextToMovie(qtexport->theMovie, "Made with Blender", kUserDataTextInformation);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "AddUserDataTextToMovie error", NULL);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2005-01-12 10:18:47 +00:00
|
|
|
err = UpdateMovieResource(qtexport->theMovie, qtexport->resRefNum, resId, qtexport->qtfilename);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "UpdateMovieResource error", NULL);
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtexport->resRefNum) CloseMovieFile(qtexport->resRefNum);
|
2005-01-11 10:58:58 +00:00
|
|
|
|
|
|
|
|
DisposeMovie(qtexport->theMovie);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-10-13 15:44:50 +00:00
|
|
|
/* printf("Finished QuickTime movie.\n"); */
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
2005-01-11 10:58:58 +00:00
|
|
|
|
2010-10-19 18:59:15 +00:00
|
|
|
#ifdef __APPLE__
|
2012-05-12 16:11:34 +00:00
|
|
|
ExitMoviesOnThread();
|
2010-10-19 18:59:15 +00:00
|
|
|
#endif
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtexport) {
|
2005-01-11 10:58:58 +00:00
|
|
|
MEM_freeN(qtexport);
|
|
|
|
|
qtexport = NULL;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2011-12-30 07:55:15 +00:00
|
|
|
void free_qtcomponentdata(void)
|
|
|
|
|
{
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtdata) {
|
|
|
|
|
if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
|
2005-01-11 10:58:58 +00:00
|
|
|
MEM_freeN(qtdata);
|
|
|
|
|
qtdata = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
static void check_renderbutton_framerate(RenderData *rd, ReportList *reports)
|
2009-01-04 14:14:06 +00:00
|
|
|
{
|
2012-07-07 22:51:57 +00:00
|
|
|
/* to keep float framerates consistent between the codec dialog and frs/sec button. */
|
2012-05-12 16:11:34 +00:00
|
|
|
OSErr err;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCGetInfo fr error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-03-24 06:24:53 +00:00
|
|
|
if ( (rd->frs_sec == 24 || rd->frs_sec == 30 || rd->frs_sec == 60) &&
|
2012-05-12 16:11:34 +00:00
|
|
|
(qtdata->gTemporalSettings.frameRate == 1571553 ||
|
|
|
|
|
qtdata->gTemporalSettings.frameRate == 1964113 ||
|
|
|
|
|
qtdata->gTemporalSettings.frameRate == 3928227))
|
2011-11-11 13:09:14 +00:00
|
|
|
{
|
|
|
|
|
/* do nothing */
|
|
|
|
|
}
|
2009-11-09 17:06:48 +00:00
|
|
|
else {
|
|
|
|
|
if (rd->frs_sec_base > 0)
|
|
|
|
|
qtdata->gTemporalSettings.frameRate =
|
2012-05-12 16:11:34 +00:00
|
|
|
((float)(rd->frs_sec << 16) / rd->frs_sec_base);
|
2009-11-09 17:06:48 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2012-04-29 17:11:40 +00:00
|
|
|
CheckError(err, "SCSetInfo error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
if (qtdata->gTemporalSettings.frameRate == 1571553) { /* 23.98 fps */
|
2008-03-12 22:01:57 +00:00
|
|
|
qtdata->kVideoTimeScale = 24000;
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
qtdata->duration = 1001;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
2012-10-20 20:20:02 +00:00
|
|
|
else if (qtdata->gTemporalSettings.frameRate == 1964113) { /* 29.97 fps */
|
2008-03-12 22:01:57 +00:00
|
|
|
qtdata->kVideoTimeScale = 30000;
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
qtdata->duration = 1001;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
2012-10-20 20:20:02 +00:00
|
|
|
else if (qtdata->gTemporalSettings.frameRate == 3928227) { /* 59.94 fps */
|
2008-03-12 22:01:57 +00:00
|
|
|
qtdata->kVideoTimeScale = 60000;
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
qtdata->duration = 1001;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2005-01-11 10:58:58 +00:00
|
|
|
qtdata->kVideoTimeScale = (qtdata->gTemporalSettings.frameRate >> 16) * 100;
|
|
|
|
|
qtdata->duration = 100;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-05-21 01:21:07 +00:00
|
|
|
|
2011-12-23 22:07:34 +00:00
|
|
|
void quicktime_verify_image_type(RenderData *rd, ImageFormatData *imf)
|
2009-11-20 10:37:50 +00:00
|
|
|
{
|
2011-12-23 22:07:34 +00:00
|
|
|
if (imf->imtype == R_IMF_IMTYPE_QUICKTIME) {
|
2012-05-12 16:11:34 +00:00
|
|
|
if ((rd->qtcodecsettings.codecType == 0) ||
|
|
|
|
|
(rd->qtcodecsettings.codecSpatialQuality < 0) ||
|
2012-05-20 19:49:27 +00:00
|
|
|
(rd->qtcodecsettings.codecSpatialQuality > 100))
|
|
|
|
|
{
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->qtcodecsettings.codecType = kJPEGCodecType;
|
|
|
|
|
rd->qtcodecsettings.codec = (int)anyCodec;
|
2012-05-12 16:11:34 +00:00
|
|
|
rd->qtcodecsettings.codecSpatialQuality = (codecHighQuality * 100) / codecLosslessQuality;
|
|
|
|
|
rd->qtcodecsettings.codecTemporalQuality = (codecHighQuality * 100) / codecLosslessQuality;
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->qtcodecsettings.keyFrameRate = 25;
|
2012-10-20 20:20:02 +00:00
|
|
|
rd->qtcodecsettings.bitRate = 5000000; /* 5 Mbps */
|
2009-11-20 10:37:50 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
int get_qtcodec_settings(RenderData *rd, ReportList *reports)
|
2003-04-28 02:15:46 +00:00
|
|
|
{
|
2009-12-02 11:23:11 +00:00
|
|
|
OSErr err = noErr;
|
2012-07-07 22:51:57 +00:00
|
|
|
/* erase any existing codecsetting */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtdata) {
|
|
|
|
|
if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
|
2005-01-11 10:58:58 +00:00
|
|
|
free_qtcomponentdata();
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* allocate new */
|
2005-01-11 10:58:58 +00:00
|
|
|
qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeComponentData");
|
|
|
|
|
qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* get previous selected codecsetting, from qtatom or detailed settings */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
|
2009-12-23 11:49:07 +00:00
|
|
|
QT_GetCodecSettingsFromScene(rd, reports);
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-12 16:11:34 +00:00
|
|
|
SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-12-02 11:23:11 +00:00
|
|
|
qtdata->gSpatialSettings.codecType = rd->qtcodecsettings.codecType;
|
|
|
|
|
qtdata->gSpatialSettings.codec = (CodecComponent)rd->qtcodecsettings.codec;
|
2012-05-12 16:11:34 +00:00
|
|
|
qtdata->gSpatialSettings.spatialQuality = (rd->qtcodecsettings.codecSpatialQuality * codecLosslessQuality) / 100;
|
|
|
|
|
qtdata->gTemporalSettings.temporalQuality = (rd->qtcodecsettings.codecTemporalQuality * codecLosslessQuality) / 100;
|
2009-12-02 11:23:11 +00:00
|
|
|
qtdata->gTemporalSettings.keyFrameRate = rd->qtcodecsettings.keyFrameRate;
|
|
|
|
|
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;
|
2012-05-12 16:11:34 +00:00
|
|
|
SetMovieTimeScale(qtexport->theMovie, rd->frs_sec_base * 1000);
|
2009-12-02 11:23:11 +00:00
|
|
|
|
|
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCSetInfo1 error", reports);
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCSetInfo2 error", reports);
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCSetInfo3 error", reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
2003-05-21 02:26:45 +00:00
|
|
|
|
2009-12-22 15:20:31 +00:00
|
|
|
check_renderbutton_framerate(rd, reports);
|
2009-12-02 11:23:11 +00:00
|
|
|
|
|
|
|
|
return err;
|
|
|
|
|
}
|
2003-05-21 02:26:45 +00:00
|
|
|
|
2009-12-02 14:39:49 +00:00
|
|
|
static int request_qtcodec_settings(bContext *C, wmOperator *op)
|
2009-12-02 11:23:11 +00:00
|
|
|
{
|
2012-05-12 16:11:34 +00:00
|
|
|
OSErr err = noErr;
|
2009-12-02 14:39:49 +00:00
|
|
|
Scene *scene = CTX_data_scene(C);
|
|
|
|
|
RenderData *rd = &scene->r;
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* erase any existing codecsetting */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (qtdata) {
|
|
|
|
|
if (qtdata->theComponent) CloseComponent(qtdata->theComponent);
|
2009-12-02 14:39:49 +00:00
|
|
|
free_qtcomponentdata();
|
|
|
|
|
}
|
2012-07-07 22:51:57 +00:00
|
|
|
|
|
|
|
|
/* allocate new */
|
2009-12-02 14:39:49 +00:00
|
|
|
qtdata = MEM_callocN(sizeof(QuicktimeComponentData), "QuicktimeComponentData");
|
|
|
|
|
qtdata->theComponent = OpenDefaultComponent(StandardCompressionType, StandardCompressionSubType);
|
2012-07-07 22:51:57 +00:00
|
|
|
|
|
|
|
|
/* get previous selected codecsetting, from qtatom or detailed settings */
|
2012-03-24 06:24:53 +00:00
|
|
|
if (rd->qtcodecdata && rd->qtcodecdata->cdParms) {
|
2009-12-23 11:49:07 +00:00
|
|
|
QT_GetCodecSettingsFromScene(rd, op->reports);
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-12 16:11:34 +00:00
|
|
|
SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2009-12-02 14:39:49 +00:00
|
|
|
|
|
|
|
|
qtdata->gSpatialSettings.codecType = rd->qtcodecsettings.codecType;
|
|
|
|
|
qtdata->gSpatialSettings.codec = (CodecComponent)rd->qtcodecsettings.codec;
|
2012-05-12 16:11:34 +00:00
|
|
|
qtdata->gSpatialSettings.spatialQuality = (rd->qtcodecsettings.codecSpatialQuality * codecLosslessQuality) / 100;
|
|
|
|
|
qtdata->gTemporalSettings.temporalQuality = (rd->qtcodecsettings.codecTemporalQuality * codecLosslessQuality) / 100;
|
2009-12-02 14:39:49 +00:00
|
|
|
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;
|
|
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
qtdata->aDataRateSetting.frameDuration = rd->frs_sec;
|
2009-12-02 14:39:49 +00:00
|
|
|
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCSetInfo1 error", op->reports);
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCSetInfo2 error", op->reports);
|
2012-05-12 16:11:34 +00:00
|
|
|
err = SCSetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
2009-12-22 15:20:31 +00:00
|
|
|
CheckError(err, "SCSetInfo3 error", op->reports);
|
2009-12-02 14:39:49 +00:00
|
|
|
}
|
2012-07-07 22:51:57 +00:00
|
|
|
/* put up the dialog box - it needs to be called from the main thread */
|
2005-01-11 10:58:58 +00:00
|
|
|
err = SCRequestSequenceSettings(qtdata->theComponent);
|
2012-07-07 22:51:57 +00:00
|
|
|
|
2003-05-09 12:45:59 +00:00
|
|
|
if (err == scUserCancelled) {
|
2009-12-03 12:16:00 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* update runtime codecsettings for use with the codec dialog */
|
2012-05-12 16:11:34 +00:00
|
|
|
SCGetInfo(qtdata->theComponent, scDataRateSettingsType, &qtdata->aDataRateSetting);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scSpatialSettingsType, &qtdata->gSpatialSettings);
|
|
|
|
|
SCGetInfo(qtdata->theComponent, scTemporalSettingsType, &qtdata->gTemporalSettings);
|
2009-12-02 11:23:11 +00:00
|
|
|
|
|
|
|
|
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Fill the render QuicktimeCodecSettings struct */
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->qtcodecsettings.codecTemporalQuality = (qtdata->gTemporalSettings.temporalQuality * 100) / codecLosslessQuality;
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Do not override scene frame rate (qtdata->gTemporalSettings.framerate) */
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->qtcodecsettings.keyFrameRate = qtdata->gTemporalSettings.keyFrameRate;
|
|
|
|
|
|
|
|
|
|
rd->qtcodecsettings.codecType = qtdata->gSpatialSettings.codecType;
|
|
|
|
|
rd->qtcodecsettings.codec = (int)qtdata->gSpatialSettings.codec;
|
|
|
|
|
rd->qtcodecsettings.colorDepth = qtdata->gSpatialSettings.depth;
|
|
|
|
|
rd->qtcodecsettings.codecSpatialQuality = (qtdata->gSpatialSettings.spatialQuality * 100) / codecLosslessQuality;
|
|
|
|
|
|
|
|
|
|
rd->qtcodecsettings.bitRate = qtdata->aDataRateSetting.dataRate;
|
|
|
|
|
rd->qtcodecsettings.minSpatialQuality = (qtdata->aDataRateSetting.minSpatialQuality * 100) / codecLosslessQuality;
|
|
|
|
|
rd->qtcodecsettings.minTemporalQuality = (qtdata->aDataRateSetting.minTemporalQuality * 100) / codecLosslessQuality;
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Frame duration is already known (qtdata->aDataRateSetting.frameDuration) */
|
2009-12-02 11:23:11 +00:00
|
|
|
|
2009-12-23 11:49:07 +00:00
|
|
|
QT_SaveCodecSettingsToScene(rd, op->reports);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2012-07-07 22:51:57 +00:00
|
|
|
/* framerate jugglin' */
|
2012-10-20 20:20:02 +00:00
|
|
|
if (qtdata->gTemporalSettings.frameRate == 1571553) { /* 23.98 fps */
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
qtdata->kVideoTimeScale = 24000;
|
|
|
|
|
qtdata->duration = 1001;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
rd->frs_sec = 24;
|
|
|
|
|
rd->frs_sec_base = 1.001;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
2012-10-20 20:20:02 +00:00
|
|
|
else if (qtdata->gTemporalSettings.frameRate == 1964113) { /* 29.97 fps */
|
2008-03-12 22:01:57 +00:00
|
|
|
qtdata->kVideoTimeScale = 30000;
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
qtdata->duration = 1001;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
rd->frs_sec = 30;
|
|
|
|
|
rd->frs_sec_base = 1.001;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
2012-10-20 20:20:02 +00:00
|
|
|
else if (qtdata->gTemporalSettings.frameRate == 3928227) { /* 59.94 fps */
|
2008-03-12 22:01:57 +00:00
|
|
|
qtdata->kVideoTimeScale = 60000;
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
qtdata->duration = 1001;
|
2003-04-28 02:15:46 +00:00
|
|
|
|
2009-01-04 14:14:06 +00:00
|
|
|
rd->frs_sec = 60;
|
|
|
|
|
rd->frs_sec_base = 1.001;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
double fps = qtdata->gTemporalSettings.frameRate;
|
|
|
|
|
|
2008-03-12 22:01:57 +00:00
|
|
|
qtdata->kVideoTimeScale = 60000;
|
2005-01-11 10:58:58 +00:00
|
|
|
qtdata->duration = qtdata->kVideoTimeScale / (qtdata->gTemporalSettings.frameRate / 65536);
|
2003-04-28 02:15:46 +00:00
|
|
|
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
if ((qtdata->gTemporalSettings.frameRate & 0xffff) == 0) {
|
2009-01-04 14:14:06 +00:00
|
|
|
rd->frs_sec = fps / 65536;
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->frs_sec_base = 1.0;
|
2012-03-24 06:24:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
/* we do our very best... */
|
2009-12-02 11:23:11 +00:00
|
|
|
rd->frs_sec = fps / 65536;
|
|
|
|
|
rd->frs_sec_base = 1.0;
|
== Core ==
This adds fractional FPS support to blender and should finally
make NTSC work correctly.
NTSC has an FPS of 30.0/1.001 which is approximately 29.97 FPS.
Therefore, it is not enough to simply make frs_sec a float, since
you can't represent this accurately enough.
I added a seperate variable frs_sec_base and FPS is now
frs_sec / frs_sec_base.
I changed all the places, where frs_sec was used to my best knowledge.
For convenience sake, I added several macros, that should make life
easier in the future:
FRA2TIME(a) : convert frame number to a double precision time in seconds
TIME2FRA(a) : the same in the opposite direction
FPS : return current FPS as a double precision number
(last resort)
This closes bug #6715
Standard framerates not supported / breaks sync -- 23.967 29.967 etc.
https://projects.blender.org/tracker/?func=detail&aid=6715&group_id=9&atid=125
Please give this heavy testing with NTSC files, quicktime in/export
and the python interface.
Errors are most probably only spotted on longer timelines, so that is
also important.
The patch was tested by Troy Sobotka and me, so it most probably should
work out of the box, but wider testing is important, since errors are
very subtle.
Enjoy!
2007-10-21 15:42:08 +00:00
|
|
|
}
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-03 12:16:00 +00:00
|
|
|
return OPERATOR_FINISHED;
|
2003-04-28 02:15:46 +00:00
|
|
|
}
|
|
|
|
|
|
2009-12-02 14:39:49 +00:00
|
|
|
static int ED_operator_setqtcodec(bContext *C)
|
|
|
|
|
{
|
|
|
|
|
return G.have_quicktime != FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-12-03 12:16:00 +00:00
|
|
|
#if defined(__APPLE__) && defined(GHOST_COCOA)
|
2012-10-20 20:20:02 +00:00
|
|
|
/* Need to set up a Cocoa NSAutoReleasePool to avoid memory leak
|
|
|
|
|
* And it must be done in an objC file, so use a GHOST_SystemCocoa.mm function for that */
|
2009-12-03 12:16:00 +00:00
|
|
|
extern int cocoa_request_qtcodec_settings(bContext *C, wmOperator *op);
|
|
|
|
|
|
|
|
|
|
int fromcocoa_request_qtcodec_settings(bContext *C, wmOperator *op)
|
|
|
|
|
{
|
|
|
|
|
return request_qtcodec_settings(C, op);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-12-02 14:39:49 +00:00
|
|
|
|
|
|
|
|
void SCENE_OT_render_data_set_quicktime_codec(wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
2013-01-27 07:23:58 +00:00
|
|
|
ot->name = "Change Codec";
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->description = "Change Quicktime codec Settings";
|
|
|
|
|
ot->idname = "SCENE_OT_render_data_set_quicktime_codec";
|
2009-12-02 14:39:49 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* api callbacks */
|
2009-12-03 12:16:00 +00:00
|
|
|
#if defined(__APPLE__) && defined(GHOST_COCOA)
|
|
|
|
|
ot->exec = cocoa_request_qtcodec_settings;
|
|
|
|
|
#else
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->exec = request_qtcodec_settings;
|
2009-12-03 12:16:00 +00:00
|
|
|
#endif
|
2012-03-22 07:26:09 +00:00
|
|
|
ot->poll = ED_operator_setqtcodec;
|
2009-12-02 14:39:49 +00:00
|
|
|
|
2010-03-22 09:30:00 +00:00
|
|
|
/* flags */
|
2012-05-12 16:11:34 +00:00
|
|
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
2009-12-02 14:39:49 +00:00
|
|
|
}
|
|
|
|
|
|
OS X Makefiles:
* added some new variables (mostly the same as with scons):
- USE_COCOA: use Cocoa for ghost (defaults to true)
- MACOSX_ARCHITECTURE: can be ppc, ppc64, i386, x86_64. By default this is the host architecture
(ppc for PowerPC Macs, i386 for Intel Macs). In theory this allows to cross compile blender for
a different architecture, though cross compilation only works on Intel Macs, because makesdna
and makesrna are built for the target architecture.
For a 64 bit build, set MACOSX_ARCHITECTURE to x86_64 (Intel) or ppc64 (PowerPC).
- MACOSX_MIN_VERS: minimum OS X version to run blender on (10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_DEPLOYMENT_TARGET: needed by the linker to create an Application targeted for a specific
OS version (defaults to 10.4 for 32 bit builds, 10.5 for 64 bit builds)
- MACOSX_SDK: path to a specific SDK. currently not used
- USE_QTKIT: use QTKit instead of QuickTime (defaults to true for 64 bit builds, as using QTKit
is mandatory in that case))
* use the same compiler flags as scons
* default compiler now is gcc-4.0 when building for 10.4 and gcc-4.2 when building for 10.5
* extract $(LCGDIR)/release/python_$(MACOSX_ARCHITECTURE).zip to Application bundle. This might
break building on 10.4, to fix that, rename $(LCGDIR)/release/python.zip
When compiling blender, only MACOSX_ARCHITECTURE might be of interest, as it allows doing 64 bit
builds (or 32 bit PowerPC builds on Intel). All other variables are then set to reasonable defaults.
For current users of the Makefile system, this commit shouldn't change much.
2010-01-03 20:35:13 +00:00
|
|
|
#endif /* USE_QTKIT */
|
2003-04-28 02:15:46 +00:00
|
|
|
#endif /* _WIN32 || __APPLE__ */
|
|
|
|
|
#endif /* WITH_QUICKTIME */
|
|
|
|
|
|