27 #include "libavutil/avassert.h"
28 #include "libavutil/channel_layout.h"
29 #include "libavutil/opt.h"
31 #if FF_API_AVFILTERBUFFER
32 AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(
const AVFrame *
frame,
35 AVFilterBufferRef *picref =
41 if (avfilter_copy_frame_props(picref, frame) < 0) {
42 picref->buf->data[0] = NULL;
43 avfilter_unref_bufferp(&picref);
48 AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(
const AVFrame *frame,
51 AVFilterBufferRef *samplesref;
56 av_log(0,
AV_LOG_ERROR,
"Layout indicates a different number of channels than actually present\n");
60 samplesref = avfilter_get_audio_buffer_ref_from_arrays_channels(
65 if (avfilter_copy_frame_props(samplesref, frame) < 0) {
66 samplesref->buf->data[0] = NULL;
67 avfilter_unref_bufferp(&samplesref);
72 AVFilterBufferRef *avfilter_get_buffer_ref_from_frame(
enum AVMediaType type,
78 return avfilter_get_video_buffer_ref_from_frame(frame, perms);
80 return avfilter_get_audio_buffer_ref_from_frame(frame, perms);
86 int avfilter_copy_buf_props(
AVFrame *dst,
const AVFilterBufferRef *
src)
95 memcpy(dst->
data, src->data,
sizeof(dst->
data));
105 dst->
width = src->video->w;
106 dst->
height = src->video->h;
139 #if FF_API_FILL_FRAME
140 int avfilter_fill_frame_from_audio_buffer_ref(
AVFrame *frame,
141 const AVFilterBufferRef *samplesref)
143 return avfilter_copy_buf_props(frame, samplesref);
146 int avfilter_fill_frame_from_video_buffer_ref(
AVFrame *frame,
147 const AVFilterBufferRef *picref)
149 return avfilter_copy_buf_props(frame, picref);
152 int avfilter_fill_frame_from_buffer_ref(
AVFrame *frame,
153 const AVFilterBufferRef *ref)
155 return avfilter_copy_buf_props(frame, ref);
This structure describes decoded (raw) audio or video data.
uint8_t ** extended_data
pointers to the data planes/channels.
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
void av_frame_set_channels(AVFrame *frame, int val)
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.
int width
width and height of the video frame
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
void av_frame_set_sample_rate(AVFrame *frame, int val)
int av_frame_get_channels(const AVFrame *frame)
uint64_t channel_layout
Channel layout of the audio data.
#define FF_ARRAY_ELEMS(a)
int channels
number of audio channels, only used for audio.
enum AVPictureType pict_type
Picture type of the frame.
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.
void av_frame_set_pkt_pos(AVFrame *frame, int64_t val)
int sample_rate
Sample rate of the audio data.
AVFilterBufferRef * avfilter_get_video_buffer_ref_from_arrays(uint8_t *const data[4], const int linesize[4], int perms, int w, int h, enum AVPixelFormat format)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
void av_frame_set_channel_layout(AVFrame *frame, int64_t val)
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_channel_layout(const AVFrame *frame)
int nb_samples
number of audio samples (per channel) described by this frame
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...