Skip to content

Commit

Permalink
avio: make get_partial_buffer internal.
Browse files Browse the repository at this point in the history
Signed-off-by: Ronald S. Bultje <[email protected]>
  • Loading branch information
elenril authored and rbultje committed Feb 21, 2011
1 parent b7effd4 commit b3db9ce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
9 changes: 1 addition & 8 deletions libavformat/avio.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte(
* @{
*/
attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
attribute_deprecated int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);
attribute_deprecated int get_byte(AVIOContext *s);
attribute_deprecated unsigned int get_le16(AVIOContext *s);
attribute_deprecated unsigned int get_le24(AVIOContext *s);
Expand Down Expand Up @@ -498,14 +499,6 @@ void put_flush_packet(AVIOContext *s);
*/
int avio_read(AVIOContext *s, unsigned char *buf, int size);

/**
* Read size bytes from AVIOContext into buf.
* This reads at most 1 packet. If that is not enough fewer bytes will be
* returned.
* @return number of bytes read or AVERROR
*/
int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size);

/** @note return 0 if EOF, so you cannot use it if EOF handling is
necessary */
int avio_r8 (AVIOContext *s);
Expand Down
8 changes: 8 additions & 0 deletions libavformat/avio_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,12 @@ int ffio_init_context(AVIOContext *s,
int64_t (*seek)(void *opaque, int64_t offset, int whence));


/**
* Read size bytes from AVIOContext into buf.
* This reads at most 1 packet. If that is not enough fewer bytes will be
* returned.
* @return number of bytes read or AVERROR
*/
int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size);

#endif // AVFORMAT_AVIO_INTERNAL_H
6 changes: 5 additions & 1 deletion libavformat/aviobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ int get_buffer(AVIOContext *s, unsigned char *buf, int size)
{
return avio_read(s, buf, size);
}
int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
{
return ffio_read_partial(s, buf, size);
}
#endif

int avio_put_str(AVIOContext *s, const char *str)
Expand Down Expand Up @@ -548,7 +552,7 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
return size1 - size;
}

int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size)
int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
{
int len;

Expand Down
3 changes: 2 additions & 1 deletion libavformat/rawdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

#include "avformat.h"
#include "avio_internal.h"
#include "rawdec.h"

/* raw input */
Expand Down Expand Up @@ -81,7 +82,7 @@ int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt)

pkt->pos= url_ftell(s->pb);
pkt->stream_index = 0;
ret = get_partial_buffer(s->pb, pkt->data, size);
ret = ffio_read_partial(s->pb, pkt->data, size);
if (ret < 0) {
av_free_packet(pkt);
return ret;
Expand Down

0 comments on commit b3db9ce

Please sign in to comment.