lavr: change the type of the data buffers to uint8_t**.
authorAnton Khirnov <anton@khirnov.net>
Fri, 5 Oct 2012 04:56:00 +0000 (06:56 +0200)
committerAnton Khirnov <anton@khirnov.net>
Fri, 5 Oct 2012 11:49:44 +0000 (13:49 +0200)
This is more consistent with what the rest of Libav does.

This breaks API.

avplay.c
libavfilter/af_asyncts.c
libavfilter/af_resample.c
libavresample/audio_data.c
libavresample/audio_data.h
libavresample/avresample-test.c
libavresample/avresample.h
libavresample/utils.c

index ead79f3..b1f2598 100644 (file)
--- a/avplay.c
+++ b/avplay.c
@@ -1961,9 +1961,9 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
                 is->audio_buf1 = tmp_out;
 
                 out_samples = avresample_convert(is->avr,
-                                                 (void **)&is->audio_buf1,
+                                                 &is->audio_buf1,
                                                  out_linesize, nb_samples,
-                                                 (void **)is->frame->data,
+                                                 is->frame->data,
                                                  is->frame->linesize[0],
                                                  is->frame->nb_samples);
                 if (out_samples < 0) {
index 0b8be8d..c7eb86d 100644 (file)
@@ -133,7 +133,7 @@ static int request_frame(AVFilterLink *link)
                                                      nb_samples);
         if (!buf)
             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);
         if (ret <= 0) {
             avfilter_unref_bufferp(&buf);
@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *link)
 
 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);
     avfilter_unref_buffer(buf);
     return ret;
@@ -210,7 +210,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
             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;
 
         if (delta > 0) {
@@ -230,7 +230,7 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
     avresample_read(s->avr, NULL, avresample_available(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);
 
 fail:
index eb2d2f9..c51f9d2 100644 (file)
@@ -149,7 +149,7 @@ static int request_frame(AVFilterLink *outlink)
         if (!buf)
             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);
         if (ret <= 0) {
@@ -186,9 +186,9 @@ static int filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
             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,
-                                     (void**)buf->extended_data, buf->linesize[0],
+                                     buf->extended_data, buf->linesize[0],
                                      buf->audio->nb_samples);
         if (ret < 0) {
             avfilter_unref_buffer(buf_out);
index d624ad3..199a68c 100644 (file)
@@ -62,7 +62,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels)
     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 read_only, const char *name)
 {
index 4609ebc..558e7e6 100644 (file)
@@ -73,7 +73,7 @@ int ff_audio_data_set_channels(AudioData *a, int channels);
  * @param name            name for debug logging (can be NULL)
  * @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 read_only, const char *name);
 
index 0d4f2df..ab49e48 100644 (file)
@@ -305,8 +305,8 @@ int main(int argc, char **argv)
                                 goto end;
                             }
 
-                            ret = avresample_convert(s, (void **)out_data, out_linesize, out_rate * 6,
-                                                        (void **) in_data,  in_linesize,  in_rate * 6);
+                            ret = avresample_convert(s, out_data, out_linesize, out_rate * 6,
+                                                         in_data,  in_linesize,  in_rate * 6);
                             if (ret < 0) {
                                 char errbuf[256];
                                 av_strerror(ret, errbuf, sizeof(errbuf));
index b93aba5..ea93952 100644 (file)
@@ -234,8 +234,8 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
  *                        not including converted samples added to the internal
  *                        output FIFO
  */
-int avresample_convert(AVAudioResampleContext *avr, void **output,
-                       int out_plane_size, int out_samples, void **input,
+int avresample_convert(AVAudioResampleContext *avr, uint8_t **output,
+                       int out_plane_size, int out_samples, uint8_t **input,
                        int in_plane_size, int in_samples);
 
 /**
@@ -287,6 +287,6 @@ int avresample_available(AVAudioResampleContext *avr);
  * @param nb_samples  number of samples to read from the FIFO
  * @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 */
index 4819b57..378dd48 100644 (file)
@@ -247,8 +247,8 @@ static int handle_buffered_output(AVAudioResampleContext *avr,
 }
 
 int attribute_align_arg avresample_convert(AVAudioResampleContext *avr,
-                                           void **output, int out_plane_size,
-                                           int out_samples, void **input,
+                                           uint8_t **output, int out_plane_size,
+                                           int out_samples, uint8_t **input,
                                            int in_plane_size, int in_samples)
 {
     AudioData input_buffer;
@@ -410,11 +410,11 @@ int avresample_available(AVAudioResampleContext *avr)
     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)
         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)