Lines Matching defs:pkt
86 size_t ac3_pkt_size; /* length of ac3 pkt we've seen so far */
387 static int demux_video(AVFormatContext *s, TyRecHdr *rec_hdr, AVPacket *pkt)
412 if ((ret = av_new_packet(pkt, size)) < 0)
414 memcpy(pkt->data, ty->chunk + ty->cur_chunk_pos, size);
416 pkt->stream_index = 0;
436 if ((ret = av_new_packet(pkt, rec_size)) < 0)
438 memcpy(pkt->data, ty->chunk + ty->cur_chunk_pos, rec_size);
440 pkt->stream_index = 0;
446 if (subrec_type == 0x0c && pkt->size >= 6)
447 pkt->data[5] |= 0x08;
462 pkt->pts = ty->last_video_pts;
473 static int check_sync_pes(AVFormatContext *s, AVPacket *pkt,
491 memcpy(ty->pes_buffer, pkt->data + offset, rec_len - offset);
496 pkt->size -= rec_len - offset;
502 ty->last_audio_pts = ff_parse_pes_pts(&pkt->data[ offset + ty->pts_offset]);
505 pkt->pts = ty->last_audio_pts;
506 memmove(pkt->data + offset, pkt->data + offset + ty->pes_length, rec_len - ty->pes_length);
507 pkt->size -= ty->pes_length;
511 static int demux_audio(AVFormatContext *s, TyRecHdr *rec_hdr, AVPacket *pkt)
554 pkt->pts = ty->last_audio_pts;
559 if ((ret = av_new_packet(pkt, rec_size - need)) < 0)
561 memcpy(pkt->data, ty->chunk + ty->cur_chunk_pos, rec_size - need);
563 pkt->stream_index = 1;
573 if (ty->ac3_pkt_size + pkt->size > AC3_PKT_LENGTH) {
574 pkt->size -= 2;
577 ty->ac3_pkt_size += pkt->size;
581 if ((ret = av_new_packet(pkt, rec_size)) < 0)
583 memcpy(pkt->data, ty->chunk + ty->cur_chunk_pos, rec_size);
585 pkt->stream_index = 1;
588 es_offset1 = find_es_header(ty_MPEGAudioPacket, pkt->data, 5);
593 ty->last_audio_pts = ff_parse_pes_pts(&pkt->data[SA_PTS_OFFSET]);
596 av_packet_unref(pkt);
603 if (check_sync_pes(s, pkt, es_offset1, rec_size) == -1) {
606 av_packet_unref(pkt);
612 if ((ret = av_new_packet(pkt, rec_size)) < 0)
614 memcpy(pkt->data, ty->chunk + ty->cur_chunk_pos, rec_size);
616 pkt->stream_index = 1;
617 pkt->pts = ty->last_audio_pts;
619 if ((ret = av_new_packet(pkt, rec_size)) < 0)
621 memcpy(pkt->data, ty->chunk + ty->cur_chunk_pos, rec_size);
623 pkt->stream_index = 1;
627 es_offset1 = find_es_header(ty_AC3AudioPacket, pkt->data, 5);
630 if (check_sync_pes(s, pkt, es_offset1, rec_size) == -1) {
632 av_packet_unref(pkt);
637 if (pkt->size > AC3_PKT_LENGTH) {
638 pkt->size -= 2;
641 ty->ac3_pkt_size = pkt->size;
653 static int ty_read_packet(AVFormatContext *s, AVPacket *pkt)
685 ret = demux_video(s, rec, pkt);
688 ret = demux_audio(s, rec, pkt);