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

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

?? rtp_h264.c.svn-base

?? ffmpeg最新源碼
?? SVN-BASE
字號:
/* * RTP H264 Protocol (RFC3984) * Copyright (c) 2006 Ryan Martell. * * 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 *//*** @file rtp_h264.c * @brief H.264 / RTP Code (RFC3984) * @author Ryan Martell <rdm4@martellventures.com> * * @note Notes: * Notes: * This currently supports packetization mode: * Single Nal Unit Mode (0), or * Non-Interleaved Mode (1).  It currently does not support * Interleaved Mode (2). (This requires implementing STAP-B, MTAP16, MTAP24, FU-B packet types) * * @note TODO: * 1) RTCP sender reports for udp streams are required.. * */#include "libavutil/base64.h"#include "libavutil/avstring.h"#include "libavcodec/bitstream.h"#include "avformat.h"#include "mpegts.h"#include <unistd.h>#include "network.h"#include <assert.h>#include "rtp_internal.h"#include "rtp_h264.h"/**    RTP/H264 specific private data.*/typedef struct h264_rtp_extra_data {    unsigned long cookie;       ///< sanity check, to make sure we get the pointer we're expecting.    //sdp setup parameters    uint8_t profile_idc;        ///< from the sdp setup parameters.    uint8_t profile_iop;        ///< from the sdp setup parameters.    uint8_t level_idc;          ///< from the sdp setup parameters.    int packetization_mode;     ///< from the sdp setup parameters.#ifdef DEBUG    int packet_types_received[32];#endif} h264_rtp_extra_data;#define MAGIC_COOKIE (0xdeadbeef)       ///< Cookie for the extradata; to verify we are what we think we are, and that we haven't been freed.#define DEAD_COOKIE (0xdeaddead)        ///< Cookie for the extradata; once it is freed./* ---------------- private code */static void sdp_parse_fmtp_config_h264(AVStream * stream,                                       h264_rtp_extra_data * h264_data,                                       char *attr, char *value){    AVCodecContext *codec = stream->codec;    assert(codec->codec_id == CODEC_ID_H264);    assert(h264_data != NULL);    if (!strcmp(attr, "packetization-mode")) {        av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Packetization Mode: %d\n", atoi(value));        h264_data->packetization_mode = atoi(value);        /*           Packetization Mode:           0 or not present: Single NAL mode (Only nals from 1-23 are allowed)           1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.           2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), and 29 (FU-B) are allowed.         */        if (h264_data->packetization_mode > 1)            av_log(stream, AV_LOG_ERROR,                   "H.264/RTP Interleaved RTP mode is not supported yet.");    } else if (!strcmp(attr, "profile-level-id")) {        if (strlen(value) == 6) {            char buffer[3];            // 6 characters=3 bytes, in hex.            uint8_t profile_idc;            uint8_t profile_iop;            uint8_t level_idc;            buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0';            profile_idc = strtol(buffer, NULL, 16);            buffer[0] = value[2]; buffer[1] = value[3];            profile_iop = strtol(buffer, NULL, 16);            buffer[0] = value[4]; buffer[1] = value[5];            level_idc = strtol(buffer, NULL, 16);            // set the parameters...            av_log(NULL, AV_LOG_DEBUG,                   "H.264/RTP Profile IDC: %x Profile IOP: %x Level: %x\n",                   profile_idc, profile_iop, level_idc);            h264_data->profile_idc = profile_idc;            h264_data->profile_iop = profile_iop;            h264_data->level_idc = level_idc;        }    } else  if (!strcmp(attr, "sprop-parameter-sets")) {        uint8_t start_sequence[]= { 0, 0, 1 };        codec->extradata_size= 0;        codec->extradata= NULL;        while (*value) {            char base64packet[1024];            uint8_t decoded_packet[1024];            uint32_t packet_size;            char *dst = base64packet;            while (*value && *value != ','                   && (dst - base64packet) < sizeof(base64packet) - 1) {                *dst++ = *value++;            }            *dst++ = '\0';            if (*value == ',')                value++;            packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));            if (packet_size) {                uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size);                if(dest)                {                    if(codec->extradata_size)                    {                        // av_realloc?                        memcpy(dest, codec->extradata, codec->extradata_size);                        av_free(codec->extradata);                    }                    memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));                    memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);                    codec->extradata= dest;                    codec->extradata_size+= sizeof(start_sequence)+packet_size;                } else {                    av_log(NULL, AV_LOG_ERROR, "H.264/RTP Unable to allocate memory for extradata!");                }            }        }        av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size);    }}// return 0 on packet, no more left, 1 on packet, 1 on partial packet...static int h264_handle_packet(RTPDemuxContext * s,                              AVPacket * pkt,                              uint32_t * timestamp,                              const uint8_t * buf,                              int len, int flags){#ifdef DEBUG    h264_rtp_extra_data *data = s->dynamic_protocol_context;#endif    uint8_t nal = buf[0];    uint8_t type = (nal & 0x1f);    int result= 0;    uint8_t start_sequence[]= {0, 0, 1};#ifdef DEBUG    assert(data);    assert(data->cookie == MAGIC_COOKIE);#endif    assert(buf);    if (type >= 1 && type <= 23)        type = 1;              // simplify the case. (these are all the nal types used internally by the h264 codec)    switch (type) {    case 0:                    // undefined;        result= -1;        break;    case 1:        av_new_packet(pkt, len+sizeof(start_sequence));        memcpy(pkt->data, start_sequence, sizeof(start_sequence));        memcpy(pkt->data+sizeof(start_sequence), buf, len);#ifdef DEBUG        data->packet_types_received[nal & 0x1f]++;#endif        break;    case 24:                   // STAP-A (one packet, multiple nals)        // consume the STAP-A NAL        buf++;        len--;        // first we are going to figure out the total size....        {            int pass= 0;            int total_length= 0;            uint8_t *dst= NULL;            for(pass= 0; pass<2; pass++) {                const uint8_t *src= buf;                int src_len= len;                do {                    uint16_t nal_size = AV_RB16(src); // this going to be a problem if unaligned (can it be?)                    // consume the length of the aggregate...                    src += 2;                    src_len -= 2;                    if (nal_size <= src_len) {                        if(pass==0) {                            // counting...                            total_length+= sizeof(start_sequence)+nal_size;                        } else {                            // copying                            assert(dst);                            memcpy(dst, start_sequence, sizeof(start_sequence));                            dst+= sizeof(start_sequence);                            memcpy(dst, src, nal_size);#ifdef DEBUG                            data->packet_types_received[*src & 0x1f]++;#endif                            dst+= nal_size;                        }                    } else {                        av_log(NULL, AV_LOG_ERROR,                               "nal size exceeds length: %d %d\n", nal_size, src_len);                    }                    // eat what we handled...                    src += nal_size;                    src_len -= nal_size;                    if (src_len < 0)                        av_log(NULL, AV_LOG_ERROR,                               "Consumed more bytes than we got! (%d)\n", src_len);                } while (src_len > 2);      // because there could be rtp padding..                if(pass==0) {                    // now we know the total size of the packet (with the start sequences added)                    av_new_packet(pkt, total_length);                    dst= pkt->data;                } else {                    assert(dst-pkt->data==total_length);                }            }        }        break;    case 25:                   // STAP-B    case 26:                   // MTAP-16    case 27:                   // MTAP-24    case 29:                   // FU-B        av_log(NULL, AV_LOG_ERROR,               "Unhandled type (%d) (See RFC for implementation details\n",               type);        result= -1;        break;    case 28:                   // FU-A (fragmented nal)        buf++;        len--;                  // skip the fu_indicator        {            // these are the same as above, we just redo them here for clarity...            uint8_t fu_indicator = nal;            uint8_t fu_header = *buf;   // read the fu_header.            uint8_t start_bit = fu_header >> 7;//            uint8_t end_bit = (fu_header & 0x40) >> 6;            uint8_t nal_type = (fu_header & 0x1f);            uint8_t reconstructed_nal;            // reconstruct this packet's true nal; only the data follows..            reconstructed_nal = fu_indicator & (0xe0);  // the original nal forbidden bit and NRI are stored in this packet's nal;            reconstructed_nal |= nal_type;            // skip the fu_header...            buf++;            len--;#ifdef DEBUG            if (start_bit)                data->packet_types_received[nal_type]++;#endif            if(start_bit) {                // copy in the start sequence, and the reconstructed nal....                av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len);                memcpy(pkt->data, start_sequence, sizeof(start_sequence));                pkt->data[sizeof(start_sequence)]= reconstructed_nal;                memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len);            } else {                av_new_packet(pkt, len);                memcpy(pkt->data, buf, len);            }        }        break;    case 30:                   // undefined    case 31:                   // undefined    default:        av_log(NULL, AV_LOG_ERROR, "Undefined type (%d)", type);        result= -1;        break;    }    return result;}/* ---------------- public code */static void *h264_new_extradata(void){    h264_rtp_extra_data *data =        av_mallocz(sizeof(h264_rtp_extra_data) +                   FF_INPUT_BUFFER_PADDING_SIZE);    if (data) {        data->cookie = MAGIC_COOKIE;    }    return data;}static void h264_free_extradata(void *d){    h264_rtp_extra_data *data = (h264_rtp_extra_data *) d;#ifdef DEBUG    int ii;    for (ii = 0; ii < 32; ii++) {        if (data->packet_types_received[ii])            av_log(NULL, AV_LOG_DEBUG, "Received %d packets of type %d\n",                   data->packet_types_received[ii], ii);    }#endif    assert(data);    assert(data->cookie == MAGIC_COOKIE);    // avoid stale pointers (assert)    data->cookie = DEAD_COOKIE;    // and clear out this...    av_free(data);}static int parse_h264_sdp_line(AVStream * stream, void *data,                               const char *line){    AVCodecContext *codec = stream->codec;    h264_rtp_extra_data *h264_data = (h264_rtp_extra_data *) data;    const char *p = line;    assert(h264_data->cookie == MAGIC_COOKIE);    if (av_strstart(p, "framesize:", &p)) {        char buf1[50];        char *dst = buf1;        // remove the protocol identifier..        while (*p && *p == ' ') p++; // strip spaces.        while (*p && *p != ' ') p++; // eat protocol identifier        while (*p && *p == ' ') p++; // strip trailing spaces.        while (*p && *p != '-' && (buf1 - dst) < sizeof(buf1) - 1) {            *dst++ = *p++;        }        *dst = '\0';        // a='framesize:96 320-240'        // set our parameters..        codec->width = atoi(buf1);        codec->height = atoi(p + 1); // skip the -        codec->pix_fmt = PIX_FMT_YUV420P;    } else if (av_strstart(p, "fmtp:", &p)) {        char attr[256];        char value[4096];        // remove the protocol identifier..        while (*p && *p == ' ') p++; // strip spaces.        while (*p && *p != ' ') p++; // eat protocol identifier        while (*p && *p == ' ') p++; // strip trailing spaces.        /* loop on each attribute */        while (rtsp_next_attr_and_value               (&p, attr, sizeof(attr), value, sizeof(value))) {            /* grab the codec extra_data from the config parameter of the fmtp line */            sdp_parse_fmtp_config_h264(stream, h264_data, attr, value);        }    } else if (av_strstart(p, "cliprect:", &p)) {        // could use this if we wanted.    }    av_set_pts_info(stream, 33, 1, 90000);      // 33 should be right, because the pts is 64 bit? (done elsewhere; this is a one time thing)    return 0;                   // keep processing it the normal way...}/**This is the structure for expanding on the dynamic rtp protocols (makes everything static. yay!)*/RTPDynamicProtocolHandler ff_h264_dynamic_handler = {    "H264",    CODEC_TYPE_VIDEO,    CODEC_ID_H264,    parse_h264_sdp_line,    h264_new_extradata,    h264_free_extradata,    h264_handle_packet};

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91麻豆精品一区二区三区| 另类综合日韩欧美亚洲| 视频一区二区中文字幕| 春色校园综合激情亚洲| 欧美成人a视频| 亚洲国产综合91精品麻豆| 不卡区在线中文字幕| 亚洲国产精品二十页| 久久精品国产一区二区三区免费看 | 中文字幕一区二区三区不卡 | 久久久精品综合| 国产一区欧美一区| 精品久久一区二区三区| 欧美亚洲高清一区二区三区不卡| 国产精品女主播av| 欧洲一区二区av| 日本91福利区| 欧美精品一区二区久久久| 国产精品99久久久久久久vr| 国产精品久久久久久久久久久免费看 | 欧美精品一区二区三区在线播放 | av日韩在线网站| 中文字幕视频一区| 久久久久久久电影| 欧美一区二区三区播放老司机| 秋霞av亚洲一区二区三| 亚洲第一成人在线| 久久综合色播五月| eeuss鲁片一区二区三区| 国产激情视频一区二区三区欧美 | 久久99久久久久久久久久久| 日韩午夜精品视频| 国产一区二区电影| 黑人巨大精品欧美黑白配亚洲 | 日韩av电影天堂| 精品处破学生在线二十三| 日韩欧美国产一区在线观看| 99久久国产免费看| 日韩av中文在线观看| 午夜视频在线观看一区二区三区| 精品国产污污免费网站入口| 日韩午夜在线影院| 精品国产网站在线观看| 精品盗摄一区二区三区| 国产午夜亚洲精品理论片色戒| 欧美性做爰猛烈叫床潮| 欧美做爰猛烈大尺度电影无法无天| 色婷婷综合久久久中文字幕| 久久精品国产精品亚洲综合| 久久国产人妖系列| 韩国av一区二区| 国产福利不卡视频| 99热国产精品| 欧美性做爰猛烈叫床潮| 91精品在线一区二区| a级精品国产片在线观看| 92国产精品观看| 在线观看一区不卡| 91精品国产91综合久久蜜臀| 精品久久久久av影院| 国产欧美一区在线| 欧美一区二区在线看| 久久综合九色综合欧美就去吻| 国产欧美一区二区在线观看| 亚洲卡通欧美制服中文| 2020国产精品久久精品美国| 国产精品家庭影院| 亚洲国产一区视频| 国产在线播放一区三区四| 成人av在线一区二区三区| 在线观看亚洲a| 精品福利在线导航| 亚洲欧洲三级电影| 日韩电影免费一区| 国产盗摄女厕一区二区三区| 色天天综合色天天久久| 日韩免费视频一区二区| 国产精品美女久久久久久2018| 亚洲一区二区四区蜜桃| ㊣最新国产の精品bt伙计久久| 亚洲第一狼人社区| 国产精品一卡二卡| 欧洲一区二区三区免费视频| 久久亚洲免费视频| 亚洲主播在线观看| 国产一区福利在线| 欧美特级限制片免费在线观看| 久久久久久久久一| 丝袜诱惑制服诱惑色一区在线观看| 亚洲激情五月婷婷| 精品亚洲免费视频| 色综合天天做天天爱| 麻豆精品国产91久久久久久| 日韩成人一区二区三区在线观看| 国产91丝袜在线观看| 成人免费高清在线观看| 欧美三区在线观看| 欧美日韩国产美| 在线综合视频播放| 18成人在线观看| 精品一区二区免费视频| 欧美视频一区二| 中文字幕精品三区| 蜜臀av一级做a爰片久久| 在线免费av一区| 国产精品青草综合久久久久99| 青草国产精品久久久久久| 色综合中文字幕国产 | 91官网在线免费观看| 欧美撒尿777hd撒尿| 国产人久久人人人人爽| 日韩精品电影在线| 欧美日韩综合在线免费观看| 亚洲图片另类小说| 婷婷久久综合九色综合绿巨人 | 国产精品久久久久久亚洲毛片| 麻豆国产一区二区| 欧美日韩第一区日日骚| 亚洲精品免费看| 一本一道久久a久久精品| 中文字幕av免费专区久久| 国产美女娇喘av呻吟久久| 欧美成人精精品一区二区频| 奇米影视在线99精品| 欧美精品第1页| 国产欧美一区二区三区在线看蜜臀| 美女视频网站久久| 日韩欧美一区二区视频| 午夜私人影院久久久久| 欧美日韩午夜精品| 午夜视频在线观看一区| 欧美日韩免费电影| 亚洲大片一区二区三区| 欧美视频中文一区二区三区在线观看| 一区二区三区在线视频观看| 蜜桃视频一区二区| 欧美一级高清片| 日本不卡一区二区三区高清视频| 欧美刺激午夜性久久久久久久| 天堂av在线一区| 日韩欧美自拍偷拍| 国产美女主播视频一区| 国产女同互慰高潮91漫画| 国产精品99久久久久久久女警| 国产欧美精品国产国产专区| 国产91在线观看| 最近日韩中文字幕| 日本久久电影网| 视频在线观看91| 欧美一区二区观看视频| 麻豆国产精品官网| 久久久99精品免费观看不卡| 丁香一区二区三区| 亚洲男人的天堂一区二区| 韩国成人精品a∨在线观看| 久久九九99视频| 97久久人人超碰| 亚洲成人自拍偷拍| 精品久久久久久久一区二区蜜臀| 国产suv精品一区二区883| 亚洲欧美日韩人成在线播放| 欧美男男青年gay1069videost| 久久精品国产77777蜜臀| 国产欧美一区二区三区在线老狼| 一本大道久久a久久综合| 婷婷成人综合网| 久久久午夜精品理论片中文字幕| a级精品国产片在线观看| 香港成人在线视频| 久久婷婷综合激情| 色综合久久88色综合天天| 免费观看在线综合| 国产精品不卡一区| 欧美电影在哪看比较好| 国产美女在线观看一区| 一区二区三区在线看| 日韩免费一区二区| 色哟哟国产精品| 精品一区精品二区高清| 亚洲人被黑人高潮完整版| 91精品婷婷国产综合久久竹菊| 国产精品一区二区免费不卡| 一区二区三区免费| 久久色.com| 91精品欧美久久久久久动漫| 成人一区二区三区视频在线观看| 午夜在线成人av| 国产精品黄色在线观看| 精品日韩在线观看| 欧美少妇性性性| 国产91在线观看丝袜| 男男视频亚洲欧美| 亚洲免费在线播放| 国产午夜久久久久| 91精品在线观看入口| 91污在线观看| 国产精品综合在线视频| 天堂在线亚洲视频| 亚洲精品ww久久久久久p站 | 中文字幕在线一区二区三区|