static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)

{

    MpegTSContext *ts = filter->u.section_filter.opaque;

    SectionHeader h1, *h = &h1;

    const uint8_t *p, *p_end, *desc_list_end, *desc_end;

    int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;

    char *name, *provider_name;



    av_dlog(ts->stream, "SDT:\n");

    hex_dump_debug(ts->stream, section, section_len);



    p_end = section + section_len - 4;

    p     = section;

    if (parse_section_header(h, &p, p_end) < 0)

        return;

    if (h->tid != SDT_TID)

        return;

    if (ts->skip_changes)

        return;

    onid = get16(&p, p_end);

    if (onid < 0)

        return;

    val = get8(&p, p_end);

    if (val < 0)

        return;

    for (;;) {

        sid = get16(&p, p_end);

        if (sid < 0)

            break;

        val = get8(&p, p_end);

        if (val < 0)

            break;

        desc_list_len = get16(&p, p_end);

        if (desc_list_len < 0)

            break;

        desc_list_len &= 0xfff;

        desc_list_end  = p + desc_list_len;

        if (desc_list_end > p_end)

            break;

        for (;;) {

            desc_tag = get8(&p, desc_list_end);

            if (desc_tag < 0)

                break;

            desc_len = get8(&p, desc_list_end);

            desc_end = p + desc_len;

            if (desc_end > desc_list_end)

                break;



            av_dlog(ts->stream, "tag: 0x%02x len=%d\n",

                    desc_tag, desc_len);



            switch (desc_tag) {

            case 0x48:

                service_type = get8(&p, p_end);

                if (service_type < 0)

                    break;

                provider_name = getstr8(&p, p_end);

                if (!provider_name)

                    break;

                name = getstr8(&p, p_end);

                if (name) {

                    AVProgram *program = av_new_program(ts->stream, sid);

                    if (program) {

                        av_dict_set(&program->metadata, "service_name", name, 0);

                        av_dict_set(&program->metadata, "service_provider",

                                    provider_name, 0);

                    }

                }

                av_free(name);

                av_free(provider_name);

                break;

            default:

                break;

            }

            p = desc_end;

        }

        p = desc_list_end;

    }

}

static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len)

{

    MpegTSContext *ts = filter->u.section_filter.opaque;

    SectionHeader h1, *h = &h1;

    const uint8_t *p, *p_end, *desc_list_end, *desc_end;

    int onid, val, sid, desc_list_len, desc_tag, desc_len, service_type;

    char *name, *provider_name;



    av_dlog(ts->stream, "SDT:\n");

    hex_dump_debug(ts->stream, section, section_len);



    p_end = section + section_len - 4;

    p     = section;

    if (parse_section_header(h, &p, p_end) < 0)

        return;

    if (h->tid != SDT_TID)

        return;

    if (ts->skip_changes)

        return;

    onid = get16(&p, p_end);

    if (onid < 0)

        return;

    val = get8(&p, p_end);

    if (val < 0)

        return;

    for (;;) {

        sid = get16(&p, p_end);

        if (sid < 0)

            break;

        val = get8(&p, p_end);

        if (val < 0)

            break;

        desc_list_len = get16(&p, p_end);

        if (desc_list_len < 0)

            break;

        desc_list_len &= 0xfff;

        desc_list_end  = p + desc_list_len;

        if (desc_list_end > p_end)

            break;

        for (;;) {

            desc_tag = get8(&p, desc_list_end);

            if (desc_tag < 0)

                break;

            desc_len = get8(&p, desc_list_end);

            desc_end = p + desc_len;

            if (desc_end > desc_list_end)

                break;



            av_dlog(ts->stream, "tag: 0x%02x len=%d\n",

                    desc_tag, desc_len);



            switch (desc_tag) {

            case 0x48:

                service_type = get8(&p, p_end);

                if (service_type < 0)

                    break;

                provider_name = getstr8(&p, p_end);

                if (!provider_name)

                    break;

                name = getstr8(&p, p_end);

                if (name) {

                    AVProgram *program = av_new_program(ts->stream, sid);

                    if (program) {

                        av_dict_set(&program->metadata, "service_name", name, 0);

                        av_dict_set(&program->metadata, "service_provider",

                                    provider_name, 0);

                    }

                }

                av_free(name);

                av_free(provider_name);

                break;

            default:

                break;

            }

            p = desc_end;

        }

        p = desc_list_end;

    }

}

static void FUNC_0(MpegTSFilter *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    MpegTSContext *ts = VAR_0->u.section_filter.opaque;

    SectionHeader h1, *h = &h1;

    const uint8_t *VAR_3, *p_end, *desc_list_end, *desc_end;

    int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;

    char *VAR_11, *VAR_12;



    av_dlog(ts->stream, "SDT:\n");

    hex_dump_debug(ts->stream, VAR_1, VAR_2);



    p_end = VAR_1 + VAR_2 - 4;

    VAR_3     = VAR_1;

    if (parse_section_header(h, &VAR_3, p_end) < 0)

        return;

    if (h->tid != SDT_TID)

        return;

    if (ts->skip_changes)

        return;

    VAR_4 = get16(&VAR_3, p_end);

    if (VAR_4 < 0)

        return;

    VAR_5 = get8(&VAR_3, p_end);

    if (VAR_5 < 0)

        return;

    for (;;) {

        VAR_6 = get16(&VAR_3, p_end);

        if (VAR_6 < 0)

            break;

        VAR_5 = get8(&VAR_3, p_end);

        if (VAR_5 < 0)

            break;

        VAR_7 = get16(&VAR_3, p_end);

        if (VAR_7 < 0)

            break;

        VAR_7 &= 0xfff;

        desc_list_end  = VAR_3 + VAR_7;

        if (desc_list_end > p_end)

            break;

        for (;;) {

            VAR_8 = get8(&VAR_3, desc_list_end);

            if (VAR_8 < 0)

                break;

            VAR_9 = get8(&VAR_3, desc_list_end);

            desc_end = VAR_3 + VAR_9;

            if (desc_end > desc_list_end)

                break;



            av_dlog(ts->stream, "tag: 0x%02x len=%d\n",

                    VAR_8, VAR_9);



            switch (VAR_8) {

            case 0x48:

                VAR_10 = get8(&VAR_3, p_end);

                if (VAR_10 < 0)

                    break;

                VAR_12 = getstr8(&VAR_3, p_end);

                if (!VAR_12)

                    break;

                VAR_11 = getstr8(&VAR_3, p_end);

                if (VAR_11) {

                    AVProgram *program = av_new_program(ts->stream, VAR_6);

                    if (program) {

                        av_dict_set(&program->metadata, "service_name", VAR_11, 0);

                        av_dict_set(&program->metadata, "service_provider",

                                    VAR_12, 0);

                    }

                }

                av_free(VAR_11);

                av_free(VAR_12);

                break;

            default:

                break;

            }

            VAR_3 = desc_end;

        }

        VAR_3 = desc_list_end;

    }

}

static void FUNC_0(MpegTSFilter *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ MpegTSContext *ts = VAR_0->u.section_filter.opaque; SectionHeader h1, *h = &h1; const uint8_t *VAR_3, *p_end, *desc_list_end, *desc_end; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; char *VAR_11, *VAR_12; av_dlog(ts->stream, "SDT:\n"); hex_dump_debug(ts->stream, VAR_1, VAR_2); p_end = VAR_1 + VAR_2 - 4; VAR_3     = VAR_1; if (parse_section_header(h, &VAR_3, p_end) < 0)
return; if (h->tid != SDT_TID)
return; if (ts->skip_changes)
return; VAR_4 = get16(&VAR_3, p_end); if (VAR_4 < 0)
return; VAR_5 = get8(&VAR_3, p_end); if (VAR_5 < 0)
return; for (;;) { VAR_6 = get16(&VAR_3, p_end); if (VAR_6 < 0)
break; VAR_5 = get8(&VAR_3, p_end); if (VAR_5 < 0)
break; VAR_7 = get16(&VAR_3, p_end); if (VAR_7 < 0)
break; VAR_7 &= 0xfff; desc_list_end  = VAR_3 + VAR_7; if (desc_list_end > p_end)
break; for (;;) { VAR_8 = get8(&VAR_3, desc_list_end); if (VAR_8 < 0)
break; VAR_9 = get8(&VAR_3, desc_list_end); desc_end = VAR_3 + VAR_9; if (desc_end > desc_list_end)
break; av_dlog(ts->stream, "tag: 0x%02x len=%d\n",
VAR_8, VAR_9); switch (VAR_8) { case 0x48:
VAR_10 = get8(&VAR_3, p_end); if (VAR_10 < 0)
break; VAR_12 = getstr8(&VAR_3, p_end); if (!VAR_12)
break; VAR_11 = getstr8(&VAR_3, p_end); if (VAR_11) { AVProgram *program = av_new_program(ts->stream, VAR_6); if (program) { av_dict_set(&program->metadata, "service_name", VAR_11, 0); av_dict_set(&program->metadata, "service_provider",
VAR_12, 0); } } av_free(VAR_11); av_free(VAR_12); break; default:
break; } VAR_3 = desc_end; } VAR_3 = desc_list_end; } }