switch(st->codec.codec_type) { case CODEC_TYPE_AUDIO: if (strlen(st->language) == 3) { *q++ = 0x0a;  *q++ = 4; *q++ = st->language[0]; *q++ = st->language[1]; *q++ = st->language[2]; *q++ = 0;  } break; case CODEC_TYPE_SUBTITLE: { const char *language; language = st->language; if (strlen(language) != 3) language = "eng"; *q++ = 0x59; *q++ = 8; *q++ = language[0]; *q++ = language[1]; *q++ = language[2]; *q++ = 0x10;  put16(&q, 1);  put16(&q, 1);  } break; }
static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service){    //    MpegTSWrite *ts = s->priv_data;    uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr;    int val, stream_type, i;    q = data;    put16(&q, 0xe000 | service->pcr_pid);    program_info_length_ptr = q;    q += 2; /* patched after */    /* put program info here */    val = 0xf000 | (q - program_info_length_ptr - 2);    program_info_length_ptr[0] = val >> 8;    program_info_length_ptr[1] = val;        for(i = 0; i < s->nb_streams; i++) {        AVStream *st = s->streams[i];        MpegTSWriteStream *ts_st = st->priv_data;        switch(st->codec.codec_id) {        case CODEC_ID_MPEG1VIDEO:        case CODEC_ID_MPEG2VIDEO:            stream_type = STREAM_TYPE_VIDEO_MPEG2;            break;        case CODEC_ID_MPEG4:            stream_type = STREAM_TYPE_VIDEO_MPEG4;            break;        case CODEC_ID_H264:            stream_type = STREAM_TYPE_VIDEO_H264;            break;        case CODEC_ID_MP2:        case CODEC_ID_MP3:            stream_type = STREAM_TYPE_AUDIO_MPEG1;            break;        case CODEC_ID_AAC:            stream_type = STREAM_TYPE_AUDIO_AAC;            break;        case CODEC_ID_AC3:            stream_type = STREAM_TYPE_AUDIO_AC3;            break;        default:            stream_type = STREAM_TYPE_PRIVATE_DATA;            break;        }        *q++ = stream_type;        put16(&q, 0xe000 | ts_st->pid);        desc_length_ptr = q;        q += 2; /* patched after */        /* write optional descriptors here */        val = 0xf000 | (q - desc_length_ptr - 2);        desc_length_ptr[0] = val >> 8;        desc_length_ptr[1] = val;    }    mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0,                          data, q - data);}   