Blackmagic RAW SDK
Blackmagic RAW SDK
Blackmagic RAW SDK
Blackmagic
RAW SDK
July 2019
Contents
Blackmagic RAW SDK
Introduction and Overview 8
1.0 API Overview 8
1.1 Decoder Overview 8
1.2 Sidecar 8
2.0 Interface Overview 10
2.2 Clip Object 10
2.3 Frame Object 11
3.0 SDK Operations and flow 11
3.1 Manual Decoders 11
4.0 GPU Configuration 11
4.1 Pipeline iterators 12
4.2 Pipeline device iterators 12
4.3 Pipeline preparation 12
4.4 Multi GPU Devices 12
Recommended UI Controls and Behavior 13
Custom Gamma Controls 14
Basic Types 17
BlackmagicRawVariantType 20
BlackmagicRawResourceType 20
BlackmagicRawResourceFormat 21
BlackmagicRawResourceUsage 21
BlackmagicRawPipeline 21
BlackmagicRawInstructionSet 21
BlackmagicRawAudioFormat 22
BlackmagicRawResolutionScale 22
BlackmagicRawClipProcessingAttribute 22
BlackmagicRawFrameProcessingAttribute 23
BlackmagicRawInterop 23
Interface Reference 24
IBlackmagicRaw Interface 24
IBlackmagicRaw::OpenClip method 24
IBlackmagicRaw::SetCallback method 25
IBlackmagicRaw::PreparePipeline method 25
Contents 2
IBlackmagicRaw::PreparePipelineForDevice method 26
IBlackmagicRaw::FlushJobs method 26
IBlackmagicRawFactory Interface 26
IBlackmagicRawFactory::CreateCodec method 26
IBlackmagicRawFactory::CreatePipelineIterator method 27
IBlackmagicRawFactory::CreatePipelineDeviceIterator method 27
IBlackmagicRawPipelineIterator Interface 28
IBlackmagicRawPipelineIterator::Next method 28
IBlackmagicRawPipelineIterator::GetName method 28
IBlackmagicRawPipelineIterator::GetInterop method 28
IBlackmagicRawPipelineIterator::GetPipeline method 29
IBlackmagicRawPipelineDeviceIterator Interface 29
IBlackmagicRawPipelineDeviceIterator::Next method 29
IBlackmagicRawPipelineDeviceIterator::GetPipeline method 29
IBlackmagicRawPipelineDeviceIterator::GetInterop method 30
IBlackmagicRawPipelineDeviceIterator::CreateDevice method 30
IBlackmagicRawOpenGLInteropHelper Interface 30
IBlackmagicRawOpenGLInteropHelper::GetPreferredResourceFormat method 30
IBlackmagicRawOpenGLInteropHelper::SetImage method 31
IBlackmagicRawPipelineDevice Interface 31
IBlackmagicRawPipelineDevice::SetBestInstructionSet method 32
IBlackmagicRawPipelineDevice::SetInstructionSet method 32
IBlackmagicRawPipelineDevice::GetInstructionSet method 32
IBlackmagicRawPipelineDevice::GetIndex method 32
IBlackmagicRawPipelineDevice::GetName method 33
IBlackmagicRawPipelineDevice::GetInterop method 33
IBlackmagicRawPipelineDevice::GetPipeline method 33
IBlackmagicRawPipelineDevice::GetPipelineName method 34
IBlackmagicRawPipelineDevice::GetOpenGLInteropHelper method 34
IBlackmagicRawToneCurve Interface 34
IBlackmagicRawToneCurve::GetToneCurve method 35
IBlackmagicRawToneCurve::EvaluateToneCurve method 36
IBlackmagicRawConstants Interface 37
IBlackmagicRawConstants::GetClipProcessingAttributeRange method 37
IBlackmagicRawConstants::GetClipProcessingAttributeList method 38
IBlackmagicRawConstants::GetFrameProcessingAttributeRange method 38
IBlackmagicRawConstants::GetFrameProcessingAttributeList method 39
IBlackmagicRawConstants::GetISOListForAnalogGain method 39
Contents 3
IBlackmagicRawConfiguration Interface 40
IBlackmagicRawConfiguration::SetPipeline method 40
IBlackmagicRawConfiguration::GetPipeline method 41
IBlackmagicRawConfiguration::IsPipelineSupported method 41
IBlackmagicRawConfiguration::SetCPUThreads method 42
IBlackmagicRawConfiguration::GetCPUThreads method 42
IBlackmagicRawConfiguration::GetMaxCPUThreadCount method 42
IBlackmagicRawConfiguration::SetWriteMetadataPerFrame method 43
IBlackmagicRawConfiguration::GetWriteMetadataPerFrame method 43
IBlackmagicRawConfiguration::SetFromDevice method 43
IBlackmagicRawConfigurationEx Interface 44
IBlackmagicRawConfigurationEx::GetResourceManager method 44
IBlackmagicRawConfigurationEx::SetResourceManager method 44
IBlackmagicRawConfigurationEx::GetInstructionSet method 45
IBlackmagicRawConfigurationEx::SetInstructionSet method 45
IBlackmagicRawResourceManager Interface 45
IBlackmagicRawResourceManager::CreateResource method 46
IBlackmagicRawResourceManager::ReleaseResource method 46
IBlackmagicRawResourceManager::CopyResource method 47
IBlackmagicRawResourceManager::GetResourceHostPointer method 47
IBlackmagicRawMetadataIterator Interface 48
IBlackmagicRawMetadataIterator::Next method 48
IBlackmagicRawMetadataIterator::GetKey method 48
IBlackmagicRawMetadataIterator::GetData method 48
IBlackmagicRawClipProcessingAttributes Interface 49
IBlackmagicRawClipProcessingAttributes::GetClipAttribute method 49
IBlackmagicRawClipProcessingAttributes::SetClipAttribute method 49
IBlackmagicRawClipProcessingAttributes::GetPost3DLUT method 50
IBlackmagicRawPost3DLUT Interface 50
IBlackmagicRawPost3DLUT::GetName method 50
IBlackmagicRawPost3DLUT::GetTitle method 51
IBlackmagicRawPost3DLUT::GetSize method 51
IBlackmagicRawPost3DLUT::GetResourceGPU method 51
IBlackmagicRawPost3DLUT::GetResourceCPU method 52
IBlackmagicRawPost3DLUT::GetResourceSizeBytes method 52
IBlackmagicRawFrameProcessingAttributes Interface 52
IBlackmagicRawFrameProcessingAttributes::GetFrameAttribute method 53
IBlackmagicRawFrameProcessingAttributes::SetFrameAttribute method 53
Contents 4
IBlackmagicRawProcessedImage Interface 53
IBlackmagicRawProcessedImage::GetWidth method 54
IBlackmagicRawProcessedImage::GetHeight method 54
IBlackmagicRawProcessedImage::GetResource method 54
IBlackmagicRawProcessedImage::GetResourceType method 55
IBlackmagicRawProcessedImage::GetResourceFormat method 55
IBlackmagicRawProcessedImage::GetResourceSizeBytes method 55
IBlackmagicRawProcessedImage::GetResourceContextAndCommandQueue method 55
IBlackmagicRawJob Interface 56
IBlackmagicRawJob::Submit method 56
IBlackmagicRawJob::Abort method 57
IBlackmagicRawJob::SetUserData method 57
IBlackmagicRawJob::GetUserData method 57
IBlackmagicRawCallback Interface 58
IBlackmagicRawCallback::ReadComplete method 58
IBlackmagicRawCallback::DecodeComplete method 59
IBlackmagicRawCallback::ProcessComplete method 59
IBlackmagicRawCallback::TrimProgress method 59
IBlackmagicRawCallback::TrimComplete method 60
IBlackmagicRawCallback::SidecarMetadataParseWarning method 60
IBlackmagicRawCallback::SidecarMetadataParseError method 60
IBlackmagicRawCallback::PreparePipelineComplete method 61
IBlackmagicRawClipAudio Interface 61
IBlackmagicRawClipAudio::GetAudioFormat method 61
IBlackmagicRawClipAudio::GetAudioBitDepth method 62
IBlackmagicRawClipAudio::GetAudioChannelCount method 62
IBlackmagicRawClipAudio::GetAudioSampleRate method 62
IBlackmagicRawClipAudio::GetAudioSampleCount method 63
IBlackmagicRawClipAudio::GetAudioSamples method 63
IBlackmagicRawFrame Interface 64
IBlackmagicRawFrame::GetFrameIndex method 65
IBlackmagicRawFrame::GetTimecode method 65
IBlackmagicRawFrame::GetMetadataIterator method 65
IBlackmagicRawFrame::GetMetadata method 66
IBlackmagicRawFrame::SetMetadata method 66
IBlackmagicRawFrame::CloneFrameProcessingAttributes method 66
IBlackmagicRawFrame::SetResolutionScale method 67
IBlackmagicRawFrame::GetResolutionScale method 67
Contents 5
IBlackmagicRawFrame::SetResourceFormat method 67
IBlackmagicRawFrame::GetResourceFormat method 68
IBlackmagicRawFrame::CreateJobDecodeAndProcessFrame method 68
IBlackmagicRawFrameEx Interface 69
IBlackmagicRawFrameEx::GetBitStreamSizeBytes method 69
IBlackmagicRawFrameEx::GetProcessedImageResolution method 69
IBlackmagicRawManualDecoderFlow1 Interface 70
IBlackmagicRawManualDecoderFlow1::PopulateFrameStateBuffer method 70
IBlackmagicRawManualDecoderFlow1::GetFrameStateSizeBytes method 71
IBlackmagicRawManualDecoderFlow1::GetDecodedSizeBytes method 71
IBlackmagicRawManualDecoderFlow1::GetProcessedSizeBytes method 72
IBlackmagicRawManualDecoderFlow1::GetPost3DLUTSizeBytes method 72
IBlackmagicRawManualDecoderFlow1::CreateJobDecode method 73
IBlackmagicRawManualDecoderFlow1::CreateJobProcess method 73
IBlackmagicRawManualDecoderFlow2 Interface 74
IBlackmagicRawManualDecoderFlow2::PopulateFrameStateBuffer method 75
IBlackmagicRawManualDecoderFlow2::GetFrameStateSizeBytes method 75
IBlackmagicRawManualDecoderFlow2::GetDecodedSizeBytes method 76
IBlackmagicRawManualDecoderFlow2::GetWorkingSizeBytes method 76
IBlackmagicRawManualDecoderFlow2::GetProcessedSizeBytes method 76
IBlackmagicRawManualDecoderFlow2::GetPost3DLUTSizeBytes method 77
IBlackmagicRawManualDecoderFlow2::CreateJobDecode method 77
IBlackmagicRawManualDecoderFlow2::CreateJobProcess method 78
IBlackmagicRawClip Interface 79
IBlackmagicRawClip::GetWidth method 80
IBlackmagicRawClip::GetHeight method 80
IBlackmagicRawClip::GetFrameRate method 80
IBlackmagicRawClip::GetFrameCount method 81
IBlackmagicRawClip::GetTimecodeForFrame method 81
IBlackmagicRawClip::GetMetadataIterator method 81
IBlackmagicRawClip::GetMetadata method 82
IBlackmagicRawClip::SetMetadata method 82
IBlackmagicRawClip::GetCameraType method 82
IBlackmagicRawClip::CloneClipProcessingAttributes method 83
IBlackmagicRawClip::GetMulticardFileCount method 83
IBlackmagicRawClip::IsMulticardFilePresent method 83
IBlackmagicRawClip::GetSidecarFileAttached method 84
IBlackmagicRawClip::SaveSidecarFile method 84
Contents 6
IBlackmagicRawClip::ReloadSidecarFile method 84
IBlackmagicRawClip::CreateJobReadFrame method 85
IBlackmagicRawClip::CreateJobTrim method 85
IBlackmagicRawClipEx Interface 86
IBlackmagicRawClipEx::GetMaxBitStreamSizeBytes method 86
IBlackmagicRawClipEx::GetBitStreamSizeBytes method 87
IBlackmagicRawClipEx::CreateJobReadFrame method 87
IBlackmagicRawClipEx::QueryTimecodeInfo method 88
Contents 7
Introduction and Overview
1.0 API Overview
The Blackmagic RAW SDK provides a highly optimised decoder and image processing pipeline.
Available on Mac, Windows, and Linux platforms, the SDK supports supports multiple CPU
architectures and multiple GPU APIs in order to take full advantage of your machine.
The goal is to provide an easy to use yet powerful SDK, which will utilise cross-platform efficient
decoding of .braw files produced by Blackmagic Cameras.
There are several GPU decoders available, including Metal, CUDA, and OpenCL. The final
processed image from each decoder will be provided in a buffer object native to the respective GPU
API. This will allow quick access for further processing or display.
The GPU decoders are dynamically loaded, meaning they will require the system to have the
relevant APIs installed in order to function.
The SDK has been designed for multi-GPU and multi-process capabilities allowing high level
workstations to use all the resources available in the system.
1.2 Sidecar
A .sidecar file may be used, storing any metadata that is modified after the original .braw file
is produced. The intent here is to not modify the original .braw file. This sidecar file can be manually
deleted if the user wants to restore the movie metadata to its original state.
When metadata or image processing values (such as white balance) are modified via the SDK, the
user can then choose to save this data to the sidecar file. Now when the movie is loaded (potentially
in a different application) the sidecar file be applied and the picture will look consistent.
At this time, the user can run the ‘trim’ operation which will bake the sidecar changes into a newly
created .braw file saved to disk. This can be run on any frame range right down to a single frame
which produces handy images to pass between colleagues.
The .sidecar file is stored as a text JSON file, allowing users to manually edit or use external tools if
they wish to modify it.
An example sidecar with an identity 3DLUT follows. The information has been truncated for brevity.
{
“tone_curve_contrast” : 1.450000,
“tone_curve_saturation” : 1.150000,
“tone_curve_midpoint” : 0.409000,
“tone_curve_highlights” : 0.600000,
“tone_curve_shadows” : 1.800000,
“tone_curve_black_level” : 0.000000,
“tone_curve_white_level” : 1.000000,
“tone_curve_video_black_level” : 1,
“highlight_recovery” : 1,
“viewing_gamma” : “Blackmagic Design Custom”,
“viewing_gamut” : “Blackmagic Design”,
“exposure”: {
“14:57:33:00” : 0.200000
},
“white_balance_kelvin”: {
“14:57:33:00” : 4520
},
“white_balance_tint”: {
“14:57:33:00” : 5
},
“iso”: {
“14:57:33:00” : 500
},
“post_3dlut_mode” : “Sidecar”,
“post_3dlut_sidecar_name” : “Identity3DLUT.cube”,
“post_3dlut_sidecar_title” : “My Identity 3D LUT”,
“post_3dlut_sidecar_size” : 33,
“post_3dlut_sidecar_data” : “0.0000000000 0.0000000000 0.0000000000
0.0312500000 0.0000000000 0.0000000000
0.0625000000 0.0000000000 0.0000000000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0.9375000000 1.0000000000 1.0000000000
0.9687500000 1.0000000000 1.0000000000
1.0000000000 1.0000000000 1.0000000000”
}
IBlackmagicRawFactory
IBlackmagicRaw
IBlackmagicRawConstants
IBlackmagicRawConfiguration
IBlackmagicRawClip
IBlackmagicRawMetadataIterator
IBlackmagicRawClipAudio
IBlackmagicRawClipProcessingAttributes
IBlackmagicRawFrame
IBlackmagicRawMetadataIterator
IBlackmagicRawFrameProcessingAttributes
IBlackmagicRawProcessedImage
IBlackmagicRawFactory is the API entry point. From here the user creates a IBlackmagicRaw object.
This object owns a single decoder instance.
This object can be configured via IBlackmagicRawConfiguration allowing the user to define CPU
constraints or set up the SDK to use desired GPU APIs.
After completing the above steps, the user can start opening clips. Once the first clip has been
opened, the decoder is started and any further configuration changes will be discarded.
Clip audio & clip-level processing attributes can also be accessed. The clip-level processing
attributes allow the user to modify fields such as displayed gamma, displayed gamut, Blackmagic
colour science generation and custom gamma parameters.
Finally with the clip object we create an asynchronous job to read a frame from the clip.
This will provide a frame object.
The user can also specify output scale & the desired pixel format of the processed image which is
produced upon request from the frame.
Once ready, the user creates an asynchronous job to produce the processed image. This image is
then ready for display.
The SDK provides three main operations, read, decode and process. The read operation is reading
the compressed image from an opened IBlackmagicRawClip file into a IBlackmagicRawFrame. The
decode operation decodes this compressed image format and prepares it for processing. The
process operation applies colour processing (such as white balancing, exposure) and provides the
final image.
Each of these operations are asynchronous and occur across multiple CPU threads / GPU contexts.
By default this is all handled internally to provide an easy yet efficient solution.
The flow described above is: open a clip, read a frame, decode and process frame:
ReadFrame() DecodeAndProcess()
To create a context and commandQueue the user needs to utilise their desired compute API library
(i.e. Metal, CUDA or OpenCL).
To make this easier for the user, Blackmagic RAW SDK offers pipeline and device iterators. These
allow creation of devices in an abstract way, removing the need to deal directly with compute APIs.
Using this interface allows applications to check for various compute APIs without the need to set-up
and call any of the API functions and hence removes the requirement of linking against API libraries
and associated dependencies explicitly.
Once a (IBlackmagicRawPipelineDevice) device has been created via the device iterator, it may be
used to configure a decoder with the SetFromDevice method of IBlackmagicRawConfiguration.
This is equivalent to, but more convenient than, querying the context and command queue from the
device with the GetPipeline method and providing these parameters to the decoder configuration
via SetPipeline.
The context and command queue owned by a device are compute-level API objects
that are used directly by the decoder. The life-time of these compute-level API objects
must outlive that of the decoder, therefore the device instance MUST outlive the
decoder instance.
The preparation of these resources is a potentially time-consuming process and as such is executed
asynchronously. The callback interface has a method (PreparePipelineComplete) to allow the user to
respond to the completion of a pipeline preparation.
Taking advantage of the manual decoders (specified in section 3.1 above) allows the user to
distribute decoding operations across multiple devices.
Color Space/Gamut
Type: Drop down selector
Gamma
Type: Drop down selector
ISO
Type: Drop down selector
Exposure
Type: Slider
Default: 0.
Default: 5600
Tint
Type: Slider
Default: 10
Highlight Recovery
Type: Checkbox
Default: Off
Export Frame
Type: Button
Update Sidecar
Type: Button
Saves sidecar file with the currently set parameters for the clip.
Note: Blackmagic Design Video should have the custom gamma controls DISABLED.
When selecting Blackmagic Design Film or Blackmagic Design Extended Video the custom gamma
controls take on the values supplied by the SDK. When a user adjusts a custom gamma control
slider, the gamma selection should automatically change to Blackmagic Design Custom which
should be written with the current values shown in the UI. The user is now creating their own custom
gamma which can be stored.
The following image examples show the custom gamma controls selectable with Blackmagic Design
Film, and disabled with an incompatible gamma such as Rec.709.
Example: The custom gamma controls (last 3rd of the RAW panel) are
disabled with Blackmagic Design Video gamma.
Saturation
Type: Slider
Default: 1.0
Contrast
Type: Slider
Default: 0.5
Midpoint
Type: Slider
Default: 0.41
Default: 1.0
Shadow Rolloff
Type: Slider
Default: 1.0
Black Level
Type: Slider
Default: 1.0
White Level
Type: Slider
Default: 1.0
Default: Off
IBlackmagicRawToneCurve::EvaluateToneCurve()
The EvaluateToneCurve method can be used to return a buffer that can then be used to draw and
visualize the result of the custom gamma controls. This is particularly useful when users are creating
their own custom gammas. An example of such a UI is shown below:
Basic Types
enum
The enumerator type is represented differently on each platform, using the most appropriate
system type:
macOS uint32_t
Linux uint32_t
uuid
The Universally unique identifier type is represented differently on each platform, using the most
appropriate system type:
Windows GUID
macOS CFUUIDBytes
Linux GUID
Boolean
A boolean is represented differently on each platform, using the most appropriate system type:
Windows BOOL
macOS bool
Linux bool
Basic Types 17
int8_t
The signed 8 bit integer type is represented differently on each platform, using the most appropriate
system type:
macOS int8_t
Linux int8_t
uint8_t
The unsigned 8 bit integer type is represented differently on each platform, using the most
appropriate system type:
macOS uint8_t
Linux uint8_t
int16_t
The signed 16 bit integer type is represented differently on each platform, using the most
appropriate system type:
Windows short
macOS int16_t
Linux int16_t
uint16_t
The unsigned 16 bit integer type is represented differently on each platform, using the most
appropriate system type:
macOS uint16_t
Linux uint16_t
int32_t
The signed 32 bit integer type is represented differently on each platform, using the most
appropriate system type:
Windows int
macOS int32_t
Linux int32_t
Basic Types 18
uint32_t
The unsigned 32 bit integer type is represented differently on each platform, using the most
appropriate system type:
macOS uint32_t
Linux uint32_t
int64_t
The signed 64 bit integer type is represented differently on each platform, using the most
appropriate system type:
macOS int64_t
Linux int64_t
uint64_t
The unsigned 64 bit integer type is represented differently on each platform, using the most
appropriate system type:
macOS uint64_t
Linux uint64_t
long
The long type is represented differently on each platform, using the most appropriate system type:
Windows LONG
macOS long
Linux long
string
Strings are represented differently on each platform, using the most appropriate system type:
Windows BSTR
macOS CFStringRef
SafeArray
The SafeArray type is represented differently on each platform, using the most appropriate
system type:
macOS SafeArray*
Linux SafeArray*
Basic Types 19
SafeArrayData
The SafeArrayData type is represented differently on each platform, using the most appropriate
system type:
macOS CFMutableDataRef
Linux void*
Variant
The Variant type is represented differently on each platform, using the most appropriate
system type:
Windows VARIANT*
macOS Variant*
Linux Variant*
BlackmagicRawVariantType
Variant types that may be stored as metadata
Value
macOS
and
Key Linux Windows Description
BlackmagicRawResourceType
Used in IBlackmagicRawResourceManager
Basic Types 20
BlackmagicRawResourceFormat
Used for resource allocation
BlackmagicRawResourceUsage
Used in IBlackmagicRawResourceManager
BlackmagicRawPipeline
Used in IBlackmagicRawConfiguration. Each pipeline has different mappings to
context/commandQueue
BlackmagicRawInstructionSet
Used in IBlackmagicRawConfiguration
Basic Types 21
BlackmagicRawAudioFormat
Used in IBlackmagicRawFileAudio
BlackmagicRawResolutionScale
Used in IBlackmagicRawFrame
BlackmagicRawClipProcessingAttribute
Variant types that may be stored as metadata
Basic Types 22
Key Value Description
BlackmagicRawFrameProcessingAttribute
Variant types that may be stored as metadata
BlackmagicRawInterop
Key Value Description
Basic Types 23
Interface Reference
IBlackmagicRaw Interface
Each codec interface will have its own memory storage and decoder. When decoding multiple clips
via one codec, first in first out ordering will apply
Related Interfaces
Interface Interface ID
IBlackmagicRawConfiguration IID_IBlackmagicRawConfiguration
IBlackmagicRawConfigurationEx IID_IBlackmagicRawConfigurationEx
IBlackmagicRawConstants IID_IBlackmagicRawConstants
IBlackmagicRawManualDecoderFlow1 IID_IBlackmagicRawManualDecoderFlow1
IBlackmagicRawManualDecoderFlow2 IID_IBlackmagicRawManualDecoderFlow2
IBlackmagicRawToneCurve IID_IBlackmagicRawToneCurve
Method Description
Blocking call which will only return once all jobs have
FlushJobs
been completed
IBlackmagicRaw::OpenClip method
Opens a clip
Syntax
HRESULT OpenClip
(string fileName,IBlackmagicRawClip** clip)
Parameters
Interface Reference 24
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when clip is NULL,
E_INVALIDARG is returned when fileName is invalid, E_FAIL is returned if the clip failed to open.
IBlackmagicRaw::SetCallback method
Registers a callback with the codec object
Syntax
HRESULT SetCallback (IBlackmagicRawCallback* callback)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRaw::PreparePipeline method
Asynchronously prepares the current pipeline for decoding, calling the registered callback’s
PreparePipelineComplete() method upon completion. This reduces the potential performance
impact of decoding the first frame due to on-demand GPU kernel compilation.
Syntax
HRESULT PreparePipeline (
void* pipelineContext,
void* pipelineCommandQueue,
void* userData)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
Interface Reference 25
IBlackmagicRaw::PreparePipelineForDevice method
Asynchronously prepares the current pipeline for decoding, calling the registered callback’s
PreparePipelineComplete() method upon completion. This reduces the potential performance impact
of decoding the first frame due to on-demand GPU kernel compilation.
Syntax
HRESULT PreparePipelineForDevice(IBlackmagicRawPipelineDevice*
pipelineDevice,
void* userData)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRaw::FlushJobs method
Blocking call which will only return once all jobs have been completed
Syntax
HRESULT FlushJobs()
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRawFactory Interface
Use this to create one or more Codec objects
Method Description
IBlackmagicRawFactory::CreateCodec method
Create a codec from the factory
Syntax
HRESULT CreateCodec (IBlackmagicRaw** codec)
Parameters
Interface Reference 26
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when codec is NULL,
E_FAIL is returned if the codec failed to create.
IBlackmagicRawFactory::CreatePipelineIterator method
Create a pipeline iterator from the factory
Syntax
HRESULT CreatePipelineIterator(
BlackmagicRawInterop interop,
IBlackmagicRawPipelineIterator**
pipelineIterator)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
pipelineIterator is NULL.
IBlackmagicRawFactory::CreatePipelineDeviceIterator method
Create a pipeline device iterator from the factory
Syntax
HRESULT CreatePipelineDeviceIterator(
BlackmagicRawPipeline pipeline,
BlackmagicRawInterop interop,
IBlackmagicRawPipelineDeviceIterator**
deviceIterator)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
deviceIterator is NULL.
Interface Reference 27
IBlackmagicRawPipelineIterator Interface
Use this to determine pipelines available for use on the system
Method Description
Next Step to next pipeline entry. S_FALSE is returned when called on last entry
IBlackmagicRawPipelineIterator::Next method
Step to next pipeline entry. S_FALSE is returned when called on last entry
Syntax
HRESULT Next()
Return Values
If the method succeeds, the return value is S_OK or S_FALSE. S_FALSE is returned when Next() is
called on the last element. E_FAIL is returned when Next() is called after the last element.
IBlackmagicRawPipelineIterator::GetName method
Get the name of the pipeline
Syntax
HRESULT GetName(string* pipelineName)
Parameters
pipelineName out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
pipelineName is NULL.
IBlackmagicRawPipelineIterator::GetInterop method
Get the interoperability of the pipeline
Syntax
HRESULT GetInterop(BlackmagicRawInterop* interop)
Parameters
interop out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when interop is NULL.
Interface Reference 28
IBlackmagicRawPipelineIterator::GetPipeline method
Get the pipeline
Syntax
HRESULT GetPipeline(BlackmagicRawPipeline* pipeline)
Parameters
pipeline out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when pipeline is NULL.
IBlackmagicRawPipelineDeviceIterator Interface
Use this to determine pipeline devices available for use on the system
Method Description
Next Step to next device entry, will return S_FALSE when called on last entry
CreateDevice Create the pipeline device (container for context and command queue)
IBlackmagicRawPipelineDeviceIterator::Next method
Step to next device entry, will return S_FALSE when called on last entry
Syntax
HRESULT Next()
Return Values
If the method succeeds, the return value is S_OK or S_FALSE. S_FALSE is returned when Next() is
called on the last element. E_FAIL is returned when Next() is called after the last element.
IBlackmagicRawPipelineDeviceIterator::GetPipeline method
Get the pipeline
Syntax
HRESULT GetPipeline(BlackmagicRawPipeline* pipeline)
Parameters
pipeline out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when pipeline is NULL.
Interface Reference 29
IBlackmagicRawPipelineDeviceIterator::GetInterop method
Get the interoperability of the device’s pipeline
Syntax
HRESULT GetInterop(BlackmagicRawInterop* interop)
Parameters
interop out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when interop is NULL.
IBlackmagicRawPipelineDeviceIterator::CreateDevice method
Create the pipeline device (container for context and command queue)
Syntax
HRESULT CreateDevice(IBlackmagicRawPipelineDevice** pipelineDevice)
Parameters
pipelineDevice out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
pipelineDevice is NULL.
IBlackmagicRawOpenGLInteropHelper Interface
Public Member Functions
Method Description
IBlackmagicRawOpenGLInteropHelper::GetPreferredResourceFormat
method
Gets the preferred resource format for interaction between the device and OpenGL
Syntax
HRESULT GetPreferredResourceFormat(
BlackmagicRawResourceFormat* preferredFormat)
Parameters
preferredFormat out –
Interface Reference 30
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
preferredFormat is NULL.
IBlackmagicRawOpenGLInteropHelper::SetImage method
Copies the processed image into an OpenGL texture
Syntax
HRESULT SetImage(
IBlackmagicRawProcessedImage* processedImage,
uint32_t* openGLTextureName,
int32_t* openGLTextureTarget)
Parameters
processedImage in
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
processedImage is NULL.
IBlackmagicRawPipelineDevice Interface
A device is essentially a container for a context and command queue associated with a pipeline. This
object is provided so the user need not deal directly with the underlying compute API in order to
provide context and command queue to the codec configuration. As such, the device instance
MUST outlive that of the codec instance on which the device is used.
Method Description
Sets the CPU instruction set of the device to be that representing the best
SetBestInstructionSet
capabilities of the system
SetInstructionSet Sets the CPU instruction set to use for the device
Gets the index of the device in the pipeline's device list. This is typically
GetIndex
used to differentiate devices in multi-GPU configurations.
GetPipelineName Gets the name of the pipeline associated with the device
Interface Reference 31
IBlackmagicRawPipelineDevice::SetBestInstructionSet method
Sets the CPU instruction set of the device to be that representing the best capabilities of the system
Syntax
HRESULT SetBestInstructionSet()
Return Values
This method returns S_OK.
IBlackmagicRawPipelineDevice::SetInstructionSet method
Sets the CPU instruction set to use for the device
Syntax
HRESULT SetInstructionSet(BlackmagicRawInstructionSet instructionSet)
Parameters
instructionSet in –
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when instructionSet is
not a valid BlackmagicRawInstructionSet enumeration value. E_FAIL is returned if the user’s CPU
does not support the specified instruction set.
IBlackmagicRawPipelineDevice::GetInstructionSet method
Gets the CPU instruction set of the device
Syntax
HRESULT GetInstructionSet(BlackmagicRawInstructionSet* instructionSet)
Parameters
instructionSet out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
instructionSet is NULL.
IBlackmagicRawPipelineDevice::GetIndex method
Gets the index of the device in the pipeline’s device list. This is typically used to differentiate devices
in multi-GPU configurations.
Syntax
HRESULT GetIndex(uint32_t* deviceIndex)
Parameters
deviceIndex out –
Interface Reference 32
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
deviceIndex is NULL.
IBlackmagicRawPipelineDevice::GetName method
Gets the name of the device
Syntax
HRESULT GetName(string* deviceName)
Parameters
deviceName out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
deviceName is NULL.
IBlackmagicRawPipelineDevice::GetInterop method
Gets the API interoperability of the device
Syntax
HRESULT GetInterop(BlackmagicRawInterop* interop)
Parameters
interop out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when interop is NULL.
IBlackmagicRawPipelineDevice::GetPipeline method
Gets the pipeline configuration information associated with the device. These parameters may be
provided to IBlackmagicRawConfiguration::SetPipeline.
IBlackmagicRawConfiguration::SetFromDevice may be a better option.
Syntax
HRESULT GetPipeline(
BlackmagicRawPipeline* pipeline,
void** context,
void** commandQueue)
Parameters
pipeline out –
context out –
commandQueue out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when any of pipeline,
context and commandQueue is NULL.
Interface Reference 33
IBlackmagicRawPipelineDevice::GetPipelineName method
Gets the name of the pipeline associated with the device
Syntax
HRESULT GetPipelineName(string* pipelineName)
Parameters
pipelineName out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
pipelineName is NULL.
IBlackmagicRawPipelineDevice::GetOpenGLInteropHelper method
Creates an instance of a helper to get the results of a processed image as an OpenGL texture
Syntax
HRESULT GetOpenGLInteropHelper(IBlackmagicRawOpenGLInteropHelper**
interopHelper)
Parameters
interopHelper out –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
interopHelper is NULL.
IBlackmagicRawToneCurve Interface
If desired, the user application can cache these results
Related Interfaces
Method Description
EvaluateToneCurve Evaluates tone curve, returned buffer can be used to visualise curve
Interface Reference 34
IBlackmagicRawToneCurve::GetToneCurve method
Query tone curve parameters for a specific camera and gamma. These are only currently available
on Gamut: Blackmagic Design, Gamma: Blackmagic Design Film, Blackmagic Design Extended
Video, Blackmagic Design Custom.
Note: Custom gamma can define a tone curve per clip, see
BlackmagicRawClipProcessingAttributes::GetToneCurveForCustomGamma()
Syntax
HRESULT GetToneCurve (
string cameraType,
string gamma,
uint16_t gen,
float* contrast,
float* saturation,
float* midpoint,
float* highlights,
float* shadows,
float* blackLevel,
float* whiteLevel,
uint16_t* videoBlackLevel)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when any of contrast,
saturation, midpoint, highlights, shadows or videoBlackLevel are NULL. E_INVALIDARG is returned
when the provided cameraType / gamma / gen combination is invalid.
Interface Reference 35
IBlackmagicRawToneCurve::EvaluateToneCurve method
Evaluates tone curve, returned buffer can be used to visualise curve
Syntax
HRESULT EvaluateToneCurve (
string cameraType,
uint16_t gen,
float contrast,
float saturation,
float midpoint,
float highlights,
float shadows,
float blackLevel,
float whiteLevel,
uint16_t videoBlackLevel,
float* array,
uint32_t arrayElementCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when arrayOut is NULL.
E_INVALIDARG is returned when arrayOutElementCount is 0 or the cameraType / bmdgen
combination provided is invalid.
Interface Reference 36
IBlackmagicRawConstants Interface
If desired, the user application can cache these results
Related Interfaces
Interface Interface ID
IBlackmagicRaw IID_IBlackmagicRaw
Method Description
IBlackmagicRawConstants::GetClipProcessingAttributeRange method
Get the clip processing attribute range for the specified attribute
Syntax
HRESULT GetClipProcessingAttributeRange (
string cameraType,
BlackmagicRawClipProcessingAttribute attribute,
Variant valueMin,
Variant valueMax)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute
is invalid, or the attribute does not have a range, see GetClipProcessingAttributeList().
E_POINTER is returned when valueMin or valueMax is NULL.
Interface Reference 37
IBlackmagicRawConstants::GetClipProcessingAttributeList method
Get the clip processing attribute value list for the specified attribute
Syntax
HRESULT GetClipProcessingAttributeList (
string cameraType,
BlackmagicRawClipProcessingAttribute attribute,
Variant array,
uint32_t* arrayElementCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute
is invalid, or the attribute does not have a value list, see GetClipProcessingAttributeRange().
IBlackmagicRawConstants::GetFrameProcessingAttributeRange method
Get the frame processing attribute range for the specified attribute
Syntax
HRESULT GetFrameProcessingAttributeRange (
string cameraType,
BlackmagicRawFrameProcessingAttribute
attribute,
Variant valueMin,
Variant valueMax)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute
is invalid, or the attribute does not have a range, see GetFrameProcessingAttributeList().
E_POINTER is returned when valueMin or valueMax is NULL.
Interface Reference 38
IBlackmagicRawConstants::GetFrameProcessingAttributeList method
Get the frame processing attribute value list for the specified attribute
Syntax
HRESULT GetFrameProcessingAttributeList (
string cameraType,
BlackmagicRawClipProcessingAttribute attribute,
Variant array,
uint32_t* arrayElementCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute is
invalid, or the attribute does not have a value list, see GetFrameProcessingAttributeRange().
IBlackmagicRawConstants::GetISOListForAnalogGain method
The ISO selection can be constrained by the analog gain selected at record time, use this
function to get a narrowed view of the available ISOs for a given cameraType and analog
gain values.
Syntax
HRESULT GetISOListForAnalogGain (
string cameraType,
float analogGain,
uint16_t* array,
uint32_t* arrayElementCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when cameraType
analogGain is invalid.
Interface Reference 39
IBlackmagicRawConfiguration Interface
The configuration properties are read when the first call to OpenClip() occurs. After this
configuration properties should not be changed, and changes will be ignored.
Related Interfaces
Interface Interface ID
IBlackmagicRaw IID_IBlackmagicRaw
Method Description
SetWriteMetadataPerFrame Sets if per-frame metadata will be written to only the relevant frame.
GetWriteMetadataPerFrame Gets if the per-frame metadata will be written to only the relevant frame
IBlackmagicRawConfiguration::SetPipeline method
Set pipeline to use for decoding, see BlackmagicRawPipeline
Syntax
HRESULT SetPipeline (
BlackmagicRawPipeline pipeline,
void* pipelineContext,
void* pipelineCommandQueue)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_FAIL is returned when the pipeline failed to
initialise.
Interface Reference 40
IBlackmagicRawConfiguration::GetPipeline method
Get pipeline used for decoding, see BlackmagicRawPipeline
Syntax
HRESULT GetPipeline (
BlackmagicRawPipeline* pipeline,
void** pipelineContextOut,
void** pipelineCommandQueueOut)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRawConfiguration::IsPipelineSupported method
Determine if a pipeline is supported by this machine. This will verify relevant hardware / DLLs
are installed
Syntax
HRESULT IsPipelineSupported (
BlackmagicRawPipeline pipeline,
Boolean* pipelineSupported)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when clip is NULL,
E_INVALIDARG is returned when pipeline is invalid
Interface Reference 41
IBlackmagicRawConfiguration::SetCPUThreads method
Sets the number of CPU threads to use while decoding. Defaults to number of hardware threads
available on system
Syntax
HRESULT SetCPUThreads (uint32_t threadCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRawConfiguration::GetCPUThreads method
Gets the number of CPU threads to use while decoding
Syntax
HRESULT GetCPUThreads (uint32_t* threadCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when threadCount is NULL.
IBlackmagicRawConfiguration::GetMaxCPUThreadCount method
Query the number of hardware threads available on system
Syntax
HRESULT GetMaxCPUThreadCount (uint32_t* threadCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
maxCPUThreadCount is NULL.
Interface Reference 42
IBlackmagicRawConfiguration::SetWriteMetadataPerFrame method
Sets if per-frame metadata will be written to only the relevant frame.
Syntax
HRESULT SetWriteMetadataPerFrame (Boolean writePerFrame)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRawConfiguration::GetWriteMetadataPerFrame method
Gets if the per-frame metadata will be written to only the relevant frame
Syntax
HRESULT GetWriteMetadataPerFrame (Boolean* writePerFrame)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
writePerFrame is NULL.
IBlackmagicRawConfiguration::SetFromDevice method
Equivalent to querying the device for instruction set, pipeline, context and command queue then calling
SetInstructionSet and SetPipeline
Syntax
HRESULT SetFromDevice(IBlackmagicRawPipelineDevice* pipelineDevice)
Parameters
pipelineDevice in –
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when the
pipelineDevice is NULL.
Interface Reference 43
IBlackmagicRawConfigurationEx Interface
Extended Configuration for Codec Object
Related Interfaces
Interface Interface ID
IBlackmagicRaw IID_IBlackmagicRaw
Method Description
Set the current resource manager, this allows the user to provide a custom
SetResourceManager
resource manager
IBlackmagicRawConfigurationEx::GetResourceManager method
Get the current resource manager
Syntax
HRESULT GetResourceManager (IBlackmagicRawResourceManager** resourceManager)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
resourceManager is NULL.
IBlackmagicRawConfigurationEx::SetResourceManager method
Set the current resource manager, this allows the user to provide a custom resource manager
Syntax
HRESULT SetResourceManager (IBlackmagicRawResourceManager* resourceManager)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_FAIL can occur when setting the a NULL
resource manager and the default resource manager failed to create.
Interface Reference 44
IBlackmagicRawConfigurationEx::GetInstructionSet method
Get the CPU instruction set used by the decoder
Syntax
HRESULT GetInstructionSet (BlackmagicRawInstructionSet* instructionSet)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
instructionSet is NULL.
IBlackmagicRawConfigurationEx::SetInstructionSet method
Set the CPU instruction set used by the decoder
Syntax
HRESULT SetInstructionSet (BlackmagicRawInstructionSet instructionSet)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when instructionSet is
invalid. E_FAIL is returned when the system does not support the provided instruction set.
IBlackmagicRawResourceManager Interface
Using this interface the user can create their own Resource manager to allow ownership over
resource allocations. An internal resource manager that implements this is interface is provided
by default.
Method Description
Interface Reference 45
IBlackmagicRawResourceManager::CreateResource method
Called when a new resource is created
Syntax
HRESULT CreateResource (
void* context,
void* commandQueue,
uint32_t sizeBytes,
BlackmagicRawResourceType type,
BlackmagicRawResourceUsage usage,
void** resource)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when resource is NULL.
E_INVALIDARG is returned when type is invalid or does not match the current pipeline.
E_OUTOFMEMORY is returned if the allocation failed.
IBlackmagicRawResourceManager::ReleaseResource method
Release a resource
Syntax
HRESULT ReleaseResource (
void* context,
void* commandQueue,
void* resource,
BlackmagicRawResourceType type)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when type is invalid or
does not match the current pipeline. E_UNEXPECTED is returned if an unexpected error occurs.
Interface Reference 46
IBlackmagicRawResourceManager::CopyResource method
Copy a resource
Syntax
HRESULT CopyResource(
void* context,
void* commandQueue,
void* source,
BlackmagicRawResourceType sourceType,
void* destination,
BlackmagicRawResourceType destinationType,
uint32_t sizeBytes,
Boolean copyAsync)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when type is invalid or
does not match the current pipeline. E_UNEXPECTED is returned if an unexpected error occurs.
IBlackmagicRawResourceManager::GetResourceHostPointer method
Obtains a pointer to a resource’s host addressable memory
Syntax
HRESULT GetResourceHostPointer(
void* context,
void* commandQueue,
void* resource,
BlackmagicRawResourceType resourceType,
void** hostPointer)
Parameters
Interface Reference 47
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when
type is invalid or does not match the current pipeline.
IBlackmagicRawMetadataIterator Interface
Iterating metadata
Method Description
Next Step to next metadata entry, will return S_FALSE when called on last entry
IBlackmagicRawMetadataIterator::Next method
Step to next metadata entry, will return S_FALSE when called on last entry
Syntax
HRESULT Next()
Return Values
If the method succeeds, the return value is S_OK or S_FALSE. S_FALSE is returned when Next() is
called on the last element. E_FAIL is returned when Next() is called after the last element.
IBlackmagicRawMetadataIterator::GetKey method
Query key name of this metadata entry
Syntax
HRESULT GetKey (string* key)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when key is NULL, E_FAIL
is returned if the iterator has already stepped past the last element
IBlackmagicRawMetadataIterator::GetData method
Query data in this metadata entry
Syntax
HRESULT GetData (Variant data)
Parameters
Interface Reference 48
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when key is NULL, E_FAIL
is returned if the iterator has already stepped past the last element
IBlackmagicRawClipProcessingAttributes Interface
Clip Processing attributes allows the user to adjust clip-level processing attributes
Related Interfaces
Interface Interface ID
IBlackmagicRawClip IID_IBlackmagicRawClip
Method Description
IBlackmagicRawClipProcessingAttributes::GetClipAttribute method
Get the attribute
Syntax
HRESULT GetClipAttribute (
BlackmagicRawClipProcessingAttribute attribute,
Variant value)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute,
E_POINTER is returned when value is NULL.
IBlackmagicRawClipProcessingAttributes::SetClipAttribute method
Set the attribute
Syntax
HRESULT SetClipAttribute (
BlackmagicRawClipProcessingAttribute attribute,
Variant value)
Parameters
Interface Reference 49
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute or
value is invalid. When changing the Sidecar 3D LUT parameters, it’s possible to set an attribute that
is valid but incompatible with the existing state (e.g. LUT Size = 33 when the current LUT Data is for a
17x17x17 cube). In this case, the method will return S_FALSE and temporarily disable the active
sidecar LUT until a full set of valid parameters are specified.
IBlackmagicRawClipProcessingAttributes::GetPost3DLUT method
Get the active 3D LUT
Syntax
HRESULT GetPost3DLUT (IBlackmagicRawPost3DLUT** lut)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when lut is NULL.
IBlackmagicRawPost3DLUT Interface
3D Look up table (LUT) object. This object provides additional information about LUTs and gives
user the ability to control the lifetime of the resource.
Method Description
GetSize Get the size of the LUT. Eg, will return 17 for a 17x17x17 LUT.
IBlackmagicRawPost3DLUT::GetName method
Get the name of the 3D LUT
Syntax
HRESULT GetName (string* name)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when name is NULL.
Interface Reference 50
IBlackmagicRawPost3DLUT::GetTitle method
Get the title of the 3D LUT
Syntax
HRESULT GetTitle (string* title)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when title is NULL.
IBlackmagicRawPost3DLUT::GetSize method
Get the size of the LUT. Eg, will return 17 for a 17x17x17 LUT.
Syntax
HRESULT GetSize (uint32_t* size)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when size is NULL.
IBlackmagicRawPost3DLUT::GetResourceGPU method
Get pointer to GPU resource the LUT is stored in
Syntax
HRESULT GetResourceGPU (
void* context,
void* commandQueue,
BlackmagicRawResourceType* type,
void** resource)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when resource or type is
NULL. E_OUTOFMEMORY is returned when the resource is lazy created and the memory
allocation failed.
Interface Reference 51
IBlackmagicRawPost3DLUT::GetResourceCPU method
Get pointer to CPU resource the LUT is stored in
Syntax
HRESULT GetResourceCPU (void** resource)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when resource is NULL.
IBlackmagicRawPost3DLUT::GetResourceSizeBytes method
Get size of resource in bytes
Syntax
HRESULT GetResourceSizeBytes (uint32_t* sizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when sizeBytes is NULL.
IBlackmagicRawFrameProcessingAttributes Interface
Processing attributes which can change per frame
Related Interfaces
Interface Interface ID
IBlackmagicRawFrame IID_IBlackmagicRawFrame
Method Description
Interface Reference 52
IBlackmagicRawFrameProcessingAttributes::GetFrameAttribute method
Get the attribute
Syntax
HRESULT GetFrameAttribute (
BlackmagicRawFrameProcessingAttribute attribute,
Variant value)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute,
E_POINTER is returned when value is NULL.
IBlackmagicRawFrameProcessingAttributes::SetFrameAttribute method
Set the attribute
Syntax
HRESULT SetAttribute (
BlackmagicRawFrameProcessingAttribute attribute,
Variant value)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when attribute
or value is invalid.
IBlackmagicRawProcessedImage Interface
This object is created by the API and provided via a ProcessComplete() callback.
Method Description
Interface Reference 53
IBlackmagicRawProcessedImage::GetWidth method
Get the width of the processed image
Syntax
HRESULT GetWidth (uint32_t* width)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when width is NULL.
IBlackmagicRawProcessedImage::GetHeight method
Get the height of the processed image
Syntax
HRESULT GetHeight (uint32_t* height)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when height is NULL.
IBlackmagicRawProcessedImage::GetResource method
Get pointer to resource the image is stored in
Syntax
HRESULT GetResource (void** resource)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when resource is NULL.
Interface Reference 54
IBlackmagicRawProcessedImage::GetResourceType method
Get type of resource, see BlackmagicRawResourceType
Syntax
HRESULT GetResourceType (BlackmagicRawResourceType* type)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when type is NULL.
IBlackmagicRawProcessedImage::GetResourceFormat method
Get format of resource, see BlackmagicRawResourceFormat
Syntax
HRESULT GetResourceFormat (BlackmagicRawResourceFormat* format)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when format is NULL.
IBlackmagicRawProcessedImage::GetResourceSizeBytes method
Get size of resource in bytes
Syntax
HRESULT GetResourceSizeBytes (uint32_t* sizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when sizeBytes is NULL.
Interface Reference 55
I BlackmagicRawProcessedImage::GetResourceContextAndCommandQueue
method
Get context and command queue that the resource was created on
Syntax
HRESULT GetResourceContextAndCommandQueue (
void** context,void** commandQueue)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when either context or
commandQueue is NULL.
IBlackmagicRawJob Interface
This is the base object that is returned when any job is created with the SDK. Use this to control and
identify jobs when callbacks occur.
Method Description
Submit the job to the decoder. This will insert the job in the decoders
internal queue. From here the relevant callback (i.e. ProcessComplete()) will
occur as soon as the job is completed.
Submit
Note: When queuing on GPU decoders, this function will not return until the
job has been submitted to the internal GPU API. So you can use GPU
synchronization methods rather than waiting for the CPU callbacks.
Abort the job. This CAN fail if the job has already been started by the
Abort
internal decoder.
GetUserData Retrieve previously attached generic userdata from the job object
IBlackmagicRawJob::Submit method
Submit the job to the decoder. This will insert the job in the decoders internal queue. From here the
relevant callback (i.e. ProcessComplete()) will occur as soon as the job is completed.
Note: When queuing on GPU decoders, this function will not return until the job has been submitted
to the internal GPU API. So you can use GPU synchronization methods rather than waiting for the
CPU callbacks.
Syntax
HRESULT Submit()
Return Values
If the method succeeds, the return value is S_OK. E_FAIL is returned if the job has already been
started. E_OUTOFMEMORY can be returned if the operation required memory and the
allocation failed.
Interface Reference 56
IBlackmagicRawJob::Abort method
Abort the job. This CAN fail if the job has already been started by the internal decoder.
Syntax
HRESULT Abort()
Return Values
If the method succeeds, the return value is S_OK. E_FAIL is returned if the job has already been
aborted, or if the job cannot abort now (for example it may have been sent to GPU already)
IBlackmagicRawJob::SetUserData method
Attach some generic userdata to the job object/
Syntax
HRESULT SetUserData (void* userData)
Parameters
Return Values
If the method succeeds, the return value is S_OK.
IBlackmagicRawJob::GetUserData method
Retrieve previously attached generic userdata from the job object
Syntax
HRESULT GetUserData (void** userData)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when userData is NULL.
Interface Reference 57
IBlackmagicRawCallback Interface
Central callback object for entire codec. Jobs submitted to any clip created by this codec will have
their results provided through these function calls
Method Description
IBlackmagicRawCallback::ReadComplete method
Called when a read has completed
Syntax
void ReadComplete (
IBlackmagicRawJob* job, HRESULT result,
IBlackmagicRawFrame* frame)
Parameters
Interface Reference 58
IBlackmagicRawCallback::DecodeComplete method
Called when a decode has completed
Syntax
void DecodeComplete (
IBlackmagicRawJob* job, HRESULT result)
Parameters
IBlackmagicRawCallback::ProcessComplete method
Called when a process has completed
Syntax
void ProcessComplete (
IBlackmagicRawJob* job, HRESULT result,
IBlackmagicRawProcessedImage* processedImage)
Parameters
IBlackmagicRawCallback::TrimProgress method
Called as a Trim job is processed to provide status updates
Syntax
void TrimProgress (
IBlackmagicRawJob* job, float progress)
Parameters
Interface Reference 59
IBlackmagicRawCallback::TrimComplete method
Called when a trim has completed
Syntax
void TrimComplete (
IBlackmagicRawJob* job, HRESULT result)
Parameters
IBlackmagicRawCallback::SidecarMetadataParseWarning method
Called when a parse warning occured when reading a related .sidecar file.
Note: Parse warnings are not fatal, the offending line will be ignored. When SaveSidecarFile() is next
called, the offending line will be removed.
Syntax
void SidecarMetadataParseWarning (
IBlackmagicRawClip* clip,
string fileName,
uint32_t lineNumber,
string info)
Parameters
IBlackmagicRawCallback::SidecarMetadataParseError method
Called when a parse error occured when reading a related .sidecar file.
Note: If a parse error occurs, the entire file is ignored. When SaveSidecarFile() file is next called,
the entire file will be replaced.
Syntax
void SidecarMetadataParseError (
IBlackmagicRawClip* clip,
string fileName,
uint32_t lineNumber,
string info)
Parameters
Interface Reference 60
IBlackmagicRawCallback::PreparePipelineComplete method
Called when preparation of the pipeline has completed
Syntax
void PreparePipelineComplete (
void* userData, HRESULT result)
Parameters
IBlackmagicRawClipAudio Interface
Interface for accessing a clips audio.
Related Interfaces
Interface Interface ID
IBlackmagicRawClip IID_IBlackmagicRawClip
Method Description
IBlackmagicRawClipAudio::GetAudioFormat method
Get format the audio was recorded in
Syntax
HRESULT GetAudioFormat (BlackmagicRawAudioFormat* format)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when format is NULL.
Interface Reference 61
IBlackmagicRawClipAudio::GetAudioBitDepth method
Get the audio bit depth
Syntax
HRESULT GetAudioBitDepth (uint32_t* bitDepth)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when bitDepth is NULL.
E_FAIL is returned if an error occured when reading the movie.
IBlackmagicRawClipAudio::GetAudioChannelCount method
Get the audio channel count
Syntax
HRESULT GetAudioChannelCount (uint32_t* channelCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when channelCount is
NULL. E_FAIL is returned if an error occured when reading the movie.
IBlackmagicRawClipAudio::GetAudioSampleRate method
Get the audio sample rate
Syntax
HRESULT GetAudioSampleRate (uint32_t* sampleRate)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when sampleRate
is NULL, E_FAIL is returned if an error occured when reading the movie.
Interface Reference 62
IBlackmagicRawClipAudio::GetAudioSampleCount method
Get the audio sample count
Syntax
HRESULT GetAudioSampleCount (uint64_t* sampleCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when sampleCount
is NULL, E_FAIL is returned if an error occured when reading the movie.
IBlackmagicRawClipAudio::GetAudioSamples method
Get audio samples from the clip
Syntax
HRESULT GetAudioSamples (
int64_t sampleFrameIndex,
void* buffer,
uint32_t bufferSizeBytes,
uint32_t maxSampleCount,
uint32_t* samplesRead,
uint32_t* bytesRead)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when bufferOut is NULL,
E_FAIL is returned if an error occured when reading the movie.
Interface Reference 63
IBlackmagicRawFrame Interface
A frame that has been read but not yet processed. This is returned in the ReadComplete() callback.
From here the user should prepare the frame for processing, and call DecodeAndProcessFrame().
QueryInterface can return: 1. This frames FrameProcessingAttributes, modify this to change
processing attributes of this frame in the clip. 2. FrameEx
Related Interfaces
Interface Interface ID
IBlackmagicRawFrameEx IID_IBlackmagicRawFrameEx
IBlackmagicRawFrameProcessingAttributes IID_IBlackmagicRawFrameProcessingAttributes
Method Description
Create a job that will decode and process our image. When
CreateJobDecodeAndProcessFrame
completed we will receive a ProcessComplete() callback
Interface Reference 64
IBlackmagicRawFrame::GetFrameIndex method
Get the frameIndex
Syntax
HRESULT GetFrameIndex (uint64_t* frameIndex)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when frameIndex is NULL.
IBlackmagicRawFrame::GetTimecode method
Get a formatted timecode for this frame
Syntax
HRESULT GetTimecode (string* timecode)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when timecode is NULL.
E_UNEXPECTED is returned if an unexpected error occurs.
IBlackmagicRawFrame::GetMetadataIterator method
Create a medatadata iterator to iterate through the metadata in this frame
Syntax
HRESULT GetMetadataIterator (IBlackmagicRawMetadataIterator** iterator)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when iterator is NULL.
E_FAIL can occur if the iterator failed to create.
Interface Reference 65
IBlackmagicRawFrame::GetMetadata method
Query a single frame metadata value defined by key
Syntax
HRESULT GetMetadata (
string key, Variant value)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when key is invalid.
E_POINTER is returned when value is NULL.
IBlackmagicRawFrame::SetMetadata method
Set metadata to this frame, this data is not saved to disk until
IBlackmagicRawClip::SaveSidecar() is called.
Syntax
HRESULT SetMetadata (
string key, Variant value)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when key is invalid
or value is of incorrect type. E_FAIL is returned if the metadata failed to write.
IBlackmagicRawFrame::CloneFrameProcessingAttributes method
Clone this frame’s FrameProcessingAttributes into another copy. From here the returned
FrameProcessingAttributes can be modified, and then provided to DecodeAndProcess() allowing
the user to decode the frame with different processing attributes than specified in the clip. This is
useful when the user wishes to preview different processing attributes.
Syntax
HRESULT CloneFrameProcessingAttributes (
IBlackmagicRawFrameProcessingAttributes**
frameProcessingAttributes)
Parameters
Interface Reference 66
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
frameProcessingAttributes is NULL. E_FAIL can occur if the object failed to create.
IBlackmagicRawFrame::SetResolutionScale method
Set the resolution scale we want to decode this image to. This can be used to enchance turn-around
time when working on the project
Syntax
HRESULT SetResolutionScale (BlackmagicRawResolutionScale resolutionScale)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when gamut is invalid.
IBlackmagicRawFrame::GetResolutionScale method
Get the resolution scale set to the frame
Syntax
HRESULT GetResolutionScale (BlackmagicRawResolutionScale* resolutionScale)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
resolutionScale is NULL.
IBlackmagicRawFrame::SetResourceFormat method
Set the desired resource format that we want to processing this frame in to
Syntax
HRESULT SetResourceFormat (BlackmagicRawResourceFormat resourceFormat)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when resourceFormat
is invalid.
Interface Reference 67
IBlackmagicRawFrame::GetResourceFormat method
Get the resource format this frame will be processed in to
Syntax
HRESULT GetResourceFormat (BlackmagicRawResourceFormat* resourceFormat)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
resourceFormat is NULL.
IBlackmagicRawFrame::CreateJobDecodeAndProcessFrame method
Create a job that will decode and process our image. When completed we will receive
a ProcessComplete() callback
Syntax
HRESULT CreateJobDecodeAndProcessFrame (
IBlackmagicRawClipProcessingAttributes*
clipProcessingAttributes,
IBlackmagicRawFrameProcessingAttributes*
frameProcessingAttributes,
IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL. E_
INVALIDARG is returned if SetCallback() hasn’t been called on the related BlackmagicRaw object.
E_FAIL can occur if the decoder failed to start or the job failed to create.
Interface Reference 68
IBlackmagicRawFrameEx Interface
Query additional information for the frame. This information is useful when decoding via the
manual decoders.
Related Interfaces
Interface Interface ID
IBlackmagicRawFrame IID_IBlackmagicRawFrame
Method Description
IBlackmagicRawFrameEx::GetBitStreamSizeBytes method
Get the frames bistream size in bytes we’ve read off disk.
Syntax
HRESULT GetBitStreamSizeBytes (uint32_t* bitStreamSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
bitStreamSizeBytes is NULL.
IBlackmagicRawFrameEx::GetProcessedImageResolution method
Query what the resolution of the processed image will be given the input resolution and the
ResolutionScale applied
Syntax
HRESULT GetProcessedImageResolution (
uint32_t* width,
uint32_t* height)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when width or
height is NULL.
Interface Reference 69
IBlackmagicRawManualDecoderFlow1 Interface
Manual decoders give you more control over which buffers are used and how things are queued.
IBlackmagicRawManualDecoderFlow1 is a pure-CPU solution.
Related Interfaces
Interface Interface ID
IBlackmagicRaw IID_IBlackmagicRaw
Method Description
IBlackmagicRawManualDecoderFlow1::PopulateFrameStateBuffer method
The manual decoders work with data blobs rather than API objects. This allows the user to transfer
the data blob to another codec instance or potentially another computer for processing. This
function converts the internal state of IBlackmagicRawFrame to frame state buffer, which is used to
perform the decode
Syntax
HRESULT PopulateFrameStateBuffer (
IBlackmagicRawFrame* frame,
IBlackmagicRawClipProcessingAttributes*
clipProcessingAttributes,
IBlackmagicRawFrameProcessingAttributes*
frameProcessingAttributes,
void* frameState,
uint32_t frameStateSizeBytes)
Interface Reference 70
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when frameState is
NULL. E_INVALIDARG is returned when frame is NULL or frameStateBufferSizeBytes is too small.
IBlackmagicRawManualDecoderFlow1::GetFrameStateSizeBytes method
Query the same of the FrameState buffer in bytes
Syntax
HRESULT GetFrameStateSizeBytes (uint32_t* frameStateSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
frameStateSizeBytes is NULL.
IBlackmagicRawManualDecoderFlow1::GetDecodedSizeBytes method
Query the size of the decoded buffer
Syntax
HRESULT GetDecodedSizeBytes (
void* frameStateBufferCPU,
uint32_t* decodedSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when decodedSizeBytes
is NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
Interface Reference 71
IBlackmagicRawManualDecoderFlow1::GetProcessedSizeBytes method
Query the size of the processed buffer
Syntax
HRESULT GetProcessedSizeBytes (
void* frameStateBufferCPU,
uint32_t* processedSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
processedSizeBytes is NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
IBlackmagicRawManualDecoderFlow1::GetPost3DLUTSizeBytes method
Query the size of the post 3D LUT buffer
Syntax
HRESULT GetPost3DLUTSizeBytes (
void* frameStateBufferCPU,
uint32_t* post3DLUTSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
processedSizeBytes is NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
Interface Reference 72
IBlackmagicRawManualDecoderFlow1::CreateJobDecode method
Create a job to decode a frame. After this decode is complete the decoded buffer will need to be
processed to get final result. This decode completion will be notified via the
OnDecodeComplete() callback
Syntax
HRESULT CreateJobDecode (
void* frameStateBufferCPU, void* bitStreamBufferCPU,
void* decodedBufferCPU, IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL.
E_INVALIDARG is returned if frameStateBufferCPU, bitStreamBufferCPU or decodedBufferCPU is
invalid. E_INVALIDARG can also be returned if SetCallback() hasn’t been called on the related
BlackmagicRaw object. E_FAIL can occur if the decoder failed to start or the job failed to create.
IBlackmagicRawManualDecoderFlow1::CreateJobProcess method
Create a job to process a frame. After this process is complete a final processed image will
be provided via a OnProcessComplete() callback
Syntax
HRESULT CreateJobProcess (
void* frameStateBufferCPU, void* decodedBufferCPU,
void* processedBufferCPU, IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL.
E_INVALIDARG is returned if frameStateBufferCPU, decodedBufferCPU or processedBufferCPU is
invalid. E_INVALIDARG can also be returned if SetCallback() hasn’t been called on the related
BlackmagicRaw object. E_FAIL can occur if the decoder failed to start or the job failed to create.
Interface Reference 73
IBlackmagicRawManualDecoderFlow2 Interface
Manual decoders give you more control over which buffers are used and how things are queued.
IBlackmagicRawManualDecoderFlow2 is a hybrid CPU/GPU solution. This will likely be faster than
Flow1, however it will depend on the GPU in the users system.
Related Interfaces
Interface Interface ID
IBlackmagicRaw IID_IBlackmagicRaw
Method Description
Interface Reference 74
IBlackmagicRawManualDecoderFlow2::PopulateFrameStateBuffer method
The manual decoders work with data blobs rather than API objects. This allows the user to transfer
the data blob to another codec instance or potentially another computer for processing. This
function converts the internal state of IBlackmagicRawFrame to frame state buffer, which is used to
perform the decode
Syntax
HRESULT PopulateFrameStateBuffer
(IBlackmagicRawFrame* frame,
IBlackmagicRawClipProcessingAttributes*
clipProcessingAttributes,
IBlackmagicRawFrameProcessingAttributes*
frameProcessingAttributes,
void* frameState,
uint32_t frameStateSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when frameState is NULL.
E_INVALIDARG is returned when frame is NULL or frameStateBufferSizeBytes is too small.
IBlackmagicRawManualDecoderFlow2::GetFrameStateSizeBytes method
Query the same of the FrameState buffer in bytes
Syntax
HRESULT GetFrameStateSizeBytes (uint32_t* frameStateSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
frameStateSizeBytes is NULL.
Interface Reference 75
IBlackmagicRawManualDecoderFlow2::GetDecodedSizeBytes method
Query the size of the decoded buffer
Syntax
HRESULT GetDecodedSizeBytes
(void* frameStateBufferCPU, uint32_t* decodedSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when decodedSizeBytes
is NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
IBlackmagicRawManualDecoderFlow2::GetWorkingSizeBytes method
Query the size of the working buffer
Syntax
HRESULT GetWorkingSizeBytes (
void* frameStateBufferCPU, uint32_t* workingSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when workingSizeBytes is
NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
IBlackmagicRawManualDecoderFlow2::GetProcessedSizeBytes method
Query the size of the processed buffer
Syntax
HRESULT GetProcessedSizeBytes (
void* frameStateBufferCPU,
uint32_t* processedSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
processedSizeBytes is NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
Interface Reference 76
IBlackmagicRawManualDecoderFlow2::GetPost3DLUTSizeBytes method
Query the size of the post 3D LUT buffer
Syntax
HRESULT GetPost3DLUTSizeBytes (
void* frameStateBufferCPU,uint32_t* post3DLUTSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
processedSizeBytes is NULL. E_INVALIDARG is returned when frameStateBufferCPU is invalid
IBlackmagicRawManualDecoderFlow2::CreateJobDecode method
Create a job to decode a frame. This is performed on CPU. After this decode is complete the
decoded buffer will need to be processed to get final result. This decode completion will be notified
via the OnDecodeComplete() callback
Syntax
HRESULT CreateJobDecode (
void* frameStateBufferCPU,
void* bitStreamBufferCPU,
void* decodedBufferCPU,
IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL.
E_INVALIDARG is returned if frameStateBufferCPU, bitStreamBufferCPU or decodedBufferCPU is
invalid. E_INVALIDARG can also be returned if SetCallback() hasn’t been called on the related
BlackmagicRaw object. E_FAIL can occur if the decoder failed to start or the job failed to create.
Interface Reference 77
IBlackmagicRawManualDecoderFlow2::CreateJobProcess method
Create a job to process a frame. This is performed on the specified GPU. After this process is
complete a final processed image will be provided via a OnProcessComplete() callback
Syntax
HRESULT CreateJobProcess (
void* context,
void* commandQueue,
void* frameStateBufferCPU,
void* decodedBufferGPU,
void* workingBufferGPU,
void* processedBufferGPU,
IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL.
E_INVALIDARG is returned if context, commandQueue, frameStateBufferCPU, decodedBufferGPU,
workingBufferGPU or processedBufferGPU is invalid. E_INVALIDARG can also be returned if
SetCallback() hasn’t been called on the related BlackmagicRaw object. E_FAIL can occur if the
decoder failed to start or the job failed to create.
Interface Reference 78
IBlackmagicRawClip Interface
Clip object, created by calling IBlackmagicRaw::OpenClip()
Related Interfaces
Interface Interface ID
IBlackmagicRawClipEx IID_IBlackmagicRawClipEx
IBlackmagicRawClipAudio IID_IBlackmagicRawClipAudio
IBlackmagicRawClipProcessingAttributes IID_IBlackmagicRawClipProcessingAttributes
Method Description
GetMetadataIterator Create a medatadata iterator to iterate through the metadata in this clip
Set metadata to this clip, this data is not saved to disk until
SetMetadata
IBlackmagicRawClip::SaveSidecar() is called
GetMulticardFileCount Queries how many cards this movie was originally recorded on to
Queries if a particular card file from the original recording are present. If
IsMulticardFilePresent
files are missing the movie will still play back, just at a lower framerate
This will save all set metadata and processing attributes to the .sidecar
SaveSidecarFile file on disk. From here the clip can be safely closed and data will be
preserved
Reload the .sidecar file, this will replace all previously non-saved
ReloadSidecarFile
metadata and processing attributes with the contents of the .sidecar file
Create a job that will read the frames bitstream into memory. When
CreateJobReadFrame
completed we will receive a ReadComplete() callback
A trim will export part of the clip with the .sidecar file baked in to a new
CreateJobTrim .braw file. This is an asynchronous job and can take some time
depending on the length of the trim
Interface Reference 79
IBlackmagicRawClip::GetWidth method
Get the width of the clip
Syntax
HRESULT GetWidth (uint32_t* width)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when width is NULL.
IBlackmagicRawClip::GetHeight method
Get the height of the clip
Syntax
HRESULT GetHeight (uint32_t* height)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when height is NULL.
IBlackmagicRawClip::GetFrameRate method
Get the frame rate of the clip
Syntax
HRESULT GetFrameRate (float* frameRate)
Parameters
frameRate out Returns the frame rate of the clip, in frames per second
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when frameRate is NULL.
E_FAIL is returned if an error occured when reading the movie.
Interface Reference 80
IBlackmagicRawClip::GetFrameCount method
Get the frame count in the clip
Syntax
HRESULT GetFrameCount (uint64_t* frameCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when frameCount is NULL.
IBlackmagicRawClip::GetTimecodeForFrame method
Get the timecode for the specified frame
Syntax
HRESULT GetTimecodeForFrame
(uint64_t frameIndex, string* timecode)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when frameIndex is
out of range. E_POINTER is returned when timecode is NULL.
IBlackmagicRawClip::GetMetadataIterator method
Create a medatadata iterator to iterate through the metadata in this clip
Syntax
HRESULT GetMetadataIterator (IBlackmagicRawMetadataIterator** iterator)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when iterator is NULL.
E_FAIL can occur if the iterator failed to create.
Interface Reference 81
IBlackmagicRawClip::GetMetadata method
Query a single clip metadata value defined by key
Syntax
HRESULT GetMetadata
(string key, Variant value)
Parameters
value out Returned value of clip metadata entry at the provided key
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when key is invalid.
E_POINTER is returned when value is NULL.
IBlackmagicRawClip::SetMetadata method
Set metadata to this clip, this data is not saved to disk until
IBlackmagicRawClip::SaveSidecar() is called
Syntax
HRESULT SetMetadata
(string key, Variant value)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_INVALIDARG is returned when key is invalid or
value is of incorrect type. E_FAIL is returned if the metadata failed to write.
IBlackmagicRawClip::GetCameraType method
Get the camera type that this clip was recorded on
Syntax
HRESULT GetCameraType (string* cameraType)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
cameraType is NULL.
Interface Reference 82
IBlackmagicRawClip::CloneClipProcessingAttributes method
Clone this clip’s ClipProcessingAttributes into another copy. From here the returned
ClipProcessingAttributes can be modified, and then provided to DecodeAndProcess() allowing the
user to decode the frame with different processing attributes than specified in the clip. This is useful
when the user wishes to preview different processing attributes.
Syntax
HRESULT CloneClipProcessingAttributes
(IBlackmagicRawClipProcessingAttributes** clipProcessingAttributes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
clipProcessingAttributes is NULL. E_FAIL can occur if the object failed to create.
IBlackmagicRawClip::GetMulticardFileCount method
Queries how many cards this movie was originally recorded on to
Syntax
HRESULT GetMulticardFileCount (uint32_t* multicardFileCount)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
multicardFileCount is NULL.
IBlackmagicRawClip::IsMulticardFilePresent method
Queries if a particular card file from the original recording are present. If files are missing the movie
will still play back, just at a lower framerate
Syntax
HRESULT IsMulticardFilePresent (
uint32_t index,
Boolean* isMulticardFilePresent)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
isMulticardFilePresent is NULL.
Interface Reference 83
IBlackmagicRawClip::GetSidecarFileAttached method
Returns if a relevant .sidecar file was present on disk
Syntax
HRESULT GetSidecarFileAttached (Boolean* isSidecarFileAttached)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
isSidecarFileAttached is NULL.
IBlackmagicRawClip::SaveSidecarFile method
This will save all set metadata and processing attributes to the .sidecar file on disk. From here the
clip can be safely closed and data will be preserved
Syntax
HRESULT SaveSidecarFile()
Return Values
If the method succeeds, the return value is S_OK. E_FAIL is returned if the save operation failed.
IBlackmagicRawClip::ReloadSidecarFile method
Reload the .sidecar file, this will replace all previously non-saved metadata and processing attributes
with the contents of the .sidecar file
Syntax
HRESULT ReloadSidecarFile()
Return Values
If the method succeeds, the return value is S_OK. E_FAIL is returned if the load operation failed.
Interface Reference 84
IBlackmagicRawClip::CreateJobReadFrame method
Create a job that will read the frames bitstream into memory. When completed we will receive
a ReadComplete() callback
Syntax
HRESULT CreateJobReadFrame (
uint64_t frameIndex, IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL.
E_INVALIDARG is returned if frameIndex is out of range or SetCallback() hasn’t been called on the
related BlackmagicRaw object. E_FAIL can occur if the job failed to create.
IBlackmagicRawClip::CreateJobTrim method
A trim will export part of the clip with the .sidecar file baked in to a new .braw file. This is an
asynchronous job and can take some time depending on the length of the trim
Syntax
HRESULT CreateJobTrim (
string fileName,
uint64_t frameIndex,
uint64_t frameCount,
IBlackmagicRawClipProcessingAttributes*
clipProcessingAttributes,
IBlackmagicRawFrameProcessingAttributes*
frameProcessingAttributes,
IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when job is NULL. E_
INVALIDARG is returned if SetCallback() hasn’t been called on the related BlackmagicRaw object.
E_FAIL can occur if the job failed to create.
Interface Reference 85
IBlackmagicRawClipEx Interface
Extended use of IBlackmagicRawClip, to pass custom bitstream
Related Interfaces
Interface Interface ID
IBlackmagicRawClip IID_IBlackmagicRawClip
Method Description
IBlackmagicRawClipEx::GetMaxBitStreamSizeBytes method
Inspects all frames in the movie and will return the maximum bit stream size encountered.
Syntax
HRESULT GetMaxBitStreamSizeBytes (uint32_t* maxBitStreamSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when
maxBitStreamSizeBytes is NULL.
Interface Reference 86
IBlackmagicRawClipEx::GetBitStreamSizeBytes method
Returns the bitsream size for the provided frame
Syntax
HRESULT GetBitStreamSizeBytes (
uint64_t frameIndex,
uint32_t* bitStreamSizeBytes)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when bitStreamSizeBytes
is NULL. E_INVALIDARG is returned when frameIndex is invalid. E_FAIL is returned if an error
occured when reading the movie.
IBlackmagicRawClipEx::CreateJobReadFrame method
Create a job that will read the frames bitstream into memory. When completed we will receive
a ReadComplete() callback. This extended variation allows the user to control exactly where
the bistream is stored in memory.
Syntax
HRESULT CreateJobReadFrame (
uint64_t frameIndex,
void* bitStream,
uint32_t bitStreamSizeBytes,
IBlackmagicRawJob** job)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when bitStream or job is
NULL. E_INVALIDARG is returned if frameIndex is out of range or bitStreamSizeBytes is 0.
E_INVALIDARG is also returned if SetCallback() hasn’t been called on the related BlackmagicRaw
object. E_FAIL can occur if the job failed to create.
Interface Reference 87
IBlackmagicRawClipEx::QueryTimecodeInfo method
Queries the timecode info for the clip. This information can be used to externally calculate valid
timecodes from a frameIndex. Alternatively you can call IBlackmagicRawFrame::GetTimecode() on a
frame object
Syntax
HRESULT QueryTimecodeInfo (
uint32_t* baseFrameIndex,
Boolean* isDropFrameTimecode)
Parameters
Return Values
If the method succeeds, the return value is S_OK. E_POINTER is returned when baseFrameIndex or
isDropFrameTimecode is NULL. E_FAIL is returned if an error occured when reading the movie.
Interface Reference 88