annotate yop.c @ 6153:2e07dcbab954 libavformat

HTTP: Get rid of the is_chunked variable, use the chunksize variable instead
author mstorsjo
date Mon, 21 Jun 2010 19:01:32 +0000
parents 178de7695c6c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5907
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
1 /**
5969
178de7695c6c Remove explicit filename from Doxygen @file commands.
diego
parents: 5913
diff changeset
2 * @file
5907
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
3 * Psygnosis YOP demuxer
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
4 *
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
5 * Copyright (C) 2010 Mohamed Naufal Basheer <naufal11@gmail.com>
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
6 * derived from the code by
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
7 * Copyright (C) 2009 Thomas P. Higdon <thomas.p.higdon@gmail.com>
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
8 *
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
9 * This file is part of FFmpeg.
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
10 *
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
11 * FFmpeg is free software; you can redistribute it and/or
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
12 * modify it under the terms of the GNU Lesser General Public
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
13 * License as published by the Free Software Foundation; either
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
14 * version 2.1 of the License, or (at your option) any later version.
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
15 *
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
16 * FFmpeg is distributed in the hope that it will be useful,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
19 * Lesser General Public License for more details.
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
20 *
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
21 * You should have received a copy of the GNU Lesser General Public
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
22 * License along with FFmpeg; if not, write to the Free Software
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
24 */
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
25
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
26 #include "libavutil/intreadwrite.h"
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
27 #include "avformat.h"
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
28
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
29 typedef struct yop_dec_context {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
30 AVPacket video_packet;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
31
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
32 int odd_frame;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
33 int frame_size;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
34 int audio_block_length;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
35 int palette_size;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
36 } YopDecContext;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
37
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
38 static int yop_probe(AVProbeData *probe_packet)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
39 {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
40 if (AV_RB16(probe_packet->buf) == AV_RB16("YO") &&
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
41 probe_packet->buf[6] &&
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
42 probe_packet->buf[7] &&
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
43 !(probe_packet->buf[8] & 1) &&
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
44 !(probe_packet->buf[10] & 1))
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
45 return AVPROBE_SCORE_MAX * 3 / 4;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
46
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
47 return 0;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
48 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
49
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
50 static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
51 {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
52 YopDecContext *yop = s->priv_data;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
53 ByteIOContext *pb = s->pb;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
54
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
55 AVCodecContext *audio_dec, *video_dec;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
56 AVStream *audio_stream, *video_stream;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
57
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
58 int frame_rate, ret;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
59
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
60 audio_stream = av_new_stream(s, 0);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
61 video_stream = av_new_stream(s, 1);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
62
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
63 // Extra data that will be passed to the decoder
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
64 video_stream->codec->extradata_size = 8;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
65
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
66 video_stream->codec->extradata = av_mallocz(video_stream->codec->extradata_size +
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
67 FF_INPUT_BUFFER_PADDING_SIZE);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
68
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
69 if (!video_stream->codec->extradata)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
70 return AVERROR(ENOMEM);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
71
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
72 // Audio
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
73 audio_dec = audio_stream->codec;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5907
diff changeset
74 audio_dec->codec_type = AVMEDIA_TYPE_AUDIO;
5907
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
75 audio_dec->codec_id = CODEC_ID_ADPCM_IMA_WS;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
76 audio_dec->channels = 1;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
77 audio_dec->sample_rate = 22050;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
78
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
79 // Video
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
80 video_dec = video_stream->codec;
5910
536e5527c1e0 Define AVMediaType enum, and use it instead of enum CodecType, which
stefano
parents: 5907
diff changeset
81 video_dec->codec_type = AVMEDIA_TYPE_VIDEO;
5907
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
82 video_dec->codec_id = CODEC_ID_YOP;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
83
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
84 url_fskip(pb, 6);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
85
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
86 frame_rate = get_byte(pb);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
87 yop->frame_size = get_byte(pb) * 2048;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
88 video_dec->width = get_le16(pb);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
89 video_dec->height = get_le16(pb);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
90
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
91 video_stream->sample_aspect_ratio = (AVRational){1, 2};
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
92
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
93 ret = get_buffer(pb, video_dec->extradata, 8);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
94 if (ret < 8)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
95 return ret < 0 ? ret : AVERROR_EOF;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
96
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
97 yop->palette_size = video_dec->extradata[0] * 3 + 4;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
98 yop->audio_block_length = AV_RL16(video_dec->extradata + 6);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
99
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
100 // 1840 samples per frame, 1 nibble per sample; hence 1840/2 = 920
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
101 if (yop->audio_block_length < 920 ||
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
102 yop->audio_block_length + yop->palette_size >= yop->frame_size) {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
103 av_log(s, AV_LOG_ERROR, "YOP has invalid header\n");
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
104 return AVERROR_INVALIDDATA;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
105 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
106
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
107 url_fseek(pb, 2048, SEEK_SET);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
108
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
109 av_set_pts_info(video_stream, 32, 1, frame_rate);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
110
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
111 return 0;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
112 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
113
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
114 static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
115 {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
116 YopDecContext *yop = s->priv_data;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
117 ByteIOContext *pb = s->pb;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
118
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
119 int ret;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
120 int actual_video_data_size = yop->frame_size -
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
121 yop->audio_block_length - yop->palette_size;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
122
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
123 yop->video_packet.stream_index = 1;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
124
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
125 if (yop->video_packet.data) {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
126 *pkt = yop->video_packet;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
127 yop->video_packet.data = NULL;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
128 yop->video_packet.size = 0;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
129 pkt->data[0] = yop->odd_frame;
5913
11bb10c37225 Replace all occurences of PKT_FLAG_KEY with AV_PKT_FLAG_KEY.
cehoyos
parents: 5910
diff changeset
130 pkt->flags |= AV_PKT_FLAG_KEY;
5907
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
131 yop->odd_frame ^= 1;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
132 return pkt->size;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
133 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
134 ret = av_new_packet(&yop->video_packet,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
135 yop->frame_size - yop->audio_block_length);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
136 if (ret < 0)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
137 return ret;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
138
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
139 yop->video_packet.pos = url_ftell(pb);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
140
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
141 ret = get_buffer(pb, yop->video_packet.data, yop->palette_size);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
142 if (ret < 0) {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
143 goto err_out;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
144 }else if (ret < yop->palette_size) {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
145 ret = AVERROR_EOF;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
146 goto err_out;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
147 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
148
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
149 ret = av_get_packet(pb, pkt, 920);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
150 if (ret < 0)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
151 goto err_out;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
152
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
153 // Set position to the start of the frame
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
154 pkt->pos = yop->video_packet.pos;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
155
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
156 url_fskip(pb, yop->audio_block_length - ret);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
157
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
158 ret = get_buffer(pb, yop->video_packet.data + yop->palette_size,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
159 actual_video_data_size);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
160 if (ret < 0)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
161 goto err_out;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
162 else if (ret < actual_video_data_size)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
163 av_shrink_packet(&yop->video_packet, yop->palette_size + ret);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
164
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
165 // Arbitrarily return the audio data first
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
166 return yop->audio_block_length;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
167
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
168 err_out:
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
169 av_free_packet(&yop->video_packet);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
170 return ret;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
171 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
172
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
173 static int yop_read_close(AVFormatContext *s)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
174 {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
175 YopDecContext *yop = s->priv_data;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
176 av_free_packet(&yop->video_packet);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
177 return 0;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
178 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
179
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
180 static int yop_read_seek(AVFormatContext *s, int stream_index,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
181 int64_t timestamp, int flags)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
182 {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
183 YopDecContext *yop = s->priv_data;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
184 int64_t frame_pos, pos_min, pos_max;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
185 int frame_count;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
186
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
187 av_free_packet(&yop->video_packet);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
188
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
189 if (!stream_index)
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
190 return -1;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
191
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
192 pos_min = s->data_offset;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
193 pos_max = url_fsize(s->pb) - yop->frame_size;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
194 frame_count = (pos_max - pos_min) / yop->frame_size;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
195
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
196 timestamp = FFMAX(0, FFMIN(frame_count, timestamp));
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
197
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
198 frame_pos = timestamp * yop->frame_size + pos_min;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
199 yop->odd_frame = timestamp & 1;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
200
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
201 url_fseek(s->pb, frame_pos, SEEK_SET);
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
202 return 0;
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
203 }
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
204
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
205 AVInputFormat yop_demuxer = {
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
206 "yop",
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
207 NULL_IF_CONFIG_SMALL("Psygnosis YOP Format"),
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
208 sizeof(YopDecContext),
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
209 yop_probe,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
210 yop_read_header,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
211 yop_read_packet,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
212 yop_read_close,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
213 yop_read_seek,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
214 .extensions = "yop",
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
215 .flags = AVFMT_GENERIC_INDEX,
326378da363a Implement YOP demuxer and video decoder.
stefano
parents:
diff changeset
216 };