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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mpegts.c

?? ffmpeg移植到symbian的全部源代碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* * 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 "libavutil/crc.h"#include "avformat.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 4096#define REGISTRATION_DESCRIPTOR 5typedef 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;    unsigned int check_crc:1;    unsigned 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;    int pos47;    /** 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);    av_free(filter);    ts->pids[pid] = NULL;}static int analyze(const uint8_t *buf, int size, int packet_size, int *index){#ifdef __CW32__    int *stat;#else    int stat[packet_size];#endif    int i;    int x=0;    int best_score=0;#ifdef __CW32__    stat = av_malloc(sizeof(int)*packet_size);#endif    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;    }#ifdef __CW32__    av_free(stat);#endif    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 */    int has_hdmv_descr = 0;#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;    clear_program(ts, h->id);    pcr_pid = get16(&p, p_end) & 0x1fff;    if (pcr_pid < 0)        return;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲国产一区在线观看网站| 日韩免费观看高清完整版 | 久久精品国产久精国产| 成人高清av在线| 日韩欧美成人午夜| 亚洲一二三级电影| 国产美女久久久久| 欧美一级免费大片| 一区二区欧美精品| 国产精品乡下勾搭老头1| 欧美日精品一区视频| 国产精品女主播av| 国产在线麻豆精品观看| 欧美在线你懂得| 亚洲欧美在线另类| 高清在线不卡av| 欧美一区二视频| 一区二区三区精品视频在线| 懂色一区二区三区免费观看| 日韩欧美一区二区不卡| 一区二区三区在线视频观看| 成人av中文字幕| 国产欧美一区二区精品仙草咪| 三级成人在线视频| 欧美视频在线播放| 亚洲麻豆国产自偷在线| 懂色av一区二区三区免费观看| 欧美精品一区二| 久久精品国产77777蜜臀| 欧美一区二区私人影院日本| 亚洲专区一二三| 欧美手机在线视频| 亚洲欧美日韩中文字幕一区二区三区| 成人18视频在线播放| 中文字幕第一区二区| a在线播放不卡| 亚洲日本在线看| 欧美一区二区视频观看视频| 亚洲国产一区二区视频| 欧美亚洲愉拍一区二区| 亚洲成人福利片| 欧美老肥妇做.爰bbww视频| 午夜精品福利一区二区三区av| 欧美日韩免费观看一区三区| 亚洲国产另类av| 欧美日韩国产综合久久| 青青青伊人色综合久久| 精品美女在线观看| 国产精品18久久久久久vr | 欧美久久久久免费| 天天做天天摸天天爽国产一区| 欧美日韩高清一区二区| 另类综合日韩欧美亚洲| 国产农村妇女毛片精品久久麻豆| 粗大黑人巨茎大战欧美成人| 亚洲激情图片小说视频| 欧美日韩激情一区| 极品销魂美女一区二区三区| 中文字幕乱码一区二区免费| 99国产精品久| 麻豆精品在线视频| 久久美女艺术照精彩视频福利播放| 成人免费看的视频| 亚洲v日本v欧美v久久精品| 这里只有精品99re| 成人一级片网址| 首页亚洲欧美制服丝腿| 欧美激情一区二区三区全黄 | 成人免费av网站| 亚洲一区二区三区免费视频| 26uuu亚洲| 欧美三级电影在线观看| 丁香婷婷综合激情五月色| 亚洲综合一区二区| 久久久青草青青国产亚洲免观| 欧美亚一区二区| 懂色一区二区三区免费观看| 日韩国产欧美一区二区三区| 国产欧美精品区一区二区三区| 欧美另类变人与禽xxxxx| www.成人在线| 国产一区二区在线影院| 亚洲精品高清在线观看| 国产色爱av资源综合区| 欧美一区二区性放荡片| 欧美在线视频全部完| 成人精品免费看| 狠狠色丁香久久婷婷综| 日韩精品一级中文字幕精品视频免费观看 | 7799精品视频| 91亚洲精品乱码久久久久久蜜桃| 久久精工是国产品牌吗| 亚洲成在人线在线播放| 亚洲精品日韩综合观看成人91| 国产女人水真多18毛片18精品视频 | 亚洲地区一二三色| 国产精品欧美久久久久一区二区| 日韩视频免费观看高清在线视频| 在线观看区一区二| 99久久精品99国产精品| 风间由美中文字幕在线看视频国产欧美 | 综合精品久久久| 国产亚洲精品aa午夜观看| 日韩一区二区三区四区| 欧美日本韩国一区| 在线视频综合导航| 91福利在线免费观看| 成人性色生活片免费看爆迷你毛片| 狠狠色丁香久久婷婷综合丁香| 日韩va欧美va亚洲va久久| 亚洲第一在线综合网站| 亚洲国产成人av| 天天操天天干天天综合网| 一区二区高清在线| 亚洲二区视频在线| 亚洲国产综合在线| 婷婷成人综合网| 蜜桃av噜噜一区| 国产毛片一区二区| 风间由美一区二区三区在线观看| 国产精品66部| 不卡av免费在线观看| 91性感美女视频| 在线亚洲一区观看| 欧美亚洲一区二区三区四区| 欧美日本一道本在线视频| 9191国产精品| 精品少妇一区二区三区| xfplay精品久久| 国产精品网站一区| 亚洲欧美日韩在线不卡| 亚洲综合激情另类小说区| 亚洲成人av免费| 老司机精品视频导航| 国产电影一区在线| 91美女在线看| 在线播放一区二区三区| 精品久久久久香蕉网| 国产精品理伦片| 亚洲一区二区三区四区不卡| 日本不卡免费在线视频| 国产黑丝在线一区二区三区| 99久久er热在这里只有精品15| 欧美三级电影网| 亚洲精品一区二区三区99| 亚洲欧洲国产专区| 日产国产高清一区二区三区| 国产精品456露脸| 欧美视频在线不卡| 久久久久久久久久久久久久久99 | 97se亚洲国产综合自在线不卡| 欧美性大战久久| 久久毛片高清国产| 亚洲一区二区在线免费观看视频| 久久se精品一区二区| 91在线精品一区二区三区| 3atv在线一区二区三区| 国产精品视频yy9299一区| 性做久久久久久免费观看 | 91官网在线免费观看| 欧美大片免费久久精品三p| 亚洲欧美综合另类在线卡通| 日本成人在线一区| 一本高清dvd不卡在线观看| 日韩欧美激情在线| 一区二区三区精品视频| 国内一区二区在线| 欧美日韩国产三级| 国产精品久久久一区麻豆最新章节| 日本午夜精品一区二区三区电影 | 亚洲欧美激情一区二区| 久久精工是国产品牌吗| 欧美色手机在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 国产一区999| 欧美精品99久久久**| 亚洲免费三区一区二区| 国产成人av影院| 欧美成人a∨高清免费观看| 亚洲国产一区二区三区 | 国产在线视频不卡二| 91精品在线观看入口| 一区二区免费视频| 成人av电影在线| 中文字幕欧美激情| 国产成人午夜电影网| 欧美成人a∨高清免费观看| 午夜精品福利一区二区三区蜜桃| 色激情天天射综合网| 亚洲免费观看高清| 99精品黄色片免费大全| 国产精品动漫网站| va亚洲va日韩不卡在线观看| 国产欧美日韩三级| 国产成人av一区二区三区在线观看| 2021国产精品久久精品| 美腿丝袜亚洲色图| 欧美成人性战久久| 国内外成人在线| 久久久久国产精品人|