| 181 | } |
| 182 | |
| 183 | static int seq_read_header(AVFormatContext *s, AVFormatParameters *ap) |
| 184 | { |
| 185 | int i, rc; |
| 186 | SeqDemuxContext *seq = s->priv_data; |
| 187 | ByteIOContext *pb = s->pb; |
| 188 | AVStream *st; |
| 189 | |
| 190 | /* init internal buffers */ |
| 191 | rc = seq_init_frame_buffers(seq, pb); |
| 192 | if (rc) |
| 193 | return rc; |
| 194 | |
| 195 | seq->current_frame_offs = 0; |
| 196 | |
| 197 | /* preload (no audio data, just buffer operations related data) */ |
| 198 | for (i = 1; i <= 100; i++) { |
| 199 | rc = seq_parse_frame_data(seq, pb); |
| 200 | if (rc) |
| 201 | return rc; |
| 202 | } |
| 203 | |
| 204 | seq->current_frame_pts = 0; |
| 205 | |
| 206 | seq->audio_buffer_full = 0; |
| 207 | |
| 208 | /* initialize the video decoder stream */ |
| 209 | st = av_new_stream(s, 0); |
| 210 | if (!st) |
| 211 | return AVERROR(ENOMEM); |
| 212 | |
| 213 | av_set_pts_info(st, 32, 1, SEQ_FRAME_RATE); |
| 214 | seq->video_stream_index = st->index; |
| 215 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 216 | st->codec->codec_id = CODEC_ID_TIERTEXSEQVIDEO; |
| 217 | st->codec->codec_tag = 0; /* no fourcc */ |
| 218 | st->codec->width = SEQ_FRAME_W; |
| 219 | st->codec->height = SEQ_FRAME_H; |
| 220 | |
| 221 | /* initialize the audio decoder stream */ |
| 222 | st = av_new_stream(s, 0); |
| 223 | if (!st) |
| 224 | return AVERROR(ENOMEM); |
| 225 | |
| 226 | av_set_pts_info(st, 32, 1, SEQ_SAMPLE_RATE); |
| 227 | seq->audio_stream_index = st->index; |
| 228 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 229 | st->codec->codec_id = CODEC_ID_PCM_S16BE; |
| 230 | st->codec->codec_tag = 0; /* no tag */ |
| 231 | st->codec->channels = 1; |
| 232 | st->codec->sample_rate = SEQ_SAMPLE_RATE; |
| 233 | st->codec->bits_per_coded_sample = 16; |
| 234 | st->codec->bit_rate = st->codec->sample_rate * st->codec->bits_per_coded_sample * st->codec->channels; |
| 235 | st->codec->block_align = st->codec->channels * st->codec->bits_per_coded_sample; |
| 236 | |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) |
nothing calls this directly
no test coverage detected