History

lavfi: implement avfilter_get_audio_buffer_ref_from_arrays()

Stefano Sabatini committed 15 years ago

Commit c3819601 parent c6d7fc23 files · +64 −2Browse files

Unified · Split

3 files
  1. doc/APIchanges +3 −0
  2. libavfilter/avfilter.c +42 −0
  3. libavfilter/avfilter.h +19 −2
doc/APIchanges+3−0
@@ -13,6 +13,9 @@ libavutil: 2011-04-18 · 12 unmodified lines
13 13
14API changes, most recent first:14API changes, most recent first:
15 15
162011-06-10 - xxxxxxx - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
17 Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.
18
162011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata192011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata
17 Move AVMetadata from lavf to lavu and rename it to20 Move AVMetadata from lavf to lavu and rename it to
18 AVDictionary -- new installed header dict.h.21 AVDictionary -- new installed header dict.h.
libavfilter/avfilter.c+42−0
@@ -421,6 +421,48 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, · 420 unmodified lines
421 return ret;421 return ret;
422}422}
423 423
424AVFilterBufferRef *
425avfilter_get_audio_buffer_ref_from_arrays(uint8_t *data[8], int linesize[8], int perms,
426 int nb_samples, enum AVSampleFormat sample_fmt,
427 int64_t channel_layout, int planar)
428{
429 AVFilterBuffer *samples = av_mallocz(sizeof(AVFilterBuffer));
430 AVFilterBufferRef *samplesref = av_mallocz(sizeof(AVFilterBufferRef));
431
432 if (!samples || !samplesref)
433 goto fail;
434
435 samplesref->buf = samples;
436 samplesref->buf->free = ff_avfilter_default_free_buffer;
437 if (!(samplesref->audio = av_mallocz(sizeof(AVFilterBufferRefAudioProps))))
438 goto fail;
439
440 samplesref->audio->nb_samples = nb_samples;
441 samplesref->audio->channel_layout = channel_layout;
442 samplesref->audio->planar = planar;
443
444 /* make sure the buffer gets read permission or it's useless for output */
445 samplesref->perms = perms | AV_PERM_READ;
446
447 samples->refcount = 1;
448 samplesref->type = AVMEDIA_TYPE_AUDIO;
449 samplesref->format = sample_fmt;
450
451 memcpy(samples->data, data, sizeof(samples->data));
452 memcpy(samples->linesize, linesize, sizeof(samples->linesize));
453 memcpy(samplesref->data, data, sizeof(samplesref->data));
454 memcpy(samplesref->linesize, linesize, sizeof(samplesref->linesize));
455
456 return samplesref;
457
458fail:
459 if (samplesref && samplesref->audio)
460 av_freep(&samplesref->audio);
461 av_freep(&samplesref);
462 av_freep(&samples);
463 return NULL;
464}
465
424int avfilter_request_frame(AVFilterLink *link)466int avfilter_request_frame(AVFilterLink *link)
425{467{
426 FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);468 FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
libavfilter/avfilter.h+19−2
@@ -26,8 +26,8 @@ · 25 unmodified lines
26#include "libavutil/samplefmt.h"26#include "libavutil/samplefmt.h"
27 27
28#define LIBAVFILTER_VERSION_MAJOR 228#define LIBAVFILTER_VERSION_MAJOR 2
29#define LIBAVFILTER_VERSION_MINOR 1429#define LIBAVFILTER_VERSION_MINOR 15
30#define LIBAVFILTER_VERSION_MICRO 130#define LIBAVFILTER_VERSION_MICRO 0
31 31
32#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \32#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
33 LIBAVFILTER_VERSION_MINOR, \33 LIBAVFILTER_VERSION_MINOR, \
@@ -694,6 +694,23 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, · 660 unmodified lines
694 enum AVSampleFormat sample_fmt, int nb_samples,694 enum AVSampleFormat sample_fmt, int nb_samples,
695 int64_t channel_layout, int planar);695 int64_t channel_layout, int planar);
696 696
697/**
698 * Create an audio buffer reference wrapped around an already
699 * allocated samples buffer.
700 *
701 * @param data pointers to the samples plane buffers
702 * @param linesize linesize for the samples plane buffers
703 * @param perms the required access permissions
704 * @param nb_samples number of samples per channel
705 * @param sample_fmt the format of each sample in the buffer to allocate
706 * @param channel_layout the channel layout of the buffer
707 * @param planar audio data layout - planar or packed
708 */
709AVFilterBufferRef *
710avfilter_get_audio_buffer_ref_from_arrays(uint8_t *data[8], int linesize[8], int perms,
711 int nb_samples, enum AVSampleFormat sample_fmt,
712 int64_t channel_layout, int planar);
713
697/**714/**
698 * Request an input frame from the filter at the other end of the link.715 * Request an input frame from the filter at the other end of the link.
699 *716 *

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