Lines Matching refs:sga
183 SGADemuxContext *sga = s->priv_data; in sga_read_header() local
186 sga->sector_headers = 1; in sga_read_header()
187 sga->first_audio_size = 0; in sga_read_header()
188 sga->video_stream_index = -1; in sga_read_header()
189 sga->audio_stream_index = -1; in sga_read_header()
190 sga->left = 2048; in sga_read_header()
191 sga->idx = 0; in sga_read_header()
202 if (!sga->first_audio_size && in sga_read_header()
207 sga->first_audio_size = avio_rb16(pb); in sga_read_header()
210 sga->sample_rate = av_rescale(clock, in sga_read_header()
218 sga->sector_headers = 0; in sga_read_header()
233 SGADemuxContext *sga = s->priv_data; in print_stats() local
237 av_log(s, AV_LOG_DEBUG, "idx: %X\n", sga->idx); in print_stats()
238 av_log(s, AV_LOG_DEBUG, "packet_type: %X\n", sga->packet_type); in print_stats()
239 av_log(s, AV_LOG_DEBUG, "payload_size: %X\n", sga->payload_size); in print_stats()
240 av_log(s, AV_LOG_DEBUG, "SECTOR: %016"PRIX64"\n", AV_RB64(sga->sector)); in print_stats()
241 av_log(s, AV_LOG_DEBUG, "stream: %X\n", sga->sector[1]); in print_stats()
247 SGADemuxContext *sga = s->priv_data; in update_type_size() local
249 if (sga->idx >= 4) { in update_type_size()
250 sga->packet_type = sga->sector[0]; in update_type_size()
251 sga->payload_size = AV_RB16(sga->sector + 2); in update_type_size()
253 sga->packet_type = 0; in update_type_size()
254 sga->payload_size = 0; in update_type_size()
260 SGADemuxContext *sga = s->priv_data; in sga_video_packet() local
263 if (sga->payload_size <= 8) in sga_video_packet()
266 if (sga->video_stream_index == -1) { in sga_video_packet()
277 sga->video_stream_index = st->index; in sga_video_packet()
279 if (sga->first_audio_size > 0 && sga->sample_rate > 0) { in sga_video_packet()
280 frame_rate.num = sga->sample_rate; in sga_video_packet()
281 frame_rate.den = sga->first_audio_size; in sga_video_packet()
289 ret = av_new_packet(pkt, sga->payload_size + 4); in sga_video_packet()
292 memcpy(pkt->data, sga->sector, sga->payload_size + 4); in sga_video_packet()
293 av_assert0(sga->idx >= sga->payload_size + 4); in sga_video_packet()
294 memmove(sga->sector, sga->sector + sga->payload_size + 4, sga->idx - sga->payload_size - 4); in sga_video_packet()
296 pkt->stream_index = sga->video_stream_index; in sga_video_packet()
298 pkt->pos = sga->pkt_pos; in sga_video_packet()
299 pkt->flags |= sga->flags; in sga_video_packet()
300 sga->idx -= sga->payload_size + 4; in sga_video_packet()
301 sga->flags = 0; in sga_video_packet()
304 …, AV_LOG_DEBUG, "VIDEO PACKET: %d:%016"PRIX64" i:%X\n", pkt->size, AV_RB64(sga->sector), sga->idx); in sga_video_packet()
311 SGADemuxContext *sga = s->priv_data; in sga_audio_packet() local
314 if (sga->payload_size <= 8) in sga_audio_packet()
317 if (sga->audio_stream_index == -1) { in sga_audio_packet()
327 st->codecpar->sample_rate = av_rescale(AV_RB16(sga->sector + 8), in sga_audio_packet()
330 sga->audio_stream_index = st->index; in sga_audio_packet()
335 ret = av_new_packet(pkt, sga->payload_size - 8); in sga_audio_packet()
338 memcpy(pkt->data, sga->sector + 12, sga->payload_size - 8); in sga_audio_packet()
339 av_assert0(sga->idx >= sga->payload_size + 4); in sga_audio_packet()
340 memmove(sga->sector, sga->sector + sga->payload_size + 4, sga->idx - sga->payload_size - 4); in sga_audio_packet()
342 pkt->stream_index = sga->audio_stream_index; in sga_audio_packet()
344 pkt->pos = sga->pkt_pos; in sga_audio_packet()
345 pkt->flags |= sga->flags; in sga_audio_packet()
346 sga->idx -= sga->payload_size + 4; in sga_audio_packet()
347 sga->flags = 0; in sga_audio_packet()
350 …, AV_LOG_DEBUG, "AUDIO PACKET: %d:%016"PRIX64" i:%X\n", pkt->size, AV_RB64(sga->sector), sga->idx); in sga_audio_packet()
357 SGADemuxContext *sga = s->priv_data; in sga_packet() local
360 if (sga->packet_type == 0xCD || in sga_packet()
361 sga->packet_type == 0xCB || in sga_packet()
362 sga->packet_type == 0xC9 || in sga_packet()
363 sga->packet_type == 0xC8 || in sga_packet()
364 sga->packet_type == 0xC7 || in sga_packet()
365 sga->packet_type == 0xC6 || in sga_packet()
366 sga->packet_type == 0xC1 || in sga_packet()
367 sga->packet_type == 0xE7) { in sga_packet()
369 } else if (sga->packet_type == 0xA1 || in sga_packet()
370 sga->packet_type == 0xA2 || in sga_packet()
371 sga->packet_type == 0xA3 || in sga_packet()
372 sga->packet_type == 0xAA) { in sga_packet()
375 if (sga->idx == 0) in sga_packet()
377 if (sga->sector[0]) in sga_packet()
379 memmove(sga->sector, sga->sector + 1, sga->idx - 1); in sga_packet()
380 sga->idx--; in sga_packet()
389 SGADemuxContext *sga = s->priv_data; in try_packet() local
393 if (sga->idx >= sga->payload_size + 4) { in try_packet()
401 return sga->idx < sga->payload_size + 4 ? AVERROR(EAGAIN) : ret; in try_packet()
406 SGADemuxContext *sga = s->priv_data; in sga_read_packet() local
410 sga->pkt_pos = avio_tell(pb); in sga_read_packet()
417 (!sga->payload_size || sga->idx < sga->payload_size + 4)) in sga_read_packet()
420 if (sga->idx < sga->payload_size + 4) { in sga_read_packet()
429 sga->left = 0; in sga_read_packet()
432 !sga->sector_headers)) { in sga_read_packet()
434 sga->flags = AV_PKT_FLAG_KEY; in sga_read_packet()
435 sga->left = 2048; in sga_read_packet()
437 sga->left = 2046; in sga_read_packet()
440 av_assert0(sga->idx + sga->left < sizeof(sga->sector)); in sga_read_packet()
441 ret = avio_read(pb, sga->sector + sga->idx, sga->left); in sga_read_packet()
443 sga->idx += ret; in sga_read_packet()
461 SGADemuxContext *sga = s->priv_data; in sga_seek() local
463 sga->packet_type = sga->payload_size = sga->idx = 0; in sga_seek()
464 memset(sga->sector, 0, sizeof(sga->sector)); in sga_seek()