annotate thp.c @ 3234:2e2221a3febb libavformat

Implement FFMAX3(a,b,c) - maximum over three arguments.
author voroshil
date Sat, 19 Apr 2008 17:07:58 +0000
parents d52c718e83f9
children 7a0230981402
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
1 /*
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
2 * THP Demuxer
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
3 * Copyright (c) 2007 Marco Gerards.
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
4 *
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
5 * This file is part of FFmpeg.
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
6 *
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
11 *
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
15 * Lesser General Public License for more details.
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
16 *
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
20 */
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
21
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
22
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
23 #include "avformat.h"
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
24
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
25 typedef struct ThpDemuxContext {
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
26 int version;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
27 int first_frame;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
28 int first_framesz;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
29 int last_frame;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
30 int compoff;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
31 int framecnt;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
32 AVRational fps;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
33 int frame;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
34 int next_frame;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
35 int next_framesz;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
36 int video_stream_index;
1988
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
37 int audio_stream_index;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
38 int compcount;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
39 unsigned char components[16];
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
40 AVStream* vst;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
41 int has_audio;
1988
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
42 int audiosize;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
43 } ThpDemuxContext;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
44
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
45
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
46 static int thp_probe(AVProbeData *p)
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
47 {
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
48 /* check file header */
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
49 if (AV_RL32(p->buf) == MKTAG('T', 'H', 'P', '\0'))
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
50 return AVPROBE_SCORE_MAX;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
51 else
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
52 return 0;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
53 }
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
54
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
55 static int thp_read_header(AVFormatContext *s,
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
56 AVFormatParameters *ap)
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
57 {
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
58 ThpDemuxContext *thp = s->priv_data;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
59 AVStream *st;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2555
diff changeset
60 ByteIOContext *pb = s->pb;
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
61 int i;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
62
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
63 /* Read the file header. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
64 get_be32(pb); /* Skip Magic. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
65 thp->version = get_be32(pb);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
66
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
67 get_be32(pb); /* Max buf size. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
68 get_be32(pb); /* Max samples. */
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
69
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
70 thp->fps = av_d2q(av_int2flt(get_be32(pb)), INT_MAX);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
71 thp->framecnt = get_be32(pb);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
72 thp->first_framesz = get_be32(pb);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
73 get_be32(pb); /* Data size. */
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
74
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
75 thp->compoff = get_be32(pb);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
76 get_be32(pb); /* offsetDataOffset. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
77 thp->first_frame = get_be32(pb);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
78 thp->last_frame = get_be32(pb);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
79
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
80 thp->next_framesz = thp->first_framesz;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
81 thp->next_frame = thp->first_frame;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
82
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
83 /* Read the component structure. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
84 url_fseek (pb, thp->compoff, SEEK_SET);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
85 thp->compcount = get_be32(pb);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
86
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
87 /* Read the list of component types. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
88 get_buffer(pb, thp->components, 16);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
89
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
90 for (i = 0; i < thp->compcount; i++) {
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
91 if (thp->components[i] == 0) {
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
92 if (thp->vst != 0)
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
93 break;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
94
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
95 /* Video component. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
96 st = av_new_stream(s, 0);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
97 if (!st)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2004
diff changeset
98 return AVERROR(ENOMEM);
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
99
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
100 /* The denominator and numerator are switched because 1/fps
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
101 is required. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
102 av_set_pts_info(st, 64, thp->fps.den, thp->fps.num);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
103 st->codec->codec_type = CODEC_TYPE_VIDEO;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
104 st->codec->codec_id = CODEC_ID_THP;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
105 st->codec->codec_tag = 0; /* no fourcc */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
106 st->codec->width = get_be32(pb);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
107 st->codec->height = get_be32(pb);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
108 st->codec->sample_rate = av_q2d(thp->fps);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
109 thp->vst = st;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
110 thp->video_stream_index = st->index;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
111
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
112 if (thp->version == 0x11000)
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
113 get_be32(pb); /* Unknown. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
114 } else if (thp->components[i] == 1) {
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
115 if (thp->has_audio != 0)
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
116 break;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
117
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
118 /* Audio component. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
119 st = av_new_stream(s, 0);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
120 if (!st)
2273
7eb456c4ed8a Replace all occurrences of AVERROR_NOMEM with AVERROR(ENOMEM).
takis
parents: 2004
diff changeset
121 return AVERROR(ENOMEM);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
122
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
123 st->codec->codec_type = CODEC_TYPE_AUDIO;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
124 st->codec->codec_id = CODEC_ID_ADPCM_THP;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
125 st->codec->codec_tag = 0; /* no fourcc */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
126 st->codec->channels = get_be32(pb); /* numChannels. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
127 st->codec->sample_rate = get_be32(pb); /* Frequency. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
128
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
129 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
130
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
131 thp->audio_stream_index = st->index;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
132 thp->has_audio = 1;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
133 }
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
134 }
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
135
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
136 return 0;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
137 }
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
138
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
139 static int thp_read_packet(AVFormatContext *s,
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
140 AVPacket *pkt)
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
141 {
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
142 ThpDemuxContext *thp = s->priv_data;
2771
d52c718e83f9 Use dynamically allocated ByteIOContext in AVFormatContext
andoma
parents: 2555
diff changeset
143 ByteIOContext *pb = s->pb;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
144 int size;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
145 int ret;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
146
1988
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
147 if (thp->audiosize == 0) {
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
148 /* Terminate when last frame is reached. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
149 if (thp->frame >= thp->framecnt)
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
150 return AVERROR(EIO);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
151
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
152 url_fseek(pb, thp->next_frame, SEEK_SET);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
153
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
154 /* Locate the next frame and read out its size. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
155 thp->next_frame += thp->next_framesz;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
156 thp->next_framesz = get_be32(pb);
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
157
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
158 get_be32(pb); /* Previous total size. */
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
159 size = get_be32(pb); /* Total size of this frame. */
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
160
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
161 /* Store the audiosize so the next time this function is called,
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
162 the audio can be read. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
163 if (thp->has_audio)
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
164 thp->audiosize = get_be32(pb); /* Audio size. */
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
165 else
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
166 thp->frame++;
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
167
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
168 ret = av_get_packet(pb, pkt, size);
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
169 if (ret != size) {
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
170 av_free_packet(pkt);
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
171 return AVERROR(EIO);
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
172 }
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
173
2004
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
174 pkt->stream_index = thp->video_stream_index;
cabaa5557164 cosmetics: indentation fix
diego
parents: 2001
diff changeset
175 } else {
1988
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
176 ret = av_get_packet(pb, pkt, thp->audiosize);
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
177 if (ret != thp->audiosize) {
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
178 av_free_packet(pkt);
2274
b21c2af60bc9 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
takis
parents: 2273
diff changeset
179 return AVERROR(EIO);
1988
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
180 }
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
181
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
182 pkt->stream_index = thp->audio_stream_index;
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
183 thp->audiosize = 0;
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
184 thp->frame++;
deacffc2740e THP PCM decoder, used on the Nintendo GameCube.
diego
parents: 1974
diff changeset
185 }
1974
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
186
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
187 return 0;
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
188 }
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
189
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
190 AVInputFormat thp_demuxer = {
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
191 "thp",
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
192 "THP",
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
193 sizeof(ThpDemuxContext),
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
194 thp_probe,
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
195 thp_read_header,
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
196 thp_read_packet
51c5fe603dba support for the THP game format by Marco Gerards, mgerards xs4all nl
diego
parents:
diff changeset
197 };