| 2851 | } |
| 2852 | |
| 2853 | static void eit_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) |
| 2854 | { |
| 2855 | MpegTSContext *ts = filter->u.section_filter.opaque; |
| 2856 | const uint8_t *p, *p_end; |
| 2857 | SectionHeader h1, *h = &h1; |
| 2858 | |
| 2859 | /* |
| 2860 | * Sometimes we receive EPG packets but SDT table do not have |
| 2861 | * eit_pres_following or eit_sched turned on, so we open EPG |
| 2862 | * stream directly here. |
| 2863 | */ |
| 2864 | if (!ts->epg_stream) { |
| 2865 | ts->epg_stream = avformat_new_stream(ts->stream, NULL); |
| 2866 | if (!ts->epg_stream) |
| 2867 | return; |
| 2868 | ts->epg_stream->id = EIT_PID; |
| 2869 | ts->epg_stream->codecpar->codec_type = AVMEDIA_TYPE_DATA; |
| 2870 | ts->epg_stream->codecpar->codec_id = AV_CODEC_ID_EPG; |
| 2871 | } |
| 2872 | |
| 2873 | if (ts->epg_stream->discard == AVDISCARD_ALL) |
| 2874 | return; |
| 2875 | |
| 2876 | p_end = section + section_len - 4; |
| 2877 | p = section; |
| 2878 | |
| 2879 | if (parse_section_header(h, &p, p_end) < 0) |
| 2880 | return; |
| 2881 | if (h->tid < EIT_TID || h->tid > OEITS_END_TID) |
| 2882 | return; |
| 2883 | |
| 2884 | av_log(ts->stream, AV_LOG_TRACE, "EIT: tid received = %.02x\n", h->tid); |
| 2885 | |
| 2886 | /** |
| 2887 | * Service_id 0xFFFF is reserved, it indicates that the current EIT table |
| 2888 | * is scrambled. |
| 2889 | */ |
| 2890 | if (h->id == 0xFFFF) { |
| 2891 | av_log(ts->stream, AV_LOG_TRACE, "Scrambled EIT table received.\n"); |
| 2892 | return; |
| 2893 | } |
| 2894 | |
| 2895 | /** |
| 2896 | * In case we receive an EPG packet before mpegts context is fully |
| 2897 | * initialized. |
| 2898 | */ |
| 2899 | if (!ts->pkt) |
| 2900 | return; |
| 2901 | |
| 2902 | new_data_packet(section, section_len, ts->pkt); |
| 2903 | ts->pkt->stream_index = ts->epg_stream->index; |
| 2904 | ts->stop_parse = 1; |
| 2905 | } |
| 2906 | |
| 2907 | static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) |
| 2908 | { |
nothing calls this directly
no test coverage detected