comparison bethsoftvid.c @ 1994:53a26acd2cf5 libavformat

remove redundant comments
author michael
date Sat, 07 Apr 2007 22:55:15 +0000
parents c86a5a28e1cb
children df6bcc29a90c
comparison
equal deleted inserted replaced
1993:c86a5a28e1cb 1994:53a26acd2cf5
56 } 56 }
57 57
58 static int vid_read_header(AVFormatContext *s, 58 static int vid_read_header(AVFormatContext *s,
59 AVFormatParameters *ap) 59 AVFormatParameters *ap)
60 { 60 {
61 BVID_DemuxContext *vid = s->priv_data; // permanent data outside of function 61 BVID_DemuxContext *vid = s->priv_data;
62 ByteIOContext *pb = &s->pb; // io to file 62 ByteIOContext *pb = &s->pb;
63 AVStream *stream; 63 AVStream *stream;
64 64
65 /* load main header. Contents: 65 /* load main header. Contents:
66 * bytes: 'V' 'I' 'D' 66 * bytes: 'V' 'I' 'D'
67 * int16s: always_512, nframes, width, height, delay, always_14 67 * int16s: always_512, nframes, width, height, delay, always_14
68 */ 68 */
69 url_fseek(pb, 5, SEEK_CUR); 69 url_fseek(pb, 5, SEEK_CUR);
70 vid->nframes = get_le16(pb); 70 vid->nframes = get_le16(pb);
71 71
72 // FFmpeg central code will use this; don't need to return or anything
73 // initialize the bethsoft codec
74 stream = av_new_stream(s, 0); 72 stream = av_new_stream(s, 0);
75 if (!stream) 73 if (!stream)
76 return AVERROR_NOMEM; 74 return AVERROR_NOMEM;
77 av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps 75 av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
78 stream->codec->codec_type = CODEC_TYPE_VIDEO; 76 stream->codec->codec_type = CODEC_TYPE_VIDEO;
113 return AVERROR_NOMEM; 111 return AVERROR_NOMEM;
114 112
115 // save the file position for the packet, include block type 113 // save the file position for the packet, include block type
116 position = url_ftell(pb) - 1; 114 position = url_ftell(pb) - 1;
117 115
118 // set the block type for the decoder
119 vidbuf_start[vidbuf_nbytes++] = block_type; 116 vidbuf_start[vidbuf_nbytes++] = block_type;
120 117
121 // get the video delay (next int16), and set the presentation time 118 // get the video delay (next int16), and set the presentation time
122 vid->video_pts += vid->bethsoft_global_delay + get_le16(pb); 119 vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
123 120
174 } 171 }
175 172
176 static int vid_read_packet(AVFormatContext *s, 173 static int vid_read_packet(AVFormatContext *s,
177 AVPacket *pkt) 174 AVPacket *pkt)
178 { 175 {
179 BVID_DemuxContext *vid = s->priv_data; // permanent data outside of function 176 BVID_DemuxContext *vid = s->priv_data;
180 ByteIOContext *pb = &s->pb; // io to file 177 ByteIOContext *pb = &s->pb;
181 unsigned char block_type; // block type 178 unsigned char block_type;
182 int audio_length; 179 int audio_length;
183 int ret_value; 180 int ret_value;
184 181
185 if(vid->is_finished || url_feof(pb)) 182 if(vid->is_finished || url_feof(pb))
186 return AVERROR_IO; 183 return AVERROR_IO;
196 } 193 }
197 pkt->stream_index = 0; 194 pkt->stream_index = 0;
198 return ret_value; 195 return ret_value;
199 196
200 case FIRST_AUDIO_BLOCK: 197 case FIRST_AUDIO_BLOCK:
201 get_le16(pb); // some unused constant 198 get_le16(pb);
202 // soundblaster DAC used for sample rate, as on specification page (link above) 199 // soundblaster DAC used for sample rate, as on specification page (link above)
203 s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb)); 200 s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
204 s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_sample; 201 s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_sample;
205 case AUDIO_BLOCK: 202 case AUDIO_BLOCK:
206 audio_length = get_le16(pb); 203 audio_length = get_le16(pb);