亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? mpegts.c

?? mediastreamer2是開(kāi)源的網(wǎng)絡(luò)傳輸媒體流的庫(kù)
?? C
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
/* * MPEG2 transport stream (aka DVB) demuxer * Copyright (c) 2002-2003 Fabrice Bellard. * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */#include "avformat.h"#include "crc.h"#include "mpegts.h"//#define DEBUG_SI//#define DEBUG_SEEK/* 1.0 second at 24Mbit/s */#define MAX_SCAN_PACKETS 32000/* maximum size in which we look for synchronisation if   synchronisation is lost */#define MAX_RESYNC_SIZE 4096typedef struct PESContext PESContext;static PESContext* add_pes_stream(MpegTSContext *ts, int pid, int pcr_pid, int stream_type);static AVStream* new_pes_av_stream(PESContext *pes, uint32_t code);extern void av_set_program_name(AVProgram *program, char *provider_name, char *name);extern void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);enum MpegTSFilterType {    MPEGTS_PES,    MPEGTS_SECTION,};typedef struct MpegTSFilter MpegTSFilter;typedef void PESCallback(MpegTSFilter *f, const uint8_t *buf, int len, int is_start);typedef struct MpegTSPESFilter {    PESCallback *pes_cb;    void *opaque;} MpegTSPESFilter;typedef void SectionCallback(MpegTSFilter *f, const uint8_t *buf, int len);typedef void SetServiceCallback(void *opaque, int ret);typedef struct MpegTSSectionFilter {    int section_index;    int section_h_size;    uint8_t *section_buf;    int check_crc:1;    int end_of_section_reached:1;    SectionCallback *section_cb;    void *opaque;} MpegTSSectionFilter;struct MpegTSFilter {    int pid;    int last_cc; /* last cc code (-1 if first packet) */    enum MpegTSFilterType type;    union {        MpegTSPESFilter pes_filter;        MpegTSSectionFilter section_filter;    } u;};#define MAX_PIDS_PER_PROGRAM 64typedef struct {    unsigned int id; //program id/service id    unsigned int nb_pids;    unsigned int pids[MAX_PIDS_PER_PROGRAM];} Program_t;struct MpegTSContext {    /* user data */    AVFormatContext *stream;    /** raw packet size, including FEC if present            */    int raw_packet_size;    /** if true, all pids are analyzed to find streams       */    int auto_guess;    /** compute exact PCR for each transport stream packet   */    int mpeg2ts_compute_pcr;    int64_t cur_pcr;    /**< used to estimate the exact PCR  */    int pcr_incr;       /**< used to estimate the exact PCR  */    /* data needed to handle file based ts */    /** stop parsing loop                                    */    int stop_parse;    /** packet containing Audio/Video data                   */    AVPacket *pkt;    /******************************************/    /* private mpegts data */    /* scan context */    /** structure to keep track of Program->pids mapping     */    unsigned int nb_prg;    Program_t *prg;    /** filters for various streams specified by PMT + for the PAT and PMT */    MpegTSFilter *pids[NB_PID_MAX];};/* TS stream handling */enum MpegTSState {    MPEGTS_HEADER = 0,    MPEGTS_PESHEADER_FILL,    MPEGTS_PAYLOAD,    MPEGTS_SKIP,};/* enough for PES header + length */#define PES_START_SIZE 9#define MAX_PES_HEADER_SIZE (9 + 255)struct PESContext {    int pid;    int pcr_pid; /**< if -1 then all packets containing PCR are considered */    int stream_type;    MpegTSContext *ts;    AVFormatContext *stream;    AVStream *st;    enum MpegTSState state;    /* used to get the format */    int data_index;    int total_size;    int pes_header_size;    int64_t pts, dts;    uint8_t header[MAX_PES_HEADER_SIZE];};extern AVInputFormat mpegts_demuxer;static void clear_program(MpegTSContext *ts, unsigned int programid){    int i;    for(i=0; i<ts->nb_prg; i++)        if(ts->prg[i].id == programid)            ts->prg[i].nb_pids = 0;}static void clear_programs(MpegTSContext *ts){    av_freep(&ts->prg);    ts->nb_prg=0;}static void add_pat_entry(MpegTSContext *ts, unsigned int programid){    Program_t *p;    void *tmp = av_realloc(ts->prg, (ts->nb_prg+1)*sizeof(Program_t));    if(!tmp)        return;    ts->prg = tmp;    p = &ts->prg[ts->nb_prg];    p->id = programid;    p->nb_pids = 0;    ts->nb_prg++;}static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid, unsigned int pid){    int i;    Program_t *p = NULL;    for(i=0; i<ts->nb_prg; i++) {        if(ts->prg[i].id == programid) {            p = &ts->prg[i];            break;        }    }    if(!p)        return;    if(p->nb_pids >= MAX_PIDS_PER_PROGRAM)        return;    p->pids[p->nb_pids++] = pid;}/** * \brief discard_pid() decides if the pid is to be discarded according *                      to caller's programs selection * \param ts    : - TS context * \param pid   : - pid * \return 1 if the pid is only comprised in programs that have .discard=AVDISCARD_ALL *         0 otherwise */static int discard_pid(MpegTSContext *ts, unsigned int pid){    int i, j, k;    int used = 0, discarded = 0;    Program_t *p;    for(i=0; i<ts->nb_prg; i++) {        p = &ts->prg[i];        for(j=0; j<p->nb_pids; j++) {            if(p->pids[j] != pid)                continue;            //is program with id p->id set to be discarded?            for(k=0; k<ts->stream->nb_programs; k++) {                if(ts->stream->programs[k]->id == p->id) {                    if(ts->stream->programs[k]->discard == AVDISCARD_ALL)                        discarded++;                    else                        used++;                }            }        }    }    return (!used && discarded);}/** *  Assembles PES packets out of TS packets, and then calls the "section_cb" *  function when they are complete. */static void write_section_data(AVFormatContext *s, MpegTSFilter *tss1,                               const uint8_t *buf, int buf_size, int is_start){    MpegTSSectionFilter *tss = &tss1->u.section_filter;    int len;    if (is_start) {        memcpy(tss->section_buf, buf, buf_size);        tss->section_index = buf_size;        tss->section_h_size = -1;        tss->end_of_section_reached = 0;    } else {        if (tss->end_of_section_reached)            return;        len = 4096 - tss->section_index;        if (buf_size < len)            len = buf_size;        memcpy(tss->section_buf + tss->section_index, buf, len);        tss->section_index += len;    }    /* compute section length if possible */    if (tss->section_h_size == -1 && tss->section_index >= 3) {        len = (AV_RB16(tss->section_buf + 1) & 0xfff) + 3;        if (len > 4096)            return;        tss->section_h_size = len;    }    if (tss->section_h_size != -1 && tss->section_index >= tss->section_h_size) {        tss->end_of_section_reached = 1;        if (!tss->check_crc ||            av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1,                   tss->section_buf, tss->section_h_size) == 0)            tss->section_cb(tss1, tss->section_buf, tss->section_h_size);    }}static MpegTSFilter *mpegts_open_section_filter(MpegTSContext *ts, unsigned int pid,                                         SectionCallback *section_cb, void *opaque,                                         int check_crc){    MpegTSFilter *filter;    MpegTSSectionFilter *sec;#ifdef DEBUG_SI    av_log(ts->stream, AV_LOG_DEBUG, "Filter: pid=0x%x\n", pid);#endif    if (pid >= NB_PID_MAX || ts->pids[pid])        return NULL;    filter = av_mallocz(sizeof(MpegTSFilter));    if (!filter)        return NULL;    ts->pids[pid] = filter;    filter->type = MPEGTS_SECTION;    filter->pid = pid;    filter->last_cc = -1;    sec = &filter->u.section_filter;    sec->section_cb = section_cb;    sec->opaque = opaque;    sec->section_buf = av_malloc(MAX_SECTION_SIZE);    sec->check_crc = check_crc;    if (!sec->section_buf) {        av_free(filter);        return NULL;    }    return filter;}static MpegTSFilter *mpegts_open_pes_filter(MpegTSContext *ts, unsigned int pid,                                     PESCallback *pes_cb,                                     void *opaque){    MpegTSFilter *filter;    MpegTSPESFilter *pes;    if (pid >= NB_PID_MAX || ts->pids[pid])        return NULL;    filter = av_mallocz(sizeof(MpegTSFilter));    if (!filter)        return NULL;    ts->pids[pid] = filter;    filter->type = MPEGTS_PES;    filter->pid = pid;    filter->last_cc = -1;    pes = &filter->u.pes_filter;    pes->pes_cb = pes_cb;    pes->opaque = opaque;    return filter;}static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter){    int pid;    pid = filter->pid;    if (filter->type == MPEGTS_SECTION)        av_freep(&filter->u.section_filter.section_buf);    else if (filter->type == MPEGTS_PES)        av_freep(&filter->u.pes_filter.opaque);    av_free(filter);    ts->pids[pid] = NULL;}static int analyze(const uint8_t *buf, int size, int packet_size, int *index){    int stat[packet_size];    int i;    int x=0;    int best_score=0;    memset(stat, 0, packet_size*sizeof(int));    for(x=i=0; i<size; i++){        if(buf[i] == 0x47){            stat[x]++;            if(stat[x] > best_score){                best_score= stat[x];                if(index) *index= x;            }        }        x++;        if(x == packet_size) x= 0;    }    return best_score;}/* autodetect fec presence. Must have at least 1024 bytes  */static int get_packet_size(const uint8_t *buf, int size){    int score, fec_score, dvhs_score;    if (size < (TS_FEC_PACKET_SIZE * 5 + 1))        return -1;    score    = analyze(buf, size, TS_PACKET_SIZE, NULL);    dvhs_score    = analyze(buf, size, TS_DVHS_PACKET_SIZE, NULL);    fec_score= analyze(buf, size, TS_FEC_PACKET_SIZE, NULL);//    av_log(NULL, AV_LOG_DEBUG, "score: %d, dvhs_score: %d, fec_score: %d \n", score, dvhs_score, fec_score);    if     (score > fec_score && score > dvhs_score) return TS_PACKET_SIZE;    else if(dvhs_score > score && dvhs_score > fec_score) return TS_DVHS_PACKET_SIZE;    else if(score < fec_score && dvhs_score < fec_score) return TS_FEC_PACKET_SIZE;    else                       return -1;}typedef struct SectionHeader {    uint8_t tid;    uint16_t id;    uint8_t version;    uint8_t sec_num;    uint8_t last_sec_num;} SectionHeader;static inline int get8(const uint8_t **pp, const uint8_t *p_end){    const uint8_t *p;    int c;    p = *pp;    if (p >= p_end)        return -1;    c = *p++;    *pp = p;    return c;}static inline int get16(const uint8_t **pp, const uint8_t *p_end){    const uint8_t *p;    int c;    p = *pp;    if ((p + 1) >= p_end)        return -1;    c = AV_RB16(p);    p += 2;    *pp = p;    return c;}/* read and allocate a DVB string preceeded by its length */static char *getstr8(const uint8_t **pp, const uint8_t *p_end){    int len;    const uint8_t *p;    char *str;    p = *pp;    len = get8(&p, p_end);    if (len < 0)        return NULL;    if ((p + len) > p_end)        return NULL;    str = av_malloc(len + 1);    if (!str)        return NULL;    memcpy(str, p, len);    str[len] = '\0';    p += len;    *pp = p;    return str;}static int parse_section_header(SectionHeader *h,                                const uint8_t **pp, const uint8_t *p_end){    int val;    val = get8(pp, p_end);    if (val < 0)        return -1;    h->tid = val;    *pp += 2;    val = get16(pp, p_end);    if (val < 0)        return -1;    h->id = val;    val = get8(pp, p_end);    if (val < 0)        return -1;    h->version = (val >> 1) & 0x1f;    val = get8(pp, p_end);    if (val < 0)        return -1;    h->sec_num = val;    val = get8(pp, p_end);    if (val < 0)        return -1;    h->last_sec_num = val;    return 0;}static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len){    MpegTSContext *ts = filter->u.section_filter.opaque;    SectionHeader h1, *h = &h1;    PESContext *pes;    AVStream *st;    const uint8_t *p, *p_end, *desc_list_end, *desc_end;    int program_info_length, pcr_pid, pid, stream_type;    int desc_list_len, desc_len, desc_tag;    int comp_page = 0, anc_page = 0; /* initialize to kill warnings */    char language[4] = {0}; /* initialize to kill warnings */#ifdef DEBUG_SI    av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len);    av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len);#endif    p_end = section + section_len - 4;    p = section;    if (parse_section_header(h, &p, p_end) < 0)        return;#ifdef DEBUG_SI    av_log(ts->stream, AV_LOG_DEBUG, "sid=0x%x sec_num=%d/%d\n",           h->id, h->sec_num, h->last_sec_num);#endif    if (h->tid != PMT_TID)        return;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产综合久久福利软件| 麻豆国产欧美一区二区三区| 亚洲国产日韩综合久久精品| 另类小说图片综合网| 国产精品 欧美精品| 在线观看日产精品| 精品三级av在线| 一区二区三区中文在线观看| 男男gaygay亚洲| 99久久精品国产一区| 91精品国产一区二区| 中文字幕的久久| 三级久久三级久久久| 国产成人高清视频| 7777精品伊人久久久大香线蕉经典版下载| 337p粉嫩大胆噜噜噜噜噜91av | 六月丁香综合在线视频| 成人动漫一区二区在线| 91精品国产91综合久久蜜臀| 国产精品久久99| 乱中年女人伦av一区二区| 91亚洲国产成人精品一区二三| 日韩一区二区在线看| 亚洲免费观看高清| 国产麻豆精品视频| 欧美日本一道本在线视频| 国产精品免费av| 麻豆精品国产91久久久久久| 色一情一伦一子一伦一区| 久久久99久久| 免费不卡在线观看| 在线观看国产一区二区| 国产精品美女视频| 精品一区二区久久久| 欧美三级电影精品| 国产精品国产三级国产普通话蜜臀 | 国产在线看一区| 欧美男同性恋视频网站| 成人欧美一区二区三区1314| 国产自产视频一区二区三区| 欧美一区二区在线看| 亚洲欧美偷拍三级| 成人动漫在线一区| 国产亚洲综合在线| 老色鬼精品视频在线观看播放| 在线观看成人免费视频| 国产精品久久久久四虎| 国产成人免费视频网站| 久久综合九色综合欧美亚洲| 美女视频免费一区| 91精品国产免费| 日韩精品三区四区| 欧美顶级少妇做爰| 亚洲成av人**亚洲成av**| 欧美在线一区二区| 亚洲激情图片一区| 色婷婷综合久久久中文一区二区| 中文字幕第一区二区| 粉嫩绯色av一区二区在线观看 | 国产精品亚洲成人| 欧美精品一区二区三区高清aⅴ| 日韩精品一区第一页| 欧美日韩在线三级| 亚洲成人福利片| 欧美日韩亚洲综合在线| 亚洲国产精品自拍| 欧美日韩国产一级二级| 视频一区在线播放| 欧美一区二区三区的| 麻豆精品蜜桃视频网站| 欧美白人最猛性xxxxx69交| 久久精品av麻豆的观看方式| 日韩免费视频一区| 国模大尺度一区二区三区| 久久综合色之久久综合| 国产永久精品大片wwwapp | av男人天堂一区| 亚洲欧美在线高清| 欧美在线一二三| 亚洲国产va精品久久久不卡综合| 欧美性感一区二区三区| 偷拍一区二区三区| 日韩精品中午字幕| 国产黄色精品网站| 一色桃子久久精品亚洲| 在线视频一区二区三| 亚洲成人免费影院| 精品日韩欧美在线| 国产aⅴ综合色| 日韩久久一区二区| 欧美性猛交一区二区三区精品| 天堂影院一区二区| 精品日韩99亚洲| 久久久亚洲精品石原莉奈| 高清免费成人av| 一区二区在线免费观看| 欧美日本韩国一区| 国产在线一区二区综合免费视频| 国产欧美日韩卡一| 在线观看不卡一区| 久久er精品视频| 国产精品国产精品国产专区不蜜| 欧洲精品视频在线观看| 日本不卡一区二区| 国产欧美一区二区精品仙草咪| 91麻豆swag| 麻豆精品在线看| 中文字幕一区二区三区在线不卡 | 一区二区三区在线视频播放| 欧美精品一卡二卡| 国产成人精品亚洲777人妖| 亚洲一区二区视频在线| 久久亚洲一区二区三区明星换脸| 91小视频免费看| 久久精品噜噜噜成人av农村| 国产精品久久久久久久久免费丝袜 | 国产精品视频线看| 欧美日韩精品三区| 国产成人精品aa毛片| 亚洲成人手机在线| 国产精品色哟哟| 欧美精选午夜久久久乱码6080| 国产精品1024| 爽好多水快深点欧美视频| 国产精品毛片大码女人| 欧美一区二区三区视频免费| 成人av一区二区三区| 日韩精品亚洲一区| 自拍偷自拍亚洲精品播放| 日韩欧美你懂的| 在线视频欧美区| 成人午夜视频在线观看| 伦理电影国产精品| 亚洲午夜精品一区二区三区他趣| 久久一区二区视频| 欧美人伦禁忌dvd放荡欲情| 高清成人在线观看| 人人狠狠综合久久亚洲| 一区二区三区四区视频精品免费 | 国产精品18久久久久久久久| 亚洲国产精品久久不卡毛片| 亚洲国产成人在线| 欧美不卡一区二区三区四区| 欧美性感一类影片在线播放| 国产91清纯白嫩初高中在线观看 | 精品久久久久久最新网址| 91九色02白丝porn| 成+人+亚洲+综合天堂| 精品在线视频一区| 日韩国产精品久久| 亚洲一卡二卡三卡四卡五卡| 国产精品福利影院| 国产婷婷色一区二区三区在线| 91精品国产高清一区二区三区| 欧美视频一二三区| 色婷婷综合久久久中文一区二区| 国产suv一区二区三区88区| 91精品国模一区二区三区| 色狠狠色噜噜噜综合网| 99综合电影在线视频| 成人精品免费网站| 国产v综合v亚洲欧| 国产黄色精品网站| 国产精品夜夜爽| 国产裸体歌舞团一区二区| 久久97超碰色| 麻豆91在线播放| 日韩中文字幕麻豆| 日欧美一区二区| 婷婷综合五月天| 亚洲大片在线观看| 五月激情六月综合| 午夜视频一区二区| 丝袜a∨在线一区二区三区不卡| 亚洲丶国产丶欧美一区二区三区| 亚洲精品日产精品乱码不卡| 亚洲欧美在线观看| 亚洲精选在线视频| 亚洲一区二区在线播放相泽 | 欧美日韩久久不卡| 欧美日韩亚洲国产综合| 欧美日韩精品三区| 91精品国产综合久久久久久久久久 | 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 亚洲视频 欧洲视频| 亚洲欧美日韩国产综合| 亚洲欧美日韩一区二区| 亚洲精品国产无天堂网2021 | 欧美日韩三级一区二区| 欧美日本一区二区| 日韩一区二区在线免费观看| 日韩精品一区国产麻豆| 337p粉嫩大胆色噜噜噜噜亚洲| 久久精品视频在线看| 国产精品萝li| 一区二区三区蜜桃网| 图片区小说区区亚洲影院| 蜜臂av日日欢夜夜爽一区| 激情综合五月天| 成人三级伦理片|