|
|
@ -58,9 +58,9 @@ AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms, |
|
|
|
if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0) |
|
|
|
if (av_samples_alloc(data, &linesize, nb_channels, nb_samples, link->format, 0) < 0) |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
|
|
|
|
samplesref = avfilter_get_audio_buffer_ref_from_arrays(data, linesize, full_perms, |
|
|
|
samplesref = avfilter_get_audio_buffer_ref_from_arrays_channels( |
|
|
|
nb_samples, link->format, |
|
|
|
data, linesize, full_perms, nb_samples, link->format, |
|
|
|
link->channel_layout); |
|
|
|
link->channels, link->channel_layout); |
|
|
|
if (!samplesref) |
|
|
|
if (!samplesref) |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
|
|
|
@ -92,13 +92,14 @@ AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms, |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data, |
|
|
|
AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays_channels(uint8_t **data, |
|
|
|
int linesize,int perms, |
|
|
|
int linesize, |
|
|
|
|
|
|
|
int perms, |
|
|
|
int nb_samples, |
|
|
|
int nb_samples, |
|
|
|
enum AVSampleFormat sample_fmt, |
|
|
|
enum AVSampleFormat sample_fmt, |
|
|
|
|
|
|
|
int channels, |
|
|
|
uint64_t channel_layout) |
|
|
|
uint64_t channel_layout) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int channels = av_get_channel_layout_nb_channels(channel_layout); |
|
|
|
|
|
|
|
int planes; |
|
|
|
int planes; |
|
|
|
AVFilterBuffer *samples = av_mallocz(sizeof(*samples)); |
|
|
|
AVFilterBuffer *samples = av_mallocz(sizeof(*samples)); |
|
|
|
AVFilterBufferRef *samplesref = av_mallocz(sizeof(*samplesref)); |
|
|
|
AVFilterBufferRef *samplesref = av_mallocz(sizeof(*samplesref)); |
|
|
@ -106,6 +107,10 @@ AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data, |
|
|
|
if (!samples || !samplesref) |
|
|
|
if (!samples || !samplesref) |
|
|
|
goto fail; |
|
|
|
goto fail; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
av_assert0(channels); |
|
|
|
|
|
|
|
av_assert0(channel_layout == 0 || |
|
|
|
|
|
|
|
channels == av_get_channel_layout_nb_channels(channel_layout)); |
|
|
|
|
|
|
|
|
|
|
|
samplesref->buf = samples; |
|
|
|
samplesref->buf = samples; |
|
|
|
samplesref->buf->free = ff_avfilter_default_free_buffer; |
|
|
|
samplesref->buf->free = ff_avfilter_default_free_buffer; |
|
|
|
if (!(samplesref->audio = av_mallocz(sizeof(*samplesref->audio)))) |
|
|
|
if (!(samplesref->audio = av_mallocz(sizeof(*samplesref->audio)))) |
|
|
@ -163,6 +168,18 @@ fail: |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data, |
|
|
|
|
|
|
|
int linesize,int perms, |
|
|
|
|
|
|
|
int nb_samples, |
|
|
|
|
|
|
|
enum AVSampleFormat sample_fmt, |
|
|
|
|
|
|
|
uint64_t channel_layout) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int channels = av_get_channel_layout_nb_channels(channel_layout); |
|
|
|
|
|
|
|
return avfilter_get_audio_buffer_ref_from_arrays_channels(data, linesize, perms, |
|
|
|
|
|
|
|
nb_samples, sample_fmt, |
|
|
|
|
|
|
|
channels, channel_layout); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int default_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame) |
|
|
|
static int default_filter_frame(AVFilterLink *link, AVFilterBufferRef *frame) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ff_filter_frame(link->dst->outputs[0], frame); |
|
|
|
return ff_filter_frame(link->dst->outputs[0], frame); |
|
|
|