/*
* THP Demuxer
- * Copyright (c) 2007 Marco Gerards.
+ * Copyright (c) 2007 Marco Gerards
*
* This file is part of FFmpeg.
*
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
+#include "libavutil/intreadwrite.h"
#include "avformat.h"
-#include "allformats.h"
typedef struct ThpDemuxContext {
int version;
{
ThpDemuxContext *thp = s->priv_data;
AVStream *st;
- ByteIOContext *pb = &s->pb;
+ AVIOContext *pb = s->pb;
int i;
/* Read the file header. */
/* Video component. */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
/* The denominator and numerator are switched because 1/fps
is required. */
av_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
- st->codec->codec_type = CODEC_TYPE_VIDEO;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_THP;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = get_be32(pb);
/* Audio component. */
st = av_new_stream(s, 0);
if (!st)
- return AVERROR_NOMEM;
+ return AVERROR(ENOMEM);
- st->codec->codec_type = CODEC_TYPE_AUDIO;
+ st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_THP;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->channels = get_be32(pb); /* numChannels. */
AVPacket *pkt)
{
ThpDemuxContext *thp = s->priv_data;
- ByteIOContext *pb = &s->pb;
+ AVIOContext *pb = s->pb;
int size;
int ret;
if (thp->audiosize == 0) {
/* Terminate when last frame is reached. */
if (thp->frame >= thp->framecnt)
- return AVERROR_IO;
+ return AVERROR(EIO);
url_fseek(pb, thp->next_frame, SEEK_SET);
ret = av_get_packet(pb, pkt, size);
if (ret != size) {
av_free_packet(pkt);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
pkt->stream_index = thp->video_stream_index;
ret = av_get_packet(pb, pkt, thp->audiosize);
if (ret != thp->audiosize) {
av_free_packet(pkt);
- return AVERROR_IO;
+ return AVERROR(EIO);
}
pkt->stream_index = thp->audio_stream_index;
return 0;
}
-AVInputFormat thp_demuxer = {
+AVInputFormat ff_thp_demuxer = {
"thp",
- "THP",
+ NULL_IF_CONFIG_SMALL("THP"),
sizeof(ThpDemuxContext),
thp_probe,
thp_read_header,