|
|
|
@ -52,7 +52,7 @@ Buffer references ownership and permissions |
|
|
|
|
point to only a part of a video buffer. |
|
|
|
|
|
|
|
|
|
A reference is usually obtained as input to the start_frame or |
|
|
|
|
filter_samples method or requested using the ff_get_video_buffer or |
|
|
|
|
filter_frame method or requested using the ff_get_video_buffer or |
|
|
|
|
ff_get_audio_buffer functions. A new reference on an existing buffer can |
|
|
|
|
be created with the avfilter_ref_buffer. A reference is destroyed using |
|
|
|
|
the avfilter_unref_bufferp function. |
|
|
|
@ -68,14 +68,14 @@ Buffer references ownership and permissions |
|
|
|
|
|
|
|
|
|
Here are the (fairly obvious) rules for reference ownership: |
|
|
|
|
|
|
|
|
|
* A reference received by the start_frame or filter_samples method |
|
|
|
|
* A reference received by the start_frame or filter_frame method |
|
|
|
|
belong to the corresponding filter. |
|
|
|
|
|
|
|
|
|
Special exception: for video references: the reference may be used |
|
|
|
|
internally for automatic copying and must not be destroyed before |
|
|
|
|
end_frame; it can be given away to ff_start_frame. |
|
|
|
|
|
|
|
|
|
* A reference passed to ff_start_frame or ff_filter_samples is given |
|
|
|
|
* A reference passed to ff_start_frame or ff_filter_frame is given |
|
|
|
|
away and must no longer be used. |
|
|
|
|
|
|
|
|
|
* A reference created with avfilter_ref_buffer belongs to the code that |
|
|
|
@ -93,16 +93,16 @@ Buffer references ownership and permissions |
|
|
|
|
The AVFilterLink structure has a few AVFilterBufferRef fields. Here are |
|
|
|
|
the rules to handle them: |
|
|
|
|
|
|
|
|
|
* cur_buf is set before the start_frame and filter_samples methods to |
|
|
|
|
* cur_buf is set before the start_frame and filter_frame methods to |
|
|
|
|
the same reference given as argument to the methods and belongs to the |
|
|
|
|
destination filter of the link. If it has not been cleared after |
|
|
|
|
end_frame or filter_samples, libavfilter will automatically destroy |
|
|
|
|
end_frame or filter_frame, libavfilter will automatically destroy |
|
|
|
|
the reference; therefore, any filter that needs to keep the reference |
|
|
|
|
for longer must set cur_buf to NULL. |
|
|
|
|
|
|
|
|
|
* out_buf belongs to the source filter of the link and can be used to |
|
|
|
|
store a reference to the buffer that has been sent to the destination. |
|
|
|
|
If it is not NULL after end_frame or filter_samples, libavfilter will |
|
|
|
|
If it is not NULL after end_frame or filter_frame, libavfilter will |
|
|
|
|
automatically destroy the reference. |
|
|
|
|
|
|
|
|
|
If a video input pad does not have a start_frame method, the default |
|
|
|
@ -179,7 +179,7 @@ Buffer references ownership and permissions |
|
|
|
|
with the WRITE permission. |
|
|
|
|
|
|
|
|
|
* Filters that intend to keep a reference after the filtering process |
|
|
|
|
is finished (after end_frame or filter_samples returns) must have the |
|
|
|
|
is finished (after end_frame or filter_frame returns) must have the |
|
|
|
|
PRESERVE permission on it and remove the WRITE permission if they |
|
|
|
|
create a new reference to give it away. |
|
|
|
|
|
|
|
|
@ -198,7 +198,7 @@ Frame scheduling |
|
|
|
|
Simple filters that output one frame for each input frame should not have |
|
|
|
|
to worry about it. |
|
|
|
|
|
|
|
|
|
start_frame / filter_samples |
|
|
|
|
start_frame / filter_frame |
|
|
|
|
---------------------------- |
|
|
|
|
|
|
|
|
|
These methods are called when a frame is pushed to the filter's input. |
|
|
|
@ -233,7 +233,7 @@ Frame scheduling |
|
|
|
|
|
|
|
|
|
This method is called when a frame is wanted on an output. |
|
|
|
|
|
|
|
|
|
For an input, it should directly call start_frame or filter_samples on |
|
|
|
|
For an input, it should directly call start_frame or filter_frame on |
|
|
|
|
the corresponding output. |
|
|
|
|
|
|
|
|
|
For a filter, if there are queued frames already ready, one of these |
|
|
|
@ -266,4 +266,4 @@ Frame scheduling |
|
|
|
|
|
|
|
|
|
Note that, except for filters that can have queued frames, request_frame |
|
|
|
|
does not push frames: it requests them to its input, and as a reaction, |
|
|
|
|
the start_frame / filter_samples method will be called and do the work. |
|
|
|
|
the start_frame / filter_frame method will be called and do the work. |
|
|
|
|