MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / pat_cb

Function pat_cb

libavformat/mpegts.c:2765–2851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2763}
2764
2765static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)
2766{
2767 MpegTSContext *ts = filter->u.section_filter.opaque;
2768 MpegTSSectionFilter *tssf = &filter->u.section_filter;
2769 SectionHeader h1, *h = &h1;
2770 const uint8_t *p, *p_end;
2771 int sid, pmt_pid;
2772 int nb_prg = 0;
2773 AVProgram *program;
2774
2775 av_log(ts->stream, AV_LOG_TRACE, "PAT:\n");
2776 hex_dump_debug(ts->stream, section, section_len);
2777
2778 p_end = section + section_len - 4;
2779 p = section;
2780 if (parse_section_header(h, &p, p_end) < 0)
2781 return;
2782 if (h->tid != PAT_TID)
2783 return;
2784 if (!h->current_next)
2785 return;
2786 if (ts->skip_changes)
2787 return;
2788
2789 if (skip_identical(h, tssf))
2790 return;
2791 ts->id = h->id;
2792
2793 for (;;) {
2794 sid = get16(&p, p_end);
2795 if (sid < 0)
2796 break;
2797 pmt_pid = get16(&p, p_end);
2798 if (pmt_pid < 0)
2799 break;
2800 pmt_pid &= 0x1fff;
2801
2802 if (pmt_pid == ts->current_pid)
2803 break;
2804
2805 av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x pid=0x%x\n", sid, pmt_pid);
2806
2807 if (sid == 0x0000) {
2808 /* NIT info */
2809 } else {
2810 MpegTSFilter *fil = ts->pids[pmt_pid];
2811 struct Program *prg;
2812 program = av_new_program(ts->stream, sid);
2813 if (program) {
2814 program->program_num = sid;
2815 program->pmt_pid = pmt_pid;
2816 }
2817 if (fil)
2818 if ( fil->type != MPEGTS_SECTION
2819 || fil->pid != pmt_pid
2820 || fil->u.section_filter.section_cb != pmt_cb)
2821 mpegts_close_filter(ts, ts->pids[pmt_pid]);
2822

Callers

nothing calls this directly

Calls 12

av_logFunction · 0.85
hex_dump_debugFunction · 0.85
parse_section_headerFunction · 0.85
skip_identicalFunction · 0.85
get16Function · 0.85
av_new_programFunction · 0.85
mpegts_close_filterFunction · 0.85
add_programFunction · 0.85
clear_programFunction · 0.85
add_pid_to_programFunction · 0.85
clear_avprogramFunction · 0.85

Tested by

no test coverage detected