Commit e7ba5b1d authored by Anton Khirnov's avatar Anton Khirnov

lavr: change the type of the data buffers to uint8_t**.

This is more consistent with what the rest of Libav does.

This breaks API.
parent 30223b3b
...@@ -1961,9 +1961,9 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr) ...@@ -1961,9 +1961,9 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
is->audio_buf1 = tmp_out; is->audio_buf1 = tmp_out;
out_samples = avresample_convert(is->avr, out_samples = avresample_convert(is->avr,
(void **)&is->audio_buf1, &is->audio_buf1,
out_linesize, nb_samples, out_linesize, nb_samples,
(void **)is->frame->data, is->frame->data,
is->frame->linesize[0], is->frame->linesize[0],
is->frame->nb_samples); is->frame->nb_samples);
if (out_samples < 0) { if (out_samples < 0) {
......
...@@ -133,7 +133,7 @@ static int request_frame(AVFilterLink *link) ...@@ -133,7 +133,7 @@ static int request_frame(AVFilterLink *link)
nb_samples); nb_samples);
if (!buf) if (!buf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ret = avresample_convert(s->avr, (void**)buf->extended_data, ret = avresample_convert(s->avr, buf->extended_data,
buf->linesize[0], nb_samples, NULL, 0, 0); buf->linesize[0], nb_samples, NULL, 0, 0);
if (ret <= 0) { if (ret <= 0) {
avfilter_unref_bufferp(&buf); avfilter_unref_bufferp(&buf);
...@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link) ...@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link)
static int write_to_fifo(ASyncContext *s, AVFilterBufferRef *buf) static int write_to_fifo(ASyncContext *s, AVFilterBufferRef *buf)
{ {
int ret = avresample_convert(s->avr, NULL, 0, 0, (void**)buf->extended_data, int ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data,
buf->linesize[0], buf->audio->nb_samples); buf->linesize[0], buf->audio->nb_samples);
avfilter_unref_buffer(buf); avfilter_unref_buffer(buf);
return ret; return ret;
...@@ -210,7 +210,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) ...@@ -210,7 +210,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
goto fail; goto fail;
} }
avresample_read(s->avr, (void**)buf_out->extended_data, out_size); avresample_read(s->avr, buf_out->extended_data, out_size);
buf_out->pts = s->pts; buf_out->pts = s->pts;
if (delta > 0) { if (delta > 0) {
...@@ -230,7 +230,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) ...@@ -230,7 +230,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
avresample_read(s->avr, NULL, avresample_available(s->avr)); avresample_read(s->avr, NULL, avresample_available(s->avr));
s->pts = pts - avresample_get_delay(s->avr); s->pts = pts - avresample_get_delay(s->avr);
ret = avresample_convert(s->avr, NULL, 0, 0, (void**)buf->extended_data, ret = avresample_convert(s->avr, NULL, 0, 0, buf->extended_data,
buf->linesize[0], buf->audio->nb_samples); buf->linesize[0], buf->audio->nb_samples);
fail: fail:
......
...@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *outlink) ...@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *outlink)
if (!buf) if (!buf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ret = avresample_convert(s->avr, (void**)buf->extended_data, ret = avresample_convert(s->avr, buf->extended_data,
buf->linesize[0], nb_samples, buf->linesize[0], nb_samples,
NULL, 0, 0); NULL, 0, 0);
if (ret <= 0) { if (ret <= 0) {
...@@ -186,9 +186,9 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) ...@@ -186,9 +186,9 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
goto fail; goto fail;
} }
ret = avresample_convert(s->avr, (void**)buf_out->extended_data, ret = avresample_convert(s->avr, buf_out->extended_data,
buf_out->linesize[0], nb_samples, buf_out->linesize[0], nb_samples,
(void**)buf->extended_data, buf->linesize[0], buf->extended_data, buf->linesize[0],
buf->audio->nb_samples); buf->audio->nb_samples);
if (ret < 0) { if (ret < 0) {
avfilter_unref_buffer(buf_out); avfilter_unref_buffer(buf_out);
......
...@@ -62,7 +62,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels) ...@@ -62,7 +62,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels)
return 0; return 0;
} }
int ff_audio_data_init(AudioData *a, void **src, int plane_size, int channels, int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels,
int nb_samples, enum AVSampleFormat sample_fmt, int nb_samples, enum AVSampleFormat sample_fmt,
int read_only, const char *name) int read_only, const char *name)
{ {
......
...@@ -73,7 +73,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels); ...@@ -73,7 +73,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels);
* @param name name for debug logging (can be NULL) * @param name name for debug logging (can be NULL)
* @return 0 on success, negative AVERROR value on error * @return 0 on success, negative AVERROR value on error
*/ */
int ff_audio_data_init(AudioData *a, void **src, int plane_size, int channels, int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels,
int nb_samples, enum AVSampleFormat sample_fmt, int nb_samples, enum AVSampleFormat sample_fmt,
int read_only, const char *name); int read_only, const char *name);
......
...@@ -305,8 +305,8 @@ int main(int argc, char **argv) ...@@ -305,8 +305,8 @@ int main(int argc, char **argv)
goto end; goto end;
} }
ret = avresample_convert(s, (void **)out_data, out_linesize, out_rate * 6, ret = avresample_convert(s, out_data, out_linesize, out_rate * 6,
(void **) in_data, in_linesize, in_rate * 6); in_data, in_linesize, in_rate * 6);
if (ret < 0) { if (ret < 0) {
char errbuf[256]; char errbuf[256];
av_strerror(ret, errbuf, sizeof(errbuf)); av_strerror(ret, errbuf, sizeof(errbuf));
......
...@@ -234,8 +234,8 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta, ...@@ -234,8 +234,8 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
* not including converted samples added to the internal * not including converted samples added to the internal
* output FIFO * output FIFO
*/ */
int avresample_convert(AVAudioResampleContext *avr, void **output, int avresample_convert(AVAudioResampleContext *avr, uint8_t **output,
int out_plane_size, int out_samples, void **input, int out_plane_size, int out_samples, uint8_t **input,
int in_plane_size, int in_samples); int in_plane_size, int in_samples);
/** /**
...@@ -287,6 +287,6 @@ int avresample_available(AVAudioResampleContext *avr); ...@@ -287,6 +287,6 @@ int avresample_available(AVAudioResampleContext *avr);
* @param nb_samples number of samples to read from the FIFO * @param nb_samples number of samples to read from the FIFO
* @return the number of samples written to output * @return the number of samples written to output
*/ */
int avresample_read(AVAudioResampleContext *avr, void **output, int nb_samples); int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples);
#endif /* AVRESAMPLE_AVRESAMPLE_H */ #endif /* AVRESAMPLE_AVRESAMPLE_H */
...@@ -247,8 +247,8 @@ static int handle_buffered_output(AVAudioResampleContext *avr, ...@@ -247,8 +247,8 @@ static int handle_buffered_output(AVAudioResampleContext *avr,
} }
int attribute_align_arg avresample_convert(AVAudioResampleContext *avr, int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,
void **output, int out_plane_size, uint8_t **output, int out_plane_size,
int out_samples, void **input, int out_samples, uint8_t **input,
int in_plane_size, int in_samples) int in_plane_size, int in_samples)
{ {
AudioData input_buffer; AudioData input_buffer;
...@@ -410,11 +410,11 @@ int avresample_available(AVAudioResampleContext *avr) ...@@ -410,11 +410,11 @@ int avresample_available(AVAudioResampleContext *avr)
return av_audio_fifo_size(avr->out_fifo); return av_audio_fifo_size(avr->out_fifo);
} }
int avresample_read(AVAudioResampleContext *avr, void **output, int nb_samples) int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples)
{ {
if (!output) if (!output)
return av_audio_fifo_drain(avr->out_fifo, nb_samples); return av_audio_fifo_drain(avr->out_fifo, nb_samples);
return av_audio_fifo_read(avr->out_fifo, output, nb_samples); return av_audio_fifo_read(avr->out_fifo, (void**)output, nb_samples);
} }
unsigned avresample_version(void) unsigned avresample_version(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment