* id RoQ (.roq) File Demuxer
* Copyright (c) 2003 The ffmpeg Project
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
AVFormatParameters *ap)
{
RoqDemuxContext *roq = s->priv_data;
- ByteIOContext *pb = s->pb;
+ AVIOContext *pb = s->pb;
int framerate;
AVStream *st;
unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
/* get the main header */
- if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+ if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
framerate = AV_RL16(&preamble[6]);
AVPacket *pkt)
{
RoqDemuxContext *roq = s->priv_data;
- ByteIOContext *pb = s->pb;
+ AVIOContext *pb = s->pb;
int ret = 0;
unsigned int chunk_size;
unsigned int chunk_type;
while (!packet_read) {
- if (url_feof(s->pb))
+ if (s->pb->eof_reached)
return AVERROR(EIO);
/* get the next chunk preamble */
- if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
+ if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
case RoQ_INFO:
if (!roq->width || !roq->height) {
AVStream *st = s->streams[roq->video_stream_index];
- if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
+ if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
st->codec->width = roq->width = AV_RL16(preamble);
st->codec->height = roq->height = AV_RL16(preamble + 2);
break;
}
/* don't care about this chunk anymore */
- url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR);
+ avio_skip(pb, RoQ_CHUNK_PREAMBLE_SIZE);
break;
case RoQ_QUAD_CODEBOOK:
/* packet needs to contain both this codebook and next VQ chunk */
- codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
+ codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
codebook_size = chunk_size;
- url_fseek(pb, codebook_size, SEEK_CUR);
- if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
+ avio_skip(pb, codebook_size);
+ if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
RoQ_CHUNK_PREAMBLE_SIZE)
return AVERROR(EIO);
chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
codebook_size;
/* rewind */
- url_fseek(pb, codebook_offset, SEEK_SET);
+ avio_seek(pb, codebook_offset, SEEK_SET);
/* load up the packet */
ret= av_get_packet(pb, pkt, chunk_size);
roq->audio_frame_count += (chunk_size / roq->audio_channels);
}
- pkt->pos= url_ftell(pb);
- ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
+ pkt->pos= avio_tell(pb);
+ ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
if (ret != chunk_size)
ret = AVERROR(EIO);
default:
av_log(s, AV_LOG_ERROR, " unknown RoQ chunk (%04X)\n", chunk_type);
return AVERROR_INVALIDDATA;
- break;
}
}
}
AVInputFormat ff_roq_demuxer = {
- "RoQ",
- NULL_IF_CONFIG_SMALL("id RoQ format"),
- sizeof(RoqDemuxContext),
- roq_probe,
- roq_read_header,
- roq_read_packet,
+ .name = "RoQ",
+ .long_name = NULL_IF_CONFIG_SMALL("id RoQ format"),
+ .priv_data_size = sizeof(RoqDemuxContext),
+ .read_probe = roq_probe,
+ .read_header = roq_read_header,
+ .read_packet = roq_read_packet,
};