diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-13 12:26:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-13 12:26:56 +0300 |
commit | 5864269b2c60b150e8ad4244ae6dfccc04f0b44a (patch) | |
tree | fb11460098269de11de2843ca29e9a61c8fa7bda | |
parent | 46e1d85e61aac190e382359d722fafbd533d35ee (diff) | |
parent | 617c4d6adbfe64b3a72b5c48f918f39d30aa18dc (diff) |
Merge branch 'master' into blender2.8
172 files changed, 25085 insertions, 2856 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b558fe14820..1c933d38ab9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -229,6 +229,11 @@ option(WITH_BULLET "Enable Bullet (Physics Engine)" ON) option(WITH_SYSTEM_BULLET "Use the systems bullet library (currently unsupported due to missing features in upstream!)" ) mark_as_advanced(WITH_SYSTEM_BULLET) option(WITH_GAMEENGINE "Enable Game Engine" ${_init_GAMEENGINE}) +if(APPLE) + set(WITH_GAMEENGINE_DECKLINK OFF) +else() + option(WITH_GAMEENGINE_DECKLINK "Support BlackMagicDesign DeckLink cards in the Game Engine" ON) +endif() option(WITH_PLAYER "Build Player" OFF) option(WITH_OPENCOLORIO "Enable OpenColorIO color management" ${_init_OPENCOLORIO}) @@ -273,6 +278,7 @@ endif() if(WITH_X11) option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON) option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON) + option(WITH_X11_ALPHA "Enable X11 transparent background" ON) endif() if(UNIX AND NOT APPLE) @@ -723,6 +729,7 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS) set(WITH_X11 OFF) set(WITH_X11_XINPUT OFF) set(WITH_X11_XF86VMODE OFF) + set(WITH_X11_ALPHA OFF) set(WITH_GHOST_XDND OFF) set(WITH_INPUT_IME OFF) endif() @@ -862,6 +869,16 @@ if(WITH_X11) endif() endif() + if(WITH_X11_ALPHA) + find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) + mark_as_advanced(X11_Xrender_LIB) + if (X11_Xrender_LIB) + list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB}) + else() + set(WITH_X11_ALPHA OFF) + endif() + endif() + endif() @@ -3199,6 +3216,7 @@ if(FIRST_RUN) info_cfg_text("System Options:") info_cfg_option(WITH_INSTALL_PORTABLE) + info_cfg_option(WITH_X11_ALPHA) info_cfg_option(WITH_X11_XF86VMODE) info_cfg_option(WITH_X11_XINPUT) info_cfg_option(WITH_MEM_JEMALLOC) diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh index b3d659313d4..e380362a11e 100755 --- a/build_files/build_environment/install_deps.sh +++ b/build_files/build_environment/install_deps.sh @@ -25,7 +25,7 @@ ARGS=$( \ getopt \ -o s:i:t:h \ ---long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-confirm,with-all,with-opencollada,\ +--long source:,install:,tmp:,info:,threads:,help,show-deps,no-sudo,no-build,no-confirm,with-all,with-opencollada,\ ver-ocio:,ver-oiio:,ver-llvm:,ver-osl:,ver-osd:,ver-openvdb:,\ force-all,force-python,force-numpy,force-boost,\ force-ocio,force-openexr,force-oiio,force-llvm,force-osl,force-osd,force-openvdb,\ @@ -97,6 +97,9 @@ ARGUMENTS_INFO="\"COMMAND LINE ARGUMENTS: --no-sudo Disable use of sudo (this script won't be able to do much though, will just print needed packages...). + --no-build + Do not build (compile) anything, dependencies not installable with the package manager will remain missing. + --no-confirm Disable any interaction with user (suitable for automated run). @@ -267,6 +270,7 @@ DO_SHOW_DEPS=false SUDO="sudo" +NO_BUILD=false NO_CONFIRM=false PYTHON_VERSION="3.5.1" @@ -463,6 +467,12 @@ while true; do PRINT "" SUDO=""; shift; continue ;; + --no-build) + PRINT "" + WARNING "--no-build enabled, this script will not be able to install all dependencies..." + PRINT "" + NO_BUILD=true; shift; continue + ;; --no-confirm) NO_CONFIRM=true; shift; continue ;; @@ -967,6 +977,11 @@ clean_Python() { } compile_Python() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, Python will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! py_magic=1 _init_python @@ -1032,6 +1047,11 @@ clean_Numpy() { } compile_Numpy() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, Numpy will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! numpy_magic=0 _init_numpy @@ -1092,6 +1112,11 @@ clean_Boost() { } compile_Boost() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, Boost will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! boost_magic=10 @@ -1165,6 +1190,11 @@ clean_OCIO() { } compile_OCIO() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenColorIO will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! ocio_magic=1 _init_ocio @@ -1256,6 +1286,11 @@ clean_ILMBASE() { } compile_ILMBASE() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, ILMBase will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! ilmbase_magic=10 _init_ilmbase @@ -1343,6 +1378,11 @@ clean_OPENEXR() { } compile_OPENEXR() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenEXR will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! openexr_magic=14 @@ -1458,6 +1498,11 @@ clean_OIIO() { } compile_OIIO() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenImageIO will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! oiio_magic=16 _init_oiio @@ -1589,6 +1634,11 @@ clean_LLVM() { } compile_LLVM() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, LLVM will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! llvm_magic=3 _init_llvm @@ -1686,6 +1736,11 @@ clean_OSL() { } compile_OSL() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenShadingLanguage will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! osl_magic=20 _init_osl @@ -1812,6 +1867,11 @@ clean_OSD() { } compile_OSD() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenSubdiv will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! osd_magic=1 _init_osd @@ -1904,6 +1964,11 @@ clean_BLOSC() { } compile_BLOSC() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, Blosc will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! blosc_magic=0 _init_blosc @@ -1986,6 +2051,11 @@ clean_OPENVDB() { } compile_OPENVDB() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenVDB will not be compiled!" + return + fi + compile_BLOSC PRINT "" @@ -2082,6 +2152,11 @@ clean_OpenCOLLADA() { } compile_OpenCOLLADA() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, OpenCOLLADA will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled results! opencollada_magic=9 _init_opencollada @@ -2161,6 +2236,11 @@ clean_FFmpeg() { } compile_FFmpeg() { + if [ "$NO_BUILD" = true ]; then + WARNING "--no-build enabled, ffmpeg will not be compiled!" + return + fi + # To be changed each time we make edits that would modify the compiled result! ffmpeg_magic=5 _init_ffmpeg diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 3aa938b63d7..d29f086069a 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -685,6 +685,14 @@ function(SETUP_BLENDER_SORTED_LIBS) list_insert_after(BLENDER_SORTED_LIBS "ge_logic_ngnetwork" "extern_bullet") endif() + if(WITH_GAMEENGINE_DECKLINK) + list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink) + endif() + + if(WIN32) + list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect) + endif() + if(WITH_OPENSUBDIV) list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv) endif() diff --git a/doc/python_api/examples/bge.texture.2.py b/doc/python_api/examples/bge.texture.2.py new file mode 100644 index 00000000000..96619007fba --- /dev/null +++ b/doc/python_api/examples/bge.texture.2.py @@ -0,0 +1,237 @@ +""" +Video Capture with DeckLink ++++++++++++++++++++++++++++ +Video frames captured with DeckLink cards have pixel formats that are generally not directly +usable by OpenGL, they must be processed by a shader. The three shaders presented here should +cover all common video capture cases. + +This file reflects the current video transfer method implemented in the Decklink module: +whenever possible the video images are transferred as float texture because this is more +compatible with GPUs. Of course, only the pixel formats that have a correspondant GL format +can be transferred as float. Look for fg_shaders in this file for an exhaustive list. + +Other pixel formats will be transferred as 32 bits integer red-channel texture but this +won't work with certain GPU (Intel GMA); the corresponding shaders are not shown here. +However, it should not be necessary to use any of them as the list below covers all practical +cases of video capture with all types of Decklink product. + +In other words, only use one of the pixel format below and you will be fine. Note that depending +on the video stream, only certain pixel formats will be allowed (others will throw an exception). +For example, to capture a PAL video stream, you must use one of the YUV formats. + +To find which pixel format is suitable for a particular video stream, use the 'Media Express' +utility that comes with the Decklink software : if you see the video in the 'Log and Capture' +Window, you have selected the right pixel format and you can use the same in Blender. + +Notes: * these shaders only decode the RGB channel and set the alpha channel to a fixed +value (look for color.a = ). It's up to you to add postprocessing to the color. + * these shaders are compatible with 2D and 3D video stream +""" +import bge +from bge import logic +from bge import texture as vt + +# The default vertex shader, because we need one +# +VertexShader = """ +#version 130 + void main() + { + gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_TexCoord[0] = gl_MultiTexCoord0; + } + +""" + +# For use with RGB video stream: the pixel is directly usable +# +FragmentShader_R10l = """ + #version 130 + uniform sampler2D tex; + // stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above) + uniform float stereo; + // eye = 0.0 for the left eye, 0.5 for the right eye + uniform float eye; + + void main(void) + { + vec4 color; + float tx, ty; + tx = gl_TexCoord[0].x; + ty = eye+gl_TexCoord[0].y*stereo; + color = texture(tex, vec2(tx,ty)); + color.a = 0.7; + gl_FragColor = color; + } +""" + +# For use with YUV video stream +# +FragmentShader_2vuy = """ + #version 130 + uniform sampler2D tex; + // stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above) + uniform float stereo; + // eye = 0.0 for the left eye, 0.5 for the right eye + uniform float eye; + + void main(void) + { + vec4 color; + float tx, ty, width, Y, Cb, Cr; + int px; + tx = gl_TexCoord[0].x; + ty = eye+gl_TexCoord[0].y*stereo; + width = float(textureSize(tex, 0).x); + color = texture(tex, vec2(tx, ty)); + px = int(floor(fract(tx*width)*2.0)); + switch (px) { + case 0: + Y = color.g; + break; + case 1: + Y = color.a; + break; + } + Y = (Y - 0.0625) * 1.168949772; + Cb = (color.b - 0.0625) * 1.142857143 - 0.5; + Cr = (color.r - 0.0625) * 1.142857143 - 0.5; + color.r = Y + 1.5748 * Cr; + color.g = Y - 0.1873 * Cb - 0.4681 * Cr; + color.b = Y + 1.8556 * Cb; + color.a = 0.7; + gl_FragColor = color; + } +""" + +# For use with high resolution YUV +# +FragmentShader_v210 = """ + #version 130 + uniform sampler2D tex; + // stereo = 1.0 if 2D image, =0.5 if 3D (left eye below, right eye above) + uniform float stereo; + // eye = 0.0 for the left eye, 0.5 for the right eye + uniform float eye; + + void main(void) + { + vec4 color, color1, color2, color3; + int px; + float tx, ty, width, sx, dx, bx, Y, Cb, Cr; + tx = gl_TexCoord[0].x; + ty = eye+gl_TexCoord[0].y*stereo; + width = float(textureSize(tex, 0).x); + // to sample macro pixels (6 pixels in 4 words) + sx = tx*width*0.25+0.01; + // index of display pixel in the macro pixel 0..5 + px = int(floor(fract(sx)*6.0)); + // increment as we sample the macro pixel + dx = 1.0/width; + // base x coord of macro pixel + bx = (floor(sx)+0.01)*dx*4.0; + color = texture(tex, vec2(bx, ty)); + color1 = texture(tex, vec2(bx+dx, ty)); + color2 = texture(tex, vec2(bx+dx*2.0, ty)); + color3 = texture(tex, vec2(bx+dx*3.0, ty)); + switch (px) { + case 0: + case 1: + Cb = color.b; + Cr = color.r; + break; + case 2: + case 3: + Cb = color1.g; + Cr = color2.b; + break; + default: + Cb = color2.r; + Cr = color3.g; + break; + } + switch (px) { + case 0: + Y = color.g; + break; + case 1: + Y = color1.b; + break; + case 2: + Y = color1.r; + break; + case 3: + Y = color2.g; + break; + case 4: + Y = color3.b; + break; + default: + Y = color3.r; + break; + } + Y = (Y - 0.0625) * 1.168949772; + Cb = (Cb - 0.0625) * 1.142857143 - 0.5; + Cr = (Cr - 0.0625) * 1.142857143 - 0.5; + color.r = Y + 1.5748 * Cr; + color.g = Y - 0.1873 * Cb - 0.4681 * Cr; + color.b = Y + 1.8556 * Cb; + color.a = 0.7; + gl_FragColor = color; + } +""" + +# The exhausitve list of pixel formats that are transferred as float texture +# Only use those for greater efficiency and compatiblity. +# +fg_shaders = { + '2vuy' :FragmentShader_2vuy, + '8BitYUV' :FragmentShader_2vuy, + 'v210' :FragmentShader_v210, + '10BitYUV' :FragmentShader_v210, + '8BitBGRA' :FragmentShader_R10l, + 'BGRA' :FragmentShader_R10l, + '8BitARGB' :FragmentShader_R10l, + '10BitRGBXLE':FragmentShader_R10l, + 'R10l' :FragmentShader_R10l + } + + +# +# Helper function to attach a pixel shader to the material that receives the video frame. +# + +def config_video(obj, format, pixel, is3D=False, mat=0, card=0): + if pixel not in fg_shaders: + raise('Unsuported shader') + shader = obj.meshes[0].materials[mat].getShader() + if shader is not None and not shader.isValid(): + shader.setSource(VertexShader, fg_shaders[pixel], True) + shader.setSampler('tex', 0) + shader.setUniformEyef("eye") + shader.setUniform1f("stereo", 0.5 if is3D else 1.0) + tex = vt.Texture(obj, mat) + tex.source = vt.VideoDeckLink(format + "/" + pixel + ("/3D" if is3D else ""), card) + print("frame rate: ", tex.source.framerate) + tex.source.play() + obj["video"] = tex + +# +# Attach this function to an object that has a material with texture +# and call it once to initialize the object +# +def init(cont): + # config_video(cont.owner, 'HD720p5994', '8BitBGRA') + # config_video(cont.owner, 'HD720p5994', '8BitYUV') + # config_video(cont.owner, 'pal ', '10BitYUV') + config_video(cont.owner, 'pal ', '8BitYUV') + + +# +# To be called on every frame +# +def play(cont): + obj = cont.owner + video = obj.get("video") + if video is not None: + video.refresh(True) diff --git a/doc/python_api/rst/bge.constraints.rst b/doc/python_api/rst/bge.constraints.rst index bf015057dcb..ed965c3dfc1 100644 --- a/doc/python_api/rst/bge.constraints.rst +++ b/doc/python_api/rst/bge.constraints.rst @@ -8,11 +8,11 @@ Physics Constraints (bge.constraints) Examples -------- -.. include:: ../examples/bge.constraints.py +.. include:: __/examples/bge.constraints.py :start-line: 1 :end-line: 4 -.. literalinclude:: ../examples/bge.constraints.py +.. literalinclude:: __/examples/bge.constraints.py :lines: 6- diff --git a/doc/python_api/rst/bge.events.rst b/doc/python_api/rst/bge.events.rst index 8dbded6a3fe..42135926fda 100644 --- a/doc/python_api/rst/bge.events.rst +++ b/doc/python_api/rst/bge.events.rst @@ -12,53 +12,53 @@ This module holds key constants for the SCA_KeyboardSensor. .. code-block:: python - # Set a connected keyboard sensor to accept F1 - import bge - - co = bge.logic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - sensor.key = bge.events.F1KEY - -.. code-block:: python - - # Do the all keys thing - import bge - - co = bge.logic.getCurrentController() - # 'Keyboard' is a keyboard sensor - sensor = co.sensors["Keyboard"] - - for key,status in sensor.events: - # key[0] == bge.events.keycode, key[1] = status - if status == bge.logic.KX_INPUT_JUST_ACTIVATED: - if key == bge.events.WKEY: - # Activate Forward! - if key == bge.events.SKEY: - # Activate Backward! - if key == bge.events.AKEY: - # Activate Left! - if key == bge.events.DKEY: - # Activate Right! - -.. code-block:: python - - # The all keys thing without a keyboard sensor (but you will - # need an always sensor with pulse mode on) - import bge - - # Just shortening names here - keyboard = bge.logic.keyboard - JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED - - if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED: - print("Activate Forward!") - if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED: - print("Activate Backward!") - if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED: - print("Activate Left!") - if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED: - print("Activate Right!") + # Set a connected keyboard sensor to accept F1 + import bge + + co = bge.logic.getCurrentController() + # 'Keyboard' is a keyboard sensor + sensor = co.sensors["Keyboard"] + sensor.key = bge.events.F1KEY + + code-block:: python + + # Do the all keys thing + import bge + + co = bge.logic.getCurrentController() + # 'Keyboard' is a keyboard sensor + sensor = co.sensors["Keyboard"] + + for key,status in sensor.events: + # key[0] == bge.events.keycode, key[1] = status + if status == bge.logic.KX_INPUT_JUST_ACTIVATED: + if key == bge.events.WKEY: + # Activate Forward! + if key == bge.events.SKEY: + # Activate Backward! + if key == bge.events.AKEY: + # Activate Left! + if key == bge.events.DKEY: + # Activate Right! + + code-block:: python + + # The all keys thing without a keyboard sensor (but you will + # need an always sensor with pulse mode on) + import bge + + # Just shortening names here + keyboard = bge.logic.keyboard + JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED + + if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED: + print("Activate Forward!") + if keyboard.events[bge.events.SKEY] == JUST_ACTIVATED: + print("Activate Backward!") + if keyboard.events[bge.events.AKEY] == JUST_ACTIVATED: + print("Activate Left!") + if keyboard.events[bge.events.DKEY] == JUST_ACTIVATED: + print("Activate Right!") ********* diff --git a/doc/python_api/rst/bge.logic.rst b/doc/python_api/rst/bge.logic.rst index 3f35901234a..5cdb8ebfee9 100644 --- a/doc/python_api/rst/bge.logic.rst +++ b/doc/python_api/rst/bge.logic.rst @@ -378,6 +378,28 @@ General functions Render next frame (if Python has control) +.. function:: setRender(render) + + Sets the global flag that controls the render of the scene. + If True, the render is done after the logic frame. + If False, the render is skipped and another logic frame starts immediately. + + .. note:: + + GPU VSync no longer limits the number of frame per second when render is off, + but the *Use Frame Rate* option still regulates the fps. To run as many frames + as possible, untick this option (Render Properties, System panel). + + :arg render: the render flag + :type render: bool + +.. function:: getRender() + + Get the current value of the global render flag + + :return: The flag value + :rtype: bool + ********************** Time related functions ********************** diff --git a/doc/python_api/rst/bge.render.rst b/doc/python_api/rst/bge.render.rst index 3b565e294dd..02c3beef672 100644 --- a/doc/python_api/rst/bge.render.rst +++ b/doc/python_api/rst/bge.render.rst @@ -90,6 +90,48 @@ Constants Right eye being used during stereoscopic rendering. +.. data:: RAS_OFS_RENDER_BUFFER + + The pixel buffer for offscreen render is a RenderBuffer. Argument to :func:`offScreenCreate` + +.. data:: RAS_OFS_RENDER_TEXTURE + + The pixel buffer for offscreen render is a Texture. Argument to :func:`offScreenCreate` + + +***** +Types +***** + +.. class:: RASOffScreen + + An off-screen render buffer object. + + Use :func:`offScreenCreate` to create it. + Currently it can only be used in the :class:`bge.texture.ImageRender` + constructor to render on a FBO rather than the default viewport. + + .. attribute:: width + + The width in pixel of the FBO + + :type: integer + + .. attribute:: height + + The height in pixel of the FBO + + :type: integer + + .. attribute:: color + + The underlying OpenGL bind code of the texture object that holds + the rendered image, 0 if the FBO is using RenderBuffer. + The choice between RenderBuffer and Texture is determined + by the target argument of :func:`offScreenCreate`. + + :type: integer + ********* Functions @@ -362,3 +404,22 @@ Functions Get the current vsync value :rtype: One of VSYNC_OFF, VSYNC_ON, VSYNC_ADAPTIVE + +.. function:: offScreenCreate(width,height[,samples=0][,target=bge.render.RAS_OFS_RENDER_BUFFER]) + + Create a Off-screen render buffer object. + + :arg width: the width of the buffer in pixels + :type width: integer + :arg height: the height of the buffer in pixels + :type height: integer + :arg samples: the number of multisample for anti-aliasing (MSAA), 0 to disable MSAA + :type samples: integer + :arg target: the pixel storage: :data:`RAS_OFS_RENDER_BUFFER` to render on RenderBuffers (the default), + :data:`RAS_OFS_RENDER_TEXTURE` to render on texture. + The later is interesting if you want to access the texture directly (see :attr:`RASOffScreen.color`). + Otherwise the default is preferable as it's more widely supported by GPUs and more efficient. + If the GPU does not support MSAA+Texture (e.g. Intel HD GPU), MSAA will be disabled. + :type target: integer + :rtype: :class:`RASOffScreen` + diff --git a/doc/python_api/rst/bge.texture.rst b/doc/python_api/rst/bge.texture.rst index 4588a3e1800..f5d325f7ce8 100644 --- a/doc/python_api/rst/bge.texture.rst +++ b/doc/python_api/rst/bge.texture.rst @@ -8,13 +8,16 @@ Introduction The bge.texture module allows you to manipulate textures during the game. -Several sources for texture are possible: video files, image files, video capture, memory buffer, camera render or a mix of that. +Several sources for texture are possible: video files, image files, video capture, memory buffer, +camera render or a mix of that. The video and image files can be loaded from the internet using an URL instead of a file name. -In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: blue screen, color band, gray, normal map. +In addition, you can apply filters on the images before sending them to the GPU, allowing video effect: +blue screen, color band, gray, normal map. -bge.texture uses FFmpeg to load images and videos. All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to: +bge.texture uses FFmpeg to load images and videos. +All the formats and codecs that FFmpeg supports are supported by this module, including but not limited to: * AVI * Ogg @@ -36,21 +39,29 @@ When the texture object is deleted, the new texture is deleted and the old textu .. module:: bge.texture -.. include:: ../examples/bge.texture.py +.. include:: __/examples/bge.texture.py :start-line: 1 :end-line: 5 - -.. literalinclude:: ../examples/bge.texture.py + +.. literalinclude:: __/examples/bge.texture.py :lines: 7- -.. include:: ../examples/bge.texture.1.py +.. include:: __/examples/bge.texture.1.py + :start-line: 1 + :end-line: 6 + +.. literalinclude:: __/examples/bge.texture.1.py + :lines: 8- + + +.. include:: __/examples/bge.texture.2.py :start-line: 1 :end-line: 6 - -.. literalinclude:: ../examples/bge.texture.1.py + +.. literalinclude:: __/examples/bge.texture.2.py :lines: 8- - - + + ************* Video classes ************* @@ -58,7 +69,7 @@ Video classes .. class:: VideoFFmpeg(file, capture=-1, rate=25.0, width=0, height=0) FFmpeg video source. - + :arg file: Path to the video to load; if capture >= 0 on Windows, this parameter will not be used. :type file: str :arg capture: Capture device number; if >= 0, the corresponding webcam will be used. (optional) @@ -73,14 +84,14 @@ Video classes .. attribute:: status Video status. (readonly) - + :type: int :value: see `FFmpeg Video and Image Status`_. .. attribute:: range Replay range. - + :type: sequence of two floats .. attribute:: repeat @@ -104,33 +115,33 @@ Video classes .. attribute:: image Image data. (readonly) - + :type: :class:`~bgl.Buffer` or None .. attribute:: size Image size. (readonly) - + :type: tuple of two ints .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool .. attribute:: flip Flip image vertically. - + :type: bool .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -155,32 +166,41 @@ Video classes .. method:: play() Play (restart) video. - + :return: Whether the video was ready or stopped. :rtype: bool .. method:: pause() Pause video. - + :return: Whether the video was playing. :rtype: bool .. method:: stop() Stop video (play will replay it from start). - + :return: Whether the video was playing. :rtype: bool - .. method:: refresh() + .. method:: refresh(buffer=None, format="RGBA", timestamp=-1.0) - Refresh video - get its status. - - :value: see `FFmpeg Video and Image Status`_. + Refresh video - get its status and optionally copy the frame to an external buffer. + :arg buffer: An optional object that implements the buffer protocol. + If specified, the image is copied to the buffer, which must be big enough or an exception is thrown. + :type buffer: any buffer type + :arg format: An optional image format specifier for the image that will be copied to the buffer. + Only valid values are "RGBA" or "BGRA" + :type format: str + :arg timestamp: An optional timestamp (in seconds from the start of the movie) + of the frame to be copied to the buffer. + :type timestamp: float + :return: see `FFmpeg Video and Image Status`_. :rtype: int + ************* Image classes ************* @@ -188,14 +208,14 @@ Image classes .. class:: ImageFFmpeg(file) FFmpeg image source. - + :arg file: Path to the image to load. :type file: str .. attribute:: status Image status. (readonly) - + :type: int :value: see `FFmpeg Video and Image Status`_. @@ -208,33 +228,33 @@ Image classes .. attribute:: image Image data. (readonly) - + :type: :class:`~bgl.Buffer` or None .. attribute:: size Image size. (readonly) - + :type: tuple of two ints .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool .. attribute:: flip Flip image vertically. - + :type: bool .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -244,25 +264,30 @@ Image classes * :class:`FilterRGB24` * :class:`FilterRGBA32` - .. method:: refresh() + .. method:: refresh(buffer=None, format="RGBA") - Refresh image, i.e. load it. - - :value: see `FFmpeg Video and Image Status`_. + Refresh image, get its status and optionally copy the frame to an external buffer. + :arg buffer: An optional object that implements the buffer protocol. + If specified, the image is copied to the buffer, which must be big enough or an exception is thrown. + :type buffer: any buffer type + :arg format: An optional image format specifier for the image that will be copied to the buffer. + Only valid values are "RGBA" or "BGRA" + :type format: str + :return: see `FFmpeg Video and Image Status`_. :rtype: int .. method:: reload(newname=None) Reload image, i.e. reopen it. - + :arg newname: Path to a new image. (optional) :type newname: str .. class:: ImageBuff(width, height, color=0, scale=False) Image source from image buffer. - + :arg width: Width of the image. :type width: int :arg height: Height of the image. @@ -276,9 +301,9 @@ Image classes .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -291,19 +316,19 @@ Image classes .. attribute:: flip Flip image vertically. - + :type: bool .. attribute:: image Image data. (readonly) - + :type: :class:`~bgl.Buffer` or None .. method:: load(imageBuffer, width, height) Load image from buffer. - + :arg imageBuffer: Buffer to load the image from. :type imageBuffer: :class:`~bgl.Buffer` or Python object implementing the buffer protocol (f.ex. bytes) :arg width: Width of the image to load. @@ -314,9 +339,10 @@ Image classes .. method:: plot(imageBuffer, width, height, positionX, positionY, mode=IMB_BLEND_COPY) Update image buffer. - + :arg imageBuffer: Buffer to load the new data from. - :type imageBuffer: :class:`~bgl.Buffer`, :class:`ImageBuff` or Python object implementing the buffer protocol (f.ex. bytes) + :type imageBuffer: :class:`~bgl.Buffer`, :class:`ImageBuff` + or Python object implementing the buffer protocol (f.ex. bytes) :arg width: Width of the data to load. :type width: int :arg height: Height of the data to load. @@ -327,18 +353,18 @@ Image classes :type positionY: int :arg mode: Drawing mode, see `Image Blending Modes`_. :type mode: int - + .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool .. attribute:: size Image size. (readonly) - + :type: tuple of two ints .. attribute:: valid @@ -350,10 +376,11 @@ Image classes .. class:: ImageMirror(scene, observer, mirror, material=0) Image source from mirror. - + :arg scene: Scene in which the image has to be taken. :type scene: :class:`~bge.types.KX_Scene` - :arg observer: Reference object for the mirror (the object from which the mirror has to be looked at, for example a camera). + :arg observer: Reference object for the mirror + (the object from which the mirror has to be looked at, for example a camera). :type observer: :class:`~bge.types.KX_GameObject` :arg mirror: Object holding the mirror. :type mirror: :class:`~bge.types.KX_GameObject` @@ -363,33 +390,33 @@ Image classes .. attribute:: alpha Use alpha in texture. - + :type: bool .. attribute:: background Background color. - + :type: int or float list [r, g, b, a] in [0.0, 255.0] .. attribute:: capsize Size of render area. - + :type: sequence of two ints .. attribute:: clip Clipping distance. - + :type: float in [0.01, 5000.0] .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -402,29 +429,38 @@ Image classes .. attribute:: flip Flip image vertically. - + :type: bool .. attribute:: image Image data. (readonly) - + :type: :class:`~bgl.Buffer` or None - .. method:: refresh() + .. method:: refresh(buffer=None, format="RGBA") + + Refresh image - render and copy the image to an external buffer (optional) + then invalidate its current content. - Refresh image - invalidate its current content. + :arg buffer: An optional object that implements the buffer protocol. + If specified, the image is rendered and copied to the buffer, + which must be big enough or an exception is thrown. + :type buffer: any buffer type + :arg format: An optional image format specifier for the image that will be copied to the buffer. + Only valid values are "RGBA" or "BGRA" + :type format: str .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool .. attribute:: size Image size (readonly). - + :type: tuple of two ints .. attribute:: valid @@ -436,7 +472,7 @@ Image classes .. attribute:: whole Use whole viewport to render. - + :type: bool .. class:: ImageMix @@ -446,9 +482,9 @@ Image classes .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -461,19 +497,19 @@ Image classes .. attribute:: flip Flip image vertically. - + :type: bool .. method:: getSource(id) Get image source. - + :arg id: Identifier of the source to get. :type id: str - + :return: Image source. :rtype: one of... - + * :class:`VideoFFmpeg` * :class:`ImageFFmpeg` * :class:`ImageBuff` @@ -485,43 +521,52 @@ Image classes .. method:: getWeight(id) Get image source weight. - + :arg id: Identifier of the source. :type id: str - + :return: Weight of the source. :rtype: int .. attribute:: image Image data. (readonly) - + :type: :class:`~bgl.Buffer` or None - .. method:: refresh() + .. method:: refresh(buffer=None, format="RGBA") - Refresh image - invalidate its current content. + Refresh image - calculate and copy the image to an external buffer (optional) + then invalidate its current content. + + :arg buffer: An optional object that implements the buffer protocol. + If specified, the image is calculated and copied to the buffer, + which must be big enough or an exception is thrown. + :type buffer: any buffer type + :arg format: An optional image format specifier for the image that will be copied to the buffer. + Only valid values are "RGBA" or "BGRA" + :type format: str .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool - + .. attribute:: size Image size. (readonly) - + :type: tuple of two ints .. method:: setSource(id, image) Set image source - all sources must have the same size. - + :arg id: Identifier of the source to set. :type id: str :arg image: Image source of type... - + * :class:`VideoFFmpeg` * :class:`ImageFFmpeg` * :class:`ImageBuff` @@ -533,7 +578,7 @@ Image classes .. method:: setWeight(id, weight) Set image source weight - the sum of the weights should be 256 to get full color intensity in the output. - + :arg id: Identifier of the source. :type id: str :arg weight: Weight of the source. @@ -548,36 +593,40 @@ Image classes .. class:: ImageRender(scene, camera) Image source from render. - + The render is done on a custom framebuffer object if fbo is specified, + otherwise on the default framebuffer. + :arg scene: Scene in which the image has to be taken. :type scene: :class:`~bge.types.KX_Scene` :arg camera: Camera from which the image has to be taken. :type camera: :class:`~bge.types.KX_Camera` + :arg fbo: Off-screen render buffer object (optional) + :type fbo: :class:`~bge.render.RASOffScreen` .. attribute:: alpha Use alpha in texture. - + :type: bool .. attribute:: background Background color. - + :type: int or float list [r, g, b, a] in [0.0, 255.0] .. attribute:: capsize Size of render area. - + :type: sequence of two ints .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -590,29 +639,25 @@ Image classes .. attribute:: flip Flip image vertically. - + :type: bool .. attribute:: image Image data. (readonly) - - :type: :class:`~bgl.Buffer` or None - - .. method:: refresh() - Refresh image - invalidate its current content. + :type: :class:`~bgl.Buffer` or None .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool .. attribute:: size Image size. (readonly) - + :type: tuple of two ints .. attribute:: valid @@ -624,22 +669,58 @@ Image classes .. attribute:: whole Use whole viewport to render. - + :type: bool .. attribute:: depth Use depth component of render as array of float - not suitable for texture source, should only be used with bge.texture.imageToArray(mode='F'). - + :type: bool .. attribute:: zbuff Use depth component of render as grey scale color - suitable for texture source. - + :type: bool + .. method:: render() + + Render the scene but do not extract the pixels yet. + The function returns as soon as the render commands have been send to the GPU. + The render will proceed asynchronously in the GPU while the host can perform other tasks. + To complete the render, you can either call :func:`refresh` + directly of refresh the texture of which this object is the source. + This method is useful to implement asynchronous render for optimal performance: call render() + on frame n and refresh() on frame n+1 to give as much as time as possible to the GPU + to render the frame while the game engine can perform other tasks. + + :return: True if the render was initiated, False if the render cannot be performed (e.g. the camera is active) + :rtype: bool + + .. method:: refresh() + .. method:: refresh(buffer, format="RGBA") + + Refresh video - render and optionally copy the image to an external buffer then invalidate its current content. + The render may have been started earlier with the :func:`render` method, + in which case this function simply waits for the render operations to complete. + When called without argument, the pixels are not extracted but the render is guaranteed + to be completed when the function returns. + This only makes sense with offscreen render on texture target (see :func:`~bge.render.offScreenCreate`). + + :arg buffer: An object that implements the buffer protocol. + If specified, the image is copied to the buffer, which must be big enough or an exception is thrown. + The transfer to the buffer is optimal if no processing of the image is needed. + This is the case if ``flip=False, alpha=True, scale=False, whole=True, depth=False, zbuff=False`` + and no filter is set. + :type buffer: any buffer type of sufficient size + :arg format: An optional image format specifier for the image that will be copied to the buffer. + Only valid values are "RGBA" or "BGRA" + :type format: str + :return: True if the render is complete, False if the render cannot be performed (e.g. the camera is active) + :rtype: bool + .. class:: ImageViewport Image source from viewport. @@ -647,21 +728,21 @@ Image classes .. attribute:: alpha Use alpha in texture. - + :type: bool .. attribute:: capsize Size of viewport area being captured. - + :type: sequence of two ints .. attribute:: filter Pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -674,35 +755,45 @@ Image classes .. attribute:: flip Flip image vertically. - + :type: bool .. attribute:: image Image data. (readonly) - + :type: :class:`~bgl.Buffer` or None .. attribute:: position Upper left corner of the captured area. - + :type: sequence of two ints - .. method:: refresh() + .. method:: refresh(buffer=None, format="RGBA") + + Refresh video - copy the viewport to an external buffer (optional) then invalidate its current content. - Refresh image - invalidate its current content. + :arg buffer: An optional object that implements the buffer protocol. + If specified, the image is copied to the buffer, which must be big enough or an exception is thrown. + The transfer to the buffer is optimal if no processing of the image is needed. + This is the case if ``flip=False, alpha=True, scale=False, whole=True, depth=False, zbuff=False`` + and no filter is set. + :type buffer: any buffer type + :arg format: An optional image format specifier for the image that will be copied to the buffer. + Only valid values are "RGBA" or "BGRA" + :type format: str .. attribute:: scale Fast scale of image (near neighbour). - + :type: bool .. attribute:: size Image size. (readonly) - + :type: tuple of two ints .. attribute:: valid @@ -714,23 +805,201 @@ Image classes .. attribute:: whole Use whole viewport to capture. - + :type: bool .. attribute:: depth Use depth component of viewport as array of float - not suitable for texture source, - should only be used with bge.texture.imageToArray(mode='F'). - + should only be used with ``bge.texture.imageToArray(mode='F')``. + :type: bool .. attribute:: zbuff - Use depth component of viewport as grey scale color - suitable for texture source. - + Use depth component of viewport as grey scale color - suitable for texture source. + :type: bool - +.. class:: VideoDeckLink(format, capture=0) + + Image source from an external video stream captured with a DeckLink video card from + Black Magic Design. + Before this source can be used, a DeckLink hardware device must be installed, it can be a PCIe card + or a USB device, and the 'Desktop Video' software package (version 10.4 or above must be installed) + on the host as described in the DeckLink documentation. + If in addition you have a recent nVideo Quadro card, you can benefit from the 'GPUDirect' technology + to push the captured video frame very efficiently to the GPU. For this you need to install the + 'DeckLink SDK' version 10.4 or above and copy the 'dvp.dll' runtime library to Blender's + installation directory or to any other place where Blender can load a DLL from. + + :arg format: string describing the video format to be captured. + :type format: str + :arg capture: Card number from which the input video must be captured. + :type capture: int + + The format argument must be written as ``<displayMode>/<pixelFormat>[/3D][:<cacheSize>]`` where ``<displayMode>`` + describes the frame size and rate and <pixelFormat> the encoding of the pixels. + The optional ``/3D`` suffix is to be used if the video stream is stereo with a left and right eye feed. + The optional ``:<cacheSize>`` suffix determines the number of the video frames kept in cache, by default 8. + Some DeckLink cards won't work below a certain cache size. + The default value 8 should be sufficient for all cards. + You may try to reduce the cache size to reduce the memory footprint. For example the The 4K Extreme is known + to work with 3 frames only, the Extreme 2 needs 4 frames and the Intensity Shuttle needs 6 frames, etc. + Reducing the cache size may be useful when Decklink is used in conjunction with GPUDirect: + all frames must be locked in memory in that case and that puts a lot of pressure on memory. + If you reduce the cache size too much, + you'll get no error but no video feed either. + + The valid ``<displayMode>`` values are copied from the ``BMDDisplayMode`` enum in the DeckLink API + without the 'bmdMode' prefix. In case a mode that is not in this list is added in a later version + of the SDK, it is also possible to specify the 4 letters of the internal code for that mode. + You will find the internal code in the ``DeckLinkAPIModes.h`` file that is part of the SDK. + Here is for reference the full list of supported display modes with their equivalent internal code: + + Internal Codes + - NTSC 'ntsc' + - NTSC2398 'nt23' + - PAL 'pal ' + - NTSCp 'ntsp' + - PALp 'palp' + HD 1080 Modes + - HD1080p2398 '23ps' + - HD1080p24 '24ps' + - HD1080p25 'Hp25' + - HD1080p2997 'Hp29' + - HD1080p30 'Hp30' + - HD1080i50 'Hi50' + - HD1080i5994 'Hi59' + - HD1080i6000 'Hi60' + - HD1080p50 'Hp50' + - HD1080p5994 'Hp59' + - HD1080p6000 'Hp60' + HD 720 Modes + - HD720p50 'hp50' + - HD720p5994 'hp59' + - HD720p60 'hp60' + 2k Modes + - 2k2398 '2k23' + - 2k24 '2k24' + - 2k25 '2k25' + 4k Modes + - 4K2160p2398 '4k23' + - 4K2160p24 '4k24' + - 4K2160p25 '4k25' + - 4K2160p2997 '4k29' + - 4K2160p30 '4k30' + - 4K2160p50 '4k50' + - 4K2160p5994 '4k59' + - 4K2160p60 '4k60' + + Most of names are self explanatory. If necessary refer to the DeckLink API documentation for more information. + + Similarly, <pixelFormat> is copied from the BMDPixelFormat enum. + + Here is for reference the full list of supported pixel format and their equivalent internal code: + + Pixel Formats + - 8BitYUV '2vuy' + - 10BitYUV 'v210' + - 8BitARGB * no equivalent code * + - 8BitBGRA 'BGRA' + - 10BitRGB 'r210' + - 12BitRGB 'R12B' + - 12BitRGBLE 'R12L' + - 10BitRGBXLE 'R10l' + - 10BitRGBX 'R10b' + + Refer to the DeckLink SDK documentation for a full description of these pixel format. + It is important to understand them as the decoding of the pixels is NOT done in VideoTexture + for performance reason. Instead a specific shader must be used to decode the pixel in the GPU. + Only the '8BitARGB', '8BitBGRA' and '10BitRGBXLE' pixel formats are mapped directly to OpenGL RGB float textures. + The '8BitYUV' and '10BitYUV' pixel formats are mapped to openGL RGB float texture but require a shader to decode. + The other pixel formats are sent as a ``GL_RED_INTEGER`` texture (i.e. a texture with only the + red channel coded as an unsigned 32 bit integer) and are not recommended for use. + + Example: ``HD1080p24/10BitYUV/3D:4`` is equivalent to ``24ps/v210/3D:4`` + and represents a full HD stereo feed at 24 frame per second and 4 frames cache size. + + Although video format auto detection is possible with certain DeckLink devices, the corresponding + API is NOT implemented in the BGE. Therefore it is important to specify the format string that + matches exactly the video feed. If the format is wrong, no frame will be captured. + It should be noted that the pixel format that you need to specify is not necessarily the actual + format in the video feed. For example, the 4K Extreme card delivers 8bit RGBs pixels in the + '10BitRGBXLE' format. Use the 'Media Express' application included in 'Desktop Video' to discover + which pixel format works for a particular video stream. + + .. attribute:: status + + Status of the capture: 1=ready to use, 2=capturing, 3=stopped + + :type: int + + .. attribute:: framerate + + Capture frame rate as computed from the video format. + + :type: float + + .. attribute:: valid + + Tells if the image attribute can be used to retrieve the image. + Always False in this implementation (the image is not available at python level) + + :type: bool + + .. attribute:: image + + The image data. Always None in this implementation. + + :type: :class:`~bgl.Buffer` or None + + .. attribute:: size + + The size of the frame in pixel. + Stereo frames have double the height of the video frame, i.e. 3D is delivered to the GPU + as a single image in top-bottom order, left eye on top. + + :type: (int,int) + + .. attribute:: scale + + Not used in this object. + + :type: bool + + .. attribute:: flip + + Not used in this object. + + :type: bool + + .. attribute:: filter + + Not used in this object. + + .. method:: play() + + Kick-off the capture after creation of the object. + + :return: True if the capture could be started, False otherwise. + :rtype: bool + + .. method:: pause() + + Temporary stops the capture. Use play() to restart it. + + :return: True if the capture could be paused, False otherwise. + :rtype: bool + + .. method:: stop() + + Stops the capture. + + :return: True if the capture could be stopped, False otherwise. + :rtype: bool + + *************** Texture classes *************** @@ -738,7 +1007,7 @@ Texture classes .. class:: Texture(gameObj, materialID=0, textureID=0, textureObj=None) Texture object. - + :arg gameObj: Game object to be created a video texture on. :type gameObj: :class:`~bge.types.KX_GameObject` :arg materialID: Material ID. (optional) @@ -751,7 +1020,7 @@ Texture classes .. attribute:: bindId OpenGL Bind Name. (readonly) - + :type: int .. method:: close() @@ -761,27 +1030,28 @@ Texture classes .. attribute:: mipmap Mipmap texture. - + :type: bool - .. method:: refresh(refresh_source=True, ts=-1.0) + .. method:: refresh(refresh_source=True, timestamp=-1.0) Refresh texture from source. - + :arg refresh_source: Whether to also refresh the image source of the texture. :type refresh_source: bool - :arg ts: If the texture controls a VideoFFmpeg object: - timestamp (in seconds from the start of the movie) of the frame to be loaded; this can be - used for video-sound synchonization by passing :attr:`~bge.types.KX_SoundActuator.time` to it. (optional) - :type ts: float + :arg timestamp: If the texture controls a VideoFFmpeg object: + timestamp (in seconds from the start of the movie) of the frame to be loaded; this can be + used for video-sound synchonization by passing :attr:`~bge.types.KX_SoundActuator.time` to it. (optional) + :type timestamp: float .. attribute:: source Source of texture. - + :type: one of... - + * :class:`VideoFFmpeg` + * :class:`VideoDeckLink` * :class:`ImageFFmpeg` * :class:`ImageBuff` * :class:`ImageMirror` @@ -789,47 +1059,168 @@ Texture classes * :class:`ImageRender` * :class:`ImageViewport` - +.. class:: DeckLink(cardIdx=0, format="") + + Certain DeckLink devices can be used to playback video: the host sends video frames regularly + for immediate or scheduled playback. The video feed is outputted on HDMI or SDI interfaces. + This class supports the immediate playback mode: it has a source attribute that is assigned + one of the source object in the bge.texture module. Refreshing the DeckLink object causes + the image source to be computed and sent to the DeckLink device for immediate transmission + on the output interfaces. Keying is supported: it allows to composite the frame with an + input video feed that transits through the DeckLink card. + + :arg cardIdx: Number of the card to be used for output (0=first card). + It should be noted that DeckLink devices are usually half duplex: + they can either be used for capture or playback but not both at the same time. + :type cardIdx: int + :arg format: String representing the display mode of the output feed. + :type format: str + + The default value of the format argument is reserved for auto detection but it is currently + not supported (it will generate a runtime error) and thus the video format must be explicitly + specified. If keying is the goal (see keying attributes), the format must match exactly the + input video feed, otherwise it can be any format supported by the device (there will be a + runtime error if not). + The format of the string is ``<displayMode>[/3D]``. + + Refer to :class:`VideoDeckLink` to get the list of acceptable ``<displayMode>``. + The optional ``/3D`` suffix is used to create a stereo 3D feed. + In that case the 'right' attribute must also be set to specify the image source for the right eye. + + Note: The pixel format is not specified here because it is always BGRA. The alpha channel is + used in keying to mix the source with the input video feed, otherwise it is not used. + If a conversion is needed to match the native video format, it is done inside the DeckLink driver + or device. + + .. attribute:: source + + This attribute must be set to one of the image source. If the image size does not fit exactly + the frame size, the extend attribute determines what to do. + + For best performance, the source image should match exactly the size of the output frame. + A further optimization is achieved if the image source object is ImageViewport or ImageRender + set for whole viewport, flip disabled and no filter: the GL frame buffer is copied directly + to the image buffer and directly from there to the DeckLink card (hence no buffer to buffer + copy inside VideoTexture). + + :type: one of... + - :class:`VideoFFmpeg` + - :class:`VideoDeckLink` + - :class:`ImageFFmpeg` + - :class:`ImageBuff` + - :class:`ImageMirror` + - :class:`ImageMix` + - :class:`ImageRender` + - :class:`ImageViewport` + + .. attribute:: right + + If the video format is stereo 3D, this attribute should be set to an image source object + that will produce the right eye images. If the goal is to render the BGE scene in 3D, + it can be achieved with 2 cameras, one for each eye, used by 2 ImageRender with an offscreen + render buffer that is just the size of the video frame. + + :type: one of... + - :class:`VideoFFmpeg` + - :class:`VideoDeckLink` + - :class:`ImageFFmpeg` + - :class:`ImageBuff` + - :class:`ImageMirror` + - :class:`ImageMix` + - :class:`ImageRender` + - :class:`ImageViewport` + + .. attribute:: keying + + Specify if keying is enabled. False (default): the output frame is sent unmodified on + the output interface (in that case no input video is required). True: the output frame + is mixed with the input video, using the alpha channel to blend the two images and the + combination is sent on the output interface. + + :type: bool + + .. attribute:: level + + If keying is enabled, sets the keying level from 0 to 255. This value is a global alpha value + that multiplies the alpha channel of the image source. Use 255 (the default) to keep the alpha + channel unmodified, 0 to make the output frame totally transparent. + + :type: int + + .. attribute:: extend + + Determines how the image source should be mapped if the size does not fit the video frame size. + * False (the default): map the image pixel by pixel. + If the image size is smaller than the frame size, extra space around the image is filled with + 0-alpha black. If it is larger, the image is cropped to fit the frame size. + * True: the image is scaled by the nearest neighbor algorithm to fit the frame size. + The scaling is fast but poor quality. For best results, always adjust the image source to + match the size of the output video. + + :type: bool + + .. method:: close() + + Close the DeckLink device and release all resources. After calling this method, + the object cannot be reactivated, it must be destroyed and a new DeckLink object + created from fresh to restart the output. + + .. method:: refresh(refresh_source,ts) + + This method must be called frequently to update the output frame in the DeckLink device. + + :arg refresh_source: True if the source objects image buffer should be invalidated after being + used to compute the output frame. This triggers the recomputing of the + source image on next refresh, which is normally the desired effect. + False if the image source buffer should stay valid and reused on next refresh. + Note that the DeckLink device stores the output frame and replays until a + new frame is sent from the host. Thus, it is not necessary to refresh the + DeckLink object if it is known that the image source has not changed. + :type refresh_source: bool + :arg ts: The timestamp value passed to the image source object to compute the image. + If unspecified, the BGE clock is used. + :type ts: float + + ************** Filter classes ************** - .. class:: FilterBGR24 Source filter BGR24. .. class:: FilterBlueScreen - Filter for Blue Screen. The RGB channels of the color are left unchanged, while the output alpha is obtained as follows: - - * if the square of the euclidian distance between the RGB color and the filter's reference color is smaller than the filter's lower limit, + Filter for Blue Screen. + The RGB channels of the color are left unchanged, while the output alpha is obtained as follows: + + - if the square of the euclidian distance between the RGB color + and the filter's reference color is smaller than the filter's lower limit, the output alpha is set to 0; - - * if that square is bigger than the filter's upper limit, the output alpha is set to 255; - - * otherwise the output alpha is linarly extrapoled between 0 and 255 in the interval of the limits. + - if that square is bigger than the filter's upper limit, the output alpha is set to 255; + - otherwise the output alpha is linarly extrapoled between 0 and 255 in the interval of the limits. .. attribute:: color Reference color. - + :type: sequence of three ints :default: (0, 0, 255) .. attribute:: limits Reference color limits. - + :type: sequence of two ints :default: (64, 64) .. attribute:: previous Previous pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -841,22 +1232,23 @@ Filter classes .. class:: FilterColor - Filter for color calculations. The output color is obtained by multiplying the reduced 4x4 matrix with the input color + Filter for color calculations. + The output color is obtained by multiplying the reduced 4x4 matrix with the input color and adding the remaining column to the result. .. attribute:: matrix Matrix [4][5] for color calculation. - + :type: sequence of four sequences of five ints :default: ((256, 0, 0, 0, 0), (0, 256, 0, 0, 0), (0, 0, 256, 0, 0), (0, 0, 0, 256, 0)) .. attribute:: previous Previous pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -868,14 +1260,15 @@ Filter classes .. class:: FilterGray - Filter for gray scale effect. Proportions of R, G and B contributions in the output gray scale are 28:151:77. + Filter for gray scale effect. + Proportions of R, G and B contributions in the output gray scale are 28:151:77. .. attribute:: previous Previous pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -888,26 +1281,26 @@ Filter classes .. class:: FilterLevel Filter for levels calculations. Each output color component is obtained as follows: - + * if it is smaller than its corresponding min value, it is set to 0; - + * if it is bigger than its corresponding max value, it is set to 255; - + * Otherwise it is linearly extrapoled between 0 and 255 in the (min, max) interval. .. attribute:: levels Levels matrix [4] (min, max). - + :type: sequence of four sequences of two ints :default: ((0, 255), (0, 255), (0, 255), (0, 255)) .. attribute:: previous Previous pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -924,23 +1317,23 @@ Filter classes .. attribute:: colorIdx Index of color used to calculate normal (0 - red, 1 - green, 2 - blue, 3 - alpha). - + :type: int in [0, 3] :default: 0 .. attribute:: depth Depth of relief. - + :type: float :default: 4.0 .. attribute:: previous Previous pixel filter. - + :type: one of... - + * :class:`FilterBGR24` * :class:`FilterBlueScreen` * :class:`FilterColor` @@ -984,25 +1377,29 @@ Functions * :class:`ImageMix` * :class:`ImageRender` * :class:`ImageViewport` - + :arg mode: Optional argument representing the pixel format. - - * You can use the characters R, G, B for the 3 color channels, A for the alpha channel, + + - You can use the characters R, G, B for the 3 color channels, A for the alpha channel, 0 to force a fixed 0 color channel and 1 to force a fixed 255 color channel. - + Examples: - * "BGR" will return 3 bytes per pixel with the Blue, Green and Red channels in that order. - * "RGB1" will return 4 bytes per pixel with the Red, Green, Blue channels in that order and the alpha channel forced to 255. - - * A special mode "F" allows to return the image as an array of float. This mode should only be used to retrieve - the depth buffer of the class:`ImageViewport` and :class:`ImageRender` objects. + + - "BGR" will return 3 bytes per pixel with the + Blue, Green and Red channels in that order. + - "RGB1" will return 4 bytes per pixel with the + Red, Green, Blue channels in that order and the alpha channel forced to 255. + + - A special mode "F" allows to return the image as an array of float. + This mode should only be used to retrieve the depth buffer of the + class:`ImageViewport` and :class:`ImageRender` objects. The default mode is "RGBA". - + :type mode: str - + :return: An object representing the image as one dimensional array of bytes of size (pixel_size*width*height), - line by line starting from the bottom of the image. The pixel size and format is determined by the mode - parameter. For mode 'F', the array is a one dimensional array of float of size (width*height). + line by line starting from the bottom of the image. The pixel size and format is determined by the mode + parameter. For mode 'F', the array is a one dimensional array of float of size (width*height). :rtype: :class:`~bgl.Buffer` .. function:: materialID(object, name) @@ -1017,7 +1414,8 @@ Functions the texture by material. In that case the material must have a texture channel in first position. - If the object has no material that matches name, it generates a runtime error. Use try/except to catch the exception. + If the object has no material that matches name, it generates a runtime error. + Use try/except to catch the exception. Ex: ``bge.texture.materialID(obj, 'IMvideo.png')`` @@ -1025,7 +1423,7 @@ Functions :type object: :class:`~bge.types.KX_GameObject` :arg name: Name of the texture/material you want to make dynamic. :type name: str - + :return: The internal material number. :rtype: int @@ -1037,11 +1435,11 @@ Functions :arg filename: Name of the error log file. :type filename: str - + :return: -1 if the parameter name is invalid (not of type string), else 0. :rtype: int - + ********* Constants ********* diff --git a/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst b/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst index f4f5c0d62ba..a389f68ee04 100644 --- a/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst +++ b/doc/python_api/rst/bge_types/bge.types.BL_Shader.rst @@ -214,6 +214,16 @@ base class --- :class:`PyObjectPlus` :arg iList: a list (2, 3 or 4 elements) of integer values :type iList: list[integer] + .. method:: setUniformEyef(name) + + Set a uniform with a float value that reflects the eye being render in stereo mode: + 0.0 for the left eye, 0.5 for the right eye. In non stereo mode, the value of the uniform + is fixed to 0.0. The typical use of this uniform is in stereo mode to sample stereo textures + containing the left and right eye images in a top-bottom order. + + :arg name: the uniform name + :type name: string + .. method:: validate() Validate the shader object. diff --git a/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst b/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst index 2b97b5939e2..bcec751929d 100644 --- a/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst +++ b/doc/python_api/rst/bge_types/bge.types.SCA_PythonJoystick.rst @@ -12,13 +12,13 @@ base class --- :class:`PyObjectPlus` .. attribute:: name The name assigned to the joystick by the operating system. (read-only) - + :type: string .. attribute:: activeButtons A list of active button values. (read-only) - + :type: list .. attribute:: axisValues @@ -27,8 +27,10 @@ base class --- :class:`PyObjectPlus` :type: list of ints. - Each specifying the value of an axis between -1.0 and 1.0 depending on how far the axis is pushed, 0 for nothing. - The first 2 values are used by most joysticks and gamepads for directional control. 3rd and 4th values are only on some joysticks and can be used for arbitary controls. + Each specifying the value of an axis between -1.0 and 1.0 + depending on how far the axis is pushed, 0 for nothing. + The first 2 values are used by most joysticks and gamepads for directional control. + 3rd and 4th values are only on some joysticks and can be used for arbitary controls. * left:[-1.0, 0.0, ...] * right:[1.0, 0.0, ...] diff --git a/doc/python_api/rst/include__bmesh.rst b/doc/python_api/rst/include__bmesh.rst index 070dc34c964..dc43d2c016e 100644 --- a/doc/python_api/rst/include__bmesh.rst +++ b/doc/python_api/rst/include__bmesh.rst @@ -1,7 +1,8 @@ .. This document is appended to the auto generated bmesh api doc to avoid clogging up the C files with details. to test this run: - ./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../ + ./blender.bin -b -noaudio -P doc/python_api/sphinx_doc_gen.py -- \ + --partial bmesh* ; cd doc/python_api ; sphinx-build sphinx-in sphinx-out ; cd ../../ Submodules: @@ -40,7 +41,7 @@ For an overview of BMesh data types and how they reference each other see: Example Script -------------- -.. literalinclude:: ../../../release/scripts/templates_py/bmesh_simple.py +.. literalinclude:: __/__/__/release/scripts/templates_py/bmesh_simple.py Stand-Alone Module @@ -59,9 +60,9 @@ There are 2 ways to access BMesh data, you can create a new BMesh by converting :class:`bpy.types.BlendData.meshes` or by accessing the current edit mode mesh. see: :class:`bmesh.types.BMesh.from_mesh` and :mod:`bmesh.from_edit_mesh` respectively. -When explicitly converting from mesh data python **owns** the data, that is to say - that the mesh only exists while -python holds a reference to it, and the script is responsible for putting it back into a mesh data-block when the edits -are done. +When explicitly converting from mesh data python **owns** the data, that is to say - +that the mesh only exists while python holds a reference to it, +and the script is responsible for putting it back into a mesh data-block when the edits are done. Note that unlike :mod:`bpy`, a BMesh does not necessarily correspond to data in the currently open blend file, a BMesh can be created, edited and freed without the user ever seeing or having access to it. diff --git a/doc/python_api/rst/info_quickstart.rst b/doc/python_api/rst/info_quickstart.rst index 164196c0ac2..f0e1bee58e7 100644 --- a/doc/python_api/rst/info_quickstart.rst +++ b/doc/python_api/rst/info_quickstart.rst @@ -151,7 +151,7 @@ Data Creation/Removal ^^^^^^^^^^^^^^^^^^^^^ Those of you familiar with other Python API's may be surprised that -new datablocks in the bpy API can't be created by calling the class: +new data-blocks in the bpy API can't be created by calling the class: >>> bpy.types.Mesh() Traceback (most recent call last): @@ -305,7 +305,7 @@ In Python, this is done by defining a class, which is a subclass of an existing Example Operator ---------------- -.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py +.. literalinclude:: __/__/__/release/scripts/templates_py/operator_simple.py Once this script runs, ``SimpleOperator`` is registered with Blender and can be called from the operator search popup or added to the toolbar. @@ -336,7 +336,7 @@ Example Panel Panels register themselves as a class, like an operator. Notice the extra ``bl_`` variables used to set the context they display in. -.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py +.. literalinclude:: __/__/__/release/scripts/templates_py/ui_panel_simple.py To run the script: @@ -393,11 +393,11 @@ so these are accessed as normal Python types. Internal Types -------------- -Used for Blender datablocks and collections: :class:`bpy.types.bpy_struct` +Used for Blender data-blocks and collections: :class:`bpy.types.bpy_struct` For data that contains its own attributes groups/meshes/bones/scenes... etc. -There are 2 main types that wrap Blenders data, one for datablocks +There are 2 main types that wrap Blenders data, one for data-blocks (known internally as ``bpy_struct``), another for properties. >>> bpy.context.object diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index ebcedbf71f1..cdbed88cc88 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -57,7 +57,7 @@ Operator Example ++++++++++++++++ This script shows how operators can be used to model a link of a chain. -.. literalinclude:: ../examples/bmesh.ops.1.py +.. literalinclude:: __/examples/bmesh.ops.1.py """ diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 9d0d358305b..74ff23ee2a3 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -325,6 +325,24 @@ except ImportError: "freestyle.types", "freestyle.utils"] +# Source files we use, and need to copy to the OUTPUT_DIR +# to have working out-of-source builds. +# Note that ".." is replaced by "__" in the RST files, +# to avoid having to match Blender's source tree. +EXTRA_SOURCE_FILES = ( + "../../../release/scripts/templates_py/bmesh_simple.py", + "../../../release/scripts/templates_py/operator_simple.py", + "../../../release/scripts/templates_py/ui_panel_simple.py", + "../../../release/scripts/templates_py/ui_previews_custom_icon.py", + "../examples/bge.constraints.py", + "../examples/bge.texture.1.py", + "../examples/bge.texture.2.py", + "../examples/bge.texture.py", + "../examples/bmesh.ops.1.py", + "../examples/bpy.app.translations.py", + ) + + # examples EXAMPLES_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "examples")) EXAMPLE_SET = set() @@ -1890,6 +1908,21 @@ def copy_handwritten_rsts(basepath): shutil.copy2(os.path.join(RST_DIR, f), basepath) +def copy_handwritten_extra(basepath): + for f_src in EXTRA_SOURCE_FILES: + if os.sep != "/": + f_src = os.sep.join(f_src.split("/")) + + f_dst = f_src.replace("..", "__") + + f_src = os.path.join(RST_DIR, f_src) + f_dst = os.path.join(basepath, f_dst) + + os.makedirs(os.path.dirname(f_dst), exist_ok=True) + + shutil.copy2(f_src, f_dst) + + def rna2sphinx(basepath): try: @@ -1921,35 +1954,48 @@ def rna2sphinx(basepath): # copy the other rsts copy_handwritten_rsts(basepath) + # copy source files referenced + copy_handwritten_extra(basepath) + -def align_sphinx_in_to_sphinx_in_tmp(): +def align_sphinx_in_to_sphinx_in_tmp(dir_src, dir_dst): ''' Move changed files from SPHINX_IN_TMP to SPHINX_IN ''' import filecmp - sphinx_in_files = set(os.listdir(SPHINX_IN)) - sphinx_in_tmp_files = set(os.listdir(SPHINX_IN_TMP)) + # possible the dir doesn't exist when running recursively + os.makedirs(dir_dst, exist_ok=True) + + sphinx_dst_files = set(os.listdir(dir_dst)) + sphinx_src_files = set(os.listdir(dir_src)) # remove deprecated files that have been removed - for f in sorted(sphinx_in_files): - if f not in sphinx_in_tmp_files: + for f in sorted(sphinx_dst_files): + if f not in sphinx_src_files: BPY_LOGGER.debug("\tdeprecated: %s" % f) - os.remove(os.path.join(SPHINX_IN, f)) + f_dst = os.path.join(dir_dst, f) + if os.path.isdir(f_dst): + shutil.rmtree(f_dst, True) + else: + os.remove(f_dst) # freshen with new files. - for f in sorted(sphinx_in_tmp_files): - f_from = os.path.join(SPHINX_IN_TMP, f) - f_to = os.path.join(SPHINX_IN, f) + for f in sorted(sphinx_src_files): + f_src = os.path.join(dir_src, f) + f_dst = os.path.join(dir_dst, f) - do_copy = True - if f in sphinx_in_files: - if filecmp.cmp(f_from, f_to): - do_copy = False + if os.path.isdir(f_src): + align_sphinx_in_to_sphinx_in_tmp(f_src, f_dst) + else: + do_copy = True + if f in sphinx_dst_files: + if filecmp.cmp(f_src, f_dst): + do_copy = False - if do_copy: - BPY_LOGGER.debug("\tupdating: %s" % f) - shutil.copy(f_from, f_to) + if do_copy: + BPY_LOGGER.debug("\tupdating: %s" % f) + shutil.copy(f_src, f_dst) def refactor_sphinx_log(sphinx_logfile): @@ -2036,7 +2082,7 @@ def main(): shutil.rmtree(SPHINX_OUT_PDF, True) else: # move changed files in SPHINX_IN - align_sphinx_in_to_sphinx_in_tmp() + align_sphinx_in_to_sphinx_in_tmp(SPHINX_IN_TMP, SPHINX_IN) # report which example files weren't used EXAMPLE_SET_UNUSED = EXAMPLE_SET - EXAMPLE_SET_USED diff --git a/doc/python_api/sphinx_doc_gen.sh b/doc/python_api/sphinx_doc_gen.sh index 1ab6bd5afc7..b3bdd386f8c 100755 --- a/doc/python_api/sphinx_doc_gen.sh +++ b/doc/python_api/sphinx_doc_gen.sh @@ -3,11 +3,6 @@ # bash doc/python_api/sphinx_doc_gen.sh # ssh upload means you need an account on the server -if [ "$1" == "" ] ; then - echo "Expected a single argument for the username on blender.org, aborting" - exit 1 -fi - # ---------------------------------------------------------------------------- # Upload vars @@ -22,9 +17,15 @@ if [ -z $BLENDER_BIN ] ; then BLENDER_BIN="./blender.bin" fi -SSH_USER=$1 -SSH_HOST=$SSH_USER"@blender.org" -SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after +if [ "$1" == "" ] ; then + echo "Expected a single argument for the username on blender.org, skipping upload step!" + DO_UPLOAD=false +else + SSH_USER=$1 + SSH_HOST=$SSH_USER"@blender.org" + SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, added after +fi + # ---------------------------------------------------------------------------- # Blender Version & Info @@ -33,10 +34,12 @@ SSH_UPLOAD="/data/www/vhosts/www.blender.org/api" # blender_python_api_VERSION, # "_".join(str(v) for v in bpy.app.version) # custom blender vars blender_srcdir=$(dirname -- $0)/../.. -blender_version=$(grep "BLENDER_VERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') -blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') -blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') -blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" | awk '{print $3}') +blender_version_header="$blender_srcdir/source/blender/blenkernel/BKE_blender_version.h" +blender_version=$(grep "BLENDER_VERSION\s" "$blender_version_header" | awk '{print $3}') +blender_version_char=$(grep "BLENDER_VERSION_CHAR\s" "$blender_version_header" | awk '{print $3}') +blender_version_cycle=$(grep "BLENDER_VERSION_CYCLE\s" "$blender_version_header" | awk '{print $3}') +blender_subversion=$(grep "BLENDER_SUBVERSION\s" "$blender_version_header" | awk '{print $3}') +unset blender_version_header if [ "$blender_version_cycle" = "release" ] ; then BLENDER_VERSION=$(expr $blender_version / 100)_$(expr $blender_version % 100)$blender_version_char"_release" @@ -48,6 +51,8 @@ SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION SPHINXBASE=doc/python_api +SPHINX_WORKDIR="$(mktemp --directory --suffix=.sphinx)" + # ---------------------------------------------------------------------------- # Generate reStructuredText (blender/python only) @@ -59,7 +64,10 @@ if $DO_EXE_BLENDER ; then -noaudio \ --factory-startup \ --python-exit-code 1 \ - --python $SPHINXBASE/sphinx_doc_gen.py + --python $SPHINXBASE/sphinx_doc_gen.py \ + -- \ + --output=$SPHINX_WORKDIR + if (($? != 0)) ; then echo "Generating documentation failed, aborting" @@ -67,15 +75,14 @@ if $DO_EXE_BLENDER ; then fi fi - # ---------------------------------------------------------------------------- # Generate HTML (sphinx) if $DO_OUT_HTML ; then - # sphinx-build -n -b html $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out + # sphinx-build -n -b html $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out # annoying bug in sphinx makes it very slow unless we do this. should report. - cd $SPHINXBASE + cd $SPHINX_WORKDIR sphinx-build -b html sphinx-in sphinx-out # XXX, saves space on upload and zip, should move HTML outside @@ -103,20 +110,21 @@ fi # Generate PDF (sphinx/laytex) if $DO_OUT_PDF ; then - sphinx-build -n -b latex $SPHINXBASE/sphinx-in $SPHINXBASE/sphinx-out - make -C $SPHINXBASE/sphinx-out - mv $SPHINXBASE/sphinx-out/contents.pdf $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf + cd $SPHINX_WORKDIR + sphinx-build -n -b latex $SPHINX_WORKDIR/sphinx-in $SPHINX_WORKDIR/sphinx-out + make -C $SPHINX_WORKDIR/sphinx-out + mv $SPHINX_WORKDIR/sphinx-out/contents.pdf \ + $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf fi - # ---------------------------------------------------------------------------- # Upload to blender servers, comment this section for testing if $DO_UPLOAD ; then - cp $SPHINXBASE/sphinx-out/contents.html $SPHINXBASE/sphinx-out/index.html + cp $SPHINX_WORKDIR/sphinx-out/contents.html $SPHINX_WORKDIR/sphinx-out/index.html ssh $SSH_USER@blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*' - rsync --progress -ave "ssh -p 22" $SPHINXBASE/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ + rsync --progress -ave "ssh -p 22" $SPHINX_WORKDIR/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/ ## symlink the dir to a static URL #ssh $SSH_USER@blender.org 'rm '$SSH_UPLOAD'/250PythonDoc && ln -s '$SSH_UPLOAD_FULL' '$SSH_UPLOAD'/250PythonDoc' @@ -134,11 +142,15 @@ if $DO_UPLOAD ; then if $DO_OUT_PDF ; then # rename so local PDF has matching name. - rsync --progress -ave "ssh -p 22" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf + rsync --progress -ave "ssh -p 22" \ + $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf \ + $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf fi if $DO_OUT_HTML_ZIP ; then - rsync --progress -ave "ssh -p 22" $SPHINXBASE/blender_python_reference_$BLENDER_VERSION.zip $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip + rsync --progress -ave "ssh -p 22" \ + $SPHINX_WORKDIR/blender_python_reference_$BLENDER_VERSION.zip \ + $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.zip fi fi @@ -149,5 +161,5 @@ fi echo "" echo "Finished! view the docs from: " -if $DO_OUT_HTML ; then echo " html:" $SPHINXBASE/sphinx-out/contents.html ; fi -if $DO_OUT_PDF ; then echo " pdf:" $SPHINXBASE/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi +if $DO_OUT_HTML ; then echo " html:" $SPHINX_WORKDIR/sphinx-out/contents.html ; fi +if $DO_OUT_PDF ; then echo " pdf:" $SPHINX_WORKDIR/sphinx-out/blender_python_reference_$BLENDER_VERSION.pdf ; fi diff --git a/extern/curve_fit_nd/intern/curve_fit_cubic.c b/extern/curve_fit_nd/intern/curve_fit_cubic.c index 1f42dd59304..4364e8f878f 100644 --- a/extern/curve_fit_nd/intern/curve_fit_cubic.c +++ b/extern/curve_fit_nd/intern/curve_fit_cubic.c @@ -46,6 +46,12 @@ /* Take curvature into account when calculating the least square solution isn't usable. */ #define USE_CIRCULAR_FALLBACK +/* Use the maximum distance of any points from the direct line between 2 points + * to calculate how long the handles need to be. + * Can do a 'perfect' reversal of subdivision when for curve has symmetrical handles and doesn't change direction + * (as with an 'S' shape). */ +#define USE_OFFSET_FALLBACK + /* avoid re-calculating lengths multiple times */ #define USE_LENGTH_CACHE @@ -339,6 +345,44 @@ static double cubic_calc_error( return error_max_sq; } +#ifdef USE_OFFSET_FALLBACK +/** + * A version #cubic_calc_error where we don't need the split-index and can exit early when over the limit. + */ +static double cubic_calc_error_simple( + const Cubic *cubic, + const double *points_offset, + const uint points_offset_len, + const double *u, + const double error_threshold_sq, + const uint dims) + +{ + double error_max_sq = 0.0; + + const double *pt_real = points_offset + dims; +#ifdef USE_VLA + double pt_eval[dims]; +#else + double *pt_eval = alloca(sizeof(double) * dims); +#endif + + for (uint i = 1; i < points_offset_len - 1; i++, pt_real += dims) { + cubic_evaluate(cubic, u[i], dims, pt_eval); + + const double err_sq = len_squared_vnvn(pt_real, pt_eval, dims); + if (err_sq >= error_threshold_sq) { + return error_threshold_sq; + } + else if (err_sq >= error_max_sq) { + error_max_sq = err_sq; + } + } + + return error_max_sq; +} +#endif + /** * Bezier multipliers */ @@ -530,6 +574,85 @@ static void cubic_from_points_fallback( } #endif /* USE_CIRCULAR_FALLBACK */ + +#ifdef USE_OFFSET_FALLBACK + +static void cubic_from_points_offset_fallback( + const double *points_offset, + const uint points_offset_len, + const double tan_l[], + const double tan_r[], + const uint dims, + + Cubic *r_cubic) +{ + const double *p0 = &points_offset[0]; + const double *p3 = &points_offset[(points_offset_len - 1) * dims]; + +#ifdef USE_VLA + double dir_unit[dims]; + double a[2][dims]; + double tmp[dims]; +#else + double *dir_unit = alloca(sizeof(double) * dims); + double *a[2] = { + alloca(sizeof(double) * dims), + alloca(sizeof(double) * dims), + }; + double *tmp = alloca(sizeof(double) * dims); +#endif + + const double dir_dist = normalize_vn_vnvn(dir_unit, p3, p0, dims); + project_plane_vn_vnvn_normalized(a[0], tan_l, dir_unit, dims); + project_plane_vn_vnvn_normalized(a[1], tan_r, dir_unit, dims); + + /* only for better accuracy, not essential */ + normalize_vn(a[0], dims); + normalize_vn(a[1], dims); + + mul_vnvn_fl(a[1], a[1], -1, dims); + + double dists[2] = {0, 0}; + + const double *pt = points_offset; + for (uint i = 1; i < points_offset_len - 1; i++, pt += dims) { + for (uint k = 0; k < 2; k++) { + sub_vn_vnvn(tmp, p0, pt, dims); + project_vn_vnvn_normalized(tmp, tmp, a[k], dims); + dists[k] = max(dists[k], dot_vnvn(tmp, a[k], dims)); + } + } + + float alpha_l = (dists[0] / 0.75) / dot_vnvn(tan_l, a[0], dims); + float alpha_r = (dists[1] / 0.75) / -dot_vnvn(tan_r, a[1], dims); + + if (!(alpha_l > 0.0f)) { + alpha_l = dir_dist / 3.0; + } + if (!(alpha_r > 0.0f)) { + alpha_r = dir_dist / 3.0; + } + + double *p1 = CUBIC_PT(r_cubic, 1, dims); + double *p2 = CUBIC_PT(r_cubic, 2, dims); + + copy_vnvn(CUBIC_PT(r_cubic, 0, dims), p0, dims); + copy_vnvn(CUBIC_PT(r_cubic, 3, dims), p3, dims); + +#ifdef USE_ORIG_INDEX_DATA + r_cubic->orig_span = (points_offset_len - 1); +#endif + + /* p1 = p0 - (tan_l * alpha_l); + * p2 = p3 + (tan_r * alpha_r); + */ + msub_vn_vnvn_fl(p1, p0, tan_l, alpha_l, dims); + madd_vn_vnvn_fl(p2, p3, tan_r, alpha_r, dims); +} + +#endif /* USE_OFFSET_FALLBACK */ + + /** * Use least-squares method to find Bezier control points for region. */ @@ -918,6 +1041,8 @@ static bool fit_cubic_to_points( Cubic *cubic_test = alloca(cubic_alloc_size(dims)); + /* Run this so we use the non-circular calculation when the circular-fallback + * in 'cubic_from_points' failed to give a close enough result. */ #ifdef USE_CIRCULAR_FALLBACK if (!(error_max_sq < error_threshold_sq)) { /* Don't use the cubic calculated above, instead calculate a new fallback cubic, @@ -940,6 +1065,24 @@ static bool fit_cubic_to_points( } #endif + /* Test the offset fallback */ +#ifdef USE_OFFSET_FALLBACK + if (!(error_max_sq < error_threshold_sq)) { + /* Using the offset from the curve to calculate cubic handle length may give better results + * try this as a second fallback. */ + cubic_from_points_offset_fallback( + points_offset, points_offset_len, + tan_l, tan_r, dims, cubic_test); + const double error_max_sq_test = cubic_calc_error_simple( + cubic_test, points_offset, points_offset_len, u, error_max_sq, dims); + + if (error_max_sq > error_max_sq_test) { + error_max_sq = error_max_sq_test; + cubic_copy(r_cubic, cubic_test, dims); + } + } +#endif + *r_error_max_sq = error_max_sq; *r_split_index = split_index; diff --git a/extern/curve_fit_nd/intern/curve_fit_inline.h b/extern/curve_fit_nd/intern/curve_fit_inline.h index f6656c0f9e9..c77e5c6e062 100644 --- a/extern/curve_fit_nd/intern/curve_fit_inline.h +++ b/extern/curve_fit_nd/intern/curve_fit_inline.h @@ -290,4 +290,28 @@ MINLINE bool equals_vnvn( return true; } +#if 0 +MINLINE void project_vn_vnvn( + double v_out[], const double p[], const double v_proj[], const uint dims) +{ + const double mul = dot_vnvn(p, v_proj, dims) / dot_vnvn(v_proj, v_proj, dims); + mul_vnvn_fl(v_out, v_proj, mul, dims); +} +#endif + +MINLINE void project_vn_vnvn_normalized( + double v_out[], const double p[], const double v_proj[], const uint dims) +{ + const double mul = dot_vnvn(p, v_proj, dims); + mul_vnvn_fl(v_out, v_proj, mul, dims); +} + +MINLINE void project_plane_vn_vnvn_normalized( + double v_out[], const double v[], const double v_plane[], const uint dims) +{ + assert(v != v_out); + project_vn_vnvn_normalized(v_out, v, v_plane, dims); + sub_vn_vnvn(v_out, v, v_out, dims); +} + /** \} */ diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt index 43e5b6bff3e..9a5476772ab 100644 --- a/intern/CMakeLists.txt +++ b/intern/CMakeLists.txt @@ -34,6 +34,10 @@ add_subdirectory(mikktspace) add_subdirectory(glew-mx) add_subdirectory(eigen) +if (WITH_GAMEENGINE_DECKLINK) + add_subdirectory(decklink) +endif() + if(WITH_AUDASPACE) add_subdirectory(audaspace) endif() @@ -79,8 +83,10 @@ if(WITH_OPENSUBDIV) endif() # only windows needs utf16 converter +# gpudirect is a runtime interface to the nVidia's DVP driver, only for windows if(WIN32) add_subdirectory(utfconv) + add_subdirectory(gpudirect) endif() if(WITH_OPENVDB) diff --git a/intern/atomic/intern/atomic_ops_unix.h b/intern/atomic/intern/atomic_ops_unix.h index bf54750ea0d..55c00024244 100644 --- a/intern/atomic/intern/atomic_ops_unix.h +++ b/intern/atomic/intern/atomic_ops_unix.h @@ -129,23 +129,24 @@ ATOMIC_INLINE uint32_t atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _ne #elif (defined(__i386__) || defined(__amd64__) || defined(__x86_64__)) ATOMIC_INLINE uint32_t atomic_add_uint32(uint32_t *p, uint32_t x) { + uint32_t ret = x; asm volatile ( "lock; xaddl %0, %1;" - : "+r" (x), "=m" (*p) /* Outputs. */ + : "+r" (ret), "=m" (*p) /* Outputs. */ : "m" (*p) /* Inputs. */ ); - return x; + return ret+x; } ATOMIC_INLINE uint32_t atomic_sub_uint32(uint32_t *p, uint32_t x) { - x = (uint32_t)(-(int32_t)x); + ret = (uint32_t)(-(int32_t)x); asm volatile ( "lock; xaddl %0, %1;" - : "+r" (x), "=m" (*p) /* Outputs. */ + : "+r" (ret), "=m" (*p) /* Outputs. */ : "m" (*p) /* Inputs. */ ); - return x; + return ret-x; } ATOMIC_INLINE uint32_t atomic_cas_uint32(uint32_t *v, uint32_t old, uint32_t _new) diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp index 9f967a4bde9..3aca46e2dc7 100644 --- a/intern/cycles/app/cycles_xml.cpp +++ b/intern/cycles/app/cycles_xml.cpp @@ -73,18 +73,6 @@ struct XMLReadState : public XMLReader { /* Attribute Reading */ -static bool xml_read_bool(bool *value, pugi::xml_node node, const char *name) -{ - pugi::xml_attribute attr = node.attribute(name); - - if(attr) { - *value = (string_iequals(attr.value(), "true")) || (atoi(attr.value()) != 0); - return true; - } - - return false; -} - static bool xml_read_int(int *value, pugi::xml_node node, const char *name) { pugi::xml_attribute attr = node.attribute(name); @@ -193,18 +181,6 @@ static bool xml_read_string(string *str, pugi::xml_node node, const char *name) return false; } -static bool xml_read_ustring(ustring *str, pugi::xml_node node, const char *name) -{ - pugi::xml_attribute attr = node.attribute(name); - - if(attr) { - *str = ustring(attr.value()); - return true; - } - - return false; -} - static bool xml_equal_string(pugi::xml_node node, const char *name, const char *value) { pugi::xml_attribute attr = node.attribute(name); @@ -215,24 +191,6 @@ static bool xml_equal_string(pugi::xml_node node, const char *name, const char * return false; } -static bool xml_read_enum_value(int *value, NodeEnum& enm, pugi::xml_node node, const char *name) -{ - pugi::xml_attribute attr = node.attribute(name); - - if(attr) { - ustring ustr(attr.value()); - - if(enm.exists(ustr)) { - *value = enm[ustr]; - return true; - } - else - fprintf(stderr, "Unknown value \"%s\" for attribute \"%s\".\n", ustr.c_str(), name); - } - - return false; -} - /* Camera */ static void xml_read_camera(XMLReadState& state, pugi::xml_node node) @@ -267,47 +225,74 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml { xml_read_node(state, shader, graph_node); - ShaderManager *manager = state.scene->shader_manager; ShaderGraph *graph = new ShaderGraph(); - map<string, ShaderNode*> nodemap; - - nodemap["output"] = graph->output(); + /* local state, shader nodes can't link to nodes outside the shader graph */ + XMLReader graph_reader; + graph_reader.node_map[ustring("output")] = graph->output(); for(pugi::xml_node node = graph_node.first_child(); node; node = node.next_sibling()) { - ShaderNode *snode = NULL; + ustring node_name(node.name()); - /* ToDo: Add missing nodes - * RGBCurvesNode, VectorCurvesNode, RGBRampNode and ConvertNode (RGB -> BW). - */ + if(node_name == "connect") { + /* connect nodes */ + vector<string> from_tokens, to_tokens; - if(string_iequals(node.name(), "image_texture")) { - ImageTextureNode *img = new ImageTextureNode(); + string_split(from_tokens, node.attribute("from").value()); + string_split(to_tokens, node.attribute("to").value()); - xml_read_string(&img->filename, node, "src"); - img->filename = path_join(state.base, img->filename); - - xml_read_enum_value((int*)&img->color_space, ImageTextureNode::color_space_enum, node, "color_space"); - xml_read_enum_value((int*)&img->projection, ImageTextureNode::projection_enum, node, "projection"); - xml_read_float(&img->projection_blend, node, "projection_blend"); + if(from_tokens.size() == 2 && to_tokens.size() == 2) { + ustring from_node_name(from_tokens[0]); + ustring from_socket_name(from_tokens[1]); + ustring to_node_name(to_tokens[0]); + ustring to_socket_name(to_tokens[1]); - /* ToDo: Interpolation */ + /* find nodes and sockets */ + ShaderOutput *output = NULL; + ShaderInput *input = NULL; - snode = img; - } - else if(string_iequals(node.name(), "environment_texture")) { - EnvironmentTextureNode *env = new EnvironmentTextureNode(); + if(graph_reader.node_map.find(from_node_name) != graph_reader.node_map.end()) { + ShaderNode *fromnode = (ShaderNode*)graph_reader.node_map[from_node_name]; - xml_read_string(&env->filename, node, "src"); - env->filename = path_join(state.base, env->filename); - - xml_read_enum_value((int*)&env->color_space, EnvironmentTextureNode::color_space_enum, node, "color_space"); - xml_read_enum_value((int*)&env->projection, EnvironmentTextureNode::projection_enum, node, "projection"); + foreach(ShaderOutput *out, fromnode->outputs) + if(string_iequals(xml_socket_name(out->name().c_str()), from_socket_name.c_str())) + output = out; + + if(!output) + fprintf(stderr, "Unknown output socket name \"%s\" on \"%s\".\n", from_node_name.c_str(), from_socket_name.c_str()); + } + else + fprintf(stderr, "Unknown shader node name \"%s\".\n", from_node_name.c_str()); + + if(graph_reader.node_map.find(to_node_name) != graph_reader.node_map.end()) { + ShaderNode *tonode = (ShaderNode*)graph_reader.node_map[to_node_name]; + + foreach(ShaderInput *in, tonode->inputs) + if(string_iequals(xml_socket_name(in->name().c_str()), to_socket_name.c_str())) + input = in; + + if(!input) + fprintf(stderr, "Unknown input socket name \"%s\" on \"%s\".\n", to_socket_name.c_str(), to_node_name.c_str()); + } + else + fprintf(stderr, "Unknown shader node name \"%s\".\n", to_node_name.c_str()); - snode = env; + /* connect */ + if(output && input) + graph->connect(output, input); + } + else + fprintf(stderr, "Invalid from or to value for connect node.\n"); + + continue; } + + ShaderNode *snode = NULL; + #ifdef WITH_OSL - else if(string_iequals(node.name(), "osl_shader")) { + if(node_name == "osl_shader") { + ShaderManager *manager = state.scene->shader_manager; + if(manager->use_osl()) { std::string filepath; @@ -320,390 +305,54 @@ static void xml_read_shader_graph(XMLReadState& state, Shader *shader, pugi::xml if(!snode) { fprintf(stderr, "Failed to create OSL node from \"%s\".\n", filepath.c_str()); + continue; } } else { fprintf(stderr, "OSL node missing \"src\" attribute.\n"); + continue; } } else { fprintf(stderr, "OSL node without using --shadingsys osl.\n"); + continue; } } + else #endif - else if(string_iequals(node.name(), "sky_texture")) { - SkyTextureNode *sky = new SkyTextureNode(); - - xml_read_enum_value((int*)&sky->type, SkyTextureNode::type_enum, node, "type"); - xml_read_float3(&sky->sun_direction, node, "sun_direction"); - xml_read_float(&sky->turbidity, node, "turbidity"); - xml_read_float(&sky->ground_albedo, node, "ground_albedo"); - - snode = sky; - } - else if(string_iequals(node.name(), "noise_texture")) { - snode = new NoiseTextureNode(); - } - else if(string_iequals(node.name(), "checker_texture")) { - snode = new CheckerTextureNode(); - } - else if(string_iequals(node.name(), "brick_texture")) { - BrickTextureNode *brick = new BrickTextureNode(); + { + /* exception for name collision */ + if(node_name == "background") + node_name = "background_shader"; - xml_read_float(&brick->offset, node, "offset"); - xml_read_int(&brick->offset_frequency, node, "offset_frequency"); - xml_read_float(&brick->squash, node, "squash"); - xml_read_int(&brick->squash_frequency, node, "squash_frequency"); + const NodeType *node_type = NodeType::find(node_name); - snode = brick; - } - else if(string_iequals(node.name(), "gradient_texture")) { - GradientTextureNode *blend = new GradientTextureNode(); - xml_read_enum_value((int*)&blend->type, GradientTextureNode::type_enum, node, "type"); - snode = blend; - } - else if(string_iequals(node.name(), "voronoi_texture")) { - VoronoiTextureNode *voronoi = new VoronoiTextureNode(); - xml_read_enum_value((int*)&voronoi->coloring, VoronoiTextureNode::coloring_enum, node, "coloring"); - snode = voronoi; - } - else if(string_iequals(node.name(), "musgrave_texture")) { - MusgraveTextureNode *musgrave = new MusgraveTextureNode(); - xml_read_enum_value((int*)&musgrave->type, MusgraveTextureNode::type_enum, node, "type"); - snode = musgrave; - } - else if(string_iequals(node.name(), "magic_texture")) { - MagicTextureNode *magic = new MagicTextureNode(); - xml_read_int(&magic->depth, node, "depth"); - snode = magic; - } - else if(string_iequals(node.name(), "wave_texture")) { - WaveTextureNode *wave = new WaveTextureNode(); - xml_read_enum_value((int*)&wave->type, WaveTextureNode::type_enum, node, "type"); - xml_read_enum_value((int*)&wave->profile, WaveTextureNode::profile_enum, node, "profile"); - snode = wave; - } - else if(string_iequals(node.name(), "normal")) { - NormalNode *normal = new NormalNode(); - xml_read_float3(&normal->direction, node, "direction"); - snode = normal; - } - else if(string_iequals(node.name(), "bump")) { - BumpNode *bump = new BumpNode(); - xml_read_bool(&bump->invert, node, "invert"); - snode = bump; - } - else if(string_iequals(node.name(), "mapping")) { - MappingNode *map = new MappingNode(); - - TextureMapping *texmap = &map->tex_mapping; - xml_read_enum_value((int*) &texmap->type, TextureMapping::type_enum, node, "type"); - xml_read_enum_value((int*) &texmap->projection, TextureMapping::projection_enum, node, "projection"); - xml_read_enum_value((int*) &texmap->x_mapping, TextureMapping::mapping_enum, node, "x_mapping"); - xml_read_enum_value((int*) &texmap->y_mapping, TextureMapping::mapping_enum, node, "y_mapping"); - xml_read_enum_value((int*) &texmap->z_mapping, TextureMapping::mapping_enum, node, "z_mapping"); - xml_read_bool(&texmap->use_minmax, node, "use_minmax"); - if(texmap->use_minmax) { - xml_read_float3(&texmap->min, node, "min"); - xml_read_float3(&texmap->max, node, "max"); + if(!node_type) { + fprintf(stderr, "Unknown shader node \"%s\".\n", node.name()); + continue; + } + else if(node_type->type != NodeType::SHADER) { + fprintf(stderr, "Node type \"%s\" is not a shader node.\n", node_type->name.c_str()); + continue; } - xml_read_float3(&texmap->translation, node, "translation"); - xml_read_float3(&texmap->rotation, node, "rotation"); - xml_read_float3(&texmap->scale, node, "scale"); - snode = map; - } - else if(string_iequals(node.name(), "anisotropic_bsdf")) { - AnisotropicBsdfNode *aniso = new AnisotropicBsdfNode(); - xml_read_enum_value((int*)&aniso->distribution, AnisotropicBsdfNode::distribution_enum, node, "distribution"); - snode = aniso; - } - else if(string_iequals(node.name(), "diffuse_bsdf")) { - snode = new DiffuseBsdfNode(); - } - else if(string_iequals(node.name(), "translucent_bsdf")) { - snode = new TranslucentBsdfNode(); - } - else if(string_iequals(node.name(), "transparent_bsdf")) { - snode = new TransparentBsdfNode(); - } - else if(string_iequals(node.name(), "velvet_bsdf")) { - snode = new VelvetBsdfNode(); + snode = (ShaderNode*) node_type->create(node_type); } - else if(string_iequals(node.name(), "toon_bsdf")) { - ToonBsdfNode *toon = new ToonBsdfNode(); - xml_read_enum_value((int*)&toon->component, ToonBsdfNode::component_enum, node, "component"); - snode = toon; - } - else if(string_iequals(node.name(), "glossy_bsdf")) { - GlossyBsdfNode *glossy = new GlossyBsdfNode(); - xml_read_enum_value((int*)&glossy->distribution, GlossyBsdfNode::distribution_enum, node, "distribution"); - snode = glossy; - } - else if(string_iequals(node.name(), "glass_bsdf")) { - GlassBsdfNode *diel = new GlassBsdfNode(); - xml_read_enum_value((int*)&diel->distribution, GlassBsdfNode::distribution_enum, node, "distribution"); - snode = diel; - } - else if(string_iequals(node.name(), "refraction_bsdf")) { - RefractionBsdfNode *diel = new RefractionBsdfNode(); - xml_read_enum_value((int*)&diel->distribution, RefractionBsdfNode::distribution_enum, node, "distribution"); - snode = diel; - } - else if(string_iequals(node.name(), "hair_bsdf")) { - HairBsdfNode *hair = new HairBsdfNode(); - xml_read_enum_value((int*)&hair->component, HairBsdfNode::component_enum, node, "component"); - snode = hair; - } - else if(string_iequals(node.name(), "emission")) { - snode = new EmissionNode(); - } - else if(string_iequals(node.name(), "ambient_occlusion")) { - snode = new AmbientOcclusionNode(); - } - else if(string_iequals(node.name(), "background")) { - snode = new BackgroundNode(); - } - else if(string_iequals(node.name(), "holdout")) { - snode = new HoldoutNode(); - } - else if(string_iequals(node.name(), "absorption_volume")) { - snode = new AbsorptionVolumeNode(); - } - else if(string_iequals(node.name(), "scatter_volume")) { - snode = new ScatterVolumeNode(); - } - else if(string_iequals(node.name(), "subsurface_scattering")) { - SubsurfaceScatteringNode *sss = new SubsurfaceScatteringNode(); - - string falloff; - xml_read_string(&falloff, node, "falloff"); - if(falloff == "cubic") - sss->closure = CLOSURE_BSSRDF_CUBIC_ID; - else if(falloff == "gaussian") - sss->closure = CLOSURE_BSSRDF_GAUSSIAN_ID; - else /*if(falloff == "burley")*/ - sss->closure = CLOSURE_BSSRDF_BURLEY_ID; - - snode = sss; - } - else if(string_iequals(node.name(), "geometry")) { - snode = new GeometryNode(); - } - else if(string_iequals(node.name(), "texture_coordinate")) { - snode = new TextureCoordinateNode(); - } - else if(string_iequals(node.name(), "light_path")) { - snode = new LightPathNode(); - } - else if(string_iequals(node.name(), "light_falloff")) { - snode = new LightFalloffNode(); - } - else if(string_iequals(node.name(), "object_info")) { - snode = new ObjectInfoNode(); - } - else if(string_iequals(node.name(), "particle_info")) { - snode = new ParticleInfoNode(); - } - else if(string_iequals(node.name(), "hair_info")) { - snode = new HairInfoNode(); - } - else if(string_iequals(node.name(), "value")) { - ValueNode *value = new ValueNode(); - xml_read_float(&value->value, node, "value"); - snode = value; - } - else if(string_iequals(node.name(), "color")) { - ColorNode *color = new ColorNode(); - xml_read_float3(&color->value, node, "value"); - snode = color; - } - else if(string_iequals(node.name(), "mix_closure")) { - snode = new MixClosureNode(); - } - else if(string_iequals(node.name(), "add_closure")) { - snode = new AddClosureNode(); - } - else if(string_iequals(node.name(), "invert")) { - snode = new InvertNode(); - } - else if(string_iequals(node.name(), "mix")) { - /* ToDo: Tag Mix case for optimization */ - MixNode *mix = new MixNode(); - xml_read_enum_value((int*)&mix->type, MixNode::type_enum, node, "type"); - xml_read_bool(&mix->use_clamp, node, "use_clamp"); - snode = mix; - } - else if(string_iequals(node.name(), "gamma")) { - snode = new GammaNode(); - } - else if(string_iequals(node.name(), "brightness")) { - snode = new BrightContrastNode(); - } - else if(string_iequals(node.name(), "combine_rgb")) { - snode = new CombineRGBNode(); - } - else if(string_iequals(node.name(), "separate_rgb")) { - snode = new SeparateRGBNode(); - } - else if(string_iequals(node.name(), "combine_hsv")) { - snode = new CombineHSVNode(); - } - else if(string_iequals(node.name(), "separate_hsv")) { - snode = new SeparateHSVNode(); - } - else if(string_iequals(node.name(), "combine_xyz")) { - snode = new CombineXYZNode(); - } - else if(string_iequals(node.name(), "separate_xyz")) { - snode = new SeparateXYZNode(); - } - else if(string_iequals(node.name(), "hsv")) { - snode = new HSVNode(); - } - else if(string_iequals(node.name(), "wavelength")) { - snode = new WavelengthNode(); - } - else if(string_iequals(node.name(), "blackbody")) { - snode = new BlackbodyNode(); - } - else if(string_iequals(node.name(), "attribute")) { - AttributeNode *attr = new AttributeNode(); - xml_read_ustring(&attr->attribute, node, "attribute"); - snode = attr; - } - else if(string_iequals(node.name(), "uv_map")) { - UVMapNode *uvm = new UVMapNode(); - xml_read_ustring(&uvm->attribute, node, "uv_map"); - snode = uvm; - } - else if(string_iequals(node.name(), "camera")) { - snode = new CameraNode(); - } - else if(string_iequals(node.name(), "fresnel")) { - snode = new FresnelNode(); - } - else if(string_iequals(node.name(), "layer_weight")) { - snode = new LayerWeightNode(); - } - else if(string_iequals(node.name(), "wireframe")) { - WireframeNode *wire = new WireframeNode; - xml_read_bool(&wire->use_pixel_size, node, "use_pixel_size"); - snode = wire; - } - else if(string_iequals(node.name(), "normal_map")) { - NormalMapNode *nmap = new NormalMapNode; - xml_read_ustring(&nmap->attribute, node, "attribute"); - xml_read_enum_value((int*)&nmap->space, NormalMapNode::space_enum, node, "space"); - snode = nmap; - } - else if(string_iequals(node.name(), "tangent")) { - TangentNode *tangent = new TangentNode; - xml_read_ustring(&tangent->attribute, node, "attribute"); - xml_read_enum_value((int*)&tangent->direction_type, TangentNode::direction_type_enum, node, "direction_type"); - xml_read_enum_value((int*)&tangent->axis, TangentNode::axis_enum, node, "axis"); - snode = tangent; - } - else if(string_iequals(node.name(), "math")) { - MathNode *math = new MathNode(); - xml_read_enum_value((int*)&math->type, MathNode::type_enum, node, "type"); - xml_read_bool(&math->use_clamp, node, "use_clamp"); - snode = math; - } - else if(string_iequals(node.name(), "vector_math")) { - VectorMathNode *vmath = new VectorMathNode(); - xml_read_enum_value((int*)&vmath->type, VectorMathNode::type_enum, node, "type"); - snode = vmath; - } - else if(string_iequals(node.name(), "vector_transform")) { - VectorTransformNode *vtransform = new VectorTransformNode(); - xml_read_enum_value((int*)&vtransform->type, VectorTransformNode::type_enum, node, "type"); - xml_read_enum_value((int*)&vtransform->convert_from, VectorTransformNode::convert_space_enum, node, "convert_from"); - xml_read_enum_value((int*)&vtransform->convert_to, VectorTransformNode::convert_space_enum, node, "convert_to"); - snode = vtransform; - } - else if(string_iequals(node.name(), "connect")) { - /* connect nodes */ - vector<string> from_tokens, to_tokens; - - string_split(from_tokens, node.attribute("from").value()); - string_split(to_tokens, node.attribute("to").value()); - if(from_tokens.size() == 2 && to_tokens.size() == 2) { - /* find nodes and sockets */ - ShaderOutput *output = NULL; - ShaderInput *input = NULL; - - if(nodemap.find(from_tokens[0]) != nodemap.end()) { - ShaderNode *fromnode = nodemap[from_tokens[0]]; + xml_read_node(graph_reader, snode, node); - foreach(ShaderOutput *out, fromnode->outputs) - if(string_iequals(xml_socket_name(out->name().c_str()), from_tokens[1])) - output = out; - - if(!output) - fprintf(stderr, "Unknown output socket name \"%s\" on \"%s\".\n", from_tokens[1].c_str(), from_tokens[0].c_str()); - } - else - fprintf(stderr, "Unknown shader node name \"%s\".\n", from_tokens[0].c_str()); - - if(nodemap.find(to_tokens[0]) != nodemap.end()) { - ShaderNode *tonode = nodemap[to_tokens[0]]; - - foreach(ShaderInput *in, tonode->inputs) - if(string_iequals(xml_socket_name(in->name().c_str()), to_tokens[1])) - input = in; - - if(!input) - fprintf(stderr, "Unknown input socket name \"%s\" on \"%s\".\n", to_tokens[1].c_str(), to_tokens[0].c_str()); - } - else - fprintf(stderr, "Unknown shader node name \"%s\".\n", to_tokens[0].c_str()); - - /* connect */ - if(output && input) - graph->connect(output, input); - } - else - fprintf(stderr, "Invalid from or to value for connect node.\n"); + if(node_name == "image_texture") { + ImageTextureNode *img = (ImageTextureNode*) snode; + img->filename = path_join(state.base, img->filename.string()); + } + else if(node_name == "environment_texture") { + EnvironmentTextureNode *env = (EnvironmentTextureNode*) snode; + env->filename = path_join(state.base, env->filename.string()); } - else - fprintf(stderr, "Unknown shader node \"%s\".\n", node.name()); if(snode) { /* add to graph */ graph->add(snode); - - /* add to map for name lookups */ - string name = ""; - xml_read_string(&name, node, "name"); - - nodemap[name] = snode; - - /* read input values */ - for(pugi::xml_attribute attr = node.first_attribute(); attr; attr = attr.next_attribute()) { - foreach(ShaderInput *in, snode->inputs) { - if(string_iequals(in->name().c_str(), attr.name())) { - switch(in->type()) { - case SocketType::FLOAT: - case SocketType::INT: - xml_read_float(&in->value_float(), node, attr.name()); - break; - case SocketType::COLOR: - case SocketType::VECTOR: - case SocketType::POINT: - case SocketType::NORMAL: - xml_read_float3(&in->value(), node, attr.name()); - break; - case SocketType::STRING: - xml_read_ustring( &in->value_string(), node, attr.name() ); - break; - default: - break; - } - } - } - } } } diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp index 7a13641a312..78a28b7feed 100644 --- a/intern/cycles/blender/blender_shader.cpp +++ b/intern/cycles/blender/blender_shader.cpp @@ -153,28 +153,31 @@ static void set_default_value(ShaderInput *input, BL::BlendData& b_data, BL::ID& b_id) { + Node *node = input->parent; + const SocketType& socket = input->socket_type; + /* copy values for non linked inputs */ switch(input->type()) { case SocketType::FLOAT: { - input->set(get_float(b_sock.ptr, "default_value")); + node->set(socket, get_float(b_sock.ptr, "default_value")); break; } case SocketType::INT: { - input->set(get_int(b_sock.ptr, "default_value")); + node->set(socket, get_int(b_sock.ptr, "default_value")); break; } case SocketType::COLOR: { - input->set(float4_to_float3(get_float4(b_sock.ptr, "default_value"))); + node->set(socket, float4_to_float3(get_float4(b_sock.ptr, "default_value"))); break; } case SocketType::NORMAL: case SocketType::POINT: case SocketType::VECTOR: { - input->set(get_float3(b_sock.ptr, "default_value")); + node->set(socket, get_float3(b_sock.ptr, "default_value")); break; } case SocketType::STRING: { - input->set((ustring)blender_absolute_path(b_data, b_id, get_string(b_sock.ptr, "default_value"))); + node->set(socket, (ustring)blender_absolute_path(b_data, b_id, get_string(b_sock.ptr, "default_value"))); break; } default: @@ -616,7 +619,7 @@ static ShaderNode *add_node(Scene *scene, /* TODO(sergey): Does not work properly when we change builtin type. */ if(b_image.is_updated()) { scene->image_manager->tag_reload_image( - image->filename, + image->filename.string(), image->builtin_data, get_image_interpolation(b_image_node), get_image_extension(b_image_node)); @@ -662,7 +665,7 @@ static ShaderNode *add_node(Scene *scene, /* TODO(sergey): Does not work properly when we change builtin type. */ if(b_image.is_updated()) { scene->image_manager->tag_reload_image( - env->filename, + env->filename.string(), env->builtin_data, get_image_interpolation(b_env_node), EXTENSION_REPEAT); @@ -799,7 +802,7 @@ static ShaderNode *add_node(Scene *scene, if(true) { b_point_density_node.cache_point_density(b_scene, settings); scene->image_manager->tag_reload_image( - point_density->filename, + point_density->filename.string(), point_density->builtin_data, point_density->interpolation, EXTENSION_CLIP); @@ -1153,13 +1156,12 @@ void BlenderSync::sync_materials(bool update_all) add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree); } else { - ShaderNode *closure, *out; - - closure = graph->add(new DiffuseBsdfNode()); - closure->input("Color")->set(get_float3(b_mat->diffuse_color())); - out = graph->output(); + DiffuseBsdfNode *diffuse = new DiffuseBsdfNode(); + diffuse->color = get_float3(b_mat->diffuse_color()); + graph->add(diffuse); - graph->connect(closure->output("BSDF"), out->input("Surface")); + ShaderNode *out = graph->output(); + graph->connect(diffuse->output("BSDF"), out->input("Surface")); } /* settings */ @@ -1202,13 +1204,12 @@ void BlenderSync::sync_world(bool update_all) shader->volume_interpolation_method = get_volume_interpolation(cworld); } else if(b_world) { - ShaderNode *closure, *out; - - closure = graph->add(new BackgroundNode()); - closure->input("Color")->set(get_float3(b_world.horizon_color())); - out = graph->output(); + BackgroundNode *background = new BackgroundNode(); + background->color = get_float3(b_world.horizon_color()); + graph->add(background); - graph->connect(closure->output("Background"), out->input("Surface")); + ShaderNode *out = graph->output(); + graph->connect(background->output("Background"), out->input("Surface")); } if(b_world) { @@ -1287,7 +1288,6 @@ void BlenderSync::sync_lamps(bool update_all) add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree); } else { - ShaderNode *closure, *out; float strength = 1.0f; if(b_lamp->type() == BL::Lamp::type_POINT || @@ -1297,12 +1297,13 @@ void BlenderSync::sync_lamps(bool update_all) strength = 100.0f; } - closure = graph->add(new EmissionNode()); - closure->input("Color")->set(get_float3(b_lamp->color())); - closure->input("Strength")->set(strength); - out = graph->output(); + EmissionNode *emission = new EmissionNode(); + emission->color = get_float3(b_lamp->color()); + emission->strength = strength; + graph->add(emission); - graph->connect(closure->output("Emission"), out->input("Surface")); + ShaderNode *out = graph->output(); + graph->connect(emission->output("Emission"), out->input("Surface")); } shader->set_graph(graph); diff --git a/intern/cycles/graph/node.cpp b/intern/cycles/graph/node.cpp index 941a66741c5..3c228a716d5 100644 --- a/intern/cycles/graph/node.cpp +++ b/intern/cycles/graph/node.cpp @@ -82,6 +82,12 @@ void Node::set(const SocketType& input, int value) get_socket_value<int>(this, input) = value; } +void Node::set(const SocketType& input, uint value) +{ + assert(input.type == SocketType::UINT); + get_socket_value<uint>(this, input) = value; +} + void Node::set(const SocketType& input, float value) { assert(input.type == SocketType::FLOAT); @@ -198,6 +204,12 @@ int Node::get_int(const SocketType& input) const return get_socket_value<int>(this, input); } +uint Node::get_uint(const SocketType& input) const +{ + assert(input.type == SocketType::UINT); + return get_socket_value<uint>(this, input); +} + float Node::get_float(const SocketType& input) const { assert(input.type == SocketType::FLOAT); diff --git a/intern/cycles/graph/node.h b/intern/cycles/graph/node.h index bb84f982fb3..64410f4539b 100644 --- a/intern/cycles/graph/node.h +++ b/intern/cycles/graph/node.h @@ -38,6 +38,7 @@ struct Node /* set values */ void set(const SocketType& input, bool value); void set(const SocketType& input, int value); + void set(const SocketType& input, uint value); void set(const SocketType& input, float value); void set(const SocketType& input, float2 value); void set(const SocketType& input, float3 value); @@ -60,6 +61,7 @@ struct Node /* get values */ bool get_bool(const SocketType& input) const; int get_int(const SocketType& input) const; + uint get_uint(const SocketType& input) const; float get_float(const SocketType& input) const; float2 get_float2(const SocketType& input) const; float3 get_float3(const SocketType& input) const; diff --git a/intern/cycles/graph/node_type.cpp b/intern/cycles/graph/node_type.cpp index 7f68ae9c7c7..6c6035fdb22 100644 --- a/intern/cycles/graph/node_type.cpp +++ b/intern/cycles/graph/node_type.cpp @@ -41,6 +41,7 @@ size_t SocketType::size(Type type) case BOOLEAN: return sizeof(bool); case FLOAT: return sizeof(float); case INT: return sizeof(int); + case UINT: return sizeof(uint); case COLOR: return sizeof(float3); case VECTOR: return sizeof(float3); case POINT: return sizeof(float3); diff --git a/intern/cycles/graph/node_type.h b/intern/cycles/graph/node_type.h index 20816f634cd..60c3244028d 100644 --- a/intern/cycles/graph/node_type.h +++ b/intern/cycles/graph/node_type.h @@ -39,6 +39,7 @@ struct SocketType BOOLEAN, FLOAT, INT, + UINT, COLOR, VECTOR, POINT, @@ -154,7 +155,7 @@ const NodeType *structname::register_type() #define SOCKET_DEFINE(name, ui_name, default_value, datatype, TYPE, flags, ...) \ { \ static datatype defval = default_value; \ - assert(SOCKET_SIZEOF(T, name) == sizeof(datatype)); \ + CHECK_TYPE(((T *)1)->name, datatype); \ type->register_input(ustring(#name), ustring(ui_name), TYPE, SOCKET_OFFSETOF(T, name), &defval, NULL, NULL, flags, ##__VA_ARGS__); \ } @@ -162,6 +163,8 @@ const NodeType *structname::register_type() SOCKET_DEFINE(name, ui_name, default_value, bool, SocketType::BOOLEAN, 0, ##__VA_ARGS__) #define SOCKET_INT(name, ui_name, default_value, ...) \ SOCKET_DEFINE(name, ui_name, default_value, int, SocketType::INT, 0, ##__VA_ARGS__) +#define SOCKET_UINT(name, ui_name, default_value, ...) \ + SOCKET_DEFINE(name, ui_name, default_value, uint, SocketType::UINT, 0, ##__VA_ARGS__) #define SOCKET_FLOAT(name, ui_name, default_value, ...) \ SOCKET_DEFINE(name, ui_name, default_value, float, SocketType::FLOAT, 0, ##__VA_ARGS__) #define SOCKET_COLOR(name, ui_name, default_value, ...) \ diff --git a/intern/cycles/graph/node_xml.cpp b/intern/cycles/graph/node_xml.cpp index 022de7cf32a..590e09645ed 100644 --- a/intern/cycles/graph/node_xml.cpp +++ b/intern/cycles/graph/node_xml.cpp @@ -108,6 +108,11 @@ void xml_read_node(XMLReader& reader, Node *node, pugi::xml_node xml_node) node->set(socket, (int)atoi(attr.value())); break; } + case SocketType::UINT: + { + node->set(socket, (uint)atoi(attr.value())); + break; + } case SocketType::INT_ARRAY: { vector<string> tokens; @@ -310,6 +315,11 @@ pugi::xml_node xml_write_node(Node *node, pugi::xml_node xml_root) attr = node->get_int(socket); break; } + case SocketType::UINT: + { + attr = node->get_uint(socket); + break; + } case SocketType::INT_ARRAY: { std::stringstream ss; diff --git a/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl b/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl index 281ed4e8726..f7f89543aa9 100644 --- a/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl +++ b/intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl @@ -45,9 +45,9 @@ shader node_anisotropic_bsdf( RoughnessV = Roughness / (1.0 - aniso); } - if (distribution == "Sharp") + if (distribution == "sharp") BSDF = Color * reflection(Normal); - else if (distribution == "Beckmann") + else if (distribution == "beckmann") BSDF = Color * microfacet_beckmann_aniso(Normal, T, RoughnessU, RoughnessV); else if (distribution == "GGX") BSDF = Color * microfacet_ggx_aniso(Normal, T, RoughnessU, RoughnessV); diff --git a/intern/cycles/kernel/shaders/node_environment_texture.osl b/intern/cycles/kernel/shaders/node_environment_texture.osl index 3a0b782c98e..0a7f602226d 100644 --- a/intern/cycles/kernel/shaders/node_environment_texture.osl +++ b/intern/cycles/kernel/shaders/node_environment_texture.osl @@ -44,7 +44,7 @@ shader node_environment_texture( matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), vector Vector = P, string filename = "", - string projection = "Equirectangular", + string projection = "equirectangular", string interpolation = "linear", string color_space = "sRGB", int is_float = 1, @@ -59,7 +59,7 @@ shader node_environment_texture( p = normalize(p); - if (projection == "Equirectangular") + if (projection == "equirectangular") p = environment_texture_direction_to_equirectangular(p); else p = environment_texture_direction_to_mirrorball(p); diff --git a/intern/cycles/kernel/shaders/node_glass_bsdf.osl b/intern/cycles/kernel/shaders/node_glass_bsdf.osl index 68bc107cc5e..8fd0a2fd714 100644 --- a/intern/cycles/kernel/shaders/node_glass_bsdf.osl +++ b/intern/cycles/kernel/shaders/node_glass_bsdf.osl @@ -19,7 +19,7 @@ shader node_glass_bsdf( color Color = 0.8, - string distribution = "Sharp", + string distribution = "sharp", float Roughness = 0.2, float IOR = 1.45, normal Normal = N, @@ -30,9 +30,9 @@ shader node_glass_bsdf( float cosi = dot(I, Normal); float Fr = fresnel_dielectric_cos(cosi, eta); - if (distribution == "Sharp") + if (distribution == "sharp") BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta)); - else if (distribution == "Beckmann") + else if (distribution == "beckmann") BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness) + (1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta)); else if (distribution == "GGX") diff --git a/intern/cycles/kernel/shaders/node_glossy_bsdf.osl b/intern/cycles/kernel/shaders/node_glossy_bsdf.osl index d3250b32d0b..cc2a66fd46a 100644 --- a/intern/cycles/kernel/shaders/node_glossy_bsdf.osl +++ b/intern/cycles/kernel/shaders/node_glossy_bsdf.osl @@ -24,9 +24,9 @@ shader node_glossy_bsdf( normal Normal = N, output closure color BSDF = 0) { - if (distribution == "Sharp") + if (distribution == "sharp") BSDF = Color * reflection(Normal); - else if (distribution == "Beckmann") + else if (distribution == "beckmann") BSDF = Color * microfacet_beckmann(Normal, Roughness); else if (distribution == "GGX") BSDF = Color * microfacet_ggx(Normal, Roughness); diff --git a/intern/cycles/kernel/shaders/node_gradient_texture.osl b/intern/cycles/kernel/shaders/node_gradient_texture.osl index 69e2ee54bdf..f458937a18f 100644 --- a/intern/cycles/kernel/shaders/node_gradient_texture.osl +++ b/intern/cycles/kernel/shaders/node_gradient_texture.osl @@ -29,31 +29,31 @@ float gradient(point p, string type) float result = 0.0; - if (type == "Linear") { + if (type == "linear") { result = x; } - else if (type == "Quadratic") { + else if (type == "quadratic") { float r = max(x, 0.0); result = r * r; } - else if (type == "Easing") { + else if (type == "easing") { float r = min(max(x, 0.0), 1.0); float t = r * r; result = (3.0 * t - 2.0 * t * r); } - else if (type == "Diagonal") { + else if (type == "diagonal") { result = (x + y) * 0.5; } - else if (type == "Radial") { + else if (type == "radial") { result = atan2(y, x) / M_2PI + 0.5; } else { float r = max(1.0 - sqrt(x * x + y * y + z * z), 0.0); - if (type == "Quadratic Sphere") + if (type == "quadratic_sphere") result = r * r; - else if (type == "Spherical") + else if (type == "spherical") result = r; } @@ -63,7 +63,7 @@ float gradient(point p, string type) shader node_gradient_texture( int use_mapping = 0, matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), - string type = "Linear", + string type = "linear", point Vector = P, output float Fac = 0.0, output color Color = 0.0) diff --git a/intern/cycles/kernel/shaders/node_hair_bsdf.osl b/intern/cycles/kernel/shaders/node_hair_bsdf.osl index 54d4cb67c3b..c8cb88f0c0b 100644 --- a/intern/cycles/kernel/shaders/node_hair_bsdf.osl +++ b/intern/cycles/kernel/shaders/node_hair_bsdf.osl @@ -20,7 +20,7 @@ shader node_hair_bsdf( color Color = 0.8, - string component = "Reflection", + string component = "reflection", float Offset = 0.0, float RoughnessU = 0.1, float RoughnessV = 1.0, @@ -37,7 +37,7 @@ shader node_hair_bsdf( BSDF = transparent(); } else { - if (component == "Reflection") + if (component == "reflection") BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0); else BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, normalize(dPdv), 0.0); @@ -48,7 +48,7 @@ shader node_hair_bsdf( BSDF = transparent(); } else { - if (component == "Reflection") + if (component == "reflection") BSDF = Color * hair_reflection(Normal, roughnessh, roughnessv, dPdu, -Offset); else BSDF = Color * hair_transmission(Normal, roughnessh, roughnessv, dPdu, -Offset); diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl index d09174ff5d3..a00401845c8 100644 --- a/intern/cycles/kernel/shaders/node_image_texture.osl +++ b/intern/cycles/kernel/shaders/node_image_texture.osl @@ -86,7 +86,7 @@ shader node_image_texture( point Vector = P, string filename = "", string color_space = "sRGB", - string projection = "Flat", + string projection = "flat", string interpolation = "smartcubic", string wrap = "periodic", float projection_blend = 0.0, @@ -100,7 +100,7 @@ shader node_image_texture( if (use_mapping) p = transform(mapping, p); - if (projection == "Flat") { + if (projection == "flat") { Color = image_texture_lookup(filename, color_space, p[0], p[1], @@ -110,7 +110,7 @@ shader node_image_texture( interpolation, wrap); } - else if (projection == "Box") { + else if (projection == "box") { /* object space normal */ vector Nob = transform("world", "object", N); @@ -210,7 +210,7 @@ shader node_image_texture( Alpha += weight[2] * tmp_alpha; } } - else if (projection == "Sphere") { + else if (projection == "sphere") { point projected = map_to_sphere(texco_remap_square(p)); Color = image_texture_lookup(filename, color_space, @@ -221,7 +221,7 @@ shader node_image_texture( interpolation, wrap); } - else if (projection == "Tube") { + else if (projection == "tube") { point projected = map_to_tube(texco_remap_square(p)); Color = image_texture_lookup(filename, color_space, diff --git a/intern/cycles/kernel/shaders/node_math.osl b/intern/cycles/kernel/shaders/node_math.osl index 85eac0b97a6..f309ef7c6f3 100644 --- a/intern/cycles/kernel/shaders/node_math.osl +++ b/intern/cycles/kernel/shaders/node_math.osl @@ -49,7 +49,7 @@ float safe_log(float a, float b) } shader node_math( - string type = "Add", + string type = "add", int use_clamp = 0, float Value1 = 0.0, float Value2 = 0.0, @@ -57,43 +57,43 @@ shader node_math( { /* OSL asin, acos, pow check for values that could give rise to nan */ - if (type == "Add") + if (type == "add") Value = Value1 + Value2; - else if (type == "Subtract") + else if (type == "subtract") Value = Value1 - Value2; - else if (type == "Multiply") + else if (type == "multiply") Value = Value1 * Value2; - else if (type == "Divide") + else if (type == "divide") Value = safe_divide(Value1, Value2); - else if (type == "Sine") + else if (type == "sine") Value = sin(Value1); - else if (type == "Cosine") + else if (type == "cosine") Value = cos(Value1); - else if (type == "Tangent") + else if (type == "tangent") Value = tan(Value1); - else if (type == "Arcsine") + else if (type == "arcsine") Value = asin(Value1); - else if (type == "Arccosine") + else if (type == "arccosine") Value = acos(Value1); - else if (type == "Arctangent") + else if (type == "arctangent") Value = atan(Value1); - else if (type == "Power") + else if (type == "power") Value = pow(Value1, Value2); - else if (type == "Logarithm") + else if (type == "logarithm") Value = safe_log(Value1, Value2); - else if (type == "Minimum") + else if (type == "minimum") Value = min(Value1, Value2); - else if (type == "Maximum") + else if (type == "maximum") Value = max(Value1, Value2); - else if (type == "Round") + else if (type == "round") Value = floor(Value1 + 0.5); - else if (type == "Less Than") + else if (type == "less_than") Value = Value1 < Value2; - else if (type == "Greater Than") + else if (type == "greater_than") Value = Value1 > Value2; - else if (type == "Modulo") + else if (type == "modulo") Value = safe_modulo(Value1, Value2); - else if (type == "Absolute") + else if (type == "absolute") Value = fabs(Value1); if (use_clamp) diff --git a/intern/cycles/kernel/shaders/node_mix.osl b/intern/cycles/kernel/shaders/node_mix.osl index 4a66748ed6a..0862c34b6e1 100644 --- a/intern/cycles/kernel/shaders/node_mix.osl +++ b/intern/cycles/kernel/shaders/node_mix.osl @@ -277,7 +277,7 @@ color node_mix_clamp(color col) } shader node_mix( - string type = "Mix", + string type = "mix", int use_clamp = 0, float Fac = 0.5, color Color1 = 0.0, @@ -286,41 +286,41 @@ shader node_mix( { float t = clamp(Fac, 0.0, 1.0); - if (type == "Mix") + if (type == "mix") Color = node_mix_blend(t, Color1, Color2); - if (type == "Add") + if (type == "add") Color = node_mix_add(t, Color1, Color2); - if (type == "Multiply") + if (type == "multiply") Color = node_mix_mul(t, Color1, Color2); - if (type == "Screen") + if (type == "screen") Color = node_mix_screen(t, Color1, Color2); - if (type == "Overlay") + if (type == "overlay") Color = node_mix_overlay(t, Color1, Color2); - if (type == "Subtract") + if (type == "subtract") Color = node_mix_sub(t, Color1, Color2); - if (type == "Divide") + if (type == "divide") Color = node_mix_div(t, Color1, Color2); - if (type == "Difference") + if (type == "difference") Color = node_mix_diff(t, Color1, Color2); - if (type == "Darken") + if (type == "darken") Color = node_mix_dark(t, Color1, Color2); - if (type == "Lighten") + if (type == "lighten") Color = node_mix_light(t, Color1, Color2); - if (type == "Dodge") + if (type == "dodge") Color = node_mix_dodge(t, Color1, Color2); - if (type == "Burn") + if (type == "burn") Color = node_mix_burn(t, Color1, Color2); - if (type == "Hue") + if (type == "hue") Color = node_mix_hue(t, Color1, Color2); - if (type == "Saturation") + if (type == "saturation") Color = node_mix_sat(t, Color1, Color2); - if (type == "Value") + if (type == "value") Color = node_mix_val (t, Color1, Color2); - if (type == "Color") + if (type == "color") Color = node_mix_color(t, Color1, Color2); - if (type == "Soft Light") + if (type == "soft_light") Color = node_mix_soft(t, Color1, Color2); - if (type == "Linear Light") + if (type == "linear_light") Color = node_mix_linear(t, Color1, Color2); if (use_clamp) diff --git a/intern/cycles/kernel/shaders/node_musgrave_texture.osl b/intern/cycles/kernel/shaders/node_musgrave_texture.osl index 2f9f62bcfe8..91f4fba5898 100644 --- a/intern/cycles/kernel/shaders/node_musgrave_texture.osl +++ b/intern/cycles/kernel/shaders/node_musgrave_texture.osl @@ -210,15 +210,15 @@ shader node_musgrave_texture( p = p * Scale; - if (type == "Multifractal") + if (type == "multifractal") Fac = intensity * noise_musgrave_multi_fractal(p, dimension, lacunarity, octaves); else if (type == "fBM") Fac = intensity * noise_musgrave_fBm(p, dimension, lacunarity, octaves); - else if (type == "Hybrid Multifractal") + else if (type == "hybrid_multifractal") Fac = intensity * noise_musgrave_hybrid_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain); - else if (type == "Ridged Multifractal") + else if (type == "ridged_multifractal") Fac = intensity * noise_musgrave_ridged_multi_fractal(p, dimension, lacunarity, octaves, Offset, Gain); - else if (type == "Hetero Terrain") + else if (type == "hetero_terrain") Fac = intensity * noise_musgrave_hetero_terrain(p, dimension, lacunarity, octaves, Offset); Color = color(Fac, Fac, Fac); diff --git a/intern/cycles/kernel/shaders/node_normal_map.osl b/intern/cycles/kernel/shaders/node_normal_map.osl index 01be566fb20..f95e9fcfe3c 100644 --- a/intern/cycles/kernel/shaders/node_normal_map.osl +++ b/intern/cycles/kernel/shaders/node_normal_map.osl @@ -20,14 +20,14 @@ shader node_normal_map( normal NormalIn = N, float Strength = 1.0, color Color = color(0.5, 0.5, 1.0), - string space = "Tangent", + string space = "tangent", string attr_name = "geom:tangent", string attr_sign_name = "geom:tangent_sign", output normal Normal = NormalIn) { color mcolor = 2.0 * color(Color[0] - 0.5, Color[1] - 0.5, Color[2] - 0.5); - if (space == "Tangent") { + if (space == "tangent") { vector tangent; vector ninterp; float tangent_sign; @@ -53,20 +53,20 @@ shader node_normal_map( Normal = normal(0, 0, 0); } } - else if (space == "Object") { + else if (space == "object") { Normal = normalize(transform("object", "world", vector(mcolor))); } - else if (space == "World") { + else if (space == "world") { Normal = normalize(vector(mcolor)); } - else if (space == "Blender Object") { + else if (space == "blender_object") { /* strange blender convention */ mcolor[1] = -mcolor[1]; mcolor[2] = -mcolor[2]; Normal = normalize(transform("object", "world", vector(mcolor))); } - else if (space == "Blender World") { + else if (space == "blender_world") { /* strange blender convention */ mcolor[1] = -mcolor[1]; mcolor[2] = -mcolor[2]; diff --git a/intern/cycles/kernel/shaders/node_refraction_bsdf.osl b/intern/cycles/kernel/shaders/node_refraction_bsdf.osl index d458ca730a4..828becf1818 100644 --- a/intern/cycles/kernel/shaders/node_refraction_bsdf.osl +++ b/intern/cycles/kernel/shaders/node_refraction_bsdf.osl @@ -18,7 +18,7 @@ shader node_refraction_bsdf( color Color = 0.8, - string distribution = "Sharp", + string distribution = "sharp", float Roughness = 0.2, float IOR = 1.45, normal Normal = N, @@ -27,9 +27,9 @@ shader node_refraction_bsdf( float f = max(IOR, 1e-5); float eta = backfacing() ? 1.0 / f : f; - if (distribution == "Sharp") + if (distribution == "sharp") BSDF = Color * refraction(Normal, eta); - else if (distribution == "Beckmann") + else if (distribution == "beckmann") BSDF = Color * microfacet_beckmann_refraction(Normal, Roughness, eta); else if (distribution == "GGX") BSDF = Color * microfacet_ggx_refraction(Normal, Roughness, eta); diff --git a/intern/cycles/kernel/shaders/node_sky_texture.osl b/intern/cycles/kernel/shaders/node_sky_texture.osl index 05eed23bea8..a6c187d15f2 100644 --- a/intern/cycles/kernel/shaders/node_sky_texture.osl +++ b/intern/cycles/kernel/shaders/node_sky_texture.osl @@ -111,7 +111,7 @@ shader node_sky_texture( int use_mapping = 0, matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), vector Vector = P, - string sky_model = "Hosek / Wilkie", + string type = "hosek_wilkie", float theta = 0.0, float phi = 0.0, color radiance = color(0.0, 0.0, 0.0), @@ -125,7 +125,7 @@ shader node_sky_texture( if (use_mapping) p = transform(mapping, p); - if (sky_model == "Hosek / Wilkie") + if (type == "hosek_wilkie") Color = sky_radiance_new(p, phi, theta, radiance, config_x, config_y, config_z); else Color = sky_radiance_old(p, phi, theta, radiance, config_x, config_y, config_z); diff --git a/intern/cycles/kernel/shaders/node_subsurface_scattering.osl b/intern/cycles/kernel/shaders/node_subsurface_scattering.osl index 1877c7e595f..5ba8f34021d 100644 --- a/intern/cycles/kernel/shaders/node_subsurface_scattering.osl +++ b/intern/cycles/kernel/shaders/node_subsurface_scattering.osl @@ -22,13 +22,13 @@ shader node_subsurface_scattering( vector Radius = vector(0.1, 0.1, 0.1), float TextureBlur = 0.0, float Sharpness = 0.0, - string falloff = "Cubic", + string falloff = "cubic", normal Normal = N, output closure color BSSRDF = 0) { - if (falloff == "Gaussian") + if (falloff == "gaussian") BSSRDF = Color * bssrdf_gaussian(Normal, Scale * Radius, TextureBlur); - else if (falloff == "Cubic") + else if (falloff == "cubic") BSSRDF = Color * bssrdf_cubic(Normal, Scale * Radius, TextureBlur, Sharpness); else BSSRDF = Color * bssrdf_burley(Normal, Scale * Radius, TextureBlur, Color); diff --git a/intern/cycles/kernel/shaders/node_tangent.osl b/intern/cycles/kernel/shaders/node_tangent.osl index 53a47396f9f..c527070a2c8 100644 --- a/intern/cycles/kernel/shaders/node_tangent.osl +++ b/intern/cycles/kernel/shaders/node_tangent.osl @@ -19,24 +19,24 @@ shader node_tangent( normal NormalIn = N, string attr_name = "geom:tangent", - string direction_type = "Radial", - string axis = "Z", + string direction_type = "radial", + string axis = "z", output normal Tangent = normalize(dPdu)) { vector T; - if (direction_type == "UV Map") { + if (direction_type == "uv_map") { getattribute(attr_name, T); } - else if (direction_type == "Radial") { + else if (direction_type == "radial") { point generated; if (!getattribute("geom:generated", generated)) generated = P; - if (axis == "X") + if (axis == "x") T = vector(0.0, -(generated[2] - 0.5), (generated[1] - 0.5)); - else if (axis == "Y") + else if (axis == "y") T = vector(-(generated[2] - 0.5), 0.0, (generated[0] - 0.5)); else T = vector(-(generated[1] - 0.5), (generated[0] - 0.5), 0.0); diff --git a/intern/cycles/kernel/shaders/node_toon_bsdf.osl b/intern/cycles/kernel/shaders/node_toon_bsdf.osl index 75c5d06f847..ae68a463e46 100644 --- a/intern/cycles/kernel/shaders/node_toon_bsdf.osl +++ b/intern/cycles/kernel/shaders/node_toon_bsdf.osl @@ -18,15 +18,15 @@ shader node_toon_bsdf( color Color = 0.8, - string component = "Diffuse", + string component = "diffuse", float Size = 0.5, float Smooth = 0.0, normal Normal = N, output closure color BSDF = 0) { - if (component == "Diffuse") + if (component == "diffuse") BSDF = Color * diffuse_toon(Normal, Size, Smooth); - else if (component == "Glossy") + else if (component == "glossy") BSDF = Color * glossy_toon(Normal, Size, Smooth); } diff --git a/intern/cycles/kernel/shaders/node_uv_map.osl b/intern/cycles/kernel/shaders/node_uv_map.osl index 77e2e8d12d7..b46b2e73457 100644 --- a/intern/cycles/kernel/shaders/node_uv_map.osl +++ b/intern/cycles/kernel/shaders/node_uv_map.osl @@ -18,7 +18,7 @@ shader node_uv_map( int from_dupli = 0, - string name = "", + string attribute = "", string bump_offset = "center", output point UV = point(0.0, 0.0, 0.0)) { @@ -26,10 +26,10 @@ shader node_uv_map( getattribute("geom:dupli_uv", UV); } else { - if (name == "") + if (attribute == "") getattribute("geom:uv", UV); else - getattribute(name, UV); + getattribute(attribute, UV); } if (bump_offset == "dx") { diff --git a/intern/cycles/kernel/shaders/node_vector_math.osl b/intern/cycles/kernel/shaders/node_vector_math.osl index f83412dc0f7..a7e3637402e 100644 --- a/intern/cycles/kernel/shaders/node_vector_math.osl +++ b/intern/cycles/kernel/shaders/node_vector_math.osl @@ -17,33 +17,33 @@ #include "stdosl.h" shader node_vector_math( - string type = "Add", + string type = "add", vector Vector1 = vector(0.0, 0.0, 0.0), vector Vector2 = vector(0.0, 0.0, 0.0), output float Value = 0.0, output vector Vector = vector(0.0, 0.0, 0.0)) { - if (type == "Add") { + if (type == "add") { Vector = Vector1 + Vector2; Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; } - else if (type == "Subtract") { + else if (type == "subtract") { Vector = Vector1 - Vector2; Value = (abs(Vector[0]) + abs(Vector[1]) + abs(Vector[2])) / 3.0; } - else if (type == "Average") { + else if (type == "average") { Value = length(Vector1 + Vector2); Vector = normalize(Vector1 + Vector2); } - else if (type == "Dot Product") { + else if (type == "dot_product") { Value = dot(Vector1, Vector2); } - else if (type == "Cross Product") { + else if (type == "cross_product") { vector c = cross(Vector1, Vector2); Value = length(c); Vector = normalize(c); } - else if (type == "Normalize") { + else if (type == "normalize") { Value = length(Vector1); Vector = normalize(Vector1); } diff --git a/intern/cycles/kernel/shaders/node_vector_transform.osl b/intern/cycles/kernel/shaders/node_vector_transform.osl index 8ebaa31ab25..afb95b340d1 100644 --- a/intern/cycles/kernel/shaders/node_vector_transform.osl +++ b/intern/cycles/kernel/shaders/node_vector_transform.osl @@ -17,18 +17,18 @@ #include "stdosl.h" shader node_vector_transform( - string type = "Vector", + string type = "vector", string convert_from = "world", string convert_to = "object", vector VectorIn = vector(0.0, 0.0, 0.0), output vector VectorOut = vector(0.0, 0.0, 0.0)) { - if (type == "Vector" || type == "Normal") { + if (type == "vector" || type == "normal") { VectorOut = transform(convert_from, convert_to, VectorIn); - if (type == "Normal") + if (type == "normal") VectorOut = normalize(VectorOut); } - else if (type == "Point") { + else if (type == "point") { point Point = (point)VectorIn; VectorOut = transform(convert_from, convert_to, Point); } diff --git a/intern/cycles/kernel/shaders/node_voronoi_texture.osl b/intern/cycles/kernel/shaders/node_voronoi_texture.osl index bacdd593c7c..0c3b95ae4d0 100644 --- a/intern/cycles/kernel/shaders/node_voronoi_texture.osl +++ b/intern/cycles/kernel/shaders/node_voronoi_texture.osl @@ -22,7 +22,7 @@ shader node_voronoi_texture( int use_mapping = 0, matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), - string coloring = "Intensity", + string coloring = "intensity", float Scale = 5.0, point Vector = P, output float Fac = 0.0, @@ -40,7 +40,7 @@ shader node_voronoi_texture( voronoi(p * Scale, 1.0, da, pa); /* Colored output */ - if (coloring == "Intensity") { + if (coloring == "intensity") { Fac = fabs(da[0]); Color = color(Fac); } diff --git a/intern/cycles/kernel/shaders/node_wave_texture.osl b/intern/cycles/kernel/shaders/node_wave_texture.osl index a07742faefc..71bc9324705 100644 --- a/intern/cycles/kernel/shaders/node_wave_texture.osl +++ b/intern/cycles/kernel/shaders/node_wave_texture.osl @@ -23,10 +23,10 @@ float wave(point p, string type, string profile, float detail, float distortion, { float n = 0.0; - if (type == "Bands") { + if (type == "bands") { n = (p[0] + p[1] + p[2]) * 10.0; } - else if (type == "Rings") { + else if (type == "rings") { n = length(p) * 20.0; } @@ -34,7 +34,7 @@ float wave(point p, string type, string profile, float detail, float distortion, n = n + (distortion * noise_turbulence(p * dscale, detail, 0)); } - if (profile == "Sine") { + if (profile == "sine") { return 0.5 + 0.5 * sin(n); } else { @@ -48,8 +48,8 @@ float wave(point p, string type, string profile, float detail, float distortion, shader node_wave_texture( int use_mapping = 0, matrix mapping = matrix(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), - string type = "Bands", - string profile = "Sine", + string type = "bands", + string profile = "sine", float Scale = 5.0, float Distortion = 0.0, float Detail = 2.0, diff --git a/intern/cycles/render/background.cpp b/intern/cycles/render/background.cpp index 20536b74e87..8d7d7b847fd 100644 --- a/intern/cycles/render/background.cpp +++ b/intern/cycles/render/background.cpp @@ -32,12 +32,12 @@ NODE_DEFINE(Background) { NodeType* type = NodeType::add("background", create); - SOCKET_INT(ao_factor, "AO Factor", 0.0f); + SOCKET_FLOAT(ao_factor, "AO Factor", 0.0f); SOCKET_FLOAT(ao_distance, "AO Distance", FLT_MAX); SOCKET_BOOLEAN(use_shader, "Use Shader", true); SOCKET_BOOLEAN(use_ao, "Use AO", false); - SOCKET_INT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY); + SOCKET_UINT(visibility, "Visibility", PATH_RAY_ALL_VISIBILITY); SOCKET_BOOLEAN(transparent, "Transparent", false); SOCKET_NODE(shader, "Shader", &Shader::node_type); diff --git a/intern/cycles/render/camera.cpp b/intern/cycles/render/camera.cpp index 2310798be2e..a6df656d220 100644 --- a/intern/cycles/render/camera.cpp +++ b/intern/cycles/render/camera.cpp @@ -68,7 +68,7 @@ NODE_DEFINE(Camera) SOCKET_FLOAT(aperturesize, "Aperture Size", 0.0f); SOCKET_FLOAT(focaldistance, "Focal Distance", 10.0f); - SOCKET_INT(blades, "Blades", 0); + SOCKET_UINT(blades, "Blades", 0); SOCKET_FLOAT(bladesrotation, "Blades Rotation", 0.0f); SOCKET_TRANSFORM(matrix, "Matrix", transform_identity()); diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp index 29c0eec9b97..9210221a261 100644 --- a/intern/cycles/render/graph.cpp +++ b/intern/cycles/render/graph.cpp @@ -51,72 +51,19 @@ bool check_node_inputs_traversed(const ShaderNode *node, return true; } -bool check_node_inputs_equals(const ShaderNode *node_a, - const ShaderNode *node_b) -{ - if(node_a->inputs.size() != node_b->inputs.size()) { - /* Happens with BSDF closure nodes which are currently sharing the same - * name for all the BSDF types, making it impossible to filter out - * incompatible nodes. - */ - return false; - } - for(int i = 0; i < node_a->inputs.size(); ++i) { - ShaderInput *input_a = node_a->inputs[i], - *input_b = node_b->inputs[i]; - if(input_a->link == NULL && input_b->link == NULL) { - /* Unconnected inputs are expected to have the same value. */ - if(input_a->value() != input_b->value()) { - return false; - } - } - else if(input_a->link != NULL && input_b->link != NULL) { - /* Expect links are to come from the same exact socket. */ - if(input_a->link != input_b->link) { - return false; - } - } - else { - /* One socket has a link and another has not, inputs can't be - * considered equal. - */ - return false; - } - } - return true; -} - } /* namespace */ -/* Input and Output */ - -ShaderInput::ShaderInput(ShaderNode *parent_, const char *name, SocketType::Type type) -{ - parent = parent_; - name_ = name; - type_ = type; - link = NULL; - value_ = make_float3(0.0f, 0.0f, 0.0f); - stack_offset = SVM_STACK_INVALID; - flags_ = 0; -} - -ShaderOutput::ShaderOutput(ShaderNode *parent_, const char *name, SocketType::Type type) -{ - parent = parent_; - name_ = name; - type_ = type; - stack_offset = SVM_STACK_INVALID; -} - /* Node */ -ShaderNode::ShaderNode(const char *name_) +ShaderNode::ShaderNode(const NodeType *type) +: Node(type) { - name = name_; + name = type->name; id = -1; bump = SHADER_BUMP_NONE; special_type = SHADER_SPECIAL_TYPE_NONE; + + create_inputs_outputs(type); } ShaderNode::~ShaderNode() @@ -128,6 +75,19 @@ ShaderNode::~ShaderNode() delete socket; } +void ShaderNode::create_inputs_outputs(const NodeType *type) +{ + foreach(const SocketType& socket, type->inputs) { + if(socket.flags & SocketType::LINKABLE) { + inputs.push_back(new ShaderInput(socket, this)); + } + } + + foreach(const SocketType& socket, type->outputs) { + outputs.push_back(new ShaderOutput(socket, this)); + } +} + ShaderInput *ShaderNode::input(const char *name) { foreach(ShaderInput *socket, inputs) { @@ -166,31 +126,6 @@ ShaderOutput *ShaderNode::output(ustring name) return NULL; } -ShaderInput *ShaderNode::add_input(const char *name, SocketType::Type type, float value, int flags) -{ - ShaderInput *input = new ShaderInput(this, name, type); - input->value_.x = value; - input->flags_ = flags; - inputs.push_back(input); - return input; -} - -ShaderInput *ShaderNode::add_input(const char *name, SocketType::Type type, float3 value, int flags) -{ - ShaderInput *input = new ShaderInput(this, name, type); - input->value_ = value; - input->flags_ = flags; - inputs.push_back(input); - return input; -} - -ShaderOutput *ShaderNode::add_output(const char *name, SocketType::Type type) -{ - ShaderOutput *output = new ShaderOutput(this, name, type); - outputs.push_back(output); - return output; -} - void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes) { foreach(ShaderInput *input, inputs) { @@ -209,6 +144,49 @@ void ShaderNode::attributes(Shader *shader, AttributeRequestSet *attributes) } } +bool ShaderNode::equals(const ShaderNode& other) +{ + if (type != other.type || bump != other.bump) + return false; + + assert(inputs.size() == other.inputs.size()); + + /* Compare unlinkable sockets */ + foreach(const SocketType& socket, type->inputs) { + if(!(socket.flags & SocketType::LINKABLE)) { + if(!Node::equals_value(other, socket)) { + return false; + } + } + } + + /* Compare linkable input sockets */ + for(int i = 0; i < inputs.size(); ++i) { + ShaderInput *input_a = inputs[i], + *input_b = other.inputs[i]; + if(input_a->link == NULL && input_b->link == NULL) { + /* Unconnected inputs are expected to have the same value. */ + if(!Node::equals_value(other, input_a->socket_type)) { + return false; + } + } + else if(input_a->link != NULL && input_b->link != NULL) { + /* Expect links are to come from the same exact socket. */ + if(input_a->link != input_b->link) { + return false; + } + } + else { + /* One socket has a link and another has not, inputs can't be + * considered equal. + */ + return false; + } + } + + return true; +} + /* Graph */ ShaderGraph::ShaderGraph() @@ -470,8 +448,7 @@ void ShaderGraph::remove_proxy_nodes() disconnect(to); /* transfer the default input value to the target socket */ - to->set(input->value()); - to->set(input->value_string()); + tonode->copy_value(to->socket_type, *proxy, input->socket_type); } } @@ -542,7 +519,7 @@ void ShaderGraph::constant_fold() vector<ShaderInput*> links(output->links); for(size_t i = 0; i < links.size(); i++) { if(i > 0) - links[i]->set(links[0]->value()); + links[i]->parent->copy_value(links[i]->socket_type, *links[0]->parent, links[0]->socket_type); disconnect(links[i]); } } @@ -604,25 +581,11 @@ void ShaderGraph::deduplicate_nodes() } /* Try to merge this node with another one. */ foreach(ShaderNode *other_node, done[node->name]) { - if(node == other_node) { - /* Don't merge with self. */ - continue; - } - if(node->name != other_node->name) { - /* Can only de-duplicate nodes of the same type. */ - continue; - } - if(!check_node_inputs_equals(node, other_node)) { - /* Node inputs are different, can't merge them, */ - continue; - } - if(!node->equals(other_node)) { - /* Node settings are different. */ - continue; - } - /* TODO(sergey): Consider making it an utility function. */ - for(int i = 0; i < node->outputs.size(); ++i) { - relink(node, node->outputs[i], other_node->outputs[i]); + if (node != other_node && node->equals(*other_node)) { + /* TODO(sergey): Consider making it an utility function. */ + for(int i = 0; i < node->outputs.size(); ++i) { + relink(node, node->outputs[i], other_node->outputs[i]); + } } break; } @@ -927,14 +890,15 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight if(fin) { /* mix closure: add node to mix closure weights */ - ShaderNode *mix_node = add(new MixClosureWeightNode()); + MixClosureWeightNode *mix_node = new MixClosureWeightNode(); + add(mix_node); ShaderInput *fac_in = mix_node->input("Fac"); ShaderInput *weight_in = mix_node->input("Weight"); if(fin->link) connect(fin->link, fac_in); else - fac_in->set(fin->value_float()); + mix_node->fac = node->get_float(fin->socket_type); if(weight_out) connect(weight_out, weight_in); @@ -961,20 +925,20 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight return; /* already has a weight connected to it? add weights */ - if(weight_in->link || weight_in->value_float() != 0.0f) { - ShaderNode *math_node = add(new MathNode()); - ShaderInput *value1_in = math_node->input("Value1"); - ShaderInput *value2_in = math_node->input("Value2"); + float weight_value = node->get_float(weight_in->socket_type); + if(weight_in->link || weight_value != 0.0f) { + MathNode *math_node = new MathNode(); + add(math_node); if(weight_in->link) - connect(weight_in->link, value1_in); + connect(weight_in->link, math_node->input("Value1")); else - value1_in->set(weight_in->value_float()); + math_node->value1 = weight_value; if(weight_out) - connect(weight_out, value2_in); + connect(weight_out, math_node->input("Value2")); else - value2_in->set(1.0f); + math_node->value2 = 1.0f; weight_out = math_node->output("Value"); if(weight_in->link) @@ -985,7 +949,7 @@ void ShaderGraph::transform_multi_closure(ShaderNode *node, ShaderOutput *weight if(weight_out) connect(weight_out, weight_in); else - weight_in->set(weight_in->value_float() + 1.0f); + node->set(weight_in->socket_type, weight_value + 1.0f); } } diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h index 882e495df20..dccd8c27b2f 100644 --- a/intern/cycles/render/graph.h +++ b/intern/cycles/render/graph.h @@ -18,6 +18,7 @@ #define __GRAPH_H__ #include "node.h" +#include "node_type.h" #include "kernel_types.h" @@ -79,32 +80,21 @@ enum ShaderNodeSpecialType { class ShaderInput { public: - ShaderInput(ShaderNode *parent, const char *name, SocketType::Type type); + ShaderInput(const SocketType& socket_type_, ShaderNode* parent_) + : socket_type(socket_type_), parent(parent_), link(NULL), stack_offset(SVM_STACK_INVALID) + {} - ustring name() { return name_; } - int flags() { return flags_; } - SocketType::Type type() { return type_; } + ustring name() { return socket_type.ui_name; } + int flags() { return socket_type.flags; } + SocketType::Type type() { return socket_type.type; } - void set(float f) { value_.x = f; } - void set(float3 f) { value_ = f; } - void set(int i) { value_.x = (float)i; } - void set(ustring s) { value_string_ = s; } - - float3& value() { return value_; } - float& value_float() { return value_.x; } - ustring& value_string() { return value_string_; } - - ustring name_; - SocketType::Type type_; + void set(float f) { ((Node*)parent)->set(socket_type, f); } + void set(float3 f) { ((Node*)parent)->set(socket_type, f); } + const SocketType& socket_type; ShaderNode *parent; ShaderOutput *link; - - float3 value_; - ustring value_string_; - int stack_offset; /* for SVM compiler */ - int flags_; }; /* Output @@ -113,17 +103,16 @@ public: class ShaderOutput { public: - ShaderOutput(ShaderNode *parent, const char *name, SocketType::Type type); - - ustring name() { return name_; } - SocketType::Type type() { return type_; } + ShaderOutput(const SocketType& socket_type_, ShaderNode* parent_) + : socket_type(socket_type_), parent(parent_), stack_offset(SVM_STACK_INVALID) + {} - ustring name_; - SocketType::Type type_; + ustring name() { return socket_type.ui_name; } + SocketType::Type type() { return socket_type.type; } + const SocketType& socket_type; ShaderNode *parent; vector<ShaderInput*> links; - int stack_offset; /* for SVM compiler */ }; @@ -132,20 +121,18 @@ public: * Shader node in graph, with input and output sockets. This is the virtual * base class for all node types. */ -class ShaderNode { +class ShaderNode : public Node { public: - explicit ShaderNode(const char *name); + explicit ShaderNode(const NodeType *type); virtual ~ShaderNode(); + void create_inputs_outputs(const NodeType *type); + ShaderInput *input(const char *name); ShaderOutput *output(const char *name); ShaderInput *input(ustring name); ShaderOutput *output(ustring name); - ShaderInput *add_input(const char *name, SocketType::Type type, float value=0.0f, int flags=0); - ShaderInput *add_input(const char *name, SocketType::Type type, float3 value, int flags=0); - ShaderOutput *add_output(const char *name, SocketType::Type type); - virtual ShaderNode *clone() const = 0; virtual void attributes(Shader *shader, AttributeRequestSet *attributes); virtual void compile(SVMCompiler& compiler) = 0; @@ -171,7 +158,6 @@ public: vector<ShaderInput*> inputs; vector<ShaderOutput*> outputs; - ustring name; /* name, not required to be unique */ int id; /* index in graph node array */ ShaderBump bump; /* for bump mapping utility */ @@ -207,23 +193,21 @@ public: * NOTE: If some node can't be de-duplicated for whatever reason it * is to be handled in the subclass. */ - virtual bool equals(const ShaderNode *other) - { - return name == other->name && - bump == other->bump; - } + virtual bool equals(const ShaderNode& other); }; /* Node definition utility macros */ #define SHADER_NODE_CLASS(type) \ + NODE_DECLARE; \ type(); \ virtual ShaderNode *clone() const { return new type(*this); } \ virtual void compile(SVMCompiler& compiler); \ virtual void compile(OSLCompiler& compiler); \ #define SHADER_NODE_NO_CLONE_CLASS(type) \ + NODE_DECLARE; \ type(); \ virtual void compile(SVMCompiler& compiler); \ virtual void compile(OSLCompiler& compiler); \ diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index e25155630bd..764a925983e 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -85,7 +85,7 @@ NODE_DEFINE(Mesh) displacement_method_enum.insert("both", DISPLACE_BOTH); SOCKET_ENUM(displacement_method, "Displacement Method", displacement_method_enum, DISPLACE_BUMP); - SOCKET_INT(motion_steps, "Motion Steps", 3); + SOCKET_UINT(motion_steps, "Motion Steps", 3); SOCKET_BOOLEAN(use_motion_blur, "Use Motion Blur", false); SOCKET_INT_ARRAY(triangles, "Triangles", array<int>()); diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index df0fee63113..6530bff0848 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -30,64 +30,40 @@ CCL_NAMESPACE_BEGIN /* Texture Mapping */ -static NodeEnum texture_mapping_type_init() -{ - NodeEnum enm; - - enm.insert("Point", TextureMapping::POINT); - enm.insert("Texture", TextureMapping::TEXTURE); - enm.insert("Vector", TextureMapping::VECTOR); - enm.insert("Normal", TextureMapping::NORMAL); - - return enm; -} - -static NodeEnum texture_mapping_mapping_init() -{ - NodeEnum enm; - - enm.insert("None", TextureMapping::NONE); - enm.insert("X", TextureMapping::X); - enm.insert("Y", TextureMapping::Y); - enm.insert("Z", TextureMapping::Z); - - return enm; -} - -static NodeEnum texture_mapping_projection_init() -{ - NodeEnum enm; - - enm.insert("Flat", TextureMapping::FLAT); - enm.insert("Cube", TextureMapping::CUBE); - enm.insert("Tube", TextureMapping::TUBE); - enm.insert("Sphere", TextureMapping::SPHERE); - - return enm; -} - -NodeEnum TextureMapping::type_enum = texture_mapping_type_init(); -NodeEnum TextureMapping::mapping_enum = texture_mapping_mapping_init(); -NodeEnum TextureMapping::projection_enum = texture_mapping_projection_init(); +#define TEXTURE_MAPPING_DEFINE(TextureNode) \ + SOCKET_POINT(tex_mapping.translation, "Translation", make_float3(0.0f, 0.0f, 0.0f)); \ + SOCKET_VECTOR(tex_mapping.rotation, "Rotation", make_float3(0.0f, 0.0f, 0.0f)); \ + SOCKET_VECTOR(tex_mapping.scale, "Scale", make_float3(1.0f, 1.0f, 1.0f)); \ + \ + SOCKET_VECTOR(tex_mapping.min, "Min", make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX)); \ + SOCKET_VECTOR(tex_mapping.max, "Max", make_float3(FLT_MAX, FLT_MAX, FLT_MAX)); \ + SOCKET_BOOLEAN(tex_mapping.use_minmax, "Use Min Max", false); \ + \ + static NodeEnum mapping_axis_enum; \ + mapping_axis_enum.insert("none", TextureMapping::NONE); \ + mapping_axis_enum.insert("x", TextureMapping::X); \ + mapping_axis_enum.insert("y", TextureMapping::Y); \ + mapping_axis_enum.insert("z", TextureMapping::Z); \ + SOCKET_ENUM(tex_mapping.x_mapping, "x_mapping", mapping_axis_enum, TextureMapping::X); \ + SOCKET_ENUM(tex_mapping.y_mapping, "y_mapping", mapping_axis_enum, TextureMapping::Y); \ + SOCKET_ENUM(tex_mapping.z_mapping, "z_mapping", mapping_axis_enum, TextureMapping::Z); \ + \ + static NodeEnum mapping_type_enum; \ + mapping_type_enum.insert("point", TextureMapping::POINT); \ + mapping_type_enum.insert("texture", TextureMapping::TEXTURE); \ + mapping_type_enum.insert("vector", TextureMapping::VECTOR); \ + mapping_type_enum.insert("normal", TextureMapping::NORMAL); \ + SOCKET_ENUM(tex_mapping.type, "Type", mapping_type_enum, TextureMapping::TEXTURE); \ + \ + static NodeEnum mapping_projection_enum; \ + mapping_projection_enum.insert("flat", TextureMapping::FLAT); \ + mapping_projection_enum.insert("cube", TextureMapping::CUBE); \ + mapping_projection_enum.insert("tube", TextureMapping::TUBE); \ + mapping_projection_enum.insert("sphere", TextureMapping::SPHERE); \ + SOCKET_ENUM(tex_mapping.projection, "Projection", mapping_projection_enum, TextureMapping::FLAT); TextureMapping::TextureMapping() { - translation = make_float3(0.0f, 0.0f, 0.0f); - rotation = make_float3(0.0f, 0.0f, 0.0f); - scale = make_float3(1.0f, 1.0f, 1.0f); - - min = make_float3(-FLT_MAX, -FLT_MAX, -FLT_MAX); - max = make_float3(FLT_MAX, FLT_MAX, FLT_MAX); - - use_minmax = false; - - x_mapping = X; - y_mapping = Y; - z_mapping = Z; - - type = TEXTURE; - - projection = FLAT; } Transform TextureMapping::compute_transform() @@ -222,72 +198,66 @@ void TextureMapping::compile(OSLCompiler &compiler) /* Image Texture */ -static NodeEnum color_space_init() +NODE_DEFINE(ImageTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("image_texture", create, NodeType::SHADER); - enm.insert("None", 0); - enm.insert("Color", 1); + TEXTURE_MAPPING_DEFINE(ImageTextureNode); - return enm; -} + SOCKET_STRING(filename, "Filename", ustring("")); -static NodeEnum image_projection_init() -{ - NodeEnum enm; + static NodeEnum color_space_enum; + color_space_enum.insert("none", NODE_COLOR_SPACE_NONE); + color_space_enum.insert("color", NODE_COLOR_SPACE_COLOR); + SOCKET_ENUM(color_space, "Color Space", color_space_enum, NODE_COLOR_SPACE_COLOR); - enm.insert("Flat", NODE_IMAGE_PROJ_FLAT); - enm.insert("Box", NODE_IMAGE_PROJ_BOX); - enm.insert("Sphere", NODE_IMAGE_PROJ_SPHERE); - enm.insert("Tube", NODE_IMAGE_PROJ_TUBE); + SOCKET_BOOLEAN(use_alpha, "Use Alpha", true); - return enm; -} + static NodeEnum interpolation_enum; + interpolation_enum.insert("closest", INTERPOLATION_CLOSEST); + interpolation_enum.insert("linear", INTERPOLATION_LINEAR); + interpolation_enum.insert("cubic", INTERPOLATION_CUBIC); + interpolation_enum.insert("smart", INTERPOLATION_SMART); + SOCKET_ENUM(interpolation, "Interpolation", interpolation_enum, INTERPOLATION_LINEAR); -static const char* get_osl_interpolation_parameter(InterpolationType interpolation) -{ - switch(interpolation) { - case INTERPOLATION_CLOSEST: - return "closest"; - case INTERPOLATION_CUBIC: - return "cubic"; - case INTERPOLATION_SMART: - return "smart"; - case INTERPOLATION_LINEAR: - default: - return "linear"; - } -} + static NodeEnum extension_enum; + extension_enum.insert("periodic", EXTENSION_REPEAT); + extension_enum.insert("clamp", EXTENSION_EXTEND); + extension_enum.insert("black", EXTENSION_CLIP); + SOCKET_ENUM(extension, "Extension", extension_enum, EXTENSION_REPEAT); + + static NodeEnum projection_enum; + projection_enum.insert("flat", NODE_IMAGE_PROJ_FLAT); + projection_enum.insert("box", NODE_IMAGE_PROJ_BOX); + projection_enum.insert("sphere", NODE_IMAGE_PROJ_SPHERE); + projection_enum.insert("tube", NODE_IMAGE_PROJ_TUBE); + SOCKET_ENUM(projection, "Projection", projection_enum, NODE_IMAGE_PROJ_FLAT); -NodeEnum ImageTextureNode::color_space_enum = color_space_init(); -NodeEnum ImageTextureNode::projection_enum = image_projection_init(); + SOCKET_FLOAT(projection_blend, "Projection Blend", 0.0f); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_UV); + + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(alpha, "Alpha"); + + return type; +} ImageTextureNode::ImageTextureNode() -: ImageSlotTextureNode("image_texture") +: ImageSlotTextureNode(node_type) { image_manager = NULL; slot = -1; is_float = -1; is_linear = false; - use_alpha = true; - filename = ""; builtin_data = NULL; - color_space = NODE_COLOR_SPACE_COLOR; - projection = NODE_IMAGE_PROJ_FLAT; - interpolation = INTERPOLATION_LINEAR; - extension = EXTENSION_REPEAT; - projection_blend = 0.0f; animated = false; - - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_UV); - add_output("Color", SocketType::COLOR); - add_output("Alpha", SocketType::FLOAT); } ImageTextureNode::~ImageTextureNode() { if(image_manager) { - image_manager->remove_image(filename, + image_manager->remove_image(filename.string(), builtin_data, interpolation, extension); @@ -328,7 +298,7 @@ void ImageTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; if(is_float == -1) { bool is_float_bool; - slot = image_manager->add_image(filename, + slot = image_manager->add_image(filename.string(), builtin_data, animated, 0, @@ -390,13 +360,13 @@ void ImageTextureNode::compile(OSLCompiler& compiler) if(is_float == -1) { if(builtin_data == NULL) { ImageManager::ImageDataType type; - type = image_manager->get_image_metadata(filename, NULL, is_linear); + type = image_manager->get_image_metadata(filename.string(), NULL, is_linear); if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4) is_float = 1; } else { bool is_float_bool; - slot = image_manager->add_image(filename, + slot = image_manager->add_image(filename.string(), builtin_data, animated, 0, @@ -410,7 +380,7 @@ void ImageTextureNode::compile(OSLCompiler& compiler) } if(slot == -1) { - compiler.parameter("filename", filename.c_str()); + compiler.parameter(this, "filename"); } else { /* TODO(sergey): It's not so simple to pass custom attribute @@ -422,70 +392,71 @@ void ImageTextureNode::compile(OSLCompiler& compiler) compiler.parameter("filename", string_printf("@%d", slot).c_str()); } if(is_linear || color_space != NODE_COLOR_SPACE_COLOR) - compiler.parameter("color_space", "Linear"); + compiler.parameter("color_space", "linear"); else compiler.parameter("color_space", "sRGB"); - compiler.parameter("projection", projection); - compiler.parameter("projection_blend", projection_blend); - compiler.parameter("is_float", is_float); + compiler.parameter(this, "projection"); + compiler.parameter(this, "projection_blend"); + compiler.parameter(this, "is_float"); compiler.parameter("use_alpha", !alpha_out->links.empty()); - compiler.parameter("interpolation", get_osl_interpolation_parameter(interpolation)); - - switch(extension) { - case EXTENSION_EXTEND: - compiler.parameter("extension", "clamp"); - break; - case EXTENSION_CLIP: - compiler.parameter("extension", "black"); - break; - case EXTENSION_REPEAT: - default: - compiler.parameter("extension", "periodic"); - break; - } + compiler.parameter(this, "interpolation"); + compiler.parameter(this, "extension"); compiler.add(this, "node_image_texture"); } /* Environment Texture */ -static NodeEnum env_projection_init() +NODE_DEFINE(EnvironmentTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("environment_texture", create, NodeType::SHADER); - enm.insert("Equirectangular", 0); - enm.insert("Mirror Ball", 1); + TEXTURE_MAPPING_DEFINE(EnvironmentTextureNode); - return enm; -} + SOCKET_STRING(filename, "Filename", ustring("")); + + static NodeEnum color_space_enum; + color_space_enum.insert("none", NODE_COLOR_SPACE_NONE); + color_space_enum.insert("color", NODE_COLOR_SPACE_COLOR); + SOCKET_ENUM(color_space, "Color Space", color_space_enum, NODE_COLOR_SPACE_COLOR); + + SOCKET_BOOLEAN(use_alpha, "Use Alpha", true); + + static NodeEnum interpolation_enum; + interpolation_enum.insert("closest", INTERPOLATION_CLOSEST); + interpolation_enum.insert("linear", INTERPOLATION_LINEAR); + interpolation_enum.insert("cubic", INTERPOLATION_CUBIC); + interpolation_enum.insert("smart", INTERPOLATION_SMART); + SOCKET_ENUM(interpolation, "Interpolation", interpolation_enum, INTERPOLATION_LINEAR); -NodeEnum EnvironmentTextureNode::color_space_enum = color_space_init(); -NodeEnum EnvironmentTextureNode::projection_enum = env_projection_init(); + static NodeEnum projection_enum; + projection_enum.insert("equirectangular", NODE_ENVIRONMENT_EQUIRECTANGULAR); + projection_enum.insert("mirror_ball", NODE_ENVIRONMENT_MIRROR_BALL); + SOCKET_ENUM(projection, "Projection", projection_enum, NODE_ENVIRONMENT_EQUIRECTANGULAR); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_POSITION); + + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(alpha, "Alpha"); + + return type; +} EnvironmentTextureNode::EnvironmentTextureNode() -: ImageSlotTextureNode("environment_texture") +: ImageSlotTextureNode(node_type) { image_manager = NULL; slot = -1; is_float = -1; is_linear = false; - use_alpha = true; - filename = ""; builtin_data = NULL; - color_space = NODE_COLOR_SPACE_COLOR; - interpolation = INTERPOLATION_LINEAR; - projection = NODE_ENVIRONMENT_EQUIRECTANGULAR; animated = false; - - add_input("Vector", SocketType::VECTOR, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_POSITION); - add_output("Color", SocketType::COLOR); - add_output("Alpha", SocketType::FLOAT); } EnvironmentTextureNode::~EnvironmentTextureNode() { if(image_manager) { - image_manager->remove_image(filename, + image_manager->remove_image(filename.string(), builtin_data, interpolation, EXTENSION_REPEAT); @@ -524,7 +495,7 @@ void EnvironmentTextureNode::compile(SVMCompiler& compiler) image_manager = compiler.image_manager; if(slot == -1) { bool is_float_bool; - slot = image_manager->add_image(filename, + slot = image_manager->add_image(filename.string(), builtin_data, animated, 0, @@ -577,13 +548,13 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler) if(is_float == -1) { if(builtin_data == NULL) { ImageManager::ImageDataType type; - type = image_manager->get_image_metadata(filename, NULL, is_linear); + type = image_manager->get_image_metadata(filename.string(), NULL, is_linear); if(type == ImageManager::IMAGE_DATA_TYPE_FLOAT || type == ImageManager::IMAGE_DATA_TYPE_FLOAT4) is_float = 1; } else { bool is_float_bool; - slot = image_manager->add_image(filename, + slot = image_manager->add_image(filename.string(), builtin_data, animated, 0, @@ -597,20 +568,19 @@ void EnvironmentTextureNode::compile(OSLCompiler& compiler) } if(slot == -1) { - compiler.parameter("filename", filename.c_str()); + compiler.parameter(this, "filename"); } else { compiler.parameter("filename", string_printf("@%d", slot).c_str()); } - compiler.parameter("projection", projection_enum[projection]); + compiler.parameter(this, "projection"); if(is_linear || color_space != NODE_COLOR_SPACE_COLOR) - compiler.parameter("color_space", "Linear"); + compiler.parameter("color_space", "linear"); else compiler.parameter("color_space", "sRGB"); - compiler.parameter("interpolation", get_osl_interpolation_parameter(interpolation)); - - compiler.parameter("is_float", is_float); + compiler.parameter(this, "interpolation"); + compiler.parameter(this, "is_float"); compiler.parameter("use_alpha", !alpha_out->links.empty()); compiler.add(this, "node_environment_texture"); } @@ -738,29 +708,31 @@ static void sky_texture_precompute_new(SunSky *sunsky, float3 dir, float turbidi arhosekskymodelstate_free(sky_state); } -static NodeEnum sky_type_init() +NODE_DEFINE(SkyTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("sky_texture", create, NodeType::SHADER); - enm.insert("Preetham", NODE_SKY_OLD); - enm.insert("Hosek / Wilkie", NODE_SKY_NEW); + TEXTURE_MAPPING_DEFINE(SkyTextureNode); - return enm; -} + static NodeEnum type_enum; + type_enum.insert("preetham", NODE_SKY_OLD); + type_enum.insert("hosek_wilkie", NODE_SKY_NEW); + SOCKET_ENUM(type, "Type", type_enum, NODE_SKY_NEW); + + SOCKET_VECTOR(sun_direction, "Sun Direction", make_float3(0.0f, 0.0f, 1.0f)); + SOCKET_FLOAT(turbidity, "Turbidity", 2.2f); + SOCKET_FLOAT(ground_albedo, "Ground Albedo", 0.3f); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); -NodeEnum SkyTextureNode::type_enum = sky_type_init(); + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} SkyTextureNode::SkyTextureNode() -: TextureNode("sky_texture") +: TextureNode(node_type) { - type = NODE_SKY_NEW; - - sun_direction = make_float3(0.0f, 0.0f, 1.0f); - turbidity = 2.2f; - ground_albedo = 0.3f; - - add_input("Vector", SocketType::VECTOR, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_POSITION); - add_output("Color", SocketType::COLOR); } void SkyTextureNode::compile(SVMCompiler& compiler) @@ -777,10 +749,9 @@ void SkyTextureNode::compile(SVMCompiler& compiler) assert(false); int vector_offset = tex_mapping.compile_begin(compiler, vector_in); - int sky_model = type; compiler.stack_assign(color_out); - compiler.add_node(NODE_TEX_SKY, vector_offset, compiler.stack_assign(color_out), sky_model); + compiler.add_node(NODE_TEX_SKY, vector_offset, compiler.stack_assign(color_out), type); compiler.add_node(__float_as_uint(sunsky.phi), __float_as_uint(sunsky.theta), __float_as_uint(sunsky.radiance_x), __float_as_uint(sunsky.radiance_y)); compiler.add_node(__float_as_uint(sunsky.radiance_z), __float_as_uint(sunsky.config_x[0]), __float_as_uint(sunsky.config_x[1]), __float_as_uint(sunsky.config_x[2])); compiler.add_node(__float_as_uint(sunsky.config_x[3]), __float_as_uint(sunsky.config_x[4]), __float_as_uint(sunsky.config_x[5]), __float_as_uint(sunsky.config_x[6])); @@ -798,7 +769,6 @@ void SkyTextureNode::compile(OSLCompiler& compiler) tex_mapping.compile(compiler); SunSky sunsky; - if(type == NODE_SKY_OLD) sky_texture_precompute_old(&sunsky, sun_direction, turbidity); else if(type == NODE_SKY_NEW) @@ -806,7 +776,7 @@ void SkyTextureNode::compile(OSLCompiler& compiler) else assert(false); - compiler.parameter("sky_model", type_enum[type]); + compiler.parameter(this, "type"); compiler.parameter("theta", sunsky.theta); compiler.parameter("phi", sunsky.phi); compiler.parameter_color("radiance", make_float3(sunsky.radiance_x, sunsky.radiance_y, sunsky.radiance_z)); @@ -818,31 +788,33 @@ void SkyTextureNode::compile(OSLCompiler& compiler) /* Gradient Texture */ -static NodeEnum gradient_type_init() +NODE_DEFINE(GradientTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("gradient_texture", create, NodeType::SHADER); - enm.insert("Linear", NODE_BLEND_LINEAR); - enm.insert("Quadratic", NODE_BLEND_QUADRATIC); - enm.insert("Easing", NODE_BLEND_EASING); - enm.insert("Diagonal", NODE_BLEND_DIAGONAL); - enm.insert("Radial", NODE_BLEND_RADIAL); - enm.insert("Quadratic Sphere", NODE_BLEND_QUADRATIC_SPHERE); - enm.insert("Spherical", NODE_BLEND_SPHERICAL); + TEXTURE_MAPPING_DEFINE(GradientTextureNode); - return enm; -} + static NodeEnum type_enum; + type_enum.insert("linear", NODE_BLEND_LINEAR); + type_enum.insert("quadratic", NODE_BLEND_QUADRATIC); + type_enum.insert("easing", NODE_BLEND_EASING); + type_enum.insert("diagonal", NODE_BLEND_DIAGONAL); + type_enum.insert("radial", NODE_BLEND_RADIAL); + type_enum.insert("quadratic_sphere", NODE_BLEND_QUADRATIC_SPHERE); + type_enum.insert("spherical", NODE_BLEND_SPHERICAL); + SOCKET_ENUM(type, "Type", type_enum, NODE_BLEND_LINEAR); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); -NodeEnum GradientTextureNode::type_enum = gradient_type_init(); + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} GradientTextureNode::GradientTextureNode() -: TextureNode("gradient_texture") +: TextureNode(node_type) { - type = NODE_BLEND_LINEAR; - - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); } void GradientTextureNode::compile(SVMCompiler& compiler) @@ -867,22 +839,32 @@ void GradientTextureNode::compile(OSLCompiler& compiler) { tex_mapping.compile(compiler); - compiler.parameter("type", type_enum[type]); + compiler.parameter(this, "type"); compiler.add(this, "node_gradient_texture"); } /* Noise Texture */ -NoiseTextureNode::NoiseTextureNode() -: TextureNode("noise_texture") +NODE_DEFINE(NoiseTextureNode) { - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_input("Scale", SocketType::FLOAT, 1.0f); - add_input("Detail", SocketType::FLOAT, 2.0f); - add_input("Distortion", SocketType::FLOAT, 0.0f); + NodeType* type = NodeType::add("noise_texture", create, NodeType::SHADER); + + TEXTURE_MAPPING_DEFINE(NoiseTextureNode); + + SOCKET_IN_FLOAT(scale, "Scale", 1.0f); + SOCKET_IN_FLOAT(detail, "Detail", 2.0f); + SOCKET_IN_FLOAT(distortion, "Distortion", 0.0f); + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} + +NoiseTextureNode::NoiseTextureNode() +: TextureNode(node_type) +{ } void NoiseTextureNode::compile(SVMCompiler& compiler) @@ -906,9 +888,9 @@ void NoiseTextureNode::compile(SVMCompiler& compiler) compiler.stack_assign_if_linked(color_out), compiler.stack_assign_if_linked(fac_out))); compiler.add_node( - __float_as_int(scale_in->value_float()), - __float_as_int(detail_in->value_float()), - __float_as_int(distortion_in->value_float())); + __float_as_int(scale), + __float_as_int(detail), + __float_as_int(distortion)); tex_mapping.compile_end(compiler, vector_in, vector_offset); } @@ -922,28 +904,29 @@ void NoiseTextureNode::compile(OSLCompiler& compiler) /* Voronoi Texture */ -static NodeEnum voronoi_coloring_init() +NODE_DEFINE(VoronoiTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("voronoi_texture", create, NodeType::SHADER); - enm.insert("Intensity", NODE_VORONOI_INTENSITY); - enm.insert("Cells", NODE_VORONOI_CELLS); + TEXTURE_MAPPING_DEFINE(VoronoiTextureNode); - return enm; -} + static NodeEnum coloring_enum; + coloring_enum.insert("intensity", NODE_VORONOI_INTENSITY); + coloring_enum.insert("cells", NODE_VORONOI_CELLS); + SOCKET_ENUM(coloring, "Coloring", coloring_enum, NODE_VORONOI_INTENSITY); -NodeEnum VoronoiTextureNode::coloring_enum = voronoi_coloring_init(); + SOCKET_IN_FLOAT(scale, "Scale", 1.0f); + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); -VoronoiTextureNode::VoronoiTextureNode() -: TextureNode("voronoi_texture") -{ - coloring = NODE_VORONOI_INTENSITY; + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); - add_input("Scale", SocketType::FLOAT, 1.0f); - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); + return type; +} - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); +VoronoiTextureNode::VoronoiTextureNode() +: TextureNode(node_type) +{ } void VoronoiTextureNode::compile(SVMCompiler& compiler) @@ -962,7 +945,7 @@ void VoronoiTextureNode::compile(SVMCompiler& compiler) vector_offset, compiler.stack_assign(fac_out), compiler.stack_assign(color_out)), - __float_as_int(scale_in->value_float())); + __float_as_int(scale)); tex_mapping.compile_end(compiler, vector_in, vector_offset); } @@ -971,42 +954,43 @@ void VoronoiTextureNode::compile(OSLCompiler& compiler) { tex_mapping.compile(compiler); - compiler.parameter("coloring", coloring_enum[coloring]); + compiler.parameter(this, "coloring"); compiler.add(this, "node_voronoi_texture"); } /* Musgrave Texture */ -static NodeEnum musgrave_type_init() +NODE_DEFINE(MusgraveTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("musgrave_texture", create, NodeType::SHADER); - enm.insert("Multifractal", NODE_MUSGRAVE_MULTIFRACTAL); - enm.insert("fBM", NODE_MUSGRAVE_FBM); - enm.insert("Hybrid Multifractal", NODE_MUSGRAVE_HYBRID_MULTIFRACTAL); - enm.insert("Ridged Multifractal", NODE_MUSGRAVE_RIDGED_MULTIFRACTAL); - enm.insert("Hetero Terrain", NODE_MUSGRAVE_HETERO_TERRAIN); + TEXTURE_MAPPING_DEFINE(MusgraveTextureNode); - return enm; -} + static NodeEnum type_enum; + type_enum.insert("multifractal", NODE_MUSGRAVE_MULTIFRACTAL); + type_enum.insert("fBM", NODE_MUSGRAVE_FBM); + type_enum.insert("hybrid_multifractal", NODE_MUSGRAVE_HYBRID_MULTIFRACTAL); + type_enum.insert("ridged_multifractal", NODE_MUSGRAVE_RIDGED_MULTIFRACTAL); + type_enum.insert("hetero_terrain", NODE_MUSGRAVE_HETERO_TERRAIN); + SOCKET_ENUM(type, "Type", type_enum, NODE_MUSGRAVE_FBM); -NodeEnum MusgraveTextureNode::type_enum = musgrave_type_init(); + SOCKET_IN_FLOAT(scale, "Scale", 1.0f); + SOCKET_IN_FLOAT(detail, "Detail", 2.0f); + SOCKET_IN_FLOAT(dimension, "Dimension", 2.0f); + SOCKET_IN_FLOAT(lacunarity, "Lacunarity", 1.0f); + SOCKET_IN_FLOAT(offset, "Offset", 0.0f); + SOCKET_IN_FLOAT(gain, "Gain", 1.0f); + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); -MusgraveTextureNode::MusgraveTextureNode() -: TextureNode("musgrave_texture") -{ - type = NODE_MUSGRAVE_FBM; + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); - add_input("Scale", SocketType::FLOAT, 1.0f); - add_input("Detail", SocketType::FLOAT, 2.0f); - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_input("Dimension", SocketType::FLOAT, 2.0f); - add_input("Lacunarity", SocketType::FLOAT, 1.0f); - add_input("Offset", SocketType::FLOAT, 0.0f); - add_input("Gain", SocketType::FLOAT, 1.0f); + return type; +} - add_output("Fac", SocketType::FLOAT); - add_output("Color", SocketType::COLOR); +MusgraveTextureNode::MusgraveTextureNode() +: TextureNode(node_type) +{ } void MusgraveTextureNode::compile(SVMCompiler& compiler) @@ -1037,12 +1021,12 @@ void MusgraveTextureNode::compile(SVMCompiler& compiler) compiler.encode_uchar4( compiler.stack_assign_if_linked(gain_in), compiler.stack_assign_if_linked(scale_in))); - compiler.add_node(__float_as_int(dimension_in->value_float()), - __float_as_int(lacunarity_in->value_float()), - __float_as_int(detail_in->value_float()), - __float_as_int(offset_in->value_float())); - compiler.add_node(__float_as_int(gain_in->value_float()), - __float_as_int(scale_in->value_float())); + compiler.add_node(__float_as_int(dimension), + __float_as_int(lacunarity), + __float_as_int(detail), + __float_as_int(offset)); + compiler.add_node(__float_as_int(gain), + __float_as_int(scale)); tex_mapping.compile_end(compiler, vector_in, vector_offset); } @@ -1051,50 +1035,43 @@ void MusgraveTextureNode::compile(OSLCompiler& compiler) { tex_mapping.compile(compiler); - compiler.parameter("type", type_enum[type]); - + compiler.parameter(this, "type"); compiler.add(this, "node_musgrave_texture"); } /* Wave Texture */ -static NodeEnum wave_type_init() +NODE_DEFINE(WaveTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("wave_texture", create, NodeType::SHADER); - enm.insert("Bands", NODE_WAVE_BANDS); - enm.insert("Rings", NODE_WAVE_RINGS); + TEXTURE_MAPPING_DEFINE(WaveTextureNode); - return enm; -} + static NodeEnum type_enum; + type_enum.insert("bands", NODE_WAVE_BANDS); + type_enum.insert("rings", NODE_WAVE_RINGS); + SOCKET_ENUM(type, "Type", type_enum, NODE_WAVE_BANDS); -static NodeEnum wave_profile_init() -{ - NodeEnum enm; + static NodeEnum profile_enum; + profile_enum.insert("sine", NODE_WAVE_PROFILE_SIN); + profile_enum.insert("saw", NODE_WAVE_PROFILE_SAW); + SOCKET_ENUM(profile, "Profile", profile_enum, NODE_WAVE_PROFILE_SIN); - enm.insert("Sine", NODE_WAVE_PROFILE_SIN); - enm.insert("Saw", NODE_WAVE_PROFILE_SAW); + SOCKET_IN_FLOAT(scale, "Scale", 1.0f); + SOCKET_IN_FLOAT(distortion, "Distortion", 0.0f); + SOCKET_IN_FLOAT(detail, "Detail", 2.0f); + SOCKET_IN_FLOAT(detail_scale, "Detail Scale", 0.0f); + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - return enm; -} + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); -NodeEnum WaveTextureNode::type_enum = wave_type_init(); -NodeEnum WaveTextureNode::profile_enum = wave_profile_init(); + return type; +} WaveTextureNode::WaveTextureNode() -: TextureNode("wave_texture") +: TextureNode(node_type) { - type = NODE_WAVE_BANDS; - profile = NODE_WAVE_PROFILE_SIN; - - add_input("Scale", SocketType::FLOAT, 1.0f); - add_input("Distortion", SocketType::FLOAT, 0.0f); - add_input("Detail", SocketType::FLOAT, 2.0f); - add_input("Detail Scale", SocketType::FLOAT, 1.0f); - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); } void WaveTextureNode::compile(SVMCompiler& compiler) @@ -1123,10 +1100,10 @@ void WaveTextureNode::compile(SVMCompiler& compiler) profile); compiler.add_node( - __float_as_int(scale_in->value_float()), - __float_as_int(detail_in->value_float()), - __float_as_int(distortion_in->value_float()), - __float_as_int(dscale_in->value_float())); + __float_as_int(scale), + __float_as_int(detail), + __float_as_int(distortion), + __float_as_int(detail_scale)); tex_mapping.compile_end(compiler, vector_in, vector_offset); } @@ -1135,25 +1112,35 @@ void WaveTextureNode::compile(OSLCompiler& compiler) { tex_mapping.compile(compiler); - compiler.parameter("type", type_enum[type]); - compiler.parameter("profile", profile_enum[profile]); + compiler.parameter(this, "type"); + compiler.parameter(this, "profile"); compiler.add(this, "node_wave_texture"); } /* Magic Texture */ -MagicTextureNode::MagicTextureNode() -: TextureNode("magic_texture") +NODE_DEFINE(MagicTextureNode) { - depth = 2; + NodeType* type = NodeType::add("magic_texture", create, NodeType::SHADER); + + TEXTURE_MAPPING_DEFINE(MagicTextureNode); + + SOCKET_INT(depth, "Depth", 2); - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_input("Scale", SocketType::FLOAT, 5.0f); - add_input("Distortion", SocketType::FLOAT, 1.0f); + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); + SOCKET_IN_FLOAT(scale, "Scale", 5.0f); + SOCKET_IN_FLOAT(distortion, "Distortion", 1.0f); - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} + +MagicTextureNode::MagicTextureNode() +: TextureNode(node_type) +{ } void MagicTextureNode::compile(SVMCompiler& compiler) @@ -1176,8 +1163,8 @@ void MagicTextureNode::compile(SVMCompiler& compiler) compiler.stack_assign_if_linked(scale_in), compiler.stack_assign_if_linked(distortion_in))); compiler.add_node( - __float_as_int(scale_in->value_float()), - __float_as_int(distortion_in->value_float())); + __float_as_int(scale), + __float_as_int(distortion)); tex_mapping.compile_end(compiler, vector_in, vector_offset); } @@ -1186,22 +1173,32 @@ void MagicTextureNode::compile(OSLCompiler& compiler) { tex_mapping.compile(compiler); - compiler.parameter("depth", depth); + compiler.parameter(this, "depth"); compiler.add(this, "node_magic_texture"); } /* Checker Texture */ -CheckerTextureNode::CheckerTextureNode() -: TextureNode("checker_texture") +NODE_DEFINE(CheckerTextureNode) { - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_input("Color1", SocketType::COLOR); - add_input("Color2", SocketType::COLOR); - add_input("Scale", SocketType::FLOAT, 1.0f); + NodeType* type = NodeType::add("checker_texture", create, NodeType::SHADER); + + TEXTURE_MAPPING_DEFINE(CheckerTextureNode); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); + SOCKET_IN_COLOR(color1, "Color1", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_COLOR(color2, "Color2", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_FLOAT(scale, "Scale", 1.0f); + + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); + return type; +} + +CheckerTextureNode::CheckerTextureNode() +: TextureNode(node_type) +{ } void CheckerTextureNode::compile(SVMCompiler& compiler) @@ -1225,7 +1222,7 @@ void CheckerTextureNode::compile(SVMCompiler& compiler) compiler.encode_uchar4( compiler.stack_assign_if_linked(color_out), compiler.stack_assign_if_linked(fac_out)), - __float_as_int(scale_in->value_float())); + __float_as_int(scale)); tex_mapping.compile_end(compiler, vector_in, vector_offset); } @@ -1239,26 +1236,37 @@ void CheckerTextureNode::compile(OSLCompiler& compiler) /* Brick Texture */ -BrickTextureNode::BrickTextureNode() -: TextureNode("brick_texture") +NODE_DEFINE(BrickTextureNode) { - offset = 0.5f; - offset_frequency = 2; - squash = 1.0f; - squash_frequency = 2; - - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_input("Color1", SocketType::COLOR); - add_input("Color2", SocketType::COLOR); - add_input("Mortar", SocketType::COLOR); - add_input("Scale", SocketType::FLOAT, 5.0f); - add_input("Mortar Size", SocketType::FLOAT, 0.02f); - add_input("Bias", SocketType::FLOAT, 0.0f); - add_input("Brick Width", SocketType::FLOAT, 0.5f); - add_input("Row Height", SocketType::FLOAT, 0.25f); + NodeType* type = NodeType::add("brick_texture", create, NodeType::SHADER); + + TEXTURE_MAPPING_DEFINE(BrickTextureNode); + + SOCKET_FLOAT(offset, "Offset", 0.5f); + SOCKET_INT(offset_frequency, "Offset Frequency", 2); + SOCKET_FLOAT(squash, "Squash", 1.0f); + SOCKET_INT(squash_frequency, "Squash Frequency", 2); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TEXTURE_GENERATED); - add_output("Color", SocketType::COLOR); - add_output("Fac", SocketType::FLOAT); + SOCKET_IN_COLOR(color1, "Color1", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_COLOR(color2, "Color2", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_COLOR(mortar, "Mortar", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_FLOAT(scale, "Scale", 5.0f); + SOCKET_IN_FLOAT(mortar_size, "Mortar Size", 0.02f); + SOCKET_IN_FLOAT(bias, "Bias", 0.0f); + SOCKET_IN_FLOAT(brick_width, "Brick Width", 0.5f); + SOCKET_IN_FLOAT(row_height, "Row Height", 0.25f); + + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} + +BrickTextureNode::BrickTextureNode() +: TextureNode(node_type) +{ } void BrickTextureNode::compile(SVMCompiler& compiler) @@ -1295,12 +1303,12 @@ void BrickTextureNode::compile(SVMCompiler& compiler) compiler.stack_assign_if_linked(fac_out))); compiler.add_node(compiler.encode_uchar4(offset_frequency, squash_frequency), - __float_as_int(scale_in->value_float()), - __float_as_int(mortar_size_in->value_float()), - __float_as_int(bias_in->value_float())); + __float_as_int(scale), + __float_as_int(mortar_size), + __float_as_int(bias)); - compiler.add_node(__float_as_int(brick_width_in->value_float()), - __float_as_int(row_height_in->value_float()), + compiler.add_node(__float_as_int(brick_width), + __float_as_int(row_height), __float_as_int(offset), __float_as_int(squash)); @@ -1311,48 +1319,55 @@ void BrickTextureNode::compile(OSLCompiler& compiler) { tex_mapping.compile(compiler); - compiler.parameter("offset", offset); - compiler.parameter("offset_frequency", offset_frequency); - compiler.parameter("squash", squash); - compiler.parameter("squash_frequency", squash_frequency); + compiler.parameter(this, "offset"); + compiler.parameter(this, "offset_frequency"); + compiler.parameter(this, "squash"); + compiler.parameter(this, "squash_frequency"); compiler.add(this, "node_brick_texture"); } /* Point Density Texture */ -static NodeEnum point_density_space_init() +NODE_DEFINE(PointDensityTextureNode) { - NodeEnum enm; + NodeType* type = NodeType::add("point_density_texture", create, NodeType::SHADER); - enm.insert("Object", NODE_TEX_VOXEL_SPACE_OBJECT); - enm.insert("World", NODE_TEX_VOXEL_SPACE_WORLD); + SOCKET_STRING(filename, "Filename", ustring("")); - return enm; -} + static NodeEnum space_enum; + space_enum.insert("object", NODE_TEX_VOXEL_SPACE_OBJECT); + space_enum.insert("world", NODE_TEX_VOXEL_SPACE_WORLD); + SOCKET_ENUM(space, "Space", space_enum, NODE_TEX_VOXEL_SPACE_OBJECT); + + static NodeEnum interpolation_enum; + interpolation_enum.insert("closest", INTERPOLATION_CLOSEST); + interpolation_enum.insert("linear", INTERPOLATION_LINEAR); + interpolation_enum.insert("cubic", INTERPOLATION_CUBIC); + interpolation_enum.insert("smart", INTERPOLATION_SMART); + SOCKET_ENUM(interpolation, "Interpolation", interpolation_enum, INTERPOLATION_LINEAR); + + SOCKET_TRANSFORM(tfm, "Transform", transform_identity()); -NodeEnum PointDensityTextureNode::space_enum = point_density_space_init(); + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_POSITION); + + SOCKET_OUT_FLOAT(density, "Density"); + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} PointDensityTextureNode::PointDensityTextureNode() -: ShaderNode("point_density") +: ShaderNode(node_type) { image_manager = NULL; slot = -1; - filename = ""; - space = NODE_TEX_VOXEL_SPACE_OBJECT; builtin_data = NULL; - interpolation = INTERPOLATION_LINEAR; - - tfm = transform_identity(); - - add_input("Vector", SocketType::POINT, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_POSITION); - add_output("Density", SocketType::FLOAT); - add_output("Color", SocketType::COLOR); } PointDensityTextureNode::~PointDensityTextureNode() { if(image_manager) { - image_manager->remove_image(filename, + image_manager->remove_image(filename.string(), builtin_data, interpolation, EXTENSION_CLIP); @@ -1390,7 +1405,7 @@ void PointDensityTextureNode::compile(SVMCompiler& compiler) if(use_density || use_color) { if(slot == -1) { bool is_float, is_linear; - slot = image_manager->add_image(filename, builtin_data, + slot = image_manager->add_image(filename.string(), builtin_data, false, 0, is_float, is_linear, interpolation, @@ -1442,7 +1457,7 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler) if(use_density || use_color) { if(slot == -1) { bool is_float, is_linear; - slot = image_manager->add_image(filename, builtin_data, + slot = image_manager->add_image(filename.string(), builtin_data, false, 0, is_float, is_linear, interpolation, @@ -1457,33 +1472,30 @@ void PointDensityTextureNode::compile(OSLCompiler& compiler) compiler.parameter("mapping", transform_transpose(tfm)); compiler.parameter("use_mapping", 1); } - switch(interpolation) { - case INTERPOLATION_CLOSEST: - compiler.parameter("interpolation", "closest"); - break; - case INTERPOLATION_CUBIC: - compiler.parameter("interpolation", "cubic"); - break; - case INTERPOLATION_LINEAR: - default: - compiler.parameter("interpolation", "linear"); - break; - } - + compiler.parameter(this, "interpolation"); compiler.add(this, "node_voxel_texture"); } } /* Normal */ -NormalNode::NormalNode() -: ShaderNode("normal") +NODE_DEFINE(NormalNode) { - direction = make_float3(0.0f, 0.0f, 1.0f); + NodeType* type = NodeType::add("normal", create, NodeType::SHADER); + + SOCKET_VECTOR(direction, "direction", make_float3(0.0f, 0.0f, 0.0f)); - add_input("Normal", SocketType::NORMAL); - add_output("Normal", SocketType::NORMAL); - add_output("Dot", SocketType::FLOAT); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_NORMAL(normal, "Normal"); + SOCKET_OUT_FLOAT(dot, "Dot"); + + return type; +} + +NormalNode::NormalNode() +: ShaderNode(node_type) +{ } void NormalNode::compile(SVMCompiler& compiler) @@ -1504,17 +1516,27 @@ void NormalNode::compile(SVMCompiler& compiler) void NormalNode::compile(OSLCompiler& compiler) { - compiler.parameter_normal("direction", direction); + compiler.parameter(this, "direction"); compiler.add(this, "node_normal"); } /* Mapping */ +NODE_DEFINE(MappingNode) +{ + NodeType* type = NodeType::add("mapping", create, NodeType::SHADER); + + TEXTURE_MAPPING_DEFINE(MappingNode); + + SOCKET_IN_POINT(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_OUT_POINT(vector, "Vector"); + + return type; +} + MappingNode::MappingNode() -: ShaderNode("mapping") +: ShaderNode(node_type) { - add_input("Vector", SocketType::POINT); - add_output("Vector", SocketType::POINT); } void MappingNode::compile(SVMCompiler& compiler) @@ -1538,17 +1560,25 @@ void MappingNode::compile(OSLCompiler& compiler) /* RGBToBW */ +NODE_DEFINE(RGBToBWNode) +{ + NodeType* type = NodeType::add("rgb_to_bw", create, NodeType::SHADER); + + SOCKET_IN_POINT(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_OUT_POINT(val, "Val"); + + return type; +} + RGBToBWNode::RGBToBWNode() -: ShaderNode("rgb_to_bw") +: ShaderNode(node_type) { - add_input("Color", SocketType::COLOR); - add_output("Val", SocketType::FLOAT); } bool RGBToBWNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) { if(inputs[0]->link == NULL) { - optimized->set(linear_rgb_to_gray(inputs[0]->value())); + optimized->set(linear_rgb_to_gray(color)); return true; } @@ -1570,82 +1600,94 @@ void RGBToBWNode::compile(OSLCompiler& compiler) /* Convert */ -ConvertNode::ConvertNode(SocketType::Type from_, SocketType::Type to_, bool autoconvert) -: ShaderNode("convert") +const NodeType* ConvertNode::node_types[ConvertNode::MAX_TYPE][ConvertNode::MAX_TYPE]; +bool ConvertNode::initialized = ConvertNode::register_types(); + +Node* ConvertNode::create(const NodeType *type) { - from = from_; - to = to_; + return new ConvertNode(type->inputs[0].type, type->outputs[0].type); +} - if(autoconvert) { - if(from == to) - special_type = SHADER_SPECIAL_TYPE_PROXY; - else - special_type = SHADER_SPECIAL_TYPE_AUTOCONVERT; +bool ConvertNode::register_types() +{ + const int num_types = 8; + SocketType::Type types[num_types] = {SocketType::FLOAT, + SocketType::INT, + SocketType::COLOR, + SocketType::VECTOR, + SocketType::POINT, + SocketType::NORMAL, + SocketType::STRING, + SocketType::CLOSURE}; + + for(size_t i = 0; i < num_types; i++) { + SocketType::Type from = types[i]; + ustring from_name(SocketType::type_name(from)); + ustring from_value_name("value_" + from_name.string()); + + for(size_t j = 0; j < num_types; j++) { + SocketType::Type to = types[j]; + ustring to_name(SocketType::type_name(to)); + ustring to_value_name("value_" + to_name.string()); + + string node_name = "convert_" + from_name.string() + "_to_" + to_name.string(); + NodeType* type = NodeType::add(node_name.c_str(), create, NodeType::SHADER); + + type->register_input(from_value_name, from_value_name, from, + SOCKET_OFFSETOF(ConvertNode, value_float), SocketType::zero_default_value(), + NULL, NULL, SocketType::LINKABLE); + type->register_output(to_value_name, to_value_name, to); + + assert(from < MAX_TYPE); + assert(to < MAX_TYPE); + + node_types[from][to] = type; + } } - if(from == SocketType::FLOAT) - add_input("value_float", SocketType::FLOAT); - else if(from == SocketType::INT) - add_input("value_int", SocketType::INT); - else if(from == SocketType::COLOR) - add_input("value_color", SocketType::COLOR); - else if(from == SocketType::VECTOR) - add_input("value_vector", SocketType::VECTOR); - else if(from == SocketType::POINT) - add_input("value_point", SocketType::POINT); - else if(from == SocketType::NORMAL) - add_input("value_normal", SocketType::NORMAL); - else if(from == SocketType::STRING) - add_input("value_string", SocketType::STRING); - else if(from == SocketType::CLOSURE) - add_input("value_closure", SocketType::CLOSURE); - else - assert(0); + return true; +} - if(to == SocketType::FLOAT) - add_output("value_float", SocketType::FLOAT); - else if(to == SocketType::INT) - add_output("value_int", SocketType::INT); - else if(to == SocketType::COLOR) - add_output("value_color", SocketType::COLOR); - else if(to == SocketType::VECTOR) - add_output("value_vector", SocketType::VECTOR); - else if(to == SocketType::POINT) - add_output("value_point", SocketType::POINT); - else if(to == SocketType::NORMAL) - add_output("value_normal", SocketType::NORMAL); - else if(to == SocketType::STRING) - add_output("value_string", SocketType::STRING); - else if(to == SocketType::CLOSURE) - add_output("value_closure", SocketType::CLOSURE); - else - assert(0); +ConvertNode::ConvertNode(SocketType::Type from_, SocketType::Type to_, bool autoconvert) +: ShaderNode(node_types[from_][to_]) +{ + from = from_; + to = to_; + + if(from == to) + special_type = SHADER_SPECIAL_TYPE_PROXY; + else if(autoconvert) + special_type = SHADER_SPECIAL_TYPE_AUTOCONVERT; } bool ConvertNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) { + /* proxy nodes should have been removed at this point */ + assert(special_type != SHADER_SPECIAL_TYPE_PROXY); + ShaderInput *in = inputs[0]; - float3 value = in->value(); /* TODO(DingTo): conversion from/to int is not supported yet, don't fold in that case */ if(in->link == NULL) { if(from == SocketType::FLOAT) { if(SocketType::is_float3(to)) { - optimized->set(make_float3(value.x, value.x, value.x)); + optimized->set(make_float3(value_float, value_float, value_float)); return true; } } else if(SocketType::is_float3(from)) { if(to == SocketType::FLOAT) { if(from == SocketType::COLOR) - optimized->set(linear_rgb_to_gray(value)); + /* color to float */ + optimized->set(linear_rgb_to_gray(value_color)); else - optimized->set(average(value)); + /* vector/point/normal to float */ + optimized->set(average(value_vector)); return true; } else if(SocketType::is_float3(to)) { - optimized->set(value); + optimized->set(value_color); return true; } } @@ -1656,8 +1698,8 @@ bool ConvertNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *opti void ConvertNode::compile(SVMCompiler& compiler) { - /* constant folding should eliminate proxy nodes */ - assert(from != to); + /* proxy nodes should have been removed at this point */ + assert(special_type != SHADER_SPECIAL_TYPE_PROXY); ShaderInput *in = inputs[0]; ShaderOutput *out = outputs[0]; @@ -1703,15 +1745,15 @@ void ConvertNode::compile(SVMCompiler& compiler) else { /* set 0,0,0 value */ compiler.add_node(NODE_VALUE_V, compiler.stack_assign(out)); - compiler.add_node(NODE_VALUE_V, in->value()); + compiler.add_node(NODE_VALUE_V, value_color); } } } void ConvertNode::compile(OSLCompiler& compiler) { - /* constant folding should eliminate proxy nodes */ - assert(from != to); + /* proxy nodes should have been removed at this point */ + assert(special_type != SHADER_SPECIAL_TYPE_PROXY); if(from == SocketType::FLOAT) compiler.add(this, "node_convert_from_float"); @@ -1731,23 +1773,10 @@ void ConvertNode::compile(OSLCompiler& compiler) /* BSDF Closure */ -BsdfNode::BsdfNode(bool scattering_) -: ShaderNode("bsdf"), scattering(scattering_) +BsdfNode::BsdfNode(const NodeType *node_type) +: ShaderNode(node_type) { special_type = SHADER_SPECIAL_TYPE_CLOSURE; - - add_input("Color", SocketType::COLOR, make_float3(0.8f, 0.8f, 0.8f)); - add_input("Normal", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); - add_input("SurfaceMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); - - if(scattering) { - closure = CLOSURE_BSSRDF_CUBIC_ID; - add_output("BSSRDF", SocketType::CLOSURE); - } - else { - closure = CLOSURE_BSDF_DIFFUSE_ID; - add_output("BSDF", SocketType::CLOSURE); - } } void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3, ShaderInput *param4) @@ -1759,9 +1788,9 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput * if(color_in->link) compiler.add_node(NODE_CLOSURE_WEIGHT, compiler.stack_assign(color_in)); else - compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value()); + compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color); - int normal_offset = compiler.stack_assign_if_linked(normal_in); + int normal_offset = (normal_in) ? compiler.stack_assign_if_linked(normal_in) : SVM_STACK_INVALID; int tangent_offset = (tangent_in) ? compiler.stack_assign_if_linked(tangent_in) : SVM_STACK_INVALID; int param3_offset = (param3) ? compiler.stack_assign(param3) : SVM_STACK_INVALID; int param4_offset = (param4) ? compiler.stack_assign(param4) : SVM_STACK_INVALID; @@ -1771,8 +1800,8 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput * (param1)? compiler.stack_assign(param1): SVM_STACK_INVALID, (param2)? compiler.stack_assign(param2): SVM_STACK_INVALID, compiler.closure_mix_weight_offset()), - __float_as_int((param1)? param1->value_float(): 0.0f), - __float_as_int((param2)? param2->value_float(): 0.0f)); + __float_as_int((param1)? get_float(param1->socket_type): 0.0f), + __float_as_int((param2)? get_float(param2->socket_type): 0.0f)); compiler.add_node(normal_offset, tangent_offset, param3_offset, param4_offset); } @@ -1789,29 +1818,35 @@ void BsdfNode::compile(OSLCompiler& /*compiler*/) /* Anisotropic BSDF Closure */ -static NodeEnum aniso_distribution_init() +NODE_DEFINE(AnisotropicBsdfNode) { - NodeEnum enm; + NodeType* type = NodeType::add("anisotropic_bsdf", create, NodeType::SHADER); - enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID); - enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID); - enm.insert("Ashikhmin-Shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum distribution_enum; + distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ANISO_ID); + distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID); + distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ANISO_ID); + SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID); + + SOCKET_IN_VECTOR(tangent, "Tangent", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TANGENT); + + SOCKET_IN_FLOAT(roughness, "Roughness", 0.2f); + SOCKET_IN_FLOAT(anisotropy, "Anisotropy", 0.5f); + SOCKET_IN_FLOAT(rotation, "Rotation", 0.0f); -NodeEnum AnisotropicBsdfNode::distribution_enum = aniso_distribution_init(); + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} AnisotropicBsdfNode::AnisotropicBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID; - distribution = CLOSURE_BSDF_MICROFACET_GGX_ANISO_ID; - - add_input("Tangent", SocketType::VECTOR, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_TANGENT); - - add_input("Roughness", SocketType::FLOAT, 0.2f); - add_input("Anisotropy", SocketType::FLOAT, 0.5f); - add_input("Rotation", SocketType::FLOAT, 0.0f); } void AnisotropicBsdfNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -1835,33 +1870,38 @@ void AnisotropicBsdfNode::compile(SVMCompiler& compiler) void AnisotropicBsdfNode::compile(OSLCompiler& compiler) { - compiler.parameter("distribution", distribution_enum[distribution]); + compiler.parameter(this, "distribution"); compiler.add(this, "node_anisotropic_bsdf"); } /* Glossy BSDF Closure */ -static NodeEnum glossy_distribution_init() +NODE_DEFINE(GlossyBsdfNode) { - NodeEnum enm; + NodeType* type = NodeType::add("glossy_bsdf", create, NodeType::SHADER); - enm.insert("Sharp", CLOSURE_BSDF_REFLECTION_ID); - enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID); - enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID); - enm.insert("Ashikhmin-Shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum distribution_enum; + distribution_enum.insert("sharp", CLOSURE_BSDF_REFLECTION_ID); + distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_ID); + distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_ID); + distribution_enum.insert("ashikhmin_shirley", CLOSURE_BSDF_ASHIKHMIN_SHIRLEY_ID); + SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_ID); + SOCKET_IN_FLOAT(roughness, "Roughness", 0.2f); + + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); -NodeEnum GlossyBsdfNode::distribution_enum = glossy_distribution_init(); + return type; +} GlossyBsdfNode::GlossyBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_MICROFACET_GGX_ID; - distribution = CLOSURE_BSDF_MICROFACET_GGX_ID; distribution_orig = NBUILTIN_CLOSURES; - - add_input("Roughness", SocketType::FLOAT, 0.2f); } void GlossyBsdfNode::simplify_settings(Scene *scene) @@ -1875,7 +1915,7 @@ void GlossyBsdfNode::simplify_settings(Scene *scene) * Note: Keep the epsilon in sync with kernel! */ ShaderInput *roughness_input = input("Roughness"); - if(!roughness_input->link && roughness_input->value_float() <= 1e-4f) { + if(!roughness_input->link && roughness <= 1e-4f) { distribution = CLOSURE_BSDF_REFLECTION_ID; } } @@ -1889,7 +1929,7 @@ void GlossyBsdfNode::simplify_settings(Scene *scene) bool GlossyBsdfNode::has_integrator_dependency() { ShaderInput *roughness_input = input("Roughness"); - return !roughness_input->link && roughness_input->value_float() <= 1e-4f; + return !roughness_input->link && roughness <= 1e-4f; } void GlossyBsdfNode::compile(SVMCompiler& compiler) @@ -1904,33 +1944,38 @@ void GlossyBsdfNode::compile(SVMCompiler& compiler) void GlossyBsdfNode::compile(OSLCompiler& compiler) { - compiler.parameter("distribution", distribution_enum[distribution]); + compiler.parameter(this, "distribution"); compiler.add(this, "node_glossy_bsdf"); } /* Glass BSDF Closure */ -static NodeEnum glass_distribution_init() +NODE_DEFINE(GlassBsdfNode) { - NodeEnum enm; + NodeType* type = NodeType::add("glass_bsdf", create, NodeType::SHADER); - enm.insert("Sharp", CLOSURE_BSDF_SHARP_GLASS_ID); - enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID); - enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum distribution_enum; + distribution_enum.insert("sharp", CLOSURE_BSDF_SHARP_GLASS_ID); + distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_GLASS_ID); + distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID); + SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_GLASS_ID); + SOCKET_IN_FLOAT(roughness, "Roughness", 0.0f); + SOCKET_IN_FLOAT(IOR, "IOR", 0.3f); -NodeEnum GlassBsdfNode::distribution_enum = glass_distribution_init(); + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} GlassBsdfNode::GlassBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_SHARP_GLASS_ID; - distribution = CLOSURE_BSDF_SHARP_GLASS_ID; distribution_orig = NBUILTIN_CLOSURES; - - add_input("Roughness", SocketType::FLOAT, 0.0f); - add_input("IOR", SocketType::FLOAT, 0.3f); } void GlassBsdfNode::simplify_settings(Scene *scene) @@ -1944,7 +1989,7 @@ void GlassBsdfNode::simplify_settings(Scene *scene) * Note: Keep the epsilon in sync with kernel! */ ShaderInput *roughness_input = input("Roughness"); - if(!roughness_input->link && roughness_input->value_float() <= 1e-4f) { + if(!roughness_input->link && roughness <= 1e-4f) { distribution = CLOSURE_BSDF_SHARP_GLASS_ID; } } @@ -1958,7 +2003,7 @@ void GlassBsdfNode::simplify_settings(Scene *scene) bool GlassBsdfNode::has_integrator_dependency() { ShaderInput *roughness_input = input("Roughness"); - return !roughness_input->link && roughness_input->value_float() <= 1e-4f; + return !roughness_input->link && roughness <= 1e-4f; } void GlassBsdfNode::compile(SVMCompiler& compiler) @@ -1973,33 +2018,39 @@ void GlassBsdfNode::compile(SVMCompiler& compiler) void GlassBsdfNode::compile(OSLCompiler& compiler) { - compiler.parameter("distribution", distribution_enum[distribution]); + compiler.parameter(this, "distribution"); compiler.add(this, "node_glass_bsdf"); } /* Refraction BSDF Closure */ -static NodeEnum refraction_distribution_init() +NODE_DEFINE(RefractionBsdfNode) { - NodeEnum enm; + NodeType* type = NodeType::add("refraction_bsdf", create, NodeType::SHADER); - enm.insert("Sharp", CLOSURE_BSDF_REFRACTION_ID); - enm.insert("Beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID); - enm.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum distribution_enum; + distribution_enum.insert("sharp", CLOSURE_BSDF_REFRACTION_ID); + distribution_enum.insert("beckmann", CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID); + distribution_enum.insert("GGX", CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID); + SOCKET_ENUM(distribution, "Distribution", distribution_enum, CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID); + + SOCKET_IN_FLOAT(roughness, "Roughness", 0.0f); + SOCKET_IN_FLOAT(IOR, "IOR", 0.3f); + + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); -NodeEnum RefractionBsdfNode::distribution_enum = refraction_distribution_init(); + return type; +} RefractionBsdfNode::RefractionBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_REFRACTION_ID; - distribution = CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID; distribution_orig = NBUILTIN_CLOSURES; - - add_input("Roughness", SocketType::FLOAT, 0.0f); - add_input("IOR", SocketType::FLOAT, 0.3f); } void RefractionBsdfNode::simplify_settings(Scene *scene) @@ -2013,7 +2064,7 @@ void RefractionBsdfNode::simplify_settings(Scene *scene) * Note: Keep the epsilon in sync with kernel! */ ShaderInput *roughness_input = input("Roughness"); - if(!roughness_input->link && roughness_input->value_float() <= 1e-4f) { + if(!roughness_input->link && roughness <= 1e-4f) { distribution = CLOSURE_BSDF_REFRACTION_ID; } } @@ -2027,7 +2078,7 @@ void RefractionBsdfNode::simplify_settings(Scene *scene) bool RefractionBsdfNode::has_integrator_dependency() { ShaderInput *roughness_input = input("Roughness"); - return !roughness_input->link && roughness_input->value_float() <= 1e-4f; + return !roughness_input->link && roughness <= 1e-4f; } void RefractionBsdfNode::compile(SVMCompiler& compiler) @@ -2042,31 +2093,36 @@ void RefractionBsdfNode::compile(SVMCompiler& compiler) void RefractionBsdfNode::compile(OSLCompiler& compiler) { - compiler.parameter("distribution", distribution_enum[distribution]); + compiler.parameter(this, "distribution"); compiler.add(this, "node_refraction_bsdf"); } /* Toon BSDF Closure */ -static NodeEnum toon_component_init() +NODE_DEFINE(ToonBsdfNode) { - NodeEnum enm; + NodeType* type = NodeType::add("toon_bsdf", create, NodeType::SHADER); - enm.insert("Diffuse", CLOSURE_BSDF_DIFFUSE_TOON_ID); - enm.insert("Glossy", CLOSURE_BSDF_GLOSSY_TOON_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum component_enum; + component_enum.insert("diffuse", CLOSURE_BSDF_DIFFUSE_TOON_ID); + component_enum.insert("glossy", CLOSURE_BSDF_GLOSSY_TOON_ID); + SOCKET_ENUM(component, "Component", component_enum, CLOSURE_BSDF_DIFFUSE_TOON_ID); + SOCKET_IN_FLOAT(size, "Size", 0.5f); + SOCKET_IN_FLOAT(smooth, "Smooth", 0.0f); -NodeEnum ToonBsdfNode::component_enum = toon_component_init(); + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} ToonBsdfNode::ToonBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_DIFFUSE_TOON_ID; - component = CLOSURE_BSDF_DIFFUSE_TOON_ID; - - add_input("Size", SocketType::FLOAT, 0.5f); - add_input("Smooth", SocketType::FLOAT, 0.0f); } void ToonBsdfNode::compile(SVMCompiler& compiler) @@ -2078,17 +2134,30 @@ void ToonBsdfNode::compile(SVMCompiler& compiler) void ToonBsdfNode::compile(OSLCompiler& compiler) { - compiler.parameter("component", component_enum[component]); + compiler.parameter(this, "component"); compiler.add(this, "node_toon_bsdf"); } /* Velvet BSDF Closure */ +NODE_DEFINE(VelvetBsdfNode) +{ + NodeType* type = NodeType::add("velvet_bsdf", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + SOCKET_IN_FLOAT(sigma, "Sigma", 1.0f); + + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} + VelvetBsdfNode::VelvetBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_ASHIKHMIN_VELVET_ID; - - add_input("Sigma", SocketType::FLOAT, 1.0f); } void VelvetBsdfNode::compile(SVMCompiler& compiler) @@ -2103,10 +2172,24 @@ void VelvetBsdfNode::compile(OSLCompiler& compiler) /* Diffuse BSDF Closure */ +NODE_DEFINE(DiffuseBsdfNode) +{ + NodeType* type = NodeType::add("diffuse_bsdf", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + SOCKET_IN_FLOAT(roughness, "Roughness", 0.0f); + + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} + DiffuseBsdfNode::DiffuseBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_DIFFUSE_ID; - add_input("Roughness", SocketType::FLOAT, 0.0f); } void DiffuseBsdfNode::compile(SVMCompiler& compiler) @@ -2121,7 +2204,21 @@ void DiffuseBsdfNode::compile(OSLCompiler& compiler) /* Translucent BSDF Closure */ +NODE_DEFINE(TranslucentBsdfNode) +{ + NodeType* type = NodeType::add("translucent_bsdf", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} + TranslucentBsdfNode::TranslucentBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_TRANSLUCENT_ID; } @@ -2138,9 +2235,21 @@ void TranslucentBsdfNode::compile(OSLCompiler& compiler) /* Transparent BSDF Closure */ +NODE_DEFINE(TransparentBsdfNode) +{ + NodeType* type = NodeType::add("transparent_bsdf", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} + TransparentBsdfNode::TransparentBsdfNode() +: BsdfNode(node_type) { - name = "transparent"; closure = CLOSURE_BSDF_TRANSPARENT_ID; } @@ -2156,29 +2265,32 @@ void TransparentBsdfNode::compile(OSLCompiler& compiler) /* Subsurface Scattering Closure */ -static NodeEnum subsurface_falloff_init() +NODE_DEFINE(SubsurfaceScatteringNode) { - NodeEnum enm; + NodeType* type = NodeType::add("subsurface_scattering", create, NodeType::SHADER); - enm.insert("Cubic", CLOSURE_BSSRDF_CUBIC_ID); - enm.insert("Gaussian", CLOSURE_BSSRDF_GAUSSIAN_ID); - enm.insert("Burley", CLOSURE_BSSRDF_BURLEY_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum falloff_enum; + falloff_enum.insert("cubic", CLOSURE_BSSRDF_CUBIC_ID); + falloff_enum.insert("gaussian", CLOSURE_BSSRDF_GAUSSIAN_ID); + falloff_enum.insert("burley", CLOSURE_BSSRDF_BURLEY_ID); + SOCKET_ENUM(falloff, "Falloff", falloff_enum, CLOSURE_BSSRDF_BURLEY_ID); + SOCKET_IN_FLOAT(scale, "Scale", 0.01f); + SOCKET_IN_VECTOR(radius, "Radius", make_float3(0.1f, 0.1f, 0.1f)); + SOCKET_IN_FLOAT(sharpness, "Sharpness", 0.0f); + SOCKET_IN_FLOAT(texture_blur, "Texture Blur", 1.0f); -NodeEnum SubsurfaceScatteringNode::falloff_enum = subsurface_falloff_init(); + SOCKET_OUT_CLOSURE(BSSRDF, "BSSRDF"); + + return type; +} SubsurfaceScatteringNode::SubsurfaceScatteringNode() -: BsdfNode(true) +: BsdfNode(node_type) { - name = "subsurface_scattering"; - falloff = CLOSURE_BSSRDF_CUBIC_ID; - - add_input("Scale", SocketType::FLOAT, 0.01f); - add_input("Radius", SocketType::VECTOR, make_float3(0.1f, 0.1f, 0.1f)); - add_input("Sharpness", SocketType::FLOAT, 0.0f); - add_input("Texture Blur", SocketType::FLOAT, 1.0f); } void SubsurfaceScatteringNode::compile(SVMCompiler& compiler) @@ -2189,7 +2301,7 @@ void SubsurfaceScatteringNode::compile(SVMCompiler& compiler) void SubsurfaceScatteringNode::compile(OSLCompiler& compiler) { - compiler.parameter("falloff", falloff_enum[closure]); + compiler.parameter(this, "falloff"); compiler.add(this, "node_subsurface_scattering"); } @@ -2202,14 +2314,22 @@ bool SubsurfaceScatteringNode::has_bssrdf_bump() /* Emissive Closure */ -EmissionNode::EmissionNode() -: ShaderNode("emission") +NODE_DEFINE(EmissionNode) { - add_input("Color", SocketType::COLOR, make_float3(0.8f, 0.8f, 0.8f)); - add_input("Strength", SocketType::FLOAT, 10.0f); - add_input("SurfaceMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); + NodeType* type = NodeType::add("emission", create, NodeType::SHADER); - add_output("Emission", SocketType::CLOSURE); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_FLOAT(strength, "Strength", 1.0f); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(emission, "Emission"); + + return type; +} + +EmissionNode::EmissionNode() +: ShaderNode(node_type) +{ } void EmissionNode::compile(SVMCompiler& compiler) @@ -2223,7 +2343,7 @@ void EmissionNode::compile(SVMCompiler& compiler) compiler.stack_assign(strength_in)); } else - compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value() * strength_in->value_float()); + compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color * strength); compiler.add_node(NODE_CLOSURE_EMISSION, compiler.closure_mix_weight_offset()); } @@ -2238,20 +2358,28 @@ bool EmissionNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *) ShaderInput *color_in = input("Color"); ShaderInput *strength_in = input("Strength"); - return ((!color_in->link && color_in->value() == make_float3(0.0f, 0.0f, 0.0f)) || - (!strength_in->link && strength_in->value_float() == 0.0f)); + return ((!color_in->link && color == make_float3(0.0f, 0.0f, 0.0f)) || + (!strength_in->link && strength == 0.0f)); } /* Background Closure */ -BackgroundNode::BackgroundNode() -: ShaderNode("background") +NODE_DEFINE(BackgroundNode) { - add_input("Color", SocketType::COLOR, make_float3(0.8f, 0.8f, 0.8f)); - add_input("Strength", SocketType::FLOAT, 1.0f); - add_input("SurfaceMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); + NodeType* type = NodeType::add("background_shader", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_FLOAT(strength, "Strength", 1.0f); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(background, "Background"); - add_output("Background", SocketType::CLOSURE); + return type; +} + +BackgroundNode::BackgroundNode() +: ShaderNode(node_type) +{ } void BackgroundNode::compile(SVMCompiler& compiler) @@ -2265,7 +2393,7 @@ void BackgroundNode::compile(SVMCompiler& compiler) compiler.stack_assign(strength_in)); } else - compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value()*strength_in->value_float()); + compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color*strength); compiler.add_node(NODE_CLOSURE_BACKGROUND, compiler.closure_mix_weight_offset()); } @@ -2280,19 +2408,27 @@ bool BackgroundNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *) ShaderInput *color_in = input("Color"); ShaderInput *strength_in = input("Strength"); - return ((!color_in->link && color_in->value() == make_float3(0.0f, 0.0f, 0.0f)) || - (!strength_in->link && strength_in->value_float() == 0.0f)); + return ((!color_in->link && color == make_float3(0.0f, 0.0f, 0.0f)) || + (!strength_in->link && strength == 0.0f)); } /* Holdout Closure */ -HoldoutNode::HoldoutNode() -: ShaderNode("holdout") +NODE_DEFINE(HoldoutNode) { - add_input("SurfaceMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); - add_input("VolumeMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); + NodeType* type = NodeType::add("holdout", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + SOCKET_IN_FLOAT(volume_mix_weight, "VolumeMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(holdout, "Holdout"); + + return type; +} - add_output("Holdout", SocketType::CLOSURE); +HoldoutNode::HoldoutNode() +: ShaderNode(node_type) +{ } void HoldoutNode::compile(SVMCompiler& compiler) @@ -2310,14 +2446,22 @@ void HoldoutNode::compile(OSLCompiler& compiler) /* Ambient Occlusion */ -AmbientOcclusionNode::AmbientOcclusionNode() -: ShaderNode("ambient_occlusion") +NODE_DEFINE(AmbientOcclusionNode) { - add_input("NormalIn", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_input("Color", SocketType::COLOR, make_float3(0.8f, 0.8f, 0.8f)); - add_input("SurfaceMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); + NodeType* type = NodeType::add("ambient_occlusion", create, NodeType::SHADER); + + SOCKET_IN_NORMAL(normal_osl, "NormalIn", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(AO, "AO"); - add_output("AO", SocketType::CLOSURE); + return type; +} + +AmbientOcclusionNode::AmbientOcclusionNode() +: ShaderNode(node_type) +{ } void AmbientOcclusionNode::compile(SVMCompiler& compiler) @@ -2327,7 +2471,7 @@ void AmbientOcclusionNode::compile(SVMCompiler& compiler) if(color_in->link) compiler.add_node(NODE_CLOSURE_WEIGHT, compiler.stack_assign(color_in)); else - compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value()); + compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color); compiler.add_node(NODE_CLOSURE_AMBIENT_OCCLUSION, compiler.closure_mix_weight_offset()); } @@ -2339,16 +2483,10 @@ void AmbientOcclusionNode::compile(OSLCompiler& compiler) /* Volume Closure */ -VolumeNode::VolumeNode() -: ShaderNode("volume") +VolumeNode::VolumeNode(const NodeType *node_type) +: ShaderNode(node_type) { closure = CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID; - - add_input("Color", SocketType::COLOR, make_float3(0.8f, 0.8f, 0.8f)); - add_input("Density", SocketType::FLOAT, 1.0f); - add_input("VolumeMixWeight", SocketType::FLOAT, 0.0f, SocketType::SVM_INTERNAL); - - add_output("Volume", SocketType::CLOSURE); } void VolumeNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2) @@ -2358,15 +2496,15 @@ void VolumeNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput if(color_in->link) compiler.add_node(NODE_CLOSURE_WEIGHT, compiler.stack_assign(color_in)); else - compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value()); + compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color); compiler.add_node(NODE_CLOSURE_VOLUME, compiler.encode_uchar4(closure, (param1)? compiler.stack_assign(param1): SVM_STACK_INVALID, (param2)? compiler.stack_assign(param2): SVM_STACK_INVALID, compiler.closure_mix_weight_offset()), - __float_as_int((param1)? param1->value_float(): 0.0f), - __float_as_int((param2)? param2->value_float(): 0.0f)); + __float_as_int((param1)? get_float(param1->socket_type): 0.0f), + __float_as_int((param2)? get_float(param2->socket_type): 0.0f)); } void VolumeNode::compile(SVMCompiler& compiler) @@ -2381,7 +2519,21 @@ void VolumeNode::compile(OSLCompiler& /*compiler*/) /* Absorption Volume Closure */ +NODE_DEFINE(AbsorptionVolumeNode) +{ + NodeType* type = NodeType::add("absorption_volume", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_FLOAT(density, "Density", 1.0f); + SOCKET_IN_FLOAT(volume_mix_weight, "VolumeMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(volume, "Volume"); + + return type; +} + AbsorptionVolumeNode::AbsorptionVolumeNode() +: VolumeNode(node_type) { closure = CLOSURE_VOLUME_ABSORPTION_ID; } @@ -2398,11 +2550,24 @@ void AbsorptionVolumeNode::compile(OSLCompiler& compiler) /* Scatter Volume Closure */ +NODE_DEFINE(ScatterVolumeNode) +{ + NodeType* type = NodeType::add("scatter_volume", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_FLOAT(density, "Density", 1.0f); + SOCKET_IN_FLOAT(anisotropy, "Anisotropy", 0.0f); + SOCKET_IN_FLOAT(volume_mix_weight, "VolumeMixWeight", 0.0f, SocketType::SVM_INTERNAL); + + SOCKET_OUT_CLOSURE(volume, "Volume"); + + return type; +} + ScatterVolumeNode::ScatterVolumeNode() +: VolumeNode(node_type) { closure = CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID; - - add_input("Anisotropy", SocketType::FLOAT, 0.0f); } void ScatterVolumeNode::compile(SVMCompiler& compiler) @@ -2417,27 +2582,32 @@ void ScatterVolumeNode::compile(OSLCompiler& compiler) /* Hair BSDF Closure */ -static NodeEnum hair_component_init() +NODE_DEFINE(HairBsdfNode) { - NodeEnum enm; + NodeType* type = NodeType::add("hair_bsdf", create, NodeType::SHADER); - enm.insert("Reflection", CLOSURE_BSDF_HAIR_REFLECTION_ID); - enm.insert("Transmission", CLOSURE_BSDF_HAIR_TRANSMISSION_ID); + SOCKET_IN_COLOR(color, "Color", make_float3(0.8f, 0.8f, 0.8f)); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(surface_mix_weight, "SurfaceMixWeight", 0.0f, SocketType::SVM_INTERNAL); - return enm; -} + static NodeEnum component_enum; + component_enum.insert("reflection", CLOSURE_BSDF_HAIR_REFLECTION_ID); + component_enum.insert("transmission", CLOSURE_BSDF_HAIR_TRANSMISSION_ID); + SOCKET_ENUM(component, "Component", component_enum, CLOSURE_BSDF_HAIR_REFLECTION_ID); + SOCKET_IN_FLOAT(offset, "Offset", 0.0f); + SOCKET_IN_FLOAT(roughness_u, "RoughnessU", 0.2f); + SOCKET_IN_FLOAT(roughness_v, "RoughnessV", 0.2f); + SOCKET_IN_VECTOR(tangent, "Tangent", make_float3(0.0f, 0.0f, 0.0f)); -NodeEnum HairBsdfNode::component_enum = hair_component_init(); + SOCKET_OUT_CLOSURE(BSDF, "BSDF"); + + return type; +} HairBsdfNode::HairBsdfNode() +: BsdfNode(node_type) { closure = CLOSURE_BSDF_HAIR_REFLECTION_ID; - component = CLOSURE_BSDF_HAIR_REFLECTION_ID; - - add_input("Offset", SocketType::FLOAT); - add_input("RoughnessU", SocketType::FLOAT); - add_input("RoughnessV", SocketType::FLOAT); - add_input("Tangent", SocketType::VECTOR); } void HairBsdfNode::compile(SVMCompiler& compiler) @@ -2449,27 +2619,34 @@ void HairBsdfNode::compile(SVMCompiler& compiler) void HairBsdfNode::compile(OSLCompiler& compiler) { - compiler.parameter("component", component_enum[component]); - + compiler.parameter(this, "component"); compiler.add(this, "node_hair_bsdf"); } /* Geometry */ +NODE_DEFINE(GeometryNode) +{ + NodeType* type = NodeType::add("geometry", create, NodeType::SHADER); + + SOCKET_IN_NORMAL(normal_osl, "NormalIn", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); + + SOCKET_OUT_POINT(position, "Position"); + SOCKET_OUT_NORMAL(normal, "Normal"); + SOCKET_OUT_NORMAL(tangent, "Tangent"); + SOCKET_OUT_NORMAL(true_normal, "True Normal"); + SOCKET_OUT_VECTOR(incoming, "Incoming"); + SOCKET_OUT_POINT(parametric, "Parametric"); + SOCKET_OUT_FLOAT(backfacing, "Backfacing"); + SOCKET_OUT_FLOAT(pointiness, "Pointiness"); + + return type; +} + GeometryNode::GeometryNode() -: ShaderNode("geometry") +: ShaderNode(node_type) { special_type = SHADER_SPECIAL_TYPE_GEOMETRY; - - add_input("NormalIn", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_output("Position", SocketType::POINT); - add_output("Normal", SocketType::NORMAL); - add_output("Tangent", SocketType::NORMAL); - add_output("True Normal", SocketType::NORMAL); - add_output("Incoming", SocketType::VECTOR); - add_output("Parametric", SocketType::POINT); - add_output("Backfacing", SocketType::FLOAT); - add_output("Pointiness", SocketType::FLOAT); } void GeometryNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -2564,21 +2741,30 @@ void GeometryNode::compile(OSLCompiler& compiler) /* TextureCoordinate */ -TextureCoordinateNode::TextureCoordinateNode() -: ShaderNode("texture_coordinate") +NODE_DEFINE(TextureCoordinateNode) { - add_input("NormalIn", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_output("Generated", SocketType::POINT); - add_output("Normal", SocketType::NORMAL); - add_output("UV", SocketType::POINT); - add_output("Object", SocketType::POINT); - add_output("Camera", SocketType::POINT); - add_output("Window", SocketType::POINT); - add_output("Reflection", SocketType::NORMAL); + NodeType* type = NodeType::add("texture_coordinate", create, NodeType::SHADER); + + SOCKET_BOOLEAN(from_dupli, "From Dupli", false); + SOCKET_BOOLEAN(use_transform, "Use Transform", false); + SOCKET_TRANSFORM(ob_tfm, "Object Transform", transform_identity()); + + SOCKET_IN_NORMAL(normal_osl, "NormalIn", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - from_dupli = false; - use_transform = false; - ob_tfm = transform_identity(); + SOCKET_OUT_POINT(generated, "Generated"); + SOCKET_OUT_NORMAL(normal, "Normal"); + SOCKET_OUT_POINT(UV, "UV"); + SOCKET_OUT_POINT(object, "Object"); + SOCKET_OUT_POINT(camera, "Camera"); + SOCKET_OUT_POINT(window, "Window"); + SOCKET_OUT_NORMAL(reflection, "Reflection"); + + return type; +} + +TextureCoordinateNode::TextureCoordinateNode() +: ShaderNode(node_type) +{ } void TextureCoordinateNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -2702,22 +2888,32 @@ void TextureCoordinateNode::compile(OSLCompiler& compiler) compiler.parameter("is_background", true); if(compiler.output_type() == SHADER_TYPE_VOLUME) compiler.parameter("is_volume", true); - compiler.parameter("use_transform", use_transform); + compiler.parameter(this, "use_transform"); Transform ob_itfm = transform_transpose(transform_inverse(ob_tfm)); compiler.parameter("object_itfm", ob_itfm); - compiler.parameter("from_dupli", from_dupli); + compiler.parameter(this, "from_dupli"); compiler.add(this, "node_texture_coordinate"); } -UVMapNode::UVMapNode() -: ShaderNode("uvmap") +/* UV Map */ + +NODE_DEFINE(UVMapNode) { - attribute = ""; - from_dupli = false; + NodeType* type = NodeType::add("uvmap", create, NodeType::SHADER); + + SOCKET_IN_STRING(attribute, "attribute", ustring("")); + SOCKET_IN_BOOLEAN(from_dupli, "from dupli", false); + + SOCKET_OUT_POINT(UV, "UV"); - add_output("UV", SocketType::POINT); + return type; +} + +UVMapNode::UVMapNode() +: ShaderNode(node_type) +{ } void UVMapNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -2776,28 +2972,36 @@ void UVMapNode::compile(OSLCompiler& compiler) else compiler.parameter("bump_offset", "center"); - compiler.parameter("from_dupli", from_dupli); - compiler.parameter("name", attribute.c_str()); + compiler.parameter(this, "from_dupli"); + compiler.parameter(this, "attribute"); compiler.add(this, "node_uv_map"); } /* Light Path */ +NODE_DEFINE(LightPathNode) +{ + NodeType* type = NodeType::add("light_path", create, NodeType::SHADER); + + SOCKET_OUT_FLOAT(is_camera_ray, "Is Camera Ray"); + SOCKET_OUT_FLOAT(is_shadow_ray, "Is Shadow Ray"); + SOCKET_OUT_FLOAT(is_diffus_ray, "Is Diffus Ray"); + SOCKET_OUT_FLOAT(is_glossy_ray, "Is Glossy Ray"); + SOCKET_OUT_FLOAT(is_singular_ray, "Is Singular Ray"); + SOCKET_OUT_FLOAT(is_reflection_ray, "Is Reflection Ray"); + SOCKET_OUT_FLOAT(is_transmission_ray, "Is Transmission Ray"); + SOCKET_OUT_FLOAT(is_volume_scatter_ray, "Is Volume Scatter Ray"); + SOCKET_OUT_FLOAT(ray_length, "Ray Length"); + SOCKET_OUT_FLOAT(ray_depth, "Ray Depth"); + SOCKET_OUT_FLOAT(transparent_depth, "Transparent Depth"); + SOCKET_OUT_FLOAT(transmission_depth, "Transmission Depth"); + + return type; +} + LightPathNode::LightPathNode() -: ShaderNode("light_path") -{ - add_output("Is Camera Ray", SocketType::FLOAT); - add_output("Is Shadow Ray", SocketType::FLOAT); - add_output("Is Diffuse Ray", SocketType::FLOAT); - add_output("Is Glossy Ray", SocketType::FLOAT); - add_output("Is Singular Ray", SocketType::FLOAT); - add_output("Is Reflection Ray", SocketType::FLOAT); - add_output("Is Transmission Ray", SocketType::FLOAT); - add_output("Is Volume Scatter Ray", SocketType::FLOAT); - add_output("Ray Length", SocketType::FLOAT); - add_output("Ray Depth", SocketType::FLOAT); - add_output("Transparent Depth", SocketType::FLOAT); - add_output("Transmission Depth", SocketType::FLOAT); +: ShaderNode(node_type) +{ } void LightPathNode::compile(SVMCompiler& compiler) @@ -2873,14 +3077,23 @@ void LightPathNode::compile(OSLCompiler& compiler) /* Light Falloff */ +NODE_DEFINE(LightFalloffNode) +{ + NodeType* type = NodeType::add("light_fallof", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(strength, "Strength", 100.0f); + SOCKET_IN_FLOAT(smooth, "Smooth", 0.0f); + + SOCKET_OUT_FLOAT(quadratic, "Quadratic"); + SOCKET_OUT_FLOAT(linear, "Linear"); + SOCKET_OUT_FLOAT(constant, "Constant"); + + return type; +} + LightFalloffNode::LightFalloffNode() -: ShaderNode("light_fallof") +: ShaderNode(node_type) { - add_input("Strength", SocketType::FLOAT, 100.0f); - add_input("Smooth", SocketType::FLOAT, 0.0f); - add_output("Quadratic", SocketType::FLOAT); - add_output("Linear", SocketType::FLOAT); - add_output("Constant", SocketType::FLOAT); } void LightFalloffNode::compile(SVMCompiler& compiler) @@ -2923,13 +3136,21 @@ void LightFalloffNode::compile(OSLCompiler& compiler) /* Object Info */ +NODE_DEFINE(ObjectInfoNode) +{ + NodeType* type = NodeType::add("object_info", create, NodeType::SHADER); + + SOCKET_OUT_VECTOR(location, "Location"); + SOCKET_OUT_FLOAT(object_index, "Object Index"); + SOCKET_OUT_FLOAT(material_index, "Material Index"); + SOCKET_OUT_FLOAT(random, "Random"); + + return type; +} + ObjectInfoNode::ObjectInfoNode() -: ShaderNode("object_info") +: ShaderNode(node_type) { - add_output("Location", SocketType::VECTOR); - add_output("Object Index", SocketType::FLOAT); - add_output("Material Index", SocketType::FLOAT); - add_output("Random", SocketType::FLOAT); } void ObjectInfoNode::compile(SVMCompiler& compiler) @@ -2962,19 +3183,27 @@ void ObjectInfoNode::compile(OSLCompiler& compiler) /* Particle Info */ -ParticleInfoNode::ParticleInfoNode() -: ShaderNode("particle_info") +NODE_DEFINE(ParticleInfoNode) { - add_output("Index", SocketType::FLOAT); - add_output("Age", SocketType::FLOAT); - add_output("Lifetime", SocketType::FLOAT); - add_output("Location", SocketType::POINT); + NodeType* type = NodeType::add("particle_info", create, NodeType::SHADER); + + SOCKET_OUT_FLOAT(index, "Index"); + SOCKET_OUT_FLOAT(age, "Age"); + SOCKET_OUT_FLOAT(lifetime, "Lifetime"); + SOCKET_OUT_POINT(location, "Location"); #if 0 /* not yet supported */ - add_output("Rotation", SHADER_SOCKET_QUATERNION); + SOCKET_OUT_QUATERNION(rotation, "Rotation"); #endif - add_output("Size", SocketType::FLOAT); - add_output("Velocity", SocketType::VECTOR); - add_output("Angular Velocity", SocketType::VECTOR); + SOCKET_OUT_FLOAT(size, "Size"); + SOCKET_OUT_VECTOR(velocity, "Velocity"); + SOCKET_OUT_VECTOR(angular_velocity, "Angular Velocity"); + + return type; +} + +ParticleInfoNode::ParticleInfoNode() +: ShaderNode(node_type) +{ } void ParticleInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -3056,15 +3285,24 @@ void ParticleInfoNode::compile(OSLCompiler& compiler) /* Hair Info */ +NODE_DEFINE(HairInfoNode) +{ + NodeType* type = NodeType::add("hair_info", create, NodeType::SHADER); + + SOCKET_OUT_FLOAT(is_strand, "Is Strand"); + SOCKET_OUT_FLOAT(intercept, "Intercept"); + SOCKET_OUT_FLOAT(thickness, "Thickness"); + SOCKET_OUT_NORMAL(tangent Normal, "Tangent Normal"); +#if 0 /*output for minimum hair width transparency - deactivated */ + SOCKET_OUT_FLOAT(fade, "Fade"); +#endif + + return type; +} + HairInfoNode::HairInfoNode() -: ShaderNode("hair_info") +: ShaderNode(node_type) { - add_output("Is Strand", SocketType::FLOAT); - add_output("Intercept", SocketType::FLOAT); - add_output("Thickness", SocketType::FLOAT); - add_output("Tangent Normal", SocketType::NORMAL); - /*output for minimum hair width transparency - deactivated*/ - /*add_output("Fade", SocketType::FLOAT);*/ } void HairInfoNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -3118,12 +3356,19 @@ void HairInfoNode::compile(OSLCompiler& compiler) /* Value */ -ValueNode::ValueNode() -: ShaderNode("value") +NODE_DEFINE(ValueNode) { - value = 0.0f; + NodeType* type = NodeType::add("value", create, NodeType::SHADER); + + SOCKET_FLOAT(value, "Value", 0.0f); + SOCKET_OUT_FLOAT(value, "Value"); - add_output("Value", SocketType::FLOAT); + return type; +} + +ValueNode::ValueNode() +: ShaderNode(node_type) +{ } bool ValueNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) @@ -3147,12 +3392,19 @@ void ValueNode::compile(OSLCompiler& compiler) /* Color */ -ColorNode::ColorNode() -: ShaderNode("color") +NODE_DEFINE(ColorNode) { - value = make_float3(0.0f, 0.0f, 0.0f); + NodeType* type = NodeType::add("color", create, NodeType::SHADER); + + SOCKET_COLOR(value, "Value", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_OUT_COLOR(color, "Color"); - add_output("Color", SocketType::COLOR); + return type; +} + +ColorNode::ColorNode() +: ShaderNode(node_type) +{ } bool ColorNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) @@ -3180,14 +3432,21 @@ void ColorNode::compile(OSLCompiler& compiler) /* Add Closure */ +NODE_DEFINE(AddClosureNode) +{ + NodeType* type = NodeType::add("add_closure", create, NodeType::SHADER); + + SOCKET_IN_CLOSURE(closure1, "Closure1"); + SOCKET_IN_CLOSURE(closure2, "Closure2"); + SOCKET_OUT_CLOSURE(closure, "Closure"); + + return type; +} + AddClosureNode::AddClosureNode() -: ShaderNode("add_closure") +: ShaderNode(node_type) { special_type = SHADER_SPECIAL_TYPE_COMBINE_CLOSURE; - - add_input("Closure1", SocketType::CLOSURE); - add_input("Closure2", SocketType::CLOSURE); - add_output("Closure", SocketType::CLOSURE); } void AddClosureNode::compile(SVMCompiler& /*compiler*/) @@ -3202,15 +3461,23 @@ void AddClosureNode::compile(OSLCompiler& compiler) /* Mix Closure */ +NODE_DEFINE(MixClosureNode) +{ + NodeType* type = NodeType::add("mix_closure", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(fac, "Fac", 0.5f); + SOCKET_IN_CLOSURE(closure1, "Closure1"); + SOCKET_IN_CLOSURE(closure2, "Closure2"); + + SOCKET_OUT_CLOSURE(closure, "Closure"); + + return type; +} + MixClosureNode::MixClosureNode() -: ShaderNode("mix_closure") +: ShaderNode(node_type) { special_type = SHADER_SPECIAL_TYPE_COMBINE_CLOSURE; - - add_input("Fac", SocketType::FLOAT, 0.5f); - add_input("Closure1", SocketType::CLOSURE); - add_input("Closure2", SocketType::CLOSURE); - add_output("Closure", SocketType::CLOSURE); } void MixClosureNode::compile(SVMCompiler& /*compiler*/) @@ -3240,12 +3507,12 @@ bool MixClosureNode::constant_fold(ShaderGraph *graph, ShaderOutput *, ShaderInp /* check for closure links and make sure factor link is disconnected */ if(closure1_in->link && closure2_in->link && !fac_in->link) { /* factor 0.0 */ - if(fac_in->value_float() == 0.0f) { + if(fac == 0.0f) { graph->relink(this, closure_out, closure1_in->link); return true; } /* factor 1.0 */ - else if(fac_in->value_float() == 1.0f) { + else if(fac == 1.0f) { graph->relink(this, closure_out, closure2_in->link); return true; } @@ -3256,13 +3523,22 @@ bool MixClosureNode::constant_fold(ShaderGraph *graph, ShaderOutput *, ShaderInp /* Mix Closure */ +NODE_DEFINE(MixClosureWeightNode) +{ + NodeType* type = NodeType::add("mix_closure_weight", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(weight, "Weight", 1.0f); + SOCKET_IN_FLOAT(fac, "Fac", 1.0f); + + SOCKET_OUT_FLOAT(weight1, "Weight1"); + SOCKET_OUT_FLOAT(weight2, "Weight2"); + + return type; +} + MixClosureWeightNode::MixClosureWeightNode() -: ShaderNode("mix_closure_weight") +: ShaderNode(node_type) { - add_input("Weight", SocketType::FLOAT, 1.0f); - add_input("Fac", SocketType::FLOAT, 1.0f); - add_output("Weight1", SocketType::FLOAT); - add_output("Weight2", SocketType::FLOAT); } void MixClosureWeightNode::compile(SVMCompiler& compiler) @@ -3287,12 +3563,21 @@ void MixClosureWeightNode::compile(OSLCompiler& /*compiler*/) /* Invert */ +NODE_DEFINE(InvertNode) +{ + NodeType* type = NodeType::add("invert", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(fac, "Fac", 1.0f); + SOCKET_IN_COLOR(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + InvertNode::InvertNode() -: ShaderNode("invert") +: ShaderNode(node_type) { - add_input("Fac", SocketType::FLOAT, 1.0f); - add_input("Color", SocketType::COLOR); - add_output("Color", SocketType::COLOR); } void InvertNode::compile(SVMCompiler& compiler) @@ -3314,46 +3599,46 @@ void InvertNode::compile(OSLCompiler& compiler) /* Mix */ -MixNode::MixNode() -: ShaderNode("mix") +NODE_DEFINE(MixNode) { - type = NODE_MIX_BLEND; + NodeType* type = NodeType::add("mix", create, NodeType::SHADER); - use_clamp = false; + static NodeEnum type_enum; + type_enum.insert("mix", NODE_MIX_BLEND); + type_enum.insert("add", NODE_MIX_ADD); + type_enum.insert("multiply", NODE_MIX_MUL); + type_enum.insert("screen", NODE_MIX_SCREEN); + type_enum.insert("overlay", NODE_MIX_OVERLAY); + type_enum.insert("subtract", NODE_MIX_SUB); + type_enum.insert("divide", NODE_MIX_DIV); + type_enum.insert("difference", NODE_MIX_DIFF); + type_enum.insert("darken", NODE_MIX_DARK); + type_enum.insert("lighten", NODE_MIX_LIGHT); + type_enum.insert("dodge", NODE_MIX_DODGE); + type_enum.insert("burn", NODE_MIX_BURN); + type_enum.insert("hue", NODE_MIX_HUE); + type_enum.insert("saturation", NODE_MIX_SAT); + type_enum.insert("value", NODE_MIX_VAL); + type_enum.insert("color", NODE_MIX_COLOR); + type_enum.insert("soft_light", NODE_MIX_SOFT); + type_enum.insert("linear_light", NODE_MIX_LINEAR); + SOCKET_ENUM(type, "Type", type_enum, NODE_MIX_BLEND); - add_input("Fac", SocketType::FLOAT, 0.5f); - add_input("Color1", SocketType::COLOR); - add_input("Color2", SocketType::COLOR); - add_output("Color", SocketType::COLOR); -} + SOCKET_BOOLEAN(use_clamp, "Use Clamp", false); -static NodeEnum mix_type_init() -{ - NodeEnum enm; + SOCKET_IN_FLOAT(fac, "Fac", 0.5f); + SOCKET_IN_COLOR(color1, "Color1", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_COLOR(color2, "Color2", make_float3(0.0f, 0.0f, 0.0f)); - enm.insert("Mix", NODE_MIX_BLEND); - enm.insert("Add", NODE_MIX_ADD); - enm.insert("Multiply", NODE_MIX_MUL); - enm.insert("Screen", NODE_MIX_SCREEN); - enm.insert("Overlay", NODE_MIX_OVERLAY); - enm.insert("Subtract", NODE_MIX_SUB); - enm.insert("Divide", NODE_MIX_DIV); - enm.insert("Difference", NODE_MIX_DIFF); - enm.insert("Darken", NODE_MIX_DARK); - enm.insert("Lighten", NODE_MIX_LIGHT); - enm.insert("Dodge", NODE_MIX_DODGE); - enm.insert("Burn", NODE_MIX_BURN); - enm.insert("Hue", NODE_MIX_HUE); - enm.insert("Saturation", NODE_MIX_SAT); - enm.insert("Value", NODE_MIX_VAL); - enm.insert("Color", NODE_MIX_COLOR); - enm.insert("Soft Light", NODE_MIX_SOFT); - enm.insert("Linear Light", NODE_MIX_LINEAR); + SOCKET_OUT_COLOR(color, "Color"); - return enm; + return type; } -NodeEnum MixNode::type_enum = mix_type_init(); +MixNode::MixNode() +: ShaderNode(node_type) +{ +} void MixNode::compile(SVMCompiler& compiler) { @@ -3376,8 +3661,8 @@ void MixNode::compile(SVMCompiler& compiler) void MixNode::compile(OSLCompiler& compiler) { - compiler.parameter("type", type_enum[type]); - compiler.parameter("use_clamp", use_clamp); + compiler.parameter(this, "type"); + compiler.parameter(this, "use_clamp"); compiler.add(this, "node_mix"); } @@ -3401,19 +3686,19 @@ bool MixNode::constant_fold(ShaderGraph *graph, ShaderOutput *, ShaderInput *opt /* remove unused mix color input when factor is 0.0 or 1.0 */ if(!fac_in->link) { /* factor 0.0 */ - if(fac_in->value_float() == 0.0f) { + if(fac == 0.0f) { if(color1_in->link) graph->relink(this, color_out, color1_in->link); else - optimized->set(color1_in->value()); + optimized->set(color1); return true; } /* factor 1.0 */ - else if(fac_in->value_float() == 1.0f) { + else if(fac == 1.0f) { if(color2_in->link) graph->relink(this, color_out, color2_in->link); else - optimized->set(color2_in->value()); + optimized->set(color2); return true; } } @@ -3422,13 +3707,23 @@ bool MixNode::constant_fold(ShaderGraph *graph, ShaderOutput *, ShaderInput *opt } /* Combine RGB */ + +NODE_DEFINE(CombineRGBNode) +{ + NodeType* type = NodeType::add("combine_rgb", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(r, "R", 0.0f); + SOCKET_IN_FLOAT(g, "G", 0.0f); + SOCKET_IN_FLOAT(b, "B", 0.0f); + + SOCKET_OUT_COLOR(image, "Image"); + + return type; +} + CombineRGBNode::CombineRGBNode() -: ShaderNode("combine_rgb") +: ShaderNode(node_type) { - add_input("R", SocketType::FLOAT); - add_input("G", SocketType::FLOAT); - add_input("B", SocketType::FLOAT); - add_output("Image", SocketType::COLOR); } void CombineRGBNode::compile(SVMCompiler& compiler) @@ -3457,13 +3752,23 @@ void CombineRGBNode::compile(OSLCompiler& compiler) } /* Combine XYZ */ + +NODE_DEFINE(CombineXYZNode) +{ + NodeType* type = NodeType::add("combine_xyz", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(x, "X", 0.0f); + SOCKET_IN_FLOAT(y, "Y", 0.0f); + SOCKET_IN_FLOAT(z, "Z", 0.0f); + + SOCKET_OUT_COLOR(color, "Image"); + + return type; +} + CombineXYZNode::CombineXYZNode() -: ShaderNode("combine_xyz") +: ShaderNode(node_type) { - add_input("X", SocketType::FLOAT); - add_input("Y", SocketType::FLOAT); - add_input("Z", SocketType::FLOAT); - add_output("Vector", SocketType::VECTOR); } void CombineXYZNode::compile(SVMCompiler& compiler) @@ -3492,13 +3797,23 @@ void CombineXYZNode::compile(OSLCompiler& compiler) } /* Combine HSV */ + +NODE_DEFINE(CombineHSVNode) +{ + NodeType* type = NodeType::add("combine_hsv", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(h, "H", 0.0f); + SOCKET_IN_FLOAT(s, "S", 0.0f); + SOCKET_IN_FLOAT(v, "V", 0.0f); + + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + CombineHSVNode::CombineHSVNode() -: ShaderNode("combine_hsv") +: ShaderNode(node_type) { - add_input("H", SocketType::FLOAT); - add_input("S", SocketType::FLOAT); - add_input("V", SocketType::FLOAT); - add_output("Color", SocketType::COLOR); } void CombineHSVNode::compile(SVMCompiler& compiler) @@ -3522,25 +3837,31 @@ void CombineHSVNode::compile(OSLCompiler& compiler) } /* Gamma */ + +NODE_DEFINE(GammaNode) +{ + NodeType* type = NodeType::add("gamma", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_FLOAT(gamma, "Gamma", 1.0f); + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + GammaNode::GammaNode() -: ShaderNode("gamma") +: ShaderNode(node_type) { - add_input("Color", SocketType::COLOR); - add_input("Gamma", SocketType::FLOAT); - add_output("Color", SocketType::COLOR); } -bool GammaNode::constant_fold(ShaderGraph *, ShaderOutput *socket, ShaderInput *optimized) +bool GammaNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) { ShaderInput *color_in = input("Color"); ShaderInput *gamma_in = input("Gamma"); - if(socket == output("Color")) { - if(color_in->link == NULL && gamma_in->link == NULL) { - optimized->set(svm_math_gamma_color(color_in->value(), - gamma_in->value_float())); - return true; - } + if(color_in->link == NULL && gamma_in->link == NULL) { + optimized->set(svm_math_gamma_color(color, gamma)); + return true; } return false; @@ -3564,13 +3885,23 @@ void GammaNode::compile(OSLCompiler& compiler) } /* Bright Contrast */ + +NODE_DEFINE(BrightContrastNode) +{ + NodeType* type = NodeType::add("brightness_contrast", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_FLOAT(bright, "Bright", 0.0f); + SOCKET_IN_FLOAT(contrast, "Contrast", 0.0f); + + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + BrightContrastNode::BrightContrastNode() -: ShaderNode("brightness") +: ShaderNode(node_type) { - add_input("Color", SocketType::COLOR); - add_input("Bright", SocketType::FLOAT); - add_input("Contrast", SocketType::FLOAT); - add_output("Color", SocketType::COLOR); } void BrightContrastNode::compile(SVMCompiler& compiler) @@ -3594,13 +3925,23 @@ void BrightContrastNode::compile(OSLCompiler& compiler) } /* Separate RGB */ + +NODE_DEFINE(SeparateRGBNode) +{ + NodeType* type = NodeType::add("separate_rgb", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Image", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_FLOAT(g, "R"); + SOCKET_OUT_FLOAT(g, "G"); + SOCKET_OUT_FLOAT(b, "B"); + + return type; +} + SeparateRGBNode::SeparateRGBNode() -: ShaderNode("separate_rgb") +: ShaderNode(node_type) { - add_input("Image", SocketType::COLOR); - add_output("R", SocketType::FLOAT); - add_output("G", SocketType::FLOAT); - add_output("B", SocketType::FLOAT); } void SeparateRGBNode::compile(SVMCompiler& compiler) @@ -3629,13 +3970,23 @@ void SeparateRGBNode::compile(OSLCompiler& compiler) } /* Separate XYZ */ + +NODE_DEFINE(SeparateXYZNode) +{ + NodeType* type = NodeType::add("separate_xyz", create, NodeType::SHADER); + + SOCKET_IN_COLOR(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_FLOAT(x, "X"); + SOCKET_OUT_FLOAT(y, "Y"); + SOCKET_OUT_FLOAT(z, "Z"); + + return type; +} + SeparateXYZNode::SeparateXYZNode() -: ShaderNode("separate_xyz") +: ShaderNode(node_type) { - add_input("Vector", SocketType::VECTOR); - add_output("X", SocketType::FLOAT); - add_output("Y", SocketType::FLOAT); - add_output("Z", SocketType::FLOAT); } void SeparateXYZNode::compile(SVMCompiler& compiler) @@ -3664,13 +4015,23 @@ void SeparateXYZNode::compile(OSLCompiler& compiler) } /* Separate HSV */ + +NODE_DEFINE(SeparateHSVNode) +{ + NodeType* type = NodeType::add("separate_hsv", create, NodeType::SHADER); + + SOCKET_IN_COLOR(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_FLOAT(h, "H"); + SOCKET_OUT_FLOAT(s, "S"); + SOCKET_OUT_FLOAT(v, "V"); + + return type; +} + SeparateHSVNode::SeparateHSVNode() -: ShaderNode("separate_hsv") +: ShaderNode(node_type) { - add_input("Color", SocketType::COLOR); - add_output("H", SocketType::FLOAT); - add_output("S", SocketType::FLOAT); - add_output("V", SocketType::FLOAT); } void SeparateHSVNode::compile(SVMCompiler& compiler) @@ -3694,15 +4055,25 @@ void SeparateHSVNode::compile(OSLCompiler& compiler) } /* Hue Saturation Value */ + +NODE_DEFINE(HSVNode) +{ + NodeType* type = NodeType::add("hsv", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(hue, "Hue", 0.5f); + SOCKET_IN_FLOAT(saturation, "Saturation", 1.0f); + SOCKET_IN_FLOAT(value, "Value", 1.0f); + SOCKET_IN_FLOAT(fac, "Fac", 1.0f); + SOCKET_IN_COLOR(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + HSVNode::HSVNode() -: ShaderNode("hsv") +: ShaderNode(node_type) { - add_input("Hue", SocketType::FLOAT); - add_input("Saturation", SocketType::FLOAT); - add_input("Value", SocketType::FLOAT); - add_input("Fac", SocketType::FLOAT); - add_input("Color", SocketType::COLOR); - add_output("Color", SocketType::COLOR); } void HSVNode::compile(SVMCompiler& compiler) @@ -3732,14 +4103,22 @@ void HSVNode::compile(OSLCompiler& compiler) /* Attribute */ -AttributeNode::AttributeNode() -: ShaderNode("attribute") +NODE_DEFINE(AttributeNode) { - attribute = ""; + NodeType* type = NodeType::add("attribute", create, NodeType::SHADER); + + SOCKET_STRING(attribute, "Attribute", ustring("")); - add_output("Color", SocketType::COLOR); - add_output("Vector", SocketType::VECTOR); - add_output("Fac", SocketType::FLOAT); + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_VECTOR(vector, "Vector"); + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} + +AttributeNode::AttributeNode() +: ShaderNode(node_type) +{ } void AttributeNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -3815,12 +4194,20 @@ void AttributeNode::compile(OSLCompiler& compiler) /* Camera */ +NODE_DEFINE(CameraNode) +{ + NodeType* type = NodeType::add("camera_info", create, NodeType::SHADER); + + SOCKET_OUT_VECTOR(view_vector, "View Vector"); + SOCKET_OUT_FLOAT(view_z_depth, "View Z Depth"); + SOCKET_OUT_FLOAT(view_distance, "View Distance"); + + return type; +} + CameraNode::CameraNode() -: ShaderNode("camera") +: ShaderNode(node_type) { - add_output("View Vector", SocketType::VECTOR); - add_output("View Z Depth", SocketType::FLOAT); - add_output("View Distance", SocketType::FLOAT); } void CameraNode::compile(SVMCompiler& compiler) @@ -3842,12 +4229,21 @@ void CameraNode::compile(OSLCompiler& compiler) /* Fresnel */ +NODE_DEFINE(FresnelNode) +{ + NodeType* type = NodeType::add("fresnel", create, NodeType::SHADER); + + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); + SOCKET_IN_FLOAT(IOR, "IOR", 1.45f); + + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} + FresnelNode::FresnelNode() -: ShaderNode("fresnel") +: ShaderNode(node_type) { - add_input("Normal", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_input("IOR", SocketType::FLOAT, 1.45f); - add_output("Fac", SocketType::FLOAT); } void FresnelNode::compile(SVMCompiler& compiler) @@ -3858,7 +4254,7 @@ void FresnelNode::compile(SVMCompiler& compiler) compiler.add_node(NODE_FRESNEL, compiler.stack_assign(IOR_in), - __float_as_int(IOR_in->value_float()), + __float_as_int(IOR), compiler.encode_uchar4( compiler.stack_assign_if_linked(normal_in), compiler.stack_assign(fac_out))); @@ -3871,14 +4267,22 @@ void FresnelNode::compile(OSLCompiler& compiler) /* Layer Weight */ -LayerWeightNode::LayerWeightNode() -: ShaderNode("layer_weight") +NODE_DEFINE(LayerWeightNode) { - add_input("Normal", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_input("Blend", SocketType::FLOAT, 0.5f); + NodeType* type = NodeType::add("layer_weight", create, NodeType::SHADER); + + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); + SOCKET_IN_FLOAT(blend, "Blend", 0.5f); - add_output("Fresnel", SocketType::FLOAT); - add_output("Facing", SocketType::FLOAT); + SOCKET_OUT_FLOAT(fresnel, "Fresnel"); + SOCKET_OUT_FLOAT(facing, "Facing"); + + return type; +} + +LayerWeightNode::LayerWeightNode() +: ShaderNode(node_type) +{ } void LayerWeightNode::compile(SVMCompiler& compiler) @@ -3891,7 +4295,7 @@ void LayerWeightNode::compile(SVMCompiler& compiler) if(!fresnel_out->links.empty()) { compiler.add_node(NODE_LAYER_WEIGHT, compiler.stack_assign_if_linked(blend_in), - __float_as_int(blend_in->value_float()), + __float_as_int(blend), compiler.encode_uchar4(NODE_LAYER_WEIGHT_FRESNEL, compiler.stack_assign_if_linked(normal_in), compiler.stack_assign(fresnel_out))); @@ -3900,7 +4304,7 @@ void LayerWeightNode::compile(SVMCompiler& compiler) if(!facing_out->links.empty()) { compiler.add_node(NODE_LAYER_WEIGHT, compiler.stack_assign_if_linked(blend_in), - __float_as_int(blend_in->value_float()), + __float_as_int(blend), compiler.encode_uchar4(NODE_LAYER_WEIGHT_FACING, compiler.stack_assign_if_linked(normal_in), compiler.stack_assign(facing_out))); @@ -3914,13 +4318,20 @@ void LayerWeightNode::compile(OSLCompiler& compiler) /* Wireframe */ +NODE_DEFINE(WireframeNode) +{ + NodeType* type = NodeType::add("wireframe", create, NodeType::SHADER); + + SOCKET_BOOLEAN(use_pixel_size, "Use Pixel Size", false); + SOCKET_IN_FLOAT(size, "Size", 0.01f); + SOCKET_OUT_FLOAT(fac, "Fac"); + + return type; +} + WireframeNode::WireframeNode() -: ShaderNode("wireframe") +: ShaderNode(node_type) { - add_input("Size", SocketType::FLOAT, 0.01f); - add_output("Fac", SocketType::FLOAT); - - use_pixel_size = false; } void WireframeNode::compile(SVMCompiler& compiler) @@ -3953,17 +4364,25 @@ void WireframeNode::compile(OSLCompiler& compiler) else { compiler.parameter("bump_offset", "center"); } - compiler.parameter("use_pixel_size", use_pixel_size); + compiler.parameter(this, "use_pixel_size"); compiler.add(this, "node_wireframe"); } /* Wavelength */ +NODE_DEFINE(WavelengthNode) +{ + NodeType* type = NodeType::add("wavelength", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(wavelength, "Wavelength", 500.0f); + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + WavelengthNode::WavelengthNode() -: ShaderNode("wavelength") +: ShaderNode(node_type) { - add_input("Wavelength", SocketType::FLOAT, 500.0f); - add_output("Color", SocketType::COLOR); } void WavelengthNode::compile(SVMCompiler& compiler) @@ -3983,22 +4402,28 @@ void WavelengthNode::compile(OSLCompiler& compiler) /* Blackbody */ +NODE_DEFINE(BlackbodyNode) +{ + NodeType* type = NodeType::add("blackbody", create, NodeType::SHADER); + + SOCKET_IN_FLOAT(temperature, "Temperature", 1200.0f); + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} + BlackbodyNode::BlackbodyNode() -: ShaderNode("blackbody") +: ShaderNode(node_type) { - add_input("Temperature", SocketType::FLOAT, 1200.0f); - add_output("Color", SocketType::COLOR); } -bool BlackbodyNode::constant_fold(ShaderGraph *, ShaderOutput *socket, ShaderInput *optimized) +bool BlackbodyNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) { ShaderInput *temperature_in = input("Temperature"); - if(socket == output("Color")) { - if(temperature_in->link == NULL) { - optimized->set(svm_math_blackbody_color(temperature_in->value_float())); - return true; - } + if(temperature_in->link == NULL) { + optimized->set(svm_math_blackbody_color(temperature)); + return true; } return false; @@ -4021,15 +4446,22 @@ void BlackbodyNode::compile(OSLCompiler& compiler) /* Output */ +NODE_DEFINE(OutputNode) +{ + NodeType* type = NodeType::add("output", create, NodeType::SHADER); + + SOCKET_IN_CLOSURE(surface, "Surface"); + SOCKET_IN_CLOSURE(volume, "Volume"); + SOCKET_IN_FLOAT(displacement, "Displacement", 0.0f); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f)); + + return type; +} + OutputNode::OutputNode() -: ShaderNode("output") +: ShaderNode(node_type) { special_type = SHADER_SPECIAL_TYPE_OUTPUT; - - add_input("Surface", SocketType::CLOSURE); - add_input("Volume", SocketType::CLOSURE); - add_input("Displacement", SocketType::FLOAT); - add_input("Normal", SocketType::NORMAL); } void OutputNode::compile(SVMCompiler& compiler) @@ -4055,66 +4487,62 @@ void OutputNode::compile(OSLCompiler& compiler) /* Math */ -MathNode::MathNode() -: ShaderNode("math") +NODE_DEFINE(MathNode) { - type = NODE_MATH_ADD; + NodeType* type = NodeType::add("math", create, NodeType::SHADER); - use_clamp = false; + static NodeEnum type_enum; + type_enum.insert("add", NODE_MATH_ADD); + type_enum.insert("subtract", NODE_MATH_SUBTRACT); + type_enum.insert("multiply", NODE_MATH_MULTIPLY); + type_enum.insert("divide", NODE_MATH_DIVIDE); + type_enum.insert("sine", NODE_MATH_SINE); + type_enum.insert("cosine", NODE_MATH_COSINE); + type_enum.insert("tangent", NODE_MATH_TANGENT); + type_enum.insert("arcsine", NODE_MATH_ARCSINE); + type_enum.insert("arccosine", NODE_MATH_ARCCOSINE); + type_enum.insert("arctangent", NODE_MATH_ARCTANGENT); + type_enum.insert("power", NODE_MATH_POWER); + type_enum.insert("logarithm", NODE_MATH_LOGARITHM); + type_enum.insert("minimum", NODE_MATH_MINIMUM); + type_enum.insert("maximum", NODE_MATH_MAXIMUM); + type_enum.insert("round", NODE_MATH_ROUND); + type_enum.insert("less_than", NODE_MATH_LESS_THAN); + type_enum.insert("greater_than", NODE_MATH_GREATER_THAN); + type_enum.insert("modulo", NODE_MATH_MODULO); + type_enum.insert("absolute", NODE_MATH_ABSOLUTE); + SOCKET_ENUM(type, "Type", type_enum, NODE_MATH_ADD); - add_input("Value1", SocketType::FLOAT); - add_input("Value2", SocketType::FLOAT); - add_output("Value", SocketType::FLOAT); -} + SOCKET_BOOLEAN(use_clamp, "Use Clamp", false); -static NodeEnum math_type_init() -{ - NodeEnum enm; + SOCKET_IN_FLOAT(value1, "Value1", 0.0f); + SOCKET_IN_FLOAT(value2, "Value2", 0.0f); - enm.insert("Add", NODE_MATH_ADD); - enm.insert("Subtract", NODE_MATH_SUBTRACT); - enm.insert("Multiply", NODE_MATH_MULTIPLY); - enm.insert("Divide", NODE_MATH_DIVIDE); - enm.insert("Sine", NODE_MATH_SINE); - enm.insert("Cosine", NODE_MATH_COSINE); - enm.insert("Tangent", NODE_MATH_TANGENT); - enm.insert("Arcsine", NODE_MATH_ARCSINE); - enm.insert("Arccosine", NODE_MATH_ARCCOSINE); - enm.insert("Arctangent", NODE_MATH_ARCTANGENT); - enm.insert("Power", NODE_MATH_POWER); - enm.insert("Logarithm", NODE_MATH_LOGARITHM); - enm.insert("Minimum", NODE_MATH_MINIMUM); - enm.insert("Maximum", NODE_MATH_MAXIMUM); - enm.insert("Round", NODE_MATH_ROUND); - enm.insert("Less Than", NODE_MATH_LESS_THAN); - enm.insert("Greater Than", NODE_MATH_GREATER_THAN); - enm.insert("Modulo", NODE_MATH_MODULO); - enm.insert("Absolute", NODE_MATH_ABSOLUTE); + SOCKET_OUT_FLOAT(value, "Value"); - return enm; + return type; } -NodeEnum MathNode::type_enum = math_type_init(); +MathNode::MathNode() +: ShaderNode(node_type) +{ +} -bool MathNode::constant_fold(ShaderGraph *, ShaderOutput *socket, ShaderInput *optimized) +bool MathNode::constant_fold(ShaderGraph *, ShaderOutput *, ShaderInput *optimized) { ShaderInput *value1_in = input("Value1"); ShaderInput *value2_in = input("Value2"); - if(socket == output("Value")) { - if(value1_in->link == NULL && value2_in->link == NULL) { - float value = svm_math(type, - value1_in->value_float(), - value2_in->value_float()); + if(value1_in->link == NULL && value2_in->link == NULL) { + float value = svm_math(type, value1, value2); - if(use_clamp) { - value = saturate(value); - } + if(use_clamp) { + value = saturate(value); + } - optimized->set(value); + optimized->set(value); - return true; - } + return true; } return false; @@ -4137,39 +4565,39 @@ void MathNode::compile(SVMCompiler& compiler) void MathNode::compile(OSLCompiler& compiler) { - compiler.parameter("type", type_enum[type]); - compiler.parameter("use_clamp", use_clamp); + compiler.parameter(this, "type"); + compiler.parameter(this, "use_clamp"); compiler.add(this, "node_math"); } /* VectorMath */ -VectorMathNode::VectorMathNode() -: ShaderNode("vector_math") +NODE_DEFINE(VectorMathNode) { - type = NODE_VECTOR_MATH_ADD; + NodeType* type = NodeType::add("vector_math", create, NodeType::SHADER); - add_input("Vector1", SocketType::VECTOR); - add_input("Vector2", SocketType::VECTOR); - add_output("Value", SocketType::FLOAT); - add_output("Vector", SocketType::VECTOR); -} + static NodeEnum type_enum; + type_enum.insert("add", NODE_VECTOR_MATH_ADD); + type_enum.insert("subtract", NODE_VECTOR_MATH_SUBTRACT); + type_enum.insert("average", NODE_VECTOR_MATH_AVERAGE); + type_enum.insert("dot_product", NODE_VECTOR_MATH_DOT_PRODUCT); + type_enum.insert("cross_product", NODE_VECTOR_MATH_CROSS_PRODUCT); + type_enum.insert("normalize", NODE_VECTOR_MATH_NORMALIZE); + SOCKET_ENUM(type, "Type", type_enum, NODE_VECTOR_MATH_ADD); -static NodeEnum vector_math_type_init() -{ - NodeEnum enm; + SOCKET_IN_VECTOR(vector1, "Vector1", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_IN_VECTOR(vector2, "Vector2", make_float3(0.0f, 0.0f, 0.0f)); - enm.insert("Add", NODE_VECTOR_MATH_ADD); - enm.insert("Subtract", NODE_VECTOR_MATH_SUBTRACT); - enm.insert("Average", NODE_VECTOR_MATH_AVERAGE); - enm.insert("Dot Product", NODE_VECTOR_MATH_DOT_PRODUCT); - enm.insert("Cross Product", NODE_VECTOR_MATH_CROSS_PRODUCT); - enm.insert("Normalize", NODE_VECTOR_MATH_NORMALIZE); + SOCKET_OUT_FLOAT(value, "Value"); + SOCKET_OUT_VECTOR(vector, "Vector"); - return enm; + return type; } -NodeEnum VectorMathNode::type_enum = vector_math_type_init(); +VectorMathNode::VectorMathNode() +: ShaderNode(node_type) +{ +} bool VectorMathNode::constant_fold(ShaderGraph *, ShaderOutput *socket, ShaderInput *optimized) { @@ -4183,8 +4611,8 @@ bool VectorMathNode::constant_fold(ShaderGraph *, ShaderOutput *socket, ShaderIn svm_vector_math(&value, &vector, type, - vector1_in->value(), - vector2_in->value()); + vector1, + vector2); if(socket == output("Value")) { optimized->set(value); @@ -4217,48 +4645,40 @@ void VectorMathNode::compile(SVMCompiler& compiler) void VectorMathNode::compile(OSLCompiler& compiler) { - compiler.parameter("type", type_enum[type]); + compiler.parameter(this, "type"); compiler.add(this, "node_vector_math"); } /* VectorTransform */ -VectorTransformNode::VectorTransformNode() -: ShaderNode("vector_transform") +NODE_DEFINE(VectorTransformNode) { - type = NODE_VECTOR_TRANSFORM_TYPE_VECTOR; - convert_from = NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD; - convert_to = NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT; + NodeType* type = NodeType::add("vector_transform", create, NodeType::SHADER); - add_input("Vector", SocketType::VECTOR); - add_output("Vector", SocketType::VECTOR); -} + static NodeEnum type_enum; + type_enum.insert("vector", NODE_VECTOR_TRANSFORM_TYPE_VECTOR); + type_enum.insert("point", NODE_VECTOR_TRANSFORM_TYPE_POINT); + type_enum.insert("normal", NODE_VECTOR_TRANSFORM_TYPE_NORMAL); + SOCKET_ENUM(type, "Type", type_enum, NODE_VECTOR_TRANSFORM_TYPE_VECTOR); -static NodeEnum vector_transform_type_init() -{ - NodeEnum enm; + static NodeEnum space_enum; + space_enum.insert("world", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD); + space_enum.insert("object", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT); + space_enum.insert("camera", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA); + SOCKET_ENUM(convert_from, "Convert From", space_enum, NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD); + SOCKET_ENUM(convert_to, "Convert To", space_enum, NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT); - enm.insert("Vector", NODE_VECTOR_TRANSFORM_TYPE_VECTOR); - enm.insert("Point", NODE_VECTOR_TRANSFORM_TYPE_POINT); - enm.insert("Normal", NODE_VECTOR_TRANSFORM_TYPE_NORMAL); + SOCKET_IN_VECTOR(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_OUT_VECTOR(vector, "Vector"); - return enm; + return type; } -static NodeEnum vector_transform_convert_space_init() +VectorTransformNode::VectorTransformNode() +: ShaderNode(node_type) { - NodeEnum enm; - - enm.insert("world", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_WORLD); - enm.insert("object", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_OBJECT); - enm.insert("camera", NODE_VECTOR_TRANSFORM_CONVERT_SPACE_CAMERA); - - return enm; } -NodeEnum VectorTransformNode::type_enum = vector_transform_type_init(); -NodeEnum VectorTransformNode::convert_space_enum = vector_transform_convert_space_init(); - void VectorTransformNode::compile(SVMCompiler& compiler) { ShaderInput *vector_in = input("Vector"); @@ -4272,33 +4692,40 @@ void VectorTransformNode::compile(SVMCompiler& compiler) void VectorTransformNode::compile(OSLCompiler& compiler) { - compiler.parameter("type", type_enum[type]); - compiler.parameter("convert_from", convert_space_enum[convert_from]); - compiler.parameter("convert_to", convert_space_enum[convert_to]); + compiler.parameter(this, "type"); + compiler.parameter(this, "convert_from"); + compiler.parameter(this, "convert_to"); compiler.add(this, "node_vector_transform"); } /* BumpNode */ -BumpNode::BumpNode() -: ShaderNode("bump") +NODE_DEFINE(BumpNode) { - invert = false; + NodeType* type = NodeType::add("bump", create, NodeType::SHADER); - special_type = SHADER_SPECIAL_TYPE_BUMP; + SOCKET_BOOLEAN(invert, "Invert", false); /* this input is used by the user, but after graph transform it is no longer * used and moved to sampler center/x/y instead */ - add_input("Height", SocketType::FLOAT); + SOCKET_IN_FLOAT(height, "Height", 1.0f); + + SOCKET_IN_FLOAT(sample_center, "SampleCenter", 0.0f); + SOCKET_IN_FLOAT(sample_x, "SampleX", 0.0f); + SOCKET_IN_FLOAT(sample_y, "SampleY", 0.0f); + SOCKET_IN_NORMAL(normal, "Normal", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); + SOCKET_IN_FLOAT(strength, "Strength", 1.0f); + SOCKET_IN_FLOAT(distance, "Distance", 0.1f); - add_input("SampleCenter", SocketType::FLOAT); - add_input("SampleX", SocketType::FLOAT); - add_input("SampleY", SocketType::FLOAT); - add_input("Normal", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL); - add_input("Strength", SocketType::FLOAT, 1.0f); - add_input("Distance", SocketType::FLOAT, 0.1f); + SOCKET_OUT_NORMAL(normal, "Normal"); + + return type; +} - add_output("Normal", SocketType::NORMAL); +BumpNode::BumpNode() +: ShaderNode(node_type) +{ + special_type = SHADER_SPECIAL_TYPE_BUMP; } void BumpNode::compile(SVMCompiler& compiler) @@ -4327,7 +4754,7 @@ void BumpNode::compile(SVMCompiler& compiler) void BumpNode::compile(OSLCompiler& compiler) { - compiler.parameter("invert", invert); + compiler.parameter(this, "invert"); compiler.add(this, "node_bump"); } @@ -4355,15 +4782,25 @@ bool BumpNode::constant_fold(ShaderGraph *graph, ShaderOutput *, ShaderInput *) /* RGBCurvesNode */ -RGBCurvesNode::RGBCurvesNode() -: ShaderNode("rgb_curves") +NODE_DEFINE(RGBCurvesNode) { - add_input("Fac", SocketType::FLOAT); - add_input("Color", SocketType::COLOR); - add_output("Color", SocketType::COLOR); + NodeType* type = NodeType::add("rgb_curves", create, NodeType::SHADER); + + SOCKET_COLOR_ARRAY(curves, "Curves", array<float3>()); + SOCKET_FLOAT(min_x, "Min X", 0.0f); + SOCKET_FLOAT(max_x, "Max X", 1.0f); + + SOCKET_IN_FLOAT(fac, "Fac", 0.0f); + SOCKET_IN_COLOR(color, "Color", make_float3(0.0f, 0.0f, 0.0f)); + + SOCKET_OUT_COLOR(color, "Color"); + + return type; +} - min_x = 0.0f; - max_x = 1.0f; +RGBCurvesNode::RGBCurvesNode() +: ShaderNode(node_type) +{ } void RGBCurvesNode::compile(SVMCompiler& compiler) @@ -4393,22 +4830,32 @@ void RGBCurvesNode::compile(OSLCompiler& compiler) return; compiler.parameter_color_array("ramp", curves); - compiler.parameter("min_x", min_x); - compiler.parameter("max_x", max_x); + compiler.parameter(this, "min_x"); + compiler.parameter(this, "max_x"); compiler.add(this, "node_rgb_curves"); } /* VectorCurvesNode */ -VectorCurvesNode::VectorCurvesNode() -: ShaderNode("vector_curves") +NODE_DEFINE(VectorCurvesNode) { - add_input("Fac", SocketType::FLOAT); - add_input("Vector", SocketType::VECTOR); - add_output("Vector", SocketType::VECTOR); + NodeType* type = NodeType::add("vector_curves", create, NodeType::SHADER); + + SOCKET_VECTOR_ARRAY(curves, "Curves", array<float3>()); + SOCKET_FLOAT(min_x, "Min X", 0.0f); + SOCKET_FLOAT(max_x, "Max X", 1.0f); + + SOCKET_IN_FLOAT(fac, "Fac", 0.0f); + SOCKET_IN_VECTOR(vector, "Vector", make_float3(0.0f, 0.0f, 0.0f)); - min_x = 0.0f; - max_x = 1.0f; + SOCKET_OUT_VECTOR(vector, "Vector"); + + return type; +} + +VectorCurvesNode::VectorCurvesNode() +: ShaderNode(node_type) +{ } void VectorCurvesNode::compile(SVMCompiler& compiler) @@ -4438,21 +4885,32 @@ void VectorCurvesNode::compile(OSLCompiler& compiler) return; compiler.parameter_color_array("ramp", curves); - compiler.parameter("min_x", min_x); - compiler.parameter("max_x", max_x); + compiler.parameter(this, "min_x"); + compiler.parameter(this, "max_x"); compiler.add(this, "node_vector_curves"); } /* RGBRampNode */ -RGBRampNode::RGBRampNode() -: ShaderNode("rgb_ramp") +NODE_DEFINE(RGBRampNode) { - add_input("Fac", SocketType::FLOAT); - add_output("Color", SocketType::COLOR); - add_output("Alpha", SocketType::FLOAT); + NodeType* type = NodeType::add("rgb_ramp", create, NodeType::SHADER); + + SOCKET_COLOR_ARRAY(ramp, "Ramp", array<float3>()); + SOCKET_FLOAT_ARRAY(ramp_alpha, "Ramp Alpha", array<float>()); + SOCKET_BOOLEAN(interpolate, "Interpolate", true); + + SOCKET_IN_FLOAT(fac, "Fac", 0.0f); + + SOCKET_OUT_COLOR(color, "Color"); + SOCKET_OUT_FLOAT(alpha, "Alpha"); - interpolate = true; + return type; +} + +RGBRampNode::RGBRampNode() +: ShaderNode(node_type) +{ } void RGBRampNode::compile(SVMCompiler& compiler) @@ -4483,18 +4941,26 @@ void RGBRampNode::compile(OSLCompiler& compiler) compiler.parameter_color_array("ramp_color", ramp); compiler.parameter_array("ramp_alpha", ramp_alpha.data(), ramp_alpha.size()); - compiler.parameter("interpolate", interpolate); + compiler.parameter(this, "interpolate"); compiler.add(this, "node_rgb_ramp"); } /* Set Normal Node */ +NODE_DEFINE(SetNormalNode) +{ + NodeType* type = NodeType::add("set_normal", create, NodeType::SHADER); + + SOCKET_IN_VECTOR(direction, "Direction", make_float3(0.0f, 0.0f, 0.0f)); + SOCKET_OUT_NORMAL(normal, "Normal"); + + return type; +} + SetNormalNode::SetNormalNode() -: ShaderNode("set_normal") +: ShaderNode(node_type) { - add_input("Direction", SocketType::VECTOR); - add_output("Normal", SocketType::NORMAL); } void SetNormalNode::compile(SVMCompiler& compiler) @@ -4515,18 +4981,47 @@ void SetNormalNode::compile(OSLCompiler& compiler) /* OSLNode */ OSLNode::OSLNode() -: ShaderNode("osl_shader") +: ShaderNode(new NodeType(NodeType::SHADER)) { special_type = SHADER_SPECIAL_TYPE_SCRIPT; } OSLNode::~OSLNode() { + delete type; +} + +OSLNode* OSLNode::create(size_t num_inputs) +{ + /* allocate space for the node itself and parameters, aligned to 16 bytes + * assuming that's the most parameter types need */ + size_t node_size = align_up(sizeof(OSLNode), 16); + size_t inputs_size = align_up(SocketType::max_size(), 16) * num_inputs; + + char *node_memory = (char*) operator new(node_size + inputs_size); + memset(node_memory, 0, node_size + inputs_size); + + return new(node_memory) OSLNode(); +} + +char* OSLNode::input_default_value() +{ + /* pointer to default value storage, which is the same as our actual value */ + size_t num_inputs = type->inputs.size(); + size_t inputs_size = align_up(SocketType::max_size(), 16) * num_inputs; + return (char*)this + align_up(sizeof(OSLNode), 16) + inputs_size; } -OSLNode* OSLNode::create(size_t) +void OSLNode::add_input(ustring name, SocketType::Type socket_type) { - return new OSLNode(); + char *memory = input_default_value(); + size_t offset = memory - (char*)this; + const_cast<NodeType*>(type)->register_input(name, name, socket_type, offset, memory, NULL, NULL, SocketType::LINKABLE); +} + +void OSLNode::add_output(ustring name, SocketType::Type socket_type) +{ + const_cast<NodeType*>(type)->register_output(name, name, socket_type); } void OSLNode::compile(SVMCompiler&) @@ -4544,32 +5039,32 @@ void OSLNode::compile(OSLCompiler& compiler) /* Normal Map */ -static NodeEnum normal_map_space_init() +NODE_DEFINE(NormalMapNode) { - NodeEnum enm; + NodeType* type = NodeType::add("normal_map", create, NodeType::SHADER); - enm.insert("Tangent", NODE_NORMAL_MAP_TANGENT); - enm.insert("Object", NODE_NORMAL_MAP_OBJECT); - enm.insert("World", NODE_NORMAL_MAP_WORLD); - enm.insert("Blender Object", NODE_NORMAL_MAP_BLENDER_OBJECT); - enm.insert("Blender World", NODE_NORMAL_MAP_BLENDER_WORLD); + static NodeEnum space_enum; + space_enum.insert("tangent", NODE_NORMAL_MAP_TANGENT); + space_enum.insert("object", NODE_NORMAL_MAP_OBJECT); + space_enum.insert("world", NODE_NORMAL_MAP_WORLD); + space_enum.insert("blender_object", NODE_NORMAL_MAP_BLENDER_OBJECT); + space_enum.insert("blender_world", NODE_NORMAL_MAP_BLENDER_WORLD); + SOCKET_ENUM(space, "Space", space_enum, NODE_TANGENT_RADIAL); - return enm; -} + SOCKET_STRING(attribute, "Attribute", ustring("")); -NodeEnum NormalMapNode::space_enum = normal_map_space_init(); + SOCKET_IN_NORMAL(normal_osl, "NormalIn", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); + SOCKET_IN_FLOAT(strength, "Strength", 1.0f); + SOCKET_IN_COLOR(color, "Color", make_float3(0.5f, 0.5f, 1.0f)); -NormalMapNode::NormalMapNode() -: ShaderNode("normal_map") -{ - space = NODE_NORMAL_MAP_TANGENT; - attribute = ustring(""); + SOCKET_OUT_NORMAL(normal, "Normal"); - add_input("NormalIn", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_input("Strength", SocketType::FLOAT, 1.0f); - add_input("Color", SocketType::COLOR); + return type; +} - add_output("Normal", SocketType::NORMAL); +NormalMapNode::NormalMapNode() +: ShaderNode(node_type) +{ } void NormalMapNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -4630,46 +5125,38 @@ void NormalMapNode::compile(OSLCompiler& compiler) } } - compiler.parameter("space", space_enum[space]); - + compiler.parameter(this, "space"); compiler.add(this, "node_normal_map"); } /* Tangent */ -static NodeEnum tangent_direction_type_init() +NODE_DEFINE(TangentNode) { - NodeEnum enm; + NodeType* type = NodeType::add("tangent", create, NodeType::SHADER); - enm.insert("Radial", NODE_TANGENT_RADIAL); - enm.insert("UV Map", NODE_TANGENT_UVMAP); + static NodeEnum direction_type_enum; + direction_type_enum.insert("radial", NODE_TANGENT_RADIAL); + direction_type_enum.insert("uv_map", NODE_TANGENT_UVMAP); + SOCKET_ENUM(direction_type, "Direction Type", direction_type_enum, NODE_TANGENT_RADIAL); - return enm; -} + static NodeEnum axis_enum; + axis_enum.insert("x", NODE_TANGENT_AXIS_X); + axis_enum.insert("y", NODE_TANGENT_AXIS_Y); + axis_enum.insert("z", NODE_TANGENT_AXIS_Z); + SOCKET_ENUM(axis, "Axis", axis_enum, NODE_TANGENT_AXIS_X); -static NodeEnum tangent_axis_init() -{ - NodeEnum enm; + SOCKET_STRING(attribute, "Attribute", ustring("")); - enm.insert("X", NODE_TANGENT_AXIS_X); - enm.insert("Y", NODE_TANGENT_AXIS_Y); - enm.insert("Z", NODE_TANGENT_AXIS_Z); + SOCKET_IN_NORMAL(normal_osl, "NormalIn", make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); + SOCKET_OUT_NORMAL(tangent, "Tangent"); - return enm; + return type; } -NodeEnum TangentNode::direction_type_enum = tangent_direction_type_init(); -NodeEnum TangentNode::axis_enum = tangent_axis_init(); - TangentNode::TangentNode() -: ShaderNode("tangent") +: ShaderNode(node_type) { - direction_type = NODE_TANGENT_RADIAL; - axis = NODE_TANGENT_AXIS_X; - attribute = ustring(""); - - add_input("NormalIn", SocketType::NORMAL, make_float3(0.0f, 0.0f, 0.0f), SocketType::LINK_NORMAL | SocketType::OSL_INTERNAL); - add_output("Tangent", SocketType::NORMAL); } void TangentNode::attributes(Shader *shader, AttributeRequestSet *attributes) @@ -4718,8 +5205,8 @@ void TangentNode::compile(OSLCompiler& compiler) compiler.parameter("attr_name", ustring((string(attribute.c_str()) + ".tangent").c_str())); } - compiler.parameter("direction_type", direction_type_enum[direction_type]); - compiler.parameter("axis", axis_enum[axis]); + compiler.parameter(this, "direction_type"); + compiler.parameter(this, "axis"); compiler.add(this, "node_tangent"); } diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h index 8b17e455f7a..41894dce86a 100644 --- a/intern/cycles/render/nodes.h +++ b/intern/cycles/render/nodes.h @@ -18,6 +18,7 @@ #define __NODES_H__ #include "graph.h" +#include "node.h" #include "util_string.h" @@ -35,6 +36,7 @@ public: Transform compute_transform(); bool skip(); void compile(SVMCompiler& compiler, int offset_in, int offset_out); + int compile(SVMCompiler& compiler, ShaderInput *vector_in); void compile(OSLCompiler &compiler); int compile_begin(SVMCompiler& compiler, ShaderInput *vector_in); @@ -49,48 +51,26 @@ public: enum Type { POINT = 0, TEXTURE = 1, VECTOR = 2, NORMAL = 3 }; Type type; - static NodeEnum type_enum; enum Mapping { NONE = 0, X = 1, Y = 2, Z = 3 }; Mapping x_mapping, y_mapping, z_mapping; - static NodeEnum mapping_enum; enum Projection { FLAT, CUBE, TUBE, SPHERE }; Projection projection; - static NodeEnum projection_enum; - - bool equals(const TextureMapping& other) { - return translation == other.translation && - rotation == other.rotation && - scale == other.scale && - use_minmax == other.use_minmax && - min == other.min && - max == other.max && - type == other.type && - x_mapping == other.x_mapping && - y_mapping == other.y_mapping && - z_mapping == other.z_mapping && - projection == other.projection; - } }; /* Nodes */ class TextureNode : public ShaderNode { public: - explicit TextureNode(const char *name_) : ShaderNode(name_) {} + explicit TextureNode(const NodeType *node_type) : ShaderNode(node_type) {} TextureMapping tex_mapping; - - virtual bool equals(const ShaderNode *other) { - return ShaderNode::equals(other) && - tex_mapping.equals(((const TextureNode*)other)->tex_mapping); - } }; /* Any node which uses image manager's slot should be a subclass of this one. */ class ImageSlotTextureNode : public TextureNode { public: - explicit ImageSlotTextureNode(const char *name_) : TextureNode(name_) { + explicit ImageSlotTextureNode(const NodeType *node_type) : TextureNode(node_type) { special_type = SHADER_SPECIAL_TYPE_IMAGE_SLOT; } int slot; @@ -107,7 +87,7 @@ public: int is_float; bool is_linear; bool use_alpha; - string filename; + ustring filename; void *builtin_data; NodeImageColorSpace color_space; NodeImageProjection projection; @@ -115,22 +95,14 @@ public: ExtensionType extension; float projection_blend; bool animated; + float3 vector; - static NodeEnum color_space_enum; - static NodeEnum projection_enum; - - virtual bool equals(const ShaderNode *other) { - const ImageTextureNode *image_node = (const ImageTextureNode*)other; + virtual bool equals(const ShaderNode& other) + { + const ImageTextureNode& image_node = (const ImageTextureNode&)other; return ImageSlotTextureNode::equals(other) && - use_alpha == image_node->use_alpha && - filename == image_node->filename && - builtin_data == image_node->builtin_data && - color_space == image_node->color_space && - projection == image_node->projection && - interpolation == image_node->interpolation && - extension == image_node->extension && - projection_blend == image_node->projection_blend && - animated == image_node->animated; + builtin_data == image_node.builtin_data && + animated == image_node.animated; } }; @@ -146,26 +118,20 @@ public: int is_float; bool is_linear; bool use_alpha; - string filename; + ustring filename; void *builtin_data; NodeImageColorSpace color_space; NodeEnvironmentProjection projection; InterpolationType interpolation; bool animated; + float3 vector; - static NodeEnum color_space_enum; - static NodeEnum projection_enum; - - virtual bool equals(const ShaderNode *other) { - const EnvironmentTextureNode *env_node = (const EnvironmentTextureNode*)other; + virtual bool equals(const ShaderNode& other) + { + const EnvironmentTextureNode& env_node = (const EnvironmentTextureNode&)other; return ImageSlotTextureNode::equals(other) && - use_alpha == env_node->use_alpha && - filename == env_node->filename && - builtin_data == env_node->builtin_data && - color_space == env_node->color_space && - projection == env_node->projection && - interpolation == env_node->interpolation && - animated == env_node->animated; + builtin_data == env_node.builtin_data && + animated == env_node.animated; } }; @@ -179,25 +145,20 @@ public: float3 sun_direction; float turbidity; float ground_albedo; - - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) { - const SkyTextureNode *sky_node = (const SkyTextureNode*)other; - return TextureNode::equals(other) && - sun_direction == sky_node->sun_direction && - turbidity == sky_node->turbidity && - ground_albedo == sky_node->ground_albedo && - type == sky_node->type; - } + float3 vector; }; class OutputNode : public ShaderNode { public: SHADER_NODE_CLASS(OutputNode) + void* surface; + void* volume; + float displacement; + float3 normal; + /* Don't allow output node de-duplication. */ - virtual bool equals(const ShaderNode * /*other*/) { return false; } + virtual bool equals(const ShaderNode& /*other*/) { return false; } }; class GradientTextureNode : public TextureNode { @@ -207,18 +168,15 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } NodeGradientType type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) { - const GradientTextureNode *gradient_node = (const GradientTextureNode*)other; - return TextureNode::equals(other) && - type == gradient_node->type; - } + float3 vector; }; class NoiseTextureNode : public TextureNode { public: SHADER_NODE_CLASS(NoiseTextureNode) + + float scale, detail, distortion; + float3 vector; }; class VoronoiTextureNode : public TextureNode { @@ -228,13 +186,8 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } NodeVoronoiColoring coloring; - static NodeEnum coloring_enum; - - virtual bool equals(const ShaderNode *other) { - const VoronoiTextureNode *voronoi_node = (const VoronoiTextureNode*)other; - return TextureNode::equals(other) && - coloring == voronoi_node->coloring; - } + float scale; + float3 vector; }; class MusgraveTextureNode : public TextureNode { @@ -244,13 +197,8 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } NodeMusgraveType type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) { - const MusgraveTextureNode *musgrave_node = (const MusgraveTextureNode*)other; - return TextureNode::equals(other) && - type == musgrave_node->type; - } + float scale, detail, dimension, lacunarity, offset, gain; + float3 vector; }; class WaveTextureNode : public TextureNode { @@ -261,15 +209,9 @@ public: NodeWaveType type; NodeWaveProfile profile; - static NodeEnum type_enum; - static NodeEnum profile_enum; - - virtual bool equals(const ShaderNode *other) { - const WaveTextureNode *wave_node = (const WaveTextureNode*)other; - return TextureNode::equals(other) && - type == wave_node->type && - profile == wave_node->profile; - } + + float scale, distortion, detail, detail_scale; + float3 vector; }; class MagicTextureNode : public TextureNode { @@ -279,18 +221,17 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } int depth; - - virtual bool equals(const ShaderNode *other) { - const MagicTextureNode *magic_node = (const MagicTextureNode*)other; - return TextureNode::equals(other) && - depth == magic_node->depth; - } + float3 vector; + float scale, distortion; }; class CheckerTextureNode : public TextureNode { public: SHADER_NODE_CLASS(CheckerTextureNode) + float3 vector, color1, color2; + float scale; + virtual int get_group() { return NODE_GROUP_LEVEL_2; } }; @@ -301,16 +242,11 @@ public: float offset, squash; int offset_frequency, squash_frequency; - virtual int get_group() { return NODE_GROUP_LEVEL_2; } + float3 color1, color2, mortar; + float scale, mortar_size, bias, brick_width, row_height; + float3 vector; - virtual bool equals(const ShaderNode *other) { - const BrickTextureNode *brick_node = (const BrickTextureNode*)other; - return TextureNode::equals(other) && - offset == brick_node->offset && - squash == brick_node->squash && - offset_frequency == brick_node->offset_frequency && - squash_frequency == brick_node->squash_frequency; - } + virtual int get_group() { return NODE_GROUP_LEVEL_2; } }; class PointDensityTextureNode : public ShaderNode { @@ -324,25 +260,20 @@ public: bool has_spatial_varying() { return true; } bool has_object_dependency() { return true; } - ImageManager *image_manager; - int slot; - string filename; + ustring filename; NodeTexVoxelSpace space; - void *builtin_data; InterpolationType interpolation; - Transform tfm; + float3 vector; - static NodeEnum space_enum; + ImageManager *image_manager; + int slot; + void *builtin_data; - virtual bool equals(const ShaderNode *other) { - const PointDensityTextureNode *point_dendity_node = (const PointDensityTextureNode*)other; + virtual bool equals(const ShaderNode& other) { + const PointDensityTextureNode& point_dendity_node = (const PointDensityTextureNode&)other; return ShaderNode::equals(other) && - filename == point_dendity_node->filename && - space == point_dendity_node->space && - builtin_data == point_dendity_node->builtin_data && - interpolation == point_dendity_node->interpolation && - tfm == point_dendity_node->tfm; + builtin_data == point_dendity_node.builtin_data; } }; @@ -351,20 +282,16 @@ public: SHADER_NODE_CLASS(MappingNode) virtual int get_group() { return NODE_GROUP_LEVEL_2; } + float3 vector; TextureMapping tex_mapping; - - virtual bool equals(const ShaderNode *other) { - const MappingNode *mapping_node = (const MappingNode*)other; - return ShaderNode::equals(other) && - tex_mapping.equals(mapping_node->tex_mapping); - } }; class RGBToBWNode : public ShaderNode { public: SHADER_NODE_CLASS(RGBToBWNode) - bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); + + float3 color; }; class ConvertNode : public ShaderNode { @@ -376,28 +303,39 @@ public: SocketType::Type from, to; - virtual bool equals(const ShaderNode *other) - { - const ConvertNode *convert_node = (const ConvertNode*)other; - return ShaderNode::equals(other) && - from == convert_node->from && - to == convert_node->to; - } + union { + float value_float; + int value_int; + float3 value_color; + float3 value_vector; + float3 value_point; + float3 value_normal; + }; + ustring value_string; + +private: + static const int MAX_TYPE = 12; + static bool register_types(); + static Node* create(const NodeType *type); + static const NodeType *node_types[MAX_TYPE][MAX_TYPE]; + static bool initialized; }; class BsdfNode : public ShaderNode { public: - explicit BsdfNode(bool scattering = false); + explicit BsdfNode(const NodeType *node_type); SHADER_NODE_BASE_CLASS(BsdfNode); bool has_spatial_varying() { return true; } void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2, ShaderInput *param3 = NULL, ShaderInput *param4 = NULL); virtual ClosureType get_closure_type() { return closure; } + float3 color; + float3 normal; + float surface_mix_weight; ClosureType closure; - bool scattering; - virtual bool equals(const ShaderNode * /*other*/) + virtual bool equals(const ShaderNode& /*other*/) { /* TODO(sergey): With some care BSDF nodes can be de-duplicated. */ return false; @@ -408,8 +346,9 @@ class AnisotropicBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(AnisotropicBsdfNode) + float3 tangent; + float roughness, anisotropy, rotation; ClosureType distribution; - static NodeEnum distribution_enum; void attributes(Shader *shader, AttributeRequestSet *attributes); }; @@ -417,6 +356,8 @@ public: class DiffuseBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(DiffuseBsdfNode) + + float roughness; }; class TranslucentBsdfNode : public BsdfNode { @@ -434,6 +375,8 @@ public: class VelvetBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(VelvetBsdfNode) + + float sigma; }; class GlossyBsdfNode : public BsdfNode { @@ -443,8 +386,8 @@ public: void simplify_settings(Scene *scene); bool has_integrator_dependency(); + float roughness; ClosureType distribution, distribution_orig; - static NodeEnum distribution_enum; }; class GlassBsdfNode : public BsdfNode { @@ -454,8 +397,8 @@ public: void simplify_settings(Scene *scene); bool has_integrator_dependency(); + float roughness, IOR; ClosureType distribution, distribution_orig; - static NodeEnum distribution_enum; }; class RefractionBsdfNode : public BsdfNode { @@ -465,16 +408,16 @@ public: void simplify_settings(Scene *scene); bool has_integrator_dependency(); + float roughness, IOR; ClosureType distribution, distribution_orig; - static NodeEnum distribution_enum; }; class ToonBsdfNode : public BsdfNode { public: SHADER_NODE_CLASS(ToonBsdfNode) + float smooth, size; ClosureType component; - static NodeEnum component_enum; }; class SubsurfaceScatteringNode : public BsdfNode { @@ -483,8 +426,11 @@ public: bool has_surface_bssrdf() { return true; } bool has_bssrdf_bump(); + float scale; + float3 radius; + float sharpness; + float texture_blur; ClosureType falloff; - static NodeEnum falloff_enum; }; class EmissionNode : public ShaderNode { @@ -494,6 +440,10 @@ public: virtual ClosureType get_closure_type() { return CLOSURE_EMISSION_ID; } bool has_surface_emission() { return true; } + + float3 color; + float strength; + float surface_mix_weight; }; class BackgroundNode : public ShaderNode { @@ -501,6 +451,10 @@ public: SHADER_NODE_CLASS(BackgroundNode) bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); virtual ClosureType get_closure_type() { return CLOSURE_BACKGROUND_ID; } + + float3 color; + float strength; + float surface_mix_weight; }; class HoldoutNode : public ShaderNode { @@ -508,6 +462,9 @@ public: SHADER_NODE_CLASS(HoldoutNode) virtual int get_group() { return NODE_GROUP_LEVEL_1; } virtual ClosureType get_closure_type() { return CLOSURE_HOLDOUT_ID; } + + float surface_mix_weight; + float volume_mix_weight; }; class AmbientOcclusionNode : public ShaderNode { @@ -517,11 +474,16 @@ public: bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_1; } virtual ClosureType get_closure_type() { return CLOSURE_AMBIENT_OCCLUSION_ID; } + + float3 normal_osl; + float3 color; + float surface_mix_weight; }; class VolumeNode : public ShaderNode { public: - SHADER_NODE_CLASS(VolumeNode) + VolumeNode(const NodeType *node_type); + SHADER_NODE_BASE_CLASS(VolumeNode) void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2); virtual int get_group() { return NODE_GROUP_LEVEL_1; } @@ -530,9 +492,12 @@ public: } virtual ClosureType get_closure_type() { return closure; } + float3 color; + float density; + float volume_mix_weight; ClosureType closure; - virtual bool equals(const ShaderNode * /*other*/) + virtual bool equals(const ShaderNode& /*other*/) { /* TODO(sergey): With some care Volume nodes can be de-duplicated. */ return false; @@ -547,6 +512,8 @@ public: class ScatterVolumeNode : public VolumeNode { public: SHADER_NODE_CLASS(ScatterVolumeNode) + + float anisotropy; }; class HairBsdfNode : public BsdfNode { @@ -554,8 +521,10 @@ public: SHADER_NODE_CLASS(HairBsdfNode) ClosureType component; - static NodeEnum component_enum; - + float offset; + float roughness_u; + float roughness_v; + float3 tangent; }; class GeometryNode : public ShaderNode { @@ -563,6 +532,8 @@ public: SHADER_NODE_CLASS(GeometryNode) void attributes(Shader *shader, AttributeRequestSet *attributes); bool has_spatial_varying() { return true; } + + float3 normal_osl; }; class TextureCoordinateNode : public ShaderNode { @@ -572,17 +543,10 @@ public: bool has_spatial_varying() { return true; } bool has_object_dependency() { return use_transform; } + float3 normal_osl; bool from_dupli; bool use_transform; Transform ob_tfm; - - virtual bool equals(const ShaderNode *other) { - const TextureCoordinateNode *texco_node = (const TextureCoordinateNode*)other; - return ShaderNode::equals(other) && - from_dupli == texco_node->from_dupli && - use_transform == texco_node->use_transform && - ob_tfm == texco_node->ob_tfm; - } }; class UVMapNode : public ShaderNode { @@ -594,13 +558,6 @@ public: ustring attribute; bool from_dupli; - - virtual bool equals(const ShaderNode *other) { - const UVMapNode *uv_map_node = (const UVMapNode*)other; - return ShaderNode::equals(other) && - attribute == uv_map_node->attribute && - from_dupli == uv_map_node->from_dupli; - } }; class LightPathNode : public ShaderNode { @@ -614,6 +571,9 @@ public: SHADER_NODE_CLASS(LightFalloffNode) bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_2; } + + float strength; + float smooth; }; class ObjectInfoNode : public ShaderNode { @@ -648,12 +608,6 @@ public: bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); float value; - - virtual bool equals(const ShaderNode *other) { - const ValueNode *value_node = (const ValueNode*)other; - return ShaderNode::equals(other) && - value == value_node->value; - } }; class ColorNode : public ShaderNode { @@ -663,12 +617,6 @@ public: bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); float3 value; - - virtual bool equals(const ShaderNode *other) { - const ColorNode *color_node = (const ColorNode*)other; - return ShaderNode::equals(other) && - value == color_node->value; - } }; class AddClosureNode : public ShaderNode { @@ -680,11 +628,16 @@ class MixClosureNode : public ShaderNode { public: SHADER_NODE_CLASS(MixClosureNode) bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); + + float fac; }; class MixClosureWeightNode : public ShaderNode { public: SHADER_NODE_CLASS(MixClosureWeightNode); + + float weight; + float fac; }; class InvertNode : public ShaderNode { @@ -692,6 +645,9 @@ public: SHADER_NODE_CLASS(InvertNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float fac; + float3 color; }; class MixNode : public ShaderNode { @@ -701,80 +657,90 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_3; } - bool use_clamp; - NodeMix type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) - { - const MixNode *mix_node = (const MixNode*)other; - return ShaderNode::equals(other) && - use_clamp == mix_node->use_clamp && - type == mix_node->type; - } + bool use_clamp; + float3 color1; + float3 color2; + float fac; }; class CombineRGBNode : public ShaderNode { public: SHADER_NODE_CLASS(CombineRGBNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float r, g, b; }; class CombineHSVNode : public ShaderNode { public: SHADER_NODE_CLASS(CombineHSVNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float h, s, v; }; class CombineXYZNode : public ShaderNode { public: SHADER_NODE_CLASS(CombineXYZNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float x, y, z; }; class GammaNode : public ShaderNode { public: SHADER_NODE_CLASS(GammaNode) - bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); - virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 color; + float gamma; }; class BrightContrastNode : public ShaderNode { public: SHADER_NODE_CLASS(BrightContrastNode) virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 color; + float bright; + float contrast; }; class SeparateRGBNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateRGBNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float3 color; }; class SeparateHSVNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateHSVNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float3 color; }; class SeparateXYZNode : public ShaderNode { public: SHADER_NODE_CLASS(SeparateXYZNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float3 vector; }; class HSVNode : public ShaderNode { public: SHADER_NODE_CLASS(HSVNode) + + float hue; + float saturation; + float value; + float fac; + float3 color; }; class AttributeNode : public ShaderNode { @@ -784,12 +750,6 @@ public: bool has_spatial_varying() { return true; } ustring attribute; - - virtual bool equals(const ShaderNode *other) { - const AttributeNode *color_node = (const AttributeNode*)other; - return ShaderNode::equals(other) && - attribute == color_node->attribute; - } }; class CameraNode : public ShaderNode { @@ -803,6 +763,9 @@ public: SHADER_NODE_CLASS(FresnelNode) bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 normal; + float IOR; }; class LayerWeightNode : public ShaderNode { @@ -810,6 +773,9 @@ public: SHADER_NODE_CLASS(LayerWeightNode) bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_1; } + + float3 normal; + float blend; }; class WireframeNode : public ShaderNode { @@ -818,22 +784,25 @@ public: bool has_spatial_varying() { return true; } virtual int get_group() { return NODE_GROUP_LEVEL_3; } + float size; bool use_pixel_size; }; class WavelengthNode : public ShaderNode { public: SHADER_NODE_CLASS(WavelengthNode) - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float wavelength; }; class BlackbodyNode : public ShaderNode { public: SHADER_NODE_CLASS(BlackbodyNode) bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); - virtual int get_group() { return NODE_GROUP_LEVEL_3; } + + float temperature; }; class MathNode : public ShaderNode { @@ -842,18 +811,10 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_1; } bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); - bool use_clamp; - + float value1; + float value2; NodeMath type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) - { - const MathNode *math_node = (const MathNode*)other; - return ShaderNode::equals(other) && - use_clamp == math_node->use_clamp && - type == math_node->type; - } + bool use_clamp; }; class NormalNode : public ShaderNode { @@ -862,13 +823,7 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_2; } float3 direction; - - virtual bool equals(const ShaderNode *other) - { - const NormalNode *normal_node = (const NormalNode*)other; - return ShaderNode::equals(other) && - direction == normal_node->direction; - } + float3 normal; }; class VectorMathNode : public ShaderNode { @@ -877,15 +832,9 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_1; } bool constant_fold(ShaderGraph *graph, ShaderOutput *socket, ShaderInput *optimized); + float3 vector1; + float3 vector2; NodeVectorMath type; - static NodeEnum type_enum; - - virtual bool equals(const ShaderNode *other) - { - const VectorMathNode *math_node = (const VectorMathNode*)other; - return ShaderNode::equals(other) && - type == math_node->type; - } }; class VectorTransformNode : public ShaderNode { @@ -897,17 +846,7 @@ public: NodeVectorTransformType type; NodeVectorTransformConvertSpace convert_from; NodeVectorTransformConvertSpace convert_to; - - static NodeEnum type_enum; - static NodeEnum convert_space_enum; - - virtual bool equals(const ShaderNode *other) { - const VectorTransformNode *vector_transform_node = (const VectorTransformNode*)other; - return ShaderNode::equals(other) && - type == vector_transform_node->type && - convert_from == vector_transform_node->convert_from && - convert_to == vector_transform_node->convert_to; - } + float3 vector; }; class BumpNode : public ShaderNode { @@ -920,12 +859,13 @@ public: } bool invert; - - virtual bool equals(const ShaderNode *other) { - const BumpNode *bump_node = (const BumpNode*)other; - return ShaderNode::equals(other) && - invert == bump_node->invert; - } + float height; + float sample_center; + float sample_x; + float sample_y; + float3 normal; + float strength; + float distance; }; class RGBCurvesNode : public ShaderNode { @@ -933,10 +873,10 @@ public: SHADER_NODE_CLASS(RGBCurvesNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } array<float3> curves; - float min_x, max_x; + float min_x, max_x, fac; + float3 color; }; class VectorCurvesNode : public ShaderNode { @@ -944,25 +884,27 @@ public: SHADER_NODE_CLASS(VectorCurvesNode) virtual int get_group() { return NODE_GROUP_LEVEL_3; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } array<float3> curves; - float min_x, max_x; + float min_x, max_x, fac; + float3 vector; }; class RGBRampNode : public ShaderNode { public: SHADER_NODE_CLASS(RGBRampNode) + virtual int get_group() { return NODE_GROUP_LEVEL_1; } + array<float3> ramp; array<float> ramp_alpha; + float fac; bool interpolate; - virtual int get_group() { return NODE_GROUP_LEVEL_1; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } }; class SetNormalNode : public ShaderNode { public: SHADER_NODE_CLASS(SetNormalNode) + float3 direction; }; class OSLNode : public ShaderNode { @@ -970,11 +912,15 @@ public: static OSLNode *create(size_t num_inputs); ~OSLNode(); + char* input_default_value(); + void add_input(ustring name, SocketType::Type type); + void add_output(ustring name, SocketType::Type type); + SHADER_NODE_BASE_CLASS(OSLNode) /* ideally we could beter detect this, but we can't query this now */ bool has_spatial_varying() { return true; } - virtual bool equals(const ShaderNode * /*other*/) { return false; } + virtual bool equals(const ShaderNode& /*other*/) { return false; } string filepath; string bytecode_hash; @@ -991,17 +937,10 @@ public: virtual int get_group() { return NODE_GROUP_LEVEL_3; } NodeNormalMapSpace space; - static NodeEnum space_enum; - ustring attribute; - - virtual bool equals(const ShaderNode *other) - { - const NormalMapNode *normal_map_node = (const NormalMapNode*)other; - return ShaderNode::equals(other) && - space == normal_map_node->space && - attribute == normal_map_node->attribute; - } + float strength; + float3 color; + float3 normal_osl; }; class TangentNode : public ShaderNode { @@ -1013,19 +952,8 @@ public: NodeTangentDirectionType direction_type; NodeTangentAxis axis; - static NodeEnum direction_type_enum; - static NodeEnum axis_enum; - ustring attribute; - - virtual bool equals(const ShaderNode *other) - { - const TangentNode *tangent_node = (const TangentNode*)other; - return ShaderNode::equals(other) && - direction_type == tangent_node->direction_type && - axis == tangent_node->axis && - attribute == tangent_node->attribute; - } + float3 normal_osl; }; CCL_NAMESPACE_END diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index 644e581bf4b..ff1f678c2d2 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -39,8 +39,8 @@ NODE_DEFINE(Object) SOCKET_NODE(mesh, "Mesh", &Mesh::node_type); SOCKET_TRANSFORM(tfm, "Transform", transform_identity()); - SOCKET_INT(visibility, "Visibility", ~0); - SOCKET_INT(random_id, "Random ID", 0); + SOCKET_UINT(visibility, "Visibility", ~0); + SOCKET_UINT(random_id, "Random ID", 0); SOCKET_INT(pass_id, "Pass ID", 0); SOCKET_BOOLEAN(use_holdout, "Use Holdout", false); SOCKET_POINT(dupli_generated, "Dupli Generated", make_float3(0.0f, 0.0f, 0.0f)); diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp index 1cfe3fb38e2..676afad997e 100644 --- a/intern/cycles/render/osl.cpp +++ b/intern/cycles/render/osl.cpp @@ -477,8 +477,10 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath, continue; if(!param->isoutput && param->validdefault) { - node->add_input(param->name.c_str(), socket_type, make_float3(param->fdefault[0], param->fdefault[1], param->fdefault[2])); - continue; + float3 *default_value = (float3*)node->input_default_value(); + default_value->x = param->fdefault[0]; + default_value->y = param->fdefault[1]; + default_value->z = param->fdefault[2]; } } else if(param->type.aggregate == TypeDesc::SCALAR) { @@ -486,24 +488,21 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath, socket_type = SocketType::INT; if(!param->isoutput && param->validdefault) { - node->add_input(param->name.c_str(), socket_type, (float)param->idefault[0]); - continue; + *(int*)node->input_default_value() = param->idefault[0]; } } else if(param->type.basetype == TypeDesc::FLOAT) { socket_type = SocketType::FLOAT; if(!param->isoutput && param->validdefault) { - node->add_input(param->name.c_str(), socket_type, param->fdefault[0]); - continue; + *(float*)node->input_default_value() = param->fdefault[0]; } } else if(param->type.basetype == TypeDesc::STRING) { socket_type = SocketType::STRING; if(!param->isoutput && param->validdefault) { - node->add_input(param->name.c_str(), socket_type); - continue; + *(ustring*)node->input_default_value() = param->sdefault[0]; } } else @@ -513,10 +512,10 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath, continue; if(param->isoutput) { - node->add_output(param->name.c_str(), socket_type); + node->add_output(param->name, socket_type); } else { - node->add_input(param->name.c_str(), socket_type); + node->add_input(param->name, socket_type); } } @@ -528,6 +527,9 @@ OSLNode *OSLShaderManager::osl_node(const std::string& filepath, node->filepath = filepath; } + /* Generate inputs and outputs */ + node->create_inputs_outputs(node->type); + return node; } @@ -643,27 +645,28 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath) continue; string param_name = compatible_name(node, input); + const SocketType& socket = input->socket_type; switch(input->type()) { case SocketType::COLOR: - parameter_color(param_name.c_str(), input->value()); + parameter_color(param_name.c_str(), node->get_float3(socket)); break; case SocketType::POINT: - parameter_point(param_name.c_str(), input->value()); + parameter_point(param_name.c_str(), node->get_float3(socket)); break; case SocketType::VECTOR: - parameter_vector(param_name.c_str(), input->value()); + parameter_vector(param_name.c_str(), node->get_float3(socket)); break; case SocketType::NORMAL: - parameter_normal(param_name.c_str(), input->value()); + parameter_normal(param_name.c_str(), node->get_float3(socket)); break; case SocketType::FLOAT: - parameter(param_name.c_str(), input->value_float()); + parameter(param_name.c_str(), node->get_float(socket)); break; case SocketType::INT: - parameter(param_name.c_str(), (int)input->value_float()); + parameter(param_name.c_str(), node->get_int(socket)); break; case SocketType::STRING: - parameter(param_name.c_str(), input->value_string()); + parameter(param_name.c_str(), node->get_string(socket)); break; case SocketType::CLOSURE: case SocketType::UNDEFINED: @@ -733,6 +736,169 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath) } } +static TypeDesc array_typedesc(TypeDesc typedesc, int arraylength) +{ + return TypeDesc((TypeDesc::BASETYPE)typedesc.basetype, + (TypeDesc::AGGREGATE)typedesc.aggregate, + (TypeDesc::VECSEMANTICS)typedesc.vecsemantics, + arraylength); +} + +void OSLCompiler::parameter(ShaderNode* node, const char *name) +{ + OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys; + ustring uname = ustring(name); + const SocketType& socket = *(node->type->find_input(uname)); + + switch(socket.type) + { + case SocketType::BOOLEAN: + { + int value = node->get_bool(socket); + ss->Parameter(name, TypeDesc::TypeInt, &value); + break; + } + case SocketType::FLOAT: + { + float value = node->get_float(socket); + ss->Parameter(uname, TypeDesc::TypeFloat, &value); + break; + } + case SocketType::INT: + { + int value = node->get_int(socket); + ss->Parameter(uname, TypeDesc::TypeInt, &value); + break; + } + case SocketType::COLOR: + { + float3 value = node->get_float3(socket); + ss->Parameter(uname, TypeDesc::TypeColor, &value); + break; + } + case SocketType::VECTOR: + { + float3 value = node->get_float3(socket); + ss->Parameter(uname, TypeDesc::TypeVector, &value); + break; + } + case SocketType::POINT: + { + float3 value = node->get_float3(socket); + ss->Parameter(uname, TypeDesc::TypePoint, &value); + break; + } + case SocketType::NORMAL: + { + float3 value = node->get_float3(socket); + ss->Parameter(uname, TypeDesc::TypeNormal, &value); + break; + } + case SocketType::POINT2: + { + float2 value = node->get_float2(socket); + ss->Parameter(uname, TypeDesc(TypeDesc::FLOAT, TypeDesc::VEC2, TypeDesc::POINT), &value); + break; + } + case SocketType::STRING: + { + ustring value = node->get_string(socket); + ss->Parameter(uname, TypeDesc::TypeString, &value); + break; + } + case SocketType::ENUM: + { + ustring value = node->get_string(socket); + ss->Parameter(uname, TypeDesc::TypeString, &value); + break; + } + case SocketType::TRANSFORM: + { + Transform value = node->get_transform(socket); + ss->Parameter(uname, TypeDesc::TypeMatrix, &value); + break; + } + case SocketType::BOOLEAN_ARRAY: + { + // OSL does not support booleans, so convert to int + const array<bool>& value = node->get_bool_array(socket); + array<int> intvalue(value.size()); + for (size_t i = 0; i < value.size(); i++) + intvalue[i] = value[i]; + ss->Parameter(uname, array_typedesc(TypeDesc::TypeInt, value.size()), intvalue.data()); + break; + } + case SocketType::FLOAT_ARRAY: + { + const array<float>& value = node->get_float_array(socket); + ss->Parameter(uname, array_typedesc(TypeDesc::TypeFloat, value.size()), value.data()); + break; + } + case SocketType::INT_ARRAY: + { + const array<int>& value = node->get_int_array(socket); + ss->Parameter(uname, array_typedesc(TypeDesc::TypeInt, value.size()), value.data()); + break; + } + case SocketType::COLOR_ARRAY: + case SocketType::VECTOR_ARRAY: + case SocketType::POINT_ARRAY: + case SocketType::NORMAL_ARRAY: + { + TypeDesc typedesc; + + switch(socket.type) + { + case SocketType::COLOR_ARRAY: typedesc = TypeDesc::TypeColor; break; + case SocketType::VECTOR_ARRAY: typedesc = TypeDesc::TypeVector; break; + case SocketType::POINT_ARRAY: typedesc = TypeDesc::TypePoint; break; + case SocketType::NORMAL_ARRAY: typedesc = TypeDesc::TypeNormal; break; + default: assert(0); break; + } + + // convert to tightly packed array since float3 has padding + const array<float3>& value = node->get_float3_array(socket); + array<float> fvalue(value.size() * 3); + for (size_t i = 0, j = 0; i < value.size(); i++) + { + fvalue[j++] = value[i].x; + fvalue[j++] = value[i].y; + fvalue[j++] = value[i].z; + } + + ss->Parameter(uname, array_typedesc(typedesc, value.size()), fvalue.data()); + break; + } + case SocketType::POINT2_ARRAY: + { + const array<float2>& value = node->get_float2_array(socket); + ss->Parameter(uname, array_typedesc(TypeDesc(TypeDesc::FLOAT, TypeDesc::VEC2, TypeDesc::POINT), value.size()), value.data()); + break; + } + case SocketType::STRING_ARRAY: + { + const array<ustring>& value = node->get_string_array(socket); + ss->Parameter(uname, array_typedesc(TypeDesc::TypeString, value.size()), value.data()); + break; + } + case SocketType::TRANSFORM_ARRAY: + { + const array<Transform>& value = node->get_transform_array(socket); + ss->Parameter(uname, array_typedesc(TypeDesc::TypeMatrix, value.size()), value.data()); + break; + } + case SocketType::CLOSURE: + case SocketType::NODE: + case SocketType::NODE_ARRAY: + case SocketType::UNDEFINED: + case SocketType::UINT: + { + assert(0); + break; + } + } +} + void OSLCompiler::parameter(const char *name, float f) { OSL::ShadingSystem *ss = (OSL::ShadingSystem*)shadingsys; @@ -996,6 +1162,10 @@ void OSLCompiler::add(ShaderNode * /*node*/, const char * /*name*/, bool /*isfil { } +void OSLCompiler::parameter(ShaderNode * /*node*/, const char * /*name*/) +{ +} + void OSLCompiler::parameter(const char * /*name*/, float /*f*/) { } diff --git a/intern/cycles/render/osl.h b/intern/cycles/render/osl.h index 13b9d6307f9..b131b672b8c 100644 --- a/intern/cycles/render/osl.h +++ b/intern/cycles/render/osl.h @@ -125,6 +125,8 @@ public: void add(ShaderNode *node, const char *name, bool isfilepath = false); + void parameter(ShaderNode *node, const char *name); + void parameter(const char *name, float f); void parameter_color(const char *name, float3 f); void parameter_vector(const char *name, float3 f); diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 708eeef3b50..4cdb878df45 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -449,17 +449,15 @@ void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, Scen void ShaderManager::add_default(Scene *scene) { - ShaderNode *closure, *out; - /* default surface */ { ShaderGraph *graph = new ShaderGraph(); - closure = graph->add(new DiffuseBsdfNode()); - closure->input("Color")->set(make_float3(0.8f, 0.8f, 0.8f)); - out = graph->output(); + DiffuseBsdfNode *diffuse = new DiffuseBsdfNode(); + diffuse->color = make_float3(0.8f, 0.8f, 0.8f); + graph->add(diffuse); - graph->connect(closure->output("BSDF"), out->input("Surface")); + graph->connect(diffuse->output("BSDF"), graph->output()->input("Surface")); Shader *shader = new Shader(); shader->name = "default_surface"; @@ -472,12 +470,12 @@ void ShaderManager::add_default(Scene *scene) { ShaderGraph *graph = new ShaderGraph(); - closure = graph->add(new EmissionNode()); - closure->input("Color")->set(make_float3(0.8f, 0.8f, 0.8f)); - closure->input("Strength")->set(0.0f); - out = graph->output(); + EmissionNode *emission = new EmissionNode(); + emission->color = make_float3(0.8f, 0.8f, 0.8f); + emission->strength = 0.0f; + graph->add(emission); - graph->connect(closure->output("Emission"), out->input("Surface")); + graph->connect(emission->output("Emission"), graph->output()->input("Surface")); Shader *shader = new Shader(); shader->name = "default_light"; diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp index d54afd1ba6f..f0e7ee2bd49 100644 --- a/intern/cycles/render/svm.cpp +++ b/intern/cycles/render/svm.cpp @@ -192,14 +192,16 @@ int SVMCompiler::stack_assign(ShaderInput *input) input->stack_offset = input->link->stack_offset; } else { + Node *node = input->parent; + /* not linked to output -> add nodes to load default value */ input->stack_offset = stack_find_offset(input->type()); if(input->type() == SocketType::FLOAT) { - add_node(NODE_VALUE_F, __float_as_int(input->value_float()), input->stack_offset); + add_node(NODE_VALUE_F, __float_as_int(node->get_float(input->socket_type)), input->stack_offset); } else if(input->type() == SocketType::INT) { - add_node(NODE_VALUE_F, (int)input->value_float(), input->stack_offset); + add_node(NODE_VALUE_F, node->get_int(input->socket_type), input->stack_offset); } else if(input->type() == SocketType::VECTOR || input->type() == SocketType::NORMAL || @@ -208,7 +210,7 @@ int SVMCompiler::stack_assign(ShaderInput *input) { add_node(NODE_VALUE_V, input->stack_offset); - add_node(NODE_VALUE_V, input->value()); + add_node(NODE_VALUE_V, node->get_float3(input->socket_type)); } else /* should not get called for closure */ assert(0); @@ -446,7 +448,7 @@ void SVMCompiler::generate_closure_node(ShaderNode *node, const char *weight_name = (current_type == SHADER_TYPE_VOLUME)? "VolumeMixWeight": "SurfaceMixWeight"; ShaderInput *weight_in = node->input(weight_name); - if(weight_in && (weight_in->link || weight_in->value_float() != 1.0f)) + if(weight_in && (weight_in->link || node->get_float(weight_in->socket_type) != 1.0f)) mix_weight_offset = stack_assign(weight_in); else mix_weight_offset = SVM_STACK_INVALID; diff --git a/intern/decklink/CMakeLists.txt b/intern/decklink/CMakeLists.txt new file mode 100644 index 00000000000..fbef65cdba4 --- /dev/null +++ b/intern/decklink/CMakeLists.txt @@ -0,0 +1,58 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# 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 +# of the License, or (at your option) any later version. +# +# 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, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# The Original Code is Copyright (C) 2015, Blender Foundation +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): Blender Foundation. +# +# ***** END GPL LICENSE BLOCK ***** + +set(INC +) + +set(INC_SYS +) + +set(SRC + DeckLinkAPI.cpp + DeckLinkAPI.h +) + +if (WIN32) + list(APPEND SRC + win/DeckLinkAPI_h.h + win/DeckLinkAPI_i.c + ) +endif() + +if (UNIX AND NOT APPLE) + list(APPEND SRC + linux/DeckLinkAPI.h + linux/DeckLinkAPIConfiguration.h + linux/DeckLinkAPIDeckControl.h + linux/DeckLinkAPIDiscovery.h + linux/DeckLinkAPIDispatch.cpp + linux/DeckLinkAPIModes.h + linux/DeckLinkAPIVersion.h + linux/DeckLinkAPITypes.h + linux/LinuxCOM.h + ) +endif() + +blender_add_lib(bf_intern_decklink "${SRC}" "${INC}" "${INC_SYS}") diff --git a/intern/decklink/DeckLinkAPI.cpp b/intern/decklink/DeckLinkAPI.cpp new file mode 100644 index 00000000000..73a1264176b --- /dev/null +++ b/intern/decklink/DeckLinkAPI.cpp @@ -0,0 +1,50 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file decklink/DeckLinkAPI.cpp +* \ingroup decklink +*/ + +#include "DeckLinkAPI.h" + +#ifdef WIN32 +IDeckLinkIterator* BMD_CreateDeckLinkIterator(void) +{ + HRESULT result; + IDeckLinkIterator* pDLIterator = NULL; + + result = CoCreateInstance(CLSID_CDeckLinkIterator, NULL, CLSCTX_ALL, IID_IDeckLinkIterator, (void**)&pDLIterator); + if (FAILED(result)) + return NULL; + return pDLIterator; +} +#else +IDeckLinkIterator* BMD_CreateDeckLinkIterator(void) +{ + return CreateDeckLinkIteratorInstance(); +} +#endif // WIN32 diff --git a/intern/decklink/DeckLinkAPI.h b/intern/decklink/DeckLinkAPI.h new file mode 100644 index 00000000000..f6d2b79f53e --- /dev/null +++ b/intern/decklink/DeckLinkAPI.h @@ -0,0 +1,56 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file decklink/DeckLinkAPI.h +* \ingroup decklink +*/ + +#ifndef __DECKLINKAPI_H__ +#define __DECKLINKAPI_H__ + +/* Include the OS specific Declink headers */ + +#ifdef WIN32 +# include <windows.h> +# include <objbase.h> +# include <comutil.h> +# include "win/DeckLinkAPI_h.h" + typedef unsigned int dl_size_t; +#elif defined(__APPLE__) +# error "Decklink not supported in OSX" +#else +# include "linux/DeckLinkAPI.h" + /* Windows COM API uses BOOL, linux uses bool */ +# define BOOL bool + typedef uint32_t dl_size_t; +#endif + + +/* OS independent function to get the device iterator */ +IDeckLinkIterator* BMD_CreateDeckLinkIterator(void); + +#endif /* __DECKLINKAPI_H__ */ diff --git a/intern/decklink/linux/DeckLinkAPI.h b/intern/decklink/linux/DeckLinkAPI.h new file mode 100644 index 00000000000..08bfba39994 --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPI.h @@ -0,0 +1,767 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPI_H +#define BMD_DECKLINKAPI_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +/* DeckLink API */ + +#include <stdint.h> +#include "LinuxCOM.h" + +#include "DeckLinkAPITypes.h" +#include "DeckLinkAPIModes.h" +#include "DeckLinkAPIDiscovery.h" +#include "DeckLinkAPIConfiguration.h" +#include "DeckLinkAPIDeckControl.h" + +#define BLACKMAGIC_DECKLINK_API_MAGIC 1 + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkVideoOutputCallback = /* 20AA5225-1958-47CB-820B-80A8D521A6EE */ {0x20,0xAA,0x52,0x25,0x19,0x58,0x47,0xCB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE}; +BMD_CONST REFIID IID_IDeckLinkInputCallback = /* DD04E5EC-7415-42AB-AE4A-E80C4DFC044A */ {0xDD,0x04,0xE5,0xEC,0x74,0x15,0x42,0xAB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A}; +BMD_CONST REFIID IID_IDeckLinkMemoryAllocator = /* B36EB6E7-9D29-4AA8-92EF-843B87A289E8 */ {0xB3,0x6E,0xB6,0xE7,0x9D,0x29,0x4A,0xA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8}; +BMD_CONST REFIID IID_IDeckLinkAudioOutputCallback = /* 403C681B-7F46-4A12-B993-2BB127084EE6 */ {0x40,0x3C,0x68,0x1B,0x7F,0x46,0x4A,0x12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6}; +BMD_CONST REFIID IID_IDeckLinkIterator = /* 50FB36CD-3063-4B73-BDBB-958087F2D8BA */ {0x50,0xFB,0x36,0xCD,0x30,0x63,0x4B,0x73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA}; +BMD_CONST REFIID IID_IDeckLinkAPIInformation = /* 7BEA3C68-730D-4322-AF34-8A7152B532A4 */ {0x7B,0xEA,0x3C,0x68,0x73,0x0D,0x43,0x22,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4}; +BMD_CONST REFIID IID_IDeckLinkOutput = /* CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564 */ {0xCC,0x5C,0x8A,0x6E,0x3F,0x2F,0x4B,0x3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64}; +BMD_CONST REFIID IID_IDeckLinkInput = /* AF22762B-DFAC-4846-AA79-FA8883560995 */ {0xAF,0x22,0x76,0x2B,0xDF,0xAC,0x48,0x46,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95}; +BMD_CONST REFIID IID_IDeckLinkVideoFrame = /* 3F716FE0-F023-4111-BE5D-EF4414C05B17 */ {0x3F,0x71,0x6F,0xE0,0xF0,0x23,0x41,0x11,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17}; +BMD_CONST REFIID IID_IDeckLinkMutableVideoFrame = /* 69E2639F-40DA-4E19-B6F2-20ACE815C390 */ {0x69,0xE2,0x63,0x9F,0x40,0xDA,0x4E,0x19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90}; +BMD_CONST REFIID IID_IDeckLinkVideoFrame3DExtensions = /* DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7 */ {0xDA,0x0F,0x7E,0x4A,0xED,0xC7,0x48,0xA8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7}; +BMD_CONST REFIID IID_IDeckLinkVideoInputFrame = /* 05CFE374-537C-4094-9A57-680525118F44 */ {0x05,0xCF,0xE3,0x74,0x53,0x7C,0x40,0x94,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44}; +BMD_CONST REFIID IID_IDeckLinkVideoFrameAncillary = /* 732E723C-D1A4-4E29-9E8E-4A88797A0004 */ {0x73,0x2E,0x72,0x3C,0xD1,0xA4,0x4E,0x29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04}; +BMD_CONST REFIID IID_IDeckLinkAudioInputPacket = /* E43D5870-2894-11DE-8C30-0800200C9A66 */ {0xE4,0x3D,0x58,0x70,0x28,0x94,0x11,0xDE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66}; +BMD_CONST REFIID IID_IDeckLinkScreenPreviewCallback = /* B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438 */ {0xB1,0xD3,0xF4,0x9A,0x85,0xFE,0x4C,0x5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38}; +BMD_CONST REFIID IID_IDeckLinkGLScreenPreviewHelper = /* 504E2209-CAC7-4C1A-9FB4-C5BB6274D22F */ {0x50,0x4E,0x22,0x09,0xCA,0xC7,0x4C,0x1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F}; +BMD_CONST REFIID IID_IDeckLinkNotificationCallback = /* B002A1EC-070D-4288-8289-BD5D36E5FF0D */ {0xB0,0x02,0xA1,0xEC,0x07,0x0D,0x42,0x88,0x82,0x89,0xBD,0x5D,0x36,0xE5,0xFF,0x0D}; +BMD_CONST REFIID IID_IDeckLinkNotification = /* 0A1FB207-E215-441B-9B19-6FA1575946C5 */ {0x0A,0x1F,0xB2,0x07,0xE2,0x15,0x44,0x1B,0x9B,0x19,0x6F,0xA1,0x57,0x59,0x46,0xC5}; +BMD_CONST REFIID IID_IDeckLinkAttributes = /* ABC11843-D966-44CB-96E2-A1CB5D3135C4 */ {0xAB,0xC1,0x18,0x43,0xD9,0x66,0x44,0xCB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4}; +BMD_CONST REFIID IID_IDeckLinkKeyer = /* 89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3 */ {0x89,0xAF,0xCA,0xF5,0x65,0xF8,0x42,0x1E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3}; +BMD_CONST REFIID IID_IDeckLinkVideoConversion = /* 3BBCB8A2-DA2C-42D9-B5D8-88083644E99A */ {0x3B,0xBC,0xB8,0xA2,0xDA,0x2C,0x42,0xD9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A}; +BMD_CONST REFIID IID_IDeckLinkDeviceNotificationCallback = /* 4997053B-0ADF-4CC8-AC70-7A50C4BE728F */ {0x49,0x97,0x05,0x3B,0x0A,0xDF,0x4C,0xC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F}; +BMD_CONST REFIID IID_IDeckLinkDiscovery = /* CDBF631C-BC76-45FA-B44D-C55059BC6101 */ {0xCD,0xBF,0x63,0x1C,0xBC,0x76,0x45,0xFA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01}; + +/* Enum BMDVideoOutputFlags - Flags to control the output of ancillary data along with video. */ + +typedef uint32_t BMDVideoOutputFlags; +enum _BMDVideoOutputFlags { + bmdVideoOutputFlagDefault = 0, + bmdVideoOutputVANC = 1 << 0, + bmdVideoOutputVITC = 1 << 1, + bmdVideoOutputRP188 = 1 << 2, + bmdVideoOutputDualStream3D = 1 << 4 +}; + +/* Enum BMDFrameFlags - Frame flags */ + +typedef uint32_t BMDFrameFlags; +enum _BMDFrameFlags { + bmdFrameFlagDefault = 0, + bmdFrameFlagFlipVertical = 1 << 0, + + /* Flags that are applicable only to instances of IDeckLinkVideoInputFrame */ + + bmdFrameHasNoInputSource = 1 << 31 +}; + +/* Enum BMDVideoInputFlags - Flags applicable to video input */ + +typedef uint32_t BMDVideoInputFlags; +enum _BMDVideoInputFlags { + bmdVideoInputFlagDefault = 0, + bmdVideoInputEnableFormatDetection = 1 << 0, + bmdVideoInputDualStream3D = 1 << 1 +}; + +/* Enum BMDVideoInputFormatChangedEvents - Bitmask passed to the VideoInputFormatChanged notification to identify the properties of the input signal that have changed */ + +typedef uint32_t BMDVideoInputFormatChangedEvents; +enum _BMDVideoInputFormatChangedEvents { + bmdVideoInputDisplayModeChanged = 1 << 0, + bmdVideoInputFieldDominanceChanged = 1 << 1, + bmdVideoInputColorspaceChanged = 1 << 2 +}; + +/* Enum BMDDetectedVideoInputFormatFlags - Flags passed to the VideoInputFormatChanged notification to describe the detected video input signal */ + +typedef uint32_t BMDDetectedVideoInputFormatFlags; +enum _BMDDetectedVideoInputFormatFlags { + bmdDetectedVideoInputYCbCr422 = 1 << 0, + bmdDetectedVideoInputRGB444 = 1 << 1, + bmdDetectedVideoInputDualStream3D = 1 << 2 +}; + +/* Enum BMDDeckLinkCapturePassthroughMode - Enumerates whether the video output is electrically connected to the video input or if the clean switching mode is enabled */ + +typedef uint32_t BMDDeckLinkCapturePassthroughMode; +enum _BMDDeckLinkCapturePassthroughMode { + bmdDeckLinkCapturePassthroughModeDirect = /* 'pdir' */ 0x70646972, + bmdDeckLinkCapturePassthroughModeCleanSwitch = /* 'pcln' */ 0x70636C6E +}; + +/* Enum BMDOutputFrameCompletionResult - Frame Completion Callback */ + +typedef uint32_t BMDOutputFrameCompletionResult; +enum _BMDOutputFrameCompletionResult { + bmdOutputFrameCompleted, + bmdOutputFrameDisplayedLate, + bmdOutputFrameDropped, + bmdOutputFrameFlushed +}; + +/* Enum BMDReferenceStatus - GenLock input status */ + +typedef uint32_t BMDReferenceStatus; +enum _BMDReferenceStatus { + bmdReferenceNotSupportedByHardware = 1 << 0, + bmdReferenceLocked = 1 << 1 +}; + +/* Enum BMDAudioSampleRate - Audio sample rates supported for output/input */ + +typedef uint32_t BMDAudioSampleRate; +enum _BMDAudioSampleRate { + bmdAudioSampleRate48kHz = 48000 +}; + +/* Enum BMDAudioSampleType - Audio sample sizes supported for output/input */ + +typedef uint32_t BMDAudioSampleType; +enum _BMDAudioSampleType { + bmdAudioSampleType16bitInteger = 16, + bmdAudioSampleType32bitInteger = 32 +}; + +/* Enum BMDAudioOutputStreamType - Audio output stream type */ + +typedef uint32_t BMDAudioOutputStreamType; +enum _BMDAudioOutputStreamType { + bmdAudioOutputStreamContinuous, + bmdAudioOutputStreamContinuousDontResample, + bmdAudioOutputStreamTimestamped +}; + +/* Enum BMDDisplayModeSupport - Output mode supported flags */ + +typedef uint32_t BMDDisplayModeSupport; +enum _BMDDisplayModeSupport { + bmdDisplayModeNotSupported = 0, + bmdDisplayModeSupported, + bmdDisplayModeSupportedWithConversion +}; + +/* Enum BMDTimecodeFormat - Timecode formats for frame metadata */ + +typedef uint32_t BMDTimecodeFormat; +enum _BMDTimecodeFormat { + bmdTimecodeRP188VITC1 = /* 'rpv1' */ 0x72707631, // RP188 timecode where DBB1 equals VITC1 (line 9) + bmdTimecodeRP188VITC2 = /* 'rp12' */ 0x72703132, // RP188 timecode where DBB1 equals VITC2 (line 9 for progressive or line 571 for interlaced/PsF) + bmdTimecodeRP188LTC = /* 'rplt' */ 0x72706C74, // RP188 timecode where DBB1 equals LTC (line 10) + bmdTimecodeRP188Any = /* 'rp18' */ 0x72703138, // For capture: return the first valid timecode in {VITC1, LTC ,VITC2} - For playback: set the timecode as VITC1 + bmdTimecodeVITC = /* 'vitc' */ 0x76697463, + bmdTimecodeVITCField2 = /* 'vit2' */ 0x76697432, + bmdTimecodeSerial = /* 'seri' */ 0x73657269 +}; + +/* Enum BMDAnalogVideoFlags - Analog video display flags */ + +typedef uint32_t BMDAnalogVideoFlags; +enum _BMDAnalogVideoFlags { + bmdAnalogVideoFlagCompositeSetup75 = 1 << 0, + bmdAnalogVideoFlagComponentBetacamLevels = 1 << 1 +}; + +/* Enum BMDAudioOutputAnalogAESSwitch - Audio output Analog/AESEBU switch */ + +typedef uint32_t BMDAudioOutputAnalogAESSwitch; +enum _BMDAudioOutputAnalogAESSwitch { + bmdAudioOutputSwitchAESEBU = /* 'aes ' */ 0x61657320, + bmdAudioOutputSwitchAnalog = /* 'anlg' */ 0x616E6C67 +}; + +/* Enum BMDVideoOutputConversionMode - Video/audio conversion mode */ + +typedef uint32_t BMDVideoOutputConversionMode; +enum _BMDVideoOutputConversionMode { + bmdNoVideoOutputConversion = /* 'none' */ 0x6E6F6E65, + bmdVideoOutputLetterboxDownconversion = /* 'ltbx' */ 0x6C746278, + bmdVideoOutputAnamorphicDownconversion = /* 'amph' */ 0x616D7068, + bmdVideoOutputHD720toHD1080Conversion = /* '720c' */ 0x37323063, + bmdVideoOutputHardwareLetterboxDownconversion = /* 'HWlb' */ 0x48576C62, + bmdVideoOutputHardwareAnamorphicDownconversion = /* 'HWam' */ 0x4857616D, + bmdVideoOutputHardwareCenterCutDownconversion = /* 'HWcc' */ 0x48576363, + bmdVideoOutputHardware720p1080pCrossconversion = /* 'xcap' */ 0x78636170, + bmdVideoOutputHardwareAnamorphic720pUpconversion = /* 'ua7p' */ 0x75613770, + bmdVideoOutputHardwareAnamorphic1080iUpconversion = /* 'ua1i' */ 0x75613169, + bmdVideoOutputHardwareAnamorphic149To720pUpconversion = /* 'u47p' */ 0x75343770, + bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = /* 'u41i' */ 0x75343169, + bmdVideoOutputHardwarePillarbox720pUpconversion = /* 'up7p' */ 0x75703770, + bmdVideoOutputHardwarePillarbox1080iUpconversion = /* 'up1i' */ 0x75703169 +}; + +/* Enum BMDVideoInputConversionMode - Video input conversion mode */ + +typedef uint32_t BMDVideoInputConversionMode; +enum _BMDVideoInputConversionMode { + bmdNoVideoInputConversion = /* 'none' */ 0x6E6F6E65, + bmdVideoInputLetterboxDownconversionFromHD1080 = /* '10lb' */ 0x31306C62, + bmdVideoInputAnamorphicDownconversionFromHD1080 = /* '10am' */ 0x3130616D, + bmdVideoInputLetterboxDownconversionFromHD720 = /* '72lb' */ 0x37326C62, + bmdVideoInputAnamorphicDownconversionFromHD720 = /* '72am' */ 0x3732616D, + bmdVideoInputLetterboxUpconversion = /* 'lbup' */ 0x6C627570, + bmdVideoInputAnamorphicUpconversion = /* 'amup' */ 0x616D7570 +}; + +/* Enum BMDVideo3DPackingFormat - Video 3D packing format */ + +typedef uint32_t BMDVideo3DPackingFormat; +enum _BMDVideo3DPackingFormat { + bmdVideo3DPackingSidebySideHalf = /* 'sbsh' */ 0x73627368, + bmdVideo3DPackingLinebyLine = /* 'lbyl' */ 0x6C62796C, + bmdVideo3DPackingTopAndBottom = /* 'tabo' */ 0x7461626F, + bmdVideo3DPackingFramePacking = /* 'frpk' */ 0x6672706B, + bmdVideo3DPackingLeftOnly = /* 'left' */ 0x6C656674, + bmdVideo3DPackingRightOnly = /* 'righ' */ 0x72696768 +}; + +/* Enum BMDIdleVideoOutputOperation - Video output operation when not playing video */ + +typedef uint32_t BMDIdleVideoOutputOperation; +enum _BMDIdleVideoOutputOperation { + bmdIdleVideoOutputBlack = /* 'blac' */ 0x626C6163, + bmdIdleVideoOutputLastFrame = /* 'lafa' */ 0x6C616661, + bmdIdleVideoOutputDesktop = /* 'desk' */ 0x6465736B +}; + +/* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ + +typedef uint32_t BMDDeckLinkAttributeID; +enum _BMDDeckLinkAttributeID { + + /* Flags */ + + BMDDeckLinkSupportsInternalKeying = /* 'keyi' */ 0x6B657969, + BMDDeckLinkSupportsExternalKeying = /* 'keye' */ 0x6B657965, + BMDDeckLinkSupportsHDKeying = /* 'keyh' */ 0x6B657968, + BMDDeckLinkSupportsInputFormatDetection = /* 'infd' */ 0x696E6664, + BMDDeckLinkHasReferenceInput = /* 'hrin' */ 0x6872696E, + BMDDeckLinkHasSerialPort = /* 'hspt' */ 0x68737074, + BMDDeckLinkHasAnalogVideoOutputGain = /* 'avog' */ 0x61766F67, + BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain = /* 'ovog' */ 0x6F766F67, + BMDDeckLinkHasVideoInputAntiAliasingFilter = /* 'aafl' */ 0x6161666C, + BMDDeckLinkHasBypass = /* 'byps' */ 0x62797073, + BMDDeckLinkSupportsDesktopDisplay = /* 'extd' */ 0x65787464, + BMDDeckLinkSupportsClockTimingAdjustment = /* 'ctad' */ 0x63746164, + BMDDeckLinkSupportsFullDuplex = /* 'fdup' */ 0x66647570, + BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset = /* 'frin' */ 0x6672696E, + BMDDeckLinkSupportsSMPTELevelAOutput = /* 'lvla' */ 0x6C766C61, + BMDDeckLinkSupportsDualLinkSDI = /* 'sdls' */ 0x73646C73, + BMDDeckLinkSupportsIdleOutput = /* 'idou' */ 0x69646F75, + + /* Integers */ + + BMDDeckLinkMaximumAudioChannels = /* 'mach' */ 0x6D616368, + BMDDeckLinkMaximumAnalogAudioChannels = /* 'aach' */ 0x61616368, + BMDDeckLinkNumberOfSubDevices = /* 'nsbd' */ 0x6E736264, + BMDDeckLinkSubDeviceIndex = /* 'subi' */ 0x73756269, + BMDDeckLinkPersistentID = /* 'peid' */ 0x70656964, + BMDDeckLinkTopologicalID = /* 'toid' */ 0x746F6964, + BMDDeckLinkVideoOutputConnections = /* 'vocn' */ 0x766F636E, + BMDDeckLinkVideoInputConnections = /* 'vicn' */ 0x7669636E, + BMDDeckLinkAudioOutputConnections = /* 'aocn' */ 0x616F636E, + BMDDeckLinkAudioInputConnections = /* 'aicn' */ 0x6169636E, + BMDDeckLinkDeviceBusyState = /* 'dbst' */ 0x64627374, + BMDDeckLinkVideoIOSupport = /* 'vios' */ 0x76696F73, // Returns a BMDVideoIOSupport bit field + + /* Floats */ + + BMDDeckLinkVideoInputGainMinimum = /* 'vigm' */ 0x7669676D, + BMDDeckLinkVideoInputGainMaximum = /* 'vigx' */ 0x76696778, + BMDDeckLinkVideoOutputGainMinimum = /* 'vogm' */ 0x766F676D, + BMDDeckLinkVideoOutputGainMaximum = /* 'vogx' */ 0x766F6778, + + /* Strings */ + + BMDDeckLinkSerialPortDeviceName = /* 'slpn' */ 0x736C706E +}; + +/* Enum BMDDeckLinkAPIInformationID - DeckLinkAPI information ID */ + +typedef uint32_t BMDDeckLinkAPIInformationID; +enum _BMDDeckLinkAPIInformationID { + BMDDeckLinkAPIVersion = /* 'vers' */ 0x76657273 +}; + +/* Enum BMDDeviceBusyState - Current device busy state */ + +typedef uint32_t BMDDeviceBusyState; +enum _BMDDeviceBusyState { + bmdDeviceCaptureBusy = 1 << 0, + bmdDevicePlaybackBusy = 1 << 1, + bmdDeviceSerialPortBusy = 1 << 2 +}; + +/* Enum BMDVideoIOSupport - Device video input/output support */ + +typedef uint32_t BMDVideoIOSupport; +enum _BMDVideoIOSupport { + bmdDeviceSupportsCapture = 1 << 0, + bmdDeviceSupportsPlayback = 1 << 1 +}; + +/* Enum BMD3DPreviewFormat - Linked Frame preview format */ + +typedef uint32_t BMD3DPreviewFormat; +enum _BMD3DPreviewFormat { + bmd3DPreviewFormatDefault = /* 'defa' */ 0x64656661, + bmd3DPreviewFormatLeftOnly = /* 'left' */ 0x6C656674, + bmd3DPreviewFormatRightOnly = /* 'righ' */ 0x72696768, + bmd3DPreviewFormatSideBySide = /* 'side' */ 0x73696465, + bmd3DPreviewFormatTopBottom = /* 'topb' */ 0x746F7062 +}; + +/* Enum BMDNotifications - Events that can be subscribed through IDeckLinkNotification */ + +typedef uint32_t BMDNotifications; +enum _BMDNotifications { + bmdPreferencesChanged = /* 'pref' */ 0x70726566 +}; + +#if defined(__cplusplus) + +// Forward Declarations + +class IDeckLinkVideoOutputCallback; +class IDeckLinkInputCallback; +class IDeckLinkMemoryAllocator; +class IDeckLinkAudioOutputCallback; +class IDeckLinkIterator; +class IDeckLinkAPIInformation; +class IDeckLinkOutput; +class IDeckLinkInput; +class IDeckLinkVideoFrame; +class IDeckLinkMutableVideoFrame; +class IDeckLinkVideoFrame3DExtensions; +class IDeckLinkVideoInputFrame; +class IDeckLinkVideoFrameAncillary; +class IDeckLinkAudioInputPacket; +class IDeckLinkScreenPreviewCallback; +class IDeckLinkGLScreenPreviewHelper; +class IDeckLinkNotificationCallback; +class IDeckLinkNotification; +class IDeckLinkAttributes; +class IDeckLinkKeyer; +class IDeckLinkVideoConversion; +class IDeckLinkDeviceNotificationCallback; +class IDeckLinkDiscovery; + +/* Interface IDeckLinkVideoOutputCallback - Frame completion callback. */ + +class IDeckLinkVideoOutputCallback : public IUnknown +{ +public: + virtual HRESULT ScheduledFrameCompleted (/* in */ IDeckLinkVideoFrame *completedFrame, /* in */ BMDOutputFrameCompletionResult result) = 0; + virtual HRESULT ScheduledPlaybackHasStopped (void) = 0; + +protected: + virtual ~IDeckLinkVideoOutputCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkInputCallback - Frame arrival callback. */ + +class IDeckLinkInputCallback : public IUnknown +{ +public: + virtual HRESULT VideoInputFormatChanged (/* in */ BMDVideoInputFormatChangedEvents notificationEvents, /* in */ IDeckLinkDisplayMode *newDisplayMode, /* in */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + virtual HRESULT VideoInputFrameArrived (/* in */ IDeckLinkVideoInputFrame* videoFrame, /* in */ IDeckLinkAudioInputPacket* audioPacket) = 0; + +protected: + virtual ~IDeckLinkInputCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkMemoryAllocator - Memory allocator for video frames. */ + +class IDeckLinkMemoryAllocator : public IUnknown +{ +public: + virtual HRESULT AllocateBuffer (/* in */ uint32_t bufferSize, /* out */ void **allocatedBuffer) = 0; + virtual HRESULT ReleaseBuffer (/* in */ void *buffer) = 0; + + virtual HRESULT Commit (void) = 0; + virtual HRESULT Decommit (void) = 0; +}; + +/* Interface IDeckLinkAudioOutputCallback - Optional callback to allow audio samples to be pulled as required. */ + +class IDeckLinkAudioOutputCallback : public IUnknown +{ +public: + virtual HRESULT RenderAudioSamples (/* in */ bool preroll) = 0; +}; + +/* Interface IDeckLinkIterator - enumerates installed DeckLink hardware */ + +class IDeckLinkIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLink **deckLinkInstance) = 0; +}; + +/* Interface IDeckLinkAPIInformation - DeckLinkAPI attribute interface */ + +class IDeckLinkAPIInformation : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ double *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAPIInformationID cfgID, /* out */ const char **value) = 0; + +protected: + virtual ~IDeckLinkAPIInformation () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkOutput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkOutput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoOutputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Output */ + + virtual HRESULT EnableVideoOutput (/* in */ BMDDisplayMode displayMode, /* in */ BMDVideoOutputFlags flags) = 0; + virtual HRESULT DisableVideoOutput (void) = 0; + + virtual HRESULT SetVideoOutputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + virtual HRESULT CreateVideoFrame (/* in */ int32_t width, /* in */ int32_t height, /* in */ int32_t rowBytes, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDFrameFlags flags, /* out */ IDeckLinkMutableVideoFrame **outFrame) = 0; + virtual HRESULT CreateAncillaryData (/* in */ BMDPixelFormat pixelFormat, /* out */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT DisplayVideoFrameSync (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + virtual HRESULT ScheduleVideoFrame (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeValue displayTime, /* in */ BMDTimeValue displayDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT SetScheduledFrameCompletionCallback (/* in */ IDeckLinkVideoOutputCallback *theCallback) = 0; + virtual HRESULT GetBufferedVideoFrameCount (/* out */ uint32_t *bufferedFrameCount) = 0; + + /* Audio Output */ + + virtual HRESULT EnableAudioOutput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount, /* in */ BMDAudioOutputStreamType streamType) = 0; + virtual HRESULT DisableAudioOutput (void) = 0; + + virtual HRESULT WriteAudioSamplesSync (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT BeginAudioPreroll (void) = 0; + virtual HRESULT EndAudioPreroll (void) = 0; + virtual HRESULT ScheduleAudioSamples (/* in */ void *buffer, /* in */ uint32_t sampleFrameCount, /* in */ BMDTimeValue streamTime, /* in */ BMDTimeScale timeScale, /* out */ uint32_t *sampleFramesWritten) = 0; + + virtual HRESULT GetBufferedAudioSampleFrameCount (/* out */ uint32_t *bufferedSampleFrameCount) = 0; + virtual HRESULT FlushBufferedAudioSamples (void) = 0; + + virtual HRESULT SetAudioCallback (/* in */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + /* Output Control */ + + virtual HRESULT StartScheduledPlayback (/* in */ BMDTimeValue playbackStartTime, /* in */ BMDTimeScale timeScale, /* in */ double playbackSpeed) = 0; + virtual HRESULT StopScheduledPlayback (/* in */ BMDTimeValue stopPlaybackAtTime, /* out */ BMDTimeValue *actualStopTime, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT IsScheduledPlaybackRunning (/* out */ bool *active) = 0; + virtual HRESULT GetScheduledStreamTime (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *streamTime, /* out */ double *playbackSpeed) = 0; + virtual HRESULT GetReferenceStatus (/* out */ BMDReferenceStatus *referenceStatus) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + virtual HRESULT GetFrameCompletionReferenceTimestamp (/* in */ IDeckLinkVideoFrame *theFrame, /* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *frameCompletionTimestamp) = 0; + +protected: + virtual ~IDeckLinkOutput () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkInput - Created by QueryInterface from IDeckLink. */ + +class IDeckLinkInput : public IUnknown +{ +public: + virtual HRESULT DoesSupportVideoMode (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags, /* out */ BMDDisplayModeSupport *result, /* out */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + virtual HRESULT GetDisplayModeIterator (/* out */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT SetScreenPreviewCallback (/* in */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + /* Video Input */ + + virtual HRESULT EnableVideoInput (/* in */ BMDDisplayMode displayMode, /* in */ BMDPixelFormat pixelFormat, /* in */ BMDVideoInputFlags flags) = 0; + virtual HRESULT DisableVideoInput (void) = 0; + virtual HRESULT GetAvailableVideoFrameCount (/* out */ uint32_t *availableFrameCount) = 0; + virtual HRESULT SetVideoInputFrameMemoryAllocator (/* in */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + /* Audio Input */ + + virtual HRESULT EnableAudioInput (/* in */ BMDAudioSampleRate sampleRate, /* in */ BMDAudioSampleType sampleType, /* in */ uint32_t channelCount) = 0; + virtual HRESULT DisableAudioInput (void) = 0; + virtual HRESULT GetAvailableAudioSampleFrameCount (/* out */ uint32_t *availableSampleFrameCount) = 0; + + /* Input Control */ + + virtual HRESULT StartStreams (void) = 0; + virtual HRESULT StopStreams (void) = 0; + virtual HRESULT PauseStreams (void) = 0; + virtual HRESULT FlushStreams (void) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkInputCallback *theCallback) = 0; + + /* Hardware Timing */ + + virtual HRESULT GetHardwareReferenceClock (/* in */ BMDTimeScale desiredTimeScale, /* out */ BMDTimeValue *hardwareTime, /* out */ BMDTimeValue *timeInFrame, /* out */ BMDTimeValue *ticksPerFrame) = 0; + +protected: + virtual ~IDeckLinkInput () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrame - Interface to encapsulate a video frame; can be caller-implemented. */ + +class IDeckLinkVideoFrame : public IUnknown +{ +public: + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual long GetRowBytes (void) = 0; + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDFrameFlags GetFlags (void) = 0; + virtual HRESULT GetBytes (/* out */ void **buffer) = 0; + + virtual HRESULT GetTimecode (/* in */ BMDTimecodeFormat format, /* out */ IDeckLinkTimecode **timecode) = 0; + virtual HRESULT GetAncillaryData (/* out */ IDeckLinkVideoFrameAncillary **ancillary) = 0; + +protected: + virtual ~IDeckLinkVideoFrame () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkMutableVideoFrame - Created by IDeckLinkOutput::CreateVideoFrame. */ + +class IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame +{ +public: + virtual HRESULT SetFlags (/* in */ BMDFrameFlags newFlags) = 0; + + virtual HRESULT SetTimecode (/* in */ BMDTimecodeFormat format, /* in */ IDeckLinkTimecode *timecode) = 0; + virtual HRESULT SetTimecodeFromComponents (/* in */ BMDTimecodeFormat format, /* in */ uint8_t hours, /* in */ uint8_t minutes, /* in */ uint8_t seconds, /* in */ uint8_t frames, /* in */ BMDTimecodeFlags flags) = 0; + virtual HRESULT SetAncillaryData (/* in */ IDeckLinkVideoFrameAncillary *ancillary) = 0; + virtual HRESULT SetTimecodeUserBits (/* in */ BMDTimecodeFormat format, /* in */ BMDTimecodeUserBits userBits) = 0; + +protected: + virtual ~IDeckLinkMutableVideoFrame () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrame3DExtensions - Optional interface implemented on IDeckLinkVideoFrame to support 3D frames */ + +class IDeckLinkVideoFrame3DExtensions : public IUnknown +{ +public: + virtual BMDVideo3DPackingFormat Get3DPackingFormat (void) = 0; + virtual HRESULT GetFrameForRightEye (/* out */ IDeckLinkVideoFrame* *rightEyeFrame) = 0; + +protected: + virtual ~IDeckLinkVideoFrame3DExtensions () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoInputFrame - Provided by the IDeckLinkVideoInput frame arrival callback. */ + +class IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame +{ +public: + virtual HRESULT GetStreamTime (/* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration, /* in */ BMDTimeScale timeScale) = 0; + virtual HRESULT GetHardwareReferenceTimestamp (/* in */ BMDTimeScale timeScale, /* out */ BMDTimeValue *frameTime, /* out */ BMDTimeValue *frameDuration) = 0; + +protected: + virtual ~IDeckLinkVideoInputFrame () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoFrameAncillary - Obtained through QueryInterface() on an IDeckLinkVideoFrame object. */ + +class IDeckLinkVideoFrameAncillary : public IUnknown +{ +public: + + virtual HRESULT GetBufferForVerticalBlankingLine (/* in */ uint32_t lineNumber, /* out */ void **buffer) = 0; + virtual BMDPixelFormat GetPixelFormat (void) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + +protected: + virtual ~IDeckLinkVideoFrameAncillary () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkAudioInputPacket - Provided by the IDeckLinkInput callback. */ + +class IDeckLinkAudioInputPacket : public IUnknown +{ +public: + virtual long GetSampleFrameCount (void) = 0; + virtual HRESULT GetBytes (/* out */ void **buffer) = 0; + virtual HRESULT GetPacketTime (/* out */ BMDTimeValue *packetTime, /* in */ BMDTimeScale timeScale) = 0; + +protected: + virtual ~IDeckLinkAudioInputPacket () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkScreenPreviewCallback - Screen preview callback */ + +class IDeckLinkScreenPreviewCallback : public IUnknown +{ +public: + virtual HRESULT DrawFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + +protected: + virtual ~IDeckLinkScreenPreviewCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkGLScreenPreviewHelper - Created with CoCreateInstance(). */ + +class IDeckLinkGLScreenPreviewHelper : public IUnknown +{ +public: + + /* Methods must be called with OpenGL context set */ + + virtual HRESULT InitializeGL (void) = 0; + virtual HRESULT PaintGL (void) = 0; + virtual HRESULT SetFrame (/* in */ IDeckLinkVideoFrame *theFrame) = 0; + virtual HRESULT Set3DPreviewFormat (/* in */ BMD3DPreviewFormat previewFormat) = 0; + +protected: + virtual ~IDeckLinkGLScreenPreviewHelper () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkNotificationCallback - DeckLink Notification Callback Interface */ + +class IDeckLinkNotificationCallback : public IUnknown +{ +public: + virtual HRESULT Notify (/* in */ BMDNotifications topic, /* in */ uint64_t param1, /* in */ uint64_t param2) = 0; +}; + +/* Interface IDeckLinkNotification - DeckLink Notification interface */ + +class IDeckLinkNotification : public IUnknown +{ +public: + virtual HRESULT Subscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0; + virtual HRESULT Unsubscribe (/* in */ BMDNotifications topic, /* in */ IDeckLinkNotificationCallback *theCallback) = 0; +}; + +/* Interface IDeckLinkAttributes - DeckLink Attribute interface */ + +class IDeckLinkAttributes : public IUnknown +{ +public: + virtual HRESULT GetFlag (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ bool *value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ double *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkAttributeID cfgID, /* out */ const char **value) = 0; + +protected: + virtual ~IDeckLinkAttributes () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkKeyer - DeckLink Keyer interface */ + +class IDeckLinkKeyer : public IUnknown +{ +public: + virtual HRESULT Enable (/* in */ bool isExternal) = 0; + virtual HRESULT SetLevel (/* in */ uint8_t level) = 0; + virtual HRESULT RampUp (/* in */ uint32_t numberOfFrames) = 0; + virtual HRESULT RampDown (/* in */ uint32_t numberOfFrames) = 0; + virtual HRESULT Disable (void) = 0; + +protected: + virtual ~IDeckLinkKeyer () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkVideoConversion - Created with CoCreateInstance(). */ + +class IDeckLinkVideoConversion : public IUnknown +{ +public: + virtual HRESULT ConvertFrame (/* in */ IDeckLinkVideoFrame* srcFrame, /* in */ IDeckLinkVideoFrame* dstFrame) = 0; + +protected: + virtual ~IDeckLinkVideoConversion () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDeviceNotificationCallback - DeckLink device arrival/removal notification callbacks */ + +class IDeckLinkDeviceNotificationCallback : public IUnknown +{ +public: + virtual HRESULT DeckLinkDeviceArrived (/* in */ IDeckLink* deckLinkDevice) = 0; + virtual HRESULT DeckLinkDeviceRemoved (/* in */ IDeckLink* deckLinkDevice) = 0; + +protected: + virtual ~IDeckLinkDeviceNotificationCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDiscovery - DeckLink device discovery */ + +class IDeckLinkDiscovery : public IUnknown +{ +public: + virtual HRESULT InstallDeviceNotifications (/* in */ IDeckLinkDeviceNotificationCallback* deviceNotificationCallback) = 0; + virtual HRESULT UninstallDeviceNotifications (void) = 0; + +protected: + virtual ~IDeckLinkDiscovery () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + IDeckLinkIterator* CreateDeckLinkIteratorInstance (void); + IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void); + IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void); + IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void); + IDeckLinkVideoConversion* CreateVideoConversionInstance (void); + bool IsDeckLinkAPIPresent (void); +} + + +#endif // defined(__cplusplus) +#endif /* defined(BMD_DECKLINKAPI_H) */ diff --git a/intern/decklink/linux/DeckLinkAPIConfiguration.h b/intern/decklink/linux/DeckLinkAPIConfiguration.h new file mode 100644 index 00000000000..9d5bc9a9e1b --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPIConfiguration.h @@ -0,0 +1,192 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPICONFIGURATION_H +#define BMD_DECKLINKAPICONFIGURATION_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkConfiguration = /* 1E69FCF6-4203-4936-8076-2A9F4CFD50CB */ {0x1E,0x69,0xFC,0xF6,0x42,0x03,0x49,0x36,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB}; + +/* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */ + +typedef uint32_t BMDDeckLinkConfigurationID; +enum _BMDDeckLinkConfigurationID { + + /* Serial port Flags */ + + bmdDeckLinkConfigSwapSerialRxTx = /* 'ssrt' */ 0x73737274, + + /* Video Input/Output Flags */ + + bmdDeckLinkConfigUse1080pNotPsF = /* 'fpro' */ 0x6670726F, + + /* Video Input/Output Integers */ + + bmdDeckLinkConfigHDMI3DPackingFormat = /* '3dpf' */ 0x33647066, + bmdDeckLinkConfigBypass = /* 'byps' */ 0x62797073, + bmdDeckLinkConfigClockTimingAdjustment = /* 'ctad' */ 0x63746164, + + /* Audio Input/Output Flags */ + + bmdDeckLinkConfigAnalogAudioConsumerLevels = /* 'aacl' */ 0x6161636C, + + /* Video output flags */ + + bmdDeckLinkConfigFieldFlickerRemoval = /* 'fdfr' */ 0x66646672, + bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion = /* 'to59' */ 0x746F3539, + bmdDeckLinkConfig444SDIVideoOutput = /* '444o' */ 0x3434346F, + bmdDeckLinkConfigSingleLinkVideoOutput = /* 'sglo' */ 0x73676C6F, + bmdDeckLinkConfigBlackVideoOutputDuringCapture = /* 'bvoc' */ 0x62766F63, + bmdDeckLinkConfigLowLatencyVideoOutput = /* 'llvo' */ 0x6C6C766F, + bmdDeckLinkConfigDownConversionOnAllAnalogOutput = /* 'caao' */ 0x6361616F, + bmdDeckLinkConfigSMPTELevelAOutput = /* 'smta' */ 0x736D7461, + + /* Video Output Integers */ + + bmdDeckLinkConfigVideoOutputConnection = /* 'vocn' */ 0x766F636E, + bmdDeckLinkConfigVideoOutputConversionMode = /* 'vocm' */ 0x766F636D, + bmdDeckLinkConfigAnalogVideoOutputFlags = /* 'avof' */ 0x61766F66, + bmdDeckLinkConfigReferenceInputTimingOffset = /* 'glot' */ 0x676C6F74, + bmdDeckLinkConfigVideoOutputIdleOperation = /* 'voio' */ 0x766F696F, + bmdDeckLinkConfigDefaultVideoOutputMode = /* 'dvom' */ 0x64766F6D, + bmdDeckLinkConfigDefaultVideoOutputModeFlags = /* 'dvof' */ 0x64766F66, + + /* Video Output Floats */ + + bmdDeckLinkConfigVideoOutputComponentLumaGain = /* 'oclg' */ 0x6F636C67, + bmdDeckLinkConfigVideoOutputComponentChromaBlueGain = /* 'occb' */ 0x6F636362, + bmdDeckLinkConfigVideoOutputComponentChromaRedGain = /* 'occr' */ 0x6F636372, + bmdDeckLinkConfigVideoOutputCompositeLumaGain = /* 'oilg' */ 0x6F696C67, + bmdDeckLinkConfigVideoOutputCompositeChromaGain = /* 'oicg' */ 0x6F696367, + bmdDeckLinkConfigVideoOutputSVideoLumaGain = /* 'oslg' */ 0x6F736C67, + bmdDeckLinkConfigVideoOutputSVideoChromaGain = /* 'oscg' */ 0x6F736367, + + /* Video Input Flags */ + + bmdDeckLinkConfigVideoInputScanning = /* 'visc' */ 0x76697363, // Applicable to H264 Pro Recorder only + bmdDeckLinkConfigUseDedicatedLTCInput = /* 'dltc' */ 0x646C7463, // Use timecode from LTC input instead of SDI stream + + /* Video Input Integers */ + + bmdDeckLinkConfigVideoInputConnection = /* 'vicn' */ 0x7669636E, + bmdDeckLinkConfigAnalogVideoInputFlags = /* 'avif' */ 0x61766966, + bmdDeckLinkConfigVideoInputConversionMode = /* 'vicm' */ 0x7669636D, + bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame = /* 'pdif' */ 0x70646966, + bmdDeckLinkConfigVANCSourceLine1Mapping = /* 'vsl1' */ 0x76736C31, + bmdDeckLinkConfigVANCSourceLine2Mapping = /* 'vsl2' */ 0x76736C32, + bmdDeckLinkConfigVANCSourceLine3Mapping = /* 'vsl3' */ 0x76736C33, + bmdDeckLinkConfigCapturePassThroughMode = /* 'cptm' */ 0x6370746D, + + /* Video Input Floats */ + + bmdDeckLinkConfigVideoInputComponentLumaGain = /* 'iclg' */ 0x69636C67, + bmdDeckLinkConfigVideoInputComponentChromaBlueGain = /* 'iccb' */ 0x69636362, + bmdDeckLinkConfigVideoInputComponentChromaRedGain = /* 'iccr' */ 0x69636372, + bmdDeckLinkConfigVideoInputCompositeLumaGain = /* 'iilg' */ 0x69696C67, + bmdDeckLinkConfigVideoInputCompositeChromaGain = /* 'iicg' */ 0x69696367, + bmdDeckLinkConfigVideoInputSVideoLumaGain = /* 'islg' */ 0x69736C67, + bmdDeckLinkConfigVideoInputSVideoChromaGain = /* 'iscg' */ 0x69736367, + + /* Audio Input Integers */ + + bmdDeckLinkConfigAudioInputConnection = /* 'aicn' */ 0x6169636E, + + /* Audio Input Floats */ + + bmdDeckLinkConfigAnalogAudioInputScaleChannel1 = /* 'ais1' */ 0x61697331, + bmdDeckLinkConfigAnalogAudioInputScaleChannel2 = /* 'ais2' */ 0x61697332, + bmdDeckLinkConfigAnalogAudioInputScaleChannel3 = /* 'ais3' */ 0x61697333, + bmdDeckLinkConfigAnalogAudioInputScaleChannel4 = /* 'ais4' */ 0x61697334, + bmdDeckLinkConfigDigitalAudioInputScale = /* 'dais' */ 0x64616973, + + /* Audio Output Integers */ + + bmdDeckLinkConfigAudioOutputAESAnalogSwitch = /* 'aoaa' */ 0x616F6161, + + /* Audio Output Floats */ + + bmdDeckLinkConfigAnalogAudioOutputScaleChannel1 = /* 'aos1' */ 0x616F7331, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel2 = /* 'aos2' */ 0x616F7332, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel3 = /* 'aos3' */ 0x616F7333, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel4 = /* 'aos4' */ 0x616F7334, + bmdDeckLinkConfigDigitalAudioOutputScale = /* 'daos' */ 0x64616F73, + + /* Device Information Strings */ + + bmdDeckLinkConfigDeviceInformationLabel = /* 'dila' */ 0x64696C61, + bmdDeckLinkConfigDeviceInformationSerialNumber = /* 'disn' */ 0x6469736E, + bmdDeckLinkConfigDeviceInformationCompany = /* 'dico' */ 0x6469636F, + bmdDeckLinkConfigDeviceInformationPhone = /* 'diph' */ 0x64697068, + bmdDeckLinkConfigDeviceInformationEmail = /* 'diem' */ 0x6469656D, + bmdDeckLinkConfigDeviceInformationDate = /* 'dida' */ 0x64696461 +}; + +// Forward Declarations + +class IDeckLinkConfiguration; + +/* Interface IDeckLinkConfiguration - DeckLink Configuration interface */ + +class IDeckLinkConfiguration : public IUnknown +{ +public: + virtual HRESULT SetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ bool value) = 0; + virtual HRESULT GetFlag (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ bool *value) = 0; + virtual HRESULT SetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ int64_t value) = 0; + virtual HRESULT GetInt (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ int64_t *value) = 0; + virtual HRESULT SetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ double value) = 0; + virtual HRESULT GetFloat (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ double *value) = 0; + virtual HRESULT SetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* in */ const char *value) = 0; + virtual HRESULT GetString (/* in */ BMDDeckLinkConfigurationID cfgID, /* out */ const char **value) = 0; + virtual HRESULT WriteConfigurationToPreferences (void) = 0; + +protected: + virtual ~IDeckLinkConfiguration () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + +#endif /* defined(BMD_DECKLINKAPICONFIGURATION_H) */ diff --git a/intern/decklink/linux/DeckLinkAPIDeckControl.h b/intern/decklink/linux/DeckLinkAPIDeckControl.h new file mode 100644 index 00000000000..b83d013129e --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPIDeckControl.h @@ -0,0 +1,215 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIDECKCONTROL_H +#define BMD_DECKLINKAPIDECKCONTROL_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkDeckControlStatusCallback = /* 53436FFB-B434-4906-BADC-AE3060FFE8EF */ {0x53,0x43,0x6F,0xFB,0xB4,0x34,0x49,0x06,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF}; +BMD_CONST REFIID IID_IDeckLinkDeckControl = /* 8E1C3ACE-19C7-4E00-8B92-D80431D958BE */ {0x8E,0x1C,0x3A,0xCE,0x19,0xC7,0x4E,0x00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE}; + +/* Enum BMDDeckControlMode - DeckControl mode */ + +typedef uint32_t BMDDeckControlMode; +enum _BMDDeckControlMode { + bmdDeckControlNotOpened = /* 'ntop' */ 0x6E746F70, + bmdDeckControlVTRControlMode = /* 'vtrc' */ 0x76747263, + bmdDeckControlExportMode = /* 'expm' */ 0x6578706D, + bmdDeckControlCaptureMode = /* 'capm' */ 0x6361706D +}; + +/* Enum BMDDeckControlEvent - DeckControl event */ + +typedef uint32_t BMDDeckControlEvent; +enum _BMDDeckControlEvent { + bmdDeckControlAbortedEvent = /* 'abte' */ 0x61627465, // This event is triggered when a capture or edit-to-tape operation is aborted. + + /* Export-To-Tape events */ + + bmdDeckControlPrepareForExportEvent = /* 'pfee' */ 0x70666565, // This event is triggered a few frames before reaching the in-point. IDeckLinkInput::StartScheduledPlayback() should be called at this point. + bmdDeckControlExportCompleteEvent = /* 'exce' */ 0x65786365, // This event is triggered a few frames after reaching the out-point. At this point, it is safe to stop playback. + + /* Capture events */ + + bmdDeckControlPrepareForCaptureEvent = /* 'pfce' */ 0x70666365, // This event is triggered a few frames before reaching the in-point. The serial timecode attached to IDeckLinkVideoInputFrames is now valid. + bmdDeckControlCaptureCompleteEvent = /* 'ccev' */ 0x63636576 // This event is triggered a few frames after reaching the out-point. +}; + +/* Enum BMDDeckControlVTRControlState - VTR Control state */ + +typedef uint32_t BMDDeckControlVTRControlState; +enum _BMDDeckControlVTRControlState { + bmdDeckControlNotInVTRControlMode = /* 'nvcm' */ 0x6E76636D, + bmdDeckControlVTRControlPlaying = /* 'vtrp' */ 0x76747270, + bmdDeckControlVTRControlRecording = /* 'vtrr' */ 0x76747272, + bmdDeckControlVTRControlStill = /* 'vtra' */ 0x76747261, + bmdDeckControlVTRControlShuttleForward = /* 'vtsf' */ 0x76747366, + bmdDeckControlVTRControlShuttleReverse = /* 'vtsr' */ 0x76747372, + bmdDeckControlVTRControlJogForward = /* 'vtjf' */ 0x76746A66, + bmdDeckControlVTRControlJogReverse = /* 'vtjr' */ 0x76746A72, + bmdDeckControlVTRControlStopped = /* 'vtro' */ 0x7674726F +}; + +/* Enum BMDDeckControlStatusFlags - Deck Control status flags */ + +typedef uint32_t BMDDeckControlStatusFlags; +enum _BMDDeckControlStatusFlags { + bmdDeckControlStatusDeckConnected = 1 << 0, + bmdDeckControlStatusRemoteMode = 1 << 1, + bmdDeckControlStatusRecordInhibited = 1 << 2, + bmdDeckControlStatusCassetteOut = 1 << 3 +}; + +/* Enum BMDDeckControlExportModeOpsFlags - Export mode flags */ + +typedef uint32_t BMDDeckControlExportModeOpsFlags; +enum _BMDDeckControlExportModeOpsFlags { + bmdDeckControlExportModeInsertVideo = 1 << 0, + bmdDeckControlExportModeInsertAudio1 = 1 << 1, + bmdDeckControlExportModeInsertAudio2 = 1 << 2, + bmdDeckControlExportModeInsertAudio3 = 1 << 3, + bmdDeckControlExportModeInsertAudio4 = 1 << 4, + bmdDeckControlExportModeInsertAudio5 = 1 << 5, + bmdDeckControlExportModeInsertAudio6 = 1 << 6, + bmdDeckControlExportModeInsertAudio7 = 1 << 7, + bmdDeckControlExportModeInsertAudio8 = 1 << 8, + bmdDeckControlExportModeInsertAudio9 = 1 << 9, + bmdDeckControlExportModeInsertAudio10 = 1 << 10, + bmdDeckControlExportModeInsertAudio11 = 1 << 11, + bmdDeckControlExportModeInsertAudio12 = 1 << 12, + bmdDeckControlExportModeInsertTimeCode = 1 << 13, + bmdDeckControlExportModeInsertAssemble = 1 << 14, + bmdDeckControlExportModeInsertPreview = 1 << 15, + bmdDeckControlUseManualExport = 1 << 16 +}; + +/* Enum BMDDeckControlError - Deck Control error */ + +typedef uint32_t BMDDeckControlError; +enum _BMDDeckControlError { + bmdDeckControlNoError = /* 'noer' */ 0x6E6F6572, + bmdDeckControlModeError = /* 'moer' */ 0x6D6F6572, + bmdDeckControlMissedInPointError = /* 'mier' */ 0x6D696572, + bmdDeckControlDeckTimeoutError = /* 'dter' */ 0x64746572, + bmdDeckControlCommandFailedError = /* 'cfer' */ 0x63666572, + bmdDeckControlDeviceAlreadyOpenedError = /* 'dalo' */ 0x64616C6F, + bmdDeckControlFailedToOpenDeviceError = /* 'fder' */ 0x66646572, + bmdDeckControlInLocalModeError = /* 'lmer' */ 0x6C6D6572, + bmdDeckControlEndOfTapeError = /* 'eter' */ 0x65746572, + bmdDeckControlUserAbortError = /* 'uaer' */ 0x75616572, + bmdDeckControlNoTapeInDeckError = /* 'nter' */ 0x6E746572, + bmdDeckControlNoVideoFromCardError = /* 'nvfc' */ 0x6E766663, + bmdDeckControlNoCommunicationError = /* 'ncom' */ 0x6E636F6D, + bmdDeckControlBufferTooSmallError = /* 'btsm' */ 0x6274736D, + bmdDeckControlBadChecksumError = /* 'chks' */ 0x63686B73, + bmdDeckControlUnknownError = /* 'uner' */ 0x756E6572 +}; + +// Forward Declarations + +class IDeckLinkDeckControlStatusCallback; +class IDeckLinkDeckControl; + +/* Interface IDeckLinkDeckControlStatusCallback - Deck control state change callback. */ + +class IDeckLinkDeckControlStatusCallback : public IUnknown +{ +public: + virtual HRESULT TimecodeUpdate (/* in */ BMDTimecodeBCD currentTimecode) = 0; + virtual HRESULT VTRControlStateChanged (/* in */ BMDDeckControlVTRControlState newState, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlEventReceived (/* in */ BMDDeckControlEvent event, /* in */ BMDDeckControlError error) = 0; + virtual HRESULT DeckControlStatusChanged (/* in */ BMDDeckControlStatusFlags flags, /* in */ uint32_t mask) = 0; + +protected: + virtual ~IDeckLinkDeckControlStatusCallback () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDeckControl - Deck Control main interface */ + +class IDeckLinkDeckControl : public IUnknown +{ +public: + virtual HRESULT Open (/* in */ BMDTimeScale timeScale, /* in */ BMDTimeValue timeValue, /* in */ bool timecodeIsDropFrame, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Close (/* in */ bool standbyOn) = 0; + virtual HRESULT GetCurrentState (/* out */ BMDDeckControlMode *mode, /* out */ BMDDeckControlVTRControlState *vtrControlState, /* out */ BMDDeckControlStatusFlags *flags) = 0; + virtual HRESULT SetStandby (/* in */ bool standbyOn) = 0; + virtual HRESULT SendCommand (/* in */ uint8_t *inBuffer, /* in */ uint32_t inBufferSize, /* out */ uint8_t *outBuffer, /* out */ uint32_t *outDataSize, /* in */ uint32_t outBufferSize, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Play (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Stop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT TogglePlayStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Eject (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GoToTimecode (/* in */ BMDTimecodeBCD timecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT FastForward (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Rewind (/* in */ bool viewTape, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepForward (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StepBack (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Jog (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Shuttle (/* in */ double rate, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeString (/* out */ const char **currentTimeCode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecode (/* out */ IDeckLinkTimecode **currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetTimecodeBCD (/* out */ BMDTimecodeBCD *currentTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetPreroll (/* in */ uint32_t prerollSeconds) = 0; + virtual HRESULT GetPreroll (/* out */ uint32_t *prerollSeconds) = 0; + virtual HRESULT SetExportOffset (/* in */ int32_t exportOffsetFields) = 0; + virtual HRESULT GetExportOffset (/* out */ int32_t *exportOffsetFields) = 0; + virtual HRESULT GetManualExportOffset (/* out */ int32_t *deckManualExportOffsetFields) = 0; + virtual HRESULT SetCaptureOffset (/* in */ int32_t captureOffsetFields) = 0; + virtual HRESULT GetCaptureOffset (/* out */ int32_t *captureOffsetFields) = 0; + virtual HRESULT StartExport (/* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* in */ BMDDeckControlExportModeOpsFlags exportModeOps, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT StartCapture (/* in */ bool useVITC, /* in */ BMDTimecodeBCD inTimecode, /* in */ BMDTimecodeBCD outTimecode, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT GetDeviceID (/* out */ uint16_t *deviceId, /* out */ BMDDeckControlError *error) = 0; + virtual HRESULT Abort (void) = 0; + virtual HRESULT CrashRecordStart (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT CrashRecordStop (/* out */ BMDDeckControlError *error) = 0; + virtual HRESULT SetCallback (/* in */ IDeckLinkDeckControlStatusCallback *callback) = 0; + +protected: + virtual ~IDeckLinkDeckControl () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + +#endif /* defined(BMD_DECKLINKAPIDECKCONTROL_H) */ diff --git a/intern/decklink/linux/DeckLinkAPIDiscovery.h b/intern/decklink/linux/DeckLinkAPIDiscovery.h new file mode 100644 index 00000000000..424d9d54b39 --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPIDiscovery.h @@ -0,0 +1,71 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIDISCOVERY_H +#define BMD_DECKLINKAPIDISCOVERY_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLink = /* C418FBDD-0587-48ED-8FE5-640F0A14AF91 */ {0xC4,0x18,0xFB,0xDD,0x05,0x87,0x48,0xED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91}; + +// Forward Declarations + +class IDeckLink; + +/* Interface IDeckLink - represents a DeckLink device */ + +class IDeckLink : public IUnknown +{ +public: + virtual HRESULT GetModelName (/* out */ const char **modelName) = 0; + virtual HRESULT GetDisplayName (/* out */ const char **displayName) = 0; + +protected: + virtual ~IDeckLink () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + +#endif /* defined(BMD_DECKLINKAPIDISCOVERY_H) */ diff --git a/intern/decklink/linux/DeckLinkAPIDispatch.cpp b/intern/decklink/linux/DeckLinkAPIDispatch.cpp new file mode 100644 index 00000000000..3cf53f109ac --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPIDispatch.cpp @@ -0,0 +1,148 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +**/ + +#include <stdlib.h> +#include <stdio.h> +#include <pthread.h> +#include <dlfcn.h> +#include <ctype.h> + +#include "DeckLinkAPI.h" + +#define kDeckLinkAPI_Name "libDeckLinkAPI.so" +#define KDeckLinkPreviewAPI_Name "libDeckLinkPreviewAPI.so" + +typedef IDeckLinkIterator* (*CreateIteratorFunc)(void); +typedef IDeckLinkAPIInformation* (*CreateAPIInformationFunc)(void); +typedef IDeckLinkGLScreenPreviewHelper* (*CreateOpenGLScreenPreviewHelperFunc)(void); +typedef IDeckLinkVideoConversion* (*CreateVideoConversionInstanceFunc)(void); +typedef IDeckLinkDiscovery* (*CreateDeckLinkDiscoveryInstanceFunc)(void); + +static pthread_once_t gDeckLinkOnceControl = PTHREAD_ONCE_INIT; +static pthread_once_t gPreviewOnceControl = PTHREAD_ONCE_INIT; + +static bool gLoadedDeckLinkAPI = false; + +static CreateIteratorFunc gCreateIteratorFunc = NULL; +static CreateAPIInformationFunc gCreateAPIInformationFunc = NULL; +static CreateOpenGLScreenPreviewHelperFunc gCreateOpenGLPreviewFunc = NULL; +static CreateVideoConversionInstanceFunc gCreateVideoConversionFunc = NULL; +static CreateDeckLinkDiscoveryInstanceFunc gCreateDeckLinkDiscoveryFunc = NULL; + +static void InitDeckLinkAPI (void) +{ + void *libraryHandle; + + libraryHandle = dlopen(kDeckLinkAPI_Name, RTLD_NOW|RTLD_GLOBAL); + if (!libraryHandle) + { + fprintf(stderr, "%s\n", dlerror()); + return; + } + + gLoadedDeckLinkAPI = true; + + gCreateIteratorFunc = (CreateIteratorFunc)dlsym(libraryHandle, "CreateDeckLinkIteratorInstance_0002"); + if (!gCreateIteratorFunc) + fprintf(stderr, "%s\n", dlerror()); + gCreateAPIInformationFunc = (CreateAPIInformationFunc)dlsym(libraryHandle, "CreateDeckLinkAPIInformationInstance_0001"); + if (!gCreateAPIInformationFunc) + fprintf(stderr, "%s\n", dlerror()); + gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc)dlsym(libraryHandle, "CreateVideoConversionInstance_0001"); + if (!gCreateVideoConversionFunc) + fprintf(stderr, "%s\n", dlerror()); + gCreateDeckLinkDiscoveryFunc = (CreateDeckLinkDiscoveryInstanceFunc)dlsym(libraryHandle, "CreateDeckLinkDiscoveryInstance_0001"); + if (!gCreateDeckLinkDiscoveryFunc) + fprintf(stderr, "%s\n", dlerror()); +} + +static void InitDeckLinkPreviewAPI (void) +{ + void *libraryHandle; + + libraryHandle = dlopen(KDeckLinkPreviewAPI_Name, RTLD_NOW|RTLD_GLOBAL); + if (!libraryHandle) + { + fprintf(stderr, "%s\n", dlerror()); + return; + } + gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc)dlsym(libraryHandle, "CreateOpenGLScreenPreviewHelper_0001"); + if (!gCreateOpenGLPreviewFunc) + fprintf(stderr, "%s\n", dlerror()); +} + +bool IsDeckLinkAPIPresent (void) +{ + // If the DeckLink API dynamic library was successfully loaded, return this knowledge to the caller + return gLoadedDeckLinkAPI; +} + +IDeckLinkIterator* CreateDeckLinkIteratorInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateIteratorFunc == NULL) + return NULL; + return gCreateIteratorFunc(); +} + +IDeckLinkAPIInformation* CreateDeckLinkAPIInformationInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateAPIInformationFunc == NULL) + return NULL; + return gCreateAPIInformationFunc(); +} + +IDeckLinkGLScreenPreviewHelper* CreateOpenGLScreenPreviewHelper (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + pthread_once(&gPreviewOnceControl, InitDeckLinkPreviewAPI); + + if (gCreateOpenGLPreviewFunc == NULL) + return NULL; + return gCreateOpenGLPreviewFunc(); +} + +IDeckLinkVideoConversion* CreateVideoConversionInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateVideoConversionFunc == NULL) + return NULL; + return gCreateVideoConversionFunc(); +} + +IDeckLinkDiscovery* CreateDeckLinkDiscoveryInstance (void) +{ + pthread_once(&gDeckLinkOnceControl, InitDeckLinkAPI); + + if (gCreateDeckLinkDiscoveryFunc == NULL) + return NULL; + return gCreateDeckLinkDiscoveryFunc(); +} diff --git a/intern/decklink/linux/DeckLinkAPIModes.h b/intern/decklink/linux/DeckLinkAPIModes.h new file mode 100644 index 00000000000..394d68c3078 --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPIModes.h @@ -0,0 +1,191 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPIMODES_H +#define BMD_DECKLINKAPIMODES_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +// Type Declarations + + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkDisplayModeIterator = /* 9C88499F-F601-4021-B80B-032E4EB41C35 */ {0x9C,0x88,0x49,0x9F,0xF6,0x01,0x40,0x21,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35}; +BMD_CONST REFIID IID_IDeckLinkDisplayMode = /* 3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78 */ {0x3E,0xB2,0xC1,0xAB,0x0A,0x3D,0x45,0x23,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78}; + +/* Enum BMDDisplayMode - Video display modes */ + +typedef uint32_t BMDDisplayMode; +enum _BMDDisplayMode { + + /* SD Modes */ + + bmdModeNTSC = /* 'ntsc' */ 0x6E747363, + bmdModeNTSC2398 = /* 'nt23' */ 0x6E743233, // 3:2 pulldown + bmdModePAL = /* 'pal ' */ 0x70616C20, + bmdModeNTSCp = /* 'ntsp' */ 0x6E747370, + bmdModePALp = /* 'palp' */ 0x70616C70, + + /* HD 1080 Modes */ + + bmdModeHD1080p2398 = /* '23ps' */ 0x32337073, + bmdModeHD1080p24 = /* '24ps' */ 0x32347073, + bmdModeHD1080p25 = /* 'Hp25' */ 0x48703235, + bmdModeHD1080p2997 = /* 'Hp29' */ 0x48703239, + bmdModeHD1080p30 = /* 'Hp30' */ 0x48703330, + bmdModeHD1080i50 = /* 'Hi50' */ 0x48693530, + bmdModeHD1080i5994 = /* 'Hi59' */ 0x48693539, + bmdModeHD1080i6000 = /* 'Hi60' */ 0x48693630, // N.B. This _really_ is 60.00 Hz. + bmdModeHD1080p50 = /* 'Hp50' */ 0x48703530, + bmdModeHD1080p5994 = /* 'Hp59' */ 0x48703539, + bmdModeHD1080p6000 = /* 'Hp60' */ 0x48703630, // N.B. This _really_ is 60.00 Hz. + + /* HD 720 Modes */ + + bmdModeHD720p50 = /* 'hp50' */ 0x68703530, + bmdModeHD720p5994 = /* 'hp59' */ 0x68703539, + bmdModeHD720p60 = /* 'hp60' */ 0x68703630, + + /* 2k Modes */ + + bmdMode2k2398 = /* '2k23' */ 0x326B3233, + bmdMode2k24 = /* '2k24' */ 0x326B3234, + bmdMode2k25 = /* '2k25' */ 0x326B3235, + + /* DCI Modes (output only) */ + + bmdMode2kDCI2398 = /* '2d23' */ 0x32643233, + bmdMode2kDCI24 = /* '2d24' */ 0x32643234, + bmdMode2kDCI25 = /* '2d25' */ 0x32643235, + + /* 4k Modes */ + + bmdMode4K2160p2398 = /* '4k23' */ 0x346B3233, + bmdMode4K2160p24 = /* '4k24' */ 0x346B3234, + bmdMode4K2160p25 = /* '4k25' */ 0x346B3235, + bmdMode4K2160p2997 = /* '4k29' */ 0x346B3239, + bmdMode4K2160p30 = /* '4k30' */ 0x346B3330, + bmdMode4K2160p50 = /* '4k50' */ 0x346B3530, + bmdMode4K2160p5994 = /* '4k59' */ 0x346B3539, + bmdMode4K2160p60 = /* '4k60' */ 0x346B3630, + + /* DCI Modes (output only) */ + + bmdMode4kDCI2398 = /* '4d23' */ 0x34643233, + bmdMode4kDCI24 = /* '4d24' */ 0x34643234, + bmdMode4kDCI25 = /* '4d25' */ 0x34643235, + + /* Special Modes */ + + bmdModeUnknown = /* 'iunk' */ 0x69756E6B +}; + +/* Enum BMDFieldDominance - Video field dominance */ + +typedef uint32_t BMDFieldDominance; +enum _BMDFieldDominance { + bmdUnknownFieldDominance = 0, + bmdLowerFieldFirst = /* 'lowr' */ 0x6C6F7772, + bmdUpperFieldFirst = /* 'uppr' */ 0x75707072, + bmdProgressiveFrame = /* 'prog' */ 0x70726F67, + bmdProgressiveSegmentedFrame = /* 'psf ' */ 0x70736620 +}; + +/* Enum BMDPixelFormat - Video pixel formats supported for output/input */ + +typedef uint32_t BMDPixelFormat; +enum _BMDPixelFormat { + bmdFormat8BitYUV = /* '2vuy' */ 0x32767579, + bmdFormat10BitYUV = /* 'v210' */ 0x76323130, + bmdFormat8BitARGB = 32, + bmdFormat8BitBGRA = /* 'BGRA' */ 0x42475241, + bmdFormat10BitRGB = /* 'r210' */ 0x72323130, // Big-endian RGB 10-bit per component with SMPTE video levels (64-960). Packed as 2:10:10:10 + bmdFormat12BitRGB = /* 'R12B' */ 0x52313242, // Big-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component + bmdFormat12BitRGBLE = /* 'R12L' */ 0x5231324C, // Little-endian RGB 12-bit per component with full range (0-4095). Packed as 12-bit per component + bmdFormat10BitRGBXLE = /* 'R10l' */ 0x5231306C, // Little-endian 10-bit RGB with SMPTE video levels (64-940) + bmdFormat10BitRGBX = /* 'R10b' */ 0x52313062 // Big-endian 10-bit RGB with SMPTE video levels (64-940) +}; + +/* Enum BMDDisplayModeFlags - Flags to describe the characteristics of an IDeckLinkDisplayMode. */ + +typedef uint32_t BMDDisplayModeFlags; +enum _BMDDisplayModeFlags { + bmdDisplayModeSupports3D = 1 << 0, + bmdDisplayModeColorspaceRec601 = 1 << 1, + bmdDisplayModeColorspaceRec709 = 1 << 2 +}; + +// Forward Declarations + +class IDeckLinkDisplayModeIterator; +class IDeckLinkDisplayMode; + +/* Interface IDeckLinkDisplayModeIterator - enumerates over supported input/output display modes. */ + +class IDeckLinkDisplayModeIterator : public IUnknown +{ +public: + virtual HRESULT Next (/* out */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0; + +protected: + virtual ~IDeckLinkDisplayModeIterator () {} // call Release method to drop reference count +}; + +/* Interface IDeckLinkDisplayMode - represents a display mode */ + +class IDeckLinkDisplayMode : public IUnknown +{ +public: + virtual HRESULT GetName (/* out */ const char **name) = 0; + virtual BMDDisplayMode GetDisplayMode (void) = 0; + virtual long GetWidth (void) = 0; + virtual long GetHeight (void) = 0; + virtual HRESULT GetFrameRate (/* out */ BMDTimeValue *frameDuration, /* out */ BMDTimeScale *timeScale) = 0; + virtual BMDFieldDominance GetFieldDominance (void) = 0; + virtual BMDDisplayModeFlags GetFlags (void) = 0; + +protected: + virtual ~IDeckLinkDisplayMode () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + +#endif /* defined(BMD_DECKLINKAPIMODES_H) */ diff --git a/intern/decklink/linux/DeckLinkAPITypes.h b/intern/decklink/linux/DeckLinkAPITypes.h new file mode 100644 index 00000000000..55e015f2a3c --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPITypes.h @@ -0,0 +1,110 @@ +/* -LICENSE-START- +** Copyright (c) 2014 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef BMD_DECKLINKAPITYPES_H +#define BMD_DECKLINKAPITYPES_H + + +#ifndef BMD_CONST + #if defined(_MSC_VER) + #define BMD_CONST __declspec(selectany) static const + #else + #define BMD_CONST static const + #endif +#endif + +// Type Declarations + +typedef int64_t BMDTimeValue; +typedef int64_t BMDTimeScale; +typedef uint32_t BMDTimecodeBCD; +typedef uint32_t BMDTimecodeUserBits; + +// Interface ID Declarations + +BMD_CONST REFIID IID_IDeckLinkTimecode = /* BC6CFBD3-8317-4325-AC1C-1216391E9340 */ {0xBC,0x6C,0xFB,0xD3,0x83,0x17,0x43,0x25,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40}; + +/* Enum BMDTimecodeFlags - Timecode flags */ + +typedef uint32_t BMDTimecodeFlags; +enum _BMDTimecodeFlags { + bmdTimecodeFlagDefault = 0, + bmdTimecodeIsDropFrame = 1 << 0, + bmdTimecodeFieldMark = 1 << 1 +}; + +/* Enum BMDVideoConnection - Video connection types */ + +typedef uint32_t BMDVideoConnection; +enum _BMDVideoConnection { + bmdVideoConnectionSDI = 1 << 0, + bmdVideoConnectionHDMI = 1 << 1, + bmdVideoConnectionOpticalSDI = 1 << 2, + bmdVideoConnectionComponent = 1 << 3, + bmdVideoConnectionComposite = 1 << 4, + bmdVideoConnectionSVideo = 1 << 5 +}; + +/* Enum BMDAudioConnection - Audio connection types */ + +typedef uint32_t BMDAudioConnection; +enum _BMDAudioConnection { + bmdAudioConnectionEmbedded = 1 << 0, + bmdAudioConnectionAESEBU = 1 << 1, + bmdAudioConnectionAnalog = 1 << 2, + bmdAudioConnectionAnalogXLR = 1 << 3, + bmdAudioConnectionAnalogRCA = 1 << 4 +}; + +// Forward Declarations + +class IDeckLinkTimecode; + +/* Interface IDeckLinkTimecode - Used for video frame timecode representation. */ + +class IDeckLinkTimecode : public IUnknown +{ +public: + virtual BMDTimecodeBCD GetBCD (void) = 0; + virtual HRESULT GetComponents (/* out */ uint8_t *hours, /* out */ uint8_t *minutes, /* out */ uint8_t *seconds, /* out */ uint8_t *frames) = 0; + virtual HRESULT GetString (/* out */ const char **timecode) = 0; + virtual BMDTimecodeFlags GetFlags (void) = 0; + virtual HRESULT GetTimecodeUserBits (/* out */ BMDTimecodeUserBits *userBits) = 0; + +protected: + virtual ~IDeckLinkTimecode () {} // call Release method to drop reference count +}; + +/* Functions */ + +extern "C" { + + +} + + +#endif /* defined(BMD_DECKLINKAPITYPES_H) */ diff --git a/intern/decklink/linux/DeckLinkAPIVersion.h b/intern/decklink/linux/DeckLinkAPIVersion.h new file mode 100644 index 00000000000..cfcc701c427 --- /dev/null +++ b/intern/decklink/linux/DeckLinkAPIVersion.h @@ -0,0 +1,37 @@ +/* -LICENSE-START- + * ** Copyright (c) 2014 Blackmagic Design + * ** + * ** Permission is hereby granted, free of charge, to any person or organization + * ** obtaining a copy of the software and accompanying documentation covered by + * ** this license (the "Software") to use, reproduce, display, distribute, + * ** execute, and transmit the Software, and to prepare derivative works of the + * ** Software, and to permit third-parties to whom the Software is furnished to + * ** do so, all subject to the following: + * ** + * ** The copyright notices in the Software and this entire statement, including + * ** the above license grant, this restriction and the following disclaimer, + * ** must be included in all copies of the Software, in whole or in part, and + * ** all derivative works of the Software, unless such copies or derivative + * ** works are solely in the form of machine-executable object code generated by + * ** a source language processor. + * ** + * ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT + * ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE + * ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, + * ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * ** DEALINGS IN THE SOFTWARE. + * ** -LICENSE-END- + * */ + +/* DeckLinkAPIVersion.h */ + +#ifndef __DeckLink_API_Version_h__ +#define __DeckLink_API_Version_h__ + +#define BLACKMAGIC_DECKLINK_API_VERSION 0x0a040000 +#define BLACKMAGIC_DECKLINK_API_VERSION_STRING "10.4" + +#endif // __DeckLink_API_Version_h__ + diff --git a/intern/decklink/linux/LinuxCOM.h b/intern/decklink/linux/LinuxCOM.h new file mode 100644 index 00000000000..ee783bbd58f --- /dev/null +++ b/intern/decklink/linux/LinuxCOM.h @@ -0,0 +1,100 @@ +/* -LICENSE-START- +** Copyright (c) 2009 Blackmagic Design +** +** Permission is hereby granted, free of charge, to any person or organization +** obtaining a copy of the software and accompanying documentation covered by +** this license (the "Software") to use, reproduce, display, distribute, +** execute, and transmit the Software, and to prepare derivative works of the +** Software, and to permit third-parties to whom the Software is furnished to +** do so, all subject to the following: +** +** The copyright notices in the Software and this entire statement, including +** the above license grant, this restriction and the following disclaimer, +** must be included in all copies of the Software, in whole or in part, and +** all derivative works of the Software, unless such copies or derivative +** works are solely in the form of machine-executable object code generated by +** a source language processor. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +** DEALINGS IN THE SOFTWARE. +** -LICENSE-END- +*/ + +#ifndef __LINUX_COM_H_ +#define __LINUX_COM_H_ + +struct REFIID +{ + unsigned char byte0; + unsigned char byte1; + unsigned char byte2; + unsigned char byte3; + unsigned char byte4; + unsigned char byte5; + unsigned char byte6; + unsigned char byte7; + unsigned char byte8; + unsigned char byte9; + unsigned char byte10; + unsigned char byte11; + unsigned char byte12; + unsigned char byte13; + unsigned char byte14; + unsigned char byte15; +}; + +typedef REFIID CFUUIDBytes; +#define CFUUIDGetUUIDBytes(x) x + +#define _HRESULT_DEFINED +typedef int HRESULT; +typedef unsigned long ULONG; +typedef void *LPVOID; + +#define SUCCEEDED(Status) ((HRESULT)(Status) >= 0) +#define FAILED(Status) ((HRESULT)(Status)<0) + +#define IS_ERROR(Status) ((unsigned long)(Status) >> 31 == SEVERITY_ERROR) +#define HRESULT_CODE(hr) ((hr) & 0xFFFF) +#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff) +#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1) +#define SEVERITY_SUCCESS 0 +#define SEVERITY_ERROR 1 + +#define MAKE_HRESULT(sev,fac,code) ((HRESULT) (((unsigned long)(sev)<<31) | ((unsigned long)(fac)<<16) | ((unsigned long)(code))) ) + +#define S_OK ((HRESULT)0x00000000L) +#define S_FALSE ((HRESULT)0x00000001L) +#define E_UNEXPECTED ((HRESULT)0x8000FFFFL) +#define E_NOTIMPL ((HRESULT)0x80000001L) +#define E_OUTOFMEMORY ((HRESULT)0x80000002L) +#define E_INVALIDARG ((HRESULT)0x80000003L) +#define E_NOINTERFACE ((HRESULT)0x80000004L) +#define E_POINTER ((HRESULT)0x80000005L) +#define E_HANDLE ((HRESULT)0x80000006L) +#define E_ABORT ((HRESULT)0x80000007L) +#define E_FAIL ((HRESULT)0x80000008L) +#define E_ACCESSDENIED ((HRESULT)0x80000009L) + +#define STDMETHODCALLTYPE + +#define IID_IUnknown (REFIID){0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} +#define IUnknownUUID IID_IUnknown + +#ifdef __cplusplus +class IUnknown +{ + public: + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) = 0; + virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0; + virtual ULONG STDMETHODCALLTYPE Release(void) = 0; +}; +#endif + +#endif + diff --git a/intern/decklink/win/DeckLinkAPI_h.h b/intern/decklink/win/DeckLinkAPI_h.h new file mode 100644 index 00000000000..1bd80b6dc95 --- /dev/null +++ b/intern/decklink/win/DeckLinkAPI_h.h @@ -0,0 +1,13323 @@ + + +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + + /* File created by MIDL compiler version 8.00.0603 */ +/* at Mon Apr 13 20:57:05 2015 + */ +/* Compiler settings for ..\..\include\DeckLinkAPI.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.00.0603 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +/* verify that the <rpcndr.h> version is high enough to compile this file*/ +#ifndef __REQUIRED_RPCNDR_H_VERSION__ +#define __REQUIRED_RPCNDR_H_VERSION__ 475 +#endif + +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __RPCNDR_H_VERSION__ +#error this stub requires an updated version of <rpcndr.h> +#endif // __RPCNDR_H_VERSION__ + + +#ifndef __DeckLinkAPI_h_h__ +#define __DeckLinkAPI_h_h__ + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#pragma once +#endif + +/* Forward Declarations */ + +#ifndef __IDeckLinkTimecode_FWD_DEFINED__ +#define __IDeckLinkTimecode_FWD_DEFINED__ +typedef interface IDeckLinkTimecode IDeckLinkTimecode; + +#endif /* __IDeckLinkTimecode_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayModeIterator_FWD_DEFINED__ +#define __IDeckLinkDisplayModeIterator_FWD_DEFINED__ +typedef interface IDeckLinkDisplayModeIterator IDeckLinkDisplayModeIterator; + +#endif /* __IDeckLinkDisplayModeIterator_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayMode_FWD_DEFINED__ +#define __IDeckLinkDisplayMode_FWD_DEFINED__ +typedef interface IDeckLinkDisplayMode IDeckLinkDisplayMode; + +#endif /* __IDeckLinkDisplayMode_FWD_DEFINED__ */ + + +#ifndef __IDeckLink_FWD_DEFINED__ +#define __IDeckLink_FWD_DEFINED__ +typedef interface IDeckLink IDeckLink; + +#endif /* __IDeckLink_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkConfiguration_FWD_DEFINED__ +#define __IDeckLinkConfiguration_FWD_DEFINED__ +typedef interface IDeckLinkConfiguration IDeckLinkConfiguration; + +#endif /* __IDeckLinkConfiguration_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ +#define __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ +typedef interface IDeckLinkDeckControlStatusCallback IDeckLinkDeckControlStatusCallback; + +#endif /* __IDeckLinkDeckControlStatusCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControl_FWD_DEFINED__ +#define __IDeckLinkDeckControl_FWD_DEFINED__ +typedef interface IDeckLinkDeckControl IDeckLinkDeckControl; + +#endif /* __IDeckLinkDeckControl_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ +#define __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ +typedef interface IBMDStreamingDeviceNotificationCallback IBMDStreamingDeviceNotificationCallback; + +#endif /* __IBMDStreamingDeviceNotificationCallback_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingH264InputCallback_FWD_DEFINED__ +#define __IBMDStreamingH264InputCallback_FWD_DEFINED__ +typedef interface IBMDStreamingH264InputCallback IBMDStreamingH264InputCallback; + +#endif /* __IBMDStreamingH264InputCallback_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingDiscovery_FWD_DEFINED__ +#define __IBMDStreamingDiscovery_FWD_DEFINED__ +typedef interface IBMDStreamingDiscovery IBMDStreamingDiscovery; + +#endif /* __IBMDStreamingDiscovery_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ +#define __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ +typedef interface IBMDStreamingVideoEncodingMode IBMDStreamingVideoEncodingMode; + +#endif /* __IBMDStreamingVideoEncodingMode_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ +#define __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ +typedef interface IBMDStreamingMutableVideoEncodingMode IBMDStreamingMutableVideoEncodingMode; + +#endif /* __IBMDStreamingMutableVideoEncodingMode_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ +#define __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ +typedef interface IBMDStreamingVideoEncodingModePresetIterator IBMDStreamingVideoEncodingModePresetIterator; + +#endif /* __IBMDStreamingVideoEncodingModePresetIterator_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingDeviceInput_FWD_DEFINED__ +#define __IBMDStreamingDeviceInput_FWD_DEFINED__ +typedef interface IBMDStreamingDeviceInput IBMDStreamingDeviceInput; + +#endif /* __IBMDStreamingDeviceInput_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingH264NALPacket_FWD_DEFINED__ +#define __IBMDStreamingH264NALPacket_FWD_DEFINED__ +typedef interface IBMDStreamingH264NALPacket IBMDStreamingH264NALPacket; + +#endif /* __IBMDStreamingH264NALPacket_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingAudioPacket_FWD_DEFINED__ +#define __IBMDStreamingAudioPacket_FWD_DEFINED__ +typedef interface IBMDStreamingAudioPacket IBMDStreamingAudioPacket; + +#endif /* __IBMDStreamingAudioPacket_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ +#define __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ +typedef interface IBMDStreamingMPEG2TSPacket IBMDStreamingMPEG2TSPacket; + +#endif /* __IBMDStreamingMPEG2TSPacket_FWD_DEFINED__ */ + + +#ifndef __IBMDStreamingH264NALParser_FWD_DEFINED__ +#define __IBMDStreamingH264NALParser_FWD_DEFINED__ +typedef interface IBMDStreamingH264NALParser IBMDStreamingH264NALParser; + +#endif /* __IBMDStreamingH264NALParser_FWD_DEFINED__ */ + + +#ifndef __CBMDStreamingDiscovery_FWD_DEFINED__ +#define __CBMDStreamingDiscovery_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CBMDStreamingDiscovery CBMDStreamingDiscovery; +#else +typedef struct CBMDStreamingDiscovery CBMDStreamingDiscovery; +#endif /* __cplusplus */ + +#endif /* __CBMDStreamingDiscovery_FWD_DEFINED__ */ + + +#ifndef __CBMDStreamingH264NALParser_FWD_DEFINED__ +#define __CBMDStreamingH264NALParser_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CBMDStreamingH264NALParser CBMDStreamingH264NALParser; +#else +typedef struct CBMDStreamingH264NALParser CBMDStreamingH264NALParser; +#endif /* __cplusplus */ + +#endif /* __CBMDStreamingH264NALParser_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoOutputCallback_FWD_DEFINED__ +#define __IDeckLinkVideoOutputCallback_FWD_DEFINED__ +typedef interface IDeckLinkVideoOutputCallback IDeckLinkVideoOutputCallback; + +#endif /* __IDeckLinkVideoOutputCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_FWD_DEFINED__ +#define __IDeckLinkInputCallback_FWD_DEFINED__ +typedef interface IDeckLinkInputCallback IDeckLinkInputCallback; + +#endif /* __IDeckLinkInputCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkMemoryAllocator_FWD_DEFINED__ +#define __IDeckLinkMemoryAllocator_FWD_DEFINED__ +typedef interface IDeckLinkMemoryAllocator IDeckLinkMemoryAllocator; + +#endif /* __IDeckLinkMemoryAllocator_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkAudioOutputCallback_FWD_DEFINED__ +#define __IDeckLinkAudioOutputCallback_FWD_DEFINED__ +typedef interface IDeckLinkAudioOutputCallback IDeckLinkAudioOutputCallback; + +#endif /* __IDeckLinkAudioOutputCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkIterator_FWD_DEFINED__ +#define __IDeckLinkIterator_FWD_DEFINED__ +typedef interface IDeckLinkIterator IDeckLinkIterator; + +#endif /* __IDeckLinkIterator_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkAPIInformation_FWD_DEFINED__ +#define __IDeckLinkAPIInformation_FWD_DEFINED__ +typedef interface IDeckLinkAPIInformation IDeckLinkAPIInformation; + +#endif /* __IDeckLinkAPIInformation_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_FWD_DEFINED__ +#define __IDeckLinkOutput_FWD_DEFINED__ +typedef interface IDeckLinkOutput IDeckLinkOutput; + +#endif /* __IDeckLinkOutput_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInput_FWD_DEFINED__ +#define __IDeckLinkInput_FWD_DEFINED__ +typedef interface IDeckLinkInput IDeckLinkInput; + +#endif /* __IDeckLinkInput_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame_FWD_DEFINED__ +#define __IDeckLinkVideoFrame_FWD_DEFINED__ +typedef interface IDeckLinkVideoFrame IDeckLinkVideoFrame; + +#endif /* __IDeckLinkVideoFrame_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkMutableVideoFrame_FWD_DEFINED__ +#define __IDeckLinkMutableVideoFrame_FWD_DEFINED__ +typedef interface IDeckLinkMutableVideoFrame IDeckLinkMutableVideoFrame; + +#endif /* __IDeckLinkMutableVideoFrame_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ +#define __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ +typedef interface IDeckLinkVideoFrame3DExtensions IDeckLinkVideoFrame3DExtensions; + +#endif /* __IDeckLinkVideoFrame3DExtensions_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_FWD_DEFINED__ +#define __IDeckLinkVideoInputFrame_FWD_DEFINED__ +typedef interface IDeckLinkVideoInputFrame IDeckLinkVideoInputFrame; + +#endif /* __IDeckLinkVideoInputFrame_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ +#define __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ +typedef interface IDeckLinkVideoFrameAncillary IDeckLinkVideoFrameAncillary; + +#endif /* __IDeckLinkVideoFrameAncillary_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkAudioInputPacket_FWD_DEFINED__ +#define __IDeckLinkAudioInputPacket_FWD_DEFINED__ +typedef interface IDeckLinkAudioInputPacket IDeckLinkAudioInputPacket; + +#endif /* __IDeckLinkAudioInputPacket_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ +#define __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ +typedef interface IDeckLinkScreenPreviewCallback IDeckLinkScreenPreviewCallback; + +#endif /* __IDeckLinkScreenPreviewCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ +#define __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ +typedef interface IDeckLinkGLScreenPreviewHelper IDeckLinkGLScreenPreviewHelper; + +#endif /* __IDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ +#define __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ +typedef interface IDeckLinkDX9ScreenPreviewHelper IDeckLinkDX9ScreenPreviewHelper; + +#endif /* __IDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkNotificationCallback_FWD_DEFINED__ +#define __IDeckLinkNotificationCallback_FWD_DEFINED__ +typedef interface IDeckLinkNotificationCallback IDeckLinkNotificationCallback; + +#endif /* __IDeckLinkNotificationCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkNotification_FWD_DEFINED__ +#define __IDeckLinkNotification_FWD_DEFINED__ +typedef interface IDeckLinkNotification IDeckLinkNotification; + +#endif /* __IDeckLinkNotification_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkAttributes_FWD_DEFINED__ +#define __IDeckLinkAttributes_FWD_DEFINED__ +typedef interface IDeckLinkAttributes IDeckLinkAttributes; + +#endif /* __IDeckLinkAttributes_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkKeyer_FWD_DEFINED__ +#define __IDeckLinkKeyer_FWD_DEFINED__ +typedef interface IDeckLinkKeyer IDeckLinkKeyer; + +#endif /* __IDeckLinkKeyer_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoConversion_FWD_DEFINED__ +#define __IDeckLinkVideoConversion_FWD_DEFINED__ +typedef interface IDeckLinkVideoConversion IDeckLinkVideoConversion; + +#endif /* __IDeckLinkVideoConversion_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ +#define __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ +typedef interface IDeckLinkDeviceNotificationCallback IDeckLinkDeviceNotificationCallback; + +#endif /* __IDeckLinkDeviceNotificationCallback_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDiscovery_FWD_DEFINED__ +#define __IDeckLinkDiscovery_FWD_DEFINED__ +typedef interface IDeckLinkDiscovery IDeckLinkDiscovery; + +#endif /* __IDeckLinkDiscovery_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkIterator_FWD_DEFINED__ +#define __CDeckLinkIterator_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkIterator CDeckLinkIterator; +#else +typedef struct CDeckLinkIterator CDeckLinkIterator; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkIterator_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkAPIInformation_FWD_DEFINED__ +#define __CDeckLinkAPIInformation_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkAPIInformation CDeckLinkAPIInformation; +#else +typedef struct CDeckLinkAPIInformation CDeckLinkAPIInformation; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkAPIInformation_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ +#define __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper; +#else +typedef struct CDeckLinkGLScreenPreviewHelper CDeckLinkGLScreenPreviewHelper; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkGLScreenPreviewHelper_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ +#define __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkDX9ScreenPreviewHelper CDeckLinkDX9ScreenPreviewHelper; +#else +typedef struct CDeckLinkDX9ScreenPreviewHelper CDeckLinkDX9ScreenPreviewHelper; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkDX9ScreenPreviewHelper_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkVideoConversion_FWD_DEFINED__ +#define __CDeckLinkVideoConversion_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkVideoConversion CDeckLinkVideoConversion; +#else +typedef struct CDeckLinkVideoConversion CDeckLinkVideoConversion; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkVideoConversion_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkDiscovery_FWD_DEFINED__ +#define __CDeckLinkDiscovery_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkDiscovery CDeckLinkDiscovery; +#else +typedef struct CDeckLinkDiscovery CDeckLinkDiscovery; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkDiscovery_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ +#define __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ +typedef interface IDeckLinkConfiguration_v10_2 IDeckLinkConfiguration_v10_2; + +#endif /* __IDeckLinkConfiguration_v10_2_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v9_9_FWD_DEFINED__ +#define __IDeckLinkOutput_v9_9_FWD_DEFINED__ +typedef interface IDeckLinkOutput_v9_9 IDeckLinkOutput_v9_9; + +#endif /* __IDeckLinkOutput_v9_9_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v9_2_FWD_DEFINED__ +#define __IDeckLinkInput_v9_2_FWD_DEFINED__ +typedef interface IDeckLinkInput_v9_2 IDeckLinkInput_v9_2; + +#endif /* __IDeckLinkInput_v9_2_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControlStatusCallback_v8_1_FWD_DEFINED__ +#define __IDeckLinkDeckControlStatusCallback_v8_1_FWD_DEFINED__ +typedef interface IDeckLinkDeckControlStatusCallback_v8_1 IDeckLinkDeckControlStatusCallback_v8_1; + +#endif /* __IDeckLinkDeckControlStatusCallback_v8_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControl_v8_1_FWD_DEFINED__ +#define __IDeckLinkDeckControl_v8_1_FWD_DEFINED__ +typedef interface IDeckLinkDeckControl_v8_1 IDeckLinkDeckControl_v8_1; + +#endif /* __IDeckLinkDeckControl_v8_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLink_v8_0_FWD_DEFINED__ +#define __IDeckLink_v8_0_FWD_DEFINED__ +typedef interface IDeckLink_v8_0 IDeckLink_v8_0; + +#endif /* __IDeckLink_v8_0_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkIterator_v8_0_FWD_DEFINED__ +#define __IDeckLinkIterator_v8_0_FWD_DEFINED__ +typedef interface IDeckLinkIterator_v8_0 IDeckLinkIterator_v8_0; + +#endif /* __IDeckLinkIterator_v8_0_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkIterator_v8_0_FWD_DEFINED__ +#define __CDeckLinkIterator_v8_0_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkIterator_v8_0 CDeckLinkIterator_v8_0; +#else +typedef struct CDeckLinkIterator_v8_0 CDeckLinkIterator_v8_0; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkIterator_v8_0_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControl_v7_9_FWD_DEFINED__ +#define __IDeckLinkDeckControl_v7_9_FWD_DEFINED__ +typedef interface IDeckLinkDeckControl_v7_9 IDeckLinkDeckControl_v7_9; + +#endif /* __IDeckLinkDeckControl_v7_9_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__ +#define __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkDisplayModeIterator_v7_6 IDeckLinkDisplayModeIterator_v7_6; + +#endif /* __IDeckLinkDisplayModeIterator_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__ +#define __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkDisplayMode_v7_6 IDeckLinkDisplayMode_v7_6; + +#endif /* __IDeckLinkDisplayMode_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v7_6_FWD_DEFINED__ +#define __IDeckLinkOutput_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkOutput_v7_6 IDeckLinkOutput_v7_6; + +#endif /* __IDeckLinkOutput_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v7_6_FWD_DEFINED__ +#define __IDeckLinkInput_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkInput_v7_6 IDeckLinkInput_v7_6; + +#endif /* __IDeckLinkInput_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkTimecode_v7_6_FWD_DEFINED__ +#define __IDeckLinkTimecode_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkTimecode_v7_6 IDeckLinkTimecode_v7_6; + +#endif /* __IDeckLinkTimecode_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__ +#define __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkVideoFrame_v7_6 IDeckLinkVideoFrame_v7_6; + +#endif /* __IDeckLinkVideoFrame_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__ +#define __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkMutableVideoFrame_v7_6 IDeckLinkMutableVideoFrame_v7_6; + +#endif /* __IDeckLinkMutableVideoFrame_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__ +#define __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkVideoInputFrame_v7_6 IDeckLinkVideoInputFrame_v7_6; + +#endif /* __IDeckLinkVideoInputFrame_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__ +#define __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkScreenPreviewCallback_v7_6 IDeckLinkScreenPreviewCallback_v7_6; + +#endif /* __IDeckLinkScreenPreviewCallback_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ +#define __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkGLScreenPreviewHelper_v7_6 IDeckLinkGLScreenPreviewHelper_v7_6; + +#endif /* __IDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__ +#define __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkVideoConversion_v7_6 IDeckLinkVideoConversion_v7_6; + +#endif /* __IDeckLinkVideoConversion_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkConfiguration_v7_6_FWD_DEFINED__ +#define __IDeckLinkConfiguration_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkConfiguration_v7_6 IDeckLinkConfiguration_v7_6; + +#endif /* __IDeckLinkConfiguration_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__ +#define __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkVideoOutputCallback_v7_6 IDeckLinkVideoOutputCallback_v7_6; + +#endif /* __IDeckLinkVideoOutputCallback_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_v7_6_FWD_DEFINED__ +#define __IDeckLinkInputCallback_v7_6_FWD_DEFINED__ +typedef interface IDeckLinkInputCallback_v7_6 IDeckLinkInputCallback_v7_6; + +#endif /* __IDeckLinkInputCallback_v7_6_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ +#define __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkGLScreenPreviewHelper_v7_6 CDeckLinkGLScreenPreviewHelper_v7_6; +#else +typedef struct CDeckLinkGLScreenPreviewHelper_v7_6 CDeckLinkGLScreenPreviewHelper_v7_6; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkGLScreenPreviewHelper_v7_6_FWD_DEFINED__ */ + + +#ifndef __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__ +#define __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__ + +#ifdef __cplusplus +typedef class CDeckLinkVideoConversion_v7_6 CDeckLinkVideoConversion_v7_6; +#else +typedef struct CDeckLinkVideoConversion_v7_6 CDeckLinkVideoConversion_v7_6; +#endif /* __cplusplus */ + +#endif /* __CDeckLinkVideoConversion_v7_6_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ +#define __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ +typedef interface IDeckLinkInputCallback_v7_3 IDeckLinkInputCallback_v7_3; + +#endif /* __IDeckLinkInputCallback_v7_3_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v7_3_FWD_DEFINED__ +#define __IDeckLinkOutput_v7_3_FWD_DEFINED__ +typedef interface IDeckLinkOutput_v7_3 IDeckLinkOutput_v7_3; + +#endif /* __IDeckLinkOutput_v7_3_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v7_3_FWD_DEFINED__ +#define __IDeckLinkInput_v7_3_FWD_DEFINED__ +typedef interface IDeckLinkInput_v7_3 IDeckLinkInput_v7_3; + +#endif /* __IDeckLinkInput_v7_3_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ +#define __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ +typedef interface IDeckLinkVideoInputFrame_v7_3 IDeckLinkVideoInputFrame_v7_3; + +#endif /* __IDeckLinkVideoInputFrame_v7_3_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ +#define __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkDisplayModeIterator_v7_1 IDeckLinkDisplayModeIterator_v7_1; + +#endif /* __IDeckLinkDisplayModeIterator_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ +#define __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkDisplayMode_v7_1 IDeckLinkDisplayMode_v7_1; + +#endif /* __IDeckLinkDisplayMode_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ +#define __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkVideoFrame_v7_1 IDeckLinkVideoFrame_v7_1; + +#endif /* __IDeckLinkVideoFrame_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ +#define __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkVideoInputFrame_v7_1 IDeckLinkVideoInputFrame_v7_1; + +#endif /* __IDeckLinkVideoInputFrame_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ +#define __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkAudioInputPacket_v7_1 IDeckLinkAudioInputPacket_v7_1; + +#endif /* __IDeckLinkAudioInputPacket_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ +#define __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkVideoOutputCallback_v7_1 IDeckLinkVideoOutputCallback_v7_1; + +#endif /* __IDeckLinkVideoOutputCallback_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ +#define __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkInputCallback_v7_1 IDeckLinkInputCallback_v7_1; + +#endif /* __IDeckLinkInputCallback_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v7_1_FWD_DEFINED__ +#define __IDeckLinkOutput_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkOutput_v7_1 IDeckLinkOutput_v7_1; + +#endif /* __IDeckLinkOutput_v7_1_FWD_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v7_1_FWD_DEFINED__ +#define __IDeckLinkInput_v7_1_FWD_DEFINED__ +typedef interface IDeckLinkInput_v7_1 IDeckLinkInput_v7_1; + +#endif /* __IDeckLinkInput_v7_1_FWD_DEFINED__ */ + + +/* header files for imported files */ +#include "unknwn.h" + +#ifdef __cplusplus +extern "C"{ +#endif + + + +#ifndef __DeckLinkAPI_LIBRARY_DEFINED__ +#define __DeckLinkAPI_LIBRARY_DEFINED__ + +/* library DeckLinkAPI */ +/* [helpstring][version][uuid] */ + +typedef LONGLONG BMDTimeValue; + +typedef LONGLONG BMDTimeScale; + +typedef unsigned int BMDTimecodeBCD; + +typedef unsigned int BMDTimecodeUserBits; + +typedef unsigned int BMDTimecodeFlags; +#if 0 +typedef enum _BMDTimecodeFlags BMDTimecodeFlags; + +#endif +/* [v1_enum] */ +enum _BMDTimecodeFlags + { + bmdTimecodeFlagDefault = 0, + bmdTimecodeIsDropFrame = ( 1 << 0 ) , + bmdTimecodeFieldMark = ( 1 << 1 ) + } ; +typedef /* [v1_enum] */ +enum _BMDVideoConnection + { + bmdVideoConnectionSDI = ( 1 << 0 ) , + bmdVideoConnectionHDMI = ( 1 << 1 ) , + bmdVideoConnectionOpticalSDI = ( 1 << 2 ) , + bmdVideoConnectionComponent = ( 1 << 3 ) , + bmdVideoConnectionComposite = ( 1 << 4 ) , + bmdVideoConnectionSVideo = ( 1 << 5 ) + } BMDVideoConnection; + +typedef /* [v1_enum] */ +enum _BMDAudioConnection + { + bmdAudioConnectionEmbedded = ( 1 << 0 ) , + bmdAudioConnectionAESEBU = ( 1 << 1 ) , + bmdAudioConnectionAnalog = ( 1 << 2 ) , + bmdAudioConnectionAnalogXLR = ( 1 << 3 ) , + bmdAudioConnectionAnalogRCA = ( 1 << 4 ) + } BMDAudioConnection; + + +typedef unsigned int BMDDisplayModeFlags; +#if 0 +typedef enum _BMDDisplayModeFlags BMDDisplayModeFlags; + +#endif +typedef /* [v1_enum] */ +enum _BMDDisplayMode + { + bmdModeNTSC = 0x6e747363, + bmdModeNTSC2398 = 0x6e743233, + bmdModePAL = 0x70616c20, + bmdModeNTSCp = 0x6e747370, + bmdModePALp = 0x70616c70, + bmdModeHD1080p2398 = 0x32337073, + bmdModeHD1080p24 = 0x32347073, + bmdModeHD1080p25 = 0x48703235, + bmdModeHD1080p2997 = 0x48703239, + bmdModeHD1080p30 = 0x48703330, + bmdModeHD1080i50 = 0x48693530, + bmdModeHD1080i5994 = 0x48693539, + bmdModeHD1080i6000 = 0x48693630, + bmdModeHD1080p50 = 0x48703530, + bmdModeHD1080p5994 = 0x48703539, + bmdModeHD1080p6000 = 0x48703630, + bmdModeHD720p50 = 0x68703530, + bmdModeHD720p5994 = 0x68703539, + bmdModeHD720p60 = 0x68703630, + bmdMode2k2398 = 0x326b3233, + bmdMode2k24 = 0x326b3234, + bmdMode2k25 = 0x326b3235, + bmdMode2kDCI2398 = 0x32643233, + bmdMode2kDCI24 = 0x32643234, + bmdMode2kDCI25 = 0x32643235, + bmdMode4K2160p2398 = 0x346b3233, + bmdMode4K2160p24 = 0x346b3234, + bmdMode4K2160p25 = 0x346b3235, + bmdMode4K2160p2997 = 0x346b3239, + bmdMode4K2160p30 = 0x346b3330, + bmdMode4K2160p50 = 0x346b3530, + bmdMode4K2160p5994 = 0x346b3539, + bmdMode4K2160p60 = 0x346b3630, + bmdMode4kDCI2398 = 0x34643233, + bmdMode4kDCI24 = 0x34643234, + bmdMode4kDCI25 = 0x34643235, + bmdModeUnknown = 0x69756e6b + } BMDDisplayMode; + +typedef /* [v1_enum] */ +enum _BMDFieldDominance + { + bmdUnknownFieldDominance = 0, + bmdLowerFieldFirst = 0x6c6f7772, + bmdUpperFieldFirst = 0x75707072, + bmdProgressiveFrame = 0x70726f67, + bmdProgressiveSegmentedFrame = 0x70736620 + } BMDFieldDominance; + +typedef /* [v1_enum] */ +enum _BMDPixelFormat + { + bmdFormat8BitYUV = 0x32767579, + bmdFormat10BitYUV = 0x76323130, + bmdFormat8BitARGB = 32, + bmdFormat8BitBGRA = 0x42475241, + bmdFormat10BitRGB = 0x72323130, + bmdFormat12BitRGB = 0x52313242, + bmdFormat12BitRGBLE = 0x5231324c, + bmdFormat10BitRGBXLE = 0x5231306c, + bmdFormat10BitRGBX = 0x52313062 + } BMDPixelFormat; + +/* [v1_enum] */ +enum _BMDDisplayModeFlags + { + bmdDisplayModeSupports3D = ( 1 << 0 ) , + bmdDisplayModeColorspaceRec601 = ( 1 << 1 ) , + bmdDisplayModeColorspaceRec709 = ( 1 << 2 ) + } ; + + +#if 0 +#endif + +#if 0 +#endif +typedef /* [v1_enum] */ +enum _BMDDeckLinkConfigurationID + { + bmdDeckLinkConfigSwapSerialRxTx = 0x73737274, + bmdDeckLinkConfigUse1080pNotPsF = 0x6670726f, + bmdDeckLinkConfigHDMI3DPackingFormat = 0x33647066, + bmdDeckLinkConfigBypass = 0x62797073, + bmdDeckLinkConfigClockTimingAdjustment = 0x63746164, + bmdDeckLinkConfigAnalogAudioConsumerLevels = 0x6161636c, + bmdDeckLinkConfigFieldFlickerRemoval = 0x66646672, + bmdDeckLinkConfigHD1080p24ToHD1080i5994Conversion = 0x746f3539, + bmdDeckLinkConfig444SDIVideoOutput = 0x3434346f, + bmdDeckLinkConfigSingleLinkVideoOutput = 0x73676c6f, + bmdDeckLinkConfigBlackVideoOutputDuringCapture = 0x62766f63, + bmdDeckLinkConfigLowLatencyVideoOutput = 0x6c6c766f, + bmdDeckLinkConfigDownConversionOnAllAnalogOutput = 0x6361616f, + bmdDeckLinkConfigSMPTELevelAOutput = 0x736d7461, + bmdDeckLinkConfigVideoOutputConnection = 0x766f636e, + bmdDeckLinkConfigVideoOutputConversionMode = 0x766f636d, + bmdDeckLinkConfigAnalogVideoOutputFlags = 0x61766f66, + bmdDeckLinkConfigReferenceInputTimingOffset = 0x676c6f74, + bmdDeckLinkConfigVideoOutputIdleOperation = 0x766f696f, + bmdDeckLinkConfigDefaultVideoOutputMode = 0x64766f6d, + bmdDeckLinkConfigDefaultVideoOutputModeFlags = 0x64766f66, + bmdDeckLinkConfigVideoOutputComponentLumaGain = 0x6f636c67, + bmdDeckLinkConfigVideoOutputComponentChromaBlueGain = 0x6f636362, + bmdDeckLinkConfigVideoOutputComponentChromaRedGain = 0x6f636372, + bmdDeckLinkConfigVideoOutputCompositeLumaGain = 0x6f696c67, + bmdDeckLinkConfigVideoOutputCompositeChromaGain = 0x6f696367, + bmdDeckLinkConfigVideoOutputSVideoLumaGain = 0x6f736c67, + bmdDeckLinkConfigVideoOutputSVideoChromaGain = 0x6f736367, + bmdDeckLinkConfigVideoInputScanning = 0x76697363, + bmdDeckLinkConfigUseDedicatedLTCInput = 0x646c7463, + bmdDeckLinkConfigVideoInputConnection = 0x7669636e, + bmdDeckLinkConfigAnalogVideoInputFlags = 0x61766966, + bmdDeckLinkConfigVideoInputConversionMode = 0x7669636d, + bmdDeckLinkConfig32PulldownSequenceInitialTimecodeFrame = 0x70646966, + bmdDeckLinkConfigVANCSourceLine1Mapping = 0x76736c31, + bmdDeckLinkConfigVANCSourceLine2Mapping = 0x76736c32, + bmdDeckLinkConfigVANCSourceLine3Mapping = 0x76736c33, + bmdDeckLinkConfigCapturePassThroughMode = 0x6370746d, + bmdDeckLinkConfigVideoInputComponentLumaGain = 0x69636c67, + bmdDeckLinkConfigVideoInputComponentChromaBlueGain = 0x69636362, + bmdDeckLinkConfigVideoInputComponentChromaRedGain = 0x69636372, + bmdDeckLinkConfigVideoInputCompositeLumaGain = 0x69696c67, + bmdDeckLinkConfigVideoInputCompositeChromaGain = 0x69696367, + bmdDeckLinkConfigVideoInputSVideoLumaGain = 0x69736c67, + bmdDeckLinkConfigVideoInputSVideoChromaGain = 0x69736367, + bmdDeckLinkConfigAudioInputConnection = 0x6169636e, + bmdDeckLinkConfigAnalogAudioInputScaleChannel1 = 0x61697331, + bmdDeckLinkConfigAnalogAudioInputScaleChannel2 = 0x61697332, + bmdDeckLinkConfigAnalogAudioInputScaleChannel3 = 0x61697333, + bmdDeckLinkConfigAnalogAudioInputScaleChannel4 = 0x61697334, + bmdDeckLinkConfigDigitalAudioInputScale = 0x64616973, + bmdDeckLinkConfigAudioOutputAESAnalogSwitch = 0x616f6161, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel1 = 0x616f7331, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel2 = 0x616f7332, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel3 = 0x616f7333, + bmdDeckLinkConfigAnalogAudioOutputScaleChannel4 = 0x616f7334, + bmdDeckLinkConfigDigitalAudioOutputScale = 0x64616f73, + bmdDeckLinkConfigDeviceInformationLabel = 0x64696c61, + bmdDeckLinkConfigDeviceInformationSerialNumber = 0x6469736e, + bmdDeckLinkConfigDeviceInformationCompany = 0x6469636f, + bmdDeckLinkConfigDeviceInformationPhone = 0x64697068, + bmdDeckLinkConfigDeviceInformationEmail = 0x6469656d, + bmdDeckLinkConfigDeviceInformationDate = 0x64696461 + } BMDDeckLinkConfigurationID; + + +typedef unsigned int BMDDeckControlStatusFlags; +typedef unsigned int BMDDeckControlExportModeOpsFlags; +#if 0 +typedef enum _BMDDeckControlStatusFlags BMDDeckControlStatusFlags; + +typedef enum _BMDDeckControlExportModeOpsFlags BMDDeckControlExportModeOpsFlags; + +#endif +typedef /* [v1_enum] */ +enum _BMDDeckControlMode + { + bmdDeckControlNotOpened = 0x6e746f70, + bmdDeckControlVTRControlMode = 0x76747263, + bmdDeckControlExportMode = 0x6578706d, + bmdDeckControlCaptureMode = 0x6361706d + } BMDDeckControlMode; + +typedef /* [v1_enum] */ +enum _BMDDeckControlEvent + { + bmdDeckControlAbortedEvent = 0x61627465, + bmdDeckControlPrepareForExportEvent = 0x70666565, + bmdDeckControlExportCompleteEvent = 0x65786365, + bmdDeckControlPrepareForCaptureEvent = 0x70666365, + bmdDeckControlCaptureCompleteEvent = 0x63636576 + } BMDDeckControlEvent; + +typedef /* [v1_enum] */ +enum _BMDDeckControlVTRControlState + { + bmdDeckControlNotInVTRControlMode = 0x6e76636d, + bmdDeckControlVTRControlPlaying = 0x76747270, + bmdDeckControlVTRControlRecording = 0x76747272, + bmdDeckControlVTRControlStill = 0x76747261, + bmdDeckControlVTRControlShuttleForward = 0x76747366, + bmdDeckControlVTRControlShuttleReverse = 0x76747372, + bmdDeckControlVTRControlJogForward = 0x76746a66, + bmdDeckControlVTRControlJogReverse = 0x76746a72, + bmdDeckControlVTRControlStopped = 0x7674726f + } BMDDeckControlVTRControlState; + +/* [v1_enum] */ +enum _BMDDeckControlStatusFlags + { + bmdDeckControlStatusDeckConnected = ( 1 << 0 ) , + bmdDeckControlStatusRemoteMode = ( 1 << 1 ) , + bmdDeckControlStatusRecordInhibited = ( 1 << 2 ) , + bmdDeckControlStatusCassetteOut = ( 1 << 3 ) + } ; +/* [v1_enum] */ +enum _BMDDeckControlExportModeOpsFlags + { + bmdDeckControlExportModeInsertVideo = ( 1 << 0 ) , + bmdDeckControlExportModeInsertAudio1 = ( 1 << 1 ) , + bmdDeckControlExportModeInsertAudio2 = ( 1 << 2 ) , + bmdDeckControlExportModeInsertAudio3 = ( 1 << 3 ) , + bmdDeckControlExportModeInsertAudio4 = ( 1 << 4 ) , + bmdDeckControlExportModeInsertAudio5 = ( 1 << 5 ) , + bmdDeckControlExportModeInsertAudio6 = ( 1 << 6 ) , + bmdDeckControlExportModeInsertAudio7 = ( 1 << 7 ) , + bmdDeckControlExportModeInsertAudio8 = ( 1 << 8 ) , + bmdDeckControlExportModeInsertAudio9 = ( 1 << 9 ) , + bmdDeckControlExportModeInsertAudio10 = ( 1 << 10 ) , + bmdDeckControlExportModeInsertAudio11 = ( 1 << 11 ) , + bmdDeckControlExportModeInsertAudio12 = ( 1 << 12 ) , + bmdDeckControlExportModeInsertTimeCode = ( 1 << 13 ) , + bmdDeckControlExportModeInsertAssemble = ( 1 << 14 ) , + bmdDeckControlExportModeInsertPreview = ( 1 << 15 ) , + bmdDeckControlUseManualExport = ( 1 << 16 ) + } ; +typedef /* [v1_enum] */ +enum _BMDDeckControlError + { + bmdDeckControlNoError = 0x6e6f6572, + bmdDeckControlModeError = 0x6d6f6572, + bmdDeckControlMissedInPointError = 0x6d696572, + bmdDeckControlDeckTimeoutError = 0x64746572, + bmdDeckControlCommandFailedError = 0x63666572, + bmdDeckControlDeviceAlreadyOpenedError = 0x64616c6f, + bmdDeckControlFailedToOpenDeviceError = 0x66646572, + bmdDeckControlInLocalModeError = 0x6c6d6572, + bmdDeckControlEndOfTapeError = 0x65746572, + bmdDeckControlUserAbortError = 0x75616572, + bmdDeckControlNoTapeInDeckError = 0x6e746572, + bmdDeckControlNoVideoFromCardError = 0x6e766663, + bmdDeckControlNoCommunicationError = 0x6e636f6d, + bmdDeckControlBufferTooSmallError = 0x6274736d, + bmdDeckControlBadChecksumError = 0x63686b73, + bmdDeckControlUnknownError = 0x756e6572 + } BMDDeckControlError; + + + +#if 0 +#endif +typedef /* [v1_enum] */ +enum _BMDStreamingDeviceMode + { + bmdStreamingDeviceIdle = 0x69646c65, + bmdStreamingDeviceEncoding = 0x656e636f, + bmdStreamingDeviceStopping = 0x73746f70, + bmdStreamingDeviceUnknown = 0x6d756e6b + } BMDStreamingDeviceMode; + +typedef /* [v1_enum] */ +enum _BMDStreamingEncodingFrameRate + { + bmdStreamingEncodedFrameRate50i = 0x65353069, + bmdStreamingEncodedFrameRate5994i = 0x65353969, + bmdStreamingEncodedFrameRate60i = 0x65363069, + bmdStreamingEncodedFrameRate2398p = 0x65323370, + bmdStreamingEncodedFrameRate24p = 0x65323470, + bmdStreamingEncodedFrameRate25p = 0x65323570, + bmdStreamingEncodedFrameRate2997p = 0x65323970, + bmdStreamingEncodedFrameRate30p = 0x65333070, + bmdStreamingEncodedFrameRate50p = 0x65353070, + bmdStreamingEncodedFrameRate5994p = 0x65353970, + bmdStreamingEncodedFrameRate60p = 0x65363070 + } BMDStreamingEncodingFrameRate; + +typedef /* [v1_enum] */ +enum _BMDStreamingEncodingSupport + { + bmdStreamingEncodingModeNotSupported = 0, + bmdStreamingEncodingModeSupported = ( bmdStreamingEncodingModeNotSupported + 1 ) , + bmdStreamingEncodingModeSupportedWithChanges = ( bmdStreamingEncodingModeSupported + 1 ) + } BMDStreamingEncodingSupport; + +typedef /* [v1_enum] */ +enum _BMDStreamingVideoCodec + { + bmdStreamingVideoCodecH264 = 0x48323634 + } BMDStreamingVideoCodec; + +typedef /* [v1_enum] */ +enum _BMDStreamingH264Profile + { + bmdStreamingH264ProfileHigh = 0x68696768, + bmdStreamingH264ProfileMain = 0x6d61696e, + bmdStreamingH264ProfileBaseline = 0x62617365 + } BMDStreamingH264Profile; + +typedef /* [v1_enum] */ +enum _BMDStreamingH264Level + { + bmdStreamingH264Level12 = 0x6c763132, + bmdStreamingH264Level13 = 0x6c763133, + bmdStreamingH264Level2 = 0x6c763220, + bmdStreamingH264Level21 = 0x6c763231, + bmdStreamingH264Level22 = 0x6c763232, + bmdStreamingH264Level3 = 0x6c763320, + bmdStreamingH264Level31 = 0x6c763331, + bmdStreamingH264Level32 = 0x6c763332, + bmdStreamingH264Level4 = 0x6c763420, + bmdStreamingH264Level41 = 0x6c763431, + bmdStreamingH264Level42 = 0x6c763432 + } BMDStreamingH264Level; + +typedef /* [v1_enum] */ +enum _BMDStreamingH264EntropyCoding + { + bmdStreamingH264EntropyCodingCAVLC = 0x45564c43, + bmdStreamingH264EntropyCodingCABAC = 0x45424143 + } BMDStreamingH264EntropyCoding; + +typedef /* [v1_enum] */ +enum _BMDStreamingAudioCodec + { + bmdStreamingAudioCodecAAC = 0x41414320 + } BMDStreamingAudioCodec; + +typedef /* [v1_enum] */ +enum _BMDStreamingEncodingModePropertyID + { + bmdStreamingEncodingPropertyVideoFrameRate = 0x76667274, + bmdStreamingEncodingPropertyVideoBitRateKbps = 0x76627274, + bmdStreamingEncodingPropertyH264Profile = 0x68707266, + bmdStreamingEncodingPropertyH264Level = 0x686c766c, + bmdStreamingEncodingPropertyH264EntropyCoding = 0x68656e74, + bmdStreamingEncodingPropertyH264HasBFrames = 0x68426672, + bmdStreamingEncodingPropertyAudioCodec = 0x61636463, + bmdStreamingEncodingPropertyAudioSampleRate = 0x61737274, + bmdStreamingEncodingPropertyAudioChannelCount = 0x61636863, + bmdStreamingEncodingPropertyAudioBitRateKbps = 0x61627274 + } BMDStreamingEncodingModePropertyID; + + + + + + + + + + + + +typedef unsigned int BMDFrameFlags; +typedef unsigned int BMDVideoInputFlags; +typedef unsigned int BMDVideoInputFormatChangedEvents; +typedef unsigned int BMDDetectedVideoInputFormatFlags; +typedef unsigned int BMDDeckLinkCapturePassthroughMode; +typedef unsigned int BMDAnalogVideoFlags; +typedef unsigned int BMDDeviceBusyState; +#if 0 +typedef enum _BMDFrameFlags BMDFrameFlags; + +typedef enum _BMDVideoInputFlags BMDVideoInputFlags; + +typedef enum _BMDVideoInputFormatChangedEvents BMDVideoInputFormatChangedEvents; + +typedef enum _BMDDetectedVideoInputFormatFlags BMDDetectedVideoInputFormatFlags; + +typedef enum _BMDDeckLinkCapturePassthroughMode BMDDeckLinkCapturePassthroughMode; + +typedef enum _BMDAnalogVideoFlags BMDAnalogVideoFlags; + +typedef enum _BMDDeviceBusyState BMDDeviceBusyState; + +#endif +typedef /* [v1_enum] */ +enum _BMDVideoOutputFlags + { + bmdVideoOutputFlagDefault = 0, + bmdVideoOutputVANC = ( 1 << 0 ) , + bmdVideoOutputVITC = ( 1 << 1 ) , + bmdVideoOutputRP188 = ( 1 << 2 ) , + bmdVideoOutputDualStream3D = ( 1 << 4 ) + } BMDVideoOutputFlags; + +/* [v1_enum] */ +enum _BMDFrameFlags + { + bmdFrameFlagDefault = 0, + bmdFrameFlagFlipVertical = ( 1 << 0 ) , + bmdFrameHasNoInputSource = ( 1 << 31 ) + } ; +/* [v1_enum] */ +enum _BMDVideoInputFlags + { + bmdVideoInputFlagDefault = 0, + bmdVideoInputEnableFormatDetection = ( 1 << 0 ) , + bmdVideoInputDualStream3D = ( 1 << 1 ) + } ; +/* [v1_enum] */ +enum _BMDVideoInputFormatChangedEvents + { + bmdVideoInputDisplayModeChanged = ( 1 << 0 ) , + bmdVideoInputFieldDominanceChanged = ( 1 << 1 ) , + bmdVideoInputColorspaceChanged = ( 1 << 2 ) + } ; +/* [v1_enum] */ +enum _BMDDetectedVideoInputFormatFlags + { + bmdDetectedVideoInputYCbCr422 = ( 1 << 0 ) , + bmdDetectedVideoInputRGB444 = ( 1 << 1 ) , + bmdDetectedVideoInputDualStream3D = ( 1 << 2 ) + } ; +/* [v1_enum] */ +enum _BMDDeckLinkCapturePassthroughMode + { + bmdDeckLinkCapturePassthroughModeDirect = 0x70646972, + bmdDeckLinkCapturePassthroughModeCleanSwitch = 0x70636c6e + } ; +typedef /* [v1_enum] */ +enum _BMDOutputFrameCompletionResult + { + bmdOutputFrameCompleted = 0, + bmdOutputFrameDisplayedLate = ( bmdOutputFrameCompleted + 1 ) , + bmdOutputFrameDropped = ( bmdOutputFrameDisplayedLate + 1 ) , + bmdOutputFrameFlushed = ( bmdOutputFrameDropped + 1 ) + } BMDOutputFrameCompletionResult; + +typedef /* [v1_enum] */ +enum _BMDReferenceStatus + { + bmdReferenceNotSupportedByHardware = ( 1 << 0 ) , + bmdReferenceLocked = ( 1 << 1 ) + } BMDReferenceStatus; + +typedef /* [v1_enum] */ +enum _BMDAudioSampleRate + { + bmdAudioSampleRate48kHz = 48000 + } BMDAudioSampleRate; + +typedef /* [v1_enum] */ +enum _BMDAudioSampleType + { + bmdAudioSampleType16bitInteger = 16, + bmdAudioSampleType32bitInteger = 32 + } BMDAudioSampleType; + +typedef /* [v1_enum] */ +enum _BMDAudioOutputStreamType + { + bmdAudioOutputStreamContinuous = 0, + bmdAudioOutputStreamContinuousDontResample = ( bmdAudioOutputStreamContinuous + 1 ) , + bmdAudioOutputStreamTimestamped = ( bmdAudioOutputStreamContinuousDontResample + 1 ) + } BMDAudioOutputStreamType; + +typedef /* [v1_enum] */ +enum _BMDDisplayModeSupport + { + bmdDisplayModeNotSupported = 0, + bmdDisplayModeSupported = ( bmdDisplayModeNotSupported + 1 ) , + bmdDisplayModeSupportedWithConversion = ( bmdDisplayModeSupported + 1 ) + } BMDDisplayModeSupport; + +typedef /* [v1_enum] */ +enum _BMDTimecodeFormat + { + bmdTimecodeRP188VITC1 = 0x72707631, + bmdTimecodeRP188VITC2 = 0x72703132, + bmdTimecodeRP188LTC = 0x72706c74, + bmdTimecodeRP188Any = 0x72703138, + bmdTimecodeVITC = 0x76697463, + bmdTimecodeVITCField2 = 0x76697432, + bmdTimecodeSerial = 0x73657269 + } BMDTimecodeFormat; + +/* [v1_enum] */ +enum _BMDAnalogVideoFlags + { + bmdAnalogVideoFlagCompositeSetup75 = ( 1 << 0 ) , + bmdAnalogVideoFlagComponentBetacamLevels = ( 1 << 1 ) + } ; +typedef /* [v1_enum] */ +enum _BMDAudioOutputAnalogAESSwitch + { + bmdAudioOutputSwitchAESEBU = 0x61657320, + bmdAudioOutputSwitchAnalog = 0x616e6c67 + } BMDAudioOutputAnalogAESSwitch; + +typedef /* [v1_enum] */ +enum _BMDVideoOutputConversionMode + { + bmdNoVideoOutputConversion = 0x6e6f6e65, + bmdVideoOutputLetterboxDownconversion = 0x6c746278, + bmdVideoOutputAnamorphicDownconversion = 0x616d7068, + bmdVideoOutputHD720toHD1080Conversion = 0x37323063, + bmdVideoOutputHardwareLetterboxDownconversion = 0x48576c62, + bmdVideoOutputHardwareAnamorphicDownconversion = 0x4857616d, + bmdVideoOutputHardwareCenterCutDownconversion = 0x48576363, + bmdVideoOutputHardware720p1080pCrossconversion = 0x78636170, + bmdVideoOutputHardwareAnamorphic720pUpconversion = 0x75613770, + bmdVideoOutputHardwareAnamorphic1080iUpconversion = 0x75613169, + bmdVideoOutputHardwareAnamorphic149To720pUpconversion = 0x75343770, + bmdVideoOutputHardwareAnamorphic149To1080iUpconversion = 0x75343169, + bmdVideoOutputHardwarePillarbox720pUpconversion = 0x75703770, + bmdVideoOutputHardwarePillarbox1080iUpconversion = 0x75703169 + } BMDVideoOutputConversionMode; + +typedef /* [v1_enum] */ +enum _BMDVideoInputConversionMode + { + bmdNoVideoInputConversion = 0x6e6f6e65, + bmdVideoInputLetterboxDownconversionFromHD1080 = 0x31306c62, + bmdVideoInputAnamorphicDownconversionFromHD1080 = 0x3130616d, + bmdVideoInputLetterboxDownconversionFromHD720 = 0x37326c62, + bmdVideoInputAnamorphicDownconversionFromHD720 = 0x3732616d, + bmdVideoInputLetterboxUpconversion = 0x6c627570, + bmdVideoInputAnamorphicUpconversion = 0x616d7570 + } BMDVideoInputConversionMode; + +typedef /* [v1_enum] */ +enum _BMDVideo3DPackingFormat + { + bmdVideo3DPackingSidebySideHalf = 0x73627368, + bmdVideo3DPackingLinebyLine = 0x6c62796c, + bmdVideo3DPackingTopAndBottom = 0x7461626f, + bmdVideo3DPackingFramePacking = 0x6672706b, + bmdVideo3DPackingLeftOnly = 0x6c656674, + bmdVideo3DPackingRightOnly = 0x72696768 + } BMDVideo3DPackingFormat; + +typedef /* [v1_enum] */ +enum _BMDIdleVideoOutputOperation + { + bmdIdleVideoOutputBlack = 0x626c6163, + bmdIdleVideoOutputLastFrame = 0x6c616661, + bmdIdleVideoOutputDesktop = 0x6465736b + } BMDIdleVideoOutputOperation; + +typedef /* [v1_enum] */ +enum _BMDDeckLinkAttributeID + { + BMDDeckLinkSupportsInternalKeying = 0x6b657969, + BMDDeckLinkSupportsExternalKeying = 0x6b657965, + BMDDeckLinkSupportsHDKeying = 0x6b657968, + BMDDeckLinkSupportsInputFormatDetection = 0x696e6664, + BMDDeckLinkHasReferenceInput = 0x6872696e, + BMDDeckLinkHasSerialPort = 0x68737074, + BMDDeckLinkHasAnalogVideoOutputGain = 0x61766f67, + BMDDeckLinkCanOnlyAdjustOverallVideoOutputGain = 0x6f766f67, + BMDDeckLinkHasVideoInputAntiAliasingFilter = 0x6161666c, + BMDDeckLinkHasBypass = 0x62797073, + BMDDeckLinkSupportsDesktopDisplay = 0x65787464, + BMDDeckLinkSupportsClockTimingAdjustment = 0x63746164, + BMDDeckLinkSupportsFullDuplex = 0x66647570, + BMDDeckLinkSupportsFullFrameReferenceInputTimingOffset = 0x6672696e, + BMDDeckLinkSupportsSMPTELevelAOutput = 0x6c766c61, + BMDDeckLinkSupportsDualLinkSDI = 0x73646c73, + BMDDeckLinkSupportsIdleOutput = 0x69646f75, + BMDDeckLinkMaximumAudioChannels = 0x6d616368, + BMDDeckLinkMaximumAnalogAudioChannels = 0x61616368, + BMDDeckLinkNumberOfSubDevices = 0x6e736264, + BMDDeckLinkSubDeviceIndex = 0x73756269, + BMDDeckLinkPersistentID = 0x70656964, + BMDDeckLinkTopologicalID = 0x746f6964, + BMDDeckLinkVideoOutputConnections = 0x766f636e, + BMDDeckLinkVideoInputConnections = 0x7669636e, + BMDDeckLinkAudioOutputConnections = 0x616f636e, + BMDDeckLinkAudioInputConnections = 0x6169636e, + BMDDeckLinkDeviceBusyState = 0x64627374, + BMDDeckLinkVideoIOSupport = 0x76696f73, + BMDDeckLinkVideoInputGainMinimum = 0x7669676d, + BMDDeckLinkVideoInputGainMaximum = 0x76696778, + BMDDeckLinkVideoOutputGainMinimum = 0x766f676d, + BMDDeckLinkVideoOutputGainMaximum = 0x766f6778, + BMDDeckLinkSerialPortDeviceName = 0x736c706e + } BMDDeckLinkAttributeID; + +typedef /* [v1_enum] */ +enum _BMDDeckLinkAPIInformationID + { + BMDDeckLinkAPIVersion = 0x76657273 + } BMDDeckLinkAPIInformationID; + +/* [v1_enum] */ +enum _BMDDeviceBusyState + { + bmdDeviceCaptureBusy = ( 1 << 0 ) , + bmdDevicePlaybackBusy = ( 1 << 1 ) , + bmdDeviceSerialPortBusy = ( 1 << 2 ) + } ; +typedef /* [v1_enum] */ +enum _BMDVideoIOSupport + { + bmdDeviceSupportsCapture = ( 1 << 0 ) , + bmdDeviceSupportsPlayback = ( 1 << 1 ) + } BMDVideoIOSupport; + +typedef /* [v1_enum] */ +enum _BMD3DPreviewFormat + { + bmd3DPreviewFormatDefault = 0x64656661, + bmd3DPreviewFormatLeftOnly = 0x6c656674, + bmd3DPreviewFormatRightOnly = 0x72696768, + bmd3DPreviewFormatSideBySide = 0x73696465, + bmd3DPreviewFormatTopBottom = 0x746f7062 + } BMD3DPreviewFormat; + +typedef /* [v1_enum] */ +enum _BMDNotifications + { + bmdPreferencesChanged = 0x70726566 + } BMDNotifications; + + + + + + + + + + + + + + + + + + + + + + + + + +typedef /* [v1_enum] */ +enum _BMDDeckLinkConfigurationID_v10_2 + { + bmdDeckLinkConfig3GBpsVideoOutput_v10_2 = 0x33676273 + } BMDDeckLinkConfigurationID_v10_2; + +typedef /* [v1_enum] */ +enum _BMDAudioConnection_v10_2 + { + bmdAudioConnectionEmbedded_v10_2 = 0x656d6264, + bmdAudioConnectionAESEBU_v10_2 = 0x61657320, + bmdAudioConnectionAnalog_v10_2 = 0x616e6c67, + bmdAudioConnectionAnalogXLR_v10_2 = 0x61786c72, + bmdAudioConnectionAnalogRCA_v10_2 = 0x61726361 + } BMDAudioConnection_v10_2; + + +typedef /* [v1_enum] */ +enum _BMDDeckControlVTRControlState_v8_1 + { + bmdDeckControlNotInVTRControlMode_v8_1 = 0x6e76636d, + bmdDeckControlVTRControlPlaying_v8_1 = 0x76747270, + bmdDeckControlVTRControlRecording_v8_1 = 0x76747272, + bmdDeckControlVTRControlStill_v8_1 = 0x76747261, + bmdDeckControlVTRControlSeeking_v8_1 = 0x76747273, + bmdDeckControlVTRControlStopped_v8_1 = 0x7674726f + } BMDDeckControlVTRControlState_v8_1; + + + +typedef /* [v1_enum] */ +enum _BMDVideoConnection_v7_6 + { + bmdVideoConnectionSDI_v7_6 = 0x73646920, + bmdVideoConnectionHDMI_v7_6 = 0x68646d69, + bmdVideoConnectionOpticalSDI_v7_6 = 0x6f707469, + bmdVideoConnectionComponent_v7_6 = 0x63706e74, + bmdVideoConnectionComposite_v7_6 = 0x636d7374, + bmdVideoConnectionSVideo_v7_6 = 0x73766964 + } BMDVideoConnection_v7_6; + + + + + + + + + + + + + + + + + + + + + + + +EXTERN_C const IID LIBID_DeckLinkAPI; + +#ifndef __IDeckLinkTimecode_INTERFACE_DEFINED__ +#define __IDeckLinkTimecode_INTERFACE_DEFINED__ + +/* interface IDeckLinkTimecode */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkTimecode; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BC6CFBD3-8317-4325-AC1C-1216391E9340") + IDeckLinkTimecode : public IUnknown + { + public: + virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetComponents( + /* [out] */ unsigned char *hours, + /* [out] */ unsigned char *minutes, + /* [out] */ unsigned char *seconds, + /* [out] */ unsigned char *frames) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [out] */ BSTR *timecode) = 0; + + virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeUserBits( + /* [out] */ BMDTimecodeUserBits *userBits) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkTimecodeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkTimecode * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkTimecode * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkTimecode * This); + + BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( + IDeckLinkTimecode * This); + + HRESULT ( STDMETHODCALLTYPE *GetComponents )( + IDeckLinkTimecode * This, + /* [out] */ unsigned char *hours, + /* [out] */ unsigned char *minutes, + /* [out] */ unsigned char *seconds, + /* [out] */ unsigned char *frames); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IDeckLinkTimecode * This, + /* [out] */ BSTR *timecode); + + BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkTimecode * This); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeUserBits )( + IDeckLinkTimecode * This, + /* [out] */ BMDTimecodeUserBits *userBits); + + END_INTERFACE + } IDeckLinkTimecodeVtbl; + + interface IDeckLinkTimecode + { + CONST_VTBL struct IDeckLinkTimecodeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkTimecode_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkTimecode_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkTimecode_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkTimecode_GetBCD(This) \ + ( (This)->lpVtbl -> GetBCD(This) ) + +#define IDeckLinkTimecode_GetComponents(This,hours,minutes,seconds,frames) \ + ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) + +#define IDeckLinkTimecode_GetString(This,timecode) \ + ( (This)->lpVtbl -> GetString(This,timecode) ) + +#define IDeckLinkTimecode_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkTimecode_GetTimecodeUserBits(This,userBits) \ + ( (This)->lpVtbl -> GetTimecodeUserBits(This,userBits) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkTimecode_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ +#define __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ + +/* interface IDeckLinkDisplayModeIterator */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDisplayModeIterator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9C88499F-F601-4021-B80B-032E4EB41C35") + IDeckLinkDisplayModeIterator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDisplayModeIteratorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDisplayModeIterator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDisplayModeIterator * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDisplayModeIterator * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IDeckLinkDisplayModeIterator * This, + /* [out] */ IDeckLinkDisplayMode **deckLinkDisplayMode); + + END_INTERFACE + } IDeckLinkDisplayModeIteratorVtbl; + + interface IDeckLinkDisplayModeIterator + { + CONST_VTBL struct IDeckLinkDisplayModeIteratorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDisplayModeIterator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDisplayModeIterator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDisplayModeIterator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDisplayModeIterator_Next(This,deckLinkDisplayMode) \ + ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDisplayModeIterator_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayMode_INTERFACE_DEFINED__ +#define __IDeckLinkDisplayMode_INTERFACE_DEFINED__ + +/* interface IDeckLinkDisplayMode */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDisplayMode; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3EB2C1AB-0A3D-4523-A3AD-F40D7FB14E78") + IDeckLinkDisplayMode : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetName( + /* [out] */ BSTR *name) = 0; + + virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; + + virtual long STDMETHODCALLTYPE GetWidth( void) = 0; + + virtual long STDMETHODCALLTYPE GetHeight( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameRate( + /* [out] */ BMDTimeValue *frameDuration, + /* [out] */ BMDTimeScale *timeScale) = 0; + + virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0; + + virtual BMDDisplayModeFlags STDMETHODCALLTYPE GetFlags( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDisplayModeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDisplayMode * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDisplayMode * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDisplayMode * This); + + HRESULT ( STDMETHODCALLTYPE *GetName )( + IDeckLinkDisplayMode * This, + /* [out] */ BSTR *name); + + BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( + IDeckLinkDisplayMode * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkDisplayMode * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkDisplayMode * This); + + HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( + IDeckLinkDisplayMode * This, + /* [out] */ BMDTimeValue *frameDuration, + /* [out] */ BMDTimeScale *timeScale); + + BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( + IDeckLinkDisplayMode * This); + + BMDDisplayModeFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkDisplayMode * This); + + END_INTERFACE + } IDeckLinkDisplayModeVtbl; + + interface IDeckLinkDisplayMode + { + CONST_VTBL struct IDeckLinkDisplayModeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDisplayMode_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDisplayMode_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDisplayMode_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDisplayMode_GetName(This,name) \ + ( (This)->lpVtbl -> GetName(This,name) ) + +#define IDeckLinkDisplayMode_GetDisplayMode(This) \ + ( (This)->lpVtbl -> GetDisplayMode(This) ) + +#define IDeckLinkDisplayMode_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkDisplayMode_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkDisplayMode_GetFrameRate(This,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) + +#define IDeckLinkDisplayMode_GetFieldDominance(This) \ + ( (This)->lpVtbl -> GetFieldDominance(This) ) + +#define IDeckLinkDisplayMode_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDisplayMode_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLink_INTERFACE_DEFINED__ +#define __IDeckLink_INTERFACE_DEFINED__ + +/* interface IDeckLink */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLink; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C418FBDD-0587-48ED-8FE5-640F0A14AF91") + IDeckLink : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetModelName( + /* [out] */ BSTR *modelName) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayName( + /* [out] */ BSTR *displayName) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLink * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLink * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLink * This); + + HRESULT ( STDMETHODCALLTYPE *GetModelName )( + IDeckLink * This, + /* [out] */ BSTR *modelName); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayName )( + IDeckLink * This, + /* [out] */ BSTR *displayName); + + END_INTERFACE + } IDeckLinkVtbl; + + interface IDeckLink + { + CONST_VTBL struct IDeckLinkVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLink_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLink_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLink_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLink_GetModelName(This,modelName) \ + ( (This)->lpVtbl -> GetModelName(This,modelName) ) + +#define IDeckLink_GetDisplayName(This,displayName) \ + ( (This)->lpVtbl -> GetDisplayName(This,displayName) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLink_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkConfiguration_INTERFACE_DEFINED__ +#define __IDeckLinkConfiguration_INTERFACE_DEFINED__ + +/* interface IDeckLinkConfiguration */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkConfiguration; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1E69FCF6-4203-4936-8076-2A9F4CFD50CB") + IDeckLinkConfiguration : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFlag( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BOOL value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFlag( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BOOL *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetInt( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ LONGLONG value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInt( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ LONGLONG *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFloat( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ double value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFloat( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ double *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetString( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BSTR value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BSTR *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkConfigurationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkConfiguration * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkConfiguration * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkConfiguration * This); + + HRESULT ( STDMETHODCALLTYPE *SetFlag )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BOOL value); + + HRESULT ( STDMETHODCALLTYPE *GetFlag )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BOOL *value); + + HRESULT ( STDMETHODCALLTYPE *SetInt )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ LONGLONG value); + + HRESULT ( STDMETHODCALLTYPE *GetInt )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ LONGLONG *value); + + HRESULT ( STDMETHODCALLTYPE *SetFloat )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ double value); + + HRESULT ( STDMETHODCALLTYPE *GetFloat )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ double *value); + + HRESULT ( STDMETHODCALLTYPE *SetString )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BSTR value); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IDeckLinkConfiguration * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BSTR *value); + + HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( + IDeckLinkConfiguration * This); + + END_INTERFACE + } IDeckLinkConfigurationVtbl; + + interface IDeckLinkConfiguration + { + CONST_VTBL struct IDeckLinkConfigurationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkConfiguration_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkConfiguration_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkConfiguration_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkConfiguration_SetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) + +#define IDeckLinkConfiguration_GetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) + +#define IDeckLinkConfiguration_SetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) + +#define IDeckLinkConfiguration_GetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) + +#define IDeckLinkConfiguration_SetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) + +#define IDeckLinkConfiguration_GetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) + +#define IDeckLinkConfiguration_SetString(This,cfgID,value) \ + ( (This)->lpVtbl -> SetString(This,cfgID,value) ) + +#define IDeckLinkConfiguration_GetString(This,cfgID,value) \ + ( (This)->lpVtbl -> GetString(This,cfgID,value) ) + +#define IDeckLinkConfiguration_WriteConfigurationToPreferences(This) \ + ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkConfiguration_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ +#define __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkDeckControlStatusCallback */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDeckControlStatusCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("53436FFB-B434-4906-BADC-AE3060FFE8EF") + IDeckLinkDeckControlStatusCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE TimecodeUpdate( + /* [in] */ BMDTimecodeBCD currentTimecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE VTRControlStateChanged( + /* [in] */ BMDDeckControlVTRControlState newState, + /* [in] */ BMDDeckControlError error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeckControlEventReceived( + /* [in] */ BMDDeckControlEvent event, + /* [in] */ BMDDeckControlError error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeckControlStatusChanged( + /* [in] */ BMDDeckControlStatusFlags flags, + /* [in] */ unsigned int mask) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDeckControlStatusCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDeckControlStatusCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDeckControlStatusCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDeckControlStatusCallback * This); + + HRESULT ( STDMETHODCALLTYPE *TimecodeUpdate )( + IDeckLinkDeckControlStatusCallback * This, + /* [in] */ BMDTimecodeBCD currentTimecode); + + HRESULT ( STDMETHODCALLTYPE *VTRControlStateChanged )( + IDeckLinkDeckControlStatusCallback * This, + /* [in] */ BMDDeckControlVTRControlState newState, + /* [in] */ BMDDeckControlError error); + + HRESULT ( STDMETHODCALLTYPE *DeckControlEventReceived )( + IDeckLinkDeckControlStatusCallback * This, + /* [in] */ BMDDeckControlEvent event, + /* [in] */ BMDDeckControlError error); + + HRESULT ( STDMETHODCALLTYPE *DeckControlStatusChanged )( + IDeckLinkDeckControlStatusCallback * This, + /* [in] */ BMDDeckControlStatusFlags flags, + /* [in] */ unsigned int mask); + + END_INTERFACE + } IDeckLinkDeckControlStatusCallbackVtbl; + + interface IDeckLinkDeckControlStatusCallback + { + CONST_VTBL struct IDeckLinkDeckControlStatusCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDeckControlStatusCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDeckControlStatusCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDeckControlStatusCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDeckControlStatusCallback_TimecodeUpdate(This,currentTimecode) \ + ( (This)->lpVtbl -> TimecodeUpdate(This,currentTimecode) ) + +#define IDeckLinkDeckControlStatusCallback_VTRControlStateChanged(This,newState,error) \ + ( (This)->lpVtbl -> VTRControlStateChanged(This,newState,error) ) + +#define IDeckLinkDeckControlStatusCallback_DeckControlEventReceived(This,event,error) \ + ( (This)->lpVtbl -> DeckControlEventReceived(This,event,error) ) + +#define IDeckLinkDeckControlStatusCallback_DeckControlStatusChanged(This,flags,mask) \ + ( (This)->lpVtbl -> DeckControlStatusChanged(This,flags,mask) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDeckControlStatusCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControl_INTERFACE_DEFINED__ +#define __IDeckLinkDeckControl_INTERFACE_DEFINED__ + +/* interface IDeckLinkDeckControl */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDeckControl; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("8E1C3ACE-19C7-4E00-8B92-D80431D958BE") + IDeckLinkDeckControl : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Open( + /* [in] */ BMDTimeScale timeScale, + /* [in] */ BMDTimeValue timeValue, + /* [in] */ BOOL timecodeIsDropFrame, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Close( + /* [in] */ BOOL standbyOn) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCurrentState( + /* [out] */ BMDDeckControlMode *mode, + /* [out] */ BMDDeckControlVTRControlState *vtrControlState, + /* [out] */ BMDDeckControlStatusFlags *flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStandby( + /* [in] */ BOOL standbyOn) = 0; + + virtual HRESULT STDMETHODCALLTYPE SendCommand( + /* [in] */ unsigned char *inBuffer, + /* [in] */ unsigned int inBufferSize, + /* [out] */ unsigned char *outBuffer, + /* [out] */ unsigned int *outDataSize, + /* [in] */ unsigned int outBufferSize, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Play( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Stop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Eject( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GoToTimecode( + /* [in] */ BMDTimecodeBCD timecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE FastForward( + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Rewind( + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StepForward( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StepBack( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Jog( + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Shuttle( + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( + /* [out] */ BSTR *currentTimeCode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecode( + /* [out] */ IDeckLinkTimecode **currentTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( + /* [out] */ BMDTimecodeBCD *currentTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPreroll( + /* [in] */ unsigned int prerollSeconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPreroll( + /* [out] */ unsigned int *prerollSeconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetExportOffset( + /* [in] */ int exportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetExportOffset( + /* [out] */ int *exportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( + /* [out] */ int *deckManualExportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( + /* [in] */ int captureOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( + /* [out] */ int *captureOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartExport( + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartCapture( + /* [in] */ BOOL useVITC, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceID( + /* [out] */ unsigned short *deviceId, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDeckControlVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDeckControl * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDeckControl * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDeckControl * This); + + HRESULT ( STDMETHODCALLTYPE *Open )( + IDeckLinkDeckControl * This, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ BMDTimeValue timeValue, + /* [in] */ BOOL timecodeIsDropFrame, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Close )( + IDeckLinkDeckControl * This, + /* [in] */ BOOL standbyOn); + + HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlMode *mode, + /* [out] */ BMDDeckControlVTRControlState *vtrControlState, + /* [out] */ BMDDeckControlStatusFlags *flags); + + HRESULT ( STDMETHODCALLTYPE *SetStandby )( + IDeckLinkDeckControl * This, + /* [in] */ BOOL standbyOn); + + HRESULT ( STDMETHODCALLTYPE *SendCommand )( + IDeckLinkDeckControl * This, + /* [in] */ unsigned char *inBuffer, + /* [in] */ unsigned int inBufferSize, + /* [out] */ unsigned char *outBuffer, + /* [out] */ unsigned int *outDataSize, + /* [in] */ unsigned int outBufferSize, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Play )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Stop )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Eject )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( + IDeckLinkDeckControl * This, + /* [in] */ BMDTimecodeBCD timecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *FastForward )( + IDeckLinkDeckControl * This, + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Rewind )( + IDeckLinkDeckControl * This, + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StepForward )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StepBack )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Jog )( + IDeckLinkDeckControl * This, + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Shuttle )( + IDeckLinkDeckControl * This, + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( + IDeckLinkDeckControl * This, + /* [out] */ BSTR *currentTimeCode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkDeckControl * This, + /* [out] */ IDeckLinkTimecode **currentTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( + IDeckLinkDeckControl * This, + /* [out] */ BMDTimecodeBCD *currentTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *SetPreroll )( + IDeckLinkDeckControl * This, + /* [in] */ unsigned int prerollSeconds); + + HRESULT ( STDMETHODCALLTYPE *GetPreroll )( + IDeckLinkDeckControl * This, + /* [out] */ unsigned int *prerollSeconds); + + HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( + IDeckLinkDeckControl * This, + /* [in] */ int exportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( + IDeckLinkDeckControl * This, + /* [out] */ int *exportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( + IDeckLinkDeckControl * This, + /* [out] */ int *deckManualExportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( + IDeckLinkDeckControl * This, + /* [in] */ int captureOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( + IDeckLinkDeckControl * This, + /* [out] */ int *captureOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *StartExport )( + IDeckLinkDeckControl * This, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StartCapture )( + IDeckLinkDeckControl * This, + /* [in] */ BOOL useVITC, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( + IDeckLinkDeckControl * This, + /* [out] */ unsigned short *deviceId, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Abort )( + IDeckLinkDeckControl * This); + + HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( + IDeckLinkDeckControl * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkDeckControl * This, + /* [in] */ IDeckLinkDeckControlStatusCallback *callback); + + END_INTERFACE + } IDeckLinkDeckControlVtbl; + + interface IDeckLinkDeckControl + { + CONST_VTBL struct IDeckLinkDeckControlVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDeckControl_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDeckControl_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDeckControl_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDeckControl_Open(This,timeScale,timeValue,timecodeIsDropFrame,error) \ + ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) + +#define IDeckLinkDeckControl_Close(This,standbyOn) \ + ( (This)->lpVtbl -> Close(This,standbyOn) ) + +#define IDeckLinkDeckControl_GetCurrentState(This,mode,vtrControlState,flags) \ + ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) + +#define IDeckLinkDeckControl_SetStandby(This,standbyOn) \ + ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) + +#define IDeckLinkDeckControl_SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) \ + ( (This)->lpVtbl -> SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) ) + +#define IDeckLinkDeckControl_Play(This,error) \ + ( (This)->lpVtbl -> Play(This,error) ) + +#define IDeckLinkDeckControl_Stop(This,error) \ + ( (This)->lpVtbl -> Stop(This,error) ) + +#define IDeckLinkDeckControl_TogglePlayStop(This,error) \ + ( (This)->lpVtbl -> TogglePlayStop(This,error) ) + +#define IDeckLinkDeckControl_Eject(This,error) \ + ( (This)->lpVtbl -> Eject(This,error) ) + +#define IDeckLinkDeckControl_GoToTimecode(This,timecode,error) \ + ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) + +#define IDeckLinkDeckControl_FastForward(This,viewTape,error) \ + ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) + +#define IDeckLinkDeckControl_Rewind(This,viewTape,error) \ + ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) + +#define IDeckLinkDeckControl_StepForward(This,error) \ + ( (This)->lpVtbl -> StepForward(This,error) ) + +#define IDeckLinkDeckControl_StepBack(This,error) \ + ( (This)->lpVtbl -> StepBack(This,error) ) + +#define IDeckLinkDeckControl_Jog(This,rate,error) \ + ( (This)->lpVtbl -> Jog(This,rate,error) ) + +#define IDeckLinkDeckControl_Shuttle(This,rate,error) \ + ( (This)->lpVtbl -> Shuttle(This,rate,error) ) + +#define IDeckLinkDeckControl_GetTimecodeString(This,currentTimeCode,error) \ + ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) + +#define IDeckLinkDeckControl_GetTimecode(This,currentTimecode,error) \ + ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) + +#define IDeckLinkDeckControl_GetTimecodeBCD(This,currentTimecode,error) \ + ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) + +#define IDeckLinkDeckControl_SetPreroll(This,prerollSeconds) \ + ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) + +#define IDeckLinkDeckControl_GetPreroll(This,prerollSeconds) \ + ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) + +#define IDeckLinkDeckControl_SetExportOffset(This,exportOffsetFields) \ + ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) + +#define IDeckLinkDeckControl_GetExportOffset(This,exportOffsetFields) \ + ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) + +#define IDeckLinkDeckControl_GetManualExportOffset(This,deckManualExportOffsetFields) \ + ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) + +#define IDeckLinkDeckControl_SetCaptureOffset(This,captureOffsetFields) \ + ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) + +#define IDeckLinkDeckControl_GetCaptureOffset(This,captureOffsetFields) \ + ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) + +#define IDeckLinkDeckControl_StartExport(This,inTimecode,outTimecode,exportModeOps,error) \ + ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) + +#define IDeckLinkDeckControl_StartCapture(This,useVITC,inTimecode,outTimecode,error) \ + ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) + +#define IDeckLinkDeckControl_GetDeviceID(This,deviceId,error) \ + ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) + +#define IDeckLinkDeckControl_Abort(This) \ + ( (This)->lpVtbl -> Abort(This) ) + +#define IDeckLinkDeckControl_CrashRecordStart(This,error) \ + ( (This)->lpVtbl -> CrashRecordStart(This,error) ) + +#define IDeckLinkDeckControl_CrashRecordStop(This,error) \ + ( (This)->lpVtbl -> CrashRecordStop(This,error) ) + +#define IDeckLinkDeckControl_SetCallback(This,callback) \ + ( (This)->lpVtbl -> SetCallback(This,callback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDeckControl_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ +#define __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ + +/* interface IBMDStreamingDeviceNotificationCallback */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingDeviceNotificationCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("F9531D64-3305-4B29-A387-7F74BB0D0E84") + IBMDStreamingDeviceNotificationCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE StreamingDeviceArrived( + /* [in] */ IDeckLink *device) = 0; + + virtual HRESULT STDMETHODCALLTYPE StreamingDeviceRemoved( + /* [in] */ IDeckLink *device) = 0; + + virtual HRESULT STDMETHODCALLTYPE StreamingDeviceModeChanged( + /* [in] */ IDeckLink *device, + /* [in] */ BMDStreamingDeviceMode mode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingDeviceNotificationCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingDeviceNotificationCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingDeviceNotificationCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingDeviceNotificationCallback * This); + + HRESULT ( STDMETHODCALLTYPE *StreamingDeviceArrived )( + IBMDStreamingDeviceNotificationCallback * This, + /* [in] */ IDeckLink *device); + + HRESULT ( STDMETHODCALLTYPE *StreamingDeviceRemoved )( + IBMDStreamingDeviceNotificationCallback * This, + /* [in] */ IDeckLink *device); + + HRESULT ( STDMETHODCALLTYPE *StreamingDeviceModeChanged )( + IBMDStreamingDeviceNotificationCallback * This, + /* [in] */ IDeckLink *device, + /* [in] */ BMDStreamingDeviceMode mode); + + END_INTERFACE + } IBMDStreamingDeviceNotificationCallbackVtbl; + + interface IBMDStreamingDeviceNotificationCallback + { + CONST_VTBL struct IBMDStreamingDeviceNotificationCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingDeviceNotificationCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingDeviceNotificationCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingDeviceNotificationCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceArrived(This,device) \ + ( (This)->lpVtbl -> StreamingDeviceArrived(This,device) ) + +#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceRemoved(This,device) \ + ( (This)->lpVtbl -> StreamingDeviceRemoved(This,device) ) + +#define IBMDStreamingDeviceNotificationCallback_StreamingDeviceModeChanged(This,device,mode) \ + ( (This)->lpVtbl -> StreamingDeviceModeChanged(This,device,mode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingDeviceNotificationCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ +#define __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ + +/* interface IBMDStreamingH264InputCallback */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingH264InputCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("823C475F-55AE-46F9-890C-537CC5CEDCCA") + IBMDStreamingH264InputCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE H264NALPacketArrived( + /* [in] */ IBMDStreamingH264NALPacket *nalPacket) = 0; + + virtual HRESULT STDMETHODCALLTYPE H264AudioPacketArrived( + /* [in] */ IBMDStreamingAudioPacket *audioPacket) = 0; + + virtual HRESULT STDMETHODCALLTYPE MPEG2TSPacketArrived( + /* [in] */ IBMDStreamingMPEG2TSPacket *tsPacket) = 0; + + virtual HRESULT STDMETHODCALLTYPE H264VideoInputConnectorScanningChanged( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE H264VideoInputConnectorChanged( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE H264VideoInputModeChanged( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingH264InputCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingH264InputCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingH264InputCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingH264InputCallback * This); + + HRESULT ( STDMETHODCALLTYPE *H264NALPacketArrived )( + IBMDStreamingH264InputCallback * This, + /* [in] */ IBMDStreamingH264NALPacket *nalPacket); + + HRESULT ( STDMETHODCALLTYPE *H264AudioPacketArrived )( + IBMDStreamingH264InputCallback * This, + /* [in] */ IBMDStreamingAudioPacket *audioPacket); + + HRESULT ( STDMETHODCALLTYPE *MPEG2TSPacketArrived )( + IBMDStreamingH264InputCallback * This, + /* [in] */ IBMDStreamingMPEG2TSPacket *tsPacket); + + HRESULT ( STDMETHODCALLTYPE *H264VideoInputConnectorScanningChanged )( + IBMDStreamingH264InputCallback * This); + + HRESULT ( STDMETHODCALLTYPE *H264VideoInputConnectorChanged )( + IBMDStreamingH264InputCallback * This); + + HRESULT ( STDMETHODCALLTYPE *H264VideoInputModeChanged )( + IBMDStreamingH264InputCallback * This); + + END_INTERFACE + } IBMDStreamingH264InputCallbackVtbl; + + interface IBMDStreamingH264InputCallback + { + CONST_VTBL struct IBMDStreamingH264InputCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingH264InputCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingH264InputCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingH264InputCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingH264InputCallback_H264NALPacketArrived(This,nalPacket) \ + ( (This)->lpVtbl -> H264NALPacketArrived(This,nalPacket) ) + +#define IBMDStreamingH264InputCallback_H264AudioPacketArrived(This,audioPacket) \ + ( (This)->lpVtbl -> H264AudioPacketArrived(This,audioPacket) ) + +#define IBMDStreamingH264InputCallback_MPEG2TSPacketArrived(This,tsPacket) \ + ( (This)->lpVtbl -> MPEG2TSPacketArrived(This,tsPacket) ) + +#define IBMDStreamingH264InputCallback_H264VideoInputConnectorScanningChanged(This) \ + ( (This)->lpVtbl -> H264VideoInputConnectorScanningChanged(This) ) + +#define IBMDStreamingH264InputCallback_H264VideoInputConnectorChanged(This) \ + ( (This)->lpVtbl -> H264VideoInputConnectorChanged(This) ) + +#define IBMDStreamingH264InputCallback_H264VideoInputModeChanged(This) \ + ( (This)->lpVtbl -> H264VideoInputModeChanged(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingH264InputCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingDiscovery_INTERFACE_DEFINED__ +#define __IBMDStreamingDiscovery_INTERFACE_DEFINED__ + +/* interface IBMDStreamingDiscovery */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingDiscovery; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2C837444-F989-4D87-901A-47C8A36D096D") + IBMDStreamingDiscovery : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InstallDeviceNotifications( + /* [in] */ IBMDStreamingDeviceNotificationCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE UninstallDeviceNotifications( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingDiscoveryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingDiscovery * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingDiscovery * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingDiscovery * This); + + HRESULT ( STDMETHODCALLTYPE *InstallDeviceNotifications )( + IBMDStreamingDiscovery * This, + /* [in] */ IBMDStreamingDeviceNotificationCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *UninstallDeviceNotifications )( + IBMDStreamingDiscovery * This); + + END_INTERFACE + } IBMDStreamingDiscoveryVtbl; + + interface IBMDStreamingDiscovery + { + CONST_VTBL struct IBMDStreamingDiscoveryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingDiscovery_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingDiscovery_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingDiscovery_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingDiscovery_InstallDeviceNotifications(This,theCallback) \ + ( (This)->lpVtbl -> InstallDeviceNotifications(This,theCallback) ) + +#define IBMDStreamingDiscovery_UninstallDeviceNotifications(This) \ + ( (This)->lpVtbl -> UninstallDeviceNotifications(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingDiscovery_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ +#define __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ + +/* interface IBMDStreamingVideoEncodingMode */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingVideoEncodingMode; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("1AB8035B-CD13-458D-B6DF-5E8F7C2141D9") + IBMDStreamingVideoEncodingMode : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetName( + /* [out] */ BSTR *name) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetPresetID( void) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetSourcePositionX( void) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetSourcePositionY( void) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetSourceWidth( void) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetSourceHeight( void) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetDestWidth( void) = 0; + + virtual unsigned int STDMETHODCALLTYPE GetDestHeight( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFlag( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ BOOL *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInt( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ LONGLONG *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFloat( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ double *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ BSTR *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateMutableVideoEncodingMode( + /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingVideoEncodingModeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingVideoEncodingMode * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingVideoEncodingMode * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingVideoEncodingMode * This); + + HRESULT ( STDMETHODCALLTYPE *GetName )( + IBMDStreamingVideoEncodingMode * This, + /* [out] */ BSTR *name); + + unsigned int ( STDMETHODCALLTYPE *GetPresetID )( + IBMDStreamingVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourcePositionX )( + IBMDStreamingVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourcePositionY )( + IBMDStreamingVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourceWidth )( + IBMDStreamingVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourceHeight )( + IBMDStreamingVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetDestWidth )( + IBMDStreamingVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetDestHeight )( + IBMDStreamingVideoEncodingMode * This); + + HRESULT ( STDMETHODCALLTYPE *GetFlag )( + IBMDStreamingVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ BOOL *value); + + HRESULT ( STDMETHODCALLTYPE *GetInt )( + IBMDStreamingVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ LONGLONG *value); + + HRESULT ( STDMETHODCALLTYPE *GetFloat )( + IBMDStreamingVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ double *value); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IBMDStreamingVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ BSTR *value); + + HRESULT ( STDMETHODCALLTYPE *CreateMutableVideoEncodingMode )( + IBMDStreamingVideoEncodingMode * This, + /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode); + + END_INTERFACE + } IBMDStreamingVideoEncodingModeVtbl; + + interface IBMDStreamingVideoEncodingMode + { + CONST_VTBL struct IBMDStreamingVideoEncodingModeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingVideoEncodingMode_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingVideoEncodingMode_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingVideoEncodingMode_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingVideoEncodingMode_GetName(This,name) \ + ( (This)->lpVtbl -> GetName(This,name) ) + +#define IBMDStreamingVideoEncodingMode_GetPresetID(This) \ + ( (This)->lpVtbl -> GetPresetID(This) ) + +#define IBMDStreamingVideoEncodingMode_GetSourcePositionX(This) \ + ( (This)->lpVtbl -> GetSourcePositionX(This) ) + +#define IBMDStreamingVideoEncodingMode_GetSourcePositionY(This) \ + ( (This)->lpVtbl -> GetSourcePositionY(This) ) + +#define IBMDStreamingVideoEncodingMode_GetSourceWidth(This) \ + ( (This)->lpVtbl -> GetSourceWidth(This) ) + +#define IBMDStreamingVideoEncodingMode_GetSourceHeight(This) \ + ( (This)->lpVtbl -> GetSourceHeight(This) ) + +#define IBMDStreamingVideoEncodingMode_GetDestWidth(This) \ + ( (This)->lpVtbl -> GetDestWidth(This) ) + +#define IBMDStreamingVideoEncodingMode_GetDestHeight(This) \ + ( (This)->lpVtbl -> GetDestHeight(This) ) + +#define IBMDStreamingVideoEncodingMode_GetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) + +#define IBMDStreamingVideoEncodingMode_GetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) + +#define IBMDStreamingVideoEncodingMode_GetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) + +#define IBMDStreamingVideoEncodingMode_GetString(This,cfgID,value) \ + ( (This)->lpVtbl -> GetString(This,cfgID,value) ) + +#define IBMDStreamingVideoEncodingMode_CreateMutableVideoEncodingMode(This,newEncodingMode) \ + ( (This)->lpVtbl -> CreateMutableVideoEncodingMode(This,newEncodingMode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingVideoEncodingMode_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ +#define __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ + +/* interface IBMDStreamingMutableVideoEncodingMode */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingMutableVideoEncodingMode; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("19BF7D90-1E0A-400D-B2C6-FFC4E78AD49D") + IBMDStreamingMutableVideoEncodingMode : public IBMDStreamingVideoEncodingMode + { + public: + virtual HRESULT STDMETHODCALLTYPE SetSourceRect( + /* [in] */ unsigned int posX, + /* [in] */ unsigned int posY, + /* [in] */ unsigned int width, + /* [in] */ unsigned int height) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetDestSize( + /* [in] */ unsigned int width, + /* [in] */ unsigned int height) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFlag( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ BOOL value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetInt( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ LONGLONG value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFloat( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ double value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetString( + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ BSTR value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingMutableVideoEncodingModeVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingMutableVideoEncodingMode * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingMutableVideoEncodingMode * This); + + HRESULT ( STDMETHODCALLTYPE *GetName )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [out] */ BSTR *name); + + unsigned int ( STDMETHODCALLTYPE *GetPresetID )( + IBMDStreamingMutableVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourcePositionX )( + IBMDStreamingMutableVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourcePositionY )( + IBMDStreamingMutableVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourceWidth )( + IBMDStreamingMutableVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetSourceHeight )( + IBMDStreamingMutableVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetDestWidth )( + IBMDStreamingMutableVideoEncodingMode * This); + + unsigned int ( STDMETHODCALLTYPE *GetDestHeight )( + IBMDStreamingMutableVideoEncodingMode * This); + + HRESULT ( STDMETHODCALLTYPE *GetFlag )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ BOOL *value); + + HRESULT ( STDMETHODCALLTYPE *GetInt )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ LONGLONG *value); + + HRESULT ( STDMETHODCALLTYPE *GetFloat )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ double *value); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [out] */ BSTR *value); + + HRESULT ( STDMETHODCALLTYPE *CreateMutableVideoEncodingMode )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [out] */ IBMDStreamingMutableVideoEncodingMode **newEncodingMode); + + HRESULT ( STDMETHODCALLTYPE *SetSourceRect )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ unsigned int posX, + /* [in] */ unsigned int posY, + /* [in] */ unsigned int width, + /* [in] */ unsigned int height); + + HRESULT ( STDMETHODCALLTYPE *SetDestSize )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ unsigned int width, + /* [in] */ unsigned int height); + + HRESULT ( STDMETHODCALLTYPE *SetFlag )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ BOOL value); + + HRESULT ( STDMETHODCALLTYPE *SetInt )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ LONGLONG value); + + HRESULT ( STDMETHODCALLTYPE *SetFloat )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ double value); + + HRESULT ( STDMETHODCALLTYPE *SetString )( + IBMDStreamingMutableVideoEncodingMode * This, + /* [in] */ BMDStreamingEncodingModePropertyID cfgID, + /* [in] */ BSTR value); + + END_INTERFACE + } IBMDStreamingMutableVideoEncodingModeVtbl; + + interface IBMDStreamingMutableVideoEncodingMode + { + CONST_VTBL struct IBMDStreamingMutableVideoEncodingModeVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingMutableVideoEncodingMode_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingMutableVideoEncodingMode_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingMutableVideoEncodingMode_GetName(This,name) \ + ( (This)->lpVtbl -> GetName(This,name) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetPresetID(This) \ + ( (This)->lpVtbl -> GetPresetID(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetSourcePositionX(This) \ + ( (This)->lpVtbl -> GetSourcePositionX(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetSourcePositionY(This) \ + ( (This)->lpVtbl -> GetSourcePositionY(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetSourceWidth(This) \ + ( (This)->lpVtbl -> GetSourceWidth(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetSourceHeight(This) \ + ( (This)->lpVtbl -> GetSourceHeight(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetDestWidth(This) \ + ( (This)->lpVtbl -> GetDestWidth(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetDestHeight(This) \ + ( (This)->lpVtbl -> GetDestHeight(This) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_GetString(This,cfgID,value) \ + ( (This)->lpVtbl -> GetString(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_CreateMutableVideoEncodingMode(This,newEncodingMode) \ + ( (This)->lpVtbl -> CreateMutableVideoEncodingMode(This,newEncodingMode) ) + + +#define IBMDStreamingMutableVideoEncodingMode_SetSourceRect(This,posX,posY,width,height) \ + ( (This)->lpVtbl -> SetSourceRect(This,posX,posY,width,height) ) + +#define IBMDStreamingMutableVideoEncodingMode_SetDestSize(This,width,height) \ + ( (This)->lpVtbl -> SetDestSize(This,width,height) ) + +#define IBMDStreamingMutableVideoEncodingMode_SetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_SetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_SetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) + +#define IBMDStreamingMutableVideoEncodingMode_SetString(This,cfgID,value) \ + ( (This)->lpVtbl -> SetString(This,cfgID,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingMutableVideoEncodingMode_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ +#define __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ + +/* interface IBMDStreamingVideoEncodingModePresetIterator */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingVideoEncodingModePresetIterator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7AC731A3-C950-4AD0-804A-8377AA51C6C4") + IBMDStreamingVideoEncodingModePresetIterator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [out] */ IBMDStreamingVideoEncodingMode **videoEncodingMode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingVideoEncodingModePresetIteratorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingVideoEncodingModePresetIterator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingVideoEncodingModePresetIterator * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingVideoEncodingModePresetIterator * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IBMDStreamingVideoEncodingModePresetIterator * This, + /* [out] */ IBMDStreamingVideoEncodingMode **videoEncodingMode); + + END_INTERFACE + } IBMDStreamingVideoEncodingModePresetIteratorVtbl; + + interface IBMDStreamingVideoEncodingModePresetIterator + { + CONST_VTBL struct IBMDStreamingVideoEncodingModePresetIteratorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingVideoEncodingModePresetIterator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingVideoEncodingModePresetIterator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingVideoEncodingModePresetIterator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingVideoEncodingModePresetIterator_Next(This,videoEncodingMode) \ + ( (This)->lpVtbl -> Next(This,videoEncodingMode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingVideoEncodingModePresetIterator_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ +#define __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ + +/* interface IBMDStreamingDeviceInput */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingDeviceInput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("24B6B6EC-1727-44BB-9818-34FF086ACF98") + IBMDStreamingDeviceInput : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoInputMode( + /* [in] */ BMDDisplayMode inputMode, + /* [out] */ BOOL *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoInputModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoInputMode( + /* [in] */ BMDDisplayMode inputMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCurrentDetectedVideoInputMode( + /* [out] */ BMDDisplayMode *detectedMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoEncodingMode( + /* [out] */ IBMDStreamingVideoEncodingMode **encodingMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoEncodingModePresetIterator( + /* [in] */ BMDDisplayMode inputMode, + /* [out] */ IBMDStreamingVideoEncodingModePresetIterator **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoEncodingMode( + /* [in] */ BMDDisplayMode inputMode, + /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode, + /* [out] */ BMDStreamingEncodingSupport *result, + /* [out] */ IBMDStreamingVideoEncodingMode **changedEncodingMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoEncodingMode( + /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartCapture( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopCapture( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IUnknown *theCallback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingDeviceInputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingDeviceInput * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingDeviceInput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingDeviceInput * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoInputMode )( + IBMDStreamingDeviceInput * This, + /* [in] */ BMDDisplayMode inputMode, + /* [out] */ BOOL *result); + + HRESULT ( STDMETHODCALLTYPE *GetVideoInputModeIterator )( + IBMDStreamingDeviceInput * This, + /* [out] */ IDeckLinkDisplayModeIterator **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetVideoInputMode )( + IBMDStreamingDeviceInput * This, + /* [in] */ BMDDisplayMode inputMode); + + HRESULT ( STDMETHODCALLTYPE *GetCurrentDetectedVideoInputMode )( + IBMDStreamingDeviceInput * This, + /* [out] */ BMDDisplayMode *detectedMode); + + HRESULT ( STDMETHODCALLTYPE *GetVideoEncodingMode )( + IBMDStreamingDeviceInput * This, + /* [out] */ IBMDStreamingVideoEncodingMode **encodingMode); + + HRESULT ( STDMETHODCALLTYPE *GetVideoEncodingModePresetIterator )( + IBMDStreamingDeviceInput * This, + /* [in] */ BMDDisplayMode inputMode, + /* [out] */ IBMDStreamingVideoEncodingModePresetIterator **iterator); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoEncodingMode )( + IBMDStreamingDeviceInput * This, + /* [in] */ BMDDisplayMode inputMode, + /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode, + /* [out] */ BMDStreamingEncodingSupport *result, + /* [out] */ IBMDStreamingVideoEncodingMode **changedEncodingMode); + + HRESULT ( STDMETHODCALLTYPE *SetVideoEncodingMode )( + IBMDStreamingDeviceInput * This, + /* [in] */ IBMDStreamingVideoEncodingMode *encodingMode); + + HRESULT ( STDMETHODCALLTYPE *StartCapture )( + IBMDStreamingDeviceInput * This); + + HRESULT ( STDMETHODCALLTYPE *StopCapture )( + IBMDStreamingDeviceInput * This); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IBMDStreamingDeviceInput * This, + /* [in] */ IUnknown *theCallback); + + END_INTERFACE + } IBMDStreamingDeviceInputVtbl; + + interface IBMDStreamingDeviceInput + { + CONST_VTBL struct IBMDStreamingDeviceInputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingDeviceInput_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingDeviceInput_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingDeviceInput_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingDeviceInput_DoesSupportVideoInputMode(This,inputMode,result) \ + ( (This)->lpVtbl -> DoesSupportVideoInputMode(This,inputMode,result) ) + +#define IBMDStreamingDeviceInput_GetVideoInputModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetVideoInputModeIterator(This,iterator) ) + +#define IBMDStreamingDeviceInput_SetVideoInputMode(This,inputMode) \ + ( (This)->lpVtbl -> SetVideoInputMode(This,inputMode) ) + +#define IBMDStreamingDeviceInput_GetCurrentDetectedVideoInputMode(This,detectedMode) \ + ( (This)->lpVtbl -> GetCurrentDetectedVideoInputMode(This,detectedMode) ) + +#define IBMDStreamingDeviceInput_GetVideoEncodingMode(This,encodingMode) \ + ( (This)->lpVtbl -> GetVideoEncodingMode(This,encodingMode) ) + +#define IBMDStreamingDeviceInput_GetVideoEncodingModePresetIterator(This,inputMode,iterator) \ + ( (This)->lpVtbl -> GetVideoEncodingModePresetIterator(This,inputMode,iterator) ) + +#define IBMDStreamingDeviceInput_DoesSupportVideoEncodingMode(This,inputMode,encodingMode,result,changedEncodingMode) \ + ( (This)->lpVtbl -> DoesSupportVideoEncodingMode(This,inputMode,encodingMode,result,changedEncodingMode) ) + +#define IBMDStreamingDeviceInput_SetVideoEncodingMode(This,encodingMode) \ + ( (This)->lpVtbl -> SetVideoEncodingMode(This,encodingMode) ) + +#define IBMDStreamingDeviceInput_StartCapture(This) \ + ( (This)->lpVtbl -> StartCapture(This) ) + +#define IBMDStreamingDeviceInput_StopCapture(This) \ + ( (This)->lpVtbl -> StopCapture(This) ) + +#define IBMDStreamingDeviceInput_SetCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetCallback(This,theCallback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingDeviceInput_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ +#define __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ + +/* interface IBMDStreamingH264NALPacket */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingH264NALPacket; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E260E955-14BE-4395-9775-9F02CC0A9D89") + IBMDStreamingH264NALPacket : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + /* [out] */ void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytesWithSizePrefix( + /* [out] */ void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayTime( + /* [in] */ ULONGLONG requestedTimeScale, + /* [out] */ ULONGLONG *displayTime) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPacketIndex( + /* [out] */ unsigned int *packetIndex) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingH264NALPacketVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingH264NALPacket * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingH264NALPacket * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingH264NALPacket * This); + + long ( STDMETHODCALLTYPE *GetPayloadSize )( + IBMDStreamingH264NALPacket * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IBMDStreamingH264NALPacket * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetBytesWithSizePrefix )( + IBMDStreamingH264NALPacket * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayTime )( + IBMDStreamingH264NALPacket * This, + /* [in] */ ULONGLONG requestedTimeScale, + /* [out] */ ULONGLONG *displayTime); + + HRESULT ( STDMETHODCALLTYPE *GetPacketIndex )( + IBMDStreamingH264NALPacket * This, + /* [out] */ unsigned int *packetIndex); + + END_INTERFACE + } IBMDStreamingH264NALPacketVtbl; + + interface IBMDStreamingH264NALPacket + { + CONST_VTBL struct IBMDStreamingH264NALPacketVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingH264NALPacket_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingH264NALPacket_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingH264NALPacket_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingH264NALPacket_GetPayloadSize(This) \ + ( (This)->lpVtbl -> GetPayloadSize(This) ) + +#define IBMDStreamingH264NALPacket_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IBMDStreamingH264NALPacket_GetBytesWithSizePrefix(This,buffer) \ + ( (This)->lpVtbl -> GetBytesWithSizePrefix(This,buffer) ) + +#define IBMDStreamingH264NALPacket_GetDisplayTime(This,requestedTimeScale,displayTime) \ + ( (This)->lpVtbl -> GetDisplayTime(This,requestedTimeScale,displayTime) ) + +#define IBMDStreamingH264NALPacket_GetPacketIndex(This,packetIndex) \ + ( (This)->lpVtbl -> GetPacketIndex(This,packetIndex) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingH264NALPacket_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ +#define __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ + +/* interface IBMDStreamingAudioPacket */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingAudioPacket; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("D9EB5902-1AD2-43F4-9E2C-3CFA50B5EE19") + IBMDStreamingAudioPacket : public IUnknown + { + public: + virtual BMDStreamingAudioCodec STDMETHODCALLTYPE GetCodec( void) = 0; + + virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + /* [out] */ void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPlayTime( + /* [in] */ ULONGLONG requestedTimeScale, + /* [out] */ ULONGLONG *playTime) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPacketIndex( + /* [out] */ unsigned int *packetIndex) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingAudioPacketVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingAudioPacket * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingAudioPacket * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingAudioPacket * This); + + BMDStreamingAudioCodec ( STDMETHODCALLTYPE *GetCodec )( + IBMDStreamingAudioPacket * This); + + long ( STDMETHODCALLTYPE *GetPayloadSize )( + IBMDStreamingAudioPacket * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IBMDStreamingAudioPacket * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetPlayTime )( + IBMDStreamingAudioPacket * This, + /* [in] */ ULONGLONG requestedTimeScale, + /* [out] */ ULONGLONG *playTime); + + HRESULT ( STDMETHODCALLTYPE *GetPacketIndex )( + IBMDStreamingAudioPacket * This, + /* [out] */ unsigned int *packetIndex); + + END_INTERFACE + } IBMDStreamingAudioPacketVtbl; + + interface IBMDStreamingAudioPacket + { + CONST_VTBL struct IBMDStreamingAudioPacketVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingAudioPacket_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingAudioPacket_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingAudioPacket_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingAudioPacket_GetCodec(This) \ + ( (This)->lpVtbl -> GetCodec(This) ) + +#define IBMDStreamingAudioPacket_GetPayloadSize(This) \ + ( (This)->lpVtbl -> GetPayloadSize(This) ) + +#define IBMDStreamingAudioPacket_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IBMDStreamingAudioPacket_GetPlayTime(This,requestedTimeScale,playTime) \ + ( (This)->lpVtbl -> GetPlayTime(This,requestedTimeScale,playTime) ) + +#define IBMDStreamingAudioPacket_GetPacketIndex(This,packetIndex) \ + ( (This)->lpVtbl -> GetPacketIndex(This,packetIndex) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingAudioPacket_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ +#define __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ + +/* interface IBMDStreamingMPEG2TSPacket */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingMPEG2TSPacket; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("91810D1C-4FB3-4AAA-AE56-FA301D3DFA4C") + IBMDStreamingMPEG2TSPacket : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetPayloadSize( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + /* [out] */ void **buffer) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingMPEG2TSPacketVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingMPEG2TSPacket * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingMPEG2TSPacket * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingMPEG2TSPacket * This); + + long ( STDMETHODCALLTYPE *GetPayloadSize )( + IBMDStreamingMPEG2TSPacket * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IBMDStreamingMPEG2TSPacket * This, + /* [out] */ void **buffer); + + END_INTERFACE + } IBMDStreamingMPEG2TSPacketVtbl; + + interface IBMDStreamingMPEG2TSPacket + { + CONST_VTBL struct IBMDStreamingMPEG2TSPacketVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingMPEG2TSPacket_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingMPEG2TSPacket_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingMPEG2TSPacket_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingMPEG2TSPacket_GetPayloadSize(This) \ + ( (This)->lpVtbl -> GetPayloadSize(This) ) + +#define IBMDStreamingMPEG2TSPacket_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingMPEG2TSPacket_INTERFACE_DEFINED__ */ + + +#ifndef __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ +#define __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ + +/* interface IBMDStreamingH264NALParser */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IBMDStreamingH264NALParser; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("5867F18C-5BFA-4CCC-B2A7-9DFD140417D2") + IBMDStreamingH264NALParser : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE IsNALSequenceParameterSet( + /* [in] */ IBMDStreamingH264NALPacket *nal) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsNALPictureParameterSet( + /* [in] */ IBMDStreamingH264NALPacket *nal) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetProfileAndLevelFromSPS( + /* [in] */ IBMDStreamingH264NALPacket *nal, + /* [out] */ unsigned int *profileIdc, + /* [out] */ unsigned int *profileCompatability, + /* [out] */ unsigned int *levelIdc) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IBMDStreamingH264NALParserVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IBMDStreamingH264NALParser * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IBMDStreamingH264NALParser * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IBMDStreamingH264NALParser * This); + + HRESULT ( STDMETHODCALLTYPE *IsNALSequenceParameterSet )( + IBMDStreamingH264NALParser * This, + /* [in] */ IBMDStreamingH264NALPacket *nal); + + HRESULT ( STDMETHODCALLTYPE *IsNALPictureParameterSet )( + IBMDStreamingH264NALParser * This, + /* [in] */ IBMDStreamingH264NALPacket *nal); + + HRESULT ( STDMETHODCALLTYPE *GetProfileAndLevelFromSPS )( + IBMDStreamingH264NALParser * This, + /* [in] */ IBMDStreamingH264NALPacket *nal, + /* [out] */ unsigned int *profileIdc, + /* [out] */ unsigned int *profileCompatability, + /* [out] */ unsigned int *levelIdc); + + END_INTERFACE + } IBMDStreamingH264NALParserVtbl; + + interface IBMDStreamingH264NALParser + { + CONST_VTBL struct IBMDStreamingH264NALParserVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IBMDStreamingH264NALParser_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IBMDStreamingH264NALParser_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IBMDStreamingH264NALParser_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IBMDStreamingH264NALParser_IsNALSequenceParameterSet(This,nal) \ + ( (This)->lpVtbl -> IsNALSequenceParameterSet(This,nal) ) + +#define IBMDStreamingH264NALParser_IsNALPictureParameterSet(This,nal) \ + ( (This)->lpVtbl -> IsNALPictureParameterSet(This,nal) ) + +#define IBMDStreamingH264NALParser_GetProfileAndLevelFromSPS(This,nal,profileIdc,profileCompatability,levelIdc) \ + ( (This)->lpVtbl -> GetProfileAndLevelFromSPS(This,nal,profileIdc,profileCompatability,levelIdc) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IBMDStreamingH264NALParser_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_CBMDStreamingDiscovery; + +#ifdef __cplusplus + +class DECLSPEC_UUID("0CAA31F6-8A26-40B0-86A4-BF58DCCA710C") +CBMDStreamingDiscovery; +#endif + +EXTERN_C const CLSID CLSID_CBMDStreamingH264NALParser; + +#ifdef __cplusplus + +class DECLSPEC_UUID("7753EFBD-951C-407C-97A5-23C737B73B52") +CBMDStreamingH264NALParser; +#endif + +#ifndef __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ +#define __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoOutputCallback */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoOutputCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("20AA5225-1958-47CB-820B-80A8D521A6EE") + IDeckLinkVideoOutputCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( + /* [in] */ IDeckLinkVideoFrame *completedFrame, + /* [in] */ BMDOutputFrameCompletionResult result) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoOutputCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoOutputCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoOutputCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoOutputCallback * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( + IDeckLinkVideoOutputCallback * This, + /* [in] */ IDeckLinkVideoFrame *completedFrame, + /* [in] */ BMDOutputFrameCompletionResult result); + + HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( + IDeckLinkVideoOutputCallback * This); + + END_INTERFACE + } IDeckLinkVideoOutputCallbackVtbl; + + interface IDeckLinkVideoOutputCallback + { + CONST_VTBL struct IDeckLinkVideoOutputCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoOutputCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoOutputCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoOutputCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoOutputCallback_ScheduledFrameCompleted(This,completedFrame,result) \ + ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) + +#define IDeckLinkVideoOutputCallback_ScheduledPlaybackHasStopped(This) \ + ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoOutputCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_INTERFACE_DEFINED__ +#define __IDeckLinkInputCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkInputCallback */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInputCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DD04E5EC-7415-42AB-AE4A-E80C4DFC044A") + IDeckLinkInputCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( + /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, + /* [in] */ IDeckLinkDisplayMode *newDisplayMode, + /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( + /* [in] */ IDeckLinkVideoInputFrame *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInputCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInputCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInputCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInputCallback * This); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( + IDeckLinkInputCallback * This, + /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, + /* [in] */ IDeckLinkDisplayMode *newDisplayMode, + /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( + IDeckLinkInputCallback * This, + /* [in] */ IDeckLinkVideoInputFrame *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket *audioPacket); + + END_INTERFACE + } IDeckLinkInputCallbackVtbl; + + interface IDeckLinkInputCallback + { + CONST_VTBL struct IDeckLinkInputCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInputCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInputCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInputCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInputCallback_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ + ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) + +#define IDeckLinkInputCallback_VideoInputFrameArrived(This,videoFrame,audioPacket) \ + ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInputCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ +#define __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ + +/* interface IDeckLinkMemoryAllocator */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkMemoryAllocator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B36EB6E7-9D29-4AA8-92EF-843B87A289E8") + IDeckLinkMemoryAllocator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE AllocateBuffer( + /* [in] */ unsigned int bufferSize, + /* [out] */ void **allocatedBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer( + /* [in] */ void *buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE Commit( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE Decommit( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkMemoryAllocatorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkMemoryAllocator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkMemoryAllocator * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkMemoryAllocator * This); + + HRESULT ( STDMETHODCALLTYPE *AllocateBuffer )( + IDeckLinkMemoryAllocator * This, + /* [in] */ unsigned int bufferSize, + /* [out] */ void **allocatedBuffer); + + HRESULT ( STDMETHODCALLTYPE *ReleaseBuffer )( + IDeckLinkMemoryAllocator * This, + /* [in] */ void *buffer); + + HRESULT ( STDMETHODCALLTYPE *Commit )( + IDeckLinkMemoryAllocator * This); + + HRESULT ( STDMETHODCALLTYPE *Decommit )( + IDeckLinkMemoryAllocator * This); + + END_INTERFACE + } IDeckLinkMemoryAllocatorVtbl; + + interface IDeckLinkMemoryAllocator + { + CONST_VTBL struct IDeckLinkMemoryAllocatorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkMemoryAllocator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkMemoryAllocator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkMemoryAllocator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkMemoryAllocator_AllocateBuffer(This,bufferSize,allocatedBuffer) \ + ( (This)->lpVtbl -> AllocateBuffer(This,bufferSize,allocatedBuffer) ) + +#define IDeckLinkMemoryAllocator_ReleaseBuffer(This,buffer) \ + ( (This)->lpVtbl -> ReleaseBuffer(This,buffer) ) + +#define IDeckLinkMemoryAllocator_Commit(This) \ + ( (This)->lpVtbl -> Commit(This) ) + +#define IDeckLinkMemoryAllocator_Decommit(This) \ + ( (This)->lpVtbl -> Decommit(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkMemoryAllocator_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ +#define __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkAudioOutputCallback */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkAudioOutputCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("403C681B-7F46-4A12-B993-2BB127084EE6") + IDeckLinkAudioOutputCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE RenderAudioSamples( + /* [in] */ BOOL preroll) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkAudioOutputCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkAudioOutputCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkAudioOutputCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkAudioOutputCallback * This); + + HRESULT ( STDMETHODCALLTYPE *RenderAudioSamples )( + IDeckLinkAudioOutputCallback * This, + /* [in] */ BOOL preroll); + + END_INTERFACE + } IDeckLinkAudioOutputCallbackVtbl; + + interface IDeckLinkAudioOutputCallback + { + CONST_VTBL struct IDeckLinkAudioOutputCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkAudioOutputCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkAudioOutputCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkAudioOutputCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkAudioOutputCallback_RenderAudioSamples(This,preroll) \ + ( (This)->lpVtbl -> RenderAudioSamples(This,preroll) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkAudioOutputCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkIterator_INTERFACE_DEFINED__ +#define __IDeckLinkIterator_INTERFACE_DEFINED__ + +/* interface IDeckLinkIterator */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkIterator; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("50FB36CD-3063-4B73-BDBB-958087F2D8BA") + IDeckLinkIterator : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [out] */ IDeckLink **deckLinkInstance) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkIteratorVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkIterator * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkIterator * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkIterator * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IDeckLinkIterator * This, + /* [out] */ IDeckLink **deckLinkInstance); + + END_INTERFACE + } IDeckLinkIteratorVtbl; + + interface IDeckLinkIterator + { + CONST_VTBL struct IDeckLinkIteratorVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkIterator_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkIterator_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkIterator_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkIterator_Next(This,deckLinkInstance) \ + ( (This)->lpVtbl -> Next(This,deckLinkInstance) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkIterator_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkAPIInformation_INTERFACE_DEFINED__ +#define __IDeckLinkAPIInformation_INTERFACE_DEFINED__ + +/* interface IDeckLinkAPIInformation */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkAPIInformation; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7BEA3C68-730D-4322-AF34-8A7152B532A4") + IDeckLinkAPIInformation : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetFlag( + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ BOOL *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInt( + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ LONGLONG *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFloat( + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ double *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ BSTR *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkAPIInformationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkAPIInformation * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkAPIInformation * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkAPIInformation * This); + + HRESULT ( STDMETHODCALLTYPE *GetFlag )( + IDeckLinkAPIInformation * This, + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ BOOL *value); + + HRESULT ( STDMETHODCALLTYPE *GetInt )( + IDeckLinkAPIInformation * This, + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ LONGLONG *value); + + HRESULT ( STDMETHODCALLTYPE *GetFloat )( + IDeckLinkAPIInformation * This, + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ double *value); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IDeckLinkAPIInformation * This, + /* [in] */ BMDDeckLinkAPIInformationID cfgID, + /* [out] */ BSTR *value); + + END_INTERFACE + } IDeckLinkAPIInformationVtbl; + + interface IDeckLinkAPIInformation + { + CONST_VTBL struct IDeckLinkAPIInformationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkAPIInformation_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkAPIInformation_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkAPIInformation_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkAPIInformation_GetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) + +#define IDeckLinkAPIInformation_GetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) + +#define IDeckLinkAPIInformation_GetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) + +#define IDeckLinkAPIInformation_GetString(This,cfgID,value) \ + ( (This)->lpVtbl -> GetString(This,cfgID,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkAPIInformation_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_INTERFACE_DEFINED__ +#define __IDeckLinkOutput_INTERFACE_DEFINED__ + +/* interface IDeckLinkOutput */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkOutput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CC5C8A6E-3F2F-4B3A-87EA-FD78AF300564") + IDeckLinkOutput : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoOutputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDVideoOutputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( + /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( + /* [in] */ int width, + /* [in] */ int height, + /* [in] */ int rowBytes, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( + /* [in] */ BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( + /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( + /* [in] */ IDeckLinkVideoFrame *theFrame, + /* [in] */ BMDTimeValue displayTime, + /* [in] */ BMDTimeValue displayDuration, + /* [in] */ BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( + /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( + /* [out] */ unsigned int *bufferedFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount, + /* [in] */ BMDAudioOutputStreamType streamType) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [in] */ BMDTimeValue streamTime, + /* [in] */ BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( + /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( + /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( + /* [in] */ BMDTimeValue playbackStartTime, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ double playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( + /* [in] */ BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + /* [in] */ BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( + /* [out] */ BOOL *active) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *streamTime, + /* [out] */ double *playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( + /* [out] */ BMDReferenceStatus *referenceStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameCompletionReferenceTimestamp( + /* [in] */ IDeckLinkVideoFrame *theFrame, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *frameCompletionTimestamp) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkOutputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkOutput * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkOutput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkOutput * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkOutput * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoOutputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkOutput * This, + /* [out] */ IDeckLinkDisplayModeIterator **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( + IDeckLinkOutput * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDVideoOutputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( + IDeckLinkOutput * This); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkMemoryAllocator *theAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( + IDeckLinkOutput * This, + /* [in] */ int width, + /* [in] */ int height, + /* [in] */ int rowBytes, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame **outFrame); + + HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( + IDeckLinkOutput * This, + /* [in] */ BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); + + HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkVideoFrame *theFrame); + + HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkVideoFrame *theFrame, + /* [in] */ BMDTimeValue displayTime, + /* [in] */ BMDTimeValue displayDuration, + /* [in] */ BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkVideoOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( + IDeckLinkOutput * This, + /* [out] */ unsigned int *bufferedFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( + IDeckLinkOutput * This, + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount, + /* [in] */ BMDAudioOutputStreamType streamType); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( + IDeckLinkOutput * This); + + HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( + IDeckLinkOutput * This, + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( + IDeckLinkOutput * This); + + HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( + IDeckLinkOutput * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( + IDeckLinkOutput * This, + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [in] */ BMDTimeValue streamTime, + /* [in] */ BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( + IDeckLinkOutput * This, + /* [out] */ unsigned int *bufferedSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( + IDeckLinkOutput * This); + + HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkAudioOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( + IDeckLinkOutput * This, + /* [in] */ BMDTimeValue playbackStartTime, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ double playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( + IDeckLinkOutput * This, + /* [in] */ BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + /* [in] */ BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( + IDeckLinkOutput * This, + /* [out] */ BOOL *active); + + HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( + IDeckLinkOutput * This, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *streamTime, + /* [out] */ double *playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( + IDeckLinkOutput * This, + /* [out] */ BMDReferenceStatus *referenceStatus); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkOutput * This, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame); + + HRESULT ( STDMETHODCALLTYPE *GetFrameCompletionReferenceTimestamp )( + IDeckLinkOutput * This, + /* [in] */ IDeckLinkVideoFrame *theFrame, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *frameCompletionTimestamp); + + END_INTERFACE + } IDeckLinkOutputVtbl; + + interface IDeckLinkOutput + { + CONST_VTBL struct IDeckLinkOutputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkOutput_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkOutput_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkOutput_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkOutput_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) + +#define IDeckLinkOutput_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkOutput_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkOutput_EnableVideoOutput(This,displayMode,flags) \ + ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) + +#define IDeckLinkOutput_DisableVideoOutput(This) \ + ( (This)->lpVtbl -> DisableVideoOutput(This) ) + +#define IDeckLinkOutput_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ + ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) + +#define IDeckLinkOutput_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ + ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) + +#define IDeckLinkOutput_CreateAncillaryData(This,pixelFormat,outBuffer) \ + ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) + +#define IDeckLinkOutput_DisplayVideoFrameSync(This,theFrame) \ + ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) + +#define IDeckLinkOutput_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ + ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) + +#define IDeckLinkOutput_SetScheduledFrameCompletionCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) + +#define IDeckLinkOutput_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ + ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) + +#define IDeckLinkOutput_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ + ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) + +#define IDeckLinkOutput_DisableAudioOutput(This) \ + ( (This)->lpVtbl -> DisableAudioOutput(This) ) + +#define IDeckLinkOutput_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ + ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) + +#define IDeckLinkOutput_BeginAudioPreroll(This) \ + ( (This)->lpVtbl -> BeginAudioPreroll(This) ) + +#define IDeckLinkOutput_EndAudioPreroll(This) \ + ( (This)->lpVtbl -> EndAudioPreroll(This) ) + +#define IDeckLinkOutput_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ + ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) + +#define IDeckLinkOutput_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ + ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) + +#define IDeckLinkOutput_FlushBufferedAudioSamples(This) \ + ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) + +#define IDeckLinkOutput_SetAudioCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) + +#define IDeckLinkOutput_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ + ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) + +#define IDeckLinkOutput_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ + ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) + +#define IDeckLinkOutput_IsScheduledPlaybackRunning(This,active) \ + ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) + +#define IDeckLinkOutput_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ + ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) + +#define IDeckLinkOutput_GetReferenceStatus(This,referenceStatus) \ + ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) + +#define IDeckLinkOutput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) + +#define IDeckLinkOutput_GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) \ + ( (This)->lpVtbl -> GetFrameCompletionReferenceTimestamp(This,theFrame,desiredTimeScale,frameCompletionTimestamp) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkOutput_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInput_INTERFACE_DEFINED__ +#define __IDeckLinkInput_INTERFACE_DEFINED__ + +/* interface IDeckLinkInput */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInput; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AF22762B-DFAC-4846-AA79-FA8883560995") + IDeckLinkInput : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( + /* [out] */ unsigned int *availableFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoInputFrameMemoryAllocator( + /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( + /* [out] */ unsigned int *availableSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkInputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInputVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInput * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInput * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkInput * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkInput * This, + /* [out] */ IDeckLinkDisplayModeIterator **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkInput * This, + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( + IDeckLinkInput * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( + IDeckLinkInput * This, + /* [out] */ unsigned int *availableFrameCount); + + HRESULT ( STDMETHODCALLTYPE *SetVideoInputFrameMemoryAllocator )( + IDeckLinkInput * This, + /* [in] */ IDeckLinkMemoryAllocator *theAllocator); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( + IDeckLinkInput * This, + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( + IDeckLinkInput * This, + /* [out] */ unsigned int *availableSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *StartStreams )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *StopStreams )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *PauseStreams )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *FlushStreams )( + IDeckLinkInput * This); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkInput * This, + /* [in] */ IDeckLinkInputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkInput * This, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame); + + END_INTERFACE + } IDeckLinkInputVtbl; + + interface IDeckLinkInput + { + CONST_VTBL struct IDeckLinkInputVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInput_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInput_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInput_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInput_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) + +#define IDeckLinkInput_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkInput_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkInput_EnableVideoInput(This,displayMode,pixelFormat,flags) \ + ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) + +#define IDeckLinkInput_DisableVideoInput(This) \ + ( (This)->lpVtbl -> DisableVideoInput(This) ) + +#define IDeckLinkInput_GetAvailableVideoFrameCount(This,availableFrameCount) \ + ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) + +#define IDeckLinkInput_SetVideoInputFrameMemoryAllocator(This,theAllocator) \ + ( (This)->lpVtbl -> SetVideoInputFrameMemoryAllocator(This,theAllocator) ) + +#define IDeckLinkInput_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ + ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) + +#define IDeckLinkInput_DisableAudioInput(This) \ + ( (This)->lpVtbl -> DisableAudioInput(This) ) + +#define IDeckLinkInput_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ + ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) + +#define IDeckLinkInput_StartStreams(This) \ + ( (This)->lpVtbl -> StartStreams(This) ) + +#define IDeckLinkInput_StopStreams(This) \ + ( (This)->lpVtbl -> StopStreams(This) ) + +#define IDeckLinkInput_PauseStreams(This) \ + ( (This)->lpVtbl -> PauseStreams(This) ) + +#define IDeckLinkInput_FlushStreams(This) \ + ( (This)->lpVtbl -> FlushStreams(This) ) + +#define IDeckLinkInput_SetCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetCallback(This,theCallback) ) + +#define IDeckLinkInput_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInput_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame_INTERFACE_DEFINED__ +#define __IDeckLinkVideoFrame_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoFrame */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3F716FE0-F023-4111-BE5D-EF4414C05B17") + IDeckLinkVideoFrame : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetWidth( void) = 0; + + virtual long STDMETHODCALLTYPE GetHeight( void) = 0; + + virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0; + + virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; + + virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + /* [out] */ void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecode( + /* [in] */ BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode **timecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoFrame * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoFrame * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoFrame * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoFrame * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoFrame * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoFrame * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoFrame * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkVideoFrame * This, + /* [in] */ BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkVideoFrame * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + END_INTERFACE + } IDeckLinkVideoFrameVtbl; + + interface IDeckLinkVideoFrame + { + CONST_VTBL struct IDeckLinkVideoFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoFrame_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoFrame_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoFrame_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoFrame_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoFrame_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoFrame_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkVideoFrame_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkVideoFrame_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ +#define __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ + +/* interface IDeckLinkMutableVideoFrame */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkMutableVideoFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("69E2639F-40DA-4E19-B6F2-20ACE815C390") + IDeckLinkMutableVideoFrame : public IDeckLinkVideoFrame + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFlags( + /* [in] */ BMDFrameFlags newFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTimecode( + /* [in] */ BMDTimecodeFormat format, + /* [in] */ IDeckLinkTimecode *timecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( + /* [in] */ BMDTimecodeFormat format, + /* [in] */ unsigned char hours, + /* [in] */ unsigned char minutes, + /* [in] */ unsigned char seconds, + /* [in] */ unsigned char frames, + /* [in] */ BMDTimecodeFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( + /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTimecodeUserBits( + /* [in] */ BMDTimecodeFormat format, + /* [in] */ BMDTimecodeUserBits userBits) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkMutableVideoFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkMutableVideoFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkMutableVideoFrame * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkMutableVideoFrame * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkMutableVideoFrame * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkMutableVideoFrame * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkMutableVideoFrame * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkMutableVideoFrame * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkMutableVideoFrame * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkMutableVideoFrame * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + HRESULT ( STDMETHODCALLTYPE *SetFlags )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ BMDFrameFlags newFlags); + + HRESULT ( STDMETHODCALLTYPE *SetTimecode )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ BMDTimecodeFormat format, + /* [in] */ IDeckLinkTimecode *timecode); + + HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ BMDTimecodeFormat format, + /* [in] */ unsigned char hours, + /* [in] */ unsigned char minutes, + /* [in] */ unsigned char seconds, + /* [in] */ unsigned char frames, + /* [in] */ BMDTimecodeFlags flags); + + HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ IDeckLinkVideoFrameAncillary *ancillary); + + HRESULT ( STDMETHODCALLTYPE *SetTimecodeUserBits )( + IDeckLinkMutableVideoFrame * This, + /* [in] */ BMDTimecodeFormat format, + /* [in] */ BMDTimecodeUserBits userBits); + + END_INTERFACE + } IDeckLinkMutableVideoFrameVtbl; + + interface IDeckLinkMutableVideoFrame + { + CONST_VTBL struct IDeckLinkMutableVideoFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkMutableVideoFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkMutableVideoFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkMutableVideoFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkMutableVideoFrame_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkMutableVideoFrame_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkMutableVideoFrame_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkMutableVideoFrame_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkMutableVideoFrame_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkMutableVideoFrame_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkMutableVideoFrame_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkMutableVideoFrame_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + + +#define IDeckLinkMutableVideoFrame_SetFlags(This,newFlags) \ + ( (This)->lpVtbl -> SetFlags(This,newFlags) ) + +#define IDeckLinkMutableVideoFrame_SetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) + +#define IDeckLinkMutableVideoFrame_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) \ + ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) + +#define IDeckLinkMutableVideoFrame_SetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) + +#define IDeckLinkMutableVideoFrame_SetTimecodeUserBits(This,format,userBits) \ + ( (This)->lpVtbl -> SetTimecodeUserBits(This,format,userBits) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkMutableVideoFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ +#define __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoFrame3DExtensions */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoFrame3DExtensions; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("DA0F7E4A-EDC7-48A8-9CDD-2DB51C729CD7") + IDeckLinkVideoFrame3DExtensions : public IUnknown + { + public: + virtual BMDVideo3DPackingFormat STDMETHODCALLTYPE Get3DPackingFormat( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameForRightEye( + /* [out] */ IDeckLinkVideoFrame **rightEyeFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoFrame3DExtensionsVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoFrame3DExtensions * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoFrame3DExtensions * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoFrame3DExtensions * This); + + BMDVideo3DPackingFormat ( STDMETHODCALLTYPE *Get3DPackingFormat )( + IDeckLinkVideoFrame3DExtensions * This); + + HRESULT ( STDMETHODCALLTYPE *GetFrameForRightEye )( + IDeckLinkVideoFrame3DExtensions * This, + /* [out] */ IDeckLinkVideoFrame **rightEyeFrame); + + END_INTERFACE + } IDeckLinkVideoFrame3DExtensionsVtbl; + + interface IDeckLinkVideoFrame3DExtensions + { + CONST_VTBL struct IDeckLinkVideoFrame3DExtensionsVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoFrame3DExtensions_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoFrame3DExtensions_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoFrame3DExtensions_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoFrame3DExtensions_Get3DPackingFormat(This) \ + ( (This)->lpVtbl -> Get3DPackingFormat(This) ) + +#define IDeckLinkVideoFrame3DExtensions_GetFrameForRightEye(This,rightEyeFrame) \ + ( (This)->lpVtbl -> GetFrameForRightEye(This,rightEyeFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoFrame3DExtensions_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ +#define __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoInputFrame */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoInputFrame; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("05CFE374-537C-4094-9A57-680525118F44") + IDeckLinkVideoInputFrame : public IDeckLinkVideoFrame + { + public: + virtual HRESULT STDMETHODCALLTYPE GetStreamTime( + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration, + /* [in] */ BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( + /* [in] */ BMDTimeScale timeScale, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoInputFrameVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoInputFrame * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoInputFrame * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoInputFrame * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoInputFrame * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoInputFrame * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoInputFrame * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoInputFrame * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoInputFrame * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoInputFrame * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkVideoInputFrame * This, + /* [in] */ BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkVideoInputFrame * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( + IDeckLinkVideoInputFrame * This, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration, + /* [in] */ BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( + IDeckLinkVideoInputFrame * This, + /* [in] */ BMDTimeScale timeScale, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration); + + END_INTERFACE + } IDeckLinkVideoInputFrameVtbl; + + interface IDeckLinkVideoInputFrame + { + CONST_VTBL struct IDeckLinkVideoInputFrameVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoInputFrame_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoInputFrame_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoInputFrame_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoInputFrame_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoInputFrame_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoInputFrame_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoInputFrame_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoInputFrame_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoInputFrame_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkVideoInputFrame_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkVideoInputFrame_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + + +#define IDeckLinkVideoInputFrame_GetStreamTime(This,frameTime,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) + +#define IDeckLinkVideoInputFrame_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) \ + ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoInputFrame_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ +#define __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoFrameAncillary */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoFrameAncillary; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("732E723C-D1A4-4E29-9E8E-4A88797A0004") + IDeckLinkVideoFrameAncillary : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetBufferForVerticalBlankingLine( + /* [in] */ unsigned int lineNumber, + /* [out] */ void **buffer) = 0; + + virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; + + virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoFrameAncillaryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoFrameAncillary * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoFrameAncillary * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoFrameAncillary * This); + + HRESULT ( STDMETHODCALLTYPE *GetBufferForVerticalBlankingLine )( + IDeckLinkVideoFrameAncillary * This, + /* [in] */ unsigned int lineNumber, + /* [out] */ void **buffer); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoFrameAncillary * This); + + BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( + IDeckLinkVideoFrameAncillary * This); + + END_INTERFACE + } IDeckLinkVideoFrameAncillaryVtbl; + + interface IDeckLinkVideoFrameAncillary + { + CONST_VTBL struct IDeckLinkVideoFrameAncillaryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoFrameAncillary_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoFrameAncillary_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoFrameAncillary_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoFrameAncillary_GetBufferForVerticalBlankingLine(This,lineNumber,buffer) \ + ( (This)->lpVtbl -> GetBufferForVerticalBlankingLine(This,lineNumber,buffer) ) + +#define IDeckLinkVideoFrameAncillary_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoFrameAncillary_GetDisplayMode(This) \ + ( (This)->lpVtbl -> GetDisplayMode(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoFrameAncillary_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ +#define __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ + +/* interface IDeckLinkAudioInputPacket */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkAudioInputPacket; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E43D5870-2894-11DE-8C30-0800200C9A66") + IDeckLinkAudioInputPacket : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetSampleFrameCount( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + /* [out] */ void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPacketTime( + /* [out] */ BMDTimeValue *packetTime, + /* [in] */ BMDTimeScale timeScale) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkAudioInputPacketVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkAudioInputPacket * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkAudioInputPacket * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkAudioInputPacket * This); + + long ( STDMETHODCALLTYPE *GetSampleFrameCount )( + IDeckLinkAudioInputPacket * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkAudioInputPacket * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetPacketTime )( + IDeckLinkAudioInputPacket * This, + /* [out] */ BMDTimeValue *packetTime, + /* [in] */ BMDTimeScale timeScale); + + END_INTERFACE + } IDeckLinkAudioInputPacketVtbl; + + interface IDeckLinkAudioInputPacket + { + CONST_VTBL struct IDeckLinkAudioInputPacketVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkAudioInputPacket_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkAudioInputPacket_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkAudioInputPacket_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkAudioInputPacket_GetSampleFrameCount(This) \ + ( (This)->lpVtbl -> GetSampleFrameCount(This) ) + +#define IDeckLinkAudioInputPacket_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkAudioInputPacket_GetPacketTime(This,packetTime,timeScale) \ + ( (This)->lpVtbl -> GetPacketTime(This,packetTime,timeScale) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkAudioInputPacket_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ +#define __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkScreenPreviewCallback */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B1D3F49A-85FE-4C5D-95C8-0B5D5DCCD438") + IDeckLinkScreenPreviewCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DrawFrame( + /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkScreenPreviewCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkScreenPreviewCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkScreenPreviewCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkScreenPreviewCallback * This); + + HRESULT ( STDMETHODCALLTYPE *DrawFrame )( + IDeckLinkScreenPreviewCallback * This, + /* [in] */ IDeckLinkVideoFrame *theFrame); + + END_INTERFACE + } IDeckLinkScreenPreviewCallbackVtbl; + + interface IDeckLinkScreenPreviewCallback + { + CONST_VTBL struct IDeckLinkScreenPreviewCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkScreenPreviewCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkScreenPreviewCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkScreenPreviewCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkScreenPreviewCallback_DrawFrame(This,theFrame) \ + ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkScreenPreviewCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ +#define __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ + +/* interface IDeckLinkGLScreenPreviewHelper */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("504E2209-CAC7-4C1A-9FB4-C5BB6274D22F") + IDeckLinkGLScreenPreviewHelper : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFrame( + /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( + /* [in] */ BMD3DPreviewFormat previewFormat) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkGLScreenPreviewHelperVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkGLScreenPreviewHelper * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkGLScreenPreviewHelper * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkGLScreenPreviewHelper * This); + + HRESULT ( STDMETHODCALLTYPE *InitializeGL )( + IDeckLinkGLScreenPreviewHelper * This); + + HRESULT ( STDMETHODCALLTYPE *PaintGL )( + IDeckLinkGLScreenPreviewHelper * This); + + HRESULT ( STDMETHODCALLTYPE *SetFrame )( + IDeckLinkGLScreenPreviewHelper * This, + /* [in] */ IDeckLinkVideoFrame *theFrame); + + HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( + IDeckLinkGLScreenPreviewHelper * This, + /* [in] */ BMD3DPreviewFormat previewFormat); + + END_INTERFACE + } IDeckLinkGLScreenPreviewHelperVtbl; + + interface IDeckLinkGLScreenPreviewHelper + { + CONST_VTBL struct IDeckLinkGLScreenPreviewHelperVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkGLScreenPreviewHelper_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkGLScreenPreviewHelper_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkGLScreenPreviewHelper_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkGLScreenPreviewHelper_InitializeGL(This) \ + ( (This)->lpVtbl -> InitializeGL(This) ) + +#define IDeckLinkGLScreenPreviewHelper_PaintGL(This) \ + ( (This)->lpVtbl -> PaintGL(This) ) + +#define IDeckLinkGLScreenPreviewHelper_SetFrame(This,theFrame) \ + ( (This)->lpVtbl -> SetFrame(This,theFrame) ) + +#define IDeckLinkGLScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat) \ + ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkGLScreenPreviewHelper_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ +#define __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ + +/* interface IDeckLinkDX9ScreenPreviewHelper */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDX9ScreenPreviewHelper; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2094B522-D1A1-40C0-9AC7-1C012218EF02") + IDeckLinkDX9ScreenPreviewHelper : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Initialize( + /* [in] */ void *device) = 0; + + virtual HRESULT STDMETHODCALLTYPE Render( + /* [in] */ RECT *rc) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFrame( + /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE Set3DPreviewFormat( + /* [in] */ BMD3DPreviewFormat previewFormat) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDX9ScreenPreviewHelperVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDX9ScreenPreviewHelper * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDX9ScreenPreviewHelper * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDX9ScreenPreviewHelper * This); + + HRESULT ( STDMETHODCALLTYPE *Initialize )( + IDeckLinkDX9ScreenPreviewHelper * This, + /* [in] */ void *device); + + HRESULT ( STDMETHODCALLTYPE *Render )( + IDeckLinkDX9ScreenPreviewHelper * This, + /* [in] */ RECT *rc); + + HRESULT ( STDMETHODCALLTYPE *SetFrame )( + IDeckLinkDX9ScreenPreviewHelper * This, + /* [in] */ IDeckLinkVideoFrame *theFrame); + + HRESULT ( STDMETHODCALLTYPE *Set3DPreviewFormat )( + IDeckLinkDX9ScreenPreviewHelper * This, + /* [in] */ BMD3DPreviewFormat previewFormat); + + END_INTERFACE + } IDeckLinkDX9ScreenPreviewHelperVtbl; + + interface IDeckLinkDX9ScreenPreviewHelper + { + CONST_VTBL struct IDeckLinkDX9ScreenPreviewHelperVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDX9ScreenPreviewHelper_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDX9ScreenPreviewHelper_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDX9ScreenPreviewHelper_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDX9ScreenPreviewHelper_Initialize(This,device) \ + ( (This)->lpVtbl -> Initialize(This,device) ) + +#define IDeckLinkDX9ScreenPreviewHelper_Render(This,rc) \ + ( (This)->lpVtbl -> Render(This,rc) ) + +#define IDeckLinkDX9ScreenPreviewHelper_SetFrame(This,theFrame) \ + ( (This)->lpVtbl -> SetFrame(This,theFrame) ) + +#define IDeckLinkDX9ScreenPreviewHelper_Set3DPreviewFormat(This,previewFormat) \ + ( (This)->lpVtbl -> Set3DPreviewFormat(This,previewFormat) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDX9ScreenPreviewHelper_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ +#define __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkNotificationCallback */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkNotificationCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("b002a1ec-070d-4288-8289-bd5d36e5ff0d") + IDeckLinkNotificationCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Notify( + /* [in] */ BMDNotifications topic, + /* [in] */ ULONGLONG param1, + /* [in] */ ULONGLONG param2) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkNotificationCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkNotificationCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkNotificationCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkNotificationCallback * This); + + HRESULT ( STDMETHODCALLTYPE *Notify )( + IDeckLinkNotificationCallback * This, + /* [in] */ BMDNotifications topic, + /* [in] */ ULONGLONG param1, + /* [in] */ ULONGLONG param2); + + END_INTERFACE + } IDeckLinkNotificationCallbackVtbl; + + interface IDeckLinkNotificationCallback + { + CONST_VTBL struct IDeckLinkNotificationCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkNotificationCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkNotificationCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkNotificationCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkNotificationCallback_Notify(This,topic,param1,param2) \ + ( (This)->lpVtbl -> Notify(This,topic,param1,param2) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkNotificationCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkNotification_INTERFACE_DEFINED__ +#define __IDeckLinkNotification_INTERFACE_DEFINED__ + +/* interface IDeckLinkNotification */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkNotification; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("0a1fb207-e215-441b-9b19-6fa1575946c5") + IDeckLinkNotification : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Subscribe( + /* [in] */ BMDNotifications topic, + /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE Unsubscribe( + /* [in] */ BMDNotifications topic, + /* [in] */ IDeckLinkNotificationCallback *theCallback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkNotificationVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkNotification * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkNotification * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkNotification * This); + + HRESULT ( STDMETHODCALLTYPE *Subscribe )( + IDeckLinkNotification * This, + /* [in] */ BMDNotifications topic, + /* [in] */ IDeckLinkNotificationCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *Unsubscribe )( + IDeckLinkNotification * This, + /* [in] */ BMDNotifications topic, + /* [in] */ IDeckLinkNotificationCallback *theCallback); + + END_INTERFACE + } IDeckLinkNotificationVtbl; + + interface IDeckLinkNotification + { + CONST_VTBL struct IDeckLinkNotificationVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkNotification_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkNotification_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkNotification_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkNotification_Subscribe(This,topic,theCallback) \ + ( (This)->lpVtbl -> Subscribe(This,topic,theCallback) ) + +#define IDeckLinkNotification_Unsubscribe(This,topic,theCallback) \ + ( (This)->lpVtbl -> Unsubscribe(This,topic,theCallback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkNotification_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkAttributes_INTERFACE_DEFINED__ +#define __IDeckLinkAttributes_INTERFACE_DEFINED__ + +/* interface IDeckLinkAttributes */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkAttributes; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("ABC11843-D966-44CB-96E2-A1CB5D3135C4") + IDeckLinkAttributes : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetFlag( + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ BOOL *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInt( + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ LONGLONG *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFloat( + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ double *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ BSTR *value) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkAttributesVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkAttributes * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkAttributes * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkAttributes * This); + + HRESULT ( STDMETHODCALLTYPE *GetFlag )( + IDeckLinkAttributes * This, + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ BOOL *value); + + HRESULT ( STDMETHODCALLTYPE *GetInt )( + IDeckLinkAttributes * This, + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ LONGLONG *value); + + HRESULT ( STDMETHODCALLTYPE *GetFloat )( + IDeckLinkAttributes * This, + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ double *value); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IDeckLinkAttributes * This, + /* [in] */ BMDDeckLinkAttributeID cfgID, + /* [out] */ BSTR *value); + + END_INTERFACE + } IDeckLinkAttributesVtbl; + + interface IDeckLinkAttributes + { + CONST_VTBL struct IDeckLinkAttributesVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkAttributes_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkAttributes_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkAttributes_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkAttributes_GetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) + +#define IDeckLinkAttributes_GetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) + +#define IDeckLinkAttributes_GetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) + +#define IDeckLinkAttributes_GetString(This,cfgID,value) \ + ( (This)->lpVtbl -> GetString(This,cfgID,value) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkAttributes_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkKeyer_INTERFACE_DEFINED__ +#define __IDeckLinkKeyer_INTERFACE_DEFINED__ + +/* interface IDeckLinkKeyer */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkKeyer; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("89AFCAF5-65F8-421E-98F7-96FE5F5BFBA3") + IDeckLinkKeyer : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Enable( + /* [in] */ BOOL isExternal) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetLevel( + /* [in] */ unsigned char level) = 0; + + virtual HRESULT STDMETHODCALLTYPE RampUp( + /* [in] */ unsigned int numberOfFrames) = 0; + + virtual HRESULT STDMETHODCALLTYPE RampDown( + /* [in] */ unsigned int numberOfFrames) = 0; + + virtual HRESULT STDMETHODCALLTYPE Disable( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkKeyerVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkKeyer * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkKeyer * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkKeyer * This); + + HRESULT ( STDMETHODCALLTYPE *Enable )( + IDeckLinkKeyer * This, + /* [in] */ BOOL isExternal); + + HRESULT ( STDMETHODCALLTYPE *SetLevel )( + IDeckLinkKeyer * This, + /* [in] */ unsigned char level); + + HRESULT ( STDMETHODCALLTYPE *RampUp )( + IDeckLinkKeyer * This, + /* [in] */ unsigned int numberOfFrames); + + HRESULT ( STDMETHODCALLTYPE *RampDown )( + IDeckLinkKeyer * This, + /* [in] */ unsigned int numberOfFrames); + + HRESULT ( STDMETHODCALLTYPE *Disable )( + IDeckLinkKeyer * This); + + END_INTERFACE + } IDeckLinkKeyerVtbl; + + interface IDeckLinkKeyer + { + CONST_VTBL struct IDeckLinkKeyerVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkKeyer_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkKeyer_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkKeyer_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkKeyer_Enable(This,isExternal) \ + ( (This)->lpVtbl -> Enable(This,isExternal) ) + +#define IDeckLinkKeyer_SetLevel(This,level) \ + ( (This)->lpVtbl -> SetLevel(This,level) ) + +#define IDeckLinkKeyer_RampUp(This,numberOfFrames) \ + ( (This)->lpVtbl -> RampUp(This,numberOfFrames) ) + +#define IDeckLinkKeyer_RampDown(This,numberOfFrames) \ + ( (This)->lpVtbl -> RampDown(This,numberOfFrames) ) + +#define IDeckLinkKeyer_Disable(This) \ + ( (This)->lpVtbl -> Disable(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkKeyer_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoConversion_INTERFACE_DEFINED__ +#define __IDeckLinkVideoConversion_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoConversion */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoConversion; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3BBCB8A2-DA2C-42D9-B5D8-88083644E99A") + IDeckLinkVideoConversion : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ConvertFrame( + /* [in] */ IDeckLinkVideoFrame *srcFrame, + /* [in] */ IDeckLinkVideoFrame *dstFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoConversionVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoConversion * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoConversion * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoConversion * This); + + HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( + IDeckLinkVideoConversion * This, + /* [in] */ IDeckLinkVideoFrame *srcFrame, + /* [in] */ IDeckLinkVideoFrame *dstFrame); + + END_INTERFACE + } IDeckLinkVideoConversionVtbl; + + interface IDeckLinkVideoConversion + { + CONST_VTBL struct IDeckLinkVideoConversionVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoConversion_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoConversion_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoConversion_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoConversion_ConvertFrame(This,srcFrame,dstFrame) \ + ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoConversion_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ +#define __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ + +/* interface IDeckLinkDeviceNotificationCallback */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDeviceNotificationCallback; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4997053B-0ADF-4CC8-AC70-7A50C4BE728F") + IDeckLinkDeviceNotificationCallback : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DeckLinkDeviceArrived( + /* [in] */ IDeckLink *deckLinkDevice) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeckLinkDeviceRemoved( + /* [in] */ IDeckLink *deckLinkDevice) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDeviceNotificationCallbackVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDeviceNotificationCallback * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDeviceNotificationCallback * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDeviceNotificationCallback * This); + + HRESULT ( STDMETHODCALLTYPE *DeckLinkDeviceArrived )( + IDeckLinkDeviceNotificationCallback * This, + /* [in] */ IDeckLink *deckLinkDevice); + + HRESULT ( STDMETHODCALLTYPE *DeckLinkDeviceRemoved )( + IDeckLinkDeviceNotificationCallback * This, + /* [in] */ IDeckLink *deckLinkDevice); + + END_INTERFACE + } IDeckLinkDeviceNotificationCallbackVtbl; + + interface IDeckLinkDeviceNotificationCallback + { + CONST_VTBL struct IDeckLinkDeviceNotificationCallbackVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDeviceNotificationCallback_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDeviceNotificationCallback_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDeviceNotificationCallback_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDeviceNotificationCallback_DeckLinkDeviceArrived(This,deckLinkDevice) \ + ( (This)->lpVtbl -> DeckLinkDeviceArrived(This,deckLinkDevice) ) + +#define IDeckLinkDeviceNotificationCallback_DeckLinkDeviceRemoved(This,deckLinkDevice) \ + ( (This)->lpVtbl -> DeckLinkDeviceRemoved(This,deckLinkDevice) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDeviceNotificationCallback_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDiscovery_INTERFACE_DEFINED__ +#define __IDeckLinkDiscovery_INTERFACE_DEFINED__ + +/* interface IDeckLinkDiscovery */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDiscovery; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CDBF631C-BC76-45FA-B44D-C55059BC6101") + IDeckLinkDiscovery : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InstallDeviceNotifications( + /* [in] */ IDeckLinkDeviceNotificationCallback *deviceNotificationCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE UninstallDeviceNotifications( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDiscoveryVtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDiscovery * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDiscovery * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDiscovery * This); + + HRESULT ( STDMETHODCALLTYPE *InstallDeviceNotifications )( + IDeckLinkDiscovery * This, + /* [in] */ IDeckLinkDeviceNotificationCallback *deviceNotificationCallback); + + HRESULT ( STDMETHODCALLTYPE *UninstallDeviceNotifications )( + IDeckLinkDiscovery * This); + + END_INTERFACE + } IDeckLinkDiscoveryVtbl; + + interface IDeckLinkDiscovery + { + CONST_VTBL struct IDeckLinkDiscoveryVtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDiscovery_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDiscovery_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDiscovery_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDiscovery_InstallDeviceNotifications(This,deviceNotificationCallback) \ + ( (This)->lpVtbl -> InstallDeviceNotifications(This,deviceNotificationCallback) ) + +#define IDeckLinkDiscovery_UninstallDeviceNotifications(This) \ + ( (This)->lpVtbl -> UninstallDeviceNotifications(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDiscovery_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_CDeckLinkIterator; + +#ifdef __cplusplus + +class DECLSPEC_UUID("1F2E109A-8F4F-49E4-9203-135595CB6FA5") +CDeckLinkIterator; +#endif + +EXTERN_C const CLSID CLSID_CDeckLinkAPIInformation; + +#ifdef __cplusplus + +class DECLSPEC_UUID("263CA19F-ED09-482E-9F9D-84005783A237") +CDeckLinkAPIInformation; +#endif + +EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper; + +#ifdef __cplusplus + +class DECLSPEC_UUID("F63E77C7-B655-4A4A-9AD0-3CA85D394343") +CDeckLinkGLScreenPreviewHelper; +#endif + +EXTERN_C const CLSID CLSID_CDeckLinkDX9ScreenPreviewHelper; + +#ifdef __cplusplus + +class DECLSPEC_UUID("CC010023-E01D-4525-9D59-80C8AB3DC7A0") +CDeckLinkDX9ScreenPreviewHelper; +#endif + +EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion; + +#ifdef __cplusplus + +class DECLSPEC_UUID("7DBBBB11-5B7B-467D-AEA4-CEA468FD368C") +CDeckLinkVideoConversion; +#endif + +EXTERN_C const CLSID CLSID_CDeckLinkDiscovery; + +#ifdef __cplusplus + +class DECLSPEC_UUID("1073A05C-D885-47E9-B3C6-129B3F9F648B") +CDeckLinkDiscovery; +#endif + +#ifndef __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ +#define __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ + +/* interface IDeckLinkConfiguration_v10_2 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkConfiguration_v10_2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C679A35B-610C-4D09-B748-1D0478100FC0") + IDeckLinkConfiguration_v10_2 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFlag( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BOOL value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFlag( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BOOL *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetInt( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ LONGLONG value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetInt( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ LONGLONG *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFloat( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ double value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFloat( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ double *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetString( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BSTR value) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BSTR *value) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkConfiguration_v10_2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkConfiguration_v10_2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkConfiguration_v10_2 * This); + + HRESULT ( STDMETHODCALLTYPE *SetFlag )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BOOL value); + + HRESULT ( STDMETHODCALLTYPE *GetFlag )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BOOL *value); + + HRESULT ( STDMETHODCALLTYPE *SetInt )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ LONGLONG value); + + HRESULT ( STDMETHODCALLTYPE *GetInt )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ LONGLONG *value); + + HRESULT ( STDMETHODCALLTYPE *SetFloat )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ double value); + + HRESULT ( STDMETHODCALLTYPE *GetFloat )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ double *value); + + HRESULT ( STDMETHODCALLTYPE *SetString )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [in] */ BSTR value); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IDeckLinkConfiguration_v10_2 * This, + /* [in] */ BMDDeckLinkConfigurationID cfgID, + /* [out] */ BSTR *value); + + HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( + IDeckLinkConfiguration_v10_2 * This); + + END_INTERFACE + } IDeckLinkConfiguration_v10_2Vtbl; + + interface IDeckLinkConfiguration_v10_2 + { + CONST_VTBL struct IDeckLinkConfiguration_v10_2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkConfiguration_v10_2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkConfiguration_v10_2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkConfiguration_v10_2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkConfiguration_v10_2_SetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> SetFlag(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_GetFlag(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFlag(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_SetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> SetInt(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_GetInt(This,cfgID,value) \ + ( (This)->lpVtbl -> GetInt(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_SetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> SetFloat(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_GetFloat(This,cfgID,value) \ + ( (This)->lpVtbl -> GetFloat(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_SetString(This,cfgID,value) \ + ( (This)->lpVtbl -> SetString(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_GetString(This,cfgID,value) \ + ( (This)->lpVtbl -> GetString(This,cfgID,value) ) + +#define IDeckLinkConfiguration_v10_2_WriteConfigurationToPreferences(This) \ + ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkConfiguration_v10_2_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v9_9_INTERFACE_DEFINED__ +#define __IDeckLinkOutput_v9_9_INTERFACE_DEFINED__ + +/* interface IDeckLinkOutput_v9_9 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkOutput_v9_9; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A3EF0963-0862-44ED-92A9-EE89ABF431C7") + IDeckLinkOutput_v9_9 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoOutputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDVideoOutputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( + /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( + /* [in] */ int width, + /* [in] */ int height, + /* [in] */ int rowBytes, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame **outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( + /* [in] */ BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( + /* [in] */ IDeckLinkVideoFrame *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( + /* [in] */ IDeckLinkVideoFrame *theFrame, + /* [in] */ BMDTimeValue displayTime, + /* [in] */ BMDTimeValue displayDuration, + /* [in] */ BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( + /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( + /* [out] */ unsigned int *bufferedFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount, + /* [in] */ BMDAudioOutputStreamType streamType) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [in] */ BMDTimeValue streamTime, + /* [in] */ BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( + /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( + /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( + /* [in] */ BMDTimeValue playbackStartTime, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ double playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( + /* [in] */ BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + /* [in] */ BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( + /* [out] */ BOOL *active) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *streamTime, + /* [out] */ double *playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetReferenceStatus( + /* [out] */ BMDReferenceStatus *referenceStatus) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkOutput_v9_9Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkOutput_v9_9 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkOutput_v9_9 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoOutputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkOutput_v9_9 * This, + /* [out] */ IDeckLinkDisplayModeIterator **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDVideoOutputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( + IDeckLinkOutput_v9_9 * This); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ IDeckLinkMemoryAllocator *theAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ int width, + /* [in] */ int height, + /* [in] */ int rowBytes, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame **outFrame); + + HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); + + HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ IDeckLinkVideoFrame *theFrame); + + HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ IDeckLinkVideoFrame *theFrame, + /* [in] */ BMDTimeValue displayTime, + /* [in] */ BMDTimeValue displayDuration, + /* [in] */ BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ IDeckLinkVideoOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( + IDeckLinkOutput_v9_9 * This, + /* [out] */ unsigned int *bufferedFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount, + /* [in] */ BMDAudioOutputStreamType streamType); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( + IDeckLinkOutput_v9_9 * This); + + HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( + IDeckLinkOutput_v9_9 * This); + + HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( + IDeckLinkOutput_v9_9 * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ void *buffer, + /* [in] */ unsigned int sampleFrameCount, + /* [in] */ BMDTimeValue streamTime, + /* [in] */ BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( + IDeckLinkOutput_v9_9 * This, + /* [out] */ unsigned int *bufferedSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( + IDeckLinkOutput_v9_9 * This); + + HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ IDeckLinkAudioOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDTimeValue playbackStartTime, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ double playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + /* [in] */ BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( + IDeckLinkOutput_v9_9 * This, + /* [out] */ BOOL *active); + + HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *streamTime, + /* [out] */ double *playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *GetReferenceStatus )( + IDeckLinkOutput_v9_9 * This, + /* [out] */ BMDReferenceStatus *referenceStatus); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkOutput_v9_9 * This, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame); + + END_INTERFACE + } IDeckLinkOutput_v9_9Vtbl; + + interface IDeckLinkOutput_v9_9 + { + CONST_VTBL struct IDeckLinkOutput_v9_9Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkOutput_v9_9_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkOutput_v9_9_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkOutput_v9_9_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkOutput_v9_9_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) + +#define IDeckLinkOutput_v9_9_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkOutput_v9_9_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkOutput_v9_9_EnableVideoOutput(This,displayMode,flags) \ + ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) + +#define IDeckLinkOutput_v9_9_DisableVideoOutput(This) \ + ( (This)->lpVtbl -> DisableVideoOutput(This) ) + +#define IDeckLinkOutput_v9_9_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ + ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) + +#define IDeckLinkOutput_v9_9_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ + ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) + +#define IDeckLinkOutput_v9_9_CreateAncillaryData(This,pixelFormat,outBuffer) \ + ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) + +#define IDeckLinkOutput_v9_9_DisplayVideoFrameSync(This,theFrame) \ + ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) + +#define IDeckLinkOutput_v9_9_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ + ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) + +#define IDeckLinkOutput_v9_9_SetScheduledFrameCompletionCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) + +#define IDeckLinkOutput_v9_9_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ + ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) + +#define IDeckLinkOutput_v9_9_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ + ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) + +#define IDeckLinkOutput_v9_9_DisableAudioOutput(This) \ + ( (This)->lpVtbl -> DisableAudioOutput(This) ) + +#define IDeckLinkOutput_v9_9_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ + ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) + +#define IDeckLinkOutput_v9_9_BeginAudioPreroll(This) \ + ( (This)->lpVtbl -> BeginAudioPreroll(This) ) + +#define IDeckLinkOutput_v9_9_EndAudioPreroll(This) \ + ( (This)->lpVtbl -> EndAudioPreroll(This) ) + +#define IDeckLinkOutput_v9_9_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ + ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) + +#define IDeckLinkOutput_v9_9_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ + ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) + +#define IDeckLinkOutput_v9_9_FlushBufferedAudioSamples(This) \ + ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) + +#define IDeckLinkOutput_v9_9_SetAudioCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) + +#define IDeckLinkOutput_v9_9_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ + ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) + +#define IDeckLinkOutput_v9_9_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ + ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) + +#define IDeckLinkOutput_v9_9_IsScheduledPlaybackRunning(This,active) \ + ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) + +#define IDeckLinkOutput_v9_9_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ + ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) + +#define IDeckLinkOutput_v9_9_GetReferenceStatus(This,referenceStatus) \ + ( (This)->lpVtbl -> GetReferenceStatus(This,referenceStatus) ) + +#define IDeckLinkOutput_v9_9_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkOutput_v9_9_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v9_2_INTERFACE_DEFINED__ +#define __IDeckLinkInput_v9_2_INTERFACE_DEFINED__ + +/* interface IDeckLinkInput_v9_2 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInput_v9_2; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("6D40EF78-28B9-4E21-990D-95BB7750A04F") + IDeckLinkInput_v9_2 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( + /* [out] */ unsigned int *availableFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( + /* [out] */ unsigned int *availableSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkInputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInput_v9_2Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInput_v9_2 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInput_v9_2 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkInput_v9_2 * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags, + /* [out] */ BMDDisplayModeSupport *result, + /* [out] */ IDeckLinkDisplayMode **resultDisplayMode); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkInput_v9_2 * This, + /* [out] */ IDeckLinkDisplayModeIterator **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkInput_v9_2 * This, + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( + IDeckLinkInput_v9_2 * This, + /* [in] */ BMDDisplayMode displayMode, + /* [in] */ BMDPixelFormat pixelFormat, + /* [in] */ BMDVideoInputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( + IDeckLinkInput_v9_2 * This, + /* [out] */ unsigned int *availableFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( + IDeckLinkInput_v9_2 * This, + /* [in] */ BMDAudioSampleRate sampleRate, + /* [in] */ BMDAudioSampleType sampleType, + /* [in] */ unsigned int channelCount); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( + IDeckLinkInput_v9_2 * This, + /* [out] */ unsigned int *availableSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *StartStreams )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *StopStreams )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *PauseStreams )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *FlushStreams )( + IDeckLinkInput_v9_2 * This); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkInput_v9_2 * This, + /* [in] */ IDeckLinkInputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkInput_v9_2 * This, + /* [in] */ BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame); + + END_INTERFACE + } IDeckLinkInput_v9_2Vtbl; + + interface IDeckLinkInput_v9_2 + { + CONST_VTBL struct IDeckLinkInput_v9_2Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInput_v9_2_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInput_v9_2_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInput_v9_2_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInput_v9_2_DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,flags,result,resultDisplayMode) ) + +#define IDeckLinkInput_v9_2_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkInput_v9_2_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkInput_v9_2_EnableVideoInput(This,displayMode,pixelFormat,flags) \ + ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) + +#define IDeckLinkInput_v9_2_DisableVideoInput(This) \ + ( (This)->lpVtbl -> DisableVideoInput(This) ) + +#define IDeckLinkInput_v9_2_GetAvailableVideoFrameCount(This,availableFrameCount) \ + ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) + +#define IDeckLinkInput_v9_2_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ + ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) + +#define IDeckLinkInput_v9_2_DisableAudioInput(This) \ + ( (This)->lpVtbl -> DisableAudioInput(This) ) + +#define IDeckLinkInput_v9_2_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ + ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) + +#define IDeckLinkInput_v9_2_StartStreams(This) \ + ( (This)->lpVtbl -> StartStreams(This) ) + +#define IDeckLinkInput_v9_2_StopStreams(This) \ + ( (This)->lpVtbl -> StopStreams(This) ) + +#define IDeckLinkInput_v9_2_PauseStreams(This) \ + ( (This)->lpVtbl -> PauseStreams(This) ) + +#define IDeckLinkInput_v9_2_FlushStreams(This) \ + ( (This)->lpVtbl -> FlushStreams(This) ) + +#define IDeckLinkInput_v9_2_SetCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetCallback(This,theCallback) ) + +#define IDeckLinkInput_v9_2_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInput_v9_2_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControlStatusCallback_v8_1_INTERFACE_DEFINED__ +#define __IDeckLinkDeckControlStatusCallback_v8_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkDeckControlStatusCallback_v8_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDeckControlStatusCallback_v8_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E5F693C1-4283-4716-B18F-C1431521955B") + IDeckLinkDeckControlStatusCallback_v8_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE TimecodeUpdate( + /* [in] */ BMDTimecodeBCD currentTimecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE VTRControlStateChanged( + /* [in] */ BMDDeckControlVTRControlState_v8_1 newState, + /* [in] */ BMDDeckControlError error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeckControlEventReceived( + /* [in] */ BMDDeckControlEvent event, + /* [in] */ BMDDeckControlError error) = 0; + + virtual HRESULT STDMETHODCALLTYPE DeckControlStatusChanged( + /* [in] */ BMDDeckControlStatusFlags flags, + /* [in] */ unsigned int mask) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDeckControlStatusCallback_v8_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDeckControlStatusCallback_v8_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDeckControlStatusCallback_v8_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDeckControlStatusCallback_v8_1 * This); + + HRESULT ( STDMETHODCALLTYPE *TimecodeUpdate )( + IDeckLinkDeckControlStatusCallback_v8_1 * This, + /* [in] */ BMDTimecodeBCD currentTimecode); + + HRESULT ( STDMETHODCALLTYPE *VTRControlStateChanged )( + IDeckLinkDeckControlStatusCallback_v8_1 * This, + /* [in] */ BMDDeckControlVTRControlState_v8_1 newState, + /* [in] */ BMDDeckControlError error); + + HRESULT ( STDMETHODCALLTYPE *DeckControlEventReceived )( + IDeckLinkDeckControlStatusCallback_v8_1 * This, + /* [in] */ BMDDeckControlEvent event, + /* [in] */ BMDDeckControlError error); + + HRESULT ( STDMETHODCALLTYPE *DeckControlStatusChanged )( + IDeckLinkDeckControlStatusCallback_v8_1 * This, + /* [in] */ BMDDeckControlStatusFlags flags, + /* [in] */ unsigned int mask); + + END_INTERFACE + } IDeckLinkDeckControlStatusCallback_v8_1Vtbl; + + interface IDeckLinkDeckControlStatusCallback_v8_1 + { + CONST_VTBL struct IDeckLinkDeckControlStatusCallback_v8_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDeckControlStatusCallback_v8_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDeckControlStatusCallback_v8_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDeckControlStatusCallback_v8_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDeckControlStatusCallback_v8_1_TimecodeUpdate(This,currentTimecode) \ + ( (This)->lpVtbl -> TimecodeUpdate(This,currentTimecode) ) + +#define IDeckLinkDeckControlStatusCallback_v8_1_VTRControlStateChanged(This,newState,error) \ + ( (This)->lpVtbl -> VTRControlStateChanged(This,newState,error) ) + +#define IDeckLinkDeckControlStatusCallback_v8_1_DeckControlEventReceived(This,event,error) \ + ( (This)->lpVtbl -> DeckControlEventReceived(This,event,error) ) + +#define IDeckLinkDeckControlStatusCallback_v8_1_DeckControlStatusChanged(This,flags,mask) \ + ( (This)->lpVtbl -> DeckControlStatusChanged(This,flags,mask) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDeckControlStatusCallback_v8_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDeckControl_v8_1_INTERFACE_DEFINED__ +#define __IDeckLinkDeckControl_v8_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkDeckControl_v8_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDeckControl_v8_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("522A9E39-0F3C-4742-94EE-D80DE335DA1D") + IDeckLinkDeckControl_v8_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Open( + /* [in] */ BMDTimeScale timeScale, + /* [in] */ BMDTimeValue timeValue, + /* [in] */ BOOL timecodeIsDropFrame, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Close( + /* [in] */ BOOL standbyOn) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCurrentState( + /* [out] */ BMDDeckControlMode *mode, + /* [out] */ BMDDeckControlVTRControlState_v8_1 *vtrControlState, + /* [out] */ BMDDeckControlStatusFlags *flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStandby( + /* [in] */ BOOL standbyOn) = 0; + + virtual HRESULT STDMETHODCALLTYPE SendCommand( + /* [in] */ unsigned char *inBuffer, + /* [in] */ unsigned int inBufferSize, + /* [out] */ unsigned char *outBuffer, + /* [out] */ unsigned int *outDataSize, + /* [in] */ unsigned int outBufferSize, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Play( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Stop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Eject( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GoToTimecode( + /* [in] */ BMDTimecodeBCD timecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE FastForward( + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Rewind( + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StepForward( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StepBack( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Jog( + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Shuttle( + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( + /* [out] */ BSTR *currentTimeCode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecode( + /* [out] */ IDeckLinkTimecode **currentTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( + /* [out] */ BMDTimecodeBCD *currentTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPreroll( + /* [in] */ unsigned int prerollSeconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPreroll( + /* [out] */ unsigned int *prerollSeconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetExportOffset( + /* [in] */ int exportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetExportOffset( + /* [out] */ int *exportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( + /* [out] */ int *deckManualExportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( + /* [in] */ int captureOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( + /* [out] */ int *captureOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartExport( + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartCapture( + /* [in] */ BOOL useVITC, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceID( + /* [out] */ unsigned short *deviceId, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkDeckControlStatusCallback_v8_1 *callback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDeckControl_v8_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDeckControl_v8_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDeckControl_v8_1 * This); + + HRESULT ( STDMETHODCALLTYPE *Open )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ BMDTimeValue timeValue, + /* [in] */ BOOL timecodeIsDropFrame, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Close )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BOOL standbyOn); + + HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlMode *mode, + /* [out] */ BMDDeckControlVTRControlState_v8_1 *vtrControlState, + /* [out] */ BMDDeckControlStatusFlags *flags); + + HRESULT ( STDMETHODCALLTYPE *SetStandby )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BOOL standbyOn); + + HRESULT ( STDMETHODCALLTYPE *SendCommand )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ unsigned char *inBuffer, + /* [in] */ unsigned int inBufferSize, + /* [out] */ unsigned char *outBuffer, + /* [out] */ unsigned int *outDataSize, + /* [in] */ unsigned int outBufferSize, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Play )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Stop )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Eject )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BMDTimecodeBCD timecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *FastForward )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Rewind )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StepForward )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StepBack )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Jog )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Shuttle )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BSTR *currentTimeCode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ IDeckLinkTimecode **currentTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDTimecodeBCD *currentTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *SetPreroll )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ unsigned int prerollSeconds); + + HRESULT ( STDMETHODCALLTYPE *GetPreroll )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ unsigned int *prerollSeconds); + + HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ int exportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ int *exportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ int *deckManualExportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ int captureOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ int *captureOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *StartExport )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StartCapture )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ BOOL useVITC, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ unsigned short *deviceId, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Abort )( + IDeckLinkDeckControl_v8_1 * This); + + HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( + IDeckLinkDeckControl_v8_1 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkDeckControl_v8_1 * This, + /* [in] */ IDeckLinkDeckControlStatusCallback_v8_1 *callback); + + END_INTERFACE + } IDeckLinkDeckControl_v8_1Vtbl; + + interface IDeckLinkDeckControl_v8_1 + { + CONST_VTBL struct IDeckLinkDeckControl_v8_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDeckControl_v8_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDeckControl_v8_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDeckControl_v8_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDeckControl_v8_1_Open(This,timeScale,timeValue,timecodeIsDropFrame,error) \ + ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) + +#define IDeckLinkDeckControl_v8_1_Close(This,standbyOn) \ + ( (This)->lpVtbl -> Close(This,standbyOn) ) + +#define IDeckLinkDeckControl_v8_1_GetCurrentState(This,mode,vtrControlState,flags) \ + ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) + +#define IDeckLinkDeckControl_v8_1_SetStandby(This,standbyOn) \ + ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) + +#define IDeckLinkDeckControl_v8_1_SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) \ + ( (This)->lpVtbl -> SendCommand(This,inBuffer,inBufferSize,outBuffer,outDataSize,outBufferSize,error) ) + +#define IDeckLinkDeckControl_v8_1_Play(This,error) \ + ( (This)->lpVtbl -> Play(This,error) ) + +#define IDeckLinkDeckControl_v8_1_Stop(This,error) \ + ( (This)->lpVtbl -> Stop(This,error) ) + +#define IDeckLinkDeckControl_v8_1_TogglePlayStop(This,error) \ + ( (This)->lpVtbl -> TogglePlayStop(This,error) ) + +#define IDeckLinkDeckControl_v8_1_Eject(This,error) \ + ( (This)->lpVtbl -> Eject(This,error) ) + +#define IDeckLinkDeckControl_v8_1_GoToTimecode(This,timecode,error) \ + ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) + +#define IDeckLinkDeckControl_v8_1_FastForward(This,viewTape,error) \ + ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) + +#define IDeckLinkDeckControl_v8_1_Rewind(This,viewTape,error) \ + ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) + +#define IDeckLinkDeckControl_v8_1_StepForward(This,error) \ + ( (This)->lpVtbl -> StepForward(This,error) ) + +#define IDeckLinkDeckControl_v8_1_StepBack(This,error) \ + ( (This)->lpVtbl -> StepBack(This,error) ) + +#define IDeckLinkDeckControl_v8_1_Jog(This,rate,error) \ + ( (This)->lpVtbl -> Jog(This,rate,error) ) + +#define IDeckLinkDeckControl_v8_1_Shuttle(This,rate,error) \ + ( (This)->lpVtbl -> Shuttle(This,rate,error) ) + +#define IDeckLinkDeckControl_v8_1_GetTimecodeString(This,currentTimeCode,error) \ + ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) + +#define IDeckLinkDeckControl_v8_1_GetTimecode(This,currentTimecode,error) \ + ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) + +#define IDeckLinkDeckControl_v8_1_GetTimecodeBCD(This,currentTimecode,error) \ + ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) + +#define IDeckLinkDeckControl_v8_1_SetPreroll(This,prerollSeconds) \ + ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) + +#define IDeckLinkDeckControl_v8_1_GetPreroll(This,prerollSeconds) \ + ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) + +#define IDeckLinkDeckControl_v8_1_SetExportOffset(This,exportOffsetFields) \ + ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) + +#define IDeckLinkDeckControl_v8_1_GetExportOffset(This,exportOffsetFields) \ + ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) + +#define IDeckLinkDeckControl_v8_1_GetManualExportOffset(This,deckManualExportOffsetFields) \ + ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) + +#define IDeckLinkDeckControl_v8_1_SetCaptureOffset(This,captureOffsetFields) \ + ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) + +#define IDeckLinkDeckControl_v8_1_GetCaptureOffset(This,captureOffsetFields) \ + ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) + +#define IDeckLinkDeckControl_v8_1_StartExport(This,inTimecode,outTimecode,exportModeOps,error) \ + ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) + +#define IDeckLinkDeckControl_v8_1_StartCapture(This,useVITC,inTimecode,outTimecode,error) \ + ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) + +#define IDeckLinkDeckControl_v8_1_GetDeviceID(This,deviceId,error) \ + ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) + +#define IDeckLinkDeckControl_v8_1_Abort(This) \ + ( (This)->lpVtbl -> Abort(This) ) + +#define IDeckLinkDeckControl_v8_1_CrashRecordStart(This,error) \ + ( (This)->lpVtbl -> CrashRecordStart(This,error) ) + +#define IDeckLinkDeckControl_v8_1_CrashRecordStop(This,error) \ + ( (This)->lpVtbl -> CrashRecordStop(This,error) ) + +#define IDeckLinkDeckControl_v8_1_SetCallback(This,callback) \ + ( (This)->lpVtbl -> SetCallback(This,callback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDeckControl_v8_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLink_v8_0_INTERFACE_DEFINED__ +#define __IDeckLink_v8_0_INTERFACE_DEFINED__ + +/* interface IDeckLink_v8_0 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLink_v8_0; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("62BFF75D-6569-4E55-8D4D-66AA03829ABC") + IDeckLink_v8_0 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetModelName( + /* [out] */ BSTR *modelName) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLink_v8_0Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLink_v8_0 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLink_v8_0 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLink_v8_0 * This); + + HRESULT ( STDMETHODCALLTYPE *GetModelName )( + IDeckLink_v8_0 * This, + /* [out] */ BSTR *modelName); + + END_INTERFACE + } IDeckLink_v8_0Vtbl; + + interface IDeckLink_v8_0 + { + CONST_VTBL struct IDeckLink_v8_0Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLink_v8_0_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLink_v8_0_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLink_v8_0_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLink_v8_0_GetModelName(This,modelName) \ + ( (This)->lpVtbl -> GetModelName(This,modelName) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLink_v8_0_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkIterator_v8_0_INTERFACE_DEFINED__ +#define __IDeckLinkIterator_v8_0_INTERFACE_DEFINED__ + +/* interface IDeckLinkIterator_v8_0 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkIterator_v8_0; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("74E936FC-CC28-4A67-81A0-1E94E52D4E69") + IDeckLinkIterator_v8_0 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [out] */ IDeckLink_v8_0 **deckLinkInstance) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkIterator_v8_0Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkIterator_v8_0 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkIterator_v8_0 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkIterator_v8_0 * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IDeckLinkIterator_v8_0 * This, + /* [out] */ IDeckLink_v8_0 **deckLinkInstance); + + END_INTERFACE + } IDeckLinkIterator_v8_0Vtbl; + + interface IDeckLinkIterator_v8_0 + { + CONST_VTBL struct IDeckLinkIterator_v8_0Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkIterator_v8_0_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkIterator_v8_0_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkIterator_v8_0_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkIterator_v8_0_Next(This,deckLinkInstance) \ + ( (This)->lpVtbl -> Next(This,deckLinkInstance) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkIterator_v8_0_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_CDeckLinkIterator_v8_0; + +#ifdef __cplusplus + +class DECLSPEC_UUID("D9EDA3B3-2887-41FA-B724-017CF1EB1D37") +CDeckLinkIterator_v8_0; +#endif + +#ifndef __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__ +#define __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__ + +/* interface IDeckLinkDeckControl_v7_9 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDeckControl_v7_9; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A4D81043-0619-42B7-8ED6-602D29041DF7") + IDeckLinkDeckControl_v7_9 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Open( + /* [in] */ BMDTimeScale timeScale, + /* [in] */ BMDTimeValue timeValue, + /* [in] */ BOOL timecodeIsDropFrame, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Close( + /* [in] */ BOOL standbyOn) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCurrentState( + /* [out] */ BMDDeckControlMode *mode, + /* [out] */ BMDDeckControlVTRControlState *vtrControlState, + /* [out] */ BMDDeckControlStatusFlags *flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetStandby( + /* [in] */ BOOL standbyOn) = 0; + + virtual HRESULT STDMETHODCALLTYPE Play( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Stop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE TogglePlayStop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Eject( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GoToTimecode( + /* [in] */ BMDTimecodeBCD timecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE FastForward( + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Rewind( + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StepForward( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StepBack( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Jog( + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Shuttle( + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeString( + /* [out] */ BSTR *currentTimeCode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecode( + /* [out] */ IDeckLinkTimecode **currentTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecodeBCD( + /* [out] */ BMDTimecodeBCD *currentTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetPreroll( + /* [in] */ unsigned int prerollSeconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetPreroll( + /* [out] */ unsigned int *prerollSeconds) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetExportOffset( + /* [in] */ int exportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetExportOffset( + /* [out] */ int *exportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetManualExportOffset( + /* [out] */ int *deckManualExportOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCaptureOffset( + /* [in] */ int captureOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetCaptureOffset( + /* [out] */ int *captureOffsetFields) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartExport( + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartCapture( + /* [in] */ BOOL useVITC, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDeviceID( + /* [out] */ unsigned short *deviceId, + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE Abort( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE CrashRecordStart( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE CrashRecordStop( + /* [out] */ BMDDeckControlError *error) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkDeckControlStatusCallback *callback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDeckControl_v7_9Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDeckControl_v7_9 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDeckControl_v7_9 * This); + + HRESULT ( STDMETHODCALLTYPE *Open )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BMDTimeScale timeScale, + /* [in] */ BMDTimeValue timeValue, + /* [in] */ BOOL timecodeIsDropFrame, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Close )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BOOL standbyOn); + + HRESULT ( STDMETHODCALLTYPE *GetCurrentState )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlMode *mode, + /* [out] */ BMDDeckControlVTRControlState *vtrControlState, + /* [out] */ BMDDeckControlStatusFlags *flags); + + HRESULT ( STDMETHODCALLTYPE *SetStandby )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BOOL standbyOn); + + HRESULT ( STDMETHODCALLTYPE *Play )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Stop )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *TogglePlayStop )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Eject )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GoToTimecode )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BMDTimecodeBCD timecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *FastForward )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Rewind )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BOOL viewTape, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StepForward )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StepBack )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Jog )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Shuttle )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ double rate, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeString )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BSTR *currentTimeCode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ IDeckLinkTimecode **currentTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetTimecodeBCD )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDTimecodeBCD *currentTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *SetPreroll )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ unsigned int prerollSeconds); + + HRESULT ( STDMETHODCALLTYPE *GetPreroll )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ unsigned int *prerollSeconds); + + HRESULT ( STDMETHODCALLTYPE *SetExportOffset )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ int exportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetExportOffset )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ int *exportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetManualExportOffset )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ int *deckManualExportOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *SetCaptureOffset )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ int captureOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *GetCaptureOffset )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ int *captureOffsetFields); + + HRESULT ( STDMETHODCALLTYPE *StartExport )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [in] */ BMDDeckControlExportModeOpsFlags exportModeOps, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *StartCapture )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ BOOL useVITC, + /* [in] */ BMDTimecodeBCD inTimecode, + /* [in] */ BMDTimecodeBCD outTimecode, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *GetDeviceID )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ unsigned short *deviceId, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *Abort )( + IDeckLinkDeckControl_v7_9 * This); + + HRESULT ( STDMETHODCALLTYPE *CrashRecordStart )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *CrashRecordStop )( + IDeckLinkDeckControl_v7_9 * This, + /* [out] */ BMDDeckControlError *error); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkDeckControl_v7_9 * This, + /* [in] */ IDeckLinkDeckControlStatusCallback *callback); + + END_INTERFACE + } IDeckLinkDeckControl_v7_9Vtbl; + + interface IDeckLinkDeckControl_v7_9 + { + CONST_VTBL struct IDeckLinkDeckControl_v7_9Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDeckControl_v7_9_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDeckControl_v7_9_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDeckControl_v7_9_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDeckControl_v7_9_Open(This,timeScale,timeValue,timecodeIsDropFrame,error) \ + ( (This)->lpVtbl -> Open(This,timeScale,timeValue,timecodeIsDropFrame,error) ) + +#define IDeckLinkDeckControl_v7_9_Close(This,standbyOn) \ + ( (This)->lpVtbl -> Close(This,standbyOn) ) + +#define IDeckLinkDeckControl_v7_9_GetCurrentState(This,mode,vtrControlState,flags) \ + ( (This)->lpVtbl -> GetCurrentState(This,mode,vtrControlState,flags) ) + +#define IDeckLinkDeckControl_v7_9_SetStandby(This,standbyOn) \ + ( (This)->lpVtbl -> SetStandby(This,standbyOn) ) + +#define IDeckLinkDeckControl_v7_9_Play(This,error) \ + ( (This)->lpVtbl -> Play(This,error) ) + +#define IDeckLinkDeckControl_v7_9_Stop(This,error) \ + ( (This)->lpVtbl -> Stop(This,error) ) + +#define IDeckLinkDeckControl_v7_9_TogglePlayStop(This,error) \ + ( (This)->lpVtbl -> TogglePlayStop(This,error) ) + +#define IDeckLinkDeckControl_v7_9_Eject(This,error) \ + ( (This)->lpVtbl -> Eject(This,error) ) + +#define IDeckLinkDeckControl_v7_9_GoToTimecode(This,timecode,error) \ + ( (This)->lpVtbl -> GoToTimecode(This,timecode,error) ) + +#define IDeckLinkDeckControl_v7_9_FastForward(This,viewTape,error) \ + ( (This)->lpVtbl -> FastForward(This,viewTape,error) ) + +#define IDeckLinkDeckControl_v7_9_Rewind(This,viewTape,error) \ + ( (This)->lpVtbl -> Rewind(This,viewTape,error) ) + +#define IDeckLinkDeckControl_v7_9_StepForward(This,error) \ + ( (This)->lpVtbl -> StepForward(This,error) ) + +#define IDeckLinkDeckControl_v7_9_StepBack(This,error) \ + ( (This)->lpVtbl -> StepBack(This,error) ) + +#define IDeckLinkDeckControl_v7_9_Jog(This,rate,error) \ + ( (This)->lpVtbl -> Jog(This,rate,error) ) + +#define IDeckLinkDeckControl_v7_9_Shuttle(This,rate,error) \ + ( (This)->lpVtbl -> Shuttle(This,rate,error) ) + +#define IDeckLinkDeckControl_v7_9_GetTimecodeString(This,currentTimeCode,error) \ + ( (This)->lpVtbl -> GetTimecodeString(This,currentTimeCode,error) ) + +#define IDeckLinkDeckControl_v7_9_GetTimecode(This,currentTimecode,error) \ + ( (This)->lpVtbl -> GetTimecode(This,currentTimecode,error) ) + +#define IDeckLinkDeckControl_v7_9_GetTimecodeBCD(This,currentTimecode,error) \ + ( (This)->lpVtbl -> GetTimecodeBCD(This,currentTimecode,error) ) + +#define IDeckLinkDeckControl_v7_9_SetPreroll(This,prerollSeconds) \ + ( (This)->lpVtbl -> SetPreroll(This,prerollSeconds) ) + +#define IDeckLinkDeckControl_v7_9_GetPreroll(This,prerollSeconds) \ + ( (This)->lpVtbl -> GetPreroll(This,prerollSeconds) ) + +#define IDeckLinkDeckControl_v7_9_SetExportOffset(This,exportOffsetFields) \ + ( (This)->lpVtbl -> SetExportOffset(This,exportOffsetFields) ) + +#define IDeckLinkDeckControl_v7_9_GetExportOffset(This,exportOffsetFields) \ + ( (This)->lpVtbl -> GetExportOffset(This,exportOffsetFields) ) + +#define IDeckLinkDeckControl_v7_9_GetManualExportOffset(This,deckManualExportOffsetFields) \ + ( (This)->lpVtbl -> GetManualExportOffset(This,deckManualExportOffsetFields) ) + +#define IDeckLinkDeckControl_v7_9_SetCaptureOffset(This,captureOffsetFields) \ + ( (This)->lpVtbl -> SetCaptureOffset(This,captureOffsetFields) ) + +#define IDeckLinkDeckControl_v7_9_GetCaptureOffset(This,captureOffsetFields) \ + ( (This)->lpVtbl -> GetCaptureOffset(This,captureOffsetFields) ) + +#define IDeckLinkDeckControl_v7_9_StartExport(This,inTimecode,outTimecode,exportModeOps,error) \ + ( (This)->lpVtbl -> StartExport(This,inTimecode,outTimecode,exportModeOps,error) ) + +#define IDeckLinkDeckControl_v7_9_StartCapture(This,useVITC,inTimecode,outTimecode,error) \ + ( (This)->lpVtbl -> StartCapture(This,useVITC,inTimecode,outTimecode,error) ) + +#define IDeckLinkDeckControl_v7_9_GetDeviceID(This,deviceId,error) \ + ( (This)->lpVtbl -> GetDeviceID(This,deviceId,error) ) + +#define IDeckLinkDeckControl_v7_9_Abort(This) \ + ( (This)->lpVtbl -> Abort(This) ) + +#define IDeckLinkDeckControl_v7_9_CrashRecordStart(This,error) \ + ( (This)->lpVtbl -> CrashRecordStart(This,error) ) + +#define IDeckLinkDeckControl_v7_9_CrashRecordStop(This,error) \ + ( (This)->lpVtbl -> CrashRecordStop(This,error) ) + +#define IDeckLinkDeckControl_v7_9_SetCallback(This,callback) \ + ( (This)->lpVtbl -> SetCallback(This,callback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDeckControl_v7_9_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkDisplayModeIterator_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("455D741F-1779-4800-86F5-0B5D13D79751") + IDeckLinkDisplayModeIterator_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [out] */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDisplayModeIterator_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDisplayModeIterator_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDisplayModeIterator_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDisplayModeIterator_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IDeckLinkDisplayModeIterator_v7_6 * This, + /* [out] */ IDeckLinkDisplayMode_v7_6 **deckLinkDisplayMode); + + END_INTERFACE + } IDeckLinkDisplayModeIterator_v7_6Vtbl; + + interface IDeckLinkDisplayModeIterator_v7_6 + { + CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDisplayModeIterator_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDisplayModeIterator_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDisplayModeIterator_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDisplayModeIterator_v7_6_Next(This,deckLinkDisplayMode) \ + ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDisplayModeIterator_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkDisplayMode_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("87451E84-2B7E-439E-A629-4393EA4A8550") + IDeckLinkDisplayMode_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetName( + /* [out] */ BSTR *name) = 0; + + virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; + + virtual long STDMETHODCALLTYPE GetWidth( void) = 0; + + virtual long STDMETHODCALLTYPE GetHeight( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameRate( + /* [out] */ BMDTimeValue *frameDuration, + /* [out] */ BMDTimeScale *timeScale) = 0; + + virtual BMDFieldDominance STDMETHODCALLTYPE GetFieldDominance( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDisplayMode_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDisplayMode_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDisplayMode_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDisplayMode_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetName )( + IDeckLinkDisplayMode_v7_6 * This, + /* [out] */ BSTR *name); + + BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( + IDeckLinkDisplayMode_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkDisplayMode_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkDisplayMode_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( + IDeckLinkDisplayMode_v7_6 * This, + /* [out] */ BMDTimeValue *frameDuration, + /* [out] */ BMDTimeScale *timeScale); + + BMDFieldDominance ( STDMETHODCALLTYPE *GetFieldDominance )( + IDeckLinkDisplayMode_v7_6 * This); + + END_INTERFACE + } IDeckLinkDisplayMode_v7_6Vtbl; + + interface IDeckLinkDisplayMode_v7_6 + { + CONST_VTBL struct IDeckLinkDisplayMode_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDisplayMode_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDisplayMode_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDisplayMode_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDisplayMode_v7_6_GetName(This,name) \ + ( (This)->lpVtbl -> GetName(This,name) ) + +#define IDeckLinkDisplayMode_v7_6_GetDisplayMode(This) \ + ( (This)->lpVtbl -> GetDisplayMode(This) ) + +#define IDeckLinkDisplayMode_v7_6_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkDisplayMode_v7_6_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkDisplayMode_v7_6_GetFrameRate(This,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) + +#define IDeckLinkDisplayMode_v7_6_GetFieldDominance(This) \ + ( (This)->lpVtbl -> GetFieldDominance(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDisplayMode_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkOutput_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkOutput_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("29228142-EB8C-4141-A621-F74026450955") + IDeckLinkOutput_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( + BMDDisplayMode displayMode, + BMDVideoOutputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( + /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( + BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame, + BMDTimeValue displayTime, + BMDTimeValue displayDuration, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( + /* [in] */ IDeckLinkVideoOutputCallback_v7_6 *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( + /* [out] */ unsigned int *bufferedFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount, + BMDAudioOutputStreamType streamType) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + BMDTimeValue streamTime, + BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( + /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( + /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( + BMDTimeValue playbackStartTime, + BMDTimeScale timeScale, + double playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( + BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( + /* [out] */ BOOL *active) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetScheduledStreamTime( + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *streamTime, + /* [out] */ double *playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkOutput_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkOutput_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkOutput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkOutput_v7_6 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkOutput_v7_6 * This, + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( + IDeckLinkOutput_v7_6 * This, + BMDDisplayMode displayMode, + BMDVideoOutputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( + IDeckLinkOutput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ IDeckLinkMemoryAllocator *theAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( + IDeckLinkOutput_v7_6 * This, + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame); + + HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( + IDeckLinkOutput_v7_6 * This, + BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); + + HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame); + + HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame, + BMDTimeValue displayTime, + BMDTimeValue displayDuration, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ IDeckLinkVideoOutputCallback_v7_6 *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( + IDeckLinkOutput_v7_6 * This, + /* [out] */ unsigned int *bufferedFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( + IDeckLinkOutput_v7_6 * This, + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount, + BMDAudioOutputStreamType streamType); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( + IDeckLinkOutput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( + IDeckLinkOutput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( + IDeckLinkOutput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + BMDTimeValue streamTime, + BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( + IDeckLinkOutput_v7_6 * This, + /* [out] */ unsigned int *bufferedSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( + IDeckLinkOutput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( + IDeckLinkOutput_v7_6 * This, + /* [in] */ IDeckLinkAudioOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( + IDeckLinkOutput_v7_6 * This, + BMDTimeValue playbackStartTime, + BMDTimeScale timeScale, + double playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( + IDeckLinkOutput_v7_6 * This, + BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( + IDeckLinkOutput_v7_6 * This, + /* [out] */ BOOL *active); + + HRESULT ( STDMETHODCALLTYPE *GetScheduledStreamTime )( + IDeckLinkOutput_v7_6 * This, + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *streamTime, + /* [out] */ double *playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkOutput_v7_6 * This, + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame); + + END_INTERFACE + } IDeckLinkOutput_v7_6Vtbl; + + interface IDeckLinkOutput_v7_6 + { + CONST_VTBL struct IDeckLinkOutput_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkOutput_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkOutput_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkOutput_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkOutput_v7_6_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) + +#define IDeckLinkOutput_v7_6_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkOutput_v7_6_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkOutput_v7_6_EnableVideoOutput(This,displayMode,flags) \ + ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) + +#define IDeckLinkOutput_v7_6_DisableVideoOutput(This) \ + ( (This)->lpVtbl -> DisableVideoOutput(This) ) + +#define IDeckLinkOutput_v7_6_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ + ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) + +#define IDeckLinkOutput_v7_6_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ + ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) + +#define IDeckLinkOutput_v7_6_CreateAncillaryData(This,pixelFormat,outBuffer) \ + ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) + +#define IDeckLinkOutput_v7_6_DisplayVideoFrameSync(This,theFrame) \ + ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) + +#define IDeckLinkOutput_v7_6_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ + ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) + +#define IDeckLinkOutput_v7_6_SetScheduledFrameCompletionCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) + +#define IDeckLinkOutput_v7_6_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ + ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) + +#define IDeckLinkOutput_v7_6_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ + ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) + +#define IDeckLinkOutput_v7_6_DisableAudioOutput(This) \ + ( (This)->lpVtbl -> DisableAudioOutput(This) ) + +#define IDeckLinkOutput_v7_6_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ + ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) + +#define IDeckLinkOutput_v7_6_BeginAudioPreroll(This) \ + ( (This)->lpVtbl -> BeginAudioPreroll(This) ) + +#define IDeckLinkOutput_v7_6_EndAudioPreroll(This) \ + ( (This)->lpVtbl -> EndAudioPreroll(This) ) + +#define IDeckLinkOutput_v7_6_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ + ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) + +#define IDeckLinkOutput_v7_6_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ + ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) + +#define IDeckLinkOutput_v7_6_FlushBufferedAudioSamples(This) \ + ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) + +#define IDeckLinkOutput_v7_6_SetAudioCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) + +#define IDeckLinkOutput_v7_6_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ + ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) + +#define IDeckLinkOutput_v7_6_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ + ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) + +#define IDeckLinkOutput_v7_6_IsScheduledPlaybackRunning(This,active) \ + ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) + +#define IDeckLinkOutput_v7_6_GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) \ + ( (This)->lpVtbl -> GetScheduledStreamTime(This,desiredTimeScale,streamTime,playbackSpeed) ) + +#define IDeckLinkOutput_v7_6_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkOutput_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkInput_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkInput_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInput_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("300C135A-9F43-48E2-9906-6D7911D93CF1") + IDeckLinkInput_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + BMDVideoInputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( + /* [out] */ unsigned int *availableFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( + /* [out] */ unsigned int *availableSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkInputCallback_v7_6 *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInput_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInput_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInput_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkInput_v7_6 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkInput_v7_6 * This, + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkInput_v7_6 * This, + /* [in] */ IDeckLinkScreenPreviewCallback_v7_6 *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( + IDeckLinkInput_v7_6 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + BMDVideoInputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( + IDeckLinkInput_v7_6 * This, + /* [out] */ unsigned int *availableFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( + IDeckLinkInput_v7_6 * This, + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( + IDeckLinkInput_v7_6 * This, + /* [out] */ unsigned int *availableSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *StartStreams )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *StopStreams )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *PauseStreams )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *FlushStreams )( + IDeckLinkInput_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkInput_v7_6 * This, + /* [in] */ IDeckLinkInputCallback_v7_6 *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkInput_v7_6 * This, + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *hardwareTime, + /* [out] */ BMDTimeValue *timeInFrame, + /* [out] */ BMDTimeValue *ticksPerFrame); + + END_INTERFACE + } IDeckLinkInput_v7_6Vtbl; + + interface IDeckLinkInput_v7_6 + { + CONST_VTBL struct IDeckLinkInput_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInput_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInput_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInput_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInput_v7_6_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) + +#define IDeckLinkInput_v7_6_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkInput_v7_6_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkInput_v7_6_EnableVideoInput(This,displayMode,pixelFormat,flags) \ + ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) + +#define IDeckLinkInput_v7_6_DisableVideoInput(This) \ + ( (This)->lpVtbl -> DisableVideoInput(This) ) + +#define IDeckLinkInput_v7_6_GetAvailableVideoFrameCount(This,availableFrameCount) \ + ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) + +#define IDeckLinkInput_v7_6_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ + ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) + +#define IDeckLinkInput_v7_6_DisableAudioInput(This) \ + ( (This)->lpVtbl -> DisableAudioInput(This) ) + +#define IDeckLinkInput_v7_6_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ + ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) + +#define IDeckLinkInput_v7_6_StartStreams(This) \ + ( (This)->lpVtbl -> StartStreams(This) ) + +#define IDeckLinkInput_v7_6_StopStreams(This) \ + ( (This)->lpVtbl -> StopStreams(This) ) + +#define IDeckLinkInput_v7_6_PauseStreams(This) \ + ( (This)->lpVtbl -> PauseStreams(This) ) + +#define IDeckLinkInput_v7_6_FlushStreams(This) \ + ( (This)->lpVtbl -> FlushStreams(This) ) + +#define IDeckLinkInput_v7_6_SetCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetCallback(This,theCallback) ) + +#define IDeckLinkInput_v7_6_GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,hardwareTime,timeInFrame,ticksPerFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInput_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkTimecode_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkTimecode_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EFB9BCA6-A521-44F7-BD69-2332F24D9EE6") + IDeckLinkTimecode_v7_6 : public IUnknown + { + public: + virtual BMDTimecodeBCD STDMETHODCALLTYPE GetBCD( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetComponents( + /* [out] */ unsigned char *hours, + /* [out] */ unsigned char *minutes, + /* [out] */ unsigned char *seconds, + /* [out] */ unsigned char *frames) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetString( + /* [out] */ BSTR *timecode) = 0; + + virtual BMDTimecodeFlags STDMETHODCALLTYPE GetFlags( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkTimecode_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkTimecode_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkTimecode_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkTimecode_v7_6 * This); + + BMDTimecodeBCD ( STDMETHODCALLTYPE *GetBCD )( + IDeckLinkTimecode_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetComponents )( + IDeckLinkTimecode_v7_6 * This, + /* [out] */ unsigned char *hours, + /* [out] */ unsigned char *minutes, + /* [out] */ unsigned char *seconds, + /* [out] */ unsigned char *frames); + + HRESULT ( STDMETHODCALLTYPE *GetString )( + IDeckLinkTimecode_v7_6 * This, + /* [out] */ BSTR *timecode); + + BMDTimecodeFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkTimecode_v7_6 * This); + + END_INTERFACE + } IDeckLinkTimecode_v7_6Vtbl; + + interface IDeckLinkTimecode_v7_6 + { + CONST_VTBL struct IDeckLinkTimecode_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkTimecode_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkTimecode_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkTimecode_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkTimecode_v7_6_GetBCD(This) \ + ( (This)->lpVtbl -> GetBCD(This) ) + +#define IDeckLinkTimecode_v7_6_GetComponents(This,hours,minutes,seconds,frames) \ + ( (This)->lpVtbl -> GetComponents(This,hours,minutes,seconds,frames) ) + +#define IDeckLinkTimecode_v7_6_GetString(This,timecode) \ + ( (This)->lpVtbl -> GetString(This,timecode) ) + +#define IDeckLinkTimecode_v7_6_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkTimecode_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoFrame_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("A8D8238E-6B18-4196-99E1-5AF717B83D32") + IDeckLinkVideoFrame_v7_6 : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetWidth( void) = 0; + + virtual long STDMETHODCALLTYPE GetHeight( void) = 0; + + virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0; + + virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; + + virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + /* [out] */ void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetTimecode( + BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode_v7_6 **timecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAncillaryData( + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoFrame_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoFrame_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoFrame_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoFrame_v7_6 * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoFrame_v7_6 * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoFrame_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoFrame_v7_6 * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkVideoFrame_v7_6 * This, + BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode_v7_6 **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkVideoFrame_v7_6 * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + END_INTERFACE + } IDeckLinkVideoFrame_v7_6Vtbl; + + interface IDeckLinkVideoFrame_v7_6 + { + CONST_VTBL struct IDeckLinkVideoFrame_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoFrame_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoFrame_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoFrame_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoFrame_v7_6_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoFrame_v7_6_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoFrame_v7_6_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoFrame_v7_6_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoFrame_v7_6_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoFrame_v7_6_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkVideoFrame_v7_6_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkVideoFrame_v7_6_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoFrame_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkMutableVideoFrame_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkMutableVideoFrame_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("46FCEE00-B4E6-43D0-91C0-023A7FCEB34F") + IDeckLinkMutableVideoFrame_v7_6 : public IDeckLinkVideoFrame_v7_6 + { + public: + virtual HRESULT STDMETHODCALLTYPE SetFlags( + BMDFrameFlags newFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTimecode( + BMDTimecodeFormat format, + /* [in] */ IDeckLinkTimecode_v7_6 *timecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetTimecodeFromComponents( + BMDTimecodeFormat format, + unsigned char hours, + unsigned char minutes, + unsigned char seconds, + unsigned char frames, + BMDTimecodeFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAncillaryData( + /* [in] */ IDeckLinkVideoFrameAncillary *ancillary) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkMutableVideoFrame_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkMutableVideoFrame_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkMutableVideoFrame_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkMutableVideoFrame_v7_6 * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkMutableVideoFrame_v7_6 * This, + BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode_v7_6 **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkMutableVideoFrame_v7_6 * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + HRESULT ( STDMETHODCALLTYPE *SetFlags )( + IDeckLinkMutableVideoFrame_v7_6 * This, + BMDFrameFlags newFlags); + + HRESULT ( STDMETHODCALLTYPE *SetTimecode )( + IDeckLinkMutableVideoFrame_v7_6 * This, + BMDTimecodeFormat format, + /* [in] */ IDeckLinkTimecode_v7_6 *timecode); + + HRESULT ( STDMETHODCALLTYPE *SetTimecodeFromComponents )( + IDeckLinkMutableVideoFrame_v7_6 * This, + BMDTimecodeFormat format, + unsigned char hours, + unsigned char minutes, + unsigned char seconds, + unsigned char frames, + BMDTimecodeFlags flags); + + HRESULT ( STDMETHODCALLTYPE *SetAncillaryData )( + IDeckLinkMutableVideoFrame_v7_6 * This, + /* [in] */ IDeckLinkVideoFrameAncillary *ancillary); + + END_INTERFACE + } IDeckLinkMutableVideoFrame_v7_6Vtbl; + + interface IDeckLinkMutableVideoFrame_v7_6 + { + CONST_VTBL struct IDeckLinkMutableVideoFrame_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkMutableVideoFrame_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkMutableVideoFrame_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkMutableVideoFrame_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkMutableVideoFrame_v7_6_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkMutableVideoFrame_v7_6_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + + +#define IDeckLinkMutableVideoFrame_v7_6_SetFlags(This,newFlags) \ + ( (This)->lpVtbl -> SetFlags(This,newFlags) ) + +#define IDeckLinkMutableVideoFrame_v7_6_SetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> SetTimecode(This,format,timecode) ) + +#define IDeckLinkMutableVideoFrame_v7_6_SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) \ + ( (This)->lpVtbl -> SetTimecodeFromComponents(This,format,hours,minutes,seconds,frames,flags) ) + +#define IDeckLinkMutableVideoFrame_v7_6_SetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> SetAncillaryData(This,ancillary) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkMutableVideoFrame_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoInputFrame_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("9A74FA41-AE9F-47AC-8CF4-01F42DD59965") + IDeckLinkVideoInputFrame_v7_6 : public IDeckLinkVideoFrame_v7_6 + { + public: + virtual HRESULT STDMETHODCALLTYPE GetStreamTime( + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceTimestamp( + BMDTimeScale timeScale, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoInputFrame_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoInputFrame_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoInputFrame_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoInputFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoInputFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoInputFrame_v7_6 * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoInputFrame_v7_6 * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoInputFrame_v7_6 * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoInputFrame_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoInputFrame_v7_6 * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkVideoInputFrame_v7_6 * This, + BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode_v7_6 **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkVideoInputFrame_v7_6 * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( + IDeckLinkVideoInputFrame_v7_6 * This, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceTimestamp )( + IDeckLinkVideoInputFrame_v7_6 * This, + BMDTimeScale timeScale, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration); + + END_INTERFACE + } IDeckLinkVideoInputFrame_v7_6Vtbl; + + interface IDeckLinkVideoInputFrame_v7_6 + { + CONST_VTBL struct IDeckLinkVideoInputFrame_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoInputFrame_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoInputFrame_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoInputFrame_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoInputFrame_v7_6_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + + +#define IDeckLinkVideoInputFrame_v7_6_GetStreamTime(This,frameTime,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) + +#define IDeckLinkVideoInputFrame_v7_6_GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) \ + ( (This)->lpVtbl -> GetHardwareReferenceTimestamp(This,timeScale,frameTime,frameDuration) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoInputFrame_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkScreenPreviewCallback_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkScreenPreviewCallback_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("373F499D-4B4D-4518-AD22-6354E5A5825E") + IDeckLinkScreenPreviewCallback_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DrawFrame( + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkScreenPreviewCallback_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkScreenPreviewCallback_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkScreenPreviewCallback_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkScreenPreviewCallback_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *DrawFrame )( + IDeckLinkScreenPreviewCallback_v7_6 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame); + + END_INTERFACE + } IDeckLinkScreenPreviewCallback_v7_6Vtbl; + + interface IDeckLinkScreenPreviewCallback_v7_6 + { + CONST_VTBL struct IDeckLinkScreenPreviewCallback_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkScreenPreviewCallback_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkScreenPreviewCallback_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkScreenPreviewCallback_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkScreenPreviewCallback_v7_6_DrawFrame(This,theFrame) \ + ( (This)->lpVtbl -> DrawFrame(This,theFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkScreenPreviewCallback_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkGLScreenPreviewHelper_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkGLScreenPreviewHelper_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("BA575CD9-A15E-497B-B2C2-F9AFE7BE4EBA") + IDeckLinkGLScreenPreviewHelper_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE InitializeGL( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PaintGL( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetFrame( + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkGLScreenPreviewHelper_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkGLScreenPreviewHelper_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkGLScreenPreviewHelper_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkGLScreenPreviewHelper_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *InitializeGL )( + IDeckLinkGLScreenPreviewHelper_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *PaintGL )( + IDeckLinkGLScreenPreviewHelper_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetFrame )( + IDeckLinkGLScreenPreviewHelper_v7_6 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame); + + END_INTERFACE + } IDeckLinkGLScreenPreviewHelper_v7_6Vtbl; + + interface IDeckLinkGLScreenPreviewHelper_v7_6 + { + CONST_VTBL struct IDeckLinkGLScreenPreviewHelper_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkGLScreenPreviewHelper_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkGLScreenPreviewHelper_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkGLScreenPreviewHelper_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkGLScreenPreviewHelper_v7_6_InitializeGL(This) \ + ( (This)->lpVtbl -> InitializeGL(This) ) + +#define IDeckLinkGLScreenPreviewHelper_v7_6_PaintGL(This) \ + ( (This)->lpVtbl -> PaintGL(This) ) + +#define IDeckLinkGLScreenPreviewHelper_v7_6_SetFrame(This,theFrame) \ + ( (This)->lpVtbl -> SetFrame(This,theFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkGLScreenPreviewHelper_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoConversion_v7_6 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoConversion_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("3EB504C9-F97D-40FE-A158-D407D48CB53B") + IDeckLinkVideoConversion_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ConvertFrame( + /* [in] */ IDeckLinkVideoFrame_v7_6 *srcFrame, + /* [in] */ IDeckLinkVideoFrame_v7_6 *dstFrame) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoConversion_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoConversion_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoConversion_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoConversion_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *ConvertFrame )( + IDeckLinkVideoConversion_v7_6 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *srcFrame, + /* [in] */ IDeckLinkVideoFrame_v7_6 *dstFrame); + + END_INTERFACE + } IDeckLinkVideoConversion_v7_6Vtbl; + + interface IDeckLinkVideoConversion_v7_6 + { + CONST_VTBL struct IDeckLinkVideoConversion_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoConversion_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoConversion_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoConversion_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoConversion_v7_6_ConvertFrame(This,srcFrame,dstFrame) \ + ( (This)->lpVtbl -> ConvertFrame(This,srcFrame,dstFrame) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoConversion_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkConfiguration_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkConfiguration_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B8EAD569-B764-47F0-A73F-AE40DF6CBF10") + IDeckLinkConfiguration_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetConfigurationValidator( + /* [out] */ IDeckLinkConfiguration_v7_6 **configObject) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteConfigurationToPreferences( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFormat( + /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsVideoOutputActive( + /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection, + /* [out] */ BOOL *active) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoOutputFlags( + /* [in] */ BMDAnalogVideoFlags analogVideoFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoOutputFlags( + /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableFieldFlickerRemovalWhenPaused( + /* [in] */ BOOL enable) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsEnabledFieldFlickerRemovalWhenPaused( + /* [out] */ BOOL *enabled) = 0; + + virtual HRESULT STDMETHODCALLTYPE Set444And3GBpsVideoOutput( + /* [in] */ BOOL enable444VideoOutput, + /* [in] */ BOOL enable3GbsOutput) = 0; + + virtual HRESULT STDMETHODCALLTYPE Get444And3GBpsVideoOutput( + /* [out] */ BOOL *is444VideoOutputEnabled, + /* [out] */ BOOL *threeGbsOutputEnabled) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputConversionMode( + /* [in] */ BMDVideoOutputConversionMode conversionMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoOutputConversionMode( + /* [out] */ BMDVideoOutputConversionMode *conversionMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE Set_HD1080p24_to_HD1080i5994_Conversion( + /* [in] */ BOOL enable) = 0; + + virtual HRESULT STDMETHODCALLTYPE Get_HD1080p24_to_HD1080i5994_Conversion( + /* [out] */ BOOL *enabled) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoInputFormat( + /* [in] */ BMDVideoConnection_v7_6 videoInputFormat) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoInputFormat( + /* [out] */ BMDVideoConnection_v7_6 *videoInputFormat) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAnalogVideoInputFlags( + /* [in] */ BMDAnalogVideoFlags analogVideoFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAnalogVideoInputFlags( + /* [out] */ BMDAnalogVideoFlags *analogVideoFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoInputConversionMode( + /* [in] */ BMDVideoInputConversionMode conversionMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVideoInputConversionMode( + /* [out] */ BMDVideoInputConversionMode *conversionMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetBlackVideoOutputDuringCapture( + /* [in] */ BOOL blackOutInCapture) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBlackVideoOutputDuringCapture( + /* [out] */ BOOL *blackOutInCapture) = 0; + + virtual HRESULT STDMETHODCALLTYPE Set32PulldownSequenceInitialTimecodeFrame( + /* [in] */ unsigned int aFrameTimecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE Get32PulldownSequenceInitialTimecodeFrame( + /* [out] */ unsigned int *aFrameTimecode) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVancSourceLineMapping( + /* [in] */ unsigned int activeLine1VANCsource, + /* [in] */ unsigned int activeLine2VANCsource, + /* [in] */ unsigned int activeLine3VANCsource) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetVancSourceLineMapping( + /* [out] */ unsigned int *activeLine1VANCsource, + /* [out] */ unsigned int *activeLine2VANCsource, + /* [out] */ unsigned int *activeLine3VANCsource) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioInputFormat( + /* [in] */ BMDAudioConnection_v10_2 audioInputFormat) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudioInputFormat( + /* [out] */ BMDAudioConnection_v10_2 *audioInputFormat) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkConfiguration_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkConfiguration_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkConfiguration_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *GetConfigurationValidator )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ IDeckLinkConfiguration_v7_6 **configObject); + + HRESULT ( STDMETHODCALLTYPE *WriteConfigurationToPreferences )( + IDeckLinkConfiguration_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFormat )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection); + + HRESULT ( STDMETHODCALLTYPE *IsVideoOutputActive )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDVideoConnection_v7_6 videoOutputConnection, + /* [out] */ BOOL *active); + + HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoOutputFlags )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDAnalogVideoFlags analogVideoFlags); + + HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoOutputFlags )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BMDAnalogVideoFlags *analogVideoFlags); + + HRESULT ( STDMETHODCALLTYPE *EnableFieldFlickerRemovalWhenPaused )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BOOL enable); + + HRESULT ( STDMETHODCALLTYPE *IsEnabledFieldFlickerRemovalWhenPaused )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BOOL *enabled); + + HRESULT ( STDMETHODCALLTYPE *Set444And3GBpsVideoOutput )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BOOL enable444VideoOutput, + /* [in] */ BOOL enable3GbsOutput); + + HRESULT ( STDMETHODCALLTYPE *Get444And3GBpsVideoOutput )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BOOL *is444VideoOutputEnabled, + /* [out] */ BOOL *threeGbsOutputEnabled); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputConversionMode )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDVideoOutputConversionMode conversionMode); + + HRESULT ( STDMETHODCALLTYPE *GetVideoOutputConversionMode )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BMDVideoOutputConversionMode *conversionMode); + + HRESULT ( STDMETHODCALLTYPE *Set_HD1080p24_to_HD1080i5994_Conversion )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BOOL enable); + + HRESULT ( STDMETHODCALLTYPE *Get_HD1080p24_to_HD1080i5994_Conversion )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BOOL *enabled); + + HRESULT ( STDMETHODCALLTYPE *SetVideoInputFormat )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDVideoConnection_v7_6 videoInputFormat); + + HRESULT ( STDMETHODCALLTYPE *GetVideoInputFormat )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BMDVideoConnection_v7_6 *videoInputFormat); + + HRESULT ( STDMETHODCALLTYPE *SetAnalogVideoInputFlags )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDAnalogVideoFlags analogVideoFlags); + + HRESULT ( STDMETHODCALLTYPE *GetAnalogVideoInputFlags )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BMDAnalogVideoFlags *analogVideoFlags); + + HRESULT ( STDMETHODCALLTYPE *SetVideoInputConversionMode )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDVideoInputConversionMode conversionMode); + + HRESULT ( STDMETHODCALLTYPE *GetVideoInputConversionMode )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BMDVideoInputConversionMode *conversionMode); + + HRESULT ( STDMETHODCALLTYPE *SetBlackVideoOutputDuringCapture )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BOOL blackOutInCapture); + + HRESULT ( STDMETHODCALLTYPE *GetBlackVideoOutputDuringCapture )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BOOL *blackOutInCapture); + + HRESULT ( STDMETHODCALLTYPE *Set32PulldownSequenceInitialTimecodeFrame )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ unsigned int aFrameTimecode); + + HRESULT ( STDMETHODCALLTYPE *Get32PulldownSequenceInitialTimecodeFrame )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ unsigned int *aFrameTimecode); + + HRESULT ( STDMETHODCALLTYPE *SetVancSourceLineMapping )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ unsigned int activeLine1VANCsource, + /* [in] */ unsigned int activeLine2VANCsource, + /* [in] */ unsigned int activeLine3VANCsource); + + HRESULT ( STDMETHODCALLTYPE *GetVancSourceLineMapping )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ unsigned int *activeLine1VANCsource, + /* [out] */ unsigned int *activeLine2VANCsource, + /* [out] */ unsigned int *activeLine3VANCsource); + + HRESULT ( STDMETHODCALLTYPE *SetAudioInputFormat )( + IDeckLinkConfiguration_v7_6 * This, + /* [in] */ BMDAudioConnection_v10_2 audioInputFormat); + + HRESULT ( STDMETHODCALLTYPE *GetAudioInputFormat )( + IDeckLinkConfiguration_v7_6 * This, + /* [out] */ BMDAudioConnection_v10_2 *audioInputFormat); + + END_INTERFACE + } IDeckLinkConfiguration_v7_6Vtbl; + + interface IDeckLinkConfiguration_v7_6 + { + CONST_VTBL struct IDeckLinkConfiguration_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkConfiguration_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkConfiguration_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkConfiguration_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkConfiguration_v7_6_GetConfigurationValidator(This,configObject) \ + ( (This)->lpVtbl -> GetConfigurationValidator(This,configObject) ) + +#define IDeckLinkConfiguration_v7_6_WriteConfigurationToPreferences(This) \ + ( (This)->lpVtbl -> WriteConfigurationToPreferences(This) ) + +#define IDeckLinkConfiguration_v7_6_SetVideoOutputFormat(This,videoOutputConnection) \ + ( (This)->lpVtbl -> SetVideoOutputFormat(This,videoOutputConnection) ) + +#define IDeckLinkConfiguration_v7_6_IsVideoOutputActive(This,videoOutputConnection,active) \ + ( (This)->lpVtbl -> IsVideoOutputActive(This,videoOutputConnection,active) ) + +#define IDeckLinkConfiguration_v7_6_SetAnalogVideoOutputFlags(This,analogVideoFlags) \ + ( (This)->lpVtbl -> SetAnalogVideoOutputFlags(This,analogVideoFlags) ) + +#define IDeckLinkConfiguration_v7_6_GetAnalogVideoOutputFlags(This,analogVideoFlags) \ + ( (This)->lpVtbl -> GetAnalogVideoOutputFlags(This,analogVideoFlags) ) + +#define IDeckLinkConfiguration_v7_6_EnableFieldFlickerRemovalWhenPaused(This,enable) \ + ( (This)->lpVtbl -> EnableFieldFlickerRemovalWhenPaused(This,enable) ) + +#define IDeckLinkConfiguration_v7_6_IsEnabledFieldFlickerRemovalWhenPaused(This,enabled) \ + ( (This)->lpVtbl -> IsEnabledFieldFlickerRemovalWhenPaused(This,enabled) ) + +#define IDeckLinkConfiguration_v7_6_Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput) \ + ( (This)->lpVtbl -> Set444And3GBpsVideoOutput(This,enable444VideoOutput,enable3GbsOutput) ) + +#define IDeckLinkConfiguration_v7_6_Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled) \ + ( (This)->lpVtbl -> Get444And3GBpsVideoOutput(This,is444VideoOutputEnabled,threeGbsOutputEnabled) ) + +#define IDeckLinkConfiguration_v7_6_SetVideoOutputConversionMode(This,conversionMode) \ + ( (This)->lpVtbl -> SetVideoOutputConversionMode(This,conversionMode) ) + +#define IDeckLinkConfiguration_v7_6_GetVideoOutputConversionMode(This,conversionMode) \ + ( (This)->lpVtbl -> GetVideoOutputConversionMode(This,conversionMode) ) + +#define IDeckLinkConfiguration_v7_6_Set_HD1080p24_to_HD1080i5994_Conversion(This,enable) \ + ( (This)->lpVtbl -> Set_HD1080p24_to_HD1080i5994_Conversion(This,enable) ) + +#define IDeckLinkConfiguration_v7_6_Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled) \ + ( (This)->lpVtbl -> Get_HD1080p24_to_HD1080i5994_Conversion(This,enabled) ) + +#define IDeckLinkConfiguration_v7_6_SetVideoInputFormat(This,videoInputFormat) \ + ( (This)->lpVtbl -> SetVideoInputFormat(This,videoInputFormat) ) + +#define IDeckLinkConfiguration_v7_6_GetVideoInputFormat(This,videoInputFormat) \ + ( (This)->lpVtbl -> GetVideoInputFormat(This,videoInputFormat) ) + +#define IDeckLinkConfiguration_v7_6_SetAnalogVideoInputFlags(This,analogVideoFlags) \ + ( (This)->lpVtbl -> SetAnalogVideoInputFlags(This,analogVideoFlags) ) + +#define IDeckLinkConfiguration_v7_6_GetAnalogVideoInputFlags(This,analogVideoFlags) \ + ( (This)->lpVtbl -> GetAnalogVideoInputFlags(This,analogVideoFlags) ) + +#define IDeckLinkConfiguration_v7_6_SetVideoInputConversionMode(This,conversionMode) \ + ( (This)->lpVtbl -> SetVideoInputConversionMode(This,conversionMode) ) + +#define IDeckLinkConfiguration_v7_6_GetVideoInputConversionMode(This,conversionMode) \ + ( (This)->lpVtbl -> GetVideoInputConversionMode(This,conversionMode) ) + +#define IDeckLinkConfiguration_v7_6_SetBlackVideoOutputDuringCapture(This,blackOutInCapture) \ + ( (This)->lpVtbl -> SetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) + +#define IDeckLinkConfiguration_v7_6_GetBlackVideoOutputDuringCapture(This,blackOutInCapture) \ + ( (This)->lpVtbl -> GetBlackVideoOutputDuringCapture(This,blackOutInCapture) ) + +#define IDeckLinkConfiguration_v7_6_Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) \ + ( (This)->lpVtbl -> Set32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) + +#define IDeckLinkConfiguration_v7_6_Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) \ + ( (This)->lpVtbl -> Get32PulldownSequenceInitialTimecodeFrame(This,aFrameTimecode) ) + +#define IDeckLinkConfiguration_v7_6_SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) \ + ( (This)->lpVtbl -> SetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) + +#define IDeckLinkConfiguration_v7_6_GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) \ + ( (This)->lpVtbl -> GetVancSourceLineMapping(This,activeLine1VANCsource,activeLine2VANCsource,activeLine3VANCsource) ) + +#define IDeckLinkConfiguration_v7_6_SetAudioInputFormat(This,audioInputFormat) \ + ( (This)->lpVtbl -> SetAudioInputFormat(This,audioInputFormat) ) + +#define IDeckLinkConfiguration_v7_6_GetAudioInputFormat(This,audioInputFormat) \ + ( (This)->lpVtbl -> GetAudioInputFormat(This,audioInputFormat) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkConfiguration_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoOutputCallback_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("E763A626-4A3C-49D1-BF13-E7AD3692AE52") + IDeckLinkVideoOutputCallback_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( + /* [in] */ IDeckLinkVideoFrame_v7_6 *completedFrame, + /* [in] */ BMDOutputFrameCompletionResult result) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduledPlaybackHasStopped( void) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoOutputCallback_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoOutputCallback_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoOutputCallback_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoOutputCallback_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( + IDeckLinkVideoOutputCallback_v7_6 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *completedFrame, + /* [in] */ BMDOutputFrameCompletionResult result); + + HRESULT ( STDMETHODCALLTYPE *ScheduledPlaybackHasStopped )( + IDeckLinkVideoOutputCallback_v7_6 * This); + + END_INTERFACE + } IDeckLinkVideoOutputCallback_v7_6Vtbl; + + interface IDeckLinkVideoOutputCallback_v7_6 + { + CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoOutputCallback_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoOutputCallback_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoOutputCallback_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoOutputCallback_v7_6_ScheduledFrameCompleted(This,completedFrame,result) \ + ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) + +#define IDeckLinkVideoOutputCallback_v7_6_ScheduledPlaybackHasStopped(This) \ + ( (This)->lpVtbl -> ScheduledPlaybackHasStopped(This) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoOutputCallback_v7_6_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__ +#define __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__ + +/* interface IDeckLinkInputCallback_v7_6 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInputCallback_v7_6; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("31D28EE7-88B6-4CB1-897A-CDBF79A26414") + IDeckLinkInputCallback_v7_6 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( + /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, + /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, + /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( + /* [in] */ IDeckLinkVideoInputFrame_v7_6 *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInputCallback_v7_6Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInputCallback_v7_6 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInputCallback_v7_6 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInputCallback_v7_6 * This); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( + IDeckLinkInputCallback_v7_6 * This, + /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, + /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, + /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( + IDeckLinkInputCallback_v7_6 * This, + /* [in] */ IDeckLinkVideoInputFrame_v7_6 *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket *audioPacket); + + END_INTERFACE + } IDeckLinkInputCallback_v7_6Vtbl; + + interface IDeckLinkInputCallback_v7_6 + { + CONST_VTBL struct IDeckLinkInputCallback_v7_6Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInputCallback_v7_6_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInputCallback_v7_6_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInputCallback_v7_6_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInputCallback_v7_6_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ + ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) + +#define IDeckLinkInputCallback_v7_6_VideoInputFrameArrived(This,videoFrame,audioPacket) \ + ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInputCallback_v7_6_INTERFACE_DEFINED__ */ + + +EXTERN_C const CLSID CLSID_CDeckLinkGLScreenPreviewHelper_v7_6; + +#ifdef __cplusplus + +class DECLSPEC_UUID("D398CEE7-4434-4CA3-9BA6-5AE34556B905") +CDeckLinkGLScreenPreviewHelper_v7_6; +#endif + +EXTERN_C const CLSID CLSID_CDeckLinkVideoConversion_v7_6; + +#ifdef __cplusplus + +class DECLSPEC_UUID("FFA84F77-73BE-4FB7-B03E-B5E44B9F759B") +CDeckLinkVideoConversion_v7_6; +#endif + +#ifndef __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ +#define __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ + +/* interface IDeckLinkInputCallback_v7_3 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInputCallback_v7_3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("FD6F311D-4D00-444B-9ED4-1F25B5730AD0") + IDeckLinkInputCallback_v7_3 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged( + /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, + /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, + /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags) = 0; + + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( + /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket *audioPacket) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInputCallback_v7_3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInputCallback_v7_3 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInputCallback_v7_3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInputCallback_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFormatChanged )( + IDeckLinkInputCallback_v7_3 * This, + /* [in] */ BMDVideoInputFormatChangedEvents notificationEvents, + /* [in] */ IDeckLinkDisplayMode_v7_6 *newDisplayMode, + /* [in] */ BMDDetectedVideoInputFormatFlags detectedSignalFlags); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( + IDeckLinkInputCallback_v7_3 * This, + /* [in] */ IDeckLinkVideoInputFrame_v7_3 *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket *audioPacket); + + END_INTERFACE + } IDeckLinkInputCallback_v7_3Vtbl; + + interface IDeckLinkInputCallback_v7_3 + { + CONST_VTBL struct IDeckLinkInputCallback_v7_3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInputCallback_v7_3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInputCallback_v7_3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInputCallback_v7_3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInputCallback_v7_3_VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) \ + ( (This)->lpVtbl -> VideoInputFormatChanged(This,notificationEvents,newDisplayMode,detectedSignalFlags) ) + +#define IDeckLinkInputCallback_v7_3_VideoInputFrameArrived(This,videoFrame,audioPacket) \ + ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInputCallback_v7_3_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ +#define __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ + +/* interface IDeckLinkOutput_v7_3 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkOutput_v7_3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("271C65E3-C323-4344-A30F-D908BCB20AA3") + IDeckLinkOutput_v7_3 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( + BMDDisplayMode displayMode, + BMDVideoOutputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( + /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateAncillaryData( + BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame, + BMDTimeValue displayTime, + BMDTimeValue displayDuration, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( + /* [in] */ IDeckLinkVideoOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedVideoFrameCount( + /* [out] */ unsigned int *bufferedFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount, + BMDAudioOutputStreamType streamType) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + BMDTimeValue streamTime, + BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( + /* [out] */ unsigned int *bufferedSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( + /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( + BMDTimeValue playbackStartTime, + BMDTimeScale timeScale, + double playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( + BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE IsScheduledPlaybackRunning( + /* [out] */ BOOL *active) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkOutput_v7_3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkOutput_v7_3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkOutput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkOutput_v7_3 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkOutput_v7_3 * This, + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( + IDeckLinkOutput_v7_3 * This, + BMDDisplayMode displayMode, + BMDVideoOutputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( + IDeckLinkOutput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ IDeckLinkMemoryAllocator *theAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( + IDeckLinkOutput_v7_3 * This, + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + /* [out] */ IDeckLinkMutableVideoFrame_v7_6 **outFrame); + + HRESULT ( STDMETHODCALLTYPE *CreateAncillaryData )( + IDeckLinkOutput_v7_3 * This, + BMDPixelFormat pixelFormat, + /* [out] */ IDeckLinkVideoFrameAncillary **outBuffer); + + HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame); + + HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ IDeckLinkVideoFrame_v7_6 *theFrame, + BMDTimeValue displayTime, + BMDTimeValue displayDuration, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ IDeckLinkVideoOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedVideoFrameCount )( + IDeckLinkOutput_v7_3 * This, + /* [out] */ unsigned int *bufferedFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( + IDeckLinkOutput_v7_3 * This, + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount, + BMDAudioOutputStreamType streamType); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( + IDeckLinkOutput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( + IDeckLinkOutput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( + IDeckLinkOutput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ void *buffer, + unsigned int sampleFrameCount, + BMDTimeValue streamTime, + BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( + IDeckLinkOutput_v7_3 * This, + /* [out] */ unsigned int *bufferedSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( + IDeckLinkOutput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( + IDeckLinkOutput_v7_3 * This, + /* [in] */ IDeckLinkAudioOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( + IDeckLinkOutput_v7_3 * This, + BMDTimeValue playbackStartTime, + BMDTimeScale timeScale, + double playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( + IDeckLinkOutput_v7_3 * This, + BMDTimeValue stopPlaybackAtTime, + /* [out] */ BMDTimeValue *actualStopTime, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *IsScheduledPlaybackRunning )( + IDeckLinkOutput_v7_3 * This, + /* [out] */ BOOL *active); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkOutput_v7_3 * This, + BMDTimeScale desiredTimeScale, + /* [out] */ BMDTimeValue *elapsedTimeSinceSchedulerBegan); + + END_INTERFACE + } IDeckLinkOutput_v7_3Vtbl; + + interface IDeckLinkOutput_v7_3 + { + CONST_VTBL struct IDeckLinkOutput_v7_3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkOutput_v7_3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkOutput_v7_3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkOutput_v7_3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkOutput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) + +#define IDeckLinkOutput_v7_3_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkOutput_v7_3_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkOutput_v7_3_EnableVideoOutput(This,displayMode,flags) \ + ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode,flags) ) + +#define IDeckLinkOutput_v7_3_DisableVideoOutput(This) \ + ( (This)->lpVtbl -> DisableVideoOutput(This) ) + +#define IDeckLinkOutput_v7_3_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ + ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) + +#define IDeckLinkOutput_v7_3_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ + ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) + +#define IDeckLinkOutput_v7_3_CreateAncillaryData(This,pixelFormat,outBuffer) \ + ( (This)->lpVtbl -> CreateAncillaryData(This,pixelFormat,outBuffer) ) + +#define IDeckLinkOutput_v7_3_DisplayVideoFrameSync(This,theFrame) \ + ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) + +#define IDeckLinkOutput_v7_3_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ + ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) + +#define IDeckLinkOutput_v7_3_SetScheduledFrameCompletionCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) + +#define IDeckLinkOutput_v7_3_GetBufferedVideoFrameCount(This,bufferedFrameCount) \ + ( (This)->lpVtbl -> GetBufferedVideoFrameCount(This,bufferedFrameCount) ) + +#define IDeckLinkOutput_v7_3_EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) \ + ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount,streamType) ) + +#define IDeckLinkOutput_v7_3_DisableAudioOutput(This) \ + ( (This)->lpVtbl -> DisableAudioOutput(This) ) + +#define IDeckLinkOutput_v7_3_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ + ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) + +#define IDeckLinkOutput_v7_3_BeginAudioPreroll(This) \ + ( (This)->lpVtbl -> BeginAudioPreroll(This) ) + +#define IDeckLinkOutput_v7_3_EndAudioPreroll(This) \ + ( (This)->lpVtbl -> EndAudioPreroll(This) ) + +#define IDeckLinkOutput_v7_3_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ + ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) + +#define IDeckLinkOutput_v7_3_GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) \ + ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleFrameCount) ) + +#define IDeckLinkOutput_v7_3_FlushBufferedAudioSamples(This) \ + ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) + +#define IDeckLinkOutput_v7_3_SetAudioCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) + +#define IDeckLinkOutput_v7_3_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ + ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) + +#define IDeckLinkOutput_v7_3_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ + ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) + +#define IDeckLinkOutput_v7_3_IsScheduledPlaybackRunning(This,active) \ + ( (This)->lpVtbl -> IsScheduledPlaybackRunning(This,active) ) + +#define IDeckLinkOutput_v7_3_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkOutput_v7_3_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ +#define __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ + +/* interface IDeckLinkInput_v7_3 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInput_v7_3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("4973F012-9925-458C-871C-18774CDBBECB") + IDeckLinkInput_v7_3 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScreenPreviewCallback( + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + BMDVideoInputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableVideoFrameCount( + /* [out] */ unsigned int *availableFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAvailableAudioSampleFrameCount( + /* [out] */ unsigned int *availableSampleFrameCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInput_v7_3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInput_v7_3 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInput_v7_3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkInput_v7_3 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkInput_v7_3 * This, + /* [out] */ IDeckLinkDisplayModeIterator_v7_6 **iterator); + + HRESULT ( STDMETHODCALLTYPE *SetScreenPreviewCallback )( + IDeckLinkInput_v7_3 * This, + /* [in] */ IDeckLinkScreenPreviewCallback *previewCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( + IDeckLinkInput_v7_3 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + BMDVideoInputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableVideoFrameCount )( + IDeckLinkInput_v7_3 * This, + /* [out] */ unsigned int *availableFrameCount); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( + IDeckLinkInput_v7_3 * This, + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *GetAvailableAudioSampleFrameCount )( + IDeckLinkInput_v7_3 * This, + /* [out] */ unsigned int *availableSampleFrameCount); + + HRESULT ( STDMETHODCALLTYPE *StartStreams )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *StopStreams )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *PauseStreams )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *FlushStreams )( + IDeckLinkInput_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkInput_v7_3 * This, + /* [in] */ IDeckLinkInputCallback_v7_3 *theCallback); + + END_INTERFACE + } IDeckLinkInput_v7_3Vtbl; + + interface IDeckLinkInput_v7_3 + { + CONST_VTBL struct IDeckLinkInput_v7_3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInput_v7_3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInput_v7_3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInput_v7_3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInput_v7_3_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) + +#define IDeckLinkInput_v7_3_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkInput_v7_3_SetScreenPreviewCallback(This,previewCallback) \ + ( (This)->lpVtbl -> SetScreenPreviewCallback(This,previewCallback) ) + +#define IDeckLinkInput_v7_3_EnableVideoInput(This,displayMode,pixelFormat,flags) \ + ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) + +#define IDeckLinkInput_v7_3_DisableVideoInput(This) \ + ( (This)->lpVtbl -> DisableVideoInput(This) ) + +#define IDeckLinkInput_v7_3_GetAvailableVideoFrameCount(This,availableFrameCount) \ + ( (This)->lpVtbl -> GetAvailableVideoFrameCount(This,availableFrameCount) ) + +#define IDeckLinkInput_v7_3_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ + ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) + +#define IDeckLinkInput_v7_3_DisableAudioInput(This) \ + ( (This)->lpVtbl -> DisableAudioInput(This) ) + +#define IDeckLinkInput_v7_3_GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) \ + ( (This)->lpVtbl -> GetAvailableAudioSampleFrameCount(This,availableSampleFrameCount) ) + +#define IDeckLinkInput_v7_3_StartStreams(This) \ + ( (This)->lpVtbl -> StartStreams(This) ) + +#define IDeckLinkInput_v7_3_StopStreams(This) \ + ( (This)->lpVtbl -> StopStreams(This) ) + +#define IDeckLinkInput_v7_3_PauseStreams(This) \ + ( (This)->lpVtbl -> PauseStreams(This) ) + +#define IDeckLinkInput_v7_3_FlushStreams(This) \ + ( (This)->lpVtbl -> FlushStreams(This) ) + +#define IDeckLinkInput_v7_3_SetCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetCallback(This,theCallback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInput_v7_3_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ +#define __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoInputFrame_v7_3 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_3; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("CF317790-2894-11DE-8C30-0800200C9A66") + IDeckLinkVideoInputFrame_v7_3 : public IDeckLinkVideoFrame_v7_6 + { + public: + virtual HRESULT STDMETHODCALLTYPE GetStreamTime( + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration, + BMDTimeScale timeScale) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoInputFrame_v7_3Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoInputFrame_v7_3 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoInputFrame_v7_3 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoInputFrame_v7_3 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoInputFrame_v7_3 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoInputFrame_v7_3 * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoInputFrame_v7_3 * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoInputFrame_v7_3 * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoInputFrame_v7_3 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoInputFrame_v7_3 * This, + /* [out] */ void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetTimecode )( + IDeckLinkVideoInputFrame_v7_3 * This, + BMDTimecodeFormat format, + /* [out] */ IDeckLinkTimecode_v7_6 **timecode); + + HRESULT ( STDMETHODCALLTYPE *GetAncillaryData )( + IDeckLinkVideoInputFrame_v7_3 * This, + /* [out] */ IDeckLinkVideoFrameAncillary **ancillary); + + HRESULT ( STDMETHODCALLTYPE *GetStreamTime )( + IDeckLinkVideoInputFrame_v7_3 * This, + /* [out] */ BMDTimeValue *frameTime, + /* [out] */ BMDTimeValue *frameDuration, + BMDTimeScale timeScale); + + END_INTERFACE + } IDeckLinkVideoInputFrame_v7_3Vtbl; + + interface IDeckLinkVideoInputFrame_v7_3 + { + CONST_VTBL struct IDeckLinkVideoInputFrame_v7_3Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoInputFrame_v7_3_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoInputFrame_v7_3_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoInputFrame_v7_3_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoInputFrame_v7_3_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetTimecode(This,format,timecode) \ + ( (This)->lpVtbl -> GetTimecode(This,format,timecode) ) + +#define IDeckLinkVideoInputFrame_v7_3_GetAncillaryData(This,ancillary) \ + ( (This)->lpVtbl -> GetAncillaryData(This,ancillary) ) + + +#define IDeckLinkVideoInputFrame_v7_3_GetStreamTime(This,frameTime,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetStreamTime(This,frameTime,frameDuration,timeScale) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoInputFrame_v7_3_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkDisplayModeIterator_v7_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDisplayModeIterator_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("B28131B6-59AC-4857-B5AC-CD75D5883E2F") + IDeckLinkDisplayModeIterator_v7_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE Next( + /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDisplayModeIterator_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDisplayModeIterator_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDisplayModeIterator_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDisplayModeIterator_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *Next )( + IDeckLinkDisplayModeIterator_v7_1 * This, + /* [out] */ IDeckLinkDisplayMode_v7_1 **deckLinkDisplayMode); + + END_INTERFACE + } IDeckLinkDisplayModeIterator_v7_1Vtbl; + + interface IDeckLinkDisplayModeIterator_v7_1 + { + CONST_VTBL struct IDeckLinkDisplayModeIterator_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDisplayModeIterator_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDisplayModeIterator_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDisplayModeIterator_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDisplayModeIterator_v7_1_Next(This,deckLinkDisplayMode) \ + ( (This)->lpVtbl -> Next(This,deckLinkDisplayMode) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDisplayModeIterator_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkDisplayMode_v7_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkDisplayMode_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AF0CD6D5-8376-435E-8433-54F9DD530AC3") + IDeckLinkDisplayMode_v7_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE GetName( + /* [out] */ BSTR *name) = 0; + + virtual BMDDisplayMode STDMETHODCALLTYPE GetDisplayMode( void) = 0; + + virtual long STDMETHODCALLTYPE GetWidth( void) = 0; + + virtual long STDMETHODCALLTYPE GetHeight( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetFrameRate( + /* [out] */ BMDTimeValue *frameDuration, + /* [out] */ BMDTimeScale *timeScale) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkDisplayMode_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkDisplayMode_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkDisplayMode_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkDisplayMode_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetName )( + IDeckLinkDisplayMode_v7_1 * This, + /* [out] */ BSTR *name); + + BMDDisplayMode ( STDMETHODCALLTYPE *GetDisplayMode )( + IDeckLinkDisplayMode_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkDisplayMode_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkDisplayMode_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetFrameRate )( + IDeckLinkDisplayMode_v7_1 * This, + /* [out] */ BMDTimeValue *frameDuration, + /* [out] */ BMDTimeScale *timeScale); + + END_INTERFACE + } IDeckLinkDisplayMode_v7_1Vtbl; + + interface IDeckLinkDisplayMode_v7_1 + { + CONST_VTBL struct IDeckLinkDisplayMode_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkDisplayMode_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkDisplayMode_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkDisplayMode_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkDisplayMode_v7_1_GetName(This,name) \ + ( (This)->lpVtbl -> GetName(This,name) ) + +#define IDeckLinkDisplayMode_v7_1_GetDisplayMode(This) \ + ( (This)->lpVtbl -> GetDisplayMode(This) ) + +#define IDeckLinkDisplayMode_v7_1_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkDisplayMode_v7_1_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkDisplayMode_v7_1_GetFrameRate(This,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetFrameRate(This,frameDuration,timeScale) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkDisplayMode_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoFrame_v7_1 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoFrame_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("333F3A10-8C2D-43CF-B79D-46560FEEA1CE") + IDeckLinkVideoFrame_v7_1 : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetWidth( void) = 0; + + virtual long STDMETHODCALLTYPE GetHeight( void) = 0; + + virtual long STDMETHODCALLTYPE GetRowBytes( void) = 0; + + virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat( void) = 0; + + virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + void **buffer) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoFrame_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoFrame_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoFrame_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoFrame_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoFrame_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoFrame_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoFrame_v7_1 * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoFrame_v7_1 * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoFrame_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoFrame_v7_1 * This, + void **buffer); + + END_INTERFACE + } IDeckLinkVideoFrame_v7_1Vtbl; + + interface IDeckLinkVideoFrame_v7_1 + { + CONST_VTBL struct IDeckLinkVideoFrame_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoFrame_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoFrame_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoFrame_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoFrame_v7_1_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoFrame_v7_1_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoFrame_v7_1_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoFrame_v7_1_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoFrame_v7_1_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoFrame_v7_1_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoFrame_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoInputFrame_v7_1 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoInputFrame_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C8B41D95-8848-40EE-9B37-6E3417FB114B") + IDeckLinkVideoInputFrame_v7_1 : public IDeckLinkVideoFrame_v7_1 + { + public: + virtual HRESULT STDMETHODCALLTYPE GetFrameTime( + BMDTimeValue *frameTime, + BMDTimeValue *frameDuration, + BMDTimeScale timeScale) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoInputFrame_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoInputFrame_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoInputFrame_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoInputFrame_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetWidth )( + IDeckLinkVideoInputFrame_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetHeight )( + IDeckLinkVideoInputFrame_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetRowBytes )( + IDeckLinkVideoInputFrame_v7_1 * This); + + BMDPixelFormat ( STDMETHODCALLTYPE *GetPixelFormat )( + IDeckLinkVideoInputFrame_v7_1 * This); + + BMDFrameFlags ( STDMETHODCALLTYPE *GetFlags )( + IDeckLinkVideoInputFrame_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkVideoInputFrame_v7_1 * This, + void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetFrameTime )( + IDeckLinkVideoInputFrame_v7_1 * This, + BMDTimeValue *frameTime, + BMDTimeValue *frameDuration, + BMDTimeScale timeScale); + + END_INTERFACE + } IDeckLinkVideoInputFrame_v7_1Vtbl; + + interface IDeckLinkVideoInputFrame_v7_1 + { + CONST_VTBL struct IDeckLinkVideoInputFrame_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoInputFrame_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoInputFrame_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoInputFrame_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoInputFrame_v7_1_GetWidth(This) \ + ( (This)->lpVtbl -> GetWidth(This) ) + +#define IDeckLinkVideoInputFrame_v7_1_GetHeight(This) \ + ( (This)->lpVtbl -> GetHeight(This) ) + +#define IDeckLinkVideoInputFrame_v7_1_GetRowBytes(This) \ + ( (This)->lpVtbl -> GetRowBytes(This) ) + +#define IDeckLinkVideoInputFrame_v7_1_GetPixelFormat(This) \ + ( (This)->lpVtbl -> GetPixelFormat(This) ) + +#define IDeckLinkVideoInputFrame_v7_1_GetFlags(This) \ + ( (This)->lpVtbl -> GetFlags(This) ) + +#define IDeckLinkVideoInputFrame_v7_1_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + + +#define IDeckLinkVideoInputFrame_v7_1_GetFrameTime(This,frameTime,frameDuration,timeScale) \ + ( (This)->lpVtbl -> GetFrameTime(This,frameTime,frameDuration,timeScale) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoInputFrame_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkAudioInputPacket_v7_1 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkAudioInputPacket_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("C86DE4F6-A29F-42E3-AB3A-1363E29F0788") + IDeckLinkAudioInputPacket_v7_1 : public IUnknown + { + public: + virtual long STDMETHODCALLTYPE GetSampleCount( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBytes( + void **buffer) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetAudioPacketTime( + BMDTimeValue *packetTime, + BMDTimeScale timeScale) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkAudioInputPacket_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkAudioInputPacket_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkAudioInputPacket_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkAudioInputPacket_v7_1 * This); + + long ( STDMETHODCALLTYPE *GetSampleCount )( + IDeckLinkAudioInputPacket_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *GetBytes )( + IDeckLinkAudioInputPacket_v7_1 * This, + void **buffer); + + HRESULT ( STDMETHODCALLTYPE *GetAudioPacketTime )( + IDeckLinkAudioInputPacket_v7_1 * This, + BMDTimeValue *packetTime, + BMDTimeScale timeScale); + + END_INTERFACE + } IDeckLinkAudioInputPacket_v7_1Vtbl; + + interface IDeckLinkAudioInputPacket_v7_1 + { + CONST_VTBL struct IDeckLinkAudioInputPacket_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkAudioInputPacket_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkAudioInputPacket_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkAudioInputPacket_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkAudioInputPacket_v7_1_GetSampleCount(This) \ + ( (This)->lpVtbl -> GetSampleCount(This) ) + +#define IDeckLinkAudioInputPacket_v7_1_GetBytes(This,buffer) \ + ( (This)->lpVtbl -> GetBytes(This,buffer) ) + +#define IDeckLinkAudioInputPacket_v7_1_GetAudioPacketTime(This,packetTime,timeScale) \ + ( (This)->lpVtbl -> GetAudioPacketTime(This,packetTime,timeScale) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkAudioInputPacket_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkVideoOutputCallback_v7_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkVideoOutputCallback_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("EBD01AFA-E4B0-49C6-A01D-EDB9D1B55FD9") + IDeckLinkVideoOutputCallback_v7_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( + /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame, + /* [in] */ BMDOutputFrameCompletionResult result) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkVideoOutputCallback_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkVideoOutputCallback_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkVideoOutputCallback_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkVideoOutputCallback_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduledFrameCompleted )( + IDeckLinkVideoOutputCallback_v7_1 * This, + /* [in] */ IDeckLinkVideoFrame_v7_1 *completedFrame, + /* [in] */ BMDOutputFrameCompletionResult result); + + END_INTERFACE + } IDeckLinkVideoOutputCallback_v7_1Vtbl; + + interface IDeckLinkVideoOutputCallback_v7_1 + { + CONST_VTBL struct IDeckLinkVideoOutputCallback_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkVideoOutputCallback_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkVideoOutputCallback_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkVideoOutputCallback_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkVideoOutputCallback_v7_1_ScheduledFrameCompleted(This,completedFrame,result) \ + ( (This)->lpVtbl -> ScheduledFrameCompleted(This,completedFrame,result) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkVideoOutputCallback_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkInputCallback_v7_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInputCallback_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("7F94F328-5ED4-4E9F-9729-76A86BDC99CC") + IDeckLinkInputCallback_v7_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived( + /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInputCallback_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInputCallback_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInputCallback_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInputCallback_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *VideoInputFrameArrived )( + IDeckLinkInputCallback_v7_1 * This, + /* [in] */ IDeckLinkVideoInputFrame_v7_1 *videoFrame, + /* [in] */ IDeckLinkAudioInputPacket_v7_1 *audioPacket); + + END_INTERFACE + } IDeckLinkInputCallback_v7_1Vtbl; + + interface IDeckLinkInputCallback_v7_1 + { + CONST_VTBL struct IDeckLinkInputCallback_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInputCallback_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInputCallback_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInputCallback_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInputCallback_v7_1_VideoInputFrameArrived(This,videoFrame,audioPacket) \ + ( (This)->lpVtbl -> VideoInputFrameArrived(This,videoFrame,audioPacket) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInputCallback_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkOutput_v7_1 */ +/* [helpstring][local][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkOutput_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("AE5B3E9B-4E1E-4535-B6E8-480FF52F6CE5") + IDeckLinkOutput_v7_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoOutput( + BMDDisplayMode displayMode) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetVideoOutputFrameMemoryAllocator( + /* [in] */ IDeckLinkMemoryAllocator *theAllocator) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrame( + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + IDeckLinkVideoFrame_v7_1 **outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE CreateVideoFrameFromBuffer( + void *buffer, + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + IDeckLinkVideoFrame_v7_1 **outFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisplayVideoFrameSync( + IDeckLinkVideoFrame_v7_1 *theFrame) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleVideoFrame( + IDeckLinkVideoFrame_v7_1 *theFrame, + BMDTimeValue displayTime, + BMDTimeValue displayDuration, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetScheduledFrameCompletionCallback( + /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioOutput( + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioOutput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE WriteAudioSamplesSync( + void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE BeginAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EndAudioPreroll( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ScheduleAudioSamples( + void *buffer, + unsigned int sampleFrameCount, + BMDTimeValue streamTime, + BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( + /* [out] */ unsigned int *bufferedSampleCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE FlushBufferedAudioSamples( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetAudioCallback( + /* [in] */ IDeckLinkAudioOutputCallback *theCallback) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartScheduledPlayback( + BMDTimeValue playbackStartTime, + BMDTimeScale timeScale, + double playbackSpeed) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopScheduledPlayback( + BMDTimeValue stopPlaybackAtTime, + BMDTimeValue *actualStopTime, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetHardwareReferenceClock( + BMDTimeScale desiredTimeScale, + BMDTimeValue *elapsedTimeSinceSchedulerBegan) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkOutput_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkOutput_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkOutput_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkOutput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkOutput_v7_1 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkOutput_v7_1 * This, + /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoOutput )( + IDeckLinkOutput_v7_1 * This, + BMDDisplayMode displayMode); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoOutput )( + IDeckLinkOutput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetVideoOutputFrameMemoryAllocator )( + IDeckLinkOutput_v7_1 * This, + /* [in] */ IDeckLinkMemoryAllocator *theAllocator); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoFrame )( + IDeckLinkOutput_v7_1 * This, + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + IDeckLinkVideoFrame_v7_1 **outFrame); + + HRESULT ( STDMETHODCALLTYPE *CreateVideoFrameFromBuffer )( + IDeckLinkOutput_v7_1 * This, + void *buffer, + int width, + int height, + int rowBytes, + BMDPixelFormat pixelFormat, + BMDFrameFlags flags, + IDeckLinkVideoFrame_v7_1 **outFrame); + + HRESULT ( STDMETHODCALLTYPE *DisplayVideoFrameSync )( + IDeckLinkOutput_v7_1 * This, + IDeckLinkVideoFrame_v7_1 *theFrame); + + HRESULT ( STDMETHODCALLTYPE *ScheduleVideoFrame )( + IDeckLinkOutput_v7_1 * This, + IDeckLinkVideoFrame_v7_1 *theFrame, + BMDTimeValue displayTime, + BMDTimeValue displayDuration, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *SetScheduledFrameCompletionCallback )( + IDeckLinkOutput_v7_1 * This, + /* [in] */ IDeckLinkVideoOutputCallback_v7_1 *theCallback); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioOutput )( + IDeckLinkOutput_v7_1 * This, + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioOutput )( + IDeckLinkOutput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *WriteAudioSamplesSync )( + IDeckLinkOutput_v7_1 * This, + void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *BeginAudioPreroll )( + IDeckLinkOutput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *EndAudioPreroll )( + IDeckLinkOutput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *ScheduleAudioSamples )( + IDeckLinkOutput_v7_1 * This, + void *buffer, + unsigned int sampleFrameCount, + BMDTimeValue streamTime, + BMDTimeScale timeScale, + /* [out] */ unsigned int *sampleFramesWritten); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( + IDeckLinkOutput_v7_1 * This, + /* [out] */ unsigned int *bufferedSampleCount); + + HRESULT ( STDMETHODCALLTYPE *FlushBufferedAudioSamples )( + IDeckLinkOutput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetAudioCallback )( + IDeckLinkOutput_v7_1 * This, + /* [in] */ IDeckLinkAudioOutputCallback *theCallback); + + HRESULT ( STDMETHODCALLTYPE *StartScheduledPlayback )( + IDeckLinkOutput_v7_1 * This, + BMDTimeValue playbackStartTime, + BMDTimeScale timeScale, + double playbackSpeed); + + HRESULT ( STDMETHODCALLTYPE *StopScheduledPlayback )( + IDeckLinkOutput_v7_1 * This, + BMDTimeValue stopPlaybackAtTime, + BMDTimeValue *actualStopTime, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *GetHardwareReferenceClock )( + IDeckLinkOutput_v7_1 * This, + BMDTimeScale desiredTimeScale, + BMDTimeValue *elapsedTimeSinceSchedulerBegan); + + END_INTERFACE + } IDeckLinkOutput_v7_1Vtbl; + + interface IDeckLinkOutput_v7_1 + { + CONST_VTBL struct IDeckLinkOutput_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkOutput_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkOutput_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkOutput_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkOutput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) + +#define IDeckLinkOutput_v7_1_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkOutput_v7_1_EnableVideoOutput(This,displayMode) \ + ( (This)->lpVtbl -> EnableVideoOutput(This,displayMode) ) + +#define IDeckLinkOutput_v7_1_DisableVideoOutput(This) \ + ( (This)->lpVtbl -> DisableVideoOutput(This) ) + +#define IDeckLinkOutput_v7_1_SetVideoOutputFrameMemoryAllocator(This,theAllocator) \ + ( (This)->lpVtbl -> SetVideoOutputFrameMemoryAllocator(This,theAllocator) ) + +#define IDeckLinkOutput_v7_1_CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) \ + ( (This)->lpVtbl -> CreateVideoFrame(This,width,height,rowBytes,pixelFormat,flags,outFrame) ) + +#define IDeckLinkOutput_v7_1_CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame) \ + ( (This)->lpVtbl -> CreateVideoFrameFromBuffer(This,buffer,width,height,rowBytes,pixelFormat,flags,outFrame) ) + +#define IDeckLinkOutput_v7_1_DisplayVideoFrameSync(This,theFrame) \ + ( (This)->lpVtbl -> DisplayVideoFrameSync(This,theFrame) ) + +#define IDeckLinkOutput_v7_1_ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) \ + ( (This)->lpVtbl -> ScheduleVideoFrame(This,theFrame,displayTime,displayDuration,timeScale) ) + +#define IDeckLinkOutput_v7_1_SetScheduledFrameCompletionCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetScheduledFrameCompletionCallback(This,theCallback) ) + +#define IDeckLinkOutput_v7_1_EnableAudioOutput(This,sampleRate,sampleType,channelCount) \ + ( (This)->lpVtbl -> EnableAudioOutput(This,sampleRate,sampleType,channelCount) ) + +#define IDeckLinkOutput_v7_1_DisableAudioOutput(This) \ + ( (This)->lpVtbl -> DisableAudioOutput(This) ) + +#define IDeckLinkOutput_v7_1_WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) \ + ( (This)->lpVtbl -> WriteAudioSamplesSync(This,buffer,sampleFrameCount,sampleFramesWritten) ) + +#define IDeckLinkOutput_v7_1_BeginAudioPreroll(This) \ + ( (This)->lpVtbl -> BeginAudioPreroll(This) ) + +#define IDeckLinkOutput_v7_1_EndAudioPreroll(This) \ + ( (This)->lpVtbl -> EndAudioPreroll(This) ) + +#define IDeckLinkOutput_v7_1_ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) \ + ( (This)->lpVtbl -> ScheduleAudioSamples(This,buffer,sampleFrameCount,streamTime,timeScale,sampleFramesWritten) ) + +#define IDeckLinkOutput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) \ + ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) + +#define IDeckLinkOutput_v7_1_FlushBufferedAudioSamples(This) \ + ( (This)->lpVtbl -> FlushBufferedAudioSamples(This) ) + +#define IDeckLinkOutput_v7_1_SetAudioCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetAudioCallback(This,theCallback) ) + +#define IDeckLinkOutput_v7_1_StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) \ + ( (This)->lpVtbl -> StartScheduledPlayback(This,playbackStartTime,timeScale,playbackSpeed) ) + +#define IDeckLinkOutput_v7_1_StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) \ + ( (This)->lpVtbl -> StopScheduledPlayback(This,stopPlaybackAtTime,actualStopTime,timeScale) ) + +#define IDeckLinkOutput_v7_1_GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) \ + ( (This)->lpVtbl -> GetHardwareReferenceClock(This,desiredTimeScale,elapsedTimeSinceSchedulerBegan) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkOutput_v7_1_INTERFACE_DEFINED__ */ + + +#ifndef __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ +#define __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ + +/* interface IDeckLinkInput_v7_1 */ +/* [helpstring][uuid][object] */ + + +EXTERN_C const IID IID_IDeckLinkInput_v7_1; + +#if defined(__cplusplus) && !defined(CINTERFACE) + + MIDL_INTERFACE("2B54EDEF-5B32-429F-BA11-BB990596EACD") + IDeckLinkInput_v7_1 : public IUnknown + { + public: + virtual HRESULT STDMETHODCALLTYPE DoesSupportVideoMode( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetDisplayModeIterator( + /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableVideoInput( + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + BMDVideoInputFlags flags) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableVideoInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE EnableAudioInput( + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE DisableAudioInput( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE ReadAudioSamples( + void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesRead, + /* [out] */ BMDTimeValue *audioPacketTime, + BMDTimeScale timeScale) = 0; + + virtual HRESULT STDMETHODCALLTYPE GetBufferedAudioSampleFrameCount( + /* [out] */ unsigned int *bufferedSampleCount) = 0; + + virtual HRESULT STDMETHODCALLTYPE StartStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE StopStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE PauseStreams( void) = 0; + + virtual HRESULT STDMETHODCALLTYPE SetCallback( + /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback) = 0; + + }; + + +#else /* C style interface */ + + typedef struct IDeckLinkInput_v7_1Vtbl + { + BEGIN_INTERFACE + + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + IDeckLinkInput_v7_1 * This, + /* [in] */ REFIID riid, + /* [annotation][iid_is][out] */ + _COM_Outptr_ void **ppvObject); + + ULONG ( STDMETHODCALLTYPE *AddRef )( + IDeckLinkInput_v7_1 * This); + + ULONG ( STDMETHODCALLTYPE *Release )( + IDeckLinkInput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *DoesSupportVideoMode )( + IDeckLinkInput_v7_1 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + /* [out] */ BMDDisplayModeSupport *result); + + HRESULT ( STDMETHODCALLTYPE *GetDisplayModeIterator )( + IDeckLinkInput_v7_1 * This, + /* [out] */ IDeckLinkDisplayModeIterator_v7_1 **iterator); + + HRESULT ( STDMETHODCALLTYPE *EnableVideoInput )( + IDeckLinkInput_v7_1 * This, + BMDDisplayMode displayMode, + BMDPixelFormat pixelFormat, + BMDVideoInputFlags flags); + + HRESULT ( STDMETHODCALLTYPE *DisableVideoInput )( + IDeckLinkInput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *EnableAudioInput )( + IDeckLinkInput_v7_1 * This, + BMDAudioSampleRate sampleRate, + BMDAudioSampleType sampleType, + unsigned int channelCount); + + HRESULT ( STDMETHODCALLTYPE *DisableAudioInput )( + IDeckLinkInput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *ReadAudioSamples )( + IDeckLinkInput_v7_1 * This, + void *buffer, + unsigned int sampleFrameCount, + /* [out] */ unsigned int *sampleFramesRead, + /* [out] */ BMDTimeValue *audioPacketTime, + BMDTimeScale timeScale); + + HRESULT ( STDMETHODCALLTYPE *GetBufferedAudioSampleFrameCount )( + IDeckLinkInput_v7_1 * This, + /* [out] */ unsigned int *bufferedSampleCount); + + HRESULT ( STDMETHODCALLTYPE *StartStreams )( + IDeckLinkInput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *StopStreams )( + IDeckLinkInput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *PauseStreams )( + IDeckLinkInput_v7_1 * This); + + HRESULT ( STDMETHODCALLTYPE *SetCallback )( + IDeckLinkInput_v7_1 * This, + /* [in] */ IDeckLinkInputCallback_v7_1 *theCallback); + + END_INTERFACE + } IDeckLinkInput_v7_1Vtbl; + + interface IDeckLinkInput_v7_1 + { + CONST_VTBL struct IDeckLinkInput_v7_1Vtbl *lpVtbl; + }; + + + +#ifdef COBJMACROS + + +#define IDeckLinkInput_v7_1_QueryInterface(This,riid,ppvObject) \ + ( (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) ) + +#define IDeckLinkInput_v7_1_AddRef(This) \ + ( (This)->lpVtbl -> AddRef(This) ) + +#define IDeckLinkInput_v7_1_Release(This) \ + ( (This)->lpVtbl -> Release(This) ) + + +#define IDeckLinkInput_v7_1_DoesSupportVideoMode(This,displayMode,pixelFormat,result) \ + ( (This)->lpVtbl -> DoesSupportVideoMode(This,displayMode,pixelFormat,result) ) + +#define IDeckLinkInput_v7_1_GetDisplayModeIterator(This,iterator) \ + ( (This)->lpVtbl -> GetDisplayModeIterator(This,iterator) ) + +#define IDeckLinkInput_v7_1_EnableVideoInput(This,displayMode,pixelFormat,flags) \ + ( (This)->lpVtbl -> EnableVideoInput(This,displayMode,pixelFormat,flags) ) + +#define IDeckLinkInput_v7_1_DisableVideoInput(This) \ + ( (This)->lpVtbl -> DisableVideoInput(This) ) + +#define IDeckLinkInput_v7_1_EnableAudioInput(This,sampleRate,sampleType,channelCount) \ + ( (This)->lpVtbl -> EnableAudioInput(This,sampleRate,sampleType,channelCount) ) + +#define IDeckLinkInput_v7_1_DisableAudioInput(This) \ + ( (This)->lpVtbl -> DisableAudioInput(This) ) + +#define IDeckLinkInput_v7_1_ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale) \ + ( (This)->lpVtbl -> ReadAudioSamples(This,buffer,sampleFrameCount,sampleFramesRead,audioPacketTime,timeScale) ) + +#define IDeckLinkInput_v7_1_GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) \ + ( (This)->lpVtbl -> GetBufferedAudioSampleFrameCount(This,bufferedSampleCount) ) + +#define IDeckLinkInput_v7_1_StartStreams(This) \ + ( (This)->lpVtbl -> StartStreams(This) ) + +#define IDeckLinkInput_v7_1_StopStreams(This) \ + ( (This)->lpVtbl -> StopStreams(This) ) + +#define IDeckLinkInput_v7_1_PauseStreams(This) \ + ( (This)->lpVtbl -> PauseStreams(This) ) + +#define IDeckLinkInput_v7_1_SetCallback(This,theCallback) \ + ( (This)->lpVtbl -> SetCallback(This,theCallback) ) + +#endif /* COBJMACROS */ + + +#endif /* C style interface */ + + + + +#endif /* __IDeckLinkInput_v7_1_INTERFACE_DEFINED__ */ + +#endif /* __DeckLinkAPI_LIBRARY_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif + + diff --git a/intern/decklink/win/DeckLinkAPI_i.c b/intern/decklink/win/DeckLinkAPI_i.c new file mode 100644 index 00000000000..a13d486aae8 --- /dev/null +++ b/intern/decklink/win/DeckLinkAPI_i.c @@ -0,0 +1,343 @@ + + +/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */ + +/* link this file in with the server and any clients */ + + + /* File created by MIDL compiler version 8.00.0603 */ +/* at Mon Apr 13 20:57:05 2015 + */ +/* Compiler settings for ..\..\include\DeckLinkAPI.idl: + Oicf, W1, Zp8, env=Win64 (32b run), target_arch=AMD64 8.00.0603 + protocol : dce , ms_ext, c_ext, robust + error checks: allocation ref bounds_check enum stub_data + VC __declspec() decoration level: + __declspec(uuid()), __declspec(selectany), __declspec(novtable) + DECLSPEC_UUID(), MIDL_INTERFACE() +*/ +/* @@MIDL_FILE_HEADING( ) */ + +#pragma warning( disable: 4049 ) /* more than 64k source lines */ + + +#ifdef __cplusplus +extern "C"{ +#endif + + +#include <rpc.h> +#include <rpcndr.h> + +#ifdef _MIDL_USE_GUIDDEF_ + +#ifndef INITGUID +#define INITGUID +#include <guiddef.h> +#undef INITGUID +#else +#include <guiddef.h> +#endif + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) + +#else // !_MIDL_USE_GUIDDEF_ + +#ifndef __IID_DEFINED__ +#define __IID_DEFINED__ + +typedef struct _IID +{ + unsigned long x; + unsigned short s1; + unsigned short s2; + unsigned char c[8]; +} IID; + +#endif // __IID_DEFINED__ + +#ifndef CLSID_DEFINED +#define CLSID_DEFINED +typedef IID CLSID; +#endif // CLSID_DEFINED + +#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \ + const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} + +#endif !_MIDL_USE_GUIDDEF_ + +MIDL_DEFINE_GUID(IID, LIBID_DeckLinkAPI,0xD864517A,0xEDD5,0x466D,0x86,0x7D,0xC8,0x19,0xF1,0xC0,0x52,0xBB); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkTimecode,0xBC6CFBD3,0x8317,0x4325,0xAC,0x1C,0x12,0x16,0x39,0x1E,0x93,0x40); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator,0x9C88499F,0xF601,0x4021,0xB8,0x0B,0x03,0x2E,0x4E,0xB4,0x1C,0x35); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode,0x3EB2C1AB,0x0A3D,0x4523,0xA3,0xAD,0xF4,0x0D,0x7F,0xB1,0x4E,0x78); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLink,0xC418FBDD,0x0587,0x48ED,0x8F,0xE5,0x64,0x0F,0x0A,0x14,0xAF,0x91); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration,0x1E69FCF6,0x4203,0x4936,0x80,0x76,0x2A,0x9F,0x4C,0xFD,0x50,0xCB); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControlStatusCallback,0x53436FFB,0xB434,0x4906,0xBA,0xDC,0xAE,0x30,0x60,0xFF,0xE8,0xEF); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControl,0x8E1C3ACE,0x19C7,0x4E00,0x8B,0x92,0xD8,0x04,0x31,0xD9,0x58,0xBE); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDeviceNotificationCallback,0xF9531D64,0x3305,0x4B29,0xA3,0x87,0x7F,0x74,0xBB,0x0D,0x0E,0x84); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264InputCallback,0x823C475F,0x55AE,0x46F9,0x89,0x0C,0x53,0x7C,0xC5,0xCE,0xDC,0xCA); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDiscovery,0x2C837444,0xF989,0x4D87,0x90,0x1A,0x47,0xC8,0xA3,0x6D,0x09,0x6D); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingVideoEncodingMode,0x1AB8035B,0xCD13,0x458D,0xB6,0xDF,0x5E,0x8F,0x7C,0x21,0x41,0xD9); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingMutableVideoEncodingMode,0x19BF7D90,0x1E0A,0x400D,0xB2,0xC6,0xFF,0xC4,0xE7,0x8A,0xD4,0x9D); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingVideoEncodingModePresetIterator,0x7AC731A3,0xC950,0x4AD0,0x80,0x4A,0x83,0x77,0xAA,0x51,0xC6,0xC4); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingDeviceInput,0x24B6B6EC,0x1727,0x44BB,0x98,0x18,0x34,0xFF,0x08,0x6A,0xCF,0x98); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264NALPacket,0xE260E955,0x14BE,0x4395,0x97,0x75,0x9F,0x02,0xCC,0x0A,0x9D,0x89); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingAudioPacket,0xD9EB5902,0x1AD2,0x43F4,0x9E,0x2C,0x3C,0xFA,0x50,0xB5,0xEE,0x19); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingMPEG2TSPacket,0x91810D1C,0x4FB3,0x4AAA,0xAE,0x56,0xFA,0x30,0x1D,0x3D,0xFA,0x4C); + + +MIDL_DEFINE_GUID(IID, IID_IBMDStreamingH264NALParser,0x5867F18C,0x5BFA,0x4CCC,0xB2,0xA7,0x9D,0xFD,0x14,0x04,0x17,0xD2); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingDiscovery,0x0CAA31F6,0x8A26,0x40B0,0x86,0xA4,0xBF,0x58,0xDC,0xCA,0x71,0x0C); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CBMDStreamingH264NALParser,0x7753EFBD,0x951C,0x407C,0x97,0xA5,0x23,0xC7,0x37,0xB7,0x3B,0x52); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback,0x20AA5225,0x1958,0x47CB,0x82,0x0B,0x80,0xA8,0xD5,0x21,0xA6,0xEE); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback,0xDD04E5EC,0x7415,0x42AB,0xAE,0x4A,0xE8,0x0C,0x4D,0xFC,0x04,0x4A); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkMemoryAllocator,0xB36EB6E7,0x9D29,0x4AA8,0x92,0xEF,0x84,0x3B,0x87,0xA2,0x89,0xE8); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioOutputCallback,0x403C681B,0x7F46,0x4A12,0xB9,0x93,0x2B,0xB1,0x27,0x08,0x4E,0xE6); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkIterator,0x50FB36CD,0x3063,0x4B73,0xBD,0xBB,0x95,0x80,0x87,0xF2,0xD8,0xBA); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkAPIInformation,0x7BEA3C68,0x730D,0x4322,0xAF,0x34,0x8A,0x71,0x52,0xB5,0x32,0xA4); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput,0xCC5C8A6E,0x3F2F,0x4B3A,0x87,0xEA,0xFD,0x78,0xAF,0x30,0x05,0x64); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput,0xAF22762B,0xDFAC,0x4846,0xAA,0x79,0xFA,0x88,0x83,0x56,0x09,0x95); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame,0x3F716FE0,0xF023,0x4111,0xBE,0x5D,0xEF,0x44,0x14,0xC0,0x5B,0x17); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame,0x69E2639F,0x40DA,0x4E19,0xB6,0xF2,0x20,0xAC,0xE8,0x15,0xC3,0x90); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame3DExtensions,0xDA0F7E4A,0xEDC7,0x48A8,0x9C,0xDD,0x2D,0xB5,0x1C,0x72,0x9C,0xD7); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame,0x05CFE374,0x537C,0x4094,0x9A,0x57,0x68,0x05,0x25,0x11,0x8F,0x44); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrameAncillary,0x732E723C,0xD1A4,0x4E29,0x9E,0x8E,0x4A,0x88,0x79,0x7A,0x00,0x04); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioInputPacket,0xE43D5870,0x2894,0x11DE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback,0xB1D3F49A,0x85FE,0x4C5D,0x95,0xC8,0x0B,0x5D,0x5D,0xCC,0xD4,0x38); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper,0x504E2209,0xCAC7,0x4C1A,0x9F,0xB4,0xC5,0xBB,0x62,0x74,0xD2,0x2F); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDX9ScreenPreviewHelper,0x2094B522,0xD1A1,0x40C0,0x9A,0xC7,0x1C,0x01,0x22,0x18,0xEF,0x02); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotificationCallback,0xb002a1ec,0x070d,0x4288,0x82,0x89,0xbd,0x5d,0x36,0xe5,0xff,0x0d); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkNotification,0x0a1fb207,0xe215,0x441b,0x9b,0x19,0x6f,0xa1,0x57,0x59,0x46,0xc5); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkAttributes,0xABC11843,0xD966,0x44CB,0x96,0xE2,0xA1,0xCB,0x5D,0x31,0x35,0xC4); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkKeyer,0x89AFCAF5,0x65F8,0x421E,0x98,0xF7,0x96,0xFE,0x5F,0x5B,0xFB,0xA3); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion,0x3BBCB8A2,0xDA2C,0x42D9,0xB5,0xD8,0x88,0x08,0x36,0x44,0xE9,0x9A); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeviceNotificationCallback,0x4997053B,0x0ADF,0x4CC8,0xAC,0x70,0x7A,0x50,0xC4,0xBE,0x72,0x8F); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDiscovery,0xCDBF631C,0xBC76,0x45FA,0xB4,0x4D,0xC5,0x50,0x59,0xBC,0x61,0x01); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator,0x1F2E109A,0x8F4F,0x49E4,0x92,0x03,0x13,0x55,0x95,0xCB,0x6F,0xA5); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkAPIInformation,0x263CA19F,0xED09,0x482E,0x9F,0x9D,0x84,0x00,0x57,0x83,0xA2,0x37); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper,0xF63E77C7,0xB655,0x4A4A,0x9A,0xD0,0x3C,0xA8,0x5D,0x39,0x43,0x43); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDX9ScreenPreviewHelper,0xCC010023,0xE01D,0x4525,0x9D,0x59,0x80,0xC8,0xAB,0x3D,0xC7,0xA0); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion,0x7DBBBB11,0x5B7B,0x467D,0xAE,0xA4,0xCE,0xA4,0x68,0xFD,0x36,0x8C); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkDiscovery,0x1073A05C,0xD885,0x47E9,0xB3,0xC6,0x12,0x9B,0x3F,0x9F,0x64,0x8B); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v10_2,0xC679A35B,0x610C,0x4D09,0xB7,0x48,0x1D,0x04,0x78,0x10,0x0F,0xC0); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v9_9,0xA3EF0963,0x0862,0x44ED,0x92,0xA9,0xEE,0x89,0xAB,0xF4,0x31,0xC7); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v9_2,0x6D40EF78,0x28B9,0x4E21,0x99,0x0D,0x95,0xBB,0x77,0x50,0xA0,0x4F); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControlStatusCallback_v8_1,0xE5F693C1,0x4283,0x4716,0xB1,0x8F,0xC1,0x43,0x15,0x21,0x95,0x5B); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControl_v8_1,0x522A9E39,0x0F3C,0x4742,0x94,0xEE,0xD8,0x0D,0xE3,0x35,0xDA,0x1D); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLink_v8_0,0x62BFF75D,0x6569,0x4E55,0x8D,0x4D,0x66,0xAA,0x03,0x82,0x9A,0xBC); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkIterator_v8_0,0x74E936FC,0xCC28,0x4A67,0x81,0xA0,0x1E,0x94,0xE5,0x2D,0x4E,0x69); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkIterator_v8_0,0xD9EDA3B3,0x2887,0x41FA,0xB7,0x24,0x01,0x7C,0xF1,0xEB,0x1D,0x37); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDeckControl_v7_9,0xA4D81043,0x0619,0x42B7,0x8E,0xD6,0x60,0x2D,0x29,0x04,0x1D,0xF7); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator_v7_6,0x455D741F,0x1779,0x4800,0x86,0xF5,0x0B,0x5D,0x13,0xD7,0x97,0x51); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode_v7_6,0x87451E84,0x2B7E,0x439E,0xA6,0x29,0x43,0x93,0xEA,0x4A,0x85,0x50); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v7_6,0x29228142,0xEB8C,0x4141,0xA6,0x21,0xF7,0x40,0x26,0x45,0x09,0x55); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v7_6,0x300C135A,0x9F43,0x48E2,0x99,0x06,0x6D,0x79,0x11,0xD9,0x3C,0xF1); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkTimecode_v7_6,0xEFB9BCA6,0xA521,0x44F7,0xBD,0x69,0x23,0x32,0xF2,0x4D,0x9E,0xE6); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame_v7_6,0xA8D8238E,0x6B18,0x4196,0x99,0xE1,0x5A,0xF7,0x17,0xB8,0x3D,0x32); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkMutableVideoFrame_v7_6,0x46FCEE00,0xB4E6,0x43D0,0x91,0xC0,0x02,0x3A,0x7F,0xCE,0xB3,0x4F); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v7_6,0x9A74FA41,0xAE9F,0x47AC,0x8C,0xF4,0x01,0xF4,0x2D,0xD5,0x99,0x65); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkScreenPreviewCallback_v7_6,0x373F499D,0x4B4D,0x4518,0xAD,0x22,0x63,0x54,0xE5,0xA5,0x82,0x5E); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkGLScreenPreviewHelper_v7_6,0xBA575CD9,0xA15E,0x497B,0xB2,0xC2,0xF9,0xAF,0xE7,0xBE,0x4E,0xBA); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoConversion_v7_6,0x3EB504C9,0xF97D,0x40FE,0xA1,0x58,0xD4,0x07,0xD4,0x8C,0xB5,0x3B); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkConfiguration_v7_6,0xB8EAD569,0xB764,0x47F0,0xA7,0x3F,0xAE,0x40,0xDF,0x6C,0xBF,0x10); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback_v7_6,0xE763A626,0x4A3C,0x49D1,0xBF,0x13,0xE7,0xAD,0x36,0x92,0xAE,0x52); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v7_6,0x31D28EE7,0x88B6,0x4CB1,0x89,0x7A,0xCD,0xBF,0x79,0xA2,0x64,0x14); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkGLScreenPreviewHelper_v7_6,0xD398CEE7,0x4434,0x4CA3,0x9B,0xA6,0x5A,0xE3,0x45,0x56,0xB9,0x05); + + +MIDL_DEFINE_GUID(CLSID, CLSID_CDeckLinkVideoConversion_v7_6,0xFFA84F77,0x73BE,0x4FB7,0xB0,0x3E,0xB5,0xE4,0x4B,0x9F,0x75,0x9B); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v7_3,0xFD6F311D,0x4D00,0x444B,0x9E,0xD4,0x1F,0x25,0xB5,0x73,0x0A,0xD0); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v7_3,0x271C65E3,0xC323,0x4344,0xA3,0x0F,0xD9,0x08,0xBC,0xB2,0x0A,0xA3); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v7_3,0x4973F012,0x9925,0x458C,0x87,0x1C,0x18,0x77,0x4C,0xDB,0xBE,0xCB); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v7_3,0xCF317790,0x2894,0x11DE,0x8C,0x30,0x08,0x00,0x20,0x0C,0x9A,0x66); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayModeIterator_v7_1,0xB28131B6,0x59AC,0x4857,0xB5,0xAC,0xCD,0x75,0xD5,0x88,0x3E,0x2F); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkDisplayMode_v7_1,0xAF0CD6D5,0x8376,0x435E,0x84,0x33,0x54,0xF9,0xDD,0x53,0x0A,0xC3); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoFrame_v7_1,0x333F3A10,0x8C2D,0x43CF,0xB7,0x9D,0x46,0x56,0x0F,0xEE,0xA1,0xCE); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoInputFrame_v7_1,0xC8B41D95,0x8848,0x40EE,0x9B,0x37,0x6E,0x34,0x17,0xFB,0x11,0x4B); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkAudioInputPacket_v7_1,0xC86DE4F6,0xA29F,0x42E3,0xAB,0x3A,0x13,0x63,0xE2,0x9F,0x07,0x88); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkVideoOutputCallback_v7_1,0xEBD01AFA,0xE4B0,0x49C6,0xA0,0x1D,0xED,0xB9,0xD1,0xB5,0x5F,0xD9); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInputCallback_v7_1,0x7F94F328,0x5ED4,0x4E9F,0x97,0x29,0x76,0xA8,0x6B,0xDC,0x99,0xCC); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkOutput_v7_1,0xAE5B3E9B,0x4E1E,0x4535,0xB6,0xE8,0x48,0x0F,0xF5,0x2F,0x6C,0xE5); + + +MIDL_DEFINE_GUID(IID, IID_IDeckLinkInput_v7_1,0x2B54EDEF,0x5B32,0x429F,0xBA,0x11,0xBB,0x99,0x05,0x96,0xEA,0xCD); + +#undef MIDL_DEFINE_GUID + +#ifdef __cplusplus +} +#endif + + + diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt index d31e9472168..e549a48d4b9 100644 --- a/intern/ghost/CMakeLists.txt +++ b/intern/ghost/CMakeLists.txt @@ -223,6 +223,10 @@ elseif(WITH_X11) ) endif() + if(WITH_X11_ALPHA) + add_definitions(-DWITH_X11_ALPHA) + endif() + if(WITH_INPUT_NDOF) list(APPEND SRC intern/GHOST_NDOFManagerUnix.cpp diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 4c48473c7b8..08045b93db9 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -277,7 +277,7 @@ public: */ virtual GHOST_TSuccess beginFullScreen( const GHOST_DisplaySetting& setting, GHOST_IWindow **window, - const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0) = 0; + const bool stereoVisual, const bool alphaBackground = 0, const GHOST_TUns16 numOfAASamples = 0) = 0; /** * Updates the resolution while in fullscreen mode. diff --git a/intern/ghost/GHOST_Types.h b/intern/ghost/GHOST_Types.h index b3e560ab4b4..7e77ba3a41f 100644 --- a/intern/ghost/GHOST_Types.h +++ b/intern/ghost/GHOST_Types.h @@ -57,7 +57,8 @@ typedef struct { typedef enum { GHOST_glStereoVisual = (1 << 0), - GHOST_glDebugContext = (1 << 1) + GHOST_glDebugContext = (1 << 1), + GHOST_glAlphaBackground = (1 << 2), } GHOST_GLFlags; diff --git a/intern/ghost/intern/GHOST_ContextGLX.cpp b/intern/ghost/intern/GHOST_ContextGLX.cpp index 90d810b7986..d4f67da1242 100644 --- a/intern/ghost/intern/GHOST_ContextGLX.cpp +++ b/intern/ghost/intern/GHOST_ContextGLX.cpp @@ -62,6 +62,7 @@ GHOST_ContextGLX::GHOST_ContextGLX( Window window, Display *display, XVisualInfo *visualInfo, + GLXFBConfig fbconfig, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, @@ -70,6 +71,7 @@ GHOST_ContextGLX::GHOST_ContextGLX( : GHOST_Context(stereoVisual, numOfAASamples), m_display(display), m_visualInfo(visualInfo), + m_fbconfig(fbconfig), m_window(window), m_contextProfileMask(contextProfileMask), m_contextMajorVersion(contextMajorVersion), @@ -285,19 +287,24 @@ const bool GLXEW_ARB_create_context_robustness = attribs[i++] = 0; /* Create a GL 3.x context */ - GLXFBConfig *framebuffer_config = NULL; - { - int glx_attribs[64]; - int fbcount = 0; + if (m_fbconfig) { + m_context = glXCreateContextAttribsARB(m_display, m_fbconfig, s_sharedContext, true, attribs); + } + else { + GLXFBConfig *framebuffer_config = NULL; + { + int glx_attribs[64]; + int fbcount = 0; - GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_numOfAASamples, m_stereoVisual, true); + GHOST_X11_GL_GetAttributes(glx_attribs, 64, m_numOfAASamples, m_stereoVisual, false, true); - framebuffer_config = glXChooseFBConfig(m_display, DefaultScreen(m_display), glx_attribs, &fbcount); - } + framebuffer_config = glXChooseFBConfig(m_display, DefaultScreen(m_display), glx_attribs, &fbcount); + } - if (framebuffer_config) { - m_context = glXCreateContextAttribsARB(m_display, framebuffer_config[0], s_sharedContext, True, attribs); - XFree(framebuffer_config); + if (framebuffer_config) { + m_context = glXCreateContextAttribsARB(m_display, framebuffer_config[0], s_sharedContext, True, attribs); + XFree(framebuffer_config); + } } } else { @@ -401,16 +408,11 @@ GHOST_TSuccess GHOST_ContextGLX::getSwapInterval(int &intervalOut) int GHOST_X11_GL_GetAttributes( int *attribs, int attribs_max, int samples, bool is_stereo_visual, + bool need_alpha, bool for_fb_config) { int i = 0; -#ifdef GHOST_OPENGL_ALPHA - const bool need_alpha = true; -#else - const bool need_alpha = false; -#endif - #ifdef GHOST_OPENGL_STENCIL const bool need_stencil = true; #else diff --git a/intern/ghost/intern/GHOST_ContextGLX.h b/intern/ghost/intern/GHOST_ContextGLX.h index 8c2231a0b01..f0f010d1942 100644 --- a/intern/ghost/intern/GHOST_ContextGLX.h +++ b/intern/ghost/intern/GHOST_ContextGLX.h @@ -66,6 +66,7 @@ public: Window window, Display *display, XVisualInfo *visualInfo, + GLXFBConfig fbconfig, int contextProfileMask, int contextMajorVersion, int contextMinorVersion, @@ -128,6 +129,7 @@ private: Display *m_display; XVisualInfo *m_visualInfo; + GLXFBConfig m_fbconfig; Window m_window; const int m_contextProfileMask; @@ -151,6 +153,7 @@ private: int GHOST_X11_GL_GetAttributes( int *attribs, int attribs_max, int samples, bool is_stereo_visual, + bool need_alpha, bool for_fb_config); #endif // __GHOST_CONTEXTGLX_H__ diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp index cb580f60bd7..eeb6a2469ee 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.cpp +++ b/intern/ghost/intern/GHOST_ContextWGL.cpp @@ -63,6 +63,7 @@ static bool is_crappy_intel_card() GHOST_ContextWGL::GHOST_ContextWGL( bool stereoVisual, + bool alphaBackground, GHOST_TUns16 numOfAASamples, HWND hWnd, HDC hDC, @@ -78,6 +79,7 @@ GHOST_ContextWGL::GHOST_ContextWGL( m_contextMajorVersion(contextMajorVersion), m_contextMinorVersion(contextMinorVersion), m_contextFlags(contextFlags), + m_alphaBackground(alphaBackground), m_contextResetNotificationStrategy(contextResetNotificationStrategy), m_hGLRC(NULL) #ifdef WITH_GLEW_MX @@ -168,7 +170,7 @@ GHOST_TSuccess GHOST_ContextWGL::activateDrawingContext() /* Ron Fosner's code for weighting pixel formats and forcing software. * See http://www.opengl.org/resources/faq/technical/weight.cpp */ -static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd) +static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR &preferredPFD) { int weight = 0; @@ -194,11 +196,12 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd) weight += pfd.cColorBits - 8; -#ifdef GHOST_OPENGL_ALPHA - if (pfd.cAlphaBits > 0) + if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0) + weight++; +#ifdef WIN32_COMPOSITING + if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION)) weight++; #endif - #ifdef GHOST_OPENGL_STENCIL if (pfd.cStencilBits >= 8) weight++; @@ -239,7 +242,7 @@ static int choose_pixel_format_legacy(HDC hDC, PIXELFORMATDESCRIPTOR &preferredP WIN32_CHK(check == lastPFD); - int w = weight_pixel_format(pfd); + int w = weight_pixel_format(pfd, preferredPFD); if (w > weight) { weight = w; @@ -496,7 +499,10 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2( { std::vector<int> iAttributes; +#define _MAX_PIXEL_FORMATS 32 + int iPixelFormat = 0; + int iPixelFormats[_MAX_PIXEL_FORMATS]; int samples; @@ -521,8 +527,31 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2( sRGB); UINT nNumFormats; - WIN32_CHK(wglChoosePixelFormatARB(m_hDC, &(iAttributes[0]), NULL, 1, &iPixelFormat, &nNumFormats)); - + WIN32_CHK(wglChoosePixelFormatARB(m_hDC, &(iAttributes[0]), NULL, _MAX_PIXEL_FORMATS, iPixelFormats, &nNumFormats)); + +#ifdef WIN32_COMPOSITING + if (needAlpha && nNumFormats) { + // scan through all pixel format to make sure one supports compositing + PIXELFORMATDESCRIPTOR pfd; + int i; + + for (i = 0; i < nNumFormats; i++) { + if (DescribePixelFormat(m_hDC, iPixelFormats[i], sizeof(PIXELFORMATDESCRIPTOR), &pfd)) { + if (pfd.dwFlags & PFD_SUPPORT_COMPOSITION) { + iPixelFormat = iPixelFormats[i]; + break; + } + } + } + if (i == nNumFormats) { + fprintf(stderr, + "Warning! Unable to find a pixel format with compositing capability.\n"); + iPixelFormat = iPixelFormats[0]; + } + } + else +#endif + iPixelFormat = iPixelFormats[0]; /* total number of formats that match (regardless of size of iPixelFormat array) * see: WGL_ARB_pixel_format extension spec */ if (nNumFormats > 0) @@ -538,7 +567,7 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2( // check how many samples were actually gotten if (iPixelFormat != 0) { int iQuery[] = { WGL_SAMPLES_ARB }; - int actualSamples; + int actualSamples, alphaBits; wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &actualSamples); if (actualSamples != *numOfAASamples) { @@ -549,6 +578,14 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_2( *numOfAASamples = actualSamples; // set context property to actual value } + if (needAlpha) { + iQuery[0] = WGL_ALPHA_BITS_ARB; + wglGetPixelFormatAttribivARB(m_hDC, iPixelFormat, 0, 1, iQuery, &alphaBits); + if (alphaBits == 0) { + fprintf(stderr, + "Warning! Unable to find a frame buffer with alpha channel.\n"); + } + } } else { *numOfAASamples = 0; @@ -674,9 +711,15 @@ int GHOST_ContextWGL::choose_pixel_format( PFD_DRAW_TO_WINDOW | PFD_SWAP_COPY | /* support swap copy */ PFD_DOUBLEBUFFER | /* support double-buffering */ - (stereoVisual ? PFD_STEREO : 0), /* support stereo */ + (stereoVisual ? PFD_STEREO : 0) |/* support stereo */ + ( +#ifdef WIN32_COMPOSITING + needAlpha ? PFD_SUPPORT_COMPOSITION : /* support composition for transparent background */ +#endif + 0 + ), PFD_TYPE_RGBA, /* color type */ - 24, /* preferred color depth */ + (needAlpha ? 32 : 24), /* preferred color depth */ 0, 0, 0, 0, 0, 0, /* color bits (ignored) */ needAlpha ? 8 : 0, /* alpha buffer */ 0, /* alpha shift (ignored) */ @@ -727,11 +770,7 @@ static void reportContextString(const char *name, const char *dummy, const char GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext() { -#ifdef GHOST_OPENGL_ALPHA - const bool needAlpha = true; -#else - const bool needAlpha = false; -#endif + const bool needAlpha = m_alphaBackground; #ifdef GHOST_OPENGL_STENCIL const bool needStencil = true; diff --git a/intern/ghost/intern/GHOST_ContextWGL.h b/intern/ghost/intern/GHOST_ContextWGL.h index 3b04a33b662..580b4dcb82f 100644 --- a/intern/ghost/intern/GHOST_ContextWGL.h +++ b/intern/ghost/intern/GHOST_ContextWGL.h @@ -32,6 +32,8 @@ #ifndef __GHOST_CONTEXTWGL_H__ #define __GHOST_CONTEXTWGL_H__ +//#define WIN32_COMPOSITING + #include "GHOST_Context.h" #ifdef WITH_GLEW_MX @@ -65,6 +67,7 @@ public: */ GHOST_ContextWGL( bool stereoVisual, + bool alphaBackground, GHOST_TUns16 numOfAASamples, HWND hWnd, HDC hDC, @@ -164,6 +167,7 @@ private: const int m_contextMajorVersion; const int m_contextMinorVersion; const int m_contextFlags; + const bool m_alphaBackground; const int m_contextResetNotificationStrategy; HGLRC m_hGLRC; diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp index 96ff79aa65a..cbf37bf1b16 100644 --- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp +++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp @@ -125,8 +125,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragEnter(IDataObject *pDataObject, DWO */ HRESULT __stdcall GHOST_DropTargetWin32::DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) { - if (m_window->canAcceptDragOperation()) - { + if (m_window->canAcceptDragOperation()) { *pdwEffect = allowedDropEffect(*pdwEffect); } else { @@ -154,8 +153,7 @@ HRESULT __stdcall GHOST_DropTargetWin32::DragLeave(void) HRESULT __stdcall GHOST_DropTargetWin32::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) { void *data = getGhostData(pDataObject); - if (m_window->canAcceptDragOperation()) - { + if (m_window->canAcceptDragOperation()) { *pdwEffect = allowedDropEffect(*pdwEffect); } @@ -189,15 +187,13 @@ GHOST_TDragnDropTypes GHOST_DropTargetWin32::getGhostType(IDataObject *pDataObje * conversion, but we do the conversion ourself with WC_NO_BEST_FIT_CHARS. */ FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; - if (pDataObject->QueryGetData(&fmtetc) == S_OK) - { + if (pDataObject->QueryGetData(&fmtetc) == S_OK) { return GHOST_kDragnDropTypeString; } // Filesnames fmtetc.cfFormat = CF_HDROP; - if (pDataObject->QueryGetData(&fmtetc) == S_OK) - { + if (pDataObject->QueryGetData(&fmtetc) == S_OK) { return GHOST_kDragnDropTypeFilenames; } diff --git a/intern/ghost/intern/GHOST_EventManager.cpp b/intern/ghost/intern/GHOST_EventManager.cpp index bc531bd515b..0675ac734ed 100644 --- a/intern/ghost/intern/GHOST_EventManager.cpp +++ b/intern/ghost/intern/GHOST_EventManager.cpp @@ -167,11 +167,9 @@ void GHOST_EventManager::removeWindowEvents(GHOST_IWindow *window) { TEventStack::iterator iter; iter = m_events.begin(); - while (iter != m_events.end()) - { + while (iter != m_events.end()) { GHOST_IEvent *event = *iter; - if (event->getWindow() == window) - { + if (event->getWindow() == window) { GHOST_PRINT("GHOST_EventManager::removeWindowEvents(): removing event\n"); /* * Found an event for this window, remove it. @@ -191,11 +189,9 @@ void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow * { TEventStack::iterator iter; iter = m_events.begin(); - while (iter != m_events.end()) - { + while (iter != m_events.end()) { GHOST_IEvent *event = *iter; - if ((event->getType() == type) && (!window || (event->getWindow() == window))) - { + if ((event->getType() == type) && (!window || (event->getWindow() == window))) { GHOST_PRINT("GHOST_EventManager::removeTypeEvents(): removing event\n"); /* * Found an event of this type for the window, remove it. diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp index f18b7911f45..c8e14ad357f 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cpp +++ b/intern/ghost/intern/GHOST_NDOFManager.cpp @@ -378,8 +378,7 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64 NDOF_ButtonT button = (button_number < m_buttonCount) ? m_hidMap[button_number] : NDOF_BUTTON_NONE; - switch (button) - { + switch (button) { case NDOF_BUTTON_NONE: #ifdef DEBUG_NDOF_BUTTONS printf("discarded\n"); diff --git a/intern/ghost/intern/GHOST_System.cpp b/intern/ghost/intern/GHOST_System.cpp index 639ce451d23..c53580818e6 100644 --- a/intern/ghost/intern/GHOST_System.cpp +++ b/intern/ghost/intern/GHOST_System.cpp @@ -140,7 +140,7 @@ bool GHOST_System::validWindow(GHOST_IWindow *window) GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window, - const bool stereoVisual, const GHOST_TUns16 numOfAASamples) + const bool stereoVisual, const bool alphaBackground, const GHOST_TUns16 numOfAASamples) { GHOST_TSuccess success = GHOST_kFailure; GHOST_ASSERT(m_windowManager, "GHOST_System::beginFullScreen(): invalid window manager"); @@ -152,7 +152,7 @@ GHOST_TSuccess GHOST_System::beginFullScreen(const GHOST_DisplaySetting& setting success = m_displayManager->setCurrentDisplaySetting(GHOST_DisplayManager::kMainDisplay, setting); if (success == GHOST_kSuccess) { //GHOST_PRINT("GHOST_System::beginFullScreen(): creating full-screen window\n"); - success = createFullScreenWindow((GHOST_Window **)window, setting, stereoVisual, numOfAASamples); + success = createFullScreenWindow((GHOST_Window **)window, setting, stereoVisual, alphaBackground, numOfAASamples); if (success == GHOST_kSuccess) { m_windowManager->beginFullScreen(*window, stereoVisual); } @@ -349,12 +349,14 @@ GHOST_TSuccess GHOST_System::exit() } GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings, - const bool stereoVisual, const GHOST_TUns16 numOfAASamples) + const bool stereoVisual, const bool alphaBackground, const GHOST_TUns16 numOfAASamples) { GHOST_GLSettings glSettings = {0}; if (stereoVisual) glSettings.flags |= GHOST_glStereoVisual; + if (alphaBackground) + glSettings.flags |= GHOST_glAlphaBackground; glSettings.numOfAASamples = numOfAASamples; /* note: don't use getCurrentDisplaySetting() because on X11 we may diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index c4951adb4fd..a10259bc9e9 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -144,8 +144,8 @@ public: * \return Indication of success. */ GHOST_TSuccess beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow **window, - const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0); - + const bool stereoVisual, const bool alphaBackground, const GHOST_TUns16 numOfAASamples = 0); + /** * Updates the resolution while in fullscreen mode. * \param setting The new setting of the display. @@ -336,7 +336,7 @@ protected: * \return Indication of success. */ GHOST_TSuccess createFullScreenWindow(GHOST_Window **window, const GHOST_DisplaySetting &settings, - const bool stereoVisual, const GHOST_TUns16 numOfAASamples = 0); + const bool stereoVisual, const bool alphaBackground = 0, const GHOST_TUns16 numOfAASamples = 0); /** The display manager (platform dependent). */ GHOST_DisplayManager *m_displayManager; diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index c9855cfdf7e..bce390732fe 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -830,7 +830,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleWindowEvent(GHOST_TEventType eventType, window->updateDrawingContext(); pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window) ); //Mouse up event is trapped by the resizing event loop, so send it anyway to the window manager - pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonUp, window, convertButton(0))); + pushEvent(new GHOST_EventButton(getMilliSeconds(), GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft)); //m_ignoreWindowSizedMessages = true; } break; @@ -1278,19 +1278,29 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr) switch ([event type]) { case NSLeftMouseDown: + pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskLeft)); + handleTabletEvent(event); //Handle tablet events combined with mouse events + break; case NSRightMouseDown: + pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, GHOST_kButtonMaskRight)); + handleTabletEvent(event); //Handle tablet events combined with mouse events + break; case NSOtherMouseDown: pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonDown, window, convertButton([event buttonNumber]))); - //Handle tablet events combined with mouse events - handleTabletEvent(event); + handleTabletEvent(event); //Handle tablet events combined with mouse events break; case NSLeftMouseUp: + pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft)); + handleTabletEvent(event); //Handle tablet events combined with mouse events + break; case NSRightMouseUp: + pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, GHOST_kButtonMaskRight)); + handleTabletEvent(event); //Handle tablet events combined with mouse events + break; case NSOtherMouseUp: pushEvent(new GHOST_EventButton([event timestamp] * 1000, GHOST_kEventButtonUp, window, convertButton([event buttonNumber]))); - //Handle tablet events combined with mouse events - handleTabletEvent(event); + handleTabletEvent(event); //Handle tablet events combined with mouse events break; case NSLeftMouseDragged: diff --git a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp index 2bd380050f1..7d0ce5158fe 100644 --- a/intern/ghost/intern/GHOST_SystemPathsWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemPathsWin32.cpp @@ -76,8 +76,7 @@ const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *version HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16); - if (hResult == S_OK) - { + if (hResult == S_OK) { conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3); strcat(knownpath, "\\Blender Foundation\\Blender\\"); strcat(knownpath, versionstr); @@ -94,8 +93,7 @@ const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionst HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16); - if (hResult == S_OK) - { + if (hResult == S_OK) { conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3); strcat(knownpath, "\\Blender Foundation\\Blender\\"); strcat(knownpath, versionstr); diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 43fb5dc4205..1ce8002520f 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -241,6 +241,7 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow( state, type, ((glSettings.flags & GHOST_glStereoVisual) != 0), + ((glSettings.flags & GHOST_glAlphaBackground) != 0), glSettings.numOfAASamples, parentWindow, ((glSettings.flags & GHOST_glDebugContext) != 0)); @@ -408,7 +409,11 @@ GHOST_TSuccess GHOST_SystemWin32::init() ::LoadIcon(NULL, IDI_APPLICATION); } wc.hCursor = ::LoadCursor(0, IDC_ARROW); - wc.hbrBackground = 0; + wc.hbrBackground = +#ifdef INW32_COMPISITING + (HBRUSH)CreateSolidBrush +#endif + (0x00000000); wc.lpszMenuName = 0; wc.lpszClassName = L"GHOST_WindowClass"; @@ -1540,8 +1545,7 @@ static bool isStartedFromCommandPrompt() int GHOST_SystemWin32::toggleConsole(int action) { - switch (action) - { + switch (action) { case 3: // startup: hide if not started from command prompt { if (isStartedFromCommandPrompt()) { diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index c9946c13122..aeda95d5d4d 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -310,6 +310,7 @@ createWindow(const STR_String& title, left, top, width, height, state, parentWindow, type, ((glSettings.flags & GHOST_glStereoVisual) != 0), exclusive, + ((glSettings.flags & GHOST_glAlphaBackground) != 0), glSettings.numOfAASamples, (glSettings.flags & GHOST_glDebugContext) != 0); if (window) { @@ -419,8 +420,7 @@ static Bool init_timestamp_scanner(Display *, XEvent *event, XPointer arg) { init_timestamp_data *data = reinterpret_cast<init_timestamp_data *>(arg); - switch (event->type) - { + switch (event->type) { case ButtonPress: case ButtonRelease: data->timestamp = event->xbutton.time; @@ -1963,8 +1963,7 @@ int GHOST_X11_ApplicationIOErrorHandler(Display * /*display*/) static bool match_token(const char *haystack, const char *needle) { const char *p, *q; - for (p = haystack; *p; ) - { + for (p = haystack; *p; ) { while (*p && isspace(*p)) p++; if (!*p) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 81c08f4fc06..c9bcb38ab68 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -43,7 +43,9 @@ #else # include "GHOST_ContextWGL.h" #endif - +#ifdef WIN32_COMPOSITING +#include <Dwmapi.h> +#endif #include <math.h> #include <string.h> @@ -70,7 +72,8 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, GHOST_TUns32 height, GHOST_TWindowState state, GHOST_TDrawingContextType type, - bool wantStereoVisual, + bool wantStereoVisual, + bool alphaBackground, GHOST_TUns16 wantNumOfAASamples, GHOST_TEmbedderWindowID parentwindowhwnd, bool is_debug) @@ -83,6 +86,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, m_hasGrabMouse(false), m_nPressedButtons(0), m_customCursor(0), + m_wantAlphaBackground(alphaBackground), m_wintab(NULL), m_tabletData(NULL), m_tablet(0), @@ -181,17 +185,17 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0); m_hWnd = ::CreateWindowW( - s_windowClassName, // pointer to registered class name - title_16, // pointer to window name - wintype, // window style - left, // horizontal position of window - top, // vertical position of window - width, // window width - height, // window height - (HWND) m_parentWindowHwnd, // handle to parent or owner window - 0, // handle to menu or child-window identifier - ::GetModuleHandle(0), // handle to application instance - 0); // pointer to window-creation data + s_windowClassName, // pointer to registered class name + title_16, // pointer to window name + wintype, // window style + left, // horizontal position of window + top, // vertical position of window + width, // window width + height, // window height + (HWND)m_parentWindowHwnd, // handle to parent or owner window + 0, // handle to menu or child-window identifier + ::GetModuleHandle(0), // handle to application instance + 0); // pointer to window-creation data free(title_16); } else { @@ -243,6 +247,24 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, } ::ShowWindow(m_hWnd, nCmdShow); +#ifdef WIN32_COMPOSITING + if (alphaBackground && parentwindowhwnd == 0) { + + HRESULT hr = S_OK; + + // Create and populate the Blur Behind structure + DWM_BLURBEHIND bb = { 0 }; + + // Enable Blur Behind and apply to the entire client area + bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; + bb.fEnable = true; + bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1); + + // Apply Blur Behind + hr = DwmEnableBlurBehindWindow(m_hWnd, &bb); + DeleteObject(bb.hRgnBlur); + } +#endif // Force an initial paint of the window ::UpdateWindow(m_hWnd); } @@ -622,6 +644,7 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty #if defined(WITH_GL_PROFILE_CORE) GHOST_Context *context = new GHOST_ContextWGL( m_wantStereoVisual, + m_wantAlphaBackground, m_wantNumOfAASamples, m_hWnd, m_hDC, @@ -632,6 +655,7 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty #elif defined(WITH_GL_PROFILE_ES20) GHOST_Context *context = new GHOST_ContextWGL( m_wantStereoVisual, + m_wantAlphaBackground, m_wantNumOfAASamples, m_hWnd, m_hDC, @@ -642,6 +666,7 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty #elif defined(WITH_GL_PROFILE_COMPAT) GHOST_Context *context = new GHOST_ContextWGL( m_wantStereoVisual, + m_wantAlphaBackground, m_wantNumOfAASamples, m_hWnd, m_hDC, diff --git a/intern/ghost/intern/GHOST_WindowWin32.h b/intern/ghost/intern/GHOST_WindowWin32.h index b508c2f37df..a1cf58c9ceb 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.h +++ b/intern/ghost/intern/GHOST_WindowWin32.h @@ -89,6 +89,7 @@ public: GHOST_TWindowState state, GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, bool wantStereoVisual = false, + bool alphaBackground = false, GHOST_TUns16 wantNumOfAASamples = 0, GHOST_TEmbedderWindowID parentWindowHwnd = 0, bool is_debug = false); @@ -328,6 +329,8 @@ private: int m_nPressedButtons; /** HCURSOR structure of the custom cursor */ HCURSOR m_customCursor; + /** request GL context aith alpha channel */ + bool m_wantAlphaBackground; /** ITaskbarList3 structure for progress bar*/ ITaskbarList3 *m_Bar; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index e68e0901dab..a12ecec6371 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -33,7 +33,9 @@ #include <X11/cursorfont.h> #include <X11/Xatom.h> #include <X11/Xutil.h> - +#ifdef WITH_X11_ALPHA +#include <X11/extensions/Xrender.h> +#endif #include "GHOST_WindowX11.h" #include "GHOST_SystemX11.h" #include "STR_String.h" @@ -164,15 +166,21 @@ static const unsigned long BLENDER_ICON_48x48x32[] = { static XVisualInfo *x11_visualinfo_from_glx( Display *display, - bool stereoVisual, GHOST_TUns16 *r_numOfAASamples) + bool stereoVisual, + GHOST_TUns16 *r_numOfAASamples, + bool needAlpha, + GLXFBConfig *fbconfig) { - XVisualInfo *visualInfo = NULL; + XVisualInfo *visual = NULL; GHOST_TUns16 numOfAASamples = *r_numOfAASamples; + int glx_major, glx_minor, glx_version; /* GLX version: major.minor */ GHOST_TUns16 actualSamples; + int glx_attribs[64]; + + *fbconfig = NULL; /* Set up the minimum attributes that we require and see if * X can find us a visual matching those requirements. */ - int glx_major, glx_minor; /* GLX version: major.minor */ if (!glXQueryVersion(display, &glx_major, &glx_minor)) { fprintf(stderr, @@ -182,53 +190,118 @@ static XVisualInfo *x11_visualinfo_from_glx( return NULL; } + glx_version = glx_major*100 + glx_minor; - /* GLX >= 1.4 required for multi-sample */ - if ((glx_major > 1) || (glx_major == 1 && glx_minor >= 4)) { + if (glx_version >= 104) { actualSamples = numOfAASamples; } else { numOfAASamples = 0; actualSamples = 0; } + +#ifdef WITH_X11_ALPHA + if ( needAlpha + && glx_version >= 103 + && (glXChooseFBConfig || + (glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)glXGetProcAddressARB((const GLubyte *)"glXChooseFBConfig")) != NULL) + && (glXGetVisualFromFBConfig || + (glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddressARB((const GLubyte *)"glXGetVisualFromFBConfig")) != NULL) + ) { + GLXFBConfig *fbconfigs; + int nbfbconfig; + int i; + + for (;;) { + + GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, needAlpha, true); + + fbconfigs = glXChooseFBConfig(display, DefaultScreen(display), glx_attribs, &nbfbconfig); + + /* Any sample level or even zero, which means oversampling disabled, is good + * but we need a valid visual to continue */ + if (nbfbconfig > 0) { + /* take a frame buffer config that has alpha cap */ + for (i=0 ;i<nbfbconfig; i++) { + visual = (XVisualInfo*)glXGetVisualFromFBConfig(display, fbconfigs[i]); + if (!visual) + continue; + /* if we don't need a alpha background, the first config will do, otherwise + * test the alphaMask as it won't necessarily be present */ + if (needAlpha) { + XRenderPictFormat *pict_format = XRenderFindVisualFormat(display, visual->visual); + if (!pict_format) + continue; + if (pict_format->direct.alphaMask <= 0) + continue; + } + *fbconfig = fbconfigs[i]; + break; + } + XFree(fbconfigs); + if (i<nbfbconfig) { + if (actualSamples < numOfAASamples) { + fprintf(stderr, + "Warning! Unable to find a multisample pixel format that supports exactly %d samples. " + "Substituting one that uses %d samples.\n", + numOfAASamples, actualSamples); + } + break; + } + visual = NULL; + } - /* Find the display with highest samples, starting at level requested */ - for (;;) { - int glx_attribs[64]; - - GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, false); - - visualInfo = glXChooseVisual(display, DefaultScreen(display), glx_attribs); - - /* Any sample level or even zero, which means oversampling disabled, is good - * but we need a valid visual to continue */ - if (visualInfo != NULL) { - if (actualSamples < numOfAASamples) { + if (actualSamples == 0) { + /* All options exhausted, cannot continue */ fprintf(stderr, - "Warning! Unable to find a multisample pixel format that supports exactly %d samples. " - "Substituting one that uses %d samples.\n", - numOfAASamples, actualSamples); + "%s:%d: X11 glXChooseVisual() failed, " + "verify working openGL system!\n", + __FILE__, __LINE__); + + return NULL; + } + else { + --actualSamples; } - break; } + } + else +#endif + { + /* legacy, don't use extension */ + for (;;) { + GHOST_X11_GL_GetAttributes(glx_attribs, 64, actualSamples, stereoVisual, needAlpha, false); + + visual = glXChooseVisual(display, DefaultScreen(display), glx_attribs); + + /* Any sample level or even zero, which means oversampling disabled, is good + * but we need a valid visual to continue */ + if (visual != NULL) { + if (actualSamples < numOfAASamples) { + fprintf(stderr, + "Warning! Unable to find a multisample pixel format that supports exactly %d samples. " + "Substituting one that uses %d samples.\n", + numOfAASamples, actualSamples); + } + break; + } - if (actualSamples == 0) { - /* All options exhausted, cannot continue */ - fprintf(stderr, - "%s:%d: X11 glXChooseVisual() failed, " - "verify working openGL system!\n", - __FILE__, __LINE__); + if (actualSamples == 0) { + /* All options exhausted, cannot continue */ + fprintf(stderr, + "%s:%d: X11 glXChooseVisual() failed, " + "verify working openGL system!\n", + __FILE__, __LINE__); - return NULL; - } - else { - --actualSamples; + return NULL; + } + else { + --actualSamples; + } } } - *r_numOfAASamples = actualSamples; - - return visualInfo; + return visual; } GHOST_WindowX11:: @@ -244,10 +317,12 @@ GHOST_WindowX11(GHOST_SystemX11 *system, GHOST_TDrawingContextType type, const bool stereoVisual, const bool exclusive, + const bool alphaBackground, const GHOST_TUns16 numOfAASamples, const bool is_debug) : GHOST_Window(width, height, state, stereoVisual, exclusive, numOfAASamples), m_display(display), m_visualInfo(NULL), + m_fbconfig(NULL), m_normal_state(GHOST_kWindowStateNormal), m_system(system), m_invalid_window(false), @@ -264,7 +339,7 @@ GHOST_WindowX11(GHOST_SystemX11 *system, m_is_debug_context(is_debug) { if (type == GHOST_kDrawingContextTypeOpenGL) { - m_visualInfo = x11_visualinfo_from_glx(m_display, stereoVisual, &m_wantNumOfAASamples); + m_visualInfo = x11_visualinfo_from_glx(m_display, stereoVisual, &m_wantNumOfAASamples, alphaBackground, (GLXFBConfig*)&m_fbconfig); } else { XVisualInfo tmp = {0}; @@ -1240,6 +1315,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type m_window, m_display, m_visualInfo, + (GLXFBConfig)m_fbconfig, GLX_CONTEXT_CORE_PROFILE_BIT_ARB, 3, 2, GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), @@ -1251,6 +1327,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type m_window, m_display, m_visualInfo, + (GLXFBConfig)m_fbconfig, GLX_CONTEXT_ES2_PROFILE_BIT_EXT, 2, 0, GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), @@ -1262,6 +1339,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type m_window, m_display, m_visualInfo, + (GLXFBConfig)m_fbconfig, 0, // profile bit 0, 0, GHOST_OPENGL_GLX_CONTEXT_FLAGS | (m_is_debug_context ? GLX_CONTEXT_DEBUG_BIT_ARB : 0), diff --git a/intern/ghost/intern/GHOST_WindowX11.h b/intern/ghost/intern/GHOST_WindowX11.h index 5beb7b43032..0738e3d47b8 100644 --- a/intern/ghost/intern/GHOST_WindowX11.h +++ b/intern/ghost/intern/GHOST_WindowX11.h @@ -73,6 +73,7 @@ public: * \param parentWindow Parent (embedder) window * \param type The type of drawing context installed in this window. * \param stereoVisual Stereo visual for quad buffered stereo. + * \param alphaBackground Enable alpha blending of window with display background * \param numOfAASamples Number of samples used for AA (zero if no AA) */ GHOST_WindowX11( @@ -88,6 +89,7 @@ public: GHOST_TDrawingContextType type = GHOST_kDrawingContextTypeNone, const bool stereoVisual = false, const bool exclusive = false, + const bool alphaBackground = false, const GHOST_TUns16 numOfAASamples = 0, const bool is_debug = false ); @@ -321,6 +323,7 @@ private: Window m_window; Display *m_display; XVisualInfo *m_visualInfo; + void *m_fbconfig; GHOST_TWindowState m_normal_state; diff --git a/intern/gpudirect/CMakeLists.txt b/intern/gpudirect/CMakeLists.txt new file mode 100644 index 00000000000..88c09a663b8 --- /dev/null +++ b/intern/gpudirect/CMakeLists.txt @@ -0,0 +1,41 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# 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 +# of the License, or (at your option) any later version. +# +# 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, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# The Original Code is Copyright (C) 2015, Blender Foundation +# All rights reserved. +# +# The Original Code is: all of this file. +# +# Contributor(s): Blender Foundation. +# +# ***** END GPL LICENSE BLOCK ***** + +set(INC + . + # XXX, bad level include! + ../../source/blender/blenlib +) + +set(INC_SYS + ${GLEW_INCLUDE_PATH} +) + +set(SRC + dvpapi.cpp + dvpapi.h +) + +blender_add_lib(bf_intern_gpudirect "${SRC}" "${INC}" "${INC_SYS}") diff --git a/intern/gpudirect/dvpapi.cpp b/intern/gpudirect/dvpapi.cpp new file mode 100644 index 00000000000..8ae5cdbf17b --- /dev/null +++ b/intern/gpudirect/dvpapi.cpp @@ -0,0 +1,147 @@ +/* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* 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 +* of the License, or (at your option) any later version. +* +* 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, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. +* +* ***** END GPL LICENSE BLOCK ***** +*/ + +/** \file gpudirect/dvpapi.c +* \ingroup gpudirect +*/ + +#ifdef WIN32 + +#include <stdlib.h> +#include "dvpapi.h" + +extern "C" { +#include "BLI_dynlib.h" +} + +#define KDVPAPI_Name "dvp.dll" + +typedef DVPStatus (DVPAPIENTRY * PFNDVPINITGLCONTEXT) (uint32_t flags); +typedef DVPStatus (DVPAPIENTRY * PFNDVPCLOSEGLCONTEXT) (void); +typedef DVPStatus (DVPAPIENTRY * PFNDVPGETLIBRARYVERSION)(uint32_t *major, uint32_t *minor); + +static uint32_t __dvpMajorVersion = 0; +static uint32_t __dvpMinorVersion = 0; +static PFNDVPGETLIBRARYVERSION __dvpGetLibrayVersion = NULL; +static PFNDVPINITGLCONTEXT __dvpInitGLContext = NULL; +static PFNDVPCLOSEGLCONTEXT __dvpCloseGLContext = NULL; +PFNDVPBEGIN __dvpBegin = NULL; +PFNDVPEND __dvpEnd = NULL; +PFNDVPCREATEBUFFER __dvpCreateBuffer = NULL; +PFNDVPDESTROYBUFFER __dvpDestroyBuffer = NULL; +PFNDVPFREEBUFFER __dvpFreeBuffer = NULL; +PFNDVPMEMCPYLINED __dvpMemcpyLined = NULL; +PFNDVPMEMCPY __dvpMemcpy = NULL; +PFNDVPIMPORTSYNCOBJECT __dvpImportSyncObject = NULL; +PFNDVPFREESYNCOBJECT __dvpFreeSyncObject = NULL; +PFNDVPMAPBUFFERENDAPI __dvpMapBufferEndAPI = NULL; +PFNDVPMAPBUFFERWAITDVP __dvpMapBufferWaitDVP = NULL; +PFNDVPMAPBUFFERENDDVP __dvpMapBufferEndDVP = NULL; +PFNDVPMAPBUFFERWAITAPI __dvpMapBufferWaitAPI = NULL; +PFNDVPBINDTOGLCTX __dvpBindToGLCtx = NULL; +PFNDVPGETREQUIREDCONSTANTSGLCTX __dvpGetRequiredConstantsGLCtx = NULL; +PFNDVPCREATEGPUTEXTUREGL __dvpCreateGPUTextureGL = NULL; +PFNDVPUNBINDFROMGLCTX __dvpUnbindFromGLCtx = NULL; + +static DynamicLibrary *__dvpLibrary = NULL; + +DVPStatus dvpGetLibrayVersion(uint32_t *major, uint32_t *minor) +{ + if (!__dvpLibrary) + return DVP_STATUS_ERROR; + *major = __dvpMajorVersion; + *minor = __dvpMinorVersion; + return DVP_STATUS_OK; +} + +DVPStatus dvpInitGLContext(uint32_t flags) +{ + DVPStatus status; + if (!__dvpLibrary) { + __dvpLibrary = BLI_dynlib_open(KDVPAPI_Name); + if (!__dvpLibrary) { + return DVP_STATUS_ERROR; + } +// "?dvpInitGLContext@@YA?AW4DVPStatus@@I@Z"; + __dvpInitGLContext = (PFNDVPINITGLCONTEXT)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpInitGLContext@@YA?AW4DVPStatus@@I@Z"); + __dvpCloseGLContext = (PFNDVPCLOSEGLCONTEXT)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpCloseGLContext@@YA?AW4DVPStatus@@XZ"); + __dvpGetLibrayVersion = (PFNDVPGETLIBRARYVERSION)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpGetLibrayVersion@@YA?AW4DVPStatus@@PEAI0@Z"); + __dvpBegin = (PFNDVPBEGIN)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpBegin@@YA?AW4DVPStatus@@XZ"); + __dvpEnd = (PFNDVPEND)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpEnd@@YA?AW4DVPStatus@@XZ"); + __dvpCreateBuffer = (PFNDVPCREATEBUFFER)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpCreateBuffer@@YA?AW4DVPStatus@@PEAUDVPSysmemBufferDescRec@@PEA_K@Z"); + __dvpDestroyBuffer = (PFNDVPDESTROYBUFFER)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpDestroyBuffer@@YA?AW4DVPStatus@@_K@Z"); + __dvpFreeBuffer = (PFNDVPFREEBUFFER)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpFreeBuffer@@YA?AW4DVPStatus@@_K@Z"); + __dvpMemcpyLined = (PFNDVPMEMCPYLINED)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpMemcpyLined@@YA?AW4DVPStatus@@_K0I000III@Z"); + __dvpMemcpy = (PFNDVPMEMCPY)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpMemcpy2D@@YA?AW4DVPStatus@@_K0I000IIIII@Z"); + __dvpImportSyncObject = (PFNDVPIMPORTSYNCOBJECT)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpImportSyncObject@@YA?AW4DVPStatus@@PEAUDVPSyncObjectDescRec@@PEA_K@Z"); + __dvpFreeSyncObject = (PFNDVPFREESYNCOBJECT)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpFreeSyncObject@@YA?AW4DVPStatus@@_K@Z"); + __dvpMapBufferEndAPI = (PFNDVPMAPBUFFERENDAPI)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpMapBufferEndAPI@@YA?AW4DVPStatus@@_K@Z"); + __dvpMapBufferWaitDVP = (PFNDVPMAPBUFFERWAITDVP)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpMapBufferWaitDVP@@YA?AW4DVPStatus@@_K@Z"); + __dvpMapBufferEndDVP = (PFNDVPMAPBUFFERENDDVP)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpMapBufferEndDVP@@YA?AW4DVPStatus@@_K@Z"); + __dvpMapBufferWaitAPI = (PFNDVPMAPBUFFERWAITAPI)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpMapBufferWaitAPI@@YA?AW4DVPStatus@@_K@Z"); + __dvpBindToGLCtx = (PFNDVPBINDTOGLCTX)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpBindToGLCtx@@YA?AW4DVPStatus@@_K@Z"); + __dvpGetRequiredConstantsGLCtx = (PFNDVPGETREQUIREDCONSTANTSGLCTX)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpGetRequiredConstantsGLCtx@@YA?AW4DVPStatus@@PEAI00000@Z"); + __dvpCreateGPUTextureGL = (PFNDVPCREATEGPUTEXTUREGL)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpCreateGPUTextureGL@@YA?AW4DVPStatus@@IPEA_K@Z"); + __dvpUnbindFromGLCtx = (PFNDVPUNBINDFROMGLCTX)BLI_dynlib_find_symbol(__dvpLibrary, "?dvpUnbindFromGLCtx@@YA?AW4DVPStatus@@_K@Z"); + if (!__dvpInitGLContext || + !__dvpCloseGLContext || + !__dvpGetLibrayVersion || + !__dvpBegin || + !__dvpEnd || + !__dvpCreateBuffer || + !__dvpDestroyBuffer || + !__dvpFreeBuffer || + !__dvpMemcpyLined || + !__dvpMemcpy || + !__dvpImportSyncObject || + !__dvpFreeSyncObject || + !__dvpMapBufferEndAPI || + !__dvpMapBufferWaitDVP || + !__dvpMapBufferEndDVP || + !__dvpMapBufferWaitAPI || + !__dvpBindToGLCtx || + !__dvpGetRequiredConstantsGLCtx || + !__dvpCreateGPUTextureGL || + !__dvpUnbindFromGLCtx) + { + return DVP_STATUS_ERROR; + } + // check that the library version is what we want + if ((status = __dvpGetLibrayVersion(&__dvpMajorVersion, &__dvpMinorVersion)) != DVP_STATUS_OK) + return status; + if (__dvpMajorVersion != DVP_MAJOR_VERSION || __dvpMinorVersion < DVP_MINOR_VERSION) + return DVP_STATUS_ERROR; + } + return (!__dvpInitGLContext) ? DVP_STATUS_ERROR : __dvpInitGLContext(flags); +} + +DVPStatus dvpCloseGLContext(void) +{ + return (!__dvpCloseGLContext) ? DVP_STATUS_ERROR : __dvpCloseGLContext(); +} + +#endif // WIN32 diff --git a/intern/gpudirect/dvpapi.h b/intern/gpudirect/dvpapi.h new file mode 100644 index 00000000000..4cc259f0fe8 --- /dev/null +++ b/intern/gpudirect/dvpapi.h @@ -0,0 +1,667 @@ +/* +* ***** BEGIN GPL LICENSE BLOCK ***** +* +* 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 +* of the License, or (at your option) any later version. +* +* 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, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. +* +* ***** END GPL LICENSE BLOCK ***** +*/ + +/** \file gpudirect/dvpapi.h +* \ingroup gpudirect +*/ + +#ifndef __DVPAPI_H__ +#define __DVPAPI_H__ + +#ifdef WIN32 + +#include <stdlib.h> +#include <stdint.h> + +#include "GL/glew.h" + +#if defined(__GNUC__) && __GNUC__>=4 +# define DVPAPI extern __attribute__ ((visibility("default"))) +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) +# define DVPAPI extern __global +#else +# define DVPAPI extern +#endif + +#define DVPAPIENTRY +#define DVP_MAJOR_VERSION 1 +#define DVP_MINOR_VERSION 63 + +typedef uint64_t DVPBufferHandle; +typedef uint64_t DVPSyncObjectHandle; + +typedef enum { + DVP_STATUS_OK = 0, + DVP_STATUS_INVALID_PARAMETER = 1, + DVP_STATUS_UNSUPPORTED = 2, + DVP_STATUS_END_ENUMERATION = 3, + DVP_STATUS_INVALID_DEVICE = 4, + DVP_STATUS_OUT_OF_MEMORY = 5, + DVP_STATUS_INVALID_OPERATION = 6, + DVP_STATUS_TIMEOUT = 7, + DVP_STATUS_INVALID_CONTEXT = 8, + DVP_STATUS_INVALID_RESOURCE_TYPE = 9, + DVP_STATUS_INVALID_FORMAT_OR_TYPE = 10, + DVP_STATUS_DEVICE_UNINITIALIZED = 11, + DVP_STATUS_UNSIGNALED = 12, + DVP_STATUS_SYNC_ERROR = 13, + DVP_STATUS_SYNC_STILL_BOUND = 14, + DVP_STATUS_ERROR = -1, +} DVPStatus; + +// Pixel component formats stored in the system memory buffer +// analogous to those defined in the OpenGL API, except for +// DVP_BUFFER and the DVP_CUDA_* types. DVP_BUFFER provides +// an unspecified format type to allow for general interpretation +// of the bytes at a later stage (in GPU shader). Note that not +// all paths will achieve optimal speeds due to lack of HW support +// for the transformation. The CUDA types are to be used when +// copying to/from a system memory buffer from-to a CUDA array, as the +// CUDA array implies a memory layout that matches the array. +typedef enum { + DVP_BUFFER, // Buffer treated as a raw buffer + // and copied directly into GPU buffer + // without any interpretation of the + // stored bytes. + DVP_DEPTH_COMPONENT, + DVP_RGBA, + DVP_BGRA, + DVP_RED, + DVP_GREEN, + DVP_BLUE, + DVP_ALPHA, + DVP_RGB, + DVP_BGR, + DVP_LUMINANCE, + DVP_LUMINANCE_ALPHA, + DVP_CUDA_1_CHANNEL, + DVP_CUDA_2_CHANNELS, + DVP_CUDA_4_CHANNELS, + DVP_RGBA_INTEGER, + DVP_BGRA_INTEGER, + DVP_RED_INTEGER, + DVP_GREEN_INTEGER, + DVP_BLUE_INTEGER, + DVP_ALPHA_INTEGER, + DVP_RGB_INTEGER, + DVP_BGR_INTEGER, + DVP_LUMINANCE_INTEGER, + DVP_LUMINANCE_ALPHA_INTEGER, +} DVPBufferFormats; + +// Possible pixel component storage types for system memory buffers +typedef enum { + DVP_UNSIGNED_BYTE, + DVP_BYTE, + DVP_UNSIGNED_SHORT, + DVP_SHORT, + DVP_UNSIGNED_INT, + DVP_INT, + DVP_FLOAT, + DVP_HALF_FLOAT, + DVP_UNSIGNED_BYTE_3_3_2, + DVP_UNSIGNED_BYTE_2_3_3_REV, + DVP_UNSIGNED_SHORT_5_6_5, + DVP_UNSIGNED_SHORT_5_6_5_REV, + DVP_UNSIGNED_SHORT_4_4_4_4, + DVP_UNSIGNED_SHORT_4_4_4_4_REV, + DVP_UNSIGNED_SHORT_5_5_5_1, + DVP_UNSIGNED_SHORT_1_5_5_5_REV, + DVP_UNSIGNED_INT_8_8_8_8, + DVP_UNSIGNED_INT_8_8_8_8_REV, + DVP_UNSIGNED_INT_10_10_10_2, + DVP_UNSIGNED_INT_2_10_10_10_REV, +} DVPBufferTypes; + +// System memory descriptor describing the size and storage formats +// of the buffer +typedef struct DVPSysmemBufferDescRec { + uint32_t width; // Buffer Width + uint32_t height; // Buffer Height + uint32_t stride; // Stride + uint32_t size; // Specifies the surface size if + // format == DVP_BUFFER + DVPBufferFormats format; // see enum above + DVPBufferTypes type; // see enum above + void *bufAddr; // Buffer memory address +} DVPSysmemBufferDesc; + +// Flags specified at sync object creation: +// ---------------------------------------- +// Tells the implementation to use events wherever +// possible instead of software spin loops. Note if HW +// wait operations are supported by the implementation +// then events will not be used in the dvpMemcpy* +// functions. In such a case, events may still be used +// in dvpSyncObjClientWait* functions. +#define DVP_SYNC_OBJECT_FLAGS_USE_EVENTS 0x00000001 + +typedef struct DVPSyncObjectDescRec { + uint32_t *sem; // Location to write semaphore value + uint32_t flags; // See above DVP_SYNC_OBJECT_FLAGS_* bits + DVPStatus (*externalClientWaitFunc) (DVPSyncObjectHandle sync, + uint32_t value, + bool GEQ, // If true then the function should wait for the sync value to be + // greater than or equal to the value parameter. Otherwise just a + // straight forward equality comparison should be performed. + uint64_t timeout); + // If non-null, externalClientWaitFunc allows the DVP library + // to call the application to wait for a sync object to be + // released. This allows the application to create events, + // which can be triggered on device interrupts instead of + // using spin loops inside the DVP library. Upon succeeding + // the function must return DVP_STATUS_OK, non-zero for failure + // and DVP_STATUS_TIMEOUT on timeout. The externalClientWaitFunc should + // not alter the current GL or CUDA context state +} DVPSyncObjectDesc; + +// Time used when event timeouts should be ignored +#define DVP_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull + +typedef DVPStatus (DVPAPIENTRY * PFNDVPBEGIN) (void); +typedef DVPStatus (DVPAPIENTRY * PFNDVPEND) (void); +typedef DVPStatus (DVPAPIENTRY * PFNDVPCREATEBUFFER)(DVPSysmemBufferDesc *desc, DVPBufferHandle *hBuf); +typedef DVPStatus (DVPAPIENTRY * PFNDVPDESTROYBUFFER)(DVPBufferHandle hBuf); +typedef DVPStatus (DVPAPIENTRY * PFNDVPFREEBUFFER)(DVPBufferHandle gpuBufferHandle); +typedef DVPStatus (DVPAPIENTRY * PFNDVPMEMCPYLINED)(DVPBufferHandle srcBuffer, + DVPSyncObjectHandle srcSync, + uint32_t srcAcquireValue, + uint64_t timeout, + DVPBufferHandle dstBuffer, + DVPSyncObjectHandle dstSync, + uint32_t dstReleaseValue, + uint32_t startingLine, + uint32_t numberOfLines); +typedef DVPStatus (DVPAPIENTRY * PFNDVPMEMCPY)(DVPBufferHandle srcBuffer, + DVPSyncObjectHandle srcSync, + uint32_t srcAcquireValue, + uint64_t timeout, + DVPBufferHandle dstBuffer, + DVPSyncObjectHandle dstSync, + uint32_t dstReleaseValue, + uint32_t srcOffset, + uint32_t dstOffset, + uint32_t count); +typedef DVPStatus (DVPAPIENTRY * PFNDVPIMPORTSYNCOBJECT)(DVPSyncObjectDesc *desc, + DVPSyncObjectHandle *syncObject); +typedef DVPStatus (DVPAPIENTRY * PFNDVPFREESYNCOBJECT)(DVPSyncObjectHandle syncObject); +typedef DVPStatus (DVPAPIENTRY * PFNDVPGETREQUIREDCONSTANTSGLCTX)(uint32_t *bufferAddrAlignment, + uint32_t *bufferGPUStrideAlignment, + uint32_t *semaphoreAddrAlignment, + uint32_t *semaphoreAllocSize, + uint32_t *semaphorePayloadOffset, + uint32_t *semaphorePayloadSize); +typedef DVPStatus (DVPAPIENTRY * PFNDVPBINDTOGLCTX)(DVPBufferHandle hBuf); +typedef DVPStatus (DVPAPIENTRY * PFNDVPUNBINDFROMGLCTX)(DVPBufferHandle hBuf); +typedef DVPStatus (DVPAPIENTRY * PFNDVPMAPBUFFERENDAPI)(DVPBufferHandle gpuBufferHandle); +typedef DVPStatus (DVPAPIENTRY * PFNDVPMAPBUFFERWAITDVP)(DVPBufferHandle gpuBufferHandle); +typedef DVPStatus (DVPAPIENTRY * PFNDVPMAPBUFFERENDDVP)(DVPBufferHandle gpuBufferHandle); +typedef DVPStatus (DVPAPIENTRY * PFNDVPMAPBUFFERWAITAPI)(DVPBufferHandle gpuBufferHandle); +typedef DVPStatus (DVPAPIENTRY * PFNDVPCREATEGPUTEXTUREGL)(GLuint texID, + DVPBufferHandle *bufferHandle); + +// Flags supplied to the dvpInit* functions: +// +// DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT is only supported for OpenGL +// contexts and is the only supported flag for CUDA. It allows for +// certain cases to be optimized by sharing the context +// of the application for the DVP operations. This removes the +// need to do certain synchronizations. See issue 5 for parallel +// issues. When used, the app's GL context must be current for all calls +// to the DVP library. +// the DVP library. +#define DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT 0x000000001 + +//------------------------------------------------------------------------ +// Function: dvpInitGLContext +// +// To be called before any DVP resources are allocated. +// This call allows for specification of flags that may +// change the way DVP operations are performed. See above +// for the list of flags. +// +// The OpenGL context must be current at time of call. +// +// Parameters: flags[IN] - Buffer description structure +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +extern DVPStatus dvpInitGLContext(uint32_t flags); + +//------------------------------------------------------------------------ +// Function: dvpCloseGLContext +// +// Function to be called when app closes to allow freeing +// of any DVP library allocated resources. +// +// The OpenGL context must be current at time of call. +// +// Parameters: none +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +extern DVPStatus dvpCloseGLContext(); + +//------------------------------------------------------------------------ +// Function: dvpGetLibrayVersion +// +// Description: Returns the current version of the library +// +// Parameters: major[OUT] - returned major version +// minor[OUT] - returned minor version +// +// Returns: DVP_STATUS_OK +//------------------------------------------------------------------------ +extern DVPStatus dvpGetLibrayVersion(uint32_t *major, uint32_t *minor); + +//------------------------------------------------------------------------ +// Function: dvpBegin +// +// Description: dvpBegin must be called before any combination of DVP +// function calls dvpMemCpy*, dvpMapBufferWaitDVP, +// dvpSyncObjClientWait*, and dvpMapBufferEndDVP. After +// the last of these functions has been called is dvpEnd +// must be called. This allows for more efficient batched +// DVP operations. +// +// Parameters: none +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpBegin DVPAPI_GET_FUN(__dvpBegin) + +//------------------------------------------------------------------------ +// Function: dvpEnd +// +// Description: dvpEnd signals the end of a batch of DVP function calls +// that began with dvpBegin +// +// Parameters: none +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpEnd DVPAPI_GET_FUN(__dvpEnd) + + +//------------------------------------------------------------------------ +// Function: dvpCreateBuffer +// +// Description: Create a DVP buffer using system memory, wrapping a user +// passed pointer. The pointer must be aligned +// to values returned by dvpGetRequiredAlignments* +// +// Parameters: desc[IN] - Buffer description structure +// hBuf[OUT] - DVP Buffer handle +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpCreateBuffer DVPAPI_GET_FUN(__dvpCreateBuffer) + + +//------------------------------------------------------------------------ +// Function: dvpDestroyBuffer +// +// Description: Destroy a previously created DVP buffer. +// +// Parameters: hBuf[IN] - DVP Buffer handle +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpDestroyBuffer DVPAPI_GET_FUN(__dvpDestroyBuffer) + +//------------------------------------------------------------------------ +// Function: dvpFreeBuffer +// +// Description: dvpFreeBuffer frees the DVP buffer reference +// +// Parameters: gpuBufferHandle[IN] - DVP Buffer handle +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpFreeBuffer DVPAPI_GET_FUN(__dvpFreeBuffer) + +//------------------------------------------------------------------------ +// Function: dvpMemcpyLined +// +// Description: dvpMemcpyLined provides buffer copies between a +// DVP sysmem buffer and a graphics API texture (as opposed to +// a buffer type). Other buffer types (such +// as graphics API buffers) return DVP_STATUS_INVALID_PARAMETER. +// +// In addition, see "dvpMemcpy* general comments" above. +// +// Parameters: srcBuffer[IN] - src buffer handle +// srcSync[IN] - sync to acquire on before transfer +// srcAcquireValue[IN] - value to acquire on before transfer +// timeout[IN] - time out value in nanoseconds. +// dstBuffer[IN] - src buffer handle +// dstSync[IN] - sync to release on transfer completion +// dstReleaseValue[IN] - value to release on completion +// startingLine[IN] - starting line of buffer +// numberOfLines[IN] - number of lines to copy +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +// +// GL state effected: The following GL state may be altered by this +// function (not relevant if no GL source or destination +// is used): +// -GL_PACK_SKIP_ROWS, GL_PACK_SKIP_PIXELS, +// GL_PACK_ROW_LENGTH +// -The buffer bound to GL_PIXEL_PACK_BUFFER +// -The current bound framebuffer (GL_FRAMEBUFFER_EXT) +// -GL_UNPACK_SKIP_ROWS, GL_UNPACK_SKIP_PIXELS, +// GL_UNPACK_ROW_LENGTH +// -The buffer bound to GL_PIXEL_UNPACK_BUFFER +// -The texture bound to GL_TEXTURE_2D +//------------------------------------------------------------------------ +#define dvpMemcpyLined DVPAPI_GET_FUN(__dvpMemcpyLined) + + +//------------------------------------------------------------------------ +// Function: dvpMemcpy +// +// Description: dvpMemcpy provides buffer copies between a +// DVP sysmem buffer and a graphics API pure buffer (as +// opposed to a texture type). Other buffer types (such +// as graphics API textures) return +// DVP_STATUS_INVALID_PARAMETER. +// +// The start address of the srcBuffer is given by srcOffset +// and the dstBuffer start address is given by dstOffset. +// +// In addition, see "dvpMemcpy* general comments" above. +// +// Parameters: srcBuffer[IN] - src buffer handle +// srcSync[IN] - sync to acquire on before transfer +// srcAcquireValue[IN] - value to acquire on before transfer +// timeout[IN] - time out value in nanoseconds. +// dstBuffer[IN] - src buffer handle +// dstSync[IN] - sync to release on completion +// dstReleaseValue[IN] - value to release on completion +// uint32_t srcOffset[IN] - byte offset of srcBuffer +// uint32_t dstOffset[IN] - byte offset of dstBuffer +// uint32_t count[IN] - number of bytes to copy +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +// +// GL state effected: The following GL state may be altered by this +// function (not relevant if no GL source or destination +// is used): +// - The buffer bound to GL_COPY_WRITE_BUFFER +// - The buffer bound to GL_COPY_READ_BUFFER +// +//------------------------------------------------------------------------ +#define dvpMemcpy DVPAPI_GET_FUN(__dvpMemcpy) + +//------------------------------------------------------------------------ +// Function: dvpImportSyncObject +// +// Description: dvpImportSyncObject creates a DVPSyncObject from the +// DVPSyncObjectDesc. Note that a sync object is not +// supported for copy operations targeting different APIs. +// This means, for example, it is illegal to call dvpMemCpy* +// for source or target GL texture with sync object A and +// then later use that same sync object in dvpMemCpy* +// operation for a source or target CUDA buffer. The same +// semaphore memory can still be used for two different sync +// objects. +// +// Parameters: desc[IN] - data describing the sync object +// syncObject[OUT] - handle to sync object +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpImportSyncObject DVPAPI_GET_FUN(__dvpImportSyncObject) + +//------------------------------------------------------------------------ +// Function: dvpFreeSyncObject +// +// Description: dvpFreeSyncObject waits for any outstanding releases on +// this sync object before freeing the resources allocated for +// the specified sync object. The application must make sure +// any outstanding acquire operations have already been +// completed. +// +// If OpenGL is being used and the app's GL context is being +// shared (via the DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT flag), +// then dvpFreeSyncObject needs to be called while each context, +// on which the sync object was used, is current. If +// DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT is used and there are out +// standing contexts from which this sync object must be free'd +// then dvpFreeSyncObject will return DVP_STATUS_SYNC_STILL_BOUND. +// +// Parameters: syncObject[IN] - handle to sync object to be free'd +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +// DVP_STATUS_SYNC_STILL_BOUND +//------------------------------------------------------------------------ +#define dvpFreeSyncObject DVPAPI_GET_FUN(__dvpFreeSyncObject) + + +//------------------------------------------------------------------------ +// Function: dvpMapBufferEndAPI +// +// Description: Tells DVP to setup a signal for this buffer in the +// callers API context or device. The signal follows all +// previous API operations up to this point and, thus, +// allows subsequent DVP calls to know when then this buffer +// is ready for use within the DVP library. This function +// would be followed by a call to dvpMapBufferWaitDVP to +// synchronize rendering in the API stream and the DVP +// stream. +// +// If OpenGL or CUDA is used, the OpenGL/CUDA context +// must be current at time of call. +// +// The use of dvpMapBufferEndAPI is NOT recommended for +// CUDA synchronisation, as it is more optimal to use a +// applcation CUDA stream in conjunction with +// dvpMapBufferEndCUDAStream. This allows the driver to +// do optimisations, such as parllelise the copy operations +// and compute. +// +// This must be called outside the dvpBegin/dvpEnd pair. In +// addition, this call is not thread safe and must be called +// from or fenced against the rendering thread associated with +// the context or device. +// +// Parameters: gpuBufferHandle[IN] - buffer to track +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +// DVP_STATUS_UNSIGNALED - returned if the API is +// unable to place a signal in the API context queue +//------------------------------------------------------------------------ +#define dvpMapBufferEndAPI DVPAPI_GET_FUN(__dvpMapBufferEndAPI) + +//------------------------------------------------------------------------ +// Function: dvpMapBufferEndAPI +// +// Description: Tells DVP to setup a signal for this buffer in the +// callers API context or device. The signal follows all +// previous API operations up to this point and, thus, +// allows subsequent DVP calls to know when then this buffer +// is ready for use within the DVP library. This function +// would be followed by a call to dvpMapBufferWaitDVP to +// synchronize rendering in the API stream and the DVP +// stream. +// +// If OpenGL or CUDA is used, the OpenGL/CUDA context +// must be current at time of call. +// +// The use of dvpMapBufferEndAPI is NOT recommended for +// CUDA synchronisation, as it is more optimal to use a +// applcation CUDA stream in conjunction with +// dvpMapBufferEndCUDAStream. This allows the driver to +// do optimisations, such as parllelise the copy operations +// and compute. +// +// This must be called outside the dvpBegin/dvpEnd pair. In +// addition, this call is not thread safe and must be called +// from or fenced against the rendering thread associated with +// the context or device. +// +// Parameters: gpuBufferHandle[IN] - buffer to track +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +// DVP_STATUS_UNSIGNALED - returned if the API is +// unable to place a signal in the API context queue +//------------------------------------------------------------------------ +#define dvpMapBufferEndAPI DVPAPI_GET_FUN(__dvpMapBufferEndAPI) + +//------------------------------------------------------------------------ +// Function: dvpMapBufferWaitDVP +// +// Description: Tells DVP to make the DVP stream wait for a previous +// signal triggered by a dvpMapBufferEndAPI call. +// +// This must be called inside the dvpBegin/dvpEnd pair. +// +// Parameters: gpuBufferHandle[IN] - buffer to track +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpMapBufferWaitDVP DVPAPI_GET_FUN(__dvpMapBufferWaitDVP) + +//------------------------------------------------------------------------ +// Function: dvpMapBufferEndDVP +// +// Description: Tells DVP to setup a signal for this buffer after +// DVP operations are complete. The signal allows +// the API to know when then this buffer is +// ready for use within a API stream. This function would +// be followed by a call to dvpMapBufferWaitAPI to +// synchronize copies in the DVP stream and the API +// rendering stream. +// +// This must be called inside the dvpBegin/dvpEnd pair. +// +// Parameters: gpuBufferHandle[IN] - buffer to track +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpMapBufferEndDVP DVPAPI_GET_FUN(__dvpMapBufferEndDVP) + +//------------------------------------------------------------------------ +// Function: dvpMapBufferWaitAPI +// +// Description: Tells DVP to make the current API context or device to +// wait for a previous signal triggered by a +// dvpMapBufferEndDVP call. +// +// The use of dvpMapBufferWaitCUDAStream is NOT recommended for +// CUDA synchronisation, as it is more optimal to use a +// applcation CUDA stream in conjunction with +// dvpMapBufferEndCUDAStream. This allows the driver to +// do optimisations, such as parllelise the copy operations +// and compute. +// +// If OpenGL or CUDA is used, the OpenGL/CUDA context +// must be current at time of call. +// +// This must be called outside the dvpBegin/dvpEnd pair. In +// addition, this call is not thread safe and must be called +// from or fenced against the rendering thread associated with +// the context or device. +// +// Parameters: gpuBufferHandle[IN] - buffer to track +// +// Returns: DVP_STATUS_OK +// DVP_STATUS_INVALID_PARAMETER +// DVP_STATUS_ERROR +//------------------------------------------------------------------------ +#define dvpMapBufferWaitAPI DVPAPI_GET_FUN(__dvpMapBufferWaitAPI) + +//------------------------------------------------------------------------ +// If the multiple GL contexts used in the application access the same +// sysmem buffers, then application must create those GL contexts with +// display list shared. +//------------------------------------------------------------------------ +#define dvpBindToGLCtx DVPAPI_GET_FUN(__dvpBindToGLCtx) +#define dvpGetRequiredConstantsGLCtx DVPAPI_GET_FUN(__dvpGetRequiredConstantsGLCtx) +#define dvpCreateGPUTextureGL DVPAPI_GET_FUN(__dvpCreateGPUTextureGL) +#define dvpUnbindFromGLCtx DVPAPI_GET_FUN(__dvpUnbindFromGLCtx) + + +DVPAPI PFNDVPBEGIN __dvpBegin; +DVPAPI PFNDVPEND __dvpEnd; +DVPAPI PFNDVPCREATEBUFFER __dvpCreateBuffer; +DVPAPI PFNDVPDESTROYBUFFER __dvpDestroyBuffer; +DVPAPI PFNDVPFREEBUFFER __dvpFreeBuffer; +DVPAPI PFNDVPMEMCPYLINED __dvpMemcpyLined; +DVPAPI PFNDVPMEMCPY __dvpMemcpy; +DVPAPI PFNDVPIMPORTSYNCOBJECT __dvpImportSyncObject; +DVPAPI PFNDVPFREESYNCOBJECT __dvpFreeSyncObject; +DVPAPI PFNDVPMAPBUFFERENDAPI __dvpMapBufferEndAPI; +DVPAPI PFNDVPMAPBUFFERWAITDVP __dvpMapBufferWaitDVP; +DVPAPI PFNDVPMAPBUFFERENDDVP __dvpMapBufferEndDVP; +DVPAPI PFNDVPMAPBUFFERWAITAPI __dvpMapBufferWaitAPI; + + +//------------------------------------------------------------------------ +// If the multiple GL contexts used in the application access the same +// sysmem buffers, then application must create those GL contexts with +// display list shared. +//------------------------------------------------------------------------ +DVPAPI PFNDVPBINDTOGLCTX __dvpBindToGLCtx; +DVPAPI PFNDVPGETREQUIREDCONSTANTSGLCTX __dvpGetRequiredConstantsGLCtx; +DVPAPI PFNDVPCREATEGPUTEXTUREGL __dvpCreateGPUTextureGL; +DVPAPI PFNDVPUNBINDFROMGLCTX __dvpUnbindFromGLCtx; + +#define DVPAPI_GET_FUN(x) x + +#endif // WIN32 + +#endif // __DVPAPI_H__ + diff --git a/intern/moto/include/MT_Matrix4x4.h b/intern/moto/include/MT_Matrix4x4.h index 045cc3b8361..2ecac81ea6f 100644 --- a/intern/moto/include/MT_Matrix4x4.h +++ b/intern/moto/include/MT_Matrix4x4.h @@ -144,6 +144,16 @@ public: } /** + * Scale the rows of this matrix with x, y, z, w respectively. + */ + void tscale(MT_Scalar x, MT_Scalar y, MT_Scalar z, MT_Scalar w) { + m_el[0][0] *= x; m_el[1][0] *= y; m_el[2][0] *= z; m_el[3][0] *= w; + m_el[0][1] *= x; m_el[1][1] *= y; m_el[2][1] *= z; m_el[3][1] *= w; + m_el[0][2] *= x; m_el[1][2] *= y; m_el[2][2] *= z; m_el[3][2] *= w; + m_el[0][3] *= x; m_el[1][3] *= y; m_el[2][3] *= z; m_el[3][3] *= w; + } + + /** * Return a column-scaled version of this matrix. */ MT_Matrix4x4 scaled(MT_Scalar x, MT_Scalar y, MT_Scalar z, MT_Scalar w) const { diff --git a/release/datafiles/LICENSE-droidsans.ttf.txt b/release/datafiles/LICENSE-droidsans.ttf.txt index cf6f53e8644..6711ad37338 100644 --- a/release/datafiles/LICENSE-droidsans.ttf.txt +++ b/release/datafiles/LICENSE-droidsans.ttf.txt @@ -52,6 +52,8 @@ License: GPL-2.1+ (8) tlwg Loma (Thaï) Copyright: 2003 National Electronics and Computer Technology Center +Modified to fix and/or adapt kerning to Blender basic layout engine by Hồ Châu in 2016. + License: GPL-2+ with Font exception See Appendices C. diff --git a/release/datafiles/fonts/droidsans.ttf.gz b/release/datafiles/fonts/droidsans.ttf.gz Binary files differindex 5b942162141..7940852f637 100644 --- a/release/datafiles/fonts/droidsans.ttf.gz +++ b/release/datafiles/fonts/droidsans.ttf.gz diff --git a/release/scripts/modules/bpy/utils/previews.py b/release/scripts/modules/bpy/utils/previews.py index c67c523ea72..568116b027c 100644 --- a/release/scripts/modules/bpy/utils/previews.py +++ b/release/scripts/modules/bpy/utils/previews.py @@ -30,7 +30,7 @@ This allows scripts to generate their own previews, and use them as icons in UI Custom Icon Example ------------------- -.. literalinclude:: ../../../release/scripts/templates_py/ui_previews_custom_icon.py +.. literalinclude:: __/__/__/release/scripts/templates_py/ui_previews_custom_icon.py """ __all__ = ( diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 6b81c47765b..c1013342bd9 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -1185,6 +1185,10 @@ static void emDM_drawMappedFaces( if (draw_option_prev == DM_DRAW_OPTION_STIPPLE) { GPU_basic_shader_bind(GPU_SHADER_USE_COLOR); } + + if (shade_prev == GL_FLAT) { + glShadeModel(GL_SMOOTH); + } } static void bmdm_get_tri_uv(BMLoop *ltri[3], MLoopUV *luv[3], const int cd_loop_uv_offset) diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5f76b79b298..25f485a25aa 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -282,18 +282,18 @@ void angle_poly_v3(float *angles, const float *verts[3], int len); /********************************* Geometry **********************************/ -void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]); -void project_v3_v3v3(float r[3], const float p[3], const float n[3]); -void project_plane_v3_v3v3(float c[3], const float v[3], const float v_plane[3]); -void project_plane_v2_v2v2(float c[2], const float v[2], const float v_plane[2]); -void project_v3_plane(float v[3], const float n[3], const float p[3]); -void reflect_v3_v3v3(float r[3], const float v[3], const float n[3]); +void project_v2_v2v2(float out[2], const float p[2], const float v_proj[2]); +void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3]); +void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3]); +void project_plane_v2_v2v2(float out[2], const float p[2], const float v_plane[2]); +void project_v3_plane(float out[3], const float plane_no[3], const float plane_co[3]); +void reflect_v3_v3v3(float out[3], const float vec[3], const float normal[3]); void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3]); -void ortho_v3_v3(float p[3], const float v[3]); -void ortho_v2_v2(float p[2], const float v[2]); +void ortho_v3_v3(float out[3], const float v[3]); +void ortho_v2_v2(float out[2], const float v[2]); void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3]); void rotate_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle); -void rotate_normalized_v3_v3v3fl(float v[3], const float p[3], const float axis[3], const float angle); +void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], const float angle); /*********************************** Other ***********************************/ diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index 7b84dddcb68..f36d2faa1b8 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -49,6 +49,7 @@ void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1); void BLI_rng_seed(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); void BLI_rng_srandom(struct RNG *rng, unsigned int seed) ATTR_NONNULL(1); +void BLI_rng_get_char_n(RNG *rng, char *bytes, size_t bytes_len) ATTR_NONNULL(1, 2); int BLI_rng_get_int(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); unsigned int BLI_rng_get_uint(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index 7f2db3743df..988034349e0 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -585,23 +585,27 @@ void angle_poly_v3(float *angles, const float *verts[3], int len) /********************************* Geometry **********************************/ -/* Project v1 on v2 */ -void project_v2_v2v2(float c[2], const float v1[2], const float v2[2]) +/** + * Project \a p onto \a v_proj + */ +void project_v2_v2v2(float out[2], const float p[2], const float v_proj[2]) { - const float mul = dot_v2v2(v1, v2) / dot_v2v2(v2, v2); + const float mul = dot_v2v2(p, v_proj) / dot_v2v2(v_proj, v_proj); - c[0] = mul * v2[0]; - c[1] = mul * v2[1]; + out[0] = mul * v_proj[0]; + out[1] = mul * v_proj[1]; } -/* Project v1 on v2 */ -void project_v3_v3v3(float c[3], const float v1[3], const float v2[3]) +/** + * Project \a p onto \a v_proj + */ +void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3]) { - const float mul = dot_v3v3(v1, v2) / dot_v3v3(v2, v2); + const float mul = dot_v3v3(p, v_proj) / dot_v3v3(v_proj, v_proj); - c[0] = mul * v2[0]; - c[1] = mul * v2[1]; - c[2] = mul * v2[2]; + out[0] = mul * v_proj[0]; + out[1] = mul * v_proj[1]; + out[2] = mul * v_proj[2]; } /** @@ -617,35 +621,35 @@ void project_v3_v3v3(float c[3], const float v1[3], const float v2[3]) * sub_v3_v3v3(c, v, c); * \endcode */ -void project_plane_v3_v3v3(float c[3], const float v[3], const float v_plane[3]) +void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3]) { - const float mul = dot_v3v3(v, v_plane) / dot_v3v3(v_plane, v_plane); + const float mul = dot_v3v3(p, v_plane) / dot_v3v3(v_plane, v_plane); - c[0] = v[0] - (mul * v_plane[0]); - c[1] = v[1] - (mul * v_plane[1]); - c[2] = v[2] - (mul * v_plane[2]); + out[0] = p[0] - (mul * v_plane[0]); + out[1] = p[1] - (mul * v_plane[1]); + out[2] = p[2] - (mul * v_plane[2]); } -void project_plane_v2_v2v2(float c[2], const float v[2], const float v_plane[2]) +void project_plane_v2_v2v2(float out[2], const float p[2], const float v_plane[2]) { - const float mul = dot_v2v2(v, v_plane) / dot_v2v2(v_plane, v_plane); + const float mul = dot_v2v2(p, v_plane) / dot_v2v2(v_plane, v_plane); - c[0] = v[0] - (mul * v_plane[0]); - c[1] = v[1] - (mul * v_plane[1]); + out[0] = p[0] - (mul * v_plane[0]); + out[1] = p[1] - (mul * v_plane[1]); } /* project a vector on a plane defined by normal and a plane point p */ -void project_v3_plane(float v[3], const float n[3], const float p[3]) +void project_v3_plane(float out[3], const float plane_no[3], const float plane_co[3]) { float vector[3]; float mul; - sub_v3_v3v3(vector, v, p); - mul = dot_v3v3(vector, n) / len_squared_v3(n); + sub_v3_v3v3(vector, out, plane_co); + mul = dot_v3v3(vector, plane_no) / len_squared_v3(plane_no); - mul_v3_v3fl(vector, n, mul); + mul_v3_v3fl(vector, plane_no, mul); - sub_v3_v3(v, vector); + sub_v3_v3(out, vector); } /* Returns a vector bisecting the angle at v2 formed by v1, v2 and v3 */ @@ -664,15 +668,15 @@ void bisect_v3_v3v3v3(float out[3], const float v1[3], const float v2[3], const * Returns a reflection vector from a vector and a normal vector * reflect = vec - ((2 * DotVecs(vec, mirror)) * mirror) */ -void reflect_v3_v3v3(float out[3], const float vec[3], const float normal[3]) +void reflect_v3_v3v3(float out[3], const float v[3], const float normal[3]) { - const float dot2 = 2.0f * dot_v3v3(vec, normal); + const float dot2 = 2.0f * dot_v3v3(v, normal); BLI_ASSERT_UNIT_V3(normal); - out[0] = vec[0] - (dot2 * normal[0]); - out[1] = vec[1] - (dot2 * normal[1]); - out[2] = vec[2] - (dot2 * normal[2]); + out[0] = v[0] - (dot2 * normal[0]); + out[1] = v[1] - (dot2 * normal[1]); + out[2] = v[2] - (dot2 * normal[2]); } /** @@ -710,27 +714,27 @@ void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3]) * * \note return vector won't maintain same length. */ -void ortho_v3_v3(float p[3], const float v[3]) +void ortho_v3_v3(float out[3], const float v[3]) { const int axis = axis_dominant_v3_single(v); - BLI_assert(p != v); + BLI_assert(out != v); switch (axis) { case 0: - p[0] = -v[1] - v[2]; - p[1] = v[0]; - p[2] = v[0]; + out[0] = -v[1] - v[2]; + out[1] = v[0]; + out[2] = v[0]; break; case 1: - p[0] = v[1]; - p[1] = -v[0] - v[2]; - p[2] = v[1]; + out[0] = v[1]; + out[1] = -v[0] - v[2]; + out[2] = v[1]; break; case 2: - p[0] = v[2]; - p[1] = v[2]; - p[2] = -v[0] - v[1]; + out[0] = v[2]; + out[1] = v[2]; + out[2] = -v[0] - v[1]; break; } } @@ -738,18 +742,19 @@ void ortho_v3_v3(float p[3], const float v[3]) /** * no brainer compared to v3, just have for consistency. */ -void ortho_v2_v2(float p[2], const float v[2]) +void ortho_v2_v2(float out[2], const float v[2]) { - BLI_assert(p != v); + BLI_assert(out != v); - p[0] = -v[1]; - p[1] = v[0]; + out[0] = -v[1]; + out[1] = v[0]; } -/* Rotate a point p by angle theta around an arbitrary axis r +/** + * Rotate a point \a p by \a angle around an arbitrary unit length \a axis. * http://local.wasp.uwa.edu.au/~pbourke/geometry/ */ -void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle) +void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], const float angle) { const float costheta = cosf(angle); const float sintheta = sinf(angle); @@ -757,17 +762,17 @@ void rotate_normalized_v3_v3v3fl(float r[3], const float p[3], const float axis[ /* double check they are normalized */ BLI_ASSERT_UNIT_V3(axis); - r[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) + - (((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) + - (((1 - costheta) * axis[0] * axis[2] + axis[1] * sintheta) * p[2]); + out[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) + + (((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) + + (((1 - costheta) * axis[0] * axis[2] + axis[1] * sintheta) * p[2]); - r[1] = (((1 - costheta) * axis[0] * axis[1] + axis[2] * sintheta) * p[0]) + - ((costheta + (1 - costheta) * axis[1] * axis[1]) * p[1]) + - (((1 - costheta) * axis[1] * axis[2] - axis[0] * sintheta) * p[2]); + out[1] = (((1 - costheta) * axis[0] * axis[1] + axis[2] * sintheta) * p[0]) + + ((costheta + (1 - costheta) * axis[1] * axis[1]) * p[1]) + + (((1 - costheta) * axis[1] * axis[2] - axis[0] * sintheta) * p[2]); - r[2] = (((1 - costheta) * axis[0] * axis[2] - axis[1] * sintheta) * p[0]) + - (((1 - costheta) * axis[1] * axis[2] + axis[0] * sintheta) * p[1]) + - ((costheta + (1 - costheta) * axis[2] * axis[2]) * p[2]); + out[2] = (((1 - costheta) * axis[0] * axis[2] - axis[1] * sintheta) * p[0]) + + (((1 - costheta) * axis[1] * axis[2] + axis[0] * sintheta) * p[1]) + + ((costheta + (1 - costheta) * axis[2] * axis[2]) * p[2]); } void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle) diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c index 66c568a7ff3..40d9a3da3d9 100644 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@ -46,6 +46,7 @@ #define MULTIPLIER 0x5DEECE66Dll #define MASK 0x0000FFFFFFFFFFFFll +#define MASK_BYTES 2 #define ADDEND 0xB #define LOWSEED 0x330E @@ -107,6 +108,45 @@ BLI_INLINE void rng_step(RNG *rng) rng->X = (MULTIPLIER * rng->X + ADDEND) & MASK; } +void BLI_rng_get_char_n(RNG *rng, char *bytes, size_t bytes_len) +{ + size_t last_len = 0; + size_t trim_len = bytes_len; + +#define RAND_STRIDE (sizeof(rng->X) - MASK_BYTES) + + if (trim_len > RAND_STRIDE) { + last_len = trim_len % RAND_STRIDE; + trim_len = trim_len - last_len; + } + else { + trim_len = 0; + last_len = bytes_len; + } + + const char *data_src = (void *)&(rng->X); + size_t i = 0; + while (i != trim_len) { + BLI_assert(i < trim_len); +#ifdef __BIG_ENDIAN__ + for (size_t j = (RAND_STRIDE + MASK_BYTES) - 1; j != MASK_BYTES - 1; j--) +#else + for (size_t j = 0; j != RAND_STRIDE; j++) +#endif + { + bytes[i++] = data_src[j]; + } + rng_step(rng); + } + if (last_len) { + for (size_t j = 0; j != last_len; j++) { + bytes[i++] = data_src[j]; + } + } + +#undef RAND_STRIDE +} + int BLI_rng_get_int(RNG *rng) { rng_step(rng); diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 3fe888736f0..d6ca7239e39 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -904,7 +904,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3]) } else if (ese->htype == BM_FACE) { BMFace *efa = (BMFace *)ese->ele; - BM_face_calc_plane(efa, r_plane); + BM_face_calc_tangent_auto(efa, r_plane); } } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index 62b29e61d08..79051a2490f 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -286,64 +286,258 @@ float BM_face_calc_perimeter(const BMFace *f) return perimeter; } -void BM_vert_tri_calc_plane(BMVert *verts[3], float r_plane[3]) +/** + * Utility function to calculate the edge which is most different from the other two. + * + * \return The first edge index, where the second vertex is ``(index + 1) % 3``. + */ +static int bm_vert_tri_find_unique_edge(BMVert *verts[3]) { - float lens[3]; + /* find the most 'unique' loop, (greatest difference to others) */ +#if 1 + /* optimized version that avoids sqrt */ float difs[3]; - int order[3] = {0, 1, 2}; + for (int i_prev = 1, i_curr = 2, i_next = 0; + i_next < 3; + i_prev = i_curr, i_curr = i_next++) + { + const float *co = verts[i_curr]->co; + const float *co_other[2] = {verts[i_prev]->co, verts[i_next]->co}; + float proj_dir[3]; + mid_v3_v3v3(proj_dir, co_other[0], co_other[1]); + sub_v3_v3(proj_dir, co); + + float proj_pair[2][3]; + project_v3_v3v3(proj_pair[0], co_other[0], proj_dir); + project_v3_v3v3(proj_pair[1], co_other[1], proj_dir); + difs[i_next] = len_squared_v3v3(proj_pair[0], proj_pair[1]); + } +#else + const float lens[3] = { + len_v3v3(verts[0]->co, verts[1]->co), + len_v3v3(verts[1]->co, verts[2]->co), + len_v3v3(verts[2]->co, verts[0]->co), + }; + const float difs[3] = { + fabsf(lens[1] - lens[2]), + fabsf(lens[2] - lens[0]), + fabsf(lens[0] - lens[1]), + }; +#endif - lens[0] = len_v3v3(verts[0]->co, verts[1]->co); - lens[1] = len_v3v3(verts[1]->co, verts[2]->co); - lens[2] = len_v3v3(verts[2]->co, verts[0]->co); + int order[3] = {0, 1, 2}; + axis_sort_v3(difs, order); - /* find the shortest or the longest loop */ - difs[0] = fabsf(lens[1] - lens[2]); - difs[1] = fabsf(lens[2] - lens[0]); - difs[2] = fabsf(lens[0] - lens[1]); + return order[0]; +} - axis_sort_v3(difs, order); - sub_v3_v3v3(r_plane, verts[order[0]]->co, verts[(order[0] + 1) % 3]->co); +/** + * Calculate a tangent from any 3 vertices. + * + * The tangent aligns to the most *unique* edge + * (the edge most unlike the other two). + * + * \param r_tangent: Calculated unit length tangent (return value). + */ +void BM_vert_tri_calc_tangent_edge(BMVert *verts[3], float r_tangent[3]) +{ + const int index = bm_vert_tri_find_unique_edge(verts); + + sub_v3_v3v3(r_tangent, verts[index]->co, verts[(index + 1) % 3]->co); + + normalize_v3(r_tangent); } /** - * Compute a meaningful direction along the face (use for manipulator axis). - * \note result isnt normalized. + * Calculate a tangent from any 3 vertices, + * + * The tangent follows the center-line formed by the most unique edges center + * and the opposite vertex. + * + * \param r_tangent: Calculated unit length tangent (return value). */ -void BM_face_calc_plane(const BMFace *f, float r_plane[3]) +void BM_vert_tri_calc_tangent_edge_pair(BMVert *verts[3], float r_tangent[3]) +{ + const int index = bm_vert_tri_find_unique_edge(verts); + + const float *v_a = verts[index]->co; + const float *v_b = verts[(index + 1) % 3]->co; + const float *v_other = verts[(index + 2) % 3]->co; + + mid_v3_v3v3(r_tangent, v_a, v_b); + sub_v3_v3v3(r_tangent, v_other, r_tangent); + + normalize_v3(r_tangent); +} + +/** + * Compute the tanget of the face, using the longest edge. + */ +void BM_face_calc_tangent_edge(const BMFace *f, float r_tangent[3]) +{ + const BMLoop *l_long = BM_face_find_longest_loop((BMFace *)f); + + sub_v3_v3v3(r_tangent, l_long->v->co, l_long->next->v->co); + + normalize_v3(r_tangent); + +} + +/** + * Compute the tanget of the face, using the two longest disconected edges. + * + * \param r_tangent: Calculated unit length tangent (return value). + */ +void BM_face_calc_tangent_edge_pair(const BMFace *f, float r_tangent[3]) { if (f->len == 3) { BMVert *verts[3]; BM_face_as_array_vert_tri((BMFace *)f, verts); - BM_vert_tri_calc_plane(verts, r_plane); + BM_vert_tri_calc_tangent_edge_pair(verts, r_tangent); } else if (f->len == 4) { + /* Use longest edge pair */ BMVert *verts[4]; float vec[3], vec_a[3], vec_b[3]; - // BM_iter_as_array(NULL, BM_VERTS_OF_FACE, efa, (void **)verts, 4); BM_face_as_array_vert_quad((BMFace *)f, verts); sub_v3_v3v3(vec_a, verts[3]->co, verts[2]->co); sub_v3_v3v3(vec_b, verts[0]->co, verts[1]->co); - add_v3_v3v3(r_plane, vec_a, vec_b); + add_v3_v3v3(r_tangent, vec_a, vec_b); sub_v3_v3v3(vec_a, verts[0]->co, verts[3]->co); sub_v3_v3v3(vec_b, verts[1]->co, verts[2]->co); add_v3_v3v3(vec, vec_a, vec_b); - /* use the biggest edge length */ - if (len_squared_v3(r_plane) < len_squared_v3(vec)) { - copy_v3_v3(r_plane, vec); + /* use the longest edge length */ + if (len_squared_v3(r_tangent) < len_squared_v3(vec)) { + copy_v3_v3(r_tangent, vec); } } else { - const BMLoop *l_long = BM_face_find_longest_loop((BMFace *)f); + /* For ngons use two longest disconnected edges */ + BMLoop *l_long = BM_face_find_longest_loop((BMFace *)f); + BMLoop *l_long_other = NULL; - sub_v3_v3v3(r_plane, l_long->v->co, l_long->next->v->co); + float len_max_sq = 0.0f; + float vec_a[3], vec_b[3]; + + BMLoop *l_iter = l_long->prev->prev; + BMLoop *l_last = l_long->next; + + do { + const float len_sq = len_squared_v3v3(l_iter->v->co, l_iter->next->v->co); + if (len_sq >= len_max_sq) { + l_long_other = l_iter; + len_max_sq = len_sq; + } + } while ((l_iter = l_iter->prev) != l_last); + + sub_v3_v3v3(vec_a, l_long->next->v->co, l_long->v->co); + sub_v3_v3v3(vec_b, l_long_other->v->co, l_long_other->next->v->co); + add_v3_v3v3(r_tangent, vec_a, vec_b); + + /* Edges may not be opposite side of the ngon, + * this could cause problems for ngons with multiple-aligned edges of the same length. + * Fallback to longest edge. */ + if (UNLIKELY(normalize_v3(r_tangent) == 0.0f)) { + normalize_v3_v3(r_tangent, vec_a); + } } +} - normalize_v3(r_plane); +/** + * Compute the tanget of the face, using the edge farthest away from any vertex in the face. + * + * \param r_tangent: Calculated unit length tangent (return value). + */ +void BM_face_calc_tangent_edge_diagonal(const BMFace *f, float r_tangent[3]) +{ + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + + /* incase of degenerate faces */ + zero_v3(r_tangent); + + /* warning: O(n^2) loop here, take care! */ + float dist_max_sq = 0.0f; + do { + BMLoop *l_iter_other = l_iter->next; + BMLoop *l_iter_last = l_iter->prev; + do { + BLI_assert(!ELEM(l_iter->v->co, l_iter_other->v->co, l_iter_other->next->v->co)); + float co_other[3], vec[3]; + closest_to_line_segment_v3(co_other, l_iter->v->co, l_iter_other->v->co, l_iter_other->next->v->co); + sub_v3_v3v3(vec, l_iter->v->co, co_other); + + const float dist_sq = len_squared_v3(vec); + if (dist_sq > dist_max_sq) { + dist_max_sq = dist_sq; + copy_v3_v3(r_tangent, vec); + } + } while ((l_iter_other = l_iter_other->next) != l_iter_last); + } while ((l_iter = l_iter->next) != l_first); + + normalize_v3(r_tangent); +} + +/** + * Compute the tanget of the face, using longest distance between vertices on the face. + * + * \note The logic is almost identical to #BM_face_calc_tangent_edge_diagonal + */ +void BM_face_calc_tangent_vert_diagonal(const BMFace *f, float r_tangent[3]) +{ + BMLoop *l_iter, *l_first; + + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + + /* incase of degenerate faces */ + zero_v3(r_tangent); + + /* warning: O(n^2) loop here, take care! */ + float dist_max_sq = 0.0f; + do { + BMLoop *l_iter_other = l_iter->next; + do { + float vec[3]; + sub_v3_v3v3(vec, l_iter->v->co, l_iter_other->v->co); + + const float dist_sq = len_squared_v3(vec); + if (dist_sq > dist_max_sq) { + dist_max_sq = dist_sq; + copy_v3_v3(r_tangent, vec); + } + } while ((l_iter_other = l_iter_other->next) != l_iter); + } while ((l_iter = l_iter->next) != l_first); + + normalize_v3(r_tangent); +} + +/** + * Compute a meaningful direction along the face (use for manipulator axis). + * + * \note Callers shouldn't depend on the *exact* method used here. + */ +void BM_face_calc_tangent_auto(const BMFace *f, float r_tangent[3]) +{ + if (f->len == 3) { + /* most 'unique' edge of a triangle */ + BMVert *verts[3]; + BM_face_as_array_vert_tri((BMFace *)f, verts); + BM_vert_tri_calc_tangent_edge(verts, r_tangent); + } + else if (f->len == 4) { + /* longest edge pair of a quad */ + BM_face_calc_tangent_edge_pair((BMFace *)f, r_tangent); + } + else { + /* longest edge of an ngon */ + BM_face_calc_tangent_edge((BMFace *)f, r_tangent); + } } /** diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h index 8f0df81af73..1e50a504875 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.h +++ b/source/blender/bmesh/intern/bmesh_polygon.h @@ -45,7 +45,11 @@ float BM_face_calc_normal_vcos( float BM_face_calc_normal_subset(const BMLoop *l_first, const BMLoop *l_last, float r_no[3]) ATTR_NONNULL(); float BM_face_calc_area(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); float BM_face_calc_perimeter(const BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -void BM_face_calc_plane(const BMFace *f, float r_plane[3]) ATTR_NONNULL(); +void BM_face_calc_tangent_edge(const BMFace *f, float r_plane[3]) ATTR_NONNULL(); +void BM_face_calc_tangent_edge_pair(const BMFace *f, float r_plane[3]) ATTR_NONNULL(); +void BM_face_calc_tangent_edge_diagonal(const BMFace *f, float r_plane[3]) ATTR_NONNULL(); +void BM_face_calc_tangent_vert_diagonal(const BMFace *f, float r_plane[3]) ATTR_NONNULL(); +void BM_face_calc_tangent_auto(const BMFace *f, float r_plane[3]) ATTR_NONNULL(); void BM_face_calc_center_bounds(const BMFace *f, float center[3]) ATTR_NONNULL(); void BM_face_calc_center_mean(const BMFace *f, float center[3]) ATTR_NONNULL(); void BM_face_calc_center_mean_vcos( @@ -90,6 +94,7 @@ void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4]) ATTR_NONNULL(); void BM_face_as_array_loop_tri(BMFace *f, BMLoop *r_loops[3]) ATTR_NONNULL(); void BM_face_as_array_loop_quad(BMFace *f, BMLoop *r_loops[4]) ATTR_NONNULL(); -void BM_vert_tri_calc_plane(BMVert *verts[3], float r_plane[3]); +void BM_vert_tri_calc_tangent_edge(BMVert *verts[3], float r_tangent[3]); +void BM_vert_tri_calc_tangent_edge_pair(BMVert *verts[3], float r_tangent[3]); #endif /* __BMESH_POLYGON_H__ */ diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index a1f40b31fc7..c58b4814726 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -224,22 +224,13 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op) if (v1 == v2) { BMO_elem_flag_enable(bm, e, EDGE_COL); } - else if (!BM_edge_exists(v1, v2)) { - BMEdge *e_new = BM_edge_create(bm, v1, v2, e, BM_CREATE_NOP); - - /* low level selection, not essential but means we can keep - * edge selection valid on auto-merge for example. */ - if ((BM_elem_flag_test(e, BM_ELEM_SELECT) == true) && - (BM_elem_flag_test(e_new, BM_ELEM_SELECT) == false)) - { - BM_elem_flag_disable(e, BM_ELEM_SELECT); - BM_elem_flag_merge_into(e_new, e_new, e); - BM_elem_flag_enable(e_new, BM_ELEM_SELECT); - /* bm->totedgesel remains valid */ - } - else { - BM_elem_flag_merge_into(e_new, e_new, e); + else { + /* always merge flags, even for edges we already created */ + BMEdge *e_new = BM_edge_exists(v1, v2); + if (e_new == NULL) { + e_new = BM_edge_create(bm, v1, v2, e, BM_CREATE_NOP); } + BM_elem_flag_merge(e_new, e); } BMO_elem_flag_enable(bm, e, ELE_DEL); diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index d78b41820b4..72a6a04feec 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -1205,8 +1205,7 @@ void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) qobj = gluNewQuadric(); gluQuadricDrawStyle(qobj, GLU_FILL); - int bound_options = GPU_basic_shader_bound_options(); - GPU_basic_shader_bind(bound_options); + GPU_basic_shader_bind(GPU_basic_shader_bound_options()); gluSphere(qobj, 100.0, 32, 24); gluDeleteQuadric(qobj); @@ -1538,10 +1537,12 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc BLI_rctf_size_x(&rect), BLI_rctf_size_y(&rect)); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE); + for (int a = 0; a < 2; a++) { if (a == 1) { - glLineStipple(3, 0xaaaa); - glEnable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_enable(GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); UI_ThemeColor(TH_SEL_MARKER); } else { @@ -1555,9 +1556,10 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc glVertex2f(0.0f, 10.0f); glEnd(); } + + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); } - glDisable(GL_LINE_STIPPLE); glPopMatrix(); ok = true; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 9a8382b2136..2b4f94a37ef 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -51,6 +51,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_basic_shader.h" + #include "UI_resources.h" #include "UI_view2d.h" @@ -100,10 +102,10 @@ static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline) if (!spline->tot_point) return; - glColor3ub(0, 0, 0); - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0xAAAA); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(1, 0xAAAA); + glColor3ub(0, 0, 0); glBegin(GL_LINES); for (i = 0; i < spline->tot_point; i++) { @@ -121,7 +123,7 @@ static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline) glEnd(); - glDisable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); } #endif @@ -455,7 +457,8 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* case MASK_DT_DASH: default: - glEnable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); #ifdef USE_XOR glEnable(GL_COLOR_LOGIC_OP); @@ -463,7 +466,6 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* #endif mask_color_active_tint(rgb_tmp, rgb_spline, is_active); glColor4ubv(rgb_tmp); - glLineStipple(3, 0xaaaa); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, points); glDrawArrays(draw_method, 0, tot_point); @@ -473,10 +475,10 @@ static void mask_draw_curve_type(const bContext *C, MaskSpline *spline, float (* #endif mask_color_active_tint(rgb_tmp, rgb_black, is_active); glColor4ubv(rgb_tmp); - glLineStipple(3, 0x5555); + GPU_basic_shader_line_stipple(3, 0x5555); glDrawArrays(draw_method, 0, tot_point); - glDisable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); break; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 65857cccb15..67fbd000b64 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -58,6 +58,8 @@ #include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_basic_shader.h" + #include "ED_screen.h" #include "ED_view3d.h" @@ -160,11 +162,11 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - glEnable(GL_LINE_STIPPLE); - glLineStipple(3, 0xAAAA); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); + GPU_basic_shader_line_width(3.0); glColor4ub(0, 0, 0, paint->paint_cursor_col[3]); - glLineWidth(3.0); if (stroke->constrain_line) { sdrawline((int)stroke->last_mouse_position[0], (int)stroke->last_mouse_position[1], stroke->constrained_pos[0], stroke->constrained_pos[1]); @@ -175,7 +177,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) } glColor4ub(255, 255, 255, paint->paint_cursor_col[3]); - glLineWidth(1.0); + GPU_basic_shader_line_width(1.0); if (stroke->constrain_line) { sdrawline((int)stroke->last_mouse_position[0], (int)stroke->last_mouse_position[1], stroke->constrained_pos[0], stroke->constrained_pos[1]); @@ -185,7 +187,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) x, y); } - glDisable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 1c5be3d1fb5..695d04d3850 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -336,8 +336,10 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int /* draw boundary border for frame if stabilization is enabled */ if (sc->flag & SC_SHOW_STABLE && clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) { glColor3f(0.0f, 0.0f, 0.0f); - glLineStipple(3, 0xaaaa); - glEnable(GL_LINE_STIPPLE); + + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); + glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_NOR); @@ -357,7 +359,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int glPopMatrix(); glDisable(GL_COLOR_LOGIC_OP); - glDisable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); } } @@ -627,8 +629,8 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glEnd(); glColor3f(0.0f, 0.0f, 0.0f); - glLineStipple(3, 0xaaaa); - glEnable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); glEnable(GL_COLOR_LOGIC_OP); glLogicOp(GL_NOR); @@ -638,7 +640,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glEnd(); glDisable(GL_COLOR_LOGIC_OP); - glDisable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); } } @@ -647,8 +649,11 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glTranslate2fv(marker_pos); if (tiny) { - glLineStipple(3, 0xaaaa); - glEnable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); + } + else { + GPU_basic_shader_bind_enable(GPU_SHADER_LINE); } if ((track->pat_flag & SELECT) == sel && (sc->flag & SC_SHOW_MARKER_PATTERN)) { @@ -713,8 +718,12 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra glEnd(); } - if (tiny) - glDisable(GL_LINE_STIPPLE); + if (tiny) { + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + } + else { + GPU_basic_shader_bind_disable(GPU_SHADER_LINE); + } glPopMatrix(); } @@ -852,16 +861,12 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo glLineWidth(outline ? 3.0f : 1.0f); - glEnable(GL_LINE_STIPPLE); - glLineStipple(3, 0xaaaa); - glBegin(GL_LINES); glVertex2f(0.0f, 0.0f); glVertex2fv(tilt_ctrl); glEnd(); - glDisable(GL_LINE_STIPPLE); - + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); /* slider to control pattern tilt */ draw_marker_slide_square(tilt_ctrl[0], tilt_ctrl[1], patdx, patdy, outline, px); @@ -1133,11 +1138,14 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane const bool thick = draw_outline && !tiny; if (stipple) { - glLineStipple(3, 0xaaaa); - glEnable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(3, 0xAAAA); + } + else { + GPU_basic_shader_bind_enable(GPU_SHADER_LINE); } - glLineWidth(thick ? 3.0f : 1.0f); + GPU_basic_shader_line_width(thick ? 3.0f : 1.0f); /* Draw rectangle itself. */ glBegin(GL_LINE_LOOP); @@ -1169,8 +1177,12 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane glPopAttrib(); } - if (stipple) - glDisable(GL_LINE_STIPPLE); + if (stipple) { + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + } + else { + GPU_basic_shader_bind_disable(GPU_SHADER_LINE); + } } /* Draw sliders. */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index f6afd7a16e7..08e12134b51 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1629,7 +1629,8 @@ void draw_timeline_seq(const bContext *C, ARegion *ar) // NOTE: the gridlines are currently spaced every 25 frames, which is only fine for 25 fps, but maybe not for 30... UI_view2d_constant_grid_draw(v2d); - if (sseq->draw_flag & SEQ_DRAW_BACKDROP) { + /* Only draw backdrop in pure sequence view. */ + if (sseq->view == SEQ_VIEW_SEQUENCE && sseq->draw_flag & SEQ_DRAW_BACKDROP) { draw_image_seq(C, scene, ar, sseq, scene->r.cfra, 0, false, true); UI_view2d_view_ortho(v2d); } diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c index 7475e8b27fd..48c49f36471 100644 --- a/source/blender/editors/space_sequencer/sequencer_select.c +++ b/source/blender/editors/space_sequencer/sequencer_select.c @@ -943,16 +943,26 @@ void SEQUENCER_OT_select_border(wmOperatorType *ot) /* ****** Selected Grouped ****** */ +enum { + SEQ_SELECT_GROUP_TYPE, + SEQ_SELECT_GROUP_TYPE_BASIC, + SEQ_SELECT_GROUP_TYPE_EFFECT, + SEQ_SELECT_GROUP_DATA, + SEQ_SELECT_GROUP_EFFECT, + SEQ_SELECT_GROUP_EFFECT_LINK, + SEQ_SELECT_GROUP_OVERLAP, +}; + static EnumPropertyItem sequencer_prop_select_grouped_types[] = { - {1, "TYPE", 0, "Type", "Shared strip type"}, - {2, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"}, - {3, "TYPE_EFFECT", 0, "Effect Type", + {SEQ_SELECT_GROUP_TYPE, "TYPE", 0, "Type", "Shared strip type"}, + {SEQ_SELECT_GROUP_TYPE_BASIC, "TYPE_BASIC", 0, "Global Type", "All strips of same basic type (Graphical or Sound)"}, + {SEQ_SELECT_GROUP_TYPE_EFFECT, "TYPE_EFFECT", 0, "Effect Type", "Shared strip effect type (if active strip is not an effect one, select all non-effect strips)"}, - {4, "DATA", 0, "Data", "Shared data (scene, image, sound, etc.)"}, - {5, "EFFECT", 0, "Effect", "Shared effects"}, - {6, "EFFECT_LINK", 0, "Effect/Linked", + {SEQ_SELECT_GROUP_DATA, "DATA", 0, "Data", "Shared data (scene, image, sound, etc.)"}, + {SEQ_SELECT_GROUP_EFFECT, "EFFECT", 0, "Effect", "Shared effects"}, + {SEQ_SELECT_GROUP_EFFECT_LINK, "EFFECT_LINK", 0, "Effect/Linked", "Other strips affected by the active one (sharing some time, and below or effect-assigned)"}, - {7, "OVERLAP", 0, "Overlap", "Overlapping time"}, + {SEQ_SELECT_GROUP_OVERLAP, "OVERLAP", 0, "Overlap", "Overlapping time"}, {0, NULL, 0, NULL, NULL} }; @@ -962,14 +972,16 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = { #define SEQ_USE_DATA(_seq) (ELEM(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) || SEQ_HAS_PATH(_seq)) -static bool select_grouped_type(Editing *ed, Sequence *actseq) +#define SEQ_CHANNEL_CHECK(_seq, _chan) (ELEM((_chan), 0, (_seq)->machine)) + +static bool select_grouped_type(Editing *ed, Sequence *actseq, const int channel) { Sequence *seq; bool changed = false; SEQP_BEGIN (ed, seq) { - if (seq->type == actseq->type) { + if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == actseq->type) { seq->flag |= SELECT; changed = true; } @@ -979,7 +991,7 @@ static bool select_grouped_type(Editing *ed, Sequence *actseq) return changed; } -static bool select_grouped_type_basic(Editing *ed, Sequence *actseq) +static bool select_grouped_type_basic(Editing *ed, Sequence *actseq, const int channel) { Sequence *seq; bool changed = false; @@ -987,7 +999,7 @@ static bool select_grouped_type_basic(Editing *ed, Sequence *actseq) SEQP_BEGIN (ed, seq) { - if (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq)) { + if (SEQ_CHANNEL_CHECK(seq, channel) && (is_sound ? SEQ_IS_SOUND(seq) : !SEQ_IS_SOUND(seq))) { seq->flag |= SELECT; changed = true; } @@ -997,7 +1009,7 @@ static bool select_grouped_type_basic(Editing *ed, Sequence *actseq) return changed; } -static bool select_grouped_type_effect(Editing *ed, Sequence *actseq) +static bool select_grouped_type_effect(Editing *ed, Sequence *actseq, const int channel) { Sequence *seq; bool changed = false; @@ -1005,7 +1017,7 @@ static bool select_grouped_type_effect(Editing *ed, Sequence *actseq) SEQP_BEGIN (ed, seq) { - if (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq)) { + if (SEQ_CHANNEL_CHECK(seq, channel) && (is_effect ? SEQ_IS_EFFECT(seq) : !SEQ_IS_EFFECT(seq))) { seq->flag |= SELECT; changed = true; } @@ -1015,7 +1027,7 @@ static bool select_grouped_type_effect(Editing *ed, Sequence *actseq) return changed; } -static bool select_grouped_data(Editing *ed, Sequence *actseq) +static bool select_grouped_data(Editing *ed, Sequence *actseq, const int channel) { Sequence *seq; bool changed = false; @@ -1027,7 +1039,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq) if (SEQ_HAS_PATH(actseq) && dir) { SEQP_BEGIN (ed, seq) { - if (SEQ_HAS_PATH(seq) && seq->strip && STREQ(seq->strip->dir, dir)) { + if (SEQ_CHANNEL_CHECK(seq, channel) && SEQ_HAS_PATH(seq) && seq->strip && STREQ(seq->strip->dir, dir)) { seq->flag |= SELECT; changed = true; } @@ -1038,7 +1050,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq) Scene *sce = actseq->scene; SEQP_BEGIN (ed, seq) { - if (seq->type == SEQ_TYPE_SCENE && seq->scene == sce) { + if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_SCENE && seq->scene == sce) { seq->flag |= SELECT; changed = true; } @@ -1049,7 +1061,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq) MovieClip *clip = actseq->clip; SEQP_BEGIN (ed, seq) { - if (seq->type == SEQ_TYPE_MOVIECLIP && seq->clip == clip) { + if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_MOVIECLIP && seq->clip == clip) { seq->flag |= SELECT; changed = true; } @@ -1060,7 +1072,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq) struct Mask *mask = actseq->mask; SEQP_BEGIN (ed, seq) { - if (seq->type == SEQ_TYPE_MASK && seq->mask == mask) { + if (SEQ_CHANNEL_CHECK(seq, channel) && seq->type == SEQ_TYPE_MASK && seq->mask == mask) { seq->flag |= SELECT; changed = true; } @@ -1071,7 +1083,7 @@ static bool select_grouped_data(Editing *ed, Sequence *actseq) return changed; } -static bool select_grouped_effect(Editing *ed, Sequence *actseq) +static bool select_grouped_effect(Editing *ed, Sequence *actseq, const int channel) { Sequence *seq; bool changed = false; @@ -1083,7 +1095,9 @@ static bool select_grouped_effect(Editing *ed, Sequence *actseq) SEQP_BEGIN (ed, seq) { - if ((seq->type & SEQ_TYPE_EFFECT) && ELEM(actseq, seq->seq1, seq->seq2, seq->seq3)) { + if (SEQ_CHANNEL_CHECK(seq, channel) && (seq->type & SEQ_TYPE_EFFECT) && + ELEM(actseq, seq->seq1, seq->seq2, seq->seq3)) + { effects[seq->type] = true; } } @@ -1091,7 +1105,7 @@ static bool select_grouped_effect(Editing *ed, Sequence *actseq) SEQP_BEGIN (ed, seq) { - if (effects[seq->type]) { + if (SEQ_CHANNEL_CHECK(seq, channel) && effects[seq->type]) { if (seq->seq1) seq->seq1->flag |= SELECT; if (seq->seq2) seq->seq2->flag |= SELECT; if (seq->seq3) seq->seq3->flag |= SELECT; @@ -1120,7 +1134,7 @@ static bool select_grouped_time_overlap(Editing *ed, Sequence *actseq) return changed; } -static bool select_grouped_effect_link(Editing *ed, Sequence *actseq) +static bool select_grouped_effect_link(Editing *ed, Sequence *actseq, const int channel) { Sequence *seq = NULL; bool changed = false; @@ -1144,7 +1158,8 @@ static bool select_grouped_effect_link(Editing *ed, Sequence *actseq) /* Ignore all seqs already selected! */ /* Ignore all seqs not sharing some time with active one. */ /* Ignore all seqs of incompatible types (audio vs video). */ - if ((seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp) || + if (!SEQ_CHANNEL_CHECK(seq, channel) || + (seq->flag & SELECT) || (seq->startdisp >= enddisp) || (seq->enddisp < startdisp) || (!is_audio && SEQ_IS_SOUND(seq)) || (is_audio && !((seq->type == SEQ_TYPE_META) || SEQ_IS_SOUND(seq)))) { @@ -1190,17 +1205,19 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); Sequence *seq, *actseq = BKE_sequencer_active_get(scene); - int type = RNA_enum_get(op->ptr, "type"); - bool changed = false, extend; - extend = RNA_boolean_get(op->ptr, "extend"); + const int type = RNA_enum_get(op->ptr, "type"); + const int channel = RNA_boolean_get(op->ptr, "use_active_channel") ? actseq->machine : 0; + const bool extend = RNA_boolean_get(op->ptr, "extend"); + + bool changed = false; if (actseq == NULL) { BKE_report(op->reports, RPT_ERROR, "No active sequence!"); return OPERATOR_CANCELLED; } - if (extend == 0) { + if (!extend) { SEQP_BEGIN (ed, seq) { seq->flag &= ~SELECT; @@ -1209,13 +1226,32 @@ static int sequencer_select_grouped_exec(bContext *C, wmOperator *op) SEQ_END; } - if (type == 1) changed |= select_grouped_type(ed, actseq); - else if (type == 2) changed |= select_grouped_type_basic(ed, actseq); - else if (type == 3) changed |= select_grouped_type_effect(ed, actseq); - else if (type == 4) changed |= select_grouped_data(ed, actseq); - else if (type == 5) changed |= select_grouped_effect(ed, actseq); - else if (type == 6) changed |= select_grouped_effect_link(ed, actseq); - else if (type == 7) changed |= select_grouped_time_overlap(ed, actseq); + switch (type) { + case SEQ_SELECT_GROUP_TYPE: + changed |= select_grouped_type(ed, actseq, channel); + break; + case SEQ_SELECT_GROUP_TYPE_BASIC: + changed |= select_grouped_type_basic(ed, actseq, channel); + break; + case SEQ_SELECT_GROUP_TYPE_EFFECT: + changed |= select_grouped_type_effect(ed, actseq, channel); + break; + case SEQ_SELECT_GROUP_DATA: + changed |= select_grouped_data(ed, actseq, channel); + break; + case SEQ_SELECT_GROUP_EFFECT: + changed |= select_grouped_effect(ed, actseq, channel); + break; + case SEQ_SELECT_GROUP_EFFECT_LINK: + changed |= select_grouped_effect_link(ed, actseq, channel); + break; + case SEQ_SELECT_GROUP_OVERLAP: + changed |= select_grouped_time_overlap(ed, actseq); + break; + default: + BLI_assert(0); + break; + } if (changed) { WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER | NA_SELECTED, scene); @@ -1241,7 +1277,9 @@ void SEQUENCER_OT_select_grouped(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); ot->prop = RNA_def_enum(ot->srna, "type", sequencer_prop_select_grouped_types, 0, "Type", ""); + RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); + RNA_def_boolean(ot->srna, "use_active_channel", false, "Same Channel", + "Only consider strips on the same channel as the active one"); } diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index d8364011036..ee82a4c5072 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -1310,8 +1310,8 @@ void draw_mesh_paint_weight_edges(RegionView3D *rv3d, DerivedMesh *dm, } glColor4ub(255, 255, 255, 96); - glEnable(GL_LINE_STIPPLE); - glLineStipple(1, 0xAAAA); + GPU_basic_shader_bind_enable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); + GPU_basic_shader_line_stipple(1, 0xAAAA); dm->drawMappedEdges(dm, (DMSetDrawOptions)edgemask_cb, user_data); @@ -1323,7 +1323,7 @@ void draw_mesh_paint_weight_edges(RegionView3D *rv3d, DerivedMesh *dm, glEnable(GL_DEPTH_TEST); } - glDisable(GL_LINE_STIPPLE); + GPU_basic_shader_bind_disable(GPU_SHADER_LINE | GPU_SHADER_STIPPLE); if (use_alpha) { glDisable(GL_BLEND); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 0e012b45cad..64b12498ae2 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -4056,6 +4056,10 @@ void view3d_main_region_draw(const bContext *C, ARegion *ar) view3d_main_region_draw_info(C, scene, ar, v3d, grid_unit, render_border); v3d->flag |= V3D_INVALID_BACKBUF; + + BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_transp)); + BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_xray)); + BLI_assert(BLI_listbase_is_empty(&v3d->afterdraw_xraytransp)); } #ifdef DEBUG_DRAW diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 137f7c1656a..b7f8011725f 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5704,6 +5704,7 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t) BMEditMesh *em = BKE_editmesh_from_object(t->obedit); BMesh *bm = em->bm; char hflag; + bool has_face_sel = (bm->totfacesel != 0); if (t->flag & T_MIRROR) { TransData *td; @@ -5727,8 +5728,10 @@ static void special_aftertrans_update__mesh(bContext *UNUSED(C), TransInfo *t) EDBM_automerge(t->scene, t->obedit, true, hflag); - if ((em->selectmode & SCE_SELECT_VERTEX) == 0) { - EDBM_select_flush(em); + /* Special case, this is needed or faces won't re-select. + * Flush selected edges to faces. */ + if (has_face_sel && (em->selectmode == SCE_SELECT_FACE)) { + EDBM_selectmode_flush_ex(em, SCE_SELECT_EDGE); } } } diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 719da14cb73..1d6a392aae6 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -636,7 +636,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) { - BM_face_calc_plane(efa, vec); + BM_face_calc_tangent_auto(efa, vec); add_v3_v3(normal, efa->no); add_v3_v3(plane, vec); } @@ -690,7 +690,7 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3 sub_v3_v3v3(plane, v_pair[0]->co, v_pair[1]->co); } else { - BM_vert_tri_calc_plane(v_tri, plane); + BM_vert_tri_calc_tangent_edge(v_tri, plane); } } else { diff --git a/source/blender/gpu/GPU_basic_shader.h b/source/blender/gpu/GPU_basic_shader.h index 6c78aec2ec7..d9bf3d1ced3 100644 --- a/source/blender/gpu/GPU_basic_shader.h +++ b/source/blender/gpu/GPU_basic_shader.h @@ -76,6 +76,9 @@ void GPU_basic_shaders_init(void); void GPU_basic_shaders_exit(void); void GPU_basic_shader_bind(int options); +void GPU_basic_shader_bind_enable(int options); +void GPU_basic_shader_bind_disable(int options); + int GPU_basic_shader_bound_options(void); /* Only use for small blocks of code that don't support glsl shader. */ diff --git a/source/blender/gpu/intern/gpu_basic_shader.c b/source/blender/gpu/intern/gpu_basic_shader.c index c5a2d07bdc8..a2b89239344 100644 --- a/source/blender/gpu/intern/gpu_basic_shader.c +++ b/source/blender/gpu/intern/gpu_basic_shader.c @@ -502,17 +502,18 @@ void GPU_basic_shader_bind(int options) else if ((bound_options & GPU_SHADER_LINE) && (bound_options & GPU_SHADER_STIPPLE)) { glDisable(GL_LINE_STIPPLE); } - else { - if (options & GPU_SHADER_STIPPLE) - glEnable(GL_POLYGON_STIPPLE); - else if (bound_options & GPU_SHADER_STIPPLE) - glDisable(GL_POLYGON_STIPPLE); + + if (((options & GPU_SHADER_LINE) == 0) && (options & GPU_SHADER_STIPPLE)) { + glEnable(GL_POLYGON_STIPPLE); + } + else if (((bound_options & GPU_SHADER_LINE) == 0) && (bound_options & GPU_SHADER_STIPPLE)) { + glDisable(GL_POLYGON_STIPPLE); } if (options & GPU_SHADER_FLAT_NORMAL) { glShadeModel(GL_FLAT); } - else { + else if (bound_options & GPU_SHADER_FLAT_NORMAL) { glShadeModel(GL_SMOOTH); } } @@ -520,6 +521,16 @@ void GPU_basic_shader_bind(int options) GPU_MATERIAL_STATE.bound_options = options; } +void GPU_basic_shader_bind_enable(int options) +{ + GPU_basic_shader_bind(GPU_MATERIAL_STATE.bound_options | options); +} + +void GPU_basic_shader_bind_disable(int options) +{ + GPU_basic_shader_bind(GPU_MATERIAL_STATE.bound_options & ~options); +} + int GPU_basic_shader_bound_options(void) { /* ideally this should disappear, anything that uses this is making fragile diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 35bfc687052..36d297fb9fe 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -1843,15 +1843,15 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial, if (buffers->vert_buf) { char *base = NULL; char *index_base = NULL; - int bound_options = 0; + /* weak inspection of bound options, should not be necessary ideally */ + const int bound_options_old = GPU_basic_shader_bound_options(); + int bound_options_new = 0; glEnableClientState(GL_VERTEX_ARRAY); if (!wireframe) { glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_COLOR_ARRAY); - /* weak inspection of bound options, should not be necessary ideally */ - bound_options = GPU_basic_shader_bound_options(); - GPU_basic_shader_bind(bound_options | GPU_SHADER_USE_COLOR); + bound_options_new |= GPU_SHADER_USE_COLOR; } GPU_buffer_bind(buffers->vert_buf, GPU_BINDING_ARRAY); @@ -1867,9 +1867,13 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial, glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); } else { - bound_options = GPU_basic_shader_bound_options(); - GPU_basic_shader_bind(bound_options | ((buffers->smooth || buffers->face_indices_len) ? - 0 : GPU_SHADER_FLAT_NORMAL)); + if ((buffers->smooth == false) && (buffers->face_indices_len == 0)) { + bound_options_new |= GPU_SHADER_FLAT_NORMAL; + } + } + + if (bound_options_new & ~bound_options_old) { + GPU_basic_shader_bind(bound_options_old | bound_options_new); } if (buffers->tot_quad) { @@ -1944,7 +1948,10 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial, if (!wireframe) { glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_COLOR_ARRAY); - GPU_basic_shader_bind(bound_options); + } + + if (bound_options_new & ~bound_options_old) { + GPU_basic_shader_bind(bound_options_old); } } } diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index a0722af522b..fe4360d1e3b 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1803,6 +1803,82 @@ static PyObject *bpy_bmface_calc_perimeter(BPy_BMFace *self) } +PyDoc_STRVAR(bpy_bmface_calc_tangent_edge_doc, +".. method:: calc_tangent_edge()\n" +"\n" +" Return face tangent based on longest edge.\n" +"\n" +" :return: a normalized vector.\n" +" :rtype: :class:`mathutils.Vector`\n" +); +static PyObject *bpy_bmface_calc_tangent_edge(BPy_BMFace *self) +{ + float tangent[3]; + + BPY_BM_CHECK_OBJ(self); + BM_face_calc_tangent_edge(self->f, tangent); + return Vector_CreatePyObject(tangent, 3, NULL); +} + + +PyDoc_STRVAR(bpy_bmface_calc_tangent_edge_pair_doc, +".. method:: calc_tangent_edge_pair()\n" +"\n" +" Return face tangent based on the two longest disconected edges.\n" +"\n" +" - Tris: Use the edge pair with the most similar lengths.\n" +" - Quads: Use the longest edge pair.\n" +" - NGons: Use the two longest disconnected edges.\n" +"\n" +" :return: a normalized vector.\n" +" :rtype: :class:`mathutils.Vector`\n" +); +static PyObject *bpy_bmface_calc_tangent_edge_pair(BPy_BMFace *self) +{ + float tangent[3]; + + BPY_BM_CHECK_OBJ(self); + BM_face_calc_tangent_edge_pair(self->f, tangent); + return Vector_CreatePyObject(tangent, 3, NULL); +} + + +PyDoc_STRVAR(bpy_bmface_calc_tangent_edge_diagonal_doc, +".. method:: calc_tangent_edge_diagonal()\n" +"\n" +" Return face tangent based on the edge farthest from any vertex.\n" +"\n" +" :return: a normalized vector.\n" +" :rtype: :class:`mathutils.Vector`\n" +); +static PyObject *bpy_bmface_calc_tangent_edge_diagonal(BPy_BMFace *self) +{ + float tangent[3]; + + BPY_BM_CHECK_OBJ(self); + BM_face_calc_tangent_edge_diagonal(self->f, tangent); + return Vector_CreatePyObject(tangent, 3, NULL); +} + + +PyDoc_STRVAR(bpy_bmface_calc_tangent_vert_diagonal_doc, +".. method:: calc_tangent_vert_diagonal()\n" +"\n" +" Return face tangent based on the two most distent vertices.\n" +"\n" +" :return: a normalized vector.\n" +" :rtype: :class:`mathutils.Vector`\n" +); +static PyObject *bpy_bmface_calc_tangent_vert_diagonal(BPy_BMFace *self) +{ + float tangent[3]; + + BPY_BM_CHECK_OBJ(self); + BM_face_calc_tangent_vert_diagonal(self->f, tangent); + return Vector_CreatePyObject(tangent, 3, NULL); +} + + PyDoc_STRVAR(bpy_bmface_calc_center_mean_doc, ".. method:: calc_center_median()\n" "\n" @@ -2702,6 +2778,10 @@ static struct PyMethodDef bpy_bmface_methods[] = { {"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc}, {"calc_perimeter", (PyCFunction)bpy_bmface_calc_perimeter, METH_NOARGS, bpy_bmface_calc_perimeter_doc}, + {"calc_tangent_edge", (PyCFunction)bpy_bmface_calc_tangent_edge, METH_NOARGS, bpy_bmface_calc_tangent_edge_doc}, + {"calc_tangent_edge_pair", (PyCFunction)bpy_bmface_calc_tangent_edge_pair, METH_NOARGS, bpy_bmface_calc_tangent_edge_pair_doc}, + {"calc_tangent_edge_diagonal", (PyCFunction)bpy_bmface_calc_tangent_edge_diagonal, METH_NOARGS, bpy_bmface_calc_tangent_edge_diagonal_doc}, + {"calc_tangent_vert_diagonal", (PyCFunction)bpy_bmface_calc_tangent_vert_diagonal, METH_NOARGS, bpy_bmface_calc_tangent_vert_diagonal_doc}, {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc}, {"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_mean_weighted, METH_NOARGS, bpy_bmface_calc_center_mean_weighted_doc}, {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc}, diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt index 6f32d50c2fe..206007b8d8b 100644 --- a/source/blenderplayer/CMakeLists.txt +++ b/source/blenderplayer/CMakeLists.txt @@ -215,6 +215,14 @@ endif() list(APPEND BLENDER_SORTED_LIBS bf_intern_locale) endif() + if(WITH_GAMEENGINE_DECKLINK) + list(APPEND BLENDER_SORTED_LIBS bf_intern_decklink) + endif() + + if(WIN32) + list(APPEND BLENDER_SORTED_LIBS bf_intern_gpudirect) + endif() + if(WITH_OPENSUBDIV) list(APPEND BLENDER_SORTED_LIBS bf_intern_opensubdiv) endif() diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index c5fc55a8e68..91683f4d6e7 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -341,6 +341,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c ketsjiengine->SetUseFixedTime(usefixed); ketsjiengine->SetTimingDisplay(frameRate, profile, properties); ketsjiengine->SetRestrictAnimationFPS(restrictAnimFPS); + ketsjiengine->SetRender(true); KX_KetsjiEngine::SetExitKey(ConvertKeyCode(startscene->gm.exitkey)); //set the global settings (carried over if restart/load new files) diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp index f0a7bd47ca3..1b52c61b816 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp @@ -301,7 +301,7 @@ bool GPG_Application::startScreenSaverFullScreen( const int stereoMode, const GHOST_TUns16 samples) { - bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode, samples); + bool ret = startFullScreen(width, height, bpp, frequency, stereoVisual, stereoMode, 0, samples); if (ret) { HWND ghost_hwnd = findGhostWindowHWND(m_mainWindow); @@ -325,6 +325,7 @@ bool GPG_Application::startWindow( int windowHeight, const bool stereoVisual, const int stereoMode, + const int alphaBackground, const GHOST_TUns16 samples) { GHOST_GLSettings glSettings = {0}; @@ -333,6 +334,8 @@ bool GPG_Application::startWindow( //STR_String title ("Blender Player - GHOST"); if (stereoVisual) glSettings.flags |= GHOST_glStereoVisual; + if (alphaBackground) + glSettings.flags |= GHOST_glAlphaBackground; glSettings.numOfAASamples = samples; m_mainWindow = fSystem->createWindow(title, windowLeft, windowTop, windowWidth, windowHeight, GHOST_kWindowStateNormal, @@ -360,6 +363,7 @@ bool GPG_Application::startEmbeddedWindow( const GHOST_TEmbedderWindowID parentWindow, const bool stereoVisual, const int stereoMode, + const int alphaBackground, const GHOST_TUns16 samples) { GHOST_TWindowState state = GHOST_kWindowStateNormal; @@ -367,6 +371,8 @@ bool GPG_Application::startEmbeddedWindow( if (stereoVisual) glSettings.flags |= GHOST_glStereoVisual; + if (alphaBackground) + glSettings.flags |= GHOST_glAlphaBackground; glSettings.numOfAASamples = samples; if (parentWindow != 0) @@ -394,6 +400,7 @@ bool GPG_Application::startFullScreen( int bpp,int frequency, const bool stereoVisual, const int stereoMode, + const int alphaBackground, const GHOST_TUns16 samples, bool useDesktop) { @@ -407,7 +414,7 @@ bool GPG_Application::startFullScreen( setting.bpp = bpp; setting.frequency = frequency; - fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual, samples); + fSystem->beginFullScreen(setting, &m_mainWindow, stereoVisual, alphaBackground, samples); m_mainWindow->setCursorVisibility(false); /* note that X11 ignores this (it uses a window internally for fullscreen) */ m_mainWindow->setState(GHOST_kWindowStateFullScreen); @@ -671,6 +678,7 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, const int stereoMode) //set the global settings (carried over if restart/load new files) m_ketsjiengine->SetGlobalSettings(m_globalSettings); + m_ketsjiengine->SetRender(true); m_engineInitialized = true; } diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.h b/source/gameengine/GamePlayer/ghost/GPG_Application.h index b6f545c2de8..e757cc10e32 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_Application.h +++ b/source/gameengine/GamePlayer/ghost/GPG_Application.h @@ -65,13 +65,13 @@ public: bool startWindow(STR_String& title, int windowLeft, int windowTop, int windowWidth, int windowHeight, - const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); + const bool stereoVisual, const int stereoMode, const int alphaBackground=0, const GHOST_TUns16 samples=0); bool startFullScreen(int width, int height, int bpp, int frequency, - const bool stereoVisual, const int stereoMode, + const bool stereoVisual, const int stereoMode, const int alphaBackground = 0, const GHOST_TUns16 samples=0, bool useDesktop=false); bool startEmbeddedWindow(STR_String& title, const GHOST_TEmbedderWindowID parent_window, - const bool stereoVisual, const int stereoMode, const GHOST_TUns16 samples=0); + const bool stereoVisual, const int stereoMode, const int alphaBackground=0, const GHOST_TUns16 samples=0); #ifdef WIN32 bool startScreenSaverFullScreen(int width, int height, int bpp, int frequency, diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp index ac2e4dfa563..30ad5b37777 100644 --- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp +++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp @@ -444,6 +444,7 @@ int main( int validArguments=0; bool samplesParFound = false; GHOST_TUns16 aasamples = 0; + int alphaBackground = 0; #ifdef WIN32 char **argv; @@ -838,6 +839,12 @@ int main( } break; } + case 'a': // allow window to blend with display background + { + i++; + alphaBackground = 1; + break; + } default: //not recognized { printf("Unknown argument: %s\n", argv[i++]); @@ -1041,7 +1048,7 @@ int main( #endif { app.startFullScreen(fullScreenWidth, fullScreenHeight, fullScreenBpp, fullScreenFrequency, - stereoWindow, stereomode, aasamples, (scene->gm.playerflag & GAME_PLAYER_DESKTOP_RESOLUTION)); + stereoWindow, stereomode, alphaBackground, aasamples, (scene->gm.playerflag & GAME_PLAYER_DESKTOP_RESOLUTION)); } } else @@ -1088,7 +1095,7 @@ int main( app.startEmbeddedWindow(title, parentWindow, stereoWindow, stereomode, aasamples); else app.startWindow(title, windowLeft, windowTop, windowWidth, windowHeight, - stereoWindow, stereomode, aasamples); + stereoWindow, stereomode, alphaBackground, aasamples); if (SYS_GetCommandLineInt(syshandle, "nomipmap", 0)) { GPU_set_mipmap(0); diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 6613780a0f8..72815cadc70 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -32,6 +32,7 @@ #include "MT_Matrix4x4.h" #include "MT_Matrix3x3.h" #include "KX_PyMath.h" +#include "KX_PythonInit.h" #include "MEM_guardedalloc.h" #include "RAS_MeshObject.h" @@ -67,15 +68,16 @@ BL_Uniform::~BL_Uniform() #endif } -void BL_Uniform::Apply(class BL_Shader *shader) +bool BL_Uniform::Apply(class BL_Shader *shader) { #ifdef SORT_UNIFORMS + RAS_IRasterizer *ras; MT_assert(mType > UNI_NONE && mType < UNI_MAX && mData); - if (!mDirty) { - return; - } + if (!mDirty) + return false; + mDirty = false; switch (mType) { case UNI_FLOAT: { @@ -83,6 +85,15 @@ void BL_Uniform::Apply(class BL_Shader *shader) glUniform1fARB(mLoc, (GLfloat)*f); break; } + case UNI_FLOAT_EYE: + { + float *f = (float*)mData; + ras = KX_GetActiveEngine()->GetRasterizer(); + *f = (ras->GetEye() == RAS_IRasterizer::RAS_STEREO_LEFTEYE) ? 0.0f : 0.5f; + glUniform1fARB(mLoc, (GLfloat)*f); + mDirty = (ras->Stereo()) ? true : false; + break; + } case UNI_INT: { int *f = (int *)mData; @@ -138,7 +149,7 @@ void BL_Uniform::Apply(class BL_Shader *shader) break; } } - mDirty = false; + return mDirty; #endif } @@ -274,11 +285,10 @@ void BL_Shader::ApplyShader() return; } - for (unsigned int i = 0; i < mUniforms.size(); i++) { - mUniforms[i]->Apply(this); - } - mDirty = false; + for (unsigned int i=0; i<mUniforms.size(); i++) { + mDirty |= mUniforms[i]->Apply(this); + } #endif } @@ -314,64 +324,70 @@ bool BL_Shader::LinkProgram() return false; } - // -- vertex shader ------------------ - tmpVert = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); - glShaderSourceARB(tmpVert, 1, (const char **)&vertProg, 0); - glCompileShaderARB(tmpVert); - glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint *)&vertlen); - - // print info if any - if (vertlen > 0 && vertlen < MAX_LOG_LEN) { - logInf = (char *)MEM_mallocN(vertlen, "vert-log"); - glGetInfoLogARB(tmpVert, vertlen, (GLsizei *)&char_len, logInf); - - if (char_len > 0) { - spit("---- Vertex Shader Error ----"); - spit(logInf); + if (vertProg[0] != 0) { + // -- vertex shader ------------------ + tmpVert = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + glShaderSourceARB(tmpVert, 1, (const char**)&vertProg, 0); + glCompileShaderARB(tmpVert); + glGetObjectParameterivARB(tmpVert, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*)&vertlen); + + // print info if any + if (vertlen > 0 && vertlen < MAX_LOG_LEN) { + logInf = (char*)MEM_mallocN(vertlen, "vert-log"); + glGetInfoLogARB(tmpVert, vertlen, (GLsizei*)&char_len, logInf); + if (char_len > 0) { + spit("---- Vertex Shader Error ----"); + spit(logInf); + } + MEM_freeN(logInf); + logInf = 0; + } + // check for compile errors + glGetObjectParameterivARB(tmpVert, GL_OBJECT_COMPILE_STATUS_ARB, (GLint*)&vertstatus); + if (!vertstatus) { + spit("---- Vertex shader failed to compile ----"); + goto programError; } - - MEM_freeN(logInf); - logInf = 0; - } - - // check for compile errors - glGetObjectParameterivARB(tmpVert, GL_OBJECT_COMPILE_STATUS_ARB, (GLint *)&vertstatus); - if (!vertstatus) { - spit("---- Vertex shader failed to compile ----"); - goto programError; } - // -- fragment shader ---------------- - tmpFrag = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); - glShaderSourceARB(tmpFrag, 1, (const char **)&fragProg, 0); - glCompileShaderARB(tmpFrag); - glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint *)&fraglen); - - if (fraglen > 0 && fraglen < MAX_LOG_LEN) { - logInf = (char *)MEM_mallocN(fraglen, "frag-log"); - glGetInfoLogARB(tmpFrag, fraglen, (GLsizei *)&char_len, logInf); - - if (char_len > 0) { - spit("---- Fragment Shader Error ----"); - spit(logInf); + if (fragProg[0] != 0) { + // -- fragment shader ---------------- + tmpFrag = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + glShaderSourceARB(tmpFrag, 1, (const char**)&fragProg, 0); + glCompileShaderARB(tmpFrag); + glGetObjectParameterivARB(tmpFrag, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint*)&fraglen); + if (fraglen > 0 && fraglen < MAX_LOG_LEN) { + logInf = (char*)MEM_mallocN(fraglen, "frag-log"); + glGetInfoLogARB(tmpFrag, fraglen, (GLsizei*)&char_len, logInf); + if (char_len > 0) { + spit("---- Fragment Shader Error ----"); + spit(logInf); + } + MEM_freeN(logInf); + logInf = 0; } - MEM_freeN(logInf); - logInf = 0; + glGetObjectParameterivARB(tmpFrag, GL_OBJECT_COMPILE_STATUS_ARB, (GLint*)&fragstatus); + if (!fragstatus) { + spit("---- Fragment shader failed to compile ----"); + goto programError; + } } - - glGetObjectParameterivARB(tmpFrag, GL_OBJECT_COMPILE_STATUS_ARB, (GLint *)&fragstatus); - - if (!fragstatus) { - spit("---- Fragment shader failed to compile ----"); + + if (!tmpFrag && !tmpVert) { + spit("---- No shader given ----"); goto programError; } // -- program ------------------------ // set compiled vert/frag shader & link tmpProg = glCreateProgramObjectARB(); - glAttachObjectARB(tmpProg, tmpVert); - glAttachObjectARB(tmpProg, tmpFrag); + if (tmpVert) { + glAttachObjectARB(tmpProg, tmpVert); + } + if (tmpFrag) { + glAttachObjectARB(tmpProg, tmpFrag); + } glLinkProgramARB(tmpProg); glGetObjectParameterivARB(tmpProg, GL_OBJECT_INFO_LOG_LENGTH_ARB, (GLint *)&proglen); glGetObjectParameterivARB(tmpProg, GL_OBJECT_LINK_STATUS_ARB, (GLint *)&progstatus); @@ -396,8 +412,12 @@ bool BL_Shader::LinkProgram() // set mShader = tmpProg; - glDeleteObjectARB(tmpVert); - glDeleteObjectARB(tmpFrag); + if (tmpVert) { + glDeleteObjectARB(tmpVert); + } + if (tmpFrag) { + glDeleteObjectARB(tmpFrag); + } mOk = 1; mError = 0; return true; @@ -748,6 +768,7 @@ PyMethodDef BL_Shader::Methods[] = { KX_PYMETHODTABLE(BL_Shader, validate), // access functions KX_PYMETHODTABLE(BL_Shader, isValid), + KX_PYMETHODTABLE(BL_Shader, setUniformEyef), KX_PYMETHODTABLE(BL_Shader, setUniform1f), KX_PYMETHODTABLE(BL_Shader, setUniform2f), KX_PYMETHODTABLE(BL_Shader, setUniform3f), @@ -1019,6 +1040,27 @@ KX_PYMETHODDEF_DOC(BL_Shader, setUniform4f, "setUniform4f(name, fx,fy,fz, fw) ") return NULL; } +KX_PYMETHODDEF_DOC(BL_Shader, setUniformEyef, "setUniformEyef(name)") +{ + if (mError) { + Py_RETURN_NONE; + } + const char *uniform; + float value = 0.0f; + if (PyArg_ParseTuple(args, "s:setUniformEyef", &uniform)) { + int loc = GetUniformLocation(uniform); + if (loc != -1) { +#ifdef SORT_UNIFORMS + SetUniformfv(loc, BL_Uniform::UNI_FLOAT_EYE, &value, sizeof(float)); +#else + SetUniform(loc, (int)value); +#endif + } + Py_RETURN_NONE; + } + return NULL; +} + KX_PYMETHODDEF_DOC(BL_Shader, setUniform1i, "setUniform1i(name, ix)") { if (mError) { diff --git a/source/gameengine/Ketsji/BL_Shader.h b/source/gameengine/Ketsji/BL_Shader.h index aef4b42a85a..5de715d67d4 100644 --- a/source/gameengine/Ketsji/BL_Shader.h +++ b/source/gameengine/Ketsji/BL_Shader.h @@ -64,10 +64,11 @@ public: UNI_FLOAT4, UNI_MAT3, UNI_MAT4, + UNI_FLOAT_EYE, UNI_MAX }; - void Apply(class BL_Shader *shader); + bool Apply(class BL_Shader *shader); void SetData(int location, int type, bool transpose = false); int GetLocation() { return mLoc; } void *getData() { return mData; } @@ -226,6 +227,7 @@ public: KX_PYMETHOD_DOC(BL_Shader, setUniform3i); KX_PYMETHOD_DOC(BL_Shader, setUniform2i); KX_PYMETHOD_DOC(BL_Shader, setUniform1i); + KX_PYMETHOD_DOC(BL_Shader, setUniformEyef); KX_PYMETHOD_DOC(BL_Shader, setUniformfv); KX_PYMETHOD_DOC(BL_Shader, setUniformiv); KX_PYMETHOD_DOC(BL_Shader, setUniformMatrix4); diff --git a/source/gameengine/Ketsji/KX_Dome.cpp b/source/gameengine/Ketsji/KX_Dome.cpp index 6585b9dc831..d08372e47d4 100644 --- a/source/gameengine/Ketsji/KX_Dome.cpp +++ b/source/gameengine/Ketsji/KX_Dome.cpp @@ -1600,7 +1600,7 @@ void KX_Dome::RotateCamera(KX_Camera* cam, int i) MT_Transform camtrans(cam->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->NodeGetLocalScaling(), cam->GetCameraData()->m_perspective); cam->SetModelviewMatrix(viewmat); // restore the original orientation @@ -2035,7 +2035,7 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* cam, int i) MT_Transform camtrans(cam->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), 1.0f); + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->NodeGetLocalScaling(), 1.0f); cam->SetModelviewMatrix(viewmat); // restore the original orientation diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 7237c473332..b0a8e376eb6 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -108,7 +108,7 @@ double KX_KetsjiEngine::m_suspendeddelta = 0.0; double KX_KetsjiEngine::m_average_framerate = 0.0; bool KX_KetsjiEngine::m_restrict_anim_fps = false; short KX_KetsjiEngine::m_exitkey = 130; // ESC Key - +bool KX_KetsjiEngine::m_doRender = true; /** * Constructor of the Ketsji Engine @@ -173,6 +173,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system) m_overrideFrameColorR(0.0f), m_overrideFrameColorG(0.0f), m_overrideFrameColorB(0.0f), + m_overrideFrameColorA(0.0f), m_usedome(false) { @@ -381,7 +382,7 @@ void KX_KetsjiEngine::RenderDome() m_overrideFrameColorR, m_overrideFrameColorG, m_overrideFrameColorB, - 1.0 + m_overrideFrameColorA ); } else @@ -749,6 +750,9 @@ bool KX_KetsjiEngine::NextFrame() scene->setSuspendedTime(m_clockTime); m_logger->StartLog(tc_services, m_kxsystem->GetTimeInSeconds(), true); + + // invalidates the shadow buffer from previous render/ImageRender because the scene has changed + scene->SetShadowDone(false); } // update system devices @@ -771,7 +775,7 @@ bool KX_KetsjiEngine::NextFrame() // Start logging time spent outside main loop m_logger->StartLog(tc_outside, m_kxsystem->GetTimeInSeconds(), true); - return doRender; + return doRender && m_doRender; } @@ -805,7 +809,7 @@ void KX_KetsjiEngine::Render() m_overrideFrameColorR, m_overrideFrameColorG, m_overrideFrameColorB, - 1.0 + m_overrideFrameColorA ); } else @@ -1133,6 +1137,8 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene) cam->Release(); } } + /* remember that we have a valid shadow buffer for that scene */ + scene->SetShadowDone(true); } // update graphics @@ -1252,7 +1258,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam) MT_Transform camtrans(cam->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); + m_rasterizer->SetViewMatrix(viewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->NodeGetLocalScaling(), cam->GetCameraData()->m_perspective); cam->SetModelviewMatrix(viewmat); // The following actually reschedules all vertices to be @@ -1925,6 +1931,16 @@ short KX_KetsjiEngine::GetExitKey() return m_exitkey; } +void KX_KetsjiEngine::SetRender(bool render) +{ + m_doRender = render; +} + +bool KX_KetsjiEngine::GetRender() +{ + return m_doRender; +} + void KX_KetsjiEngine::SetShowFramerate(bool frameRate) { m_show_framerate = frameRate; @@ -2023,19 +2039,21 @@ bool KX_KetsjiEngine::GetUseOverrideFrameColor(void) const } -void KX_KetsjiEngine::SetOverrideFrameColor(float r, float g, float b) +void KX_KetsjiEngine::SetOverrideFrameColor(float r, float g, float b, float a) { m_overrideFrameColorR = r; m_overrideFrameColorG = g; m_overrideFrameColorB = b; + m_overrideFrameColorA = a; } -void KX_KetsjiEngine::GetOverrideFrameColor(float& r, float& g, float& b) const +void KX_KetsjiEngine::GetOverrideFrameColor(float& r, float& g, float& b, float& a) const { r = m_overrideFrameColorR; g = m_overrideFrameColorG; b = m_overrideFrameColorB; + a = m_overrideFrameColorA; } diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h b/source/gameengine/Ketsji/KX_KetsjiEngine.h index 3b8cec2ac82..1756214b6dd 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.h +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h @@ -129,6 +129,8 @@ private: static short m_exitkey; /* Key used to exit the BGE */ + static bool m_doRender; /* whether or not the scene should be rendered after the logic frame */ + int m_exitcode; STR_String m_exitstring; @@ -199,6 +201,8 @@ private: float m_overrideFrameColorG; /** Blue component of framing bar color. */ float m_overrideFrameColorB; + /** alpha component of framing bar color. */ + float m_overrideFrameColorA; /** Settings that doesn't go away with Game Actuator */ GlobalSettings m_globalsettings; @@ -209,7 +213,6 @@ private: void RenderFrame(KX_Scene* scene, KX_Camera* cam); void PostRenderScene(KX_Scene* scene); void RenderDebugProperties(); - void RenderShadowBuffers(KX_Scene *scene); public: KX_KetsjiEngine(class KX_ISystem* system); @@ -249,6 +252,7 @@ public: ///returns true if an update happened to indicate -> Render bool NextFrame(); void Render(); + void RenderShadowBuffers(KX_Scene *scene); void StartEngine(bool clearIpo); void StopEngine(); @@ -401,6 +405,16 @@ public: static short GetExitKey(); /** + * Activate or deactivates the render of the scene after the logic frame + * \param render true (render) or false (do not render) + */ + static void SetRender(bool render); + /** + * Get the current render flag value + */ + static bool GetRender(); + + /** * \Sets the display for frame rate on or off. */ void SetShowFramerate(bool frameRate); @@ -485,7 +499,7 @@ public: * \param g Green component of the override color. * \param b Blue component of the override color. */ - void SetOverrideFrameColor(float r, float g, float b); + void SetOverrideFrameColor(float r, float g, float b, float a); /** * Returns the color used for framing bar color instead of the one in the Blender file's scenes. @@ -493,7 +507,7 @@ public: * \param g Green component of the override color. * \param b Blue component of the override color. */ - void GetOverrideFrameColor(float& r, float& g, float& b) const; + void GetOverrideFrameColor(float& r, float& g, float& b, float& a) const; KX_Scene* CreateScene(const STR_String& scenename); KX_Scene* CreateScene(Scene *scene, bool libloading=false); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 9f173a567ee..cdc2f9f3644 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -104,6 +104,7 @@ extern "C" { #include "BL_ArmatureObject.h" #include "RAS_IRasterizer.h" #include "RAS_ICanvas.h" +#include "RAS_IOffScreen.h" #include "RAS_BucketManager.h" #include "RAS_2DFilterManager.h" #include "MT_Vector3.h" @@ -469,6 +470,21 @@ static PyObject *gPyGetExitKey(PyObject *) return PyLong_FromLong(KX_KetsjiEngine::GetExitKey()); } +static PyObject *gPySetRender(PyObject *, PyObject *args) +{ + int render; + if (!PyArg_ParseTuple(args, "i:setRender", &render)) + return NULL; + KX_KetsjiEngine::SetRender(render); + Py_RETURN_NONE; +} + +static PyObject *gPyGetRender(PyObject *) +{ + return PyBool_FromLong(KX_KetsjiEngine::GetRender()); +} + + static PyObject *gPySetMaxLogicFrame(PyObject *, PyObject *args) { int frame; @@ -909,6 +925,8 @@ static struct PyMethodDef game_methods[] = { {"setAnimRecordFrame", (PyCFunction) gPySetAnimRecordFrame, METH_VARARGS, (const char *)"Sets the current frame number used for animation recording"}, {"getExitKey", (PyCFunction) gPyGetExitKey, METH_NOARGS, (const char *)"Gets the key used to exit the game engine"}, {"setExitKey", (PyCFunction) gPySetExitKey, METH_VARARGS, (const char *)"Sets the key used to exit the game engine"}, + {"setRender", (PyCFunction) gPySetRender, METH_VARARGS, (const char *)"Set the global render flag"}, + {"getRender", (PyCFunction) gPyGetRender, METH_NOARGS, (const char *)"get the global render flag value"}, {"getUseExternalClock", (PyCFunction) gPyGetUseExternalClock, METH_NOARGS, (const char *)"Get if we use the time provided by an external clock"}, {"setUseExternalClock", (PyCFunction) gPySetUseExternalClock, METH_VARARGS, (const char *)"Set if we use the time provided by an external clock"}, {"getClockTime", (PyCFunction) gPyGetClockTime, METH_NOARGS, (const char *)"Get the last BGE render time. " @@ -1457,6 +1475,158 @@ static PyObject *gPyGetDisplayDimensions(PyObject *) return result; } + +/* python wrapper around RAS_IOffScreen + * Should eventually gets its own file + */ + +static void PyRASOffScreen__tp_dealloc(PyRASOffScreen *self) +{ + if (self->ofs) + delete self->ofs; + Py_TYPE(self)->tp_free((PyObject *)self); +} + +PyDoc_STRVAR(py_RASOffScreen_doc, +"RASOffscreen(width, height) -> new GPU Offscreen object" +"initialized to hold a framebuffer object of ``width`` x ``height``.\n" +"" +); + +PyDoc_STRVAR(RASOffScreen_width_doc, "Offscreen buffer width.\n\n:type: integer"); +static PyObject *RASOffScreen_width_get(PyRASOffScreen *self, void *UNUSED(type)) +{ + return PyLong_FromLong(self->ofs->GetWidth()); +} + +PyDoc_STRVAR(RASOffScreen_height_doc, "Offscreen buffer height.\n\n:type: GLsizei"); +static PyObject *RASOffScreen_height_get(PyRASOffScreen *self, void *UNUSED(type)) +{ + return PyLong_FromLong(self->ofs->GetHeight()); +} + +PyDoc_STRVAR(RASOffScreen_color_doc, "Offscreen buffer texture object (if target is RAS_OFS_RENDER_TEXTURE).\n\n:type: GLuint"); +static PyObject *RASOffScreen_color_get(PyRASOffScreen *self, void *UNUSED(type)) +{ + return PyLong_FromLong(self->ofs->GetColor()); +} + +static PyGetSetDef RASOffScreen_getseters[] = { + {(char *)"width", (getter)RASOffScreen_width_get, (setter)NULL, RASOffScreen_width_doc, NULL}, + {(char *)"height", (getter)RASOffScreen_height_get, (setter)NULL, RASOffScreen_height_doc, NULL}, + {(char *)"color", (getter)RASOffScreen_color_get, (setter)NULL, RASOffScreen_color_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ +}; + +static int PyRASOffScreen__tp_init(PyRASOffScreen *self, PyObject *args, PyObject *kwargs) +{ + int width, height, samples, target; + const char *keywords[] = {"width", "height", "samples", "target", NULL}; + + samples = 0; + target = RAS_IOffScreen::RAS_OFS_RENDER_BUFFER; + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|ii:RASOffscreen", (char **)keywords, &width, &height, &samples, &target)) { + return -1; + } + + if (width <= 0) { + PyErr_SetString(PyExc_ValueError, "negative 'width' given"); + return -1; + } + + if (height <= 0) { + PyErr_SetString(PyExc_ValueError, "negative 'height' given"); + return -1; + } + + if (samples < 0) { + PyErr_SetString(PyExc_ValueError, "negative 'samples' given"); + return -1; + } + + if (target != RAS_IOffScreen::RAS_OFS_RENDER_BUFFER && target != RAS_IOffScreen::RAS_OFS_RENDER_TEXTURE) + { + PyErr_SetString(PyExc_ValueError, "invalid 'target' given, can only be RAS_OFS_RENDER_BUFFER or RAS_OFS_RENDER_TEXTURE"); + return -1; + } + if (!gp_Rasterizer) + { + PyErr_SetString(PyExc_SystemError, "no rasterizer"); + return -1; + } + self->ofs = gp_Rasterizer->CreateOffScreen(width, height, samples, target); + if (!self->ofs) { + PyErr_SetString(PyExc_SystemError, "creation failed"); + return -1; + } + return 0; +} + +PyTypeObject PyRASOffScreen_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "RASOffScreen", /* tp_name */ + sizeof(PyRASOffScreen), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)PyRASOffScreen__tp_dealloc, /* tp_dealloc */ + NULL, /* tp_print */ + NULL, /* tp_getattr */ + NULL, /* tp_setattr */ + NULL, /* tp_compare */ + NULL, /* tp_repr */ + NULL, /* tp_as_number */ + NULL, /* tp_as_sequence */ + NULL, /* tp_as_mapping */ + NULL, /* tp_hash */ + NULL, /* tp_call */ + NULL, /* tp_str */ + NULL, /* tp_getattro */ + NULL, /* tp_setattro */ + NULL, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + py_RASOffScreen_doc, /* Documentation string */ + NULL, /* tp_traverse */ + NULL, /* tp_clear */ + NULL, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + NULL, /* tp_iter */ + NULL, /* tp_iternext */ + NULL, /* tp_methods */ + NULL, /* tp_members */ + RASOffScreen_getseters, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + NULL, /* tp_descr_get */ + NULL, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PyRASOffScreen__tp_init, /* tp_init */ + (allocfunc)PyType_GenericAlloc, /* tp_alloc */ + (newfunc)PyType_GenericNew, /* tp_new */ + (freefunc)0, /* tp_free */ + NULL, /* tp_is_gc */ + NULL, /* tp_bases */ + NULL, /* tp_mro */ + NULL, /* tp_cache */ + NULL, /* tp_subclasses */ + NULL, /* tp_weaklist */ + (destructor) NULL /* tp_del */ +}; + + +static PyObject *gPyOffScreenCreate(PyObject *UNUSED(self), PyObject *args) +{ + int width; + int height; + int samples; + int target; + + samples = 0; + if (!PyArg_ParseTuple(args, "ii|ii:offScreenCreate", &width, &height, &samples, &target)) + return NULL; + + return PyObject_CallObject((PyObject *) &PyRASOffScreen_Type, args); +} + PyDoc_STRVAR(Rasterizer_module_documentation, "This is the Python API for the game engine of Rasterizer" ); @@ -1511,6 +1681,7 @@ static struct PyMethodDef rasterizer_methods[] = { {"showProperties",(PyCFunction) gPyShowProperties, METH_VARARGS, "show or hide the debug properties"}, {"autoDebugList",(PyCFunction) gPyAutoDebugList, METH_VARARGS, "enable or disable auto adding debug properties to the debug list"}, {"clearDebugList",(PyCFunction) gPyClearDebugList, METH_NOARGS, "clears the debug property list"}, + {"offScreenCreate", (PyCFunction) gPyOffScreenCreate, METH_VARARGS, "create an offscreen buffer object, arguments are width and height in pixels"}, { NULL, (PyCFunction) NULL, 0, NULL } }; @@ -2330,6 +2501,8 @@ PyMODINIT_FUNC initRasterizerPythonBinding() PyObject *m; PyObject *d; + PyType_Ready(&PyRASOffScreen_Type); + m = PyModule_Create(&Rasterizer_module_def); PyDict_SetItemString(PySys_GetObject("modules"), Rasterizer_module_def.m_name, m); @@ -2357,6 +2530,11 @@ PyMODINIT_FUNC initRasterizerPythonBinding() KX_MACRO_addTypesToDict(d, LEFT_EYE, RAS_IRasterizer::RAS_STEREO_LEFTEYE); KX_MACRO_addTypesToDict(d, RIGHT_EYE, RAS_IRasterizer::RAS_STEREO_RIGHTEYE); + /* offscreen render */ + KX_MACRO_addTypesToDict(d, RAS_OFS_RENDER_BUFFER, RAS_IOffScreen::RAS_OFS_RENDER_BUFFER); + KX_MACRO_addTypesToDict(d, RAS_OFS_RENDER_TEXTURE, RAS_IOffScreen::RAS_OFS_RENDER_TEXTURE); + + // XXXX Add constants here // Check for errors diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index a5a418b5e78..47ba2c4343f 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -172,6 +172,7 @@ KX_Scene::KX_Scene(class SCA_IInputDevice* keyboarddevice, m_activity_culling = false; m_suspend = false; m_isclearingZbuffer = true; + m_isShadowDone = false; m_tempObjectList = new CListValue(); m_objectlist = new CListValue(); m_parentlist = new CListValue(); diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h index c43b7be45dc..6d8ae8a321b 100644 --- a/source/gameengine/Ketsji/KX_Scene.h +++ b/source/gameengine/Ketsji/KX_Scene.h @@ -172,6 +172,11 @@ protected: bool m_isclearingZbuffer; /** + * Does the shadow buffer needs calculing + */ + bool m_isShadowDone; + + /** * The name of the scene */ STR_String m_sceneName; @@ -572,6 +577,8 @@ public: bool IsSuspended(); bool IsClearingZBuffer(); void EnableZBufferClearing(bool isclearingZbuffer); + bool IsShadowDone() { return m_isShadowDone; } + void SetShadowDone(bool b) { m_isShadowDone = b; } // use of DBVT tree for camera culling void SetDbvtCulling(bool b) { m_dbvt_culling = b; } bool GetDbvtCulling() { return m_dbvt_culling; } diff --git a/source/gameengine/Rasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/CMakeLists.txt index 496a864244b..c65fcac5161 100644 --- a/source/gameengine/Rasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/CMakeLists.txt @@ -65,6 +65,8 @@ set(SRC RAS_IPolygonMaterial.h RAS_IRasterizer.h RAS_ILightObject.h + RAS_IOffScreen.h + RAS_ISync.h RAS_MaterialBucket.h RAS_MeshObject.h RAS_ObjectColor.h diff --git a/source/gameengine/Rasterizer/RAS_IOffScreen.h b/source/gameengine/Rasterizer/RAS_IOffScreen.h new file mode 100644 index 00000000000..e5f3dc43e5f --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_IOffScreen.h @@ -0,0 +1,84 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file RAS_IOffScreen.h + * \ingroup bgerast + */ + +#ifndef __RAS_OFFSCREEN_H__ +#define __RAS_OFFSCREEN_H__ + +#include "EXP_Python.h" + +class RAS_ICanvas; + +class MT_Transform; + +struct Image; + +class RAS_IOffScreen +{ +public: + enum RAS_OFS_BIND_MODE { + RAS_OFS_BIND_RENDER = 0, + RAS_OFS_BIND_READ, + }; + enum RAS_OFS_RENDER_TARGET { + RAS_OFS_RENDER_BUFFER = 0, // use render buffer as render target + RAS_OFS_RENDER_TEXTURE, // use texture as render target + }; + + int m_width; + int m_height; + int m_samples; + int m_color; // if used, holds the texture object, 0 if not used + + virtual ~RAS_IOffScreen() {} + + virtual bool Create(int width, int height, int samples, RAS_OFS_RENDER_TARGET target) = 0; + virtual void Destroy() = 0; + virtual void Bind(RAS_OFS_BIND_MODE mode) = 0; + virtual void Blit() = 0; + virtual void Unbind() = 0; + virtual void MipMap() = 0; + + virtual int GetWidth() { return m_width; } + virtual int GetHeight() { return m_height; } + virtual int GetSamples() { return m_samples; } + virtual int GetColor() { return m_color; } +}; + +#ifdef WITH_PYTHON +typedef struct { + PyObject_HEAD + RAS_IOffScreen *ofs; +} PyRASOffScreen; + +extern PyTypeObject PyRASOffScreen_Type; +#endif + +#endif /* __RAS_OFFSCREEN_H__ */ diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h b/source/gameengine/Rasterizer/RAS_IRasterizer.h index a92b87773c7..dc92408915b 100644 --- a/source/gameengine/Rasterizer/RAS_IRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h @@ -55,6 +55,8 @@ class RAS_IPolyMaterial; class RAS_MeshSlot; class RAS_ILightObject; class SCA_IScene; +class RAS_IOffScreen; +class RAS_ISync; typedef vector<unsigned short> KX_IndexArray; typedef vector<RAS_TexVert> KX_VertexArray; @@ -258,6 +260,18 @@ public: virtual float GetFocalLength() = 0; /** + * Create an offscreen render buffer that can be used as target for render. + * For the time being, it is only used in VideoTexture for custom render. + */ + virtual RAS_IOffScreen *CreateOffScreen(int width, int height, int samples, int target) = 0; + + /** + * Create a sync object + * For use with offscreen render + */ + virtual RAS_ISync *CreateSync(int type) = 0; + + /** * SwapBuffers swaps the back buffer with the front buffer. */ virtual void SwapBuffers() = 0; @@ -287,7 +301,7 @@ public: * Sets the modelview matrix. */ virtual void SetViewMatrix(const MT_Matrix4x4 &mat, const MT_Matrix3x3 &ori, - const MT_Point3 &pos, bool perspective) = 0; + const MT_Point3 &pos, const MT_Vector3 &scale, bool perspective) = 0; /** */ diff --git a/source/gameengine/Rasterizer/RAS_ISync.h b/source/gameengine/Rasterizer/RAS_ISync.h new file mode 100644 index 00000000000..b9987dc1cad --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_ISync.h @@ -0,0 +1,48 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file RAS_ISync.h + * \ingroup bgerast + */ + +#ifndef __RAS_ISYNC_H__ +#define __RAS_ISYNC_H__ + +class RAS_ISync +{ +public: + enum RAS_SYNC_TYPE { + RAS_SYNC_TYPE_FENCE = 0, + }; + virtual ~RAS_ISync() {} + + virtual bool Create(RAS_SYNC_TYPE type) = 0; + virtual void Destroy() = 0; + virtual void Wait() = 0; +}; + +#endif /* __RAS_ISYNC_H__ */ diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt index 9f95e2c82af..89e31b62b41 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt @@ -51,6 +51,8 @@ set(INC_SYS set(SRC RAS_ListRasterizer.cpp RAS_OpenGLLight.cpp + RAS_OpenGLOffScreen.cpp + RAS_OpenGLSync.cpp RAS_OpenGLRasterizer.cpp RAS_StorageVA.cpp RAS_StorageVBO.cpp @@ -58,6 +60,8 @@ set(SRC RAS_IStorage.h RAS_ListRasterizer.h RAS_OpenGLLight.h + RAS_OpenGLOffScreen.h + RAS_OpenGLSync.h RAS_OpenGLRasterizer.h RAS_StorageVA.h RAS_StorageVBO.h diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp index e15ae4bd0d7..fff988a07c5 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp @@ -242,7 +242,7 @@ void RAS_OpenGLLight::BindShadowBuffer(RAS_ICanvas *canvas, KX_Camera *cam, MT_T RAS_IRasterizer::StereoMode stereomode = m_rasterizer->GetStereoMode(); m_rasterizer->SetStereoMode(RAS_IRasterizer::RAS_STEREO_NOSTEREO); m_rasterizer->SetProjectionMatrix(projectionmat); - m_rasterizer->SetViewMatrix(modelviewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->GetCameraData()->m_perspective); + m_rasterizer->SetViewMatrix(modelviewmat, cam->NodeGetWorldOrientation(), cam->NodeGetWorldPosition(), cam->NodeGetLocalScaling(), cam->GetCameraData()->m_perspective); m_rasterizer->SetStereoMode(stereomode); } diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLOffScreen.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLOffScreen.cpp new file mode 100644 index 00000000000..26ece47d8b3 --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLOffScreen.cpp @@ -0,0 +1,347 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "glew-mx.h" + +#include <stdio.h> + +#include "RAS_OpenGLOffScreen.h" +#include "RAS_ICanvas.h" + +RAS_OpenGLOffScreen::RAS_OpenGLOffScreen(RAS_ICanvas *canvas) + :m_canvas(canvas), m_depthrb(0), m_colorrb(0), m_depthtx(0), m_colortx(0), + m_fbo(0), m_blitfbo(0), m_blitrbo(0), m_blittex(0), m_target(RAS_OFS_RENDER_BUFFER), m_bound(false) +{ + m_width = 0; + m_height = 0; + m_samples = 0; + m_color = 0; +} + +RAS_OpenGLOffScreen::~RAS_OpenGLOffScreen() +{ + Destroy(); +} + +bool RAS_OpenGLOffScreen::Create(int width, int height, int samples, RAS_OFS_RENDER_TARGET target) +{ + GLenum status; + GLuint glo[2], fbo; + GLint max_samples; + GLenum textarget; + + if (m_fbo) { + printf("RAS_OpenGLOffScreen::Create(): buffer exists already, destroy first\n"); + return false; + } + if (target != RAS_IOffScreen::RAS_OFS_RENDER_BUFFER && + target != RAS_IOffScreen::RAS_OFS_RENDER_TEXTURE) + { + printf("RAS_OpenGLOffScreen::Create(): invalid offscren target\n"); + return false; + } + if (!GLEW_EXT_framebuffer_object) { + printf("RAS_OpenGLOffScreen::Create(): frame buffer not supported\n"); + return false; + } + if (samples) { + if (!GLEW_EXT_framebuffer_multisample || + !GLEW_EXT_framebuffer_blit) + { + samples = 0; + } + } + if (samples && target == RAS_OFS_RENDER_TEXTURE) { + // we need this in addition if we use multisample textures + if (!GLEW_ARB_texture_multisample || + !GLEW_EXT_framebuffer_multisample_blit_scaled) + { + samples = 0; + } + } + if (samples) { + max_samples = 0; + glGetIntegerv(GL_MAX_SAMPLES_EXT , &max_samples); + if (samples > max_samples) + samples = max_samples; + } + m_target = target; + fbo = 0; + glGenFramebuffersEXT(1, &fbo); + if (fbo == 0) { + printf("RAS_OpenGLOffScreen::Create(): frame buffer creation failed: %d\n", (int)glGetError()); + return false; + } + m_fbo = fbo; + glo[0] = glo[1] = 0; + if (target == RAS_OFS_RENDER_TEXTURE) { + glGenTextures(2, glo); + if (glo[0] == 0 || glo[1] == 0) { + printf("RAS_OpenGLOffScreen::Create(): texture creation failed: %d\n", (int)glGetError()); + goto L_ERROR; + } + m_depthtx = glo[0]; + m_color = m_colortx = glo[1]; + if (samples) { + textarget = GL_TEXTURE_2D_MULTISAMPLE; + glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_depthtx); + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, GL_DEPTH_COMPONENT, width, height, true); + glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, m_colortx); + glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, samples, GL_RGBA8, width, height, true); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0); + } + else { + textarget = GL_TEXTURE_2D; + glBindTexture(GL_TEXTURE_2D, m_depthtx); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, width, height, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); + glBindTexture(GL_TEXTURE_2D, m_colortx); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glBindTexture(GL_TEXTURE_2D, 0); + } + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, textarget, m_depthtx, 0); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, textarget, m_colortx, 0); + } + else { + glGenRenderbuffersEXT(2, glo); + if (glo[0] == 0 || glo[1] == 0) { + printf("RAS_OpenGLOffScreen::Create(): render buffer creation failed: %d\n", (int)glGetError()); + goto L_ERROR; + } + m_depthrb = glo[0]; + m_colorrb = glo[1]; + glBindRenderbufferEXT(GL_RENDERBUFFER, m_depthrb); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, samples, GL_DEPTH_COMPONENT, width, height); + glBindRenderbufferEXT(GL_RENDERBUFFER, m_colorrb); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, samples, GL_RGBA8, width, height); + glBindRenderbufferEXT(GL_RENDERBUFFER, 0); + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER, m_depthrb); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER, m_colorrb); + } + status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("RAS_OpenGLOffScreen::Create(): frame buffer incomplete: %d\n", (int)status); + goto L_ERROR; + } + m_width = width; + m_height = height; + + if (samples > 0) { + GLuint blit_tex; + GLuint blit_fbo; + // create a secondary FBO to blit to before the pixel can be read + + /* write into new single-sample buffer */ + glGenFramebuffersEXT(1, &blit_fbo); + if (!blit_fbo) { + printf("RAS_OpenGLOffScreen::Create(): failed creating a FBO for multi-sample offscreen buffer\n"); + goto L_ERROR; + } + m_blitfbo = blit_fbo; + blit_tex = 0; + if (target == RAS_OFS_RENDER_TEXTURE) { + glGenTextures(1, &blit_tex); + if (!blit_tex) { + printf("RAS_OpenGLOffScreen::Create(): failed creating a texture for multi-sample offscreen buffer\n"); + goto L_ERROR; + } + // m_color is the texture where the final render goes, the blit texture in this case + m_color = m_blittex = blit_tex; + glBindTexture(GL_TEXTURE_2D, m_blittex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_blitfbo); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_blittex, 0); + } + else { + /* create render buffer for new 'fbo_blit' */ + glGenRenderbuffersEXT(1, &blit_tex); + if (!blit_tex) { + printf("RAS_OpenGLOffScreen::Create(): failed creating a render buffer for multi-sample offscreen buffer\n"); + goto L_ERROR; + } + m_blitrbo = blit_tex; + glBindRenderbufferEXT(GL_RENDERBUFFER, m_blitrbo); + glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 0, GL_RGBA8, width, height); + glBindRenderbufferEXT(GL_RENDERBUFFER, 0); + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_blitfbo); + glFramebufferRenderbufferEXT(GL_DRAW_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER, m_blitrbo); + } + status = glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER_EXT); + glBindFramebuffer(GL_DRAW_FRAMEBUFFER_EXT, 0); + if (status != GL_FRAMEBUFFER_COMPLETE) { + printf("RAS_OpenGLOffScreen::Create(): frame buffer for multi-sample offscreen buffer incomplete: %d\n", (int)status); + goto L_ERROR; + } + // remember that multisample is enabled + m_samples = 1; + } + return true; + +L_ERROR: + Destroy(); + return false; +} + +void RAS_OpenGLOffScreen::Destroy() +{ + GLuint globj; + Unbind(); + if (m_fbo) { + globj = m_fbo; + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + if (m_target == RAS_OFS_RENDER_TEXTURE) { + GLenum textarget = (m_samples) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D; + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, textarget, 0, 0); + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, textarget, 0, 0); + } + else { + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, 0); + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, 0); + } + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glDeleteFramebuffersEXT(1, &globj); + m_fbo = 0; + } + if (m_depthrb) { + globj = m_depthrb; + glDeleteRenderbuffers(1, &globj); + m_depthrb = 0; + } + if (m_colorrb) { + globj = m_colorrb; + glDeleteRenderbuffers(1, &globj); + m_colorrb = 0; + } + if (m_depthtx) { + globj = m_depthtx; + glDeleteTextures(1, &globj); + m_depthtx = 0; + } + if (m_colortx) { + globj = m_colortx; + glDeleteTextures(1, &globj); + m_colortx = 0; + } + if (m_blitfbo) { + globj = m_blitfbo; + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_blitfbo); + if (m_target == RAS_OFS_RENDER_TEXTURE) { + glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, 0, 0); + } + else { + glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, 0); + } + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glDeleteFramebuffersEXT(1, &globj); + m_blitfbo = 0; + } + if (m_blitrbo) { + globj = m_blitrbo; + glDeleteRenderbuffers(1, &globj); + m_blitrbo = 0; + } + if (m_blittex) { + globj = m_blittex; + glDeleteTextures(1, &globj); + m_blittex = 0; + } + m_width = 0; + m_height = 0; + m_samples = 0; + m_color = 0; + m_target = RAS_OFS_RENDER_BUFFER; +} + +void RAS_OpenGLOffScreen::Bind(RAS_OFS_BIND_MODE mode) +{ + if (m_fbo) { + if (mode == RAS_OFS_BIND_RENDER) { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + glViewport(0, 0, m_width, m_height); + glDisable(GL_SCISSOR_TEST); + } + else if (!m_blitfbo) { + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + } + else { + glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_blitfbo); + glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + } + m_bound = true; + } +} + +void RAS_OpenGLOffScreen::Unbind() +{ + if (!m_bound) + return; + + glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); + glEnable(GL_SCISSOR_TEST); + glReadBuffer(GL_BACK); + glDrawBuffer(GL_BACK); + m_bound = false; +} + +void RAS_OpenGLOffScreen::MipMap() +{ + if (m_color) { + glBindTexture(GL_TEXTURE_2D, m_color); + glGenerateMipmap(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, 0); + } +} + +void RAS_OpenGLOffScreen::Blit() +{ + if (m_bound && m_blitfbo) { + // set the draw target to the secondary FBO, the read target is still the multisample FBO + glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, m_blitfbo); + + // sample the primary + glBlitFramebufferEXT(0, 0, m_width, m_height, 0, 0, m_width, m_height, GL_COLOR_BUFFER_BIT, GL_NEAREST); + + // make sure the next glReadPixels will read from the secondary buffer + glBindFramebufferEXT(GL_READ_FRAMEBUFFER, m_blitfbo); + } +} diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLOffScreen.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLOffScreen.h new file mode 100644 index 00000000000..94d0d4aa105 --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLOffScreen.h @@ -0,0 +1,65 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __RAS_OPENGLOFFSCREEN__ +#define __RAS_OPENGLOFFSCREEN__ + +#include "RAS_IOffScreen.h" +#include "GPU_extensions.h" + +class RAS_ICanvas; + +class RAS_OpenGLOffScreen : public RAS_IOffScreen +{ + RAS_ICanvas *m_canvas; + // these are GL objects + unsigned int m_depthrb; + unsigned int m_colorrb; + unsigned int m_depthtx; + unsigned int m_colortx; + unsigned int m_fbo; + unsigned int m_blitfbo; + unsigned int m_blitrbo; + unsigned int m_blittex; + RAS_OFS_RENDER_TARGET m_target; + bool m_bound; + + +public: + RAS_OpenGLOffScreen(RAS_ICanvas *canvas); + ~RAS_OpenGLOffScreen(); + + bool Create(int width, int height, int samples, RAS_OFS_RENDER_TARGET target); + void Destroy(); + void Bind(RAS_OFS_BIND_MODE mode); + void Blit(); + void Unbind(); + void MipMap(); +}; + +#endif /* __RAS_OPENGLOFFSCREEN__ */ + diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp index 34f0ef04a58..fcb11ce2355 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp @@ -46,6 +46,8 @@ #include "MT_CmMatrix4x4.h" #include "RAS_OpenGLLight.h" +#include "RAS_OpenGLOffScreen.h" +#include "RAS_OpenGLSync.h" #include "RAS_StorageVA.h" #include "RAS_StorageVBO.h" @@ -92,6 +94,7 @@ RAS_OpenGLRasterizer::RAS_OpenGLRasterizer(RAS_ICanvas* canvas, RAS_STORAGE_TYPE m_time(0.0f), m_campos(0.0f, 0.0f, 0.0f), m_camortho(false), + m_camnegscale(false), m_stereomode(RAS_STEREO_NOSTEREO), m_curreye(RAS_STEREO_LEFTEYE), m_eyeseparation(0.0f), @@ -207,7 +210,7 @@ void RAS_OpenGLRasterizer::SetBackColor(float color[3]) m_redback = color[0]; m_greenback = color[1]; m_blueback = color[2]; - m_alphaback = 1.0f; + m_alphaback = 0.0f; } void RAS_OpenGLRasterizer::SetFog(short type, float start, float dist, float intensity, float color[3]) @@ -600,6 +603,31 @@ float RAS_OpenGLRasterizer::GetFocalLength() return m_focallength; } +RAS_IOffScreen *RAS_OpenGLRasterizer::CreateOffScreen(int width, int height, int samples, int target) +{ + RAS_IOffScreen *ofs; + + ofs = new RAS_OpenGLOffScreen(m_2DCanvas); + + if (!ofs->Create(width, height, samples, (RAS_IOffScreen::RAS_OFS_RENDER_TARGET)target)) { + delete ofs; + return NULL; + } + return ofs; +} + +RAS_ISync *RAS_OpenGLRasterizer::CreateSync(int type) +{ + RAS_ISync *sync; + + sync = new RAS_OpenGLSync(); + + if (!sync->Create((RAS_ISync::RAS_SYNC_TYPE)type)) { + delete sync; + return NULL; + } + return sync; +} void RAS_OpenGLRasterizer::SwapBuffers() { @@ -924,6 +952,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetOrthoMatrix( void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, const MT_Matrix3x3 & camOrientMat3x3, const MT_Point3 & pos, + const MT_Vector3 &scale, bool perspective) { m_viewmatrix = mat; @@ -966,6 +995,12 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, } } + bool negX = (scale[0] < 0.0f); + bool negY = (scale[0] < 0.0f); + bool negZ = (scale[0] < 0.0f); + if (negX || negY || negZ) { + m_viewmatrix.tscale((negX)?-1.0f:1.0f, (negY)?-1.0f:1.0f, (negZ)?-1.0f:1.0f, 1.0); + } m_viewinvmatrix = m_viewmatrix; m_viewinvmatrix.invert(); @@ -976,6 +1011,7 @@ void RAS_OpenGLRasterizer::SetViewMatrix(const MT_Matrix4x4 &mat, glMatrixMode(GL_MODELVIEW); glLoadMatrixf(glviewmat); m_campos = pos; + m_camnegscale = negX ^ negY ^ negZ; } @@ -1108,6 +1144,9 @@ void RAS_OpenGLRasterizer::SetAlphaBlend(int alphablend) void RAS_OpenGLRasterizer::SetFrontFace(bool ccw) { + if (m_camnegscale) + ccw = !ccw; + if (m_last_frontface == ccw) return; diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h index 4c22d1de611..9561e207dba 100644 --- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h @@ -96,6 +96,7 @@ class RAS_OpenGLRasterizer : public RAS_IRasterizer MT_Matrix4x4 m_viewinvmatrix; MT_Point3 m_campos; bool m_camortho; + bool m_camnegscale; StereoMode m_stereomode; StereoEye m_curreye; @@ -180,7 +181,8 @@ public: virtual float GetEyeSeparation(); virtual void SetFocalLength(const float focallength); virtual float GetFocalLength(); - + virtual RAS_IOffScreen *CreateOffScreen(int width, int height, int samples, int target); + virtual RAS_ISync *CreateSync(int type); virtual void SwapBuffers(); virtual void IndexPrimitives(class RAS_MeshSlot &ms); @@ -189,7 +191,12 @@ public: virtual void SetProjectionMatrix(MT_CmMatrix4x4 &mat); virtual void SetProjectionMatrix(const MT_Matrix4x4 &mat); - virtual void SetViewMatrix(const MT_Matrix4x4 &mat, const MT_Matrix3x3 &ori, const MT_Point3 &pos, bool perspective); + virtual void SetViewMatrix( + const MT_Matrix4x4 &mat, + const MT_Matrix3x3 &ori, + const MT_Point3 &pos, + const MT_Vector3 &scale, + bool perspective); virtual const MT_Point3& GetCameraPosition(); virtual bool GetCameraOrtho(); diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLSync.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLSync.cpp new file mode 100644 index 00000000000..ebb4a9a3ca1 --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLSync.cpp @@ -0,0 +1,82 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#include "glew-mx.h" + +#include <stdio.h> + +#include "RAS_OpenGLSync.h" + +RAS_OpenGLSync::RAS_OpenGLSync() + :m_sync(NULL) +{ +} + +RAS_OpenGLSync::~RAS_OpenGLSync() +{ + Destroy(); +} + +bool RAS_OpenGLSync::Create(RAS_SYNC_TYPE type) +{ + if (m_sync) { + printf("RAS_OpenGLSync::Create(): sync already exists, destroy first\n"); + return false; + } + if (type != RAS_SYNC_TYPE_FENCE) { + printf("RAS_OpenGLSync::Create(): only RAS_SYNC_TYPE_FENCE are currently supported\n"); + return false; + } + if (!GLEW_ARB_sync) { + printf("RAS_OpenGLSync::Create(): ARB_sync extension is needed to create sync object\n"); + return false; + } + m_sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + if (!m_sync) { + printf("RAS_OpenGLSync::Create(): glFenceSync() failed"); + return false; + } + return true; +} + +void RAS_OpenGLSync::Destroy() +{ + if (m_sync) { + glDeleteSync(m_sync); + m_sync = NULL; + } +} + +void RAS_OpenGLSync::Wait() +{ + if (m_sync) { + // this is needed to ensure that the sync is in the GPU + glFlush(); + // block until the operation have completed + glWaitSync(m_sync, 0, GL_TIMEOUT_IGNORED); + } +} diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLSync.h b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLSync.h new file mode 100644 index 00000000000..9b6340b04ac --- /dev/null +++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLSync.h @@ -0,0 +1,50 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __RAS_OPENGLSYNC__ +#define __RAS_OPENGLSYNC__ + + +#include "RAS_ISync.h" + +struct __GLsync; + +class RAS_OpenGLSync : public RAS_ISync +{ +private: + struct __GLsync *m_sync; + +public: + RAS_OpenGLSync(); + ~RAS_OpenGLSync(); + + virtual bool Create(RAS_SYNC_TYPE type); + virtual void Destroy(); + virtual void Wait(); +}; + +#endif /* __RAS_OPENGLSYNC__ */ diff --git a/source/gameengine/VideoTexture/CMakeLists.txt b/source/gameengine/VideoTexture/CMakeLists.txt index 4be9a9abe5c..1eb09b02e05 100644 --- a/source/gameengine/VideoTexture/CMakeLists.txt +++ b/source/gameengine/VideoTexture/CMakeLists.txt @@ -45,6 +45,9 @@ set(INC ../../../intern/glew-mx ../../../intern/guardedalloc ../../../intern/string + ../../../intern/decklink + ../../../intern/gpudirect + ../../../intern/atomic ) set(INC_SYS @@ -68,8 +71,10 @@ set(SRC ImageViewport.cpp PyTypeList.cpp Texture.cpp + DeckLink.cpp VideoBase.cpp VideoFFmpeg.cpp + VideoDeckLink.cpp blendVideoTex.cpp BlendType.h @@ -87,8 +92,10 @@ set(SRC ImageViewport.h PyTypeList.h Texture.h + DeckLink.h VideoBase.h VideoFFmpeg.h + VideoDeckLink.h ) if(WITH_CODEC_FFMPEG) @@ -100,7 +107,13 @@ if(WITH_CODEC_FFMPEG) remove_strict_flags_file( VideoFFmpeg.cpp + VideoDeckLink + DeckLink ) endif() +if(WITH_GAMEENGINE_DECKLINK) + add_definitions(-DWITH_GAMEENGINE_DECKLINK) +endif() + blender_add_lib(ge_videotex "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/gameengine/VideoTexture/Common.h b/source/gameengine/VideoTexture/Common.h index 90f7e66452a..22ea177addc 100644 --- a/source/gameengine/VideoTexture/Common.h +++ b/source/gameengine/VideoTexture/Common.h @@ -36,7 +36,8 @@ #define NULL 0 #endif -#ifndef HRESULT +#ifndef _HRESULT_DEFINED +#define _HRESULT_DEFINED #define HRESULT long #endif diff --git a/source/gameengine/VideoTexture/DeckLink.cpp b/source/gameengine/VideoTexture/DeckLink.cpp new file mode 100644 index 00000000000..0506756ef2d --- /dev/null +++ b/source/gameengine/VideoTexture/DeckLink.cpp @@ -0,0 +1,813 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file gameengine/VideoTexture/Texture.cpp + * \ingroup bgevideotex + */ + +#ifdef WITH_GAMEENGINE_DECKLINK + +// implementation + +// FFmpeg defines its own version of stdint.h on Windows. +// Decklink needs FFmpeg, so it uses its version of stdint.h +// this is necessary for INT64_C macro +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS +#endif +// this is necessary for UINTPTR_MAX (used by atomic-ops) +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#endif + +#include "atomic_ops.h" + +#include "EXP_PyObjectPlus.h" +#include "KX_KetsjiEngine.h" +#include "KX_PythonInit.h" +#include "DeckLink.h" + +#include <memory.h> + +// macro for exception handling and logging +#define CATCH_EXCP catch (Exception & exp) \ +{ exp.report(); return NULL; } + +static struct +{ + const char *name; + BMDDisplayMode mode; +} sModeStringTab[] = { + { "NTSC", bmdModeNTSC }, + { "NTSC2398", bmdModeNTSC2398 }, + { "PAL", bmdModePAL }, + { "NTSCp", bmdModeNTSCp }, + { "PALp", bmdModePALp }, + + /* HD 1080 Modes */ + + { "HD1080p2398", bmdModeHD1080p2398 }, + { "HD1080p24", bmdModeHD1080p24 }, + { "HD1080p25", bmdModeHD1080p25 }, + { "HD1080p2997", bmdModeHD1080p2997 }, + { "HD1080p30", bmdModeHD1080p30 }, + { "HD1080i50", bmdModeHD1080i50 }, + { "HD1080i5994", bmdModeHD1080i5994 }, + { "HD1080i6000", bmdModeHD1080i6000 }, + { "HD1080p50", bmdModeHD1080p50 }, + { "HD1080p5994", bmdModeHD1080p5994 }, + { "HD1080p6000", bmdModeHD1080p6000 }, + + /* HD 720 Modes */ + + { "HD720p50", bmdModeHD720p50 }, + { "HD720p5994", bmdModeHD720p5994 }, + { "HD720p60", bmdModeHD720p60 }, + + /* 2k Modes */ + + { "2k2398", bmdMode2k2398 }, + { "2k24", bmdMode2k24 }, + { "2k25", bmdMode2k25 }, + + /* DCI Modes (output only) */ + + { "2kDCI2398", bmdMode2kDCI2398 }, + { "2kDCI24", bmdMode2kDCI24 }, + { "2kDCI25", bmdMode2kDCI25 }, + + /* 4k Modes */ + + { "4K2160p2398", bmdMode4K2160p2398 }, + { "4K2160p24", bmdMode4K2160p24 }, + { "4K2160p25", bmdMode4K2160p25 }, + { "4K2160p2997", bmdMode4K2160p2997 }, + { "4K2160p30", bmdMode4K2160p30 }, + { "4K2160p50", bmdMode4K2160p50 }, + { "4K2160p5994", bmdMode4K2160p5994 }, + { "4K2160p60", bmdMode4K2160p60 }, + // sentinel + { NULL } +}; + +static struct +{ + const char *name; + BMDPixelFormat format; +} sFormatStringTab[] = { + { "8BitYUV", bmdFormat8BitYUV }, + { "10BitYUV", bmdFormat10BitYUV }, + { "8BitARGB", bmdFormat8BitARGB }, + { "8BitBGRA", bmdFormat8BitBGRA }, + { "10BitRGB", bmdFormat10BitRGB }, + { "12BitRGB", bmdFormat12BitRGB }, + { "12BitRGBLE", bmdFormat12BitRGBLE }, + { "10BitRGBXLE", bmdFormat10BitRGBXLE }, + { "10BitRGBX", bmdFormat10BitRGBX }, + // sentinel + { NULL } +}; + +ExceptionID DeckLinkBadDisplayMode, DeckLinkBadPixelFormat; +ExpDesc DeckLinkBadDisplayModeDesc(DeckLinkBadDisplayMode, "Invalid or unsupported display mode"); +ExpDesc DeckLinkBadPixelFormatDesc(DeckLinkBadPixelFormat, "Invalid or unsupported pixel format"); + +HRESULT decklink_ReadDisplayMode(const char *format, size_t len, BMDDisplayMode *displayMode) +{ + int i; + + if (len == 0) + len = strlen(format); + for (i = 0; sModeStringTab[i].name != NULL; i++) { + if (strlen(sModeStringTab[i].name) == len && + !strncmp(sModeStringTab[i].name, format, len)) + { + *displayMode = sModeStringTab[i].mode; + return S_OK; + } + } + if (len != 4) + THRWEXCP(DeckLinkBadDisplayMode, S_OK); + // assume the user entered directly the mode value as a 4 char string + *displayMode = (BMDDisplayMode)((((uint32_t)format[0]) << 24) + (((uint32_t)format[1]) << 16) + (((uint32_t)format[2]) << 8) + ((uint32_t)format[3])); + return S_OK; +} + +HRESULT decklink_ReadPixelFormat(const char *format, size_t len, BMDPixelFormat *pixelFormat) +{ + int i; + + if (!len) + len = strlen(format); + for (i = 0; sFormatStringTab[i].name != NULL; i++) { + if (strlen(sFormatStringTab[i].name) == len && + !strncmp(sFormatStringTab[i].name, format, len)) + { + *pixelFormat = sFormatStringTab[i].format; + return S_OK; + } + } + if (len != 4) + THRWEXCP(DeckLinkBadPixelFormat, S_OK); + // assume the user entered directly the mode value as a 4 char string + *pixelFormat = (BMDPixelFormat)((((uint32_t)format[0]) << 24) + (((uint32_t)format[1]) << 16) + (((uint32_t)format[2]) << 8) + ((uint32_t)format[3])); + return S_OK; +} + +class DeckLink3DFrameWrapper : public IDeckLinkVideoFrame, IDeckLinkVideoFrame3DExtensions +{ +public: + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) + { + if (!memcmp(&iid, &IID_IDeckLinkVideoFrame3DExtensions, sizeof(iid))) { + if (mpRightEye) { + *ppv = (IDeckLinkVideoFrame3DExtensions*)this; + return S_OK; + } + } + return E_NOTIMPL; + } + virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 1U; } + virtual ULONG STDMETHODCALLTYPE Release(void) { return 1U; } + // IDeckLinkVideoFrame + virtual long STDMETHODCALLTYPE GetWidth(void) { return mpLeftEye->GetWidth(); } + virtual long STDMETHODCALLTYPE GetHeight(void) { return mpLeftEye->GetHeight(); } + virtual long STDMETHODCALLTYPE GetRowBytes(void) { return mpLeftEye->GetRowBytes(); } + virtual BMDPixelFormat STDMETHODCALLTYPE GetPixelFormat(void) { return mpLeftEye->GetPixelFormat(); } + virtual BMDFrameFlags STDMETHODCALLTYPE GetFlags(void) { return mpLeftEye->GetFlags(); } + virtual HRESULT STDMETHODCALLTYPE GetBytes(void **buffer) { return mpLeftEye->GetBytes(buffer); } + virtual HRESULT STDMETHODCALLTYPE GetTimecode(BMDTimecodeFormat format,IDeckLinkTimecode **timecode) + { return mpLeftEye->GetTimecode(format, timecode); } + virtual HRESULT STDMETHODCALLTYPE GetAncillaryData(IDeckLinkVideoFrameAncillary **ancillary) + { return mpLeftEye->GetAncillaryData(ancillary); } + // IDeckLinkVideoFrame3DExtensions + virtual BMDVideo3DPackingFormat STDMETHODCALLTYPE Get3DPackingFormat(void) + { + return bmdVideo3DPackingLeftOnly; + } + virtual HRESULT STDMETHODCALLTYPE GetFrameForRightEye( + /* [out] */ IDeckLinkVideoFrame **rightEyeFrame) + { + mpRightEye->AddRef(); + *rightEyeFrame = mpRightEye; + return S_OK; + } + // Constructor + DeckLink3DFrameWrapper(IDeckLinkVideoFrame *leftEye, IDeckLinkVideoFrame *rightEye) + { + mpLeftEye = leftEye; + mpRightEye = rightEye; + } + // no need for a destructor, it's just a wrapper +private: + IDeckLinkVideoFrame *mpLeftEye; + IDeckLinkVideoFrame *mpRightEye; +}; + +static void decklink_Reset(DeckLink *self) +{ + self->m_lastClock = 0.0; + self->mDLOutput = NULL; + self->mUse3D = false; + self->mDisplayMode = bmdModeUnknown; + self->mKeyingSupported = false; + self->mHDKeyingSupported = false; + self->mSize[0] = 0; + self->mSize[1] = 0; + self->mFrameSize = 0; + self->mLeftFrame = NULL; + self->mRightFrame = NULL; + self->mKeyer = NULL; + self->mUseKeying = false; + self->mKeyingLevel = 255; + self->mUseExtend = false; +} + +#ifdef __BIG_ENDIAN__ +#define CONV_PIXEL(i) ((((i)>>16)&0xFF00)+(((i)&0xFF00)<<16)+((i)&0xFF00FF)) +#else +#define CONV_PIXEL(i) ((((i)&0xFF)<<16)+(((i)>>16)&0xFF)+((i)&0xFF00FF00)) +#endif + +// adapt the pixel format and picture size from VideoTexture (RGBA) to DeckLink (BGRA) +static void decklink_ConvImage(uint32_t *dest, const short *destSize, const uint32_t *source, const short *srcSize, bool extend) +{ + short w, h, x, y; + const uint32_t *s; + uint32_t *d, p; + bool sameSize = (destSize[0] == srcSize[0] && destSize[1] == srcSize[1]); + + if (sameSize || !extend) { + // here we convert pixel by pixel + w = (destSize[0] < srcSize[0]) ? destSize[0] : srcSize[0]; + h = (destSize[1] < srcSize[1]) ? destSize[1] : srcSize[1]; + for (y = 0; y < h; ++y) { + s = source + y*srcSize[0]; + d = dest + y*destSize[0]; + for (x = 0; x < w; ++x, ++s, ++d) { + *d = CONV_PIXEL(*s); + } + } + } + else { + // here we scale + // interpolation accumulator + int accHeight = srcSize[1] >> 1; + d = dest; + s = source; + // process image rows + for (y = 0; y < srcSize[1]; ++y) { + // increase height accum + accHeight += destSize[1]; + // if pixel row has to be drawn + if (accHeight >= srcSize[1]) { + // decrease accum + accHeight -= srcSize[1]; + // width accum + int accWidth = srcSize[0] >> 1; + // process row + for (x = 0; x < srcSize[0]; ++x, ++s) { + // increase width accum + accWidth += destSize[0]; + // convert pixel + p = CONV_PIXEL(*s); + // if pixel has to be drown one or more times + while (accWidth >= srcSize[0]) { + // decrease accum + accWidth -= srcSize[0]; + *d++ = p; + } + } + // if there should be more identical lines + while (accHeight >= srcSize[1]) { + accHeight -= srcSize[1]; + // copy previous line + memcpy(d, d - destSize[0], 4 * destSize[0]); + d += destSize[0]; + } + } + else { + // if we skip a source line + s += srcSize[0]; + } + } + } +} + +// DeckLink object allocation +static PyObject *DeckLink_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + // allocate object + DeckLink * self = reinterpret_cast<DeckLink*>(type->tp_alloc(type, 0)); + // initialize object structure + decklink_Reset(self); + // m_leftEye is a python object, it's handled by python + self->m_leftEye = NULL; + self->m_rightEye = NULL; + // return allocated object + return reinterpret_cast<PyObject*>(self); +} + + +// forward declaration +PyObject *DeckLink_close(DeckLink *self); +int DeckLink_setSource(DeckLink *self, PyObject *value, void *closure); + + +// DeckLink object deallocation +static void DeckLink_dealloc(DeckLink *self) +{ + // release renderer + Py_XDECREF(self->m_leftEye); + // close decklink + PyObject *ret = DeckLink_close(self); + Py_DECREF(ret); + // release object + Py_TYPE((PyObject *)self)->tp_free((PyObject *)self); +} + + +ExceptionID AutoDetectionNotAvail, DeckLinkOpenCard, DeckLinkBadFormat, DeckLinkInternalError; +ExpDesc AutoDetectionNotAvailDesc(AutoDetectionNotAvail, "Auto detection not yet available"); +ExpDesc DeckLinkOpenCardDesc(DeckLinkOpenCard, "Cannot open card for output"); +ExpDesc DeckLinkBadFormatDesc(DeckLinkBadFormat, "Invalid or unsupported output format, use <mode>[/3D]"); +ExpDesc DeckLinkInternalErrorDesc(DeckLinkInternalError, "DeckLink API internal error, please report"); + +// DeckLink object initialization +static int DeckLink_init(DeckLink *self, PyObject *args, PyObject *kwds) +{ + IDeckLinkIterator* pIterator; + IDeckLinkAttributes* pAttributes; + IDeckLinkDisplayModeIterator* pDisplayModeIterator; + IDeckLinkDisplayMode* pDisplayMode; + IDeckLink* pDL; + char* p3D; + BOOL flag; + size_t len; + int i; + uint32_t displayFlags; + BMDVideoOutputFlags outputFlags; + BMDDisplayModeSupport support; + uint32_t* bytes; + + + // material ID + short cardIdx = 0; + // texture ID + char *format = NULL; + + static const char *kwlist[] = {"cardIdx", "format", NULL}; + // get parameters + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|hs", + const_cast<char**>(kwlist), &cardIdx, &format)) + return -1; + + try { + if (format == NULL) { + THRWEXCP(AutoDetectionNotAvail, S_OK); + } + + if ((p3D = strchr(format, '/')) != NULL && strcmp(p3D, "/3D")) + THRWEXCP(DeckLinkBadFormat, S_OK); + self->mUse3D = (p3D) ? true : false; + // read the mode + len = (p3D) ? (size_t)(p3D - format) : strlen(format); + // throws if bad mode + decklink_ReadDisplayMode(format, len, &self->mDisplayMode); + + pIterator = BMD_CreateDeckLinkIterator(); + pDL = NULL; + if (pIterator) { + i = 0; + while (pIterator->Next(&pDL) == S_OK) { + if (i == cardIdx) { + break; + } + i++; + pDL->Release(); + pDL = NULL; + } + pIterator->Release(); + } + + if (!pDL) { + THRWEXCP(DeckLinkOpenCard, S_OK); + } + // detect the capabilities + if (pDL->QueryInterface(IID_IDeckLinkAttributes, (void**)&pAttributes) == S_OK) { + if (pAttributes->GetFlag(BMDDeckLinkSupportsInternalKeying, &flag) == S_OK && flag) { + self->mKeyingSupported = true; + if (pAttributes->GetFlag(BMDDeckLinkSupportsHDKeying, &flag) == S_OK && flag) { + self->mHDKeyingSupported = true; + } + } + pAttributes->Release(); + } + + if (pDL->QueryInterface(IID_IDeckLinkOutput, (void**)&self->mDLOutput) != S_OK) { + self->mDLOutput = NULL; + } + if (self->mKeyingSupported) { + pDL->QueryInterface(IID_IDeckLinkKeyer, (void **)&self->mKeyer); + } + // we don't need the device anymore, release to avoid leaking + pDL->Release(); + + if (!self->mDLOutput) + THRWEXCP(DeckLinkOpenCard, S_OK); + + if (self->mDLOutput->GetDisplayModeIterator(&pDisplayModeIterator) != S_OK) + THRWEXCP(DeckLinkInternalError, S_OK); + + displayFlags = (self->mUse3D) ? bmdDisplayModeSupports3D : 0; + outputFlags = (self->mUse3D) ? bmdVideoOutputDualStream3D : bmdVideoOutputFlagDefault; + pDisplayMode = NULL; + i = 0; + while (pDisplayModeIterator->Next(&pDisplayMode) == S_OK) { + if (pDisplayMode->GetDisplayMode() == self->mDisplayMode + && (pDisplayMode->GetFlags() & displayFlags) == displayFlags) { + if (self->mDLOutput->DoesSupportVideoMode(self->mDisplayMode, bmdFormat8BitBGRA, outputFlags, &support, NULL) != S_OK || + support == bmdDisplayModeNotSupported) + { + printf("Warning: DeckLink card %d reports no BGRA support, proceed anyway\n", cardIdx); + } + break; + } + pDisplayMode->Release(); + pDisplayMode = NULL; + i++; + } + pDisplayModeIterator->Release(); + + if (!pDisplayMode) + THRWEXCP(DeckLinkBadFormat, S_OK); + self->mSize[0] = pDisplayMode->GetWidth(); + self->mSize[1] = pDisplayMode->GetHeight(); + self->mFrameSize = 4*self->mSize[0]*self->mSize[1]; + pDisplayMode->Release(); + if (self->mDLOutput->EnableVideoOutput(self->mDisplayMode, outputFlags) != S_OK) + // this shouldn't fail + THRWEXCP(DeckLinkOpenCard, S_OK); + + if (self->mDLOutput->CreateVideoFrame(self->mSize[0], self->mSize[1], self->mSize[0] * 4, bmdFormat8BitBGRA, bmdFrameFlagFlipVertical, &self->mLeftFrame) != S_OK) + THRWEXCP(DeckLinkInternalError, S_OK); + // clear alpha channel in the frame buffer + self->mLeftFrame->GetBytes((void **)&bytes); + memset(bytes, 0, self->mFrameSize); + if (self->mUse3D) { + if (self->mDLOutput->CreateVideoFrame(self->mSize[0], self->mSize[1], self->mSize[0] * 4, bmdFormat8BitBGRA, bmdFrameFlagFlipVertical, &self->mRightFrame) != S_OK) + THRWEXCP(DeckLinkInternalError, S_OK); + // clear alpha channel in the frame buffer + self->mRightFrame->GetBytes((void **)&bytes); + memset(bytes, 0, self->mFrameSize); + } + } + catch (Exception & exp) + { + printf("DeckLink: exception when opening card %d: %s\n", cardIdx, exp.what()); + exp.report(); + // normally, the object should be deallocated + return -1; + } + // initialization succeeded + return 0; +} + + +// close added decklink +PyObject *DeckLink_close(DeckLink * self) +{ + if (self->mLeftFrame) + self->mLeftFrame->Release(); + if (self->mRightFrame) + self->mRightFrame->Release(); + if (self->mKeyer) + self->mKeyer->Release(); + if (self->mDLOutput) + self->mDLOutput->Release(); + decklink_Reset(self); + Py_RETURN_NONE; +} + + +// refresh decklink key frame +static PyObject *DeckLink_refresh(DeckLink *self, PyObject *args) +{ + // get parameter - refresh source + PyObject *param; + double ts = -1.0; + + if (!PyArg_ParseTuple(args, "O|d:refresh", ¶m, &ts) || !PyBool_Check(param)) { + // report error + PyErr_SetString(PyExc_TypeError, "The value must be a bool"); + return NULL; + } + // some trick here: we are in the business of loading a key frame in decklink, + // no use to do it if we are still in the same rendering frame. + // We find this out by looking at the engine current clock time + KX_KetsjiEngine* engine = KX_GetActiveEngine(); + if (engine->GetClockTime() != self->m_lastClock) + { + self->m_lastClock = engine->GetClockTime(); + // set source refresh + bool refreshSource = (param == Py_True); + uint32_t *leftEye = NULL; + uint32_t *rightEye = NULL; + // try to process key frame from source + try { + // check if optimization is possible + if (self->m_leftEye != NULL) { + ImageBase *leftImage = self->m_leftEye->m_image; + short * srcSize = leftImage->getSize(); + self->mLeftFrame->GetBytes((void **)&leftEye); + if (srcSize[0] == self->mSize[0] && srcSize[1] == self->mSize[1]) + { + // buffer has same size, can load directly + if (!leftImage->loadImage(leftEye, self->mFrameSize, GL_BGRA, ts)) + leftEye = NULL; + } + else { + // scaling is required, go the hard way + unsigned int *src = leftImage->getImage(0, ts); + if (src != NULL) + decklink_ConvImage(leftEye, self->mSize, src, srcSize, self->mUseExtend); + else + leftEye = NULL; + } + } + if (leftEye) { + if (self->mUse3D && self->m_rightEye != NULL) { + ImageBase *rightImage = self->m_rightEye->m_image; + short * srcSize = rightImage->getSize(); + self->mRightFrame->GetBytes((void **)&rightEye); + if (srcSize[0] == self->mSize[0] && srcSize[1] == self->mSize[1]) + { + // buffer has same size, can load directly + rightImage->loadImage(rightEye, self->mFrameSize, GL_BGRA, ts); + } + else { + // scaling is required, go the hard way + unsigned int *src = rightImage->getImage(0, ts); + if (src != NULL) + decklink_ConvImage(rightEye, self->mSize, src, srcSize, self->mUseExtend); + } + } + if (self->mUse3D) { + DeckLink3DFrameWrapper frame3D( + (IDeckLinkVideoFrame*)self->mLeftFrame, + (IDeckLinkVideoFrame*)self->mRightFrame); + self->mDLOutput->DisplayVideoFrameSync(&frame3D); + } + else { + self->mDLOutput->DisplayVideoFrameSync((IDeckLinkVideoFrame*)self->mLeftFrame); + } + } + // refresh texture source, if required + if (refreshSource) { + if (self->m_leftEye) + self->m_leftEye->m_image->refresh(); + if (self->m_rightEye) + self->m_rightEye->m_image->refresh(); + } + } + CATCH_EXCP; + } + Py_RETURN_NONE; +} + +// get source object +static PyObject *DeckLink_getSource(DeckLink *self, PyObject *value, void *closure) +{ + // if source exists + if (self->m_leftEye != NULL) { + Py_INCREF(self->m_leftEye); + return reinterpret_cast<PyObject*>(self->m_leftEye); + } + // otherwise return None + Py_RETURN_NONE; +} + + +// set source object +int DeckLink_setSource(DeckLink *self, PyObject *value, void *closure) +{ + // check new value + if (value == NULL || !pyImageTypes.in(Py_TYPE(value))) { + // report value error + PyErr_SetString(PyExc_TypeError, "Invalid type of value"); + return -1; + } + // increase ref count for new value + Py_INCREF(value); + // release previous + Py_XDECREF(self->m_leftEye); + // set new value + self->m_leftEye = reinterpret_cast<PyImage*>(value); + // return success + return 0; +} + +// get source object +static PyObject *DeckLink_getRight(DeckLink *self, PyObject *value, void *closure) +{ + // if source exists + if (self->m_rightEye != NULL) + { + Py_INCREF(self->m_rightEye); + return reinterpret_cast<PyObject*>(self->m_rightEye); + } + // otherwise return None + Py_RETURN_NONE; +} + + +// set source object +static int DeckLink_setRight(DeckLink *self, PyObject *value, void *closure) +{ + // check new value + if (value == NULL || !pyImageTypes.in(Py_TYPE(value))) + { + // report value error + PyErr_SetString(PyExc_TypeError, "Invalid type of value"); + return -1; + } + // increase ref count for new value + Py_INCREF(value); + // release previous + Py_XDECREF(self->m_rightEye); + // set new value + self->m_rightEye = reinterpret_cast<PyImage*>(value); + // return success + return 0; +} + + +static PyObject *DeckLink_getKeying(DeckLink *self, PyObject *value, void *closure) +{ + if (self->mUseKeying) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} + +static int DeckLink_setKeying(DeckLink *self, PyObject *value, void *closure) +{ + if (value == NULL || !PyBool_Check(value)) + { + PyErr_SetString(PyExc_TypeError, "The value must be a bool"); + return -1; + } + if (self->mKeyer != NULL) + { + if (value == Py_True) + { + if (self->mKeyer->Enable(false) != S_OK) + { + PyErr_SetString(PyExc_RuntimeError, "Error enabling keyer"); + return -1; + } + self->mUseKeying = true; + self->mKeyer->SetLevel(self->mKeyingLevel); + } + else + { + self->mKeyer->Disable(); + self->mUseKeying = false; + } + } + // success + return 0; +} + +static PyObject *DeckLink_getLevel(DeckLink *self, PyObject *value, void *closure) +{ + return Py_BuildValue("h", self->mKeyingLevel); +} + +static int DeckLink_setLevel(DeckLink *self, PyObject *value, void *closure) +{ + long level; + if (value == NULL || !PyLong_Check(value)) { + PyErr_SetString(PyExc_TypeError, "The value must be an integer from 0 to 255"); + return -1; + } + level = PyLong_AsLong(value); + if (level > 255) + level = 255; + else if (level < 0) + level = 0; + self->mKeyingLevel = (uint8_t)level; + if (self->mUseKeying) { + if (self->mKeyer->SetLevel(self->mKeyingLevel) != S_OK) { + PyErr_SetString(PyExc_RuntimeError, "Error changin level of keyer"); + return -1; + } + } + // success + return 0; +} + +static PyObject *DeckLink_getExtend(DeckLink *self, PyObject *value, void *closure) +{ + if (self->mUseExtend) Py_RETURN_TRUE; + else Py_RETURN_FALSE; +} + +static int DeckLink_setExtend(DeckLink *self, PyObject *value, void *closure) +{ + if (value == NULL || !PyBool_Check(value)) + { + PyErr_SetString(PyExc_TypeError, "The value must be a bool"); + return -1; + } + self->mUseExtend = (value == Py_True); + return 0; +} + +// class DeckLink methods +static PyMethodDef decklinkMethods[] = +{ + { "close", (PyCFunction)DeckLink_close, METH_NOARGS, "Close dynamic decklink and restore original"}, + { "refresh", (PyCFunction)DeckLink_refresh, METH_VARARGS, "Refresh decklink from source"}, + {NULL} /* Sentinel */ +}; + +// class DeckLink attributes +static PyGetSetDef decklinkGetSets[] = +{ + { (char*)"source", (getter)DeckLink_getSource, (setter)DeckLink_setSource, (char*)"source of decklink (left eye)", NULL}, + { (char*)"right", (getter)DeckLink_getRight, (setter)DeckLink_setRight, (char*)"source of decklink (right eye)", NULL }, + { (char*)"keying", (getter)DeckLink_getKeying, (setter)DeckLink_setKeying, (char*)"whether keying is enabled (frame is alpha-composited with passthrough output)", NULL }, + { (char*)"level", (getter)DeckLink_getLevel, (setter)DeckLink_setLevel, (char*)"change the level of keying (overall alpha level of key frame, 0 to 255)", NULL }, + { (char*)"extend", (getter)DeckLink_getExtend, (setter)DeckLink_setExtend, (char*)"whether image should stretched to fit frame", NULL }, + { NULL } +}; + + +// class DeckLink declaration +PyTypeObject DeckLinkType = +{ + PyVarObject_HEAD_INIT(NULL, 0) + "VideoTexture.DeckLink", /*tp_name*/ + sizeof(DeckLink), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)DeckLink_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &imageBufferProcs, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "DeckLink objects", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + decklinkMethods, /* tp_methods */ + 0, /* tp_members */ + decklinkGetSets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DeckLink_init, /* tp_init */ + 0, /* tp_alloc */ + DeckLink_new, /* tp_new */ +}; + +#endif /* WITH_GAMEENGINE_DECKLINK */ diff --git a/source/gameengine/VideoTexture/DeckLink.h b/source/gameengine/VideoTexture/DeckLink.h new file mode 100644 index 00000000000..1c96af7b4bc --- /dev/null +++ b/source/gameengine/VideoTexture/DeckLink.h @@ -0,0 +1,86 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file VideoTexture/DeckLink.h + * \ingroup bgevideotex + */ + +#ifndef __DECKLINK_H__ +#define __DECKLINK_H__ + +#ifdef WITH_GAMEENGINE_DECKLINK + +#include "EXP_PyObjectPlus.h" +#include <structmember.h> + +#include "DNA_image_types.h" + +#include "DeckLinkAPI.h" + +#include "ImageBase.h" +#include "BlendType.h" +#include "Exception.h" + + +// type DeckLink declaration +struct DeckLink +{ + PyObject_HEAD + + // last refresh + double m_lastClock; + // decklink card to which we output + IDeckLinkOutput * mDLOutput; + IDeckLinkKeyer * mKeyer; + IDeckLinkMutableVideoFrame *mLeftFrame; + IDeckLinkMutableVideoFrame *mRightFrame; + bool mUse3D; + bool mUseKeying; + bool mUseExtend; + bool mKeyingSupported; + bool mHDKeyingSupported; + uint8_t mKeyingLevel; + BMDDisplayMode mDisplayMode; + short mSize[2]; + uint32_t mFrameSize; + + // image source + PyImage * m_leftEye; + PyImage * m_rightEye; +}; + + +// DeckLink type description +extern PyTypeObject DeckLinkType; + +// helper function +HRESULT decklink_ReadDisplayMode(const char *format, size_t len, BMDDisplayMode *displayMode); +HRESULT decklink_ReadPixelFormat(const char *format, size_t len, BMDPixelFormat *displayMode); + +#endif /* WITH_GAMEENGINE_DECKLINK */ + +#endif /* __DECKLINK_H__ */ diff --git a/source/gameengine/VideoTexture/Exception.cpp b/source/gameengine/VideoTexture/Exception.cpp index 08616e0c41c..9f82987ea62 100644 --- a/source/gameengine/VideoTexture/Exception.cpp +++ b/source/gameengine/VideoTexture/Exception.cpp @@ -213,6 +213,7 @@ void registerAllExceptions(void) ImageSizesNotMatchDesc.registerDesc(); ImageHasExportsDesc.registerDesc(); InvalidColorChannelDesc.registerDesc(); + InvalidImageModeDesc.registerDesc(); SceneInvalidDesc.registerDesc(); CameraInvalidDesc.registerDesc(); ObserverInvalidDesc.registerDesc(); @@ -223,4 +224,18 @@ void registerAllExceptions(void) MirrorTooSmallDesc.registerDesc(); SourceVideoEmptyDesc.registerDesc(); SourceVideoCreationDesc.registerDesc(); + OffScreenInvalidDesc.registerDesc(); +#ifdef WITH_GAMEENGINE_DECKLINK + AutoDetectionNotAvailDesc.registerDesc(); + DeckLinkBadDisplayModeDesc.registerDesc(); + DeckLinkBadPixelFormatDesc.registerDesc(); + DeckLinkOpenCardDesc.registerDesc(); + DeckLinkBadFormatDesc.registerDesc(); + DeckLinkInternalErrorDesc.registerDesc(); + SourceVideoOnlyCaptureDesc.registerDesc(); + VideoDeckLinkBadFormatDesc.registerDesc(); + VideoDeckLinkOpenCardDesc.registerDesc(); + VideoDeckLinkDvpInternalErrorDesc.registerDesc(); + VideoDeckLinkPinMemoryErrorDesc.registerDesc(); +#endif } diff --git a/source/gameengine/VideoTexture/Exception.h b/source/gameengine/VideoTexture/Exception.h index c3c27abe019..c4de85ff34d 100644 --- a/source/gameengine/VideoTexture/Exception.h +++ b/source/gameengine/VideoTexture/Exception.h @@ -46,7 +46,7 @@ throw Exception (err, macroHRslt, __FILE__, __LINE__); \ } -#define THRWEXCP(err,hRslt) throw Exception (err, hRslt, __FILE__, __LINE__); +#define THRWEXCP(err,hRslt) throw Exception (err, hRslt, __FILE__, __LINE__) #if defined WIN32 @@ -209,9 +209,11 @@ extern ExpDesc MaterialNotAvailDesc; extern ExpDesc ImageSizesNotMatchDesc; extern ExpDesc ImageHasExportsDesc; extern ExpDesc InvalidColorChannelDesc; +extern ExpDesc InvalidImageModeDesc; extern ExpDesc SceneInvalidDesc; extern ExpDesc CameraInvalidDesc; extern ExpDesc ObserverInvalidDesc; +extern ExpDesc OffScreenInvalidDesc; extern ExpDesc MirrorInvalidDesc; extern ExpDesc MirrorSizeInvalidDesc; extern ExpDesc MirrorNormalInvalidDesc; @@ -219,7 +221,19 @@ extern ExpDesc MirrorHorizontalDesc; extern ExpDesc MirrorTooSmallDesc; extern ExpDesc SourceVideoEmptyDesc; extern ExpDesc SourceVideoCreationDesc; - +extern ExpDesc DeckLinkBadDisplayModeDesc; +extern ExpDesc DeckLinkBadPixelFormatDesc; +extern ExpDesc AutoDetectionNotAvailDesc; +extern ExpDesc DeckLinkOpenCardDesc; +extern ExpDesc DeckLinkBadFormatDesc; +extern ExpDesc DeckLinkInternalErrorDesc; +extern ExpDesc SourceVideoOnlyCaptureDesc; +extern ExpDesc VideoDeckLinkBadFormatDesc; +extern ExpDesc VideoDeckLinkOpenCardDesc; +extern ExpDesc VideoDeckLinkDvpInternalErrorDesc; +extern ExpDesc VideoDeckLinkPinMemoryErrorDesc; + +extern ExceptionID InvalidImageMode; void registerAllExceptions(void); #endif diff --git a/source/gameengine/VideoTexture/FilterBase.h b/source/gameengine/VideoTexture/FilterBase.h index 498917e2375..db688d551d0 100644 --- a/source/gameengine/VideoTexture/FilterBase.h +++ b/source/gameengine/VideoTexture/FilterBase.h @@ -44,6 +44,13 @@ #define VT_A(v) ((unsigned char*)&v)[3] #define VT_RGBA(v,r,g,b,a) VT_R(v)=(unsigned char)r, VT_G(v)=(unsigned char)g, VT_B(v)=(unsigned char)b, VT_A(v)=(unsigned char)a +#ifdef __BIG_ENDIAN__ +# define VT_SWAPBR(i) ((((i) >> 16) & 0xFF00) + (((i) & 0xFF00) << 16) + ((i) & 0xFF00FF)) +#else +# define VT_SWAPBR(i) ((((i) & 0xFF) << 16) + (((i) >> 16) & 0xFF) + ((i) & 0xFF00FF00)) +#endif + + // forward declaration class FilterBase; diff --git a/source/gameengine/VideoTexture/FilterSource.h b/source/gameengine/VideoTexture/FilterSource.h index bc80b2b36cc..820576dfff9 100644 --- a/source/gameengine/VideoTexture/FilterSource.h +++ b/source/gameengine/VideoTexture/FilterSource.h @@ -81,6 +81,30 @@ protected: } }; +/// class for BGRA32 conversion +class FilterBGRA32 : public FilterBase +{ +public: + /// constructor + FilterBGRA32 (void) {} + /// destructor + virtual ~FilterBGRA32 (void) {} + + /// get source pixel size + virtual unsigned int getPixelSize (void) { return 4; } + +protected: + /// filter pixel, source byte buffer + virtual unsigned int filter( + unsigned char *src, short x, short y, + short * size, unsigned int pixSize, unsigned int val) + { + VT_RGBA(val,src[2],src[1],src[0],src[3]); + return val; + } +}; + + /// class for BGR24 conversion class FilterBGR24 : public FilterBase { diff --git a/source/gameengine/VideoTexture/ImageBase.cpp b/source/gameengine/VideoTexture/ImageBase.cpp index 8be152c7b8e..0db1fa293da 100644 --- a/source/gameengine/VideoTexture/ImageBase.cpp +++ b/source/gameengine/VideoTexture/ImageBase.cpp @@ -32,7 +32,6 @@ extern "C" { #include "bgl.h" } -#include "glew-mx.h" #include <vector> #include <string.h> @@ -50,6 +49,14 @@ extern "C" { // ImageBase class implementation +ExceptionID ImageHasExports; +ExceptionID InvalidColorChannel; +ExceptionID InvalidImageMode; + +ExpDesc ImageHasExportsDesc(ImageHasExports, "Image has exported buffers, cannot resize"); +ExpDesc InvalidColorChannelDesc(InvalidColorChannel, "Invalid or too many color channels specified. At most 4 values within R, G, B, A, 0, 1"); +ExpDesc InvalidImageModeDesc(InvalidImageMode, "Invalid image mode, only RGBA and BGRA are supported"); + // constructor ImageBase::ImageBase (bool staticSrc) : m_image(NULL), m_imgSize(0), m_avail(false), m_scale(false), m_scaleChange(false), m_flip(false), @@ -111,6 +118,28 @@ unsigned int * ImageBase::getImage (unsigned int texId, double ts) return m_avail ? m_image : NULL; } +bool ImageBase::loadImage(unsigned int *buffer, unsigned int size, unsigned int format, double ts) +{ + unsigned int *d, *s, v, len; + if (getImage(0, ts) != NULL && size >= getBuffSize()) { + switch (format) { + case GL_RGBA: + memcpy(buffer, m_image, getBuffSize()); + break; + case GL_BGRA: + len = (unsigned int)m_size[0] * m_size[1]; + for (s=m_image, d=buffer; len; len--) { + v = *s++; + *d++ = VT_SWAPBR(v); + } + break; + default: + THRWEXCP(InvalidImageMode,S_OK); + } + return true; + } + return false; +} // refresh image source void ImageBase::refresh (void) @@ -179,11 +208,18 @@ void ImageBase::setFilter (PyFilter * filt) m_pyfilter = filt; } -ExceptionID ImageHasExports; -ExceptionID InvalidColorChannel; +void ImageBase::swapImageBR() +{ + unsigned int size, v, *s; -ExpDesc ImageHasExportsDesc(ImageHasExports, "Image has exported buffers, cannot resize"); -ExpDesc InvalidColorChannelDesc(InvalidColorChannel, "Invalid or too many color channels specified. At most 4 values within R, G, B, A, 0, 1"); + if (m_avail) { + size = 1 * m_size[0] * m_size[1]; + for (s=m_image; size; size--) { + v = *s; + *s++ = VT_SWAPBR(v); + } + } +} // initialize image data void ImageBase::init (short width, short height) @@ -500,10 +536,57 @@ PyObject *Image_getSize (PyImage *self, void *closure) } // refresh image -PyObject *Image_refresh (PyImage *self) -{ +PyObject *Image_refresh (PyImage *self, PyObject *args) +{ + Py_buffer buffer; + bool done = true; + char *mode = NULL; + double ts = -1.0; + unsigned int format; + + memset(&buffer, 0, sizeof(buffer)); + if (PyArg_ParseTuple(args, "|s*sd:refresh", &buffer, &mode, &ts)) { + if (buffer.buf) { + // a target buffer is provided, verify its format + if (buffer.readonly) { + PyErr_SetString(PyExc_TypeError, "Buffers passed in argument must be writable"); + } + else if (!PyBuffer_IsContiguous(&buffer, 'C')) { + PyErr_SetString(PyExc_TypeError, "Buffers passed in argument must be contiguous in memory"); + } + else if (((intptr_t)buffer.buf & 3) != 0) { + PyErr_SetString(PyExc_TypeError, "Buffers passed in argument must be aligned to 4 bytes boundary"); + } + else { + // ready to get the image into our buffer + try { + if (mode == NULL || !strcmp(mode, "RGBA")) + format = GL_RGBA; + else if (!strcmp(mode, "BGRA")) + format = GL_BGRA; + else + THRWEXCP(InvalidImageMode,S_OK); + + done = self->m_image->loadImage((unsigned int *)buffer.buf, buffer.len, format, ts); + } + catch (Exception & exp) { + exp.report(); + } + } + PyBuffer_Release(&buffer); + if (PyErr_Occurred()) { + return NULL; + } + } + } + else { + return NULL; + } + self->m_image->refresh(); - Py_RETURN_NONE; + if (done) + Py_RETURN_TRUE; + Py_RETURN_FALSE; } // get scale diff --git a/source/gameengine/VideoTexture/ImageBase.h b/source/gameengine/VideoTexture/ImageBase.h index f646d145365..4c9fc5a58fb 100644 --- a/source/gameengine/VideoTexture/ImageBase.h +++ b/source/gameengine/VideoTexture/ImageBase.h @@ -40,6 +40,7 @@ #include "FilterBase.h" +#include "glew-mx.h" // forward declarations struct PyImage; @@ -104,6 +105,13 @@ public: /// calculate size(nearest power of 2) static short calcSize(short size); + /// calculate image from sources and send it to a target buffer instead of a texture + /// format is GL_RGBA or GL_BGRA + virtual bool loadImage(unsigned int *buffer, unsigned int size, unsigned int format, double ts); + + /// swap the B and R channel in-place in the image buffer + void swapImageBR(); + /// number of buffer pointing to m_image, public because not handled by this class int m_exports; @@ -348,7 +356,7 @@ PyObject *Image_getImage(PyImage *self, char *mode); // get image size PyObject *Image_getSize(PyImage *self, void *closure); // refresh image - invalidate current content -PyObject *Image_refresh(PyImage *self); +PyObject *Image_refresh(PyImage *self, PyObject *args); // get scale PyObject *Image_getScale(PyImage *self, void *closure); diff --git a/source/gameengine/VideoTexture/ImageMix.cpp b/source/gameengine/VideoTexture/ImageMix.cpp index 973be52e0fc..2de00f5ba05 100644 --- a/source/gameengine/VideoTexture/ImageMix.cpp +++ b/source/gameengine/VideoTexture/ImageMix.cpp @@ -156,7 +156,7 @@ static PyMethodDef imageMixMethods[] = { {"getWeight", (PyCFunction)getWeight, METH_VARARGS, "get image source weight"}, {"setWeight", (PyCFunction)setWeight, METH_VARARGS, "set image source weight"}, // methods from ImageBase class - {"refresh", (PyCFunction)Image_refresh, METH_NOARGS, "Refresh image - invalidate its current content"}, + {"refresh", (PyCFunction)Image_refresh, METH_VARARGS, "Refresh image - invalidate its current content"}, {NULL} }; // attributes structure diff --git a/source/gameengine/VideoTexture/ImageRender.cpp b/source/gameengine/VideoTexture/ImageRender.cpp index a374fbba2df..9991bf42a9f 100644 --- a/source/gameengine/VideoTexture/ImageRender.cpp +++ b/source/gameengine/VideoTexture/ImageRender.cpp @@ -43,6 +43,8 @@ #include "RAS_CameraData.h" #include "RAS_MeshObject.h" #include "RAS_Polygon.h" +#include "RAS_IOffScreen.h" +#include "RAS_ISync.h" #include "BLI_math.h" #include "ImageRender.h" @@ -51,11 +53,12 @@ #include "Exception.h" #include "Texture.h" -ExceptionID SceneInvalid, CameraInvalid, ObserverInvalid; +ExceptionID SceneInvalid, CameraInvalid, ObserverInvalid, OffScreenInvalid; ExceptionID MirrorInvalid, MirrorSizeInvalid, MirrorNormalInvalid, MirrorHorizontal, MirrorTooSmall; ExpDesc SceneInvalidDesc(SceneInvalid, "Scene object is invalid"); ExpDesc CameraInvalidDesc(CameraInvalid, "Camera object is invalid"); ExpDesc ObserverInvalidDesc(ObserverInvalid, "Observer object is invalid"); +ExpDesc OffScreenInvalidDesc(OffScreenInvalid, "Offscreen object is invalid"); ExpDesc MirrorInvalidDesc(MirrorInvalid, "Mirror object is invalid"); ExpDesc MirrorSizeInvalidDesc(MirrorSizeInvalid, "Mirror has no vertex or no size"); ExpDesc MirrorNormalInvalidDesc(MirrorNormalInvalid, "Cannot determine mirror plane"); @@ -63,12 +66,15 @@ ExpDesc MirrorHorizontalDesc(MirrorHorizontal, "Mirror is horizontal in local sp ExpDesc MirrorTooSmallDesc(MirrorTooSmall, "Mirror is too small"); // constructor -ImageRender::ImageRender (KX_Scene *scene, KX_Camera * camera) : - ImageViewport(), +ImageRender::ImageRender (KX_Scene *scene, KX_Camera * camera, PyRASOffScreen * offscreen) : + ImageViewport(offscreen), m_render(true), + m_done(false), m_scene(scene), m_camera(camera), m_owncamera(false), + m_offscreen(offscreen), + m_sync(NULL), m_observer(NULL), m_mirror(NULL), m_clip(100.f), @@ -81,6 +87,10 @@ ImageRender::ImageRender (KX_Scene *scene, KX_Camera * camera) : m_engine = KX_GetActiveEngine(); m_rasterizer = m_engine->GetRasterizer(); m_canvas = m_engine->GetCanvas(); + // keep a reference to the offscreen buffer + if (m_offscreen) { + Py_INCREF(m_offscreen); + } } // destructor @@ -88,6 +98,9 @@ ImageRender::~ImageRender (void) { if (m_owncamera) m_camera->Release(); + if (m_sync) + delete m_sync; + Py_XDECREF(m_offscreen); } // get background color @@ -121,30 +134,41 @@ void ImageRender::setBackgroundFromScene (KX_Scene *scene) // capture image from viewport -void ImageRender::calcImage (unsigned int texId, double ts) +void ImageRender::calcViewport (unsigned int texId, double ts, unsigned int format) { - if (m_rasterizer->GetDrawingMode() != RAS_IRasterizer::KX_TEXTURED || // no need for texture - m_camera->GetViewport() || // camera must be inactive - m_camera == m_scene->GetActiveCamera()) - { - // no need to compute texture in non texture rendering - m_avail = false; - return; - } // render the scene from the camera - Render(); - // get image from viewport - ImageViewport::calcImage(texId, ts); - // restore OpenGL state - m_canvas->EndFrame(); + if (!m_done) { + if (!Render()) { + return; + } + } + else if (m_offscreen) { + m_offscreen->ofs->Bind(RAS_IOffScreen::RAS_OFS_BIND_READ); + } + // wait until all render operations are completed + WaitSync(); + // get image from viewport (or FBO) + ImageViewport::calcViewport(texId, ts, format); + if (m_offscreen) { + m_offscreen->ofs->Unbind(); + } } -void ImageRender::Render() +bool ImageRender::Render() { RAS_FrameFrustum frustum; - if (!m_render) - return; + if (!m_render || + m_rasterizer->GetDrawingMode() != RAS_IRasterizer::KX_TEXTURED || // no need for texture + m_camera->GetViewport() || // camera must be inactive + m_camera == m_scene->GetActiveCamera()) + { + // no need to compute texture in non texture rendering + return false; + } + + if (!m_scene->IsShadowDone()) + m_engine->RenderShadowBuffers(m_scene); if (m_mirror) { @@ -164,7 +188,7 @@ void ImageRender::Render() MT_Scalar observerDistance = mirrorPlaneDTerm - observerWorldPos.dot(mirrorWorldZ); // if distance < 0.01 => observer is on wrong side of mirror, don't render if (observerDistance < 0.01) - return; + return false; // set camera world position = observerPos + normal * 2 * distance MT_Point3 cameraWorldPos = observerWorldPos + (MT_Scalar(2.0)*observerDistance)*mirrorWorldZ; m_camera->GetSGNode()->SetLocalPosition(cameraWorldPos); @@ -215,7 +239,15 @@ void ImageRender::Render() RAS_Rect area = m_canvas->GetWindowArea(); // The screen area that ImageViewport will copy is also the rendering zone - m_canvas->SetViewPort(m_position[0], m_position[1], m_position[0]+m_capSize[0]-1, m_position[1]+m_capSize[1]-1); + if (m_offscreen) { + // bind the fbo and set the viewport to full size + m_offscreen->ofs->Bind(RAS_IOffScreen::RAS_OFS_BIND_RENDER); + // this is needed to stop crashing in canvas check + m_canvas->UpdateViewPort(0, 0, m_offscreen->ofs->GetWidth(), m_offscreen->ofs->GetHeight()); + } + else { + m_canvas->SetViewPort(m_position[0], m_position[1], m_position[0]+m_capSize[0]-1, m_position[1]+m_capSize[1]-1); + } m_canvas->ClearColor(m_background[0], m_background[1], m_background[2], m_background[3]); m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER); m_rasterizer->BeginFrame(m_engine->GetClockTime()); @@ -292,17 +324,18 @@ void ImageRender::Render() MT_Transform camtrans(m_camera->GetWorldToCamera()); MT_Matrix4x4 viewmat(camtrans); - m_rasterizer->SetViewMatrix(viewmat, m_camera->NodeGetWorldOrientation(), m_camera->NodeGetWorldPosition(), m_camera->GetCameraData()->m_perspective); + m_rasterizer->SetViewMatrix(viewmat, m_camera->NodeGetWorldOrientation(), m_camera->NodeGetWorldPosition(), m_camera->NodeGetLocalScaling(), m_camera->GetCameraData()->m_perspective); m_camera->SetModelviewMatrix(viewmat); // restore the stereo mode now that the matrix is computed m_rasterizer->SetStereoMode(stereomode); - if (stereomode == RAS_IRasterizer::RAS_STEREO_QUADBUFFERED) { - // In QUAD buffer stereo mode, the GE render pass ends with the right eye on the right buffer - // but we need to draw on the left buffer to capture the render - // TODO: implement an explicit function in rasterizer to restore the left buffer. - m_rasterizer->SetEye(RAS_IRasterizer::RAS_STEREO_LEFTEYE); - } + if (m_rasterizer->Stereo()) { + // stereo mode change render settings that disturb this render, cancel them all + // we don't need to restore them as they are set before each frame render. + glDrawBuffer(GL_BACK_LEFT); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glDisable(GL_POLYGON_STIPPLE); + } m_scene->CalculateVisibleMeshes(m_rasterizer,m_camera); @@ -314,8 +347,48 @@ void ImageRender::Render() // restore the canvas area now that the render is completed m_canvas->GetWindowArea() = area; + m_canvas->EndFrame(); + + // In case multisample is active, blit the FBO + if (m_offscreen) + m_offscreen->ofs->Blit(); + // end of all render operations, let's create a sync object just in case + if (m_sync) { + // a sync from a previous render, should not happen + delete m_sync; + m_sync = NULL; + } + m_sync = m_rasterizer->CreateSync(RAS_ISync::RAS_SYNC_TYPE_FENCE); + // remember that we have done render + m_done = true; + // the image is not available at this stage + m_avail = false; + return true; +} + +void ImageRender::Unbind() +{ + if (m_offscreen) + { + m_offscreen->ofs->Unbind(); + } } +void ImageRender::WaitSync() +{ + if (m_sync) { + m_sync->Wait(); + // done with it, deleted it + delete m_sync; + m_sync = NULL; + } + if (m_offscreen) { + // this is needed to finalize the image if the target is a texture + m_offscreen->ofs->MipMap(); + } + // all rendered operation done and complete, invalidate render for next time + m_done = false; +} // cast Image pointer to ImageRender inline ImageRender * getImageRender (PyImage *self) @@ -337,11 +410,13 @@ static int ImageRender_init(PyObject *pySelf, PyObject *args, PyObject *kwds) PyObject *scene; // camera object PyObject *camera; + // offscreen buffer object + PyRASOffScreen *offscreen = NULL; // parameter keywords - static const char *kwlist[] = {"sceneObj", "cameraObj", NULL}; + static const char *kwlist[] = {"sceneObj", "cameraObj", "ofsObj", NULL}; // get parameters - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO", - const_cast<char**>(kwlist), &scene, &camera)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO|O", + const_cast<char**>(kwlist), &scene, &camera, &offscreen)) return -1; try { @@ -357,11 +432,16 @@ static int ImageRender_init(PyObject *pySelf, PyObject *args, PyObject *kwds) // throw exception if camera is not available if (cameraPtr == NULL) THRWEXCP(CameraInvalid, S_OK); + if (offscreen) { + if (Py_TYPE(offscreen) != &PyRASOffScreen_Type) { + THRWEXCP(OffScreenInvalid, S_OK); + } + } // get pointer to image structure PyImage *self = reinterpret_cast<PyImage*>(pySelf); // create source object if (self->m_image != NULL) delete self->m_image; - self->m_image = new ImageRender(scenePtr, cameraPtr); + self->m_image = new ImageRender(scenePtr, cameraPtr, offscreen); } catch (Exception & exp) { @@ -372,6 +452,55 @@ static int ImageRender_init(PyObject *pySelf, PyObject *args, PyObject *kwds) return 0; } +static PyObject *ImageRender_refresh(PyImage *self, PyObject *args) +{ + ImageRender *imageRender = getImageRender(self); + + if (!imageRender) { + PyErr_SetString(PyExc_TypeError, "Incomplete ImageRender() object"); + return NULL; + } + if (PyArg_ParseTuple(args, "")) { + // refresh called with no argument. + // For other image objects it simply invalidates the image buffer + // For ImageRender it triggers a render+sync + // Note that this only makes sense when doing offscreen render on texture + if (!imageRender->isDone()) { + if (!imageRender->Render()) { + Py_RETURN_FALSE; + } + // as we are not trying to read the pixels, just unbind + imageRender->Unbind(); + } + // wait until all render operations are completed + // this will also finalize the texture + imageRender->WaitSync(); + Py_RETURN_TRUE; + } + else { + // fallback on standard processing + PyErr_Clear(); + return Image_refresh(self, args); + } +} + +// refresh image +static PyObject *ImageRender_render(PyImage *self) +{ + ImageRender *imageRender = getImageRender(self); + + if (!imageRender) { + PyErr_SetString(PyExc_TypeError, "Incomplete ImageRender() object"); + return NULL; + } + if (!imageRender->Render()) { + Py_RETURN_FALSE; + } + // we are not reading the pixels now, unbind + imageRender->Unbind(); + Py_RETURN_TRUE; +} + // get background color static PyObject *getBackground (PyImage *self, void *closure) @@ -410,7 +539,8 @@ static int setBackground(PyImage *self, PyObject *value, void *closure) // methods structure static PyMethodDef imageRenderMethods[] = { // methods from ImageBase class - {"refresh", (PyCFunction)Image_refresh, METH_NOARGS, "Refresh image - invalidate its current content"}, + {"refresh", (PyCFunction)ImageRender_refresh, METH_VARARGS, "Refresh image - invalidate its current content after optionally transferring its content to a target buffer"}, + {"render", (PyCFunction)ImageRender_render, METH_NOARGS, "Render scene - run before refresh() to performs asynchronous render"}, {NULL} }; // attributes structure @@ -601,7 +731,9 @@ static PyGetSetDef imageMirrorGetSets[] = ImageRender::ImageRender (KX_Scene *scene, KX_GameObject *observer, KX_GameObject *mirror, RAS_IPolyMaterial *mat) : ImageViewport(), m_render(false), + m_done(false), m_scene(scene), + m_offscreen(NULL), m_observer(observer), m_mirror(mirror), m_clip(100.f) diff --git a/source/gameengine/VideoTexture/ImageRender.h b/source/gameengine/VideoTexture/ImageRender.h index ef55e4dea84..d062db44348 100644 --- a/source/gameengine/VideoTexture/ImageRender.h +++ b/source/gameengine/VideoTexture/ImageRender.h @@ -39,6 +39,8 @@ #include "DNA_screen_types.h" #include "RAS_ICanvas.h" #include "RAS_IRasterizer.h" +#include "RAS_IOffScreen.h" +#include "RAS_ISync.h" #include "ImageViewport.h" @@ -48,7 +50,7 @@ class ImageRender : public ImageViewport { public: /// constructor - ImageRender(KX_Scene *scene, KX_Camera *camera); + ImageRender(KX_Scene *scene, KX_Camera *camera, PyRASOffScreen *offscreen); ImageRender(KX_Scene *scene, KX_GameObject *observer, KX_GameObject *mirror, RAS_IPolyMaterial * mat); /// destructor @@ -63,16 +65,30 @@ public: float getClip (void) { return m_clip; } /// set whole buffer use void setClip (float clip) { m_clip = clip; } + /// render status + bool isDone() { return m_done; } + /// render frame (public so that it is accessible from python) + bool Render(); + /// in case fbo is used, method to unbind + void Unbind(); + /// wait for render to complete + void WaitSync(); protected: /// true if ready to render bool m_render; + /// is render done already? + bool m_done; /// rendered scene KX_Scene * m_scene; /// camera for render KX_Camera * m_camera; /// do we own the camera? bool m_owncamera; + /// if offscreen render + PyRASOffScreen *m_offscreen; + /// object to synchronize render even if no buffer transfer + RAS_ISync *m_sync; /// for mirror operation KX_GameObject * m_observer; KX_GameObject * m_mirror; @@ -91,15 +107,15 @@ protected: KX_KetsjiEngine* m_engine; /// background color - float m_background[4]; + float m_background[4]; /// render 3d scene to image - virtual void calcImage (unsigned int texId, double ts); + virtual void calcImage (unsigned int texId, double ts) { calcViewport(texId, ts, GL_RGBA); } + + /// render 3d scene to image + virtual void calcViewport (unsigned int texId, double ts, unsigned int format); - void Render(); - void SetupRenderFrame(KX_Scene *scene, KX_Camera* cam); - void RenderFrame(KX_Scene* scene, KX_Camera* cam); void setBackgroundFromScene(KX_Scene *scene); void SetWorldSettings(KX_WorldInfo* wi); }; diff --git a/source/gameengine/VideoTexture/ImageViewport.cpp b/source/gameengine/VideoTexture/ImageViewport.cpp index 820a019832e..8852c190053 100644 --- a/source/gameengine/VideoTexture/ImageViewport.cpp +++ b/source/gameengine/VideoTexture/ImageViewport.cpp @@ -45,14 +45,22 @@ // constructor -ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false) +ImageViewport::ImageViewport (PyRASOffScreen *offscreen) : m_alpha(false), m_texInit(false) { // get viewport rectangle - RAS_Rect rect = KX_GetActiveEngine()->GetCanvas()->GetWindowArea(); - m_viewport[0] = rect.GetLeft(); - m_viewport[1] = rect.GetBottom(); - m_viewport[2] = rect.GetWidth(); - m_viewport[3] = rect.GetHeight(); + if (offscreen) { + m_viewport[0] = 0; + m_viewport[1] = 0; + m_viewport[2] = offscreen->ofs->GetWidth(); + m_viewport[3] = offscreen->ofs->GetHeight(); + } + else { + RAS_Rect rect = KX_GetActiveEngine()->GetCanvas()->GetWindowArea(); + m_viewport[0] = rect.GetLeft(); + m_viewport[1] = rect.GetBottom(); + m_viewport[2] = rect.GetWidth(); + m_viewport[3] = rect.GetHeight(); + } //glGetIntegerv(GL_VIEWPORT, m_viewport); // create buffer for viewport image @@ -60,7 +68,7 @@ ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false) // float (1 float = 4 bytes per pixel) m_viewportImage = new BYTE [4 * getViewportSize()[0] * getViewportSize()[1]]; // set attributes - setWhole(false); + setWhole((offscreen) ? true : false); } // destructor @@ -126,25 +134,26 @@ void ImageViewport::setPosition (GLint pos[2]) // capture image from viewport -void ImageViewport::calcImage (unsigned int texId, double ts) +void ImageViewport::calcViewport (unsigned int texId, double ts, unsigned int format) { // if scale was changed if (m_scaleChange) // reset image init(m_capSize[0], m_capSize[1]); // if texture wasn't initialized - if (!m_texInit) { + if (!m_texInit && texId != 0) { // initialize it loadTexture(texId, m_image, m_size); m_texInit = true; } // if texture can be directly created - if (texId != 0 && m_pyfilter == NULL && m_capSize[0] == calcSize(m_capSize[0]) - && m_capSize[1] == calcSize(m_capSize[1]) && !m_flip && !m_zbuff && !m_depth) + if (texId != 0 && m_pyfilter == NULL && m_size[0] == m_capSize[0] && + m_size[1] == m_capSize[1] && !m_flip && !m_zbuff && !m_depth) { // just copy current viewport to texture glBindTexture(GL_TEXTURE_2D, texId); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1]); + glBindTexture(GL_TEXTURE_2D, 0); // image is not available m_avail = false; } @@ -176,11 +185,33 @@ void ImageViewport::calcImage (unsigned int texId, double ts) // get frame buffer data if (m_alpha) { - glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA, - GL_UNSIGNED_BYTE, m_viewportImage); - // filter loaded data - FilterRGBA32 filt; - filterImage(filt, m_viewportImage, m_capSize); + // as we are reading the pixel in the native format, we can read directly in the image buffer + // if we are sure that no processing is needed on the image + if (m_size[0] == m_capSize[0] && + m_size[1] == m_capSize[1] && + !m_flip && + !m_pyfilter) + { + glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], format, + GL_UNSIGNED_BYTE, m_image); + m_avail = true; + } + else if (!m_pyfilter) { + glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], format, + GL_UNSIGNED_BYTE, m_viewportImage); + FilterRGBA32 filt; + filterImage(filt, m_viewportImage, m_capSize); + } + else { + glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA, + GL_UNSIGNED_BYTE, m_viewportImage); + FilterRGBA32 filt; + filterImage(filt, m_viewportImage, m_capSize); + if (format == GL_BGRA) { + // in place byte swapping + swapImageBR(); + } + } } else { glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB, @@ -188,12 +219,46 @@ void ImageViewport::calcImage (unsigned int texId, double ts) // filter loaded data FilterRGB24 filt; filterImage(filt, m_viewportImage, m_capSize); + if (format == GL_BGRA) { + // in place byte swapping + swapImageBR(); + } } } } } } +bool ImageViewport::loadImage(unsigned int *buffer, unsigned int size, unsigned int format, double ts) +{ + unsigned int *tmp_image; + bool ret; + + // if scale was changed + if (m_scaleChange) { + // reset image + init(m_capSize[0], m_capSize[1]); + } + + // size must be identical + if (size < getBuffSize()) + return false; + + if (m_avail) { + // just copy + return ImageBase::loadImage(buffer, size, format, ts); + } + else { + tmp_image = m_image; + m_image = buffer; + calcViewport(0, ts, format); + ret = m_avail; + m_image = tmp_image; + // since the image was not loaded to our buffer, it's not valid + m_avail = false; + } + return ret; +} // cast Image pointer to ImageViewport @@ -336,7 +401,7 @@ int ImageViewport_setCaptureSize(PyImage *self, PyObject *value, void *closure) // methods structure static PyMethodDef imageViewportMethods[] = { // methods from ImageBase class - {"refresh", (PyCFunction)Image_refresh, METH_NOARGS, "Refresh image - invalidate its current content"}, + {"refresh", (PyCFunction)Image_refresh, METH_VARARGS, "Refresh image - invalidate its current content"}, {NULL} }; // attributes structure diff --git a/source/gameengine/VideoTexture/ImageViewport.h b/source/gameengine/VideoTexture/ImageViewport.h index 10d894a9fb8..8a7e9cfd2ba 100644 --- a/source/gameengine/VideoTexture/ImageViewport.h +++ b/source/gameengine/VideoTexture/ImageViewport.h @@ -35,6 +35,7 @@ #include "Common.h" #include "ImageBase.h" +#include "RAS_IOffScreen.h" /// class for viewport access @@ -42,7 +43,7 @@ class ImageViewport : public ImageBase { public: /// constructor - ImageViewport (void); + ImageViewport (PyRASOffScreen *offscreen=NULL); /// destructor virtual ~ImageViewport (void); @@ -67,6 +68,9 @@ public: /// set position in viewport void setPosition (GLint pos[2] = NULL); + /// capture image from viewport to user buffer + virtual bool loadImage(unsigned int *buffer, unsigned int size, unsigned int format, double ts); + protected: /// frame buffer rectangle GLint m_viewport[4]; @@ -89,7 +93,10 @@ protected: bool m_texInit; /// capture image from viewport - virtual void calcImage (unsigned int texId, double ts); + virtual void calcImage (unsigned int texId, double ts) { calcViewport(texId, ts, GL_RGBA); } + + /// capture image from viewport + virtual void calcViewport (unsigned int texId, double ts, unsigned int format); /// get viewport size GLint * getViewportSize (void) { return m_viewport + 2; } diff --git a/source/gameengine/VideoTexture/Texture.cpp b/source/gameengine/VideoTexture/Texture.cpp index f1c7bc303ee..bb995747360 100644 --- a/source/gameengine/VideoTexture/Texture.cpp +++ b/source/gameengine/VideoTexture/Texture.cpp @@ -393,9 +393,10 @@ static PyObject *Texture_refresh(Texture *self, PyObject *args) } // load texture for rendering loadTexture(self->m_actTex, texture, size, self->m_mipmap); - - // refresh texture source, if required - if (refreshSource) self->m_source->m_image->refresh(); + } + // refresh texture source, if required + if (refreshSource) { + self->m_source->m_image->refresh(); } } } diff --git a/source/gameengine/VideoTexture/VideoBase.cpp b/source/gameengine/VideoTexture/VideoBase.cpp index 9c8df0ca8c4..d373055b5df 100644 --- a/source/gameengine/VideoTexture/VideoBase.cpp +++ b/source/gameengine/VideoTexture/VideoBase.cpp @@ -137,8 +137,53 @@ PyObject *Video_getStatus(PyImage *self, void *closure) } // refresh video -PyObject *Video_refresh(PyImage *self) +PyObject *Video_refresh(PyImage *self, PyObject *args) { + Py_buffer buffer; + char *mode = NULL; + unsigned int format; + double ts = -1.0; + + memset(&buffer, 0, sizeof(buffer)); + if (PyArg_ParseTuple(args, "|s*sd:refresh", &buffer, &mode, &ts)) { + if (buffer.buf) { + // a target buffer is provided, verify its format + if (buffer.readonly) { + PyErr_SetString(PyExc_TypeError, "Buffers passed in argument must be writable"); + } + else if (!PyBuffer_IsContiguous(&buffer, 'C')) { + PyErr_SetString(PyExc_TypeError, "Buffers passed in argument must be contiguous in memory"); + } + else if (((intptr_t)buffer.buf & 3) != 0) { + PyErr_SetString(PyExc_TypeError, "Buffers passed in argument must be aligned to 4 bytes boundary"); + } + else { + // ready to get the image into our buffer + try { + if (mode == NULL || !strcmp(mode, "RGBA")) + format = GL_RGBA; + else if (!strcmp(mode, "BGRA")) + format = GL_BGRA; + else + THRWEXCP(InvalidImageMode,S_OK); + + if (!self->m_image->loadImage((unsigned int *)buffer.buf, buffer.len, format, ts)) { + PyErr_SetString(PyExc_TypeError, "Could not load the buffer, perhaps size is not compatible"); + } + } + catch (Exception & exp) { + exp.report(); + } + } + PyBuffer_Release(&buffer); + if (PyErr_Occurred()) + return NULL; + } + } + else + { + return NULL; + } getVideo(self)->refresh(); return Video_getStatus(self, NULL); } diff --git a/source/gameengine/VideoTexture/VideoBase.h b/source/gameengine/VideoTexture/VideoBase.h index 6f35c474300..77f46fdccd8 100644 --- a/source/gameengine/VideoTexture/VideoBase.h +++ b/source/gameengine/VideoTexture/VideoBase.h @@ -190,7 +190,7 @@ void Video_open(VideoBase *self, char *file, short captureID); PyObject *Video_play(PyImage *self); PyObject *Video_pause(PyImage *self); PyObject *Video_stop(PyImage *self); -PyObject *Video_refresh(PyImage *self); +PyObject *Video_refresh(PyImage *self, PyObject *args); PyObject *Video_getStatus(PyImage *self, void *closure); PyObject *Video_getRange(PyImage *self, void *closure); int Video_setRange(PyImage *self, PyObject *value, void *closure); diff --git a/source/gameengine/VideoTexture/VideoDeckLink.cpp b/source/gameengine/VideoTexture/VideoDeckLink.cpp new file mode 100644 index 00000000000..c8d3c28c551 --- /dev/null +++ b/source/gameengine/VideoTexture/VideoDeckLink.cpp @@ -0,0 +1,1228 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file gameengine/VideoTexture/VideoDeckLink.cpp + * \ingroup bgevideotex + */ + +#ifdef WITH_GAMEENGINE_DECKLINK + +// FFmpeg defines its own version of stdint.h on Windows. +// Decklink needs FFmpeg, so it uses its version of stdint.h +// this is necessary for INT64_C macro +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS +#endif +// this is necessary for UINTPTR_MAX (used by atomic-ops) +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS +#ifdef __STDC_LIMIT_MACROS /* else it may be unused */ +#endif +#endif +#include <stdint.h> +#include <string.h> +#ifndef WIN32 +#include <sys/time.h> +#include <sys/resource.h> +#include <sys/mman.h> +#endif + +#include "atomic_ops.h" + +#include "MEM_guardedalloc.h" +#include "PIL_time.h" +#include "VideoDeckLink.h" +#include "DeckLink.h" +#include "Exception.h" +#include "KX_KetsjiEngine.h" +#include "KX_PythonInit.h" + +extern ExceptionID DeckLinkInternalError; +ExceptionID SourceVideoOnlyCapture, VideoDeckLinkBadFormat, VideoDeckLinkOpenCard, VideoDeckLinkDvpInternalError, VideoDeckLinkPinMemoryError; +ExpDesc SourceVideoOnlyCaptureDesc(SourceVideoOnlyCapture, "This video source only allows live capture"); +ExpDesc VideoDeckLinkBadFormatDesc(VideoDeckLinkBadFormat, "Invalid or unsupported capture format, should be <mode>/<pixel>[/3D]"); +ExpDesc VideoDeckLinkOpenCardDesc(VideoDeckLinkOpenCard, "Cannot open capture card, check if driver installed"); +ExpDesc VideoDeckLinkDvpInternalErrorDesc(VideoDeckLinkDvpInternalError, "DVP API internal error, please report"); +ExpDesc VideoDeckLinkPinMemoryErrorDesc(VideoDeckLinkPinMemoryError, "Error pinning memory"); + + +#ifdef WIN32 +//////////////////////////////////////////// +// SynInfo +// +// Sets up a semaphore which is shared between the GPU and CPU and used to +// synchronise access to DVP buffers. +#define DVP_CHECK(cmd) if ((cmd) != DVP_STATUS_OK) THRWEXCP(VideoDeckLinkDvpInternalError, S_OK) + +struct SyncInfo +{ + SyncInfo(uint32_t semaphoreAllocSize, uint32_t semaphoreAddrAlignment) + { + mSemUnaligned = (uint32_t*)malloc(semaphoreAllocSize + semaphoreAddrAlignment - 1); + + // Apply alignment constraints + uint64_t val = (uint64_t)mSemUnaligned; + val += semaphoreAddrAlignment - 1; + val &= ~((uint64_t)semaphoreAddrAlignment - 1); + mSem = (uint32_t*)val; + + // Initialise + mSem[0] = 0; + mReleaseValue = 0; + mAcquireValue = 0; + + // Setup DVP sync object and import it + DVPSyncObjectDesc syncObjectDesc; + syncObjectDesc.externalClientWaitFunc = NULL; + syncObjectDesc.sem = (uint32_t*)mSem; + + DVP_CHECK(dvpImportSyncObject(&syncObjectDesc, &mDvpSync)); + + } + ~SyncInfo() + { + dvpFreeSyncObject(mDvpSync); + free((void*)mSemUnaligned); + } + + volatile uint32_t* mSem; + volatile uint32_t* mSemUnaligned; + volatile uint32_t mReleaseValue; + volatile uint32_t mAcquireValue; + DVPSyncObjectHandle mDvpSync; +}; + +//////////////////////////////////////////// +// TextureTransferDvp: transfer with GPUDirect +//////////////////////////////////////////// + +class TextureTransferDvp : public TextureTransfer +{ +public: + TextureTransferDvp(DVPBufferHandle dvpTextureHandle, TextureDesc *pDesc, void *address, uint32_t allocatedSize) + { + DVPSysmemBufferDesc sysMemBuffersDesc; + + mExtSync = NULL; + mGpuSync = NULL; + mDvpSysMemHandle = 0; + mDvpTextureHandle = 0; + mTextureHeight = 0; + mAllocatedSize = 0; + mBuffer = NULL; + + if (!_PinBuffer(address, allocatedSize)) + THRWEXCP(VideoDeckLinkPinMemoryError, S_OK); + mAllocatedSize = allocatedSize; + mBuffer = address; + + try { + if (!mBufferAddrAlignment) { + DVP_CHECK(dvpGetRequiredConstantsGLCtx(&mBufferAddrAlignment, &mBufferGpuStrideAlignment, + &mSemaphoreAddrAlignment, &mSemaphoreAllocSize, + &mSemaphorePayloadOffset, &mSemaphorePayloadSize)); + } + mExtSync = new SyncInfo(mSemaphoreAllocSize, mSemaphoreAddrAlignment); + mGpuSync = new SyncInfo(mSemaphoreAllocSize, mSemaphoreAddrAlignment); + sysMemBuffersDesc.width = pDesc->width; + sysMemBuffersDesc.height = pDesc->height; + sysMemBuffersDesc.stride = pDesc->stride; + switch (pDesc->format) { + case GL_RED_INTEGER: + sysMemBuffersDesc.format = DVP_RED_INTEGER; + break; + default: + sysMemBuffersDesc.format = DVP_BGRA; + break; + } + switch (pDesc->type) { + case GL_UNSIGNED_BYTE: + sysMemBuffersDesc.type = DVP_UNSIGNED_BYTE; + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + sysMemBuffersDesc.type = DVP_UNSIGNED_INT_2_10_10_10_REV; + break; + case GL_UNSIGNED_INT_8_8_8_8: + sysMemBuffersDesc.type = DVP_UNSIGNED_INT_8_8_8_8; + break; + case GL_UNSIGNED_INT_10_10_10_2: + sysMemBuffersDesc.type = DVP_UNSIGNED_INT_10_10_10_2; + break; + default: + sysMemBuffersDesc.type = DVP_UNSIGNED_INT; + break; + } + sysMemBuffersDesc.size = pDesc->width * pDesc->height * 4; + sysMemBuffersDesc.bufAddr = mBuffer; + DVP_CHECK(dvpCreateBuffer(&sysMemBuffersDesc, &mDvpSysMemHandle)); + DVP_CHECK(dvpBindToGLCtx(mDvpSysMemHandle)); + mDvpTextureHandle = dvpTextureHandle; + mTextureHeight = pDesc->height; + } + catch (Exception &) { + clean(); + throw; + } + } + ~TextureTransferDvp() + { + clean(); + } + + virtual void PerformTransfer() + { + // perform the transfer + // tell DVP that the old texture buffer will no longer be used + dvpMapBufferEndAPI(mDvpTextureHandle); + // do we need this? + mGpuSync->mReleaseValue++; + dvpBegin(); + // Copy from system memory to GPU texture + dvpMapBufferWaitDVP(mDvpTextureHandle); + dvpMemcpyLined(mDvpSysMemHandle, mExtSync->mDvpSync, mExtSync->mAcquireValue, DVP_TIMEOUT_IGNORED, + mDvpTextureHandle, mGpuSync->mDvpSync, mGpuSync->mReleaseValue, 0, mTextureHeight); + dvpMapBufferEndDVP(mDvpTextureHandle); + dvpEnd(); + dvpMapBufferWaitAPI(mDvpTextureHandle); + // the transfer is now complete and the texture is ready for use + } + +private: + static uint32_t mBufferAddrAlignment; + static uint32_t mBufferGpuStrideAlignment; + static uint32_t mSemaphoreAddrAlignment; + static uint32_t mSemaphoreAllocSize; + static uint32_t mSemaphorePayloadOffset; + static uint32_t mSemaphorePayloadSize; + + void clean() + { + if (mDvpSysMemHandle) { + dvpUnbindFromGLCtx(mDvpSysMemHandle); + dvpDestroyBuffer(mDvpSysMemHandle); + } + if (mExtSync) + delete mExtSync; + if (mGpuSync) + delete mGpuSync; + if (mBuffer) + _UnpinBuffer(mBuffer, mAllocatedSize); + } + SyncInfo* mExtSync; + SyncInfo* mGpuSync; + DVPBufferHandle mDvpSysMemHandle; + DVPBufferHandle mDvpTextureHandle; + uint32_t mTextureHeight; + uint32_t mAllocatedSize; + void* mBuffer; +}; + +uint32_t TextureTransferDvp::mBufferAddrAlignment; +uint32_t TextureTransferDvp::mBufferGpuStrideAlignment; +uint32_t TextureTransferDvp::mSemaphoreAddrAlignment; +uint32_t TextureTransferDvp::mSemaphoreAllocSize; +uint32_t TextureTransferDvp::mSemaphorePayloadOffset; +uint32_t TextureTransferDvp::mSemaphorePayloadSize; + +#endif + +//////////////////////////////////////////// +// TextureTransferOGL: transfer using standard OGL buffers +//////////////////////////////////////////// + +class TextureTransferOGL : public TextureTransfer +{ +public: + TextureTransferOGL(GLuint texId, TextureDesc *pDesc, void *address) + { + memcpy(&mDesc, pDesc, sizeof(mDesc)); + mTexId = texId; + mBuffer = address; + + // as we cache transfer object, we will create one texture to hold the buffer + glGenBuffers(1, &mUnpinnedTextureBuffer); + // create a storage for it + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, mUnpinnedTextureBuffer); + glBufferData(GL_PIXEL_UNPACK_BUFFER, pDesc->size, NULL, GL_DYNAMIC_DRAW); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + } + ~TextureTransferOGL() + { + glDeleteBuffers(1, &mUnpinnedTextureBuffer); + } + + virtual void PerformTransfer() + { + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, mUnpinnedTextureBuffer); + glBufferSubData(GL_PIXEL_UNPACK_BUFFER, 0, mDesc.size, mBuffer); + glBindTexture(GL_TEXTURE_2D, mTexId); + // NULL for last arg indicates use current GL_PIXEL_UNPACK_BUFFER target as texture data + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mDesc.width, mDesc.height, mDesc.format, mDesc.type, NULL); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + } +private: + // intermediate texture to receive the buffer + GLuint mUnpinnedTextureBuffer; + // target texture to receive the image + GLuint mTexId; + // buffer + void *mBuffer; + // characteristic of the image + TextureDesc mDesc; +}; + +//////////////////////////////////////////// +// TextureTransferPMB: transfer using pinned memory buffer +//////////////////////////////////////////// + +class TextureTransferPMD : public TextureTransfer +{ +public: + TextureTransferPMD(GLuint texId, TextureDesc *pDesc, void *address, uint32_t allocatedSize) + { + memcpy(&mDesc, pDesc, sizeof(mDesc)); + mTexId = texId; + mBuffer = address; + mAllocatedSize = allocatedSize; + + _PinBuffer(address, allocatedSize); + + // as we cache transfer object, we will create one texture to hold the buffer + glGenBuffers(1, &mPinnedTextureBuffer); + // create a storage for it + glBindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, mPinnedTextureBuffer); + glBufferData(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, pDesc->size, address, GL_STREAM_DRAW); + glBindBuffer(GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, 0); + } + ~TextureTransferPMD() + { + glDeleteBuffers(1, &mPinnedTextureBuffer); + if (mBuffer) + _UnpinBuffer(mBuffer, mAllocatedSize); + } + + virtual void PerformTransfer() + { + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, mPinnedTextureBuffer); + glBindTexture(GL_TEXTURE_2D, mTexId); + // NULL for last arg indicates use current GL_PIXEL_UNPACK_BUFFER target as texture data + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, mDesc.width, mDesc.height, mDesc.format, mDesc.type, NULL); + // wait for the trasnfer to complete + GLsync fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); + glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT, 40 * 1000 * 1000); // timeout in nanosec + glDeleteSync(fence); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); + } +private: + // intermediate texture to receive the buffer + GLuint mPinnedTextureBuffer; + // target texture to receive the image + GLuint mTexId; + // buffer + void *mBuffer; + // the allocated size + uint32_t mAllocatedSize; + // characteristic of the image + TextureDesc mDesc; +}; + +bool TextureTransfer::_PinBuffer(void *address, uint32_t size) +{ +#ifdef WIN32 + return VirtualLock(address, size); +#elif defined(_POSIX_MEMLOCK_RANGE) + return !mlock(address, size); +#endif +} + +void TextureTransfer::_UnpinBuffer(void* address, uint32_t size) +{ +#ifdef WIN32 + VirtualUnlock(address, size); +#elif defined(_POSIX_MEMLOCK_RANGE) + munlock(address, size); +#endif +} + + + +//////////////////////////////////////////// +// PinnedMemoryAllocator +//////////////////////////////////////////// + + +// static members +bool PinnedMemoryAllocator::mGPUDirectInitialized = false; +bool PinnedMemoryAllocator::mHasDvp = false; +bool PinnedMemoryAllocator::mHasAMDPinnedMemory = false; +size_t PinnedMemoryAllocator::mReservedProcessMemory = 0; + +bool PinnedMemoryAllocator::ReserveMemory(size_t size) +{ +#ifdef WIN32 + // Increase the process working set size to allow pinning of memory. + if (size <= mReservedProcessMemory) + return true; + SIZE_T dwMin = 0, dwMax = 0; + HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_SET_QUOTA, FALSE, GetCurrentProcessId()); + if (!hProcess) + return false; + + // Retrieve the working set size of the process. + if (!dwMin && !GetProcessWorkingSetSize(hProcess, &dwMin, &dwMax)) + return false; + + BOOL res = SetProcessWorkingSetSize(hProcess, (size - mReservedProcessMemory) + dwMin, (size - mReservedProcessMemory) + dwMax); + if (!res) + return false; + mReservedProcessMemory = size; + CloseHandle(hProcess); + return true; +#else + struct rlimit rlim; + if (getrlimit(RLIMIT_MEMLOCK, &rlim) == 0) { + if (rlim.rlim_cur < size) { + if (rlim.rlim_max < size) + rlim.rlim_max = size; + rlim.rlim_cur = size; + return !setrlimit(RLIMIT_MEMLOCK, &rlim); + } + } + return false; +#endif +} + +PinnedMemoryAllocator::PinnedMemoryAllocator(unsigned cacheSize, size_t memSize) : +mRefCount(1U), +#ifdef WIN32 +mDvpCaptureTextureHandle(0), +#endif +mTexId(0), +mBufferCacheSize(cacheSize) +{ + pthread_mutex_init(&mMutex, NULL); + // do it once + if (!mGPUDirectInitialized) { +#ifdef WIN32 + // In windows, AMD_pinned_memory option is not available, + // we must use special DVP API only available for Quadro cards + const char* renderer = (const char *)glGetString(GL_RENDERER); + mHasDvp = (strstr(renderer, "Quadro") != NULL); + + if (mHasDvp) { + // In case the DLL is not in place, don't fail, just fallback on OpenGL + if (dvpInitGLContext(DVP_DEVICE_FLAGS_SHARE_APP_CONTEXT) != DVP_STATUS_OK) { + printf("Warning: Could not initialize DVP context, fallback on OpenGL transfer.\nInstall dvp.dll to take advantage of nVidia GPUDirect.\n"); + mHasDvp = false; + } + } +#endif + if (GLEW_AMD_pinned_memory) + mHasAMDPinnedMemory = true; + + mGPUDirectInitialized = true; + } + if (mHasDvp || mHasAMDPinnedMemory) { + ReserveMemory(memSize); + } +} + +PinnedMemoryAllocator::~PinnedMemoryAllocator() +{ + void *address; + // first clean the cache if not already done + while (!mBufferCache.empty()) { + address = mBufferCache.back(); + mBufferCache.pop_back(); + _ReleaseBuffer(address); + } + // clean preallocated buffers + while (!mAllocatedSize.empty()) { + address = mAllocatedSize.begin()->first; + _ReleaseBuffer(address); + } + +#ifdef WIN32 + if (mDvpCaptureTextureHandle) + dvpDestroyBuffer(mDvpCaptureTextureHandle); +#endif +} + +void PinnedMemoryAllocator::TransferBuffer(void* address, TextureDesc* texDesc, GLuint texId) +{ + uint32_t allocatedSize = 0; + TextureTransfer *pTransfer = NULL; + + Lock(); + if (mAllocatedSize.count(address) > 0) + allocatedSize = mAllocatedSize[address]; + Unlock(); + if (!allocatedSize) + // internal error!! + return; + if (mTexId != texId) + { + // first time we try to send data to the GPU, allocate a buffer for the texture + glBindTexture(GL_TEXTURE_2D, texId); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexImage2D(GL_TEXTURE_2D, 0, texDesc->internalFormat, texDesc->width, texDesc->height, 0, texDesc->format, texDesc->type, NULL); + glBindTexture(GL_TEXTURE_2D, 0); + mTexId = texId; + } +#ifdef WIN32 + if (mHasDvp) + { + if (!mDvpCaptureTextureHandle) + { + // bind DVP to the OGL texture + DVP_CHECK(dvpCreateGPUTextureGL(texId, &mDvpCaptureTextureHandle)); + } + } +#endif + Lock(); + if (mPinnedBuffer.count(address) > 0) + { + pTransfer = mPinnedBuffer[address]; + } + Unlock(); + if (!pTransfer) + { +#ifdef WIN32 + if (mHasDvp) + pTransfer = new TextureTransferDvp(mDvpCaptureTextureHandle, texDesc, address, allocatedSize); + else +#endif + if (mHasAMDPinnedMemory) { + pTransfer = new TextureTransferPMD(texId, texDesc, address, allocatedSize); + } + else { + pTransfer = new TextureTransferOGL(texId, texDesc, address); + } + if (pTransfer) + { + Lock(); + mPinnedBuffer[address] = pTransfer; + Unlock(); + } + } + if (pTransfer) + pTransfer->PerformTransfer(); +} + +// IUnknown methods +HRESULT STDMETHODCALLTYPE PinnedMemoryAllocator::QueryInterface(REFIID /*iid*/, LPVOID* /*ppv*/) +{ + return E_NOTIMPL; +} + +ULONG STDMETHODCALLTYPE PinnedMemoryAllocator::AddRef(void) +{ + return atomic_add_uint32(&mRefCount, 1U); +} + +ULONG STDMETHODCALLTYPE PinnedMemoryAllocator::Release(void) +{ + uint32_t newCount = atomic_sub_uint32(&mRefCount, 1U); + if (newCount == 0) + delete this; + return (ULONG)newCount; +} + +// IDeckLinkMemoryAllocator methods +HRESULT STDMETHODCALLTYPE PinnedMemoryAllocator::AllocateBuffer(dl_size_t bufferSize, void* *allocatedBuffer) +{ + Lock(); + if (mBufferCache.empty()) + { + // Allocate memory on a page boundary + // Note: aligned alloc exist in Blender but only for small alignment, use direct allocation then. + // Note: the DeckLink API tries to allocate up to 65 buffer in advance, we will limit this to 3 + // because we don't need any caching + if (mAllocatedSize.size() >= mBufferCacheSize) + *allocatedBuffer = NULL; + else { +#ifdef WIN32 + *allocatedBuffer = VirtualAlloc(NULL, bufferSize, MEM_COMMIT | MEM_RESERVE | MEM_WRITE_WATCH, PAGE_READWRITE); +#else + if (posix_memalign(allocatedBuffer, 4096, bufferSize) != 0) + *allocatedBuffer = NULL; +#endif + mAllocatedSize[*allocatedBuffer] = bufferSize; + } + } + else { + // Re-use most recently ReleaseBuffer'd address + *allocatedBuffer = mBufferCache.back(); + mBufferCache.pop_back(); + } + Unlock(); + return (*allocatedBuffer) ? S_OK : E_OUTOFMEMORY; +} + +HRESULT STDMETHODCALLTYPE PinnedMemoryAllocator::ReleaseBuffer(void* buffer) +{ + HRESULT result = S_OK; + Lock(); + if (mBufferCache.size() < mBufferCacheSize) { + mBufferCache.push_back(buffer); + } + else { + result = _ReleaseBuffer(buffer); + } + Unlock(); + return result; +} + + +HRESULT PinnedMemoryAllocator::_ReleaseBuffer(void* buffer) +{ + TextureTransfer *pTransfer; + if (mAllocatedSize.count(buffer) == 0) { + // Internal error!! + return S_OK; + } + else { + // No room left in cache, so un-pin (if it was pinned) and free this buffer + if (mPinnedBuffer.count(buffer) > 0) { + pTransfer = mPinnedBuffer[buffer]; + mPinnedBuffer.erase(buffer); + delete pTransfer; + } +#ifdef WIN32 + VirtualFree(buffer, 0, MEM_RELEASE); +#else + free(buffer); +#endif + mAllocatedSize.erase(buffer); + } + return S_OK; +} + +HRESULT STDMETHODCALLTYPE PinnedMemoryAllocator::Commit() +{ + return S_OK; +} + +HRESULT STDMETHODCALLTYPE PinnedMemoryAllocator::Decommit() +{ + void *buffer; + Lock(); + while (!mBufferCache.empty()) { + // Cleanup any frames allocated and pinned in AllocateBuffer() but not freed in ReleaseBuffer() + buffer = mBufferCache.back(); + mBufferCache.pop_back(); + _ReleaseBuffer(buffer); + } + Unlock(); + return S_OK; +} + + +//////////////////////////////////////////// +// Capture Delegate Class +//////////////////////////////////////////// + +CaptureDelegate::CaptureDelegate(VideoDeckLink* pOwner) : mpOwner(pOwner) +{ +} + +HRESULT CaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* inputFrame, IDeckLinkAudioInputPacket* /*audioPacket*/) +{ + if (!inputFrame) { + // It's possible to receive a NULL inputFrame, but a valid audioPacket. Ignore audio-only frame. + return S_OK; + } + if ((inputFrame->GetFlags() & bmdFrameHasNoInputSource) == bmdFrameHasNoInputSource) { + // let's not bother transferring frames if there is no source + return S_OK; + } + mpOwner->VideoFrameArrived(inputFrame); + return S_OK; +} + +HRESULT CaptureDelegate::VideoInputFormatChanged(BMDVideoInputFormatChangedEvents notificationEvents, IDeckLinkDisplayMode *newDisplayMode, BMDDetectedVideoInputFormatFlags detectedSignalFlags) +{ + return S_OK; +} + + + + +// macro for exception handling and logging +#define CATCH_EXCP catch (Exception & exp) \ +{ exp.report(); m_status = SourceError; } + +// class VideoDeckLink + + +// constructor +VideoDeckLink::VideoDeckLink (HRESULT * hRslt) : VideoBase(), +mDLInput(NULL), +mUse3D(false), +mFrameWidth(0), +mFrameHeight(0), +mpAllocator(NULL), +mpCaptureDelegate(NULL), +mpCacheFrame(NULL), +mClosing(false) +{ + mDisplayMode = (BMDDisplayMode)0; + mPixelFormat = (BMDPixelFormat)0; + pthread_mutex_init(&mCacheMutex, NULL); +} + +// destructor +VideoDeckLink::~VideoDeckLink () +{ + LockCache(); + mClosing = true; + if (mpCacheFrame) + { + mpCacheFrame->Release(); + mpCacheFrame = NULL; + } + UnlockCache(); + if (mDLInput != NULL) + { + // Cleanup for Capture + mDLInput->StopStreams(); + mDLInput->SetCallback(NULL); + mDLInput->DisableVideoInput(); + mDLInput->DisableAudioInput(); + mDLInput->FlushStreams(); + if (mDLInput->Release() != 0) { + printf("Reference count not NULL on DeckLink device when closing it, please report!\n"); + } + mDLInput = NULL; + } + + if (mpAllocator) + { + // if the device was properly cleared, this should be 0 + if (mpAllocator->Release() != 0) { + printf("Reference count not NULL on Allocator when closing it, please report!\n"); + } + mpAllocator = NULL; + } + if (mpCaptureDelegate) + { + delete mpCaptureDelegate; + mpCaptureDelegate = NULL; + } +} + +void VideoDeckLink::refresh(void) +{ + m_avail = false; +} + +// release components +bool VideoDeckLink::release() +{ + // release + return true; +} + +// open video file +void VideoDeckLink::openFile (char *filename) +{ + // only live capture on this device + THRWEXCP(SourceVideoOnlyCapture, S_OK); +} + + +// open video capture device +void VideoDeckLink::openCam (char *format, short camIdx) +{ + IDeckLinkDisplayModeIterator* pDLDisplayModeIterator; + BMDDisplayModeSupport modeSupport; + IDeckLinkDisplayMode* pDLDisplayMode; + IDeckLinkIterator* pIterator; + BMDTimeValue frameDuration; + BMDTimeScale frameTimescale; + IDeckLink* pDL; + uint32_t displayFlags, inputFlags; + char *pPixel, *p3D, *pEnd, *pSize; + size_t len; + int i, modeIdx, cacheSize; + + // format is constructed as <displayMode>/<pixelFormat>[/3D][:<cacheSize>] + // <displayMode> takes the form of BMDDisplayMode identifier minus the 'bmdMode' prefix. + // This implementation understands all the modes defined in SDK 10.3.1 but you can alternatively + // use the 4 characters internal representation of the mode (e.g. 'HD1080p24' == '24ps') + // <pixelFormat> takes the form of BMDPixelFormat identifier minus the 'bmdFormat' prefix. + // This implementation understand all the formats defined in SDK 10.32.1 but you can alternatively + // use the 4 characters internal representation of the format (e.g. '10BitRGB' == 'r210') + // Not all combinations of mode and pixel format are possible and it also depends on the card! + // Use /3D postfix if you are capturing a 3D stream with frame packing + // Example: To capture FullHD 1920x1080@24Hz with 3D packing and 4:4:4 10 bits RGB pixel format, use + // "HD1080p24/10BitRGB/3D" (same as "24ps/r210/3D") + // (this will be the normal capture format for FullHD on the DeckLink 4k extreme) + + if ((pSize = strchr(format, ':')) != NULL) { + cacheSize = strtol(pSize+1, &pEnd, 10); + } + else { + cacheSize = 8; + pSize = format + strlen(format); + } + if ((pPixel = strchr(format, '/')) == NULL || + ((p3D = strchr(pPixel + 1, '/')) != NULL && strncmp(p3D, "/3D", pSize-p3D))) + THRWEXCP(VideoDeckLinkBadFormat, S_OK); + mUse3D = (p3D) ? true : false; + // to simplify pixel format parsing + if (!p3D) + p3D = pSize; + + // read the mode + len = (size_t)(pPixel - format); + // accept integer display mode + + try { + // throws if bad mode + decklink_ReadDisplayMode(format, len, &mDisplayMode); + // found a valid mode, remember that we do not look for an index + modeIdx = -1; + } + catch (Exception &) { + // accept also purely numerical mode as a mode index + modeIdx = strtol(format, &pEnd, 10); + if (pEnd != pPixel || modeIdx < 0) + // not a pure number, give up + throw; + } + + // skip / + pPixel++; + len = (size_t)(p3D - pPixel); + // throws if bad format + decklink_ReadPixelFormat(pPixel, len, &mPixelFormat); + + // Caution: DeckLink API used from this point, make sure entity are released before throwing + // open the card + pIterator = BMD_CreateDeckLinkIterator(); + if (pIterator) { + i = 0; + while (pIterator->Next(&pDL) == S_OK) { + if (i == camIdx) { + if (pDL->QueryInterface(IID_IDeckLinkInput, (void**)&mDLInput) != S_OK) + mDLInput = NULL; + pDL->Release(); + break; + } + i++; + pDL->Release(); + } + pIterator->Release(); + } + if (!mDLInput) + THRWEXCP(VideoDeckLinkOpenCard, S_OK); + + + // check if display mode and pixel format are supported + if (mDLInput->GetDisplayModeIterator(&pDLDisplayModeIterator) != S_OK) + THRWEXCP(DeckLinkInternalError, S_OK); + + pDLDisplayMode = NULL; + displayFlags = (mUse3D) ? bmdDisplayModeSupports3D : 0; + inputFlags = (mUse3D) ? bmdVideoInputDualStream3D : bmdVideoInputFlagDefault; + while (pDLDisplayModeIterator->Next(&pDLDisplayMode) == S_OK) + { + if (modeIdx == 0 || pDLDisplayMode->GetDisplayMode() == mDisplayMode) { + // in case we get here because of modeIdx, make sure we have mDisplayMode set + mDisplayMode = pDLDisplayMode->GetDisplayMode(); + if ((pDLDisplayMode->GetFlags() & displayFlags) == displayFlags && + mDLInput->DoesSupportVideoMode(mDisplayMode, mPixelFormat, inputFlags, &modeSupport, NULL) == S_OK && + modeSupport == bmdDisplayModeSupported) + { + break; + } + } + pDLDisplayMode->Release(); + pDLDisplayMode = NULL; + if (modeIdx-- == 0) { + // reached the correct mode index but it does not meet the pixel format, give up + break; + } + } + pDLDisplayModeIterator->Release(); + + if (pDLDisplayMode == NULL) + THRWEXCP(VideoDeckLinkBadFormat, S_OK); + + mFrameWidth = pDLDisplayMode->GetWidth(); + mFrameHeight = pDLDisplayMode->GetHeight(); + mTextureDesc.height = (mUse3D) ? 2 * mFrameHeight : mFrameHeight; + pDLDisplayMode->GetFrameRate(&frameDuration, &frameTimescale); + pDLDisplayMode->Release(); + // for information, in case the application wants to know + m_size[0] = mFrameWidth; + m_size[1] = mTextureDesc.height; + m_frameRate = (float)frameTimescale / (float)frameDuration; + + switch (mPixelFormat) + { + case bmdFormat8BitYUV: + // 2 pixels per word + mTextureDesc.stride = mFrameWidth * 2; + mTextureDesc.width = mFrameWidth / 2; + mTextureDesc.internalFormat = GL_RGBA; + mTextureDesc.format = GL_BGRA; + mTextureDesc.type = GL_UNSIGNED_BYTE; + break; + case bmdFormat10BitYUV: + // 6 pixels in 4 words, rounded to 48 pixels + mTextureDesc.stride = ((mFrameWidth + 47) / 48) * 128; + mTextureDesc.width = mTextureDesc.stride/4; + mTextureDesc.internalFormat = GL_RGB10_A2; + mTextureDesc.format = GL_BGRA; + mTextureDesc.type = GL_UNSIGNED_INT_2_10_10_10_REV; + break; + case bmdFormat8BitARGB: + mTextureDesc.stride = mFrameWidth * 4; + mTextureDesc.width = mFrameWidth; + mTextureDesc.internalFormat = GL_RGBA; + mTextureDesc.format = GL_BGRA; + mTextureDesc.type = GL_UNSIGNED_INT_8_8_8_8; + break; + case bmdFormat8BitBGRA: + mTextureDesc.stride = mFrameWidth * 4; + mTextureDesc.width = mFrameWidth; + mTextureDesc.internalFormat = GL_RGBA; + mTextureDesc.format = GL_BGRA; + mTextureDesc.type = GL_UNSIGNED_BYTE; + break; + case bmdFormat10BitRGBXLE: + // 1 pixel per word, rounded to 64 pixels + mTextureDesc.stride = ((mFrameWidth + 63) / 64) * 256; + mTextureDesc.width = mTextureDesc.stride/4; + mTextureDesc.internalFormat = GL_RGB10_A2; + mTextureDesc.format = GL_RGBA; + mTextureDesc.type = GL_UNSIGNED_INT_10_10_10_2; + break; + case bmdFormat10BitRGBX: + case bmdFormat10BitRGB: + // 1 pixel per word, rounded to 64 pixels + mTextureDesc.stride = ((mFrameWidth + 63) / 64) * 256; + mTextureDesc.width = mTextureDesc.stride/4; + mTextureDesc.internalFormat = GL_R32UI; + mTextureDesc.format = GL_RED_INTEGER; + mTextureDesc.type = GL_UNSIGNED_INT; + break; + case bmdFormat12BitRGB: + case bmdFormat12BitRGBLE: + // 8 pixels in 9 word + mTextureDesc.stride = (mFrameWidth * 36) / 8; + mTextureDesc.width = mTextureDesc.stride/4; + mTextureDesc.internalFormat = GL_R32UI; + mTextureDesc.format = GL_RED_INTEGER; + mTextureDesc.type = GL_UNSIGNED_INT; + break; + default: + // for unknown pixel format, this will be resolved when a frame arrives + mTextureDesc.format = GL_RED_INTEGER; + mTextureDesc.type = GL_UNSIGNED_INT; + break; + } + // reserve memory for cache frame + 1 to accomodate for pixel format that we don't know yet + // note: we can't use stride as it is not yet known if the pixel format is unknown + // use instead the frame width as in worst case it's not much different (e.g. HD720/10BITYUV: 1296 pixels versus 1280) + // note: some pixel format take more than 4 bytes take that into account (9/8 versus 1) + mpAllocator = new PinnedMemoryAllocator(cacheSize, mFrameWidth*mTextureDesc.height * 4 * (1+cacheSize*9/8)); + + if (mDLInput->SetVideoInputFrameMemoryAllocator(mpAllocator) != S_OK) + THRWEXCP(DeckLinkInternalError, S_OK); + + mpCaptureDelegate = new CaptureDelegate(this); + if (mDLInput->SetCallback(mpCaptureDelegate) != S_OK) + THRWEXCP(DeckLinkInternalError, S_OK); + + if (mDLInput->EnableVideoInput(mDisplayMode, mPixelFormat, ((mUse3D) ? bmdVideoInputDualStream3D : bmdVideoInputFlagDefault)) != S_OK) + // this shouldn't failed, we tested above + THRWEXCP(DeckLinkInternalError, S_OK); + + // just in case it is needed to capture from certain cards, we don't check error because we don't need audio + mDLInput->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, 2); + + // open base class + VideoBase::openCam(format, camIdx); + + // ready to capture, will start when application calls play() +} + +// play video +bool VideoDeckLink::play (void) +{ + try + { + // if object is able to play + if (VideoBase::play()) + { + mDLInput->FlushStreams(); + return (mDLInput->StartStreams() == S_OK); + } + } + CATCH_EXCP; + return false; +} + + +// pause video +bool VideoDeckLink::pause (void) +{ + try + { + if (VideoBase::pause()) + { + mDLInput->PauseStreams(); + return true; + } + } + CATCH_EXCP; + return false; +} + +// stop video +bool VideoDeckLink::stop (void) +{ + try + { + VideoBase::stop(); + mDLInput->StopStreams(); + return true; + } + CATCH_EXCP; + return false; +} + + +// set video range +void VideoDeckLink::setRange (double start, double stop) +{ +} + +// set framerate +void VideoDeckLink::setFrameRate (float rate) +{ +} + + +// image calculation +// send cache frame directly to GPU +void VideoDeckLink::calcImage (unsigned int texId, double ts) +{ + IDeckLinkVideoInputFrame* pFrame; + LockCache(); + pFrame = mpCacheFrame; + mpCacheFrame = NULL; + UnlockCache(); + if (pFrame) { + // BUG: the dvpBindToGLCtx function fails the first time it is used, don't know why. + // This causes an exception to be thrown. + // This should be fixed but in the meantime we will catch the exception because + // it is crucial that we release the frame to keep the reference count right on the DeckLink device + try { + uint32_t rowSize = pFrame->GetRowBytes(); + uint32_t textureSize = rowSize * pFrame->GetHeight(); + void* videoPixels = NULL; + void* rightEyePixels = NULL; + if (!mTextureDesc.stride) { + // we could not compute the texture size earlier (unknown pixel size) + // let's do it now + mTextureDesc.stride = rowSize; + mTextureDesc.width = mTextureDesc.stride / 4; + } + if (mTextureDesc.stride != rowSize) { + // unexpected frame size, ignore + // TBD: print a warning + } + else { + pFrame->GetBytes(&videoPixels); + if (mUse3D) { + IDeckLinkVideoFrame3DExtensions *if3DExtensions = NULL; + IDeckLinkVideoFrame *rightEyeFrame = NULL; + if (pFrame->QueryInterface(IID_IDeckLinkVideoFrame3DExtensions, (void **)&if3DExtensions) == S_OK && + if3DExtensions->GetFrameForRightEye(&rightEyeFrame) == S_OK) { + rightEyeFrame->GetBytes(&rightEyePixels); + textureSize += ((uint64_t)rightEyePixels - (uint64_t)videoPixels); + } + if (rightEyeFrame) + rightEyeFrame->Release(); + if (if3DExtensions) + if3DExtensions->Release(); + } + mTextureDesc.size = mTextureDesc.width * mTextureDesc.height * 4; + if (mTextureDesc.size == textureSize) { + // this means that both left and right frame are contiguous and that there is no padding + // do the transfer + mpAllocator->TransferBuffer(videoPixels, &mTextureDesc, texId); + } + } + } + catch (Exception &) { + pFrame->Release(); + throw; + } + // this will trigger PinnedMemoryAllocator::RealaseBuffer + pFrame->Release(); + } + // currently we don't pass the image to the application + m_avail = false; +} + +// A frame is available from the board +// Called from an internal thread, just pass the frame to the main thread +void VideoDeckLink::VideoFrameArrived(IDeckLinkVideoInputFrame* inputFrame) +{ + IDeckLinkVideoInputFrame* pOldFrame = NULL; + LockCache(); + if (!mClosing) + { + pOldFrame = mpCacheFrame; + mpCacheFrame = inputFrame; + inputFrame->AddRef(); + } + UnlockCache(); + // old frame no longer needed, just release it + if (pOldFrame) + pOldFrame->Release(); +} + +// python methods + +// object initialization +static int VideoDeckLink_init(PyObject *pySelf, PyObject *args, PyObject *kwds) +{ + static const char *kwlist[] = { "format", "capture", NULL }; + PyImage *self = reinterpret_cast<PyImage*>(pySelf); + // see openCam for a description of format + char * format = NULL; + // capture device number, i.e. DeckLink card number, default first one + short capt = 0; + + if (!GLEW_VERSION_1_5) { + PyErr_SetString(PyExc_RuntimeError, "VideoDeckLink requires at least OpenGL 1.5"); + return -1; + } + // get parameters + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|h", + const_cast<char**>(kwlist), &format, &capt)) + return -1; + + try { + // create video object + Video_init<VideoDeckLink>(self); + + // open video source, control comes back to VideoDeckLink::openCam + Video_open(getVideo(self), format, capt); + } + catch (Exception & exp) { + exp.report(); + return -1; + } + // initialization succeded + return 0; +} + +// methods structure +static PyMethodDef videoMethods[] = +{ // methods from VideoBase class + {"play", (PyCFunction)Video_play, METH_NOARGS, "Play (restart) video"}, + {"pause", (PyCFunction)Video_pause, METH_NOARGS, "pause video"}, + {"stop", (PyCFunction)Video_stop, METH_NOARGS, "stop video (play will replay it from start)"}, + {"refresh", (PyCFunction)Video_refresh, METH_VARARGS, "Refresh video - get its status"}, + {NULL} +}; +// attributes structure +static PyGetSetDef videoGetSets[] = +{ // methods from VideoBase class + {(char*)"status", (getter)Video_getStatus, NULL, (char*)"video status", NULL}, + {(char*)"framerate", (getter)Video_getFrameRate, NULL, (char*)"frame rate", NULL}, + // attributes from ImageBase class + {(char*)"valid", (getter)Image_valid, NULL, (char*)"bool to tell if an image is available", NULL}, + {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL}, + {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL}, + {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbor)", NULL}, + {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL}, + {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL}, + {NULL} +}; + +// python type declaration +PyTypeObject VideoDeckLinkType = +{ + PyVarObject_HEAD_INIT(NULL, 0) + "VideoTexture.VideoDeckLink", /*tp_name*/ + sizeof(PyImage), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)Image_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &imageBufferProcs, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + "DeckLink video source", /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + videoMethods, /* tp_methods */ + 0, /* tp_members */ + videoGetSets, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)VideoDeckLink_init, /* tp_init */ + 0, /* tp_alloc */ + Image_allocNew, /* tp_new */ +}; + + + +//////////////////////////////////////////// +// DeckLink Capture Delegate Class +//////////////////////////////////////////// + +#endif // WITH_GAMEENGINE_DECKLINK + diff --git a/source/gameengine/VideoTexture/VideoDeckLink.h b/source/gameengine/VideoTexture/VideoDeckLink.h new file mode 100644 index 00000000000..be81f63d93c --- /dev/null +++ b/source/gameengine/VideoTexture/VideoDeckLink.h @@ -0,0 +1,256 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * 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 + * of the License, or (at your option) any later version. + * + * 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, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * +* The Original Code is Copyright (C) 2015, Blender Foundation +* All rights reserved. +* +* The Original Code is: all of this file. +* +* Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file VideoDeckLink.h + * \ingroup bgevideotex + */ + +#ifndef __VIDEODECKLINK_H__ +#define __VIDEODECKLINK_H__ + +#ifdef WITH_GAMEENGINE_DECKLINK + +/* this needs to be parsed with __cplusplus defined before included through DeckLink_compat.h */ +#if defined(__FreeBSD__) +# include <inttypes.h> +#endif +#include <map> +#include <set> + +extern "C" { +#include <pthread.h> +#include "DNA_listBase.h" +#include "BLI_threads.h" +#include "BLI_blenlib.h" +} +#include "GL/glew.h" +#ifdef WIN32 +#include "dvpapi.h" +#endif +#include "DeckLinkAPI.h" +#include "VideoBase.h" + +class PinnedMemoryAllocator; + +struct TextureDesc +{ + uint32_t width; + uint32_t height; + uint32_t stride; + uint32_t size; + GLenum internalFormat; + GLenum format; + GLenum type; + TextureDesc() + { + width = 0; + height = 0; + stride = 0; + size = 0; + internalFormat = 0; + format = 0; + type = 0; + } +}; + +class CaptureDelegate; + +// type VideoDeckLink declaration +class VideoDeckLink : public VideoBase +{ + friend class CaptureDelegate; +public: + /// constructor + VideoDeckLink (HRESULT * hRslt); + /// destructor + virtual ~VideoDeckLink (); + + /// open video/image file + virtual void openFile(char *file); + /// open video capture device + virtual void openCam(char *driver, short camIdx); + + /// release video source + virtual bool release (void); + /// overwrite base refresh to handle fixed image + virtual void refresh(void); + /// play video + virtual bool play (void); + /// pause video + virtual bool pause (void); + /// stop video + virtual bool stop (void); + /// set play range + virtual void setRange (double start, double stop); + /// set frame rate + virtual void setFrameRate (float rate); + +protected: + // format and codec information + /// image calculation + virtual void calcImage (unsigned int texId, double ts); + +private: + void VideoFrameArrived(IDeckLinkVideoInputFrame* inputFrame); + void LockCache() + { + pthread_mutex_lock(&mCacheMutex); + } + void UnlockCache() + { + pthread_mutex_unlock(&mCacheMutex); + } + + IDeckLinkInput* mDLInput; + BMDDisplayMode mDisplayMode; + BMDPixelFormat mPixelFormat; + bool mUse3D; + uint32_t mFrameWidth; + uint32_t mFrameHeight; + TextureDesc mTextureDesc; + PinnedMemoryAllocator* mpAllocator; + CaptureDelegate* mpCaptureDelegate; + + // cache frame in transit between the callback thread and the main BGE thread + // keep only one frame in cache because we just want to keep up with real time + pthread_mutex_t mCacheMutex; + IDeckLinkVideoInputFrame* mpCacheFrame; + bool mClosing; + +}; + +inline VideoDeckLink *getDeckLink(PyImage *self) +{ + return static_cast<VideoDeckLink*>(self->m_image); +} + +//////////////////////////////////////////// +// TextureTransfer : Abstract class to perform a transfer to GPU memory using fast transfer if available +//////////////////////////////////////////// +class TextureTransfer +{ +public: + TextureTransfer() {} + virtual ~TextureTransfer() { } + + virtual void PerformTransfer() = 0; +protected: + static bool _PinBuffer(void *address, uint32_t size); + static void _UnpinBuffer(void* address, uint32_t size); +}; + +//////////////////////////////////////////// +// PinnedMemoryAllocator +//////////////////////////////////////////// + +// PinnedMemoryAllocator implements the IDeckLinkMemoryAllocator interface and can be used instead of the +// built-in frame allocator, by setting with SetVideoInputFrameMemoryAllocator() or SetVideoOutputFrameMemoryAllocator(). +// +// For this sample application a custom frame memory allocator is used to ensure each address +// of frame memory is aligned on a 4kB boundary required by the OpenGL pinned memory extension. +// If the pinned memory extension is not available, this allocator will still be used and +// demonstrates how to cache frame allocations for efficiency. +// +// The frame cache delays the releasing of buffers until the cache fills up, thereby avoiding an +// allocate plus pin operation for every frame, followed by an unpin and deallocate on every frame. + + +class PinnedMemoryAllocator : public IDeckLinkMemoryAllocator +{ +public: + PinnedMemoryAllocator(unsigned cacheSize, size_t memSize); + virtual ~PinnedMemoryAllocator(); + + void TransferBuffer(void* address, TextureDesc* texDesc, GLuint texId); + + // IUnknown methods + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + + // IDeckLinkMemoryAllocator methods + virtual HRESULT STDMETHODCALLTYPE AllocateBuffer(dl_size_t bufferSize, void* *allocatedBuffer); + virtual HRESULT STDMETHODCALLTYPE ReleaseBuffer(void* buffer); + virtual HRESULT STDMETHODCALLTYPE Commit(); + virtual HRESULT STDMETHODCALLTYPE Decommit(); + +private: + static bool mGPUDirectInitialized; + static bool mHasDvp; + static bool mHasAMDPinnedMemory; + static size_t mReservedProcessMemory; + static bool ReserveMemory(size_t size); + + void Lock() + { + pthread_mutex_lock(&mMutex); + } + void Unlock() + { + pthread_mutex_unlock(&mMutex); + } + HRESULT _ReleaseBuffer(void* buffer); + + uint32_t mRefCount; + // protect the cache and the allocated map, + // not the pinnedBuffer map as it is only used from main thread + pthread_mutex_t mMutex; + std::map<void*, uint32_t> mAllocatedSize; + std::vector<void*> mBufferCache; + std::map<void *, TextureTransfer*> mPinnedBuffer; +#ifdef WIN32 + DVPBufferHandle mDvpCaptureTextureHandle; +#endif + // target texture in GPU + GLuint mTexId; + uint32_t mBufferCacheSize; +}; + +//////////////////////////////////////////// +// Capture Delegate Class +//////////////////////////////////////////// + +class CaptureDelegate : public IDeckLinkInputCallback +{ + VideoDeckLink* mpOwner; + +public: + CaptureDelegate(VideoDeckLink* pOwner); + + // IUnknown needs only a dummy implementation + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } + virtual ULONG STDMETHODCALLTYPE AddRef() { return 1; } + virtual ULONG STDMETHODCALLTYPE Release() { return 1; } + + virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame *videoFrame, IDeckLinkAudioInputPacket *audioPacket); + virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents notificationEvents, IDeckLinkDisplayMode *newDisplayMode, BMDDetectedVideoInputFormatFlags detectedSignalFlags); +}; + + +#endif /* WITH_GAMEENGINE_DECKLINK */ + +#endif /* __VIDEODECKLINK_H__ */ diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp b/source/gameengine/VideoTexture/VideoFFmpeg.cpp index 5fed1211d6c..083e9e28502 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp +++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp @@ -1203,7 +1203,7 @@ static PyMethodDef videoMethods[] = {"play", (PyCFunction)Video_play, METH_NOARGS, "Play (restart) video"}, {"pause", (PyCFunction)Video_pause, METH_NOARGS, "pause video"}, {"stop", (PyCFunction)Video_stop, METH_NOARGS, "stop video (play will replay it from start)"}, - {"refresh", (PyCFunction)Video_refresh, METH_NOARGS, "Refresh video - get its status"}, + {"refresh", (PyCFunction)Video_refresh, METH_VARARGS, "Refresh video - get its status"}, {NULL} }; // attributes structure @@ -1326,7 +1326,7 @@ static PyObject *Image_reload(PyImage *self, PyObject *args) // methods structure static PyMethodDef imageMethods[] = { // methods from VideoBase class - {"refresh", (PyCFunction)Video_refresh, METH_NOARGS, "Refresh image, i.e. load it"}, + {"refresh", (PyCFunction)Video_refresh, METH_VARARGS, "Refresh image, i.e. load it"}, {"reload", (PyCFunction)Image_reload, METH_VARARGS, "Reload image, i.e. reopen it"}, {NULL} }; diff --git a/source/gameengine/VideoTexture/blendVideoTex.cpp b/source/gameengine/VideoTexture/blendVideoTex.cpp index a62ffee3137..9b046d46412 100644 --- a/source/gameengine/VideoTexture/blendVideoTex.cpp +++ b/source/gameengine/VideoTexture/blendVideoTex.cpp @@ -128,6 +128,10 @@ static PyMethodDef moduleMethods[] = extern PyTypeObject VideoFFmpegType; extern PyTypeObject ImageFFmpegType; #endif +#ifdef WITH_GAMEENGINE_DECKLINK +extern PyTypeObject VideoDeckLinkType; +extern PyTypeObject DeckLinkType; +#endif extern PyTypeObject FilterBlueScreenType; extern PyTypeObject FilterGrayType; extern PyTypeObject FilterColorType; @@ -145,6 +149,9 @@ static void registerAllTypes(void) pyImageTypes.add(&VideoFFmpegType, "VideoFFmpeg"); pyImageTypes.add(&ImageFFmpegType, "ImageFFmpeg"); #endif +#ifdef WITH_GAMEENGINE_DECKLINK + pyImageTypes.add(&VideoDeckLinkType, "VideoDeckLink"); +#endif pyImageTypes.add(&ImageBuffType, "ImageBuff"); pyImageTypes.add(&ImageMixType, "ImageMix"); pyImageTypes.add(&ImageRenderType, "ImageRender"); @@ -194,6 +201,10 @@ PyMODINIT_FUNC initVideoTexturePythonBinding(void) return NULL; if (PyType_Ready(&TextureType) < 0) return NULL; +#ifdef WITH_GAMEENGINE_DECKLINK + if (PyType_Ready(&DeckLinkType) < 0) + return NULL; +#endif m = PyModule_Create(&VideoTexture_module_def); PyDict_SetItemString(PySys_GetObject("modules"), VideoTexture_module_def.m_name, m); @@ -207,6 +218,10 @@ PyMODINIT_FUNC initVideoTexturePythonBinding(void) Py_INCREF(&TextureType); PyModule_AddObject(m, "Texture", (PyObject *)&TextureType); +#ifdef WITH_GAMEENGINE_DECKLINK + Py_INCREF(&DeckLinkType); + PyModule_AddObject(m, "DeckLink", (PyObject *)&DeckLinkType); +#endif PyModule_AddIntConstant(m, "SOURCE_ERROR", SourceError); PyModule_AddIntConstant(m, "SOURCE_EMPTY", SourceEmpty); PyModule_AddIntConstant(m, "SOURCE_READY", SourceReady); diff --git a/tests/gtests/blenlib/BLI_array_store_test.cc b/tests/gtests/blenlib/BLI_array_store_test.cc index 33fb454ec2f..b71dc4575f1 100644 --- a/tests/gtests/blenlib/BLI_array_store_test.cc +++ b/tests/gtests/blenlib/BLI_array_store_test.cc @@ -528,15 +528,6 @@ static unsigned int rand_range_i(RNG *rng, unsigned int min_i, unsigned int max_ return min_i + value; } -static void rand_bytes(RNG *rng, char *data, int data_len) -{ - BLI_assert(data_len != 0); - while (data_len--) { - *data = BLI_rng_get_uint(rng) % 256; - data++; - } -} - static void testbuffer_list_state_random_data( ListBase *lb, const size_t stride, @@ -548,7 +539,7 @@ static void testbuffer_list_state_random_data( char *data = (char *)MEM_mallocN(data_len, __func__); if (lb->last == NULL) { - rand_bytes(rng, data, data_len); + BLI_rng_get_char_n(rng, data, data_len); } else { TestBuffer *tb_last = (TestBuffer *)lb->last; @@ -557,7 +548,7 @@ static void testbuffer_list_state_random_data( } else { memcpy(data, tb_last->data, tb_last->data_len); - rand_bytes(rng, &data[tb_last->data_len], data_len - tb_last->data_len); + BLI_rng_get_char_n(rng, &data[tb_last->data_len], data_len - tb_last->data_len); } /* perform multiple small mutations to the array. */ @@ -583,7 +574,7 @@ static void testbuffer_list_state_random_data( data_len += stride; data = (char *)MEM_reallocN((void *)data, data_len); memmove(&data[offset + stride], &data[offset], data_len - (offset + stride)); - rand_bytes(rng, &data[offset], stride); + BLI_rng_get_char_n(rng, &data[offset], stride); } break; } @@ -608,7 +599,7 @@ static void testbuffer_list_state_random_data( { if (data_len > 0) { const unsigned int offset = rand_range_i(rng, 0, data_len - stride, stride); - rand_bytes(rng, &data[offset], stride); + BLI_rng_get_char_n(rng, &data[offset], stride); } break; } @@ -667,7 +658,7 @@ static void random_chunk_generate( const size_t chunk_size_bytes = stride * chunk_count; for (int i = 0; i < chunks_per_buffer; i++) { char *data_chunk = (char *)MEM_mallocN(chunk_size_bytes, __func__); - rand_bytes(rng, data_chunk, chunk_size_bytes); + BLI_rng_get_char_n(rng, data_chunk, chunk_size_bytes); testchunk_list_add(lb, data_chunk, chunk_size_bytes); } BLI_rng_free(rng); |