• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iserver/libav-0.8.8/libavformat/

Lines Matching defs:pes

342     MpegTSPESFilter *pes;
354 pes = &filter->u.pes_filter;
355 pes->pes_cb = pes_cb;
356 pes->opaque = opaque;
368 PESContext *pes = filter->u.pes_filter.opaque;
369 av_freep(&pes->buffer);
577 static int mpegts_set_stream_info(AVStream *st, PESContext *pes,
581 st->priv_data = pes;
585 pes->st = st;
586 pes->stream_type = stream_type;
588 av_log(pes->stream, AV_LOG_DEBUG,
590 st->index, pes->stream_type, pes->pid, (char*)&prog_reg_desc);
592 st->codec->codec_tag = pes->stream_type;
594 mpegts_find_stream_type(st, pes->stream_type, ISO_types);
597 mpegts_find_stream_type(st, pes->stream_type, HDMV_types);
598 if (pes->stream_type == 0x83) {
606 memcpy(sub_pes, pes, sizeof(*sub_pes));
608 sub_st = avformat_new_stream(pes->stream, NULL);
614 sub_st->id = pes->pid;
620 sub_pes->sub_st = pes->sub_st = sub_st;
624 mpegts_find_stream_type(st, pes->stream_type, MISC_types);
629 static void new_pes_packet(PESContext *pes, AVPacket *pkt)
634 pkt->data = pes->buffer;
635 pkt->size = pes->data_index;
637 if(pes->total_size != MAX_PES_PAYLOAD &&
638 pes->pes_header_size + pes->data_index != pes->total_size + PES_START_SIZE) {
639 av_log(pes->stream, AV_LOG_WARNING, "PES packet size mismatch\n");
640 pes->flags |= AV_PKT_FLAG_CORRUPT;
645 if (pes->sub_st && pes->stream_type == 0x83 && pes->extended_stream_id == 0x76)
646 pkt->stream_index = pes->sub_st->index;
648 pkt->stream_index = pes->st->index;
649 pkt->pts = pes->pts;
650 pkt->dts = pes->dts;
652 pkt->pos = pes->ts_packet_pos;
653 pkt->flags = pes->flags;
656 pes->pts = AV_NOPTS_VALUE;
657 pes->dts = AV_NOPTS_VALUE;
658 pes->buffer = NULL;
659 pes->data_index = 0;
660 pes->flags = 0;
676 static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size)
731 pes->dts = dts;
733 pes->pts = cts;
736 avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res);
746 PESContext *pes = filter->u.pes_filter.opaque;
747 MpegTSContext *ts = pes->ts;
755 if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
756 new_pes_packet(pes, ts->pkt);
759 pes->state = MPEGTS_HEADER;
760 pes->data_index = 0;
761 pes->ts_packet_pos = pos;
765 switch(pes->state) {
767 len = PES_START_SIZE - pes->data_index;
770 memcpy(pes->header + pes->data_index, p, len);
771 pes->data_index += len;
774 if (pes->data_index == PES_START_SIZE) {
777 if (pes->header[0] == 0x00 && pes->header[1] == 0x00 &&
778 pes->header[2] == 0x01) {
780 code = pes->header[3] | 0x100;
781 av_dlog(pes->stream, "pid=%x pes_code=%#x\n", pes->pid, code);
783 if ((pes->st && pes->st->discard == AVDISCARD_ALL) ||
788 if (!pes->st) {
789 pes->st = avformat_new_stream(ts->stream, NULL);
790 if (!pes->st)
792 pes->st->id = pes->pid;
793 mpegts_set_stream_info(pes->st, pes, 0, 0);
796 pes->total_size = AV_RB16(pes->header + 4);
799 if (!pes->total_size)
800 pes->total_size = MAX_PES_PAYLOAD;
802 /* allocate pes buffer */
803 pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
804 if (!pes->buffer)
811 pes->state = MPEGTS_PESHEADER;
812 if (pes->st->codec->codec_id == CODEC_ID_NONE) {
813 av_dlog(pes->stream, "pid=%x stream_type=%x probing\n",
814 pes->pid, pes->stream_type);
815 pes->st->codec->codec_id = CODEC_ID_PROBE;
818 pes->state = MPEGTS_PAYLOAD;
819 pes->data_index = 0;
825 pes->state = MPEGTS_SKIP;
833 len = PES_HEADER_SIZE - pes->data_index;
838 memcpy(pes->header + pes->data_index, p, len);
839 pes->data_index += len;
842 if (pes->data_index == PES_HEADER_SIZE) {
843 pes->pes_header_size = pes->header[8] + 9;
844 pes->state = MPEGTS_PESHEADER_FILL;
848 len = pes->pes_header_size - pes->data_index;
853 memcpy(pes->header + pes->data_index, p, len);
854 pes->data_index += len;
857 if (pes->data_index == pes->pes_header_size) {
861 flags = pes->header[7];
862 r = pes->header + 9;
863 pes->pts = AV_NOPTS_VALUE;
864 pes->dts = AV_NOPTS_VALUE;
866 pes->dts = pes->pts = ff_parse_pes_pts(r);
869 pes->pts = ff_parse_pes_pts(r);
871 pes->dts = ff_parse_pes_pts(r);
874 pes->extended_stream_id = -1;
882 (r + 2) <= (pes->header + pes->pes_header_size)) {
885 pes->extended_stream_id = r[1];
890 pes->state = MPEGTS_PAYLOAD;
891 pes->data_index = 0;
892 if (pes->stream_type == 0x12 && buf_size > 0) {
893 int sl_header_bytes = read_sl_header(pes, &pes->sl, p, buf_size);
894 pes->pes_header_size += sl_header_bytes;
901 if (buf_size > 0 && pes->buffer) {
902 if (pes->data_index > 0 && pes->data_index+buf_size > pes->total_size) {
903 new_pes_packet(pes, ts->pkt);
904 pes->total_size = MAX_PES_PAYLOAD;
905 pes->buffer = av_malloc(pes->total_size+FF_INPUT_BUFFER_PADDING_SIZE);
906 if (!pes->buffer)
909 } else if (pes->data_index == 0 && buf_size > pes->total_size) {
910 // pes packet size is < ts size packet and pes data is padded with 0xff
912 buf_size = pes->total_size;
914 memcpy(pes->buffer+pes->data_index, p, buf_size);
915 pes->data_index += buf_size;
922 * in the pes header, i.e. not counting the first PES_START_SIZE bytes */
923 if (!ts->stop_parse && pes->total_size < MAX_PES_PAYLOAD &&
924 pes->pes_header_size + pes->data_index == pes->total_size + PES_START_SIZE) {
926 new_pes_packet(pes, ts->pkt);
941 PESContext *pes;
944 pes = av_mallocz(sizeof(PESContext));
945 if (!pes)
947 pes->ts = ts;
948 pes->stream = ts->stream;
949 pes->pid = pid;
950 pes->pcr_pid = pcr_pid;
951 pes->state = MPEGTS_SKIP;
952 pes->pts = AV_NOPTS_VALUE;
953 pes->dts = AV_NOPTS_VALUE;
954 tss = mpegts_open_pes_filter(ts, pid, mpegts_push_data, pes);
956 av_free(pes);
959 return pes;
1198 PESContext *pes;
1206 pes = ts->pids[pid]->u.pes_filter.opaque;
1207 st = pes->st;
1212 pes->sl = mp4_descr[i].sl;
1367 PESContext *pes;
1436 pes = NULL;
1446 pes = ts->pids[pid]->u.pes_filter.opaque;
1447 if (!pes->st) {
1448 pes->st = avformat_new_stream(pes->stream, NULL);
1449 pes->st->id = pes->pid;
1451 st = pes->st;
1454 pes = add_pes_stream(ts, pid, pcr_pid);
1455 if (pes) {
1456 st = avformat_new_stream(pes->stream, NULL);
1457 st->id = pes->pid;
1473 if (pes && !pes->stream_type)
1474 mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc);
1491 if (pes && prog_reg_desc == AV_RL32("HDMV") && stream_type == 0x83 && pes->sub_st) {
1492 ff_program_add_stream_index(ts->stream, h->id, pes->sub_st->index);
1493 pes->sub_st->codec->codec_tag = st->codec->codec_tag;
1781 /* seek detected, flush pes buffer */
1785 PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
1786 av_freep(&pes->buffer);
1787 pes->data_index = 0;
1788 pes->state = MPEGTS_SKIP; /* skip until pes header */
2022 /* flush pes data left */
2025 PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
2026 if (pes->state == MPEGTS_PAYLOAD && pes->data_index > 0) {
2027 new_pes_packet(pes, pkt);
2028 pes->state = MPEGTS_SKIP;