23 #include "libavutil/channel_layout.h"
24 #include "libavutil/avassert.h"
25 #include "libavutil/common.h"
26 #include "libavutil/imgutils.h"
27 #include "libavcodec/avcodec.h"
35 #if FF_API_AVFILTERBUFFER
36 void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
38 if (ptr->extended_data != ptr->data)
44 static void copy_video_props(AVFilterBufferRefVideoProps *dst, AVFilterBufferRefVideoProps *
src) {
47 int qsize = src->qp_table_size;
49 memcpy(dst->qp_table, src->qp_table, qsize);
53 AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref,
int pmask)
55 AVFilterBufferRef *
ret =
av_malloc(
sizeof(AVFilterBufferRef));
64 ret->video =
av_malloc(
sizeof(AVFilterBufferRefVideoProps));
69 copy_video_props(ret->video, ref->video);
70 ret->extended_data = ret->data;
72 ret->audio =
av_malloc(
sizeof(AVFilterBufferRefAudioProps));
77 *ret->audio = *ref->audio;
79 if (ref->extended_data && ref->extended_data != ref->data) {
81 if (!(ret->extended_data =
av_malloc(
sizeof(*ret->extended_data) *
87 memcpy(ret->extended_data, ref->extended_data,
88 sizeof(*ret->extended_data) * nb_channels);
90 ret->extended_data = ret->data;
93 ret->buf->refcount ++;
97 void avfilter_unref_buffer(AVFilterBufferRef *ref)
102 if (!(--ref->buf->refcount))
103 ref->buf->free(ref->buf);
104 if (ref->extended_data != ref->data)
114 void avfilter_unref_bufferp(AVFilterBufferRef **ref)
116 avfilter_unref_buffer(*ref);
120 int avfilter_copy_frame_props(AVFilterBufferRef *dst,
const AVFrame *src)
124 dst->format = src->
format;
131 dst->video->w = src->
width;
132 dst->video->h = src->
height;
150 void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
158 if (dst->video->qp_table)
160 copy_video_props(dst->video, src->video);
This structure describes decoded (raw) audio or video data.
Libavfilter version macros.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
libavcodec/libavfilter gluing utilities
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
int interlaced_frame
The content of the picture is interlaced.
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int width
width and height of the video frame
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void av_dict_free(AVDictionary **m)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
uint64_t channel_layout
Channel layout of the audio data.
enum AVPictureType pict_type
Picture type of the frame.
AVDictionary * av_frame_get_metadata(const AVFrame *frame)
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
Main libavfilter public API header.
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
int sample_rate
Sample rate of the audio data.
int top_field_first
If the content is interlaced, is top field displayed first.
int key_frame
1 -> keyframe, 0-> not
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t av_frame_get_pkt_pos(const AVFrame *frame)