Revision e731b8d8 libavformat/aviobuf.c

View differences:

libavformat/aviobuf.c
23 23
#include "libavutil/intreadwrite.h"
24 24
#include "avformat.h"
25 25
#include "avio.h"
26
#include "avio_internal.h"
26 27
#include "internal.h"
27 28
#include <stdarg.h>
28 29

  
......
40 41
static int url_resetbuf(AVIOContext *s, int flags);
41 42
#endif
42 43

  
43
int init_put_byte(AVIOContext *s,
44
int ffio_init_context(AVIOContext *s,
44 45
                  unsigned char *buffer,
45 46
                  int buffer_size,
46 47
                  int write_flag,
......
73 74
    return 0;
74 75
}
75 76

  
77
#if FF_API_OLD_AVIO
78
int init_put_byte(AVIOContext *s,
79
                  unsigned char *buffer,
80
                  int buffer_size,
81
                  int write_flag,
82
                  void *opaque,
83
                  int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
84
                  int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
85
                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
86
{
87
    return ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
88
                                read_packet, write_packet, seek);
89
}
90
#endif
91

  
76 92
AVIOContext *av_alloc_put_byte(
77 93
                  unsigned char *buffer,
78 94
                  int buffer_size,
......
83 99
                  int64_t (*seek)(void *opaque, int64_t offset, int whence))
84 100
{
85 101
    AVIOContext *s = av_mallocz(sizeof(AVIOContext));
86
    init_put_byte(s, buffer, buffer_size, write_flag, opaque,
102
    ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
87 103
                  read_packet, write_packet, seek);
88 104
    return s;
89 105
}
......
664 680
        return AVERROR(ENOMEM);
665 681
    }
666 682

  
667
    if (init_put_byte(*s, buffer, buffer_size,
683
    if (ffio_init_context(*s, buffer, buffer_size,
668 684
                      (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
669 685
                      url_read, url_write, url_seek) < 0) {
670 686
        av_free(buffer);
......
865 881
    *s = av_mallocz(sizeof(AVIOContext));
866 882
    if(!*s)
867 883
        return AVERROR(ENOMEM);
868
    ret = init_put_byte(*s, buf, buf_size,
884
    ret = ffio_init_context(*s, buf, buf_size,
869 885
                        (flags & URL_WRONLY || flags & URL_RDWR),
870 886
                        NULL, NULL, NULL, NULL);
871 887
    if(ret != 0)
......
964 980
        return AVERROR(ENOMEM);
965 981
    }
966 982
    d->io_buffer_size = io_buffer_size;
967
    ret = init_put_byte(*s, d->io_buffer, io_buffer_size,
983
    ret = ffio_init_context(*s, d->io_buffer, io_buffer_size,
968 984
                        1, d, NULL,
969 985
                        max_packet_size ? dyn_packet_buf_write : dyn_buf_write,
970 986
                        max_packet_size ? NULL : dyn_buf_seek);

Also available in: Unified diff