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

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

?? rtp.c

?? H.264I標準是有已有視頻編碼標準發展而來(H.261,H.263),以適應各種應用的需要,此源碼是最新的源碼.
?? C
?? 第 1 頁 / 共 2 頁
字號:

/*!
 *****************************************************************************
 *
 * \file rtp.c
 *
 * \brief
 *    Functions to handle RTP headers and packets per RFC1889 and RTP NAL spec
 *    Functions support little endian systems only (Intel, not Motorola/Sparc)
 *
 * \date
 *    30 September 2001
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 *****************************************************************************/

#include <stdlib.h>
#include <assert.h>
#include <memory.h>

#include "global.h"

#include "rtp.h"

// A little trick to avoid those horrible #if TRACE all over the source code
#if TRACE
#define SYMTRACESTRING(s) strncpy(sym.tracestring,s,TRACESTRING_SIZE)
#else
#define SYMTRACESTRING(s) // to nothing
#endif


int CurrentRTPTimestamp = 0;      //! The RTP timestamp of the current packet,
                                  //! incremented with all P and I frames
int CurrentRTPSequenceNumber = 0; //! The RTP sequence number of the current packet
                                  //! incremented by one for each sent packet

FILE *f;
/*!
 *****************************************************************************
 *
 * \brief 
 *    ComposeRTPpacket composes the complete RTP packet using the various
 *    structure members of the RTPpacket_t structure
 *
 * \return
 *    0 in case of success
 *    negative error code in case of failure
 *
 * \par Parameters
 *    Caller is responsible to allocate enough memory for the generated packet
 *    in parameter->packet. Typically a malloc of 12+paylen bytes is sufficient
 *
 * \par Side effects
 *    none
 *
 * \note
 *    Function contains assert() tests for debug purposes (consistency checks
 *    for RTP header fields
 *
 * \date
 *    30 Spetember 2001
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 *****************************************************************************/


int ComposeRTPPacket (RTPpacket_t *p)

{
  // Consistency checks through assert, only used for debug purposes
  assert (p->v == 2);
  assert (p->p == 0);
  assert (p->x == 0);
  assert (p->cc == 0);    // mixer designers need to change this one
  assert (p->m == 0 || p->m == 1);
  assert (p->pt < 128);
  assert (p->seq < 65536);
  assert (p->payload != NULL);
  assert (p->paylen < 65536 - 40);  // 2**16 -40 for IP/UDP/RTP header
  assert (p->packet != NULL);

  // Compose RTP header, little endian

  p->packet[0] = (   (p->v)
                  |  (p->p << 2)
                  |  (p->x << 3)
                  |  (p->cc << 4) );
  p->packet[1] = (   (p->m)
                  |  (p->pt << 1) );
  p->packet[2] = p->seq & 0xff;
  p->packet[3] = (p->seq >> 8) & 0xff;

  memcpy (&p->packet[4], &p->timestamp, 4);  // change to shifts for unified byte sex
  memcpy (&p->packet[8], &p->ssrc, 4);// change to shifts for unified byte sex

  // Copy payload 

  memcpy (&p->packet[12], p->payload, p->paylen);
  p->packlen = p->paylen+12;
  return 0;
}



/*!
 *****************************************************************************
 *
 * \brief 
 *    WriteRTPPacket writes the supplied RTP packet to the output file
 *
 * \return
 *    0 in case of access
 *    <0 in case of write failure (typically fatal)
 *
 * \param p
 *    the RTP packet to be written (after ComposeRTPPacket() )
 * \param f
 *    output file
 *
 * \date
 *    October 23, 2001
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 *****************************************************************************/

int WriteRTPPacket (RTPpacket_t *p, FILE *f)

{
  int intime = -1;

  assert (f != NULL);
  assert (p != NULL);


  if (1 != fwrite (&p->packlen, 4, 1, f))
    return -1;
  if (1 != fwrite (&intime, 4, 1, f))
    return -1;
  if (1 != fwrite (p->packet, p->packlen, 1, f))
    return -1;
  return 0;
}





/*!
 *****************************************************************************
 *
 * \brief 
 *    int RTPWriteNALU write a NALU to the RTP file
 *
 * \return
 *    Number of bytes written to output file
 *
 * \par Side effects
 *    Packet written, RTPSequenceNumber and RTPTimestamp updated
 *   
 * \date
 *    December 13, 2002
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 *****************************************************************************/


int WriteRTPNALU (NALU_t *n)
{
  RTPpacket_t *p;

  assert (f != NULL);
  assert (n != NULL);
  assert (n->len < 65000);

  n->buf[0] =
    n->forbidden_bit << 7      |
    n->nal_reference_idc << 5  |
    n->nal_unit_type;

  // Set RTP structure elements and alloca() memory foor the buffers
  if ((p = (RTPpacket_t *) malloc (sizeof (RTPpacket_t))) == NULL)
    no_mem_exit ("RTPWriteNALU-1");
  if ((p->packet = malloc (MAXRTPPACKETSIZE)) == NULL)
    no_mem_exit ("RTPWriteNALU-2");
  if ((p->payload = malloc (MAXRTPPACKETSIZE)) == NULL)
    no_mem_exit ("RTPWriteNALU-3");

  p->v=2;
  p->p=0;
  p->x=0;
  p->cc=0;
  p->m=(n->startcodeprefix_len==4)&1;     // a long startcode of Annex B sets marker bit of RTP
                                          // Not exactly according to the RTP paylaod spec, but
                                          // good enough for now (hopefully).
                                          //! For error resilience work, we need the correct
                                          //! marker bit.  Introduce a nalu->marker and set it in
                                          //! terminate_slice()?
  p->pt=H26LPAYLOADTYPE;
  p->seq=CurrentRTPSequenceNumber++;
  p->timestamp=CurrentRTPTimestamp;
  p->ssrc=H26LSSRC;
  p->paylen = n->len;
  memcpy (p->payload, n->buf, n->len);



  // Generate complete RTP packet
  if (ComposeRTPPacket (p) < 0)
  {
    printf ("Cannot compose RTP packet, exit\n");
    exit (-1);
  }
  if (WriteRTPPacket (p, f) < 0)
  {
    printf ("Cannot write %d bytes of RTP packet to outfile, exit\n", p->packlen);
    exit (-1);
  }
  free (p->packet);
  free (p->payload);
  free (p);
  return (n->len * 8);
}


/*!
 ********************************************************************************************
 * \brief 
 *    RTPUpdateTimestamp: patches the RTP timestamp depending on the TR
 *
 * \param 
 *    tr: TRof the following NALUs
 *
 * \return
 *    none.  
 *
 ********************************************************************************************
*/


void RTPUpdateTimestamp (int tr)
{
  int delta;
  static int oldtr = -1;

  if (oldtr == -1)            // First invocation
  {
    CurrentRTPTimestamp = 0;  //! This is a violation of the security req. of
                              //! RTP (random timestamp), but easier to debug
    oldtr = 0;
    return;
  }

  /*! The following code assumes a wrap around of TR at 256, and
      needs to be changed as soon as this is no more true.
      
      The support for B frames is a bit tricky, because it is not easy to distinguish
      between a natural wrap-around of the tr, and the intentional going back of the
      tr because of a B frame.  It is solved here by a heuristic means: It is assumed that
      B frames are never "older" than 10 tr ticks.  Everything higher than 10 is considered
      a wrap around.
  */

  delta = tr - oldtr;

  if (delta < -10)        // wrap-around
    delta+=256;

  CurrentRTPTimestamp += delta * RTP_TR_TIMESTAMP_MULT;
  oldtr = tr;
}


/*!
 ********************************************************************************************
 * \brief 
 *    Opens the output file for the RTP packet stream
 *
 * \param Filename
 *    The filename of the file to be opened
 *
 * \return
 *    none.  Function terminates the program in case of an error
 *
 ********************************************************************************************
*/

void OpenRTPFile (char *Filename)
{
  if ((f = fopen (Filename, "wb")) == NULL)
  {
    printf ("Fatal: cannot open bitstream file '%s', exit (-1)\n", Filename);
    exit (-1);
  }
}


/*!
 ********************************************************************************************
 * \brief 
 *    Closes the output file for the RTP packet stream
 *
 * \return

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕欧美区| 日韩电影一区二区三区四区| 亚洲精品大片www| 美女性感视频久久| 色伊人久久综合中文字幕| 欧美xxxx在线观看| 亚洲一二三四区| 国产成人精品影视| 日韩欧美一区在线| 亚洲精品免费视频| 成人性生交大片免费看中文| 欧美一区二区三区公司| 一区二区三区日韩精品视频| 国产寡妇亲子伦一区二区| 日韩一区二区电影在线| 亚洲综合在线免费观看| 成人午夜精品在线| 久久午夜免费电影| 精品一区二区三区蜜桃| 91精品国产综合久久小美女| 亚洲线精品一区二区三区 | 91性感美女视频| 久久久欧美精品sm网站| 蜜臀va亚洲va欧美va天堂 | 欧美成人一级视频| 日韩高清不卡一区| 7777精品伊人久久久大香线蕉完整版| 一区二区三区中文字幕| 在线免费观看日本欧美| 1000精品久久久久久久久| 成人小视频免费观看| 欧美激情综合在线| 成人听书哪个软件好| 久久精品一区四区| 国产成人综合在线观看| 久久久影视传媒| 粉嫩av一区二区三区在线播放 | 看片的网站亚洲| 日韩欧美激情四射| 激情综合网最新| 国产亚洲一区二区三区四区| 国产最新精品免费| 国产精品免费av| 一本色道亚洲精品aⅴ| 亚洲影院免费观看| 538prom精品视频线放| 久久国产三级精品| 国产色爱av资源综合区| aa级大片欧美| 午夜精品福利视频网站| 欧美一区二区三区视频免费播放| 久久国产精品色婷婷| 国产亚洲欧美中文| 91美女在线看| 免费不卡在线视频| 国产精品嫩草影院com| 91黄色免费观看| 久久av资源网| 17c精品麻豆一区二区免费| 91国内精品野花午夜精品| 日韩国产精品久久| 欧美国产视频在线| 欧美日韩午夜在线视频| 国产一区视频在线看| 日韩美女视频19| 91精品国产91热久久久做人人 | 日本久久精品电影| 蜜桃精品视频在线观看| 国产精品久久午夜| 制服丝袜亚洲色图| 成人一区二区三区| 日本不卡的三区四区五区| 亚洲国产精品t66y| 欧美日韩国产片| av午夜一区麻豆| 久久精品国产成人一区二区三区 | 欧美一区二区播放| aaa国产一区| 看国产成人h片视频| 亚洲综合丝袜美腿| 国产欧美日韩三级| 欧美一区二区黄色| 在线一区二区观看| 风间由美一区二区三区在线观看 | 欧美精品日韩一本| 波多野洁衣一区| 精品一区精品二区高清| 亚洲精品久久久蜜桃| 日本一区二区三区视频视频| 日韩一二三区不卡| 欧美日韩国产综合久久| 91原创在线视频| 成人理论电影网| 国产高清在线精品| 韩国av一区二区三区| 香蕉乱码成人久久天堂爱免费| 中文字幕精品—区二区四季| 日韩三级av在线播放| 精品视频123区在线观看| 99久久精品免费| 成人国产精品免费观看动漫| 狠狠色丁香久久婷婷综合丁香| 日韩av一区二区在线影视| 亚洲综合久久久久| 亚洲精品中文字幕乱码三区| ...xxx性欧美| 国产精品色呦呦| 国产精品久久久久aaaa樱花| 日本一区二区成人| 国产日韩欧美麻豆| 国产夜色精品一区二区av| 久久午夜色播影院免费高清| 久久综合九色综合欧美亚洲| 精品久久国产老人久久综合| 日韩女优制服丝袜电影| 日韩美一区二区三区| 日韩欧美精品三级| 久久久无码精品亚洲日韩按摩| 欧美成人精品高清在线播放| 欧美电影免费观看高清完整版在线观看 | 色婷婷综合久久久久中文| 97超碰欧美中文字幕| 在线一区二区三区| 欧美日韩一区精品| 欧美一激情一区二区三区| 欧美一区二区不卡视频| 久久亚洲一区二区三区明星换脸| 精品成人a区在线观看| 久久精品一区二区三区四区| 日本一区二区三区免费乱视频| 中文字幕在线观看一区二区| 一区二区三区免费| 天使萌一区二区三区免费观看| 日本中文字幕一区二区视频| 捆绑调教一区二区三区| 国产精品一区二区91| 97超碰欧美中文字幕| 69堂国产成人免费视频| 久久久青草青青国产亚洲免观| 综合久久国产九一剧情麻豆| 亚洲va在线va天堂| 国产在线播放一区| 91高清在线观看| 日韩精品一区二区三区蜜臀| 亚洲国产电影在线观看| 亚洲一区在线电影| 韩国av一区二区三区四区 | 欧美性极品少妇| 日韩欧美色电影| 亚洲欧美成人一区二区三区| 午夜精品一区在线观看| 国产传媒一区在线| 欧美日韩国产另类不卡| 国产欧美一区二区三区在线老狼| 一卡二卡三卡日韩欧美| 精品一区二区影视| 欧美午夜一区二区| 日本一区二区三区国色天香| 亚洲成在人线在线播放| 成人午夜精品一区二区三区| 欧美精品在线一区二区三区| 欧美极品另类videosde| 琪琪一区二区三区| 日本高清不卡一区| 国产亚洲女人久久久久毛片| 亚洲福利视频一区| 99久久婷婷国产综合精品电影 | 久久成人免费网| 91视频.com| 久久综合九色综合欧美98| 亚洲成人在线观看视频| 成人av片在线观看| 欧美精品一区二区三区很污很色的| 一区二区三区美女视频| 国产精品18久久久久久久久| 欧美精品三级日韩久久| 亚洲欧美另类图片小说| 成人免费毛片a| 精品美女一区二区三区| 婷婷亚洲久悠悠色悠在线播放 | 亚洲婷婷在线视频| 国产99久久久国产精品潘金| 欧美一级电影网站| 爽好久久久欧美精品| 在线观看中文字幕不卡| 国产精品萝li| 丁香啪啪综合成人亚洲小说| 久久久综合网站| 精品一区二区影视| 欧美videos大乳护士334| 日韩国产欧美视频| 欧美少妇bbb| 亚洲国产成人91porn| 在线观看视频91| 亚洲激情欧美激情| 色婷婷综合久久久中文字幕| 亚洲特黄一级片| 欧洲一区在线电影| 亚洲高清免费观看高清完整版在线观看 | 国产一区二区三区免费播放|