History

lavfi: add avfilter_fill_frame_from_{audio_,}buffer_ref().

Clément Bœsch committed 14 years ago

Commit a67d9cf1 parent a84851b4 files · +50 −2Browse files

Showing the changes to libavfilter (3 of 4 files). Show all

Unified · Split

3 files
  1. libavfilter/avcodec.c +23 −0
  2. libavfilter/avcodec.h +22 −0
  3. libavfilter/version.h +2 −2
libavfilter/avcodec.c+23−0
@@ -56,6 +56,20 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame · 55 unmodified lines
56 return picref;56 return picref;
57}57}
58 58
59int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
60 const AVFilterBufferRef *samplesref)
61{
62 if (!samplesref || !samplesref->audio || !frame)
63 return AVERROR(EINVAL);
64
65 memcpy(frame->data, samplesref->data, sizeof(frame->data));
66 frame->pkt_pos = samplesref->pos;
67 frame->format = samplesref->format;
68 frame->nb_samples = samplesref->audio->nb_samples;
69
70 return 0;
71}
72
59int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,73int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
60 const AVFilterBufferRef *picref)74 const AVFilterBufferRef *picref)
61{75{
@@ -73,3 +87,12 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame, · 11 unmodified lines
73 87
74 return 0;88 return 0;
75}89}
90
91int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
92 const AVFilterBufferRef *ref)
93{
94 if (!ref)
95 return AVERROR(EINVAL);
96 return ref->video ? avfilter_fill_frame_from_video_buffer_ref(frame, ref)
97 : avfilter_fill_frame_from_audio_buffer_ref(frame, ref);
98}
libavfilter/avcodec.h+22−0
@@ -46,6 +46,17 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); · 45 unmodified lines
46 */46 */
47AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);47AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms);
48 48
49/**
50 * Fill an AVFrame with the information stored in samplesref.
51 *
52 * @param frame an already allocated AVFrame
53 * @param samplesref an audio buffer reference
54 * @return 0 in case of success, a negative AVERROR code in case of
55 * failure
56 */
57int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame,
58 const AVFilterBufferRef *samplesref);
59
49/**60/**
50 * Fill an AVFrame with the information stored in picref.61 * Fill an AVFrame with the information stored in picref.
51 *62 *
@@ -57,6 +68,17 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame · 5 unmodified lines
57int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,68int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame,
58 const AVFilterBufferRef *picref);69 const AVFilterBufferRef *picref);
59 70
71/**
72 * Fill an AVFrame with information stored in ref.
73 *
74 * @param frame an already allocated AVFrame
75 * @param ref a video or audio buffer reference
76 * @return 0 in case of success, a negative AVERROR code in case of
77 * failure
78 */
79int avfilter_fill_frame_from_buffer_ref(AVFrame *frame,
80 const AVFilterBufferRef *ref);
81
60/**82/**
61 * Add frame data to buffer_src.83 * Add frame data to buffer_src.
62 *84 *
libavfilter/version.h+2−2
@@ -29,8 +29,8 @@ · 28 unmodified lines
29#include "libavutil/avutil.h"29#include "libavutil/avutil.h"
30 30
31#define LIBAVFILTER_VERSION_MAJOR 231#define LIBAVFILTER_VERSION_MAJOR 2
32#define LIBAVFILTER_VERSION_MINOR 6532#define LIBAVFILTER_VERSION_MINOR 66
33#define LIBAVFILTER_VERSION_MICRO 10233#define LIBAVFILTER_VERSION_MICRO 100
34 34
35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \35#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
36 LIBAVFILTER_VERSION_MINOR, \36 LIBAVFILTER_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t