summaryrefslogtreecommitdiff
path: root/libavformat/bethsoftvid.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-02-21 16:43:01 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-02-22 02:44:37 +0100
commite63a362857d9807b23e65872598d782fa53bb6af (patch)
tree7a21287e54bfbd2ec9c45bcb5a22e441e4992f2b /libavformat/bethsoftvid.c
parent6a786b15c34765ec00be3cd808dafbb041fd5881 (diff)
downloadffmpeg-e63a362857d9807b23e65872598d782fa53bb6af.tar.gz
avio: avio_ prefixes for get_* functions
In the name of consistency: get_byte -> avio_r8 get_<type> -> avio_r<type> get_buffer -> avio_read get_partial_buffer will be made private later get_strz is left out becase I want to change it later to return something useful. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com> (cherry picked from commit b7effd4e8338f6ed5bda630ad7ed0809bf458648)
Diffstat (limited to 'libavformat/bethsoftvid.c')
-rw-r--r--libavformat/bethsoftvid.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 017a8a6050..40d0e6296a 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -68,7 +68,7 @@ static int vid_read_header(AVFormatContext *s,
* int16s: always_512, nframes, width, height, delay, always_14
*/
url_fseek(pb, 5, SEEK_CUR);
- vid->nframes = get_le16(pb);
+ vid->nframes = avio_rl16(pb);
stream = av_new_stream(s, 0);
if (!stream)
@@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s,
av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
- stream->codec->width = get_le16(pb);
- stream->codec->height = get_le16(pb);
+ stream->codec->width = avio_rl16(pb);
+ stream->codec->height = avio_rl16(pb);
stream->codec->pix_fmt = PIX_FMT_PAL8;
- vid->bethsoft_global_delay = get_le16(pb);
- get_le16(pb);
+ vid->bethsoft_global_delay = avio_rl16(pb);
+ avio_rl16(pb);
// done with video codec, set up audio codec
stream = av_new_stream(s, 0);
@@ -117,11 +117,11 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
vidbuf_start[vidbuf_nbytes++] = block_type;
// get the video delay (next int16), and set the presentation time
- vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
+ vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb);
// set the y offset if it exists (decoder header data should be in data section)
if(block_type == VIDEO_YOFF_P_FRAME){
- if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
+ if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
goto fail;
vidbuf_nbytes += 2;
}
@@ -131,21 +131,21 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
if(!vidbuf_start)
return AVERROR(ENOMEM);
- code = get_byte(pb);
+ code = avio_r8(pb);
vidbuf_start[vidbuf_nbytes++] = code;
if(code >= 0x80){ // rle sequence
if(block_type == VIDEO_I_FRAME)
- vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
+ vidbuf_start[vidbuf_nbytes++] = avio_r8(pb);
} else if(code){ // plain sequence
- if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
+ if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
goto fail;
vidbuf_nbytes += code;
}
bytes_copied += code & 0x7F;
if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
// may contain a 0 byte even if read all pixels
- if(get_byte(pb))
+ if(avio_r8(pb))
url_fseek(pb, -1, SEEK_CUR);
break;
}
@@ -182,7 +182,7 @@ static int vid_read_packet(AVFormatContext *s,
if(vid->is_finished || url_feof(pb))
return AVERROR(EIO);
- block_type = get_byte(pb);
+ block_type = avio_r8(pb);
switch(block_type){
case PALETTE_BLOCK:
url_fseek(pb, -1, SEEK_CUR); // include block type
@@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s,
return ret_value;
case FIRST_AUDIO_BLOCK:
- get_le16(pb);
+ avio_rl16(pb);
// soundblaster DAC used for sample rate, as on specification page (link above)
- s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
+ s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb));
s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
case AUDIO_BLOCK:
- audio_length = get_le16(pb);
+ audio_length = avio_rl16(pb);
ret_value = av_get_packet(pb, pkt, audio_length);
pkt->stream_index = 1;
return ret_value != audio_length ? AVERROR(EIO) : ret_value;