AEJoy —— AE 插件开发中的 命令选择器(三) 正文

「这是我参与11月更文挑战的第 23 天,活动详情查看:2021最后一次更文挑战」。

参加该活动的第 40 篇文章

正文

帧选择器

为插件渲染的每一帧(或一组音频采样)传递。

PF_Cmd_FRAME_SETUP

分配任何帧特定的数据。这是在每一帧渲染之前立即发送的,以允许帧特定的设置(setup)数据。如果您的效果改变了其输出缓冲区的大小,请指定新的输出高度、宽度和相对原点。除了输入层之外的所有参数都是有效的。如果你设置宽度和高度为 0 , After Effects 将忽略你对以下 PF_Cmd_RENDER 的响应。注意:如果设置了PF_Outflag_I_EXPAND_BUFFER,你将接收这个选择器(还有 PF_Cmd_FRAME_SETDOWN*) 两次,一旦在它们之间没有 *PF_Cmd_RENDER 的话。这样我们就可以知道给定的图层是否可见。帧数据可以追溯到机器有 8 MB RAM 的时候。考虑到调用序列(上面),仅在 PF_Cmd_RENDER 期间分配要高效得多。

PF_Cmd_RENDER

根据输入帧和任何参数将效果渲染到输出中。这个渲染调用只能支持 8 位或 16 位每通道渲染。32 位每通道渲染必须PF_Cmd_SMART_RENDER 中处理。PF_InData 中的所有字段都是有效的。如果您对该选择器的响应被中断(您对 PF_ABORTPF_PROGRESS 的调用返回一个错误代码),您的结果将不会被使用。你不能在这个选择器中删除 frame_data ; 你必须等待直到PF_Cmd_FRAME_SETDOWN

PF_Cmd_FRAME_SETDOWN

释放任何在 PF_Cmd_FRAME_SETUP 期间分配的帧数据

PF_Cmd_AUDIO_SETUP

在每个音频渲染之前发送。请求输入音频的时间跨度(time span)。分配和初始化任何特定序列的数据。如果您的效果需要来自时间跨度的输入而不是输出时间跨度,那么请更新 PF_OutData 中的 startsampLendsampL 字段。

PF_Cmd_AUDIO_RENDER

用效果处理过的音频填充PF_OutData.dest_snd。PF_InData 中的所有字段都是有效的。如果你对这个选择器的响应被中断(你对 PF_ABORTPF_PROGRESS 的调用会返回一个错误代码),你的结果将不会被使用。

PF_Cmd_AUDIO_SETDOWN

释放 PF_Cmd_AUDIO_SETUP 期间分配的内存。

PF_Cmd_SMART_PRE_RENDER

仅限于 SmartFX。根据 effect 实现的任何标准,确定 effect 所需要产生其输出的输入区域

可能在 MediaCore 托管时发送两次*。第一个将在 *GetFrameDependencies 期间收集输入。

源检出可以在这里返回完整的帧尺寸。一旦渲染了源,如果它们的大小与第一次调用不同,那么这个选择器将使用实际的源大小第二次发出,以获得正确的输出大小。

注意,MediaCore 需要所有的输出,因此将使用 PF_PreRenderOutput::max_result_rect

16.0 的新特性

PF_PreRenderOutput 中将 PF_RenderOutputFlag_GPU_RENDER_POSSIBLE 设置为 GPU 渲染。

如果没有设置此标志,则由于参数或渲染设置的原因,请求的渲染无法使用所请求的 GPU 。

主机可能会使用另一个 what_gpu 选项(或 PF_GPU_Framework_None )来重新调用 PreRender

1
2
3
4
5
6
7
8
cpp复制代码typedef struct
{
PF_RenderRequest output_request; // 被要求渲染的效果
short bitdepth; // 正被驱动的效果(在 bpc 中的)位深
const void *gpu_data; // (new AE 16.0)
PF_GPU_Framework what_gpu; // (new AE 16.0)
A_u_long device_index; // (new AE 16.0) 和 PrSDKGPUDeviceSuite 配合使用
} PF_PreRenderInput;

PF_Cmd_SMART_RENDER

仅限 SmartFX。执行渲染并为 effect 被要求渲染的区域提供输出。

Frame Selectors

Passed for each frame (or set of audio samples) to be rendered by your plug-in.

PF_Cmd_FRAME_SETUP

Allocate any frame-specific data. This is sent immediately before each frame is rendered, to allow for frame-specific setup data. If your effect changes the size of its output buffer, specify the new output height, width, and relative origin. All parameters except the input layer are valid.If you set width and height to 0, After Effects ignores your response to the following PF_Cmd_RENDER.NOTE: If PF_Outflag_I_EXPAND_BUFFER is set, you will receive this selector (and PF_Cmd_FRAME_SETDOWN) twice, once without PF_Cmd_RENDER between them.This is so we know whether or not the given layer will be visible.Frame data dates from the days when machines might have 8MB of RAM. Given the calling sequence (above), it’s much more efficient to just allocate during PF_Cmd_RENDER.

PF_Cmd_RENDER

Render the effect into the output, based on the input frame and any parameters.This render call can only support 8-bit or 16-bit per channel rendering. 32-bit per channel rendering must be handled in PF_Cmd_SMART_RENDER.All fields in PF_InData are valid.If your response to this selector is interrupted (your calls to PF_ABORT or PF_PROGRESS returns an error code), your results will not be used.You cannot delete frame_data during this selector; you must wait until PF_Cmd_FRAME_SETDOWN.

PF_Cmd_FRAME_SETDOWN

Free any frame data allocated during PF_Cmd_FRAME_SETUP.

PF_Cmd_AUDIO_SETUP

Sent before every audio render. Request a time span of input audio. Allocate and initialize any sequence-specific data.If your effect requires input from a time span other than the output time span, update the startsampL and endsampL field in PF_OutData.

PF_Cmd_AUDIO_RENDER

Populate PF_OutData.dest_snd with effect-ed audio. All fields in PF_InData are valid.If your response to this selector is interrupted (your calls to PF_ABORT or PF_PROGRESS returns an error code), your results will not be used.

PF_Cmd_AUDIO_SETDOWN

Free memory allocated during PF_Cmd_AUDIO_SETUP.

PF_Cmd_SMART_PRE_RENDER

SmartFX only. Identify the area(s) of input the effect will need to produce its output, based on whatever criteria the effect implements.maybe sent up to twice when MediaCore is hosting. The first will come during GetFrameDependencies to collect the inputs.The source checkouts can return full frame dimensions here. Once the sources are rendered, if they are different in size than the first call then this selector will be emitted a second time with the actual source sizes in order to get a correct output size.Note that MediaCore wants all of the output, so PF_PreRenderOutput::max_result_rect will be used.New in 16.0Set PF_RenderOutputFlag_GPU_RENDER_POSSIBLE in PF_PreRenderOutput to render on the GPU.If this flag is not set the requested render is not possible with the requested GPU, because of parameters or render settings.The host may re-call PreRender with another what_gpu option (or PF_GPU_Framework_None).

1
2
3
4
5
6
7
8
9
10
> cpp复制代码typedef struct
> {
> PF_RenderRequest output_request; // what the effect is being asked to render
> short bitdepth; // bitdepth the effect is being driven in (in bpc)
> const void *gpu_data; // (new AE 16.0)
> PF_GPU_Framework what_gpu; // (new AE 16.0)
> A_u_long device_index; // (new AE 16.0) For use in conjunction with PrSDKGPUDeviceSuite
> } PF_PreRenderInput;
>
>

PF_Cmd_SMART_RENDER

SmartFX only. Perform rendering and provide output for the area(s) the effect was asked to render.

本文转载自: 掘金

开发者博客 – 和开发相关的 这里全都有

0%