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

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

?? rtp.c

?? h264標準的VC實現
?? C
字號:

/*!
 ************************************************************************
 * \file  rtp.c
 *
 * \brief
 *    Network Adaptation layer for RTP packets
 *
 * \author
 *    Main contributors (see contributors.h for copyright, address and affiliation details)
 *    - Stephan Wenger   <stewe@cs.tu-berlin.de>
 ************************************************************************
 */


/*!

  A quick guide to the basics of the RTP decoder implementation

  This module contains the RTP packetization, de-packetization, and the
  handling of Parameter Sets, see VCEG-N52 and accompanying documents.
  Note: Compound packets are not yet implemented!

  The interface between every NAL (including the RTP NAL) and the VCL is
  based on Slices.  The slice data structure on which the VCL is working
  is defined in the type Slice (in defines.h).  This type contains the
  various fields of the slice header and a partition array, which itself
  contains the data partitions the slice consists of.  When data
  partitioning is not used, then the whole slice bit string is stored
  in partition #0.  When individual partitions are missing, this is
  indicated by the size of the bit strings in the partition array.
  A complete missing slice (e.g. if a Full Slice packet was lost) is
  indicated in a similar way.  
  
  part of the slice structure is the error indication (ei-flag).  The
  Ei-flag is set in such cases in which at least one partition of a slice
  is damaged or missing.When data partitioning is used, it can happen that
  one partition does not contain any symbols but the ei_flag is cleared,
  which indicates the intentional missing of symbols of that partition.
  A typical example for this behaviour is the Intra Slice, which does not
  have symnbols in its type C partition.

  The VCL requests new data to work on through the call of readSliceRTP().
  This function calls the main state machine of this module in ReadRTPpaacket().

  ReadRTPpacket assumes, when called, that in an error free environment
  a complete slice, consisting of one Full Slice RTP packet, or three Partition
  packets of types A, B, C with consecutive sequence numbers, can be read.
  It first interprets any trailing SUPP and Parameter Update (Header) packets.
  Then it reads one video data packet.  Two cases have to be distinguished:

  1. Type A, or Full Slice packet
  In this case, the PictureID and the macroblock mumbers are used to
  identify the potential loss of a slice.  A slice is lost, when the
  StartMB of the newly read slice header is not equal to the current
  state of the decoder
    1.1 Loss detected
      In this case the last packet is unread (fseek back), and a dummy slice
      containing the missing macroblocks is conveyed to the VCL.  At the next 
      call of the NAL, the same packet is read again, but this time no packet 
      loss is detected by the above algorithm,
    1.2. No loss
      In this case it is checked whether a Full Slice packet or a type A data
      partition was read
        1.2.1 Full Slice
          The Full Slice packet is conveyed to the NAL
        1.2.2 Type A Partition
          The function RTPReadDataPartitionedSlice() is called, which collects
          the remaining type B, C partitions and handles them appropriately.

  Paraneter Update Packets (aka Header packets) are in an SDP-like syntax
  and are interpreted by a simple parser in the function 
  RTPInterpretParameterSetPacket() 

  Each Slice header contaions the information on which parameter set to be used.
  The function RTPSetImgInp() copies the information of the relevant parameter
  set in the VCL's global variables img-> and inp->  IMPORTANT: any changes
  in the semantics of the img-> and inp-> structure members must be represented
  in this function as well!

  A note to the stream-buffer data structure: The stream buffer always contains
  only the contents of the partition in question, and not the slice/partition
  header.  Decoding has to start at bitoffset 0 (UVLC) or bytreoffset 0 (CABAC).

  The remaining functions should be self-explanatory.
  
*/

#include "contributors.h"

#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <ctype.h>

#include "global.h"
#include "errorconcealment.h"
#include "rtp.h"
#include "fmo.h"
#include "sei.h"
#include "memalloc.h"


FILE *bits;

int RTPReadPacket (RTPpacket_t *p, FILE *bits);

/*!
 ************************************************************************
 * \brief
 *    Opens the bit stream file named fn
 * \return
 *    none
 ************************************************************************
 */
void OpenRTPFile (char *fn)
{
  if (NULL == (bits=fopen(fn, "rb")))
  {
    snprintf (errortext, ET_SIZE, "Cannot open RTP file '%s'", input->infile);
    error(errortext,500);
  }
}


/*!
 ************************************************************************
 * \brief
 *    Closes the bit stream file
 ************************************************************************
 */
void CloseRTPFile()
{
  fclose (bits);
}


/*!
 ************************************************************************
 * \brief
 *    Fills nalu->buf and nalu->len with the payload of an RTP packet.  
 *    Other fields in nalu-> remain uninitialized (will be taken care of 
 *    by NALUtoRBSP.
 *
 * \return
 *     4 in case of ok (for compatibility with GetAnnexbNALU)
 *     0 if there is nothing any more to read (EOF)
 *    -1 in case of any error
 *
 ************************************************************************
 */

int GetRTPNALU (NALU_t *nalu)
{
  RTPpacket_t *p;
  int ret;

  if ((p=malloc (sizeof (RTPpacket_t)))== NULL)
    no_mem_exit ("GetRTPNALU-1");
  if ((p->packet=malloc (MAXRTPPACKETSIZE))== NULL)
    no_mem_exit ("GetRTPNALU-2");
  if ((p->payload=malloc (MAXRTPPACKETSIZE))== NULL)
    no_mem_exit ("GetRTPNALU-3");

  ret = RTPReadPacket (p, bits);
  nalu->forbidden_bit = 1;
  nalu->len = 0;
  
  if (ret < 0)
    return -1;
  if (ret == 0)
    return 0;

  assert (p->paylen < nalu->max_size);

  nalu->len = p->paylen;
  memcpy (nalu->buf, p->payload, p->paylen);
  nalu->forbidden_bit = (nalu->buf[0]>>7) & 1;
  nalu->nal_reference_idc = (nalu->buf[0]>>5) & 3;
  nalu->nal_unit_type = (nalu->buf[0]) & 0x1f;

  free (p->payload);
  free (p->packet);
  free (p); 
//  printf ("Got an RTP NALU, len %d, first byte %x\n", nalu->len, nalu->buf[0]);
  return nalu->len;
}



/*!
 *****************************************************************************
 *
 * \brief 
 *    DecomposeRTPpacket interprets the RTP packet and writes the various
 *    structure members of the RTPpacket_t structure
 *
 * \return
 *    0 in case of success
 *    negative error code in case of failure
 *
 * \param p
 *    Caller is responsible to allocate enough memory for the generated payload
 *    in parameter->payload. Typically a malloc of paclen-12 bytes is sufficient
 *
 * \par Side effects
 *    none
 *
 * \date
 *    30 Spetember 2001
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 *****************************************************************************/

int DecomposeRTPpacket (RTPpacket_t *p)

{
  // consistency check 
  assert (p->packlen < 65536 - 28);  // IP, UDP headers
  assert (p->packlen >= 12);         // at least a complete RTP header
  assert (p->payload != NULL);
  assert (p->packet != NULL);

  // Extract header information

  p->v  = p->packet[0] & 0x3;
  p->p  = (p->packet[0] & 0x4) >> 2;
  p->x  = (p->packet[0] & 0x8) >> 3;
  p->cc = (p->packet[0] & 0xf0) >> 4;

  p->m  = p->packet[1] & 0x1;
  p->pt = (p->packet[1] & 0xfe) >> 1;

  p->seq = p->packet[2] | (p->packet[3] << 8);

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

  // header consistency checks
  if (     (p->v != 2)
        || (p->p != 0)
        || (p->x != 0)
        || (p->cc != 0) )
  {
    printf ("DecomposeRTPpacket, RTP header consistency problem, header follows\n");
    DumpRTPHeader (p);
    return -1;
  }
  p->paylen = p->packlen-12;
  memcpy (p->payload, &p->packet[12], p->paylen);
  return 0;
}

/*!
 *****************************************************************************
 *
 * \brief 
 *    DumpRTPHeader is a debug tool that dumps a human-readable interpretation
 *    of the RTP header
 *
 * \return
 *    n.a.
 * \param p
 *    the RTP packet to be dumped, after DecompositeRTPpacket()
 *
 * \par Side effects
 *    Debug output to stdout
 *
 * \date
 *    30 Spetember 2001
 *
 * \author
 *    Stephan Wenger   stewe@cs.tu-berlin.de
 *****************************************************************************/

void DumpRTPHeader (RTPpacket_t *p)

{
  int i;
  for (i=0; i< 30; i++)
    printf ("%02x ", p->packet[i]);
  printf ("Version (V): %d\n", p->v);
  printf ("Padding (P): %d\n", p->p);
  printf ("Extension (X): %d\n", p->x);
  printf ("CSRC count (CC): %d\n", p->cc);
  printf ("Marker bit (M): %d\n", p->m);
  printf ("Payload Type (PT): %d\n", p->pt);
  printf ("Sequence Number: %d\n", p->seq);
  printf ("Timestamp: %d\n", p->timestamp);
  printf ("SSRC: %d\n", p->ssrc);
}


/*!
 *****************************************************************************
 *
 * \brief 
 *    RTPReadPacket reads one packet from file
 *
 * \return
 *    0: EOF
 *    negative: error
 *    positive: size of RTP packet in bytes
 *
 * \param p
 *    packet data structure, with memory for p->packet allocated
 *
 * \param bits
 *    target file
 *
 * \par Side effects:
 *   - File pointer in bits moved
 *   - p->xxx filled by reading and Decomposepacket()
 *
 * \date
 *    04 November, 2001
 *
 * \author
 *    Stephan Wenger, stewe@cs.tu-berlin.de
 *****************************************************************************/

int RTPReadPacket (RTPpacket_t *p, FILE *bits)
{
  int Filepos, intime;

  assert (p != NULL);
  assert (p->packet != NULL);
  assert (p->payload != NULL);

  Filepos = ftell (bits);
  if (4 != fread (&p->packlen,1, 4, bits))
    {
      return 0;
    }
    
  if (4 != fread (&intime, 1, 4, bits))
    {
      fseek (bits, Filepos, SEEK_SET);
      printf ("RTPReadPacket: File corruption, could not read Timestamp, exit\n");
      exit (-1);
    }

  assert (p->packlen < MAXRTPPACKETSIZE);

  if (p->packlen != fread (p->packet, 1, p->packlen, bits))
    {
      printf ("RTPReadPacket: File corruption, could not read %d bytes\n", p->packlen);
      exit (-1);    // EOF inidication
    }

  if (DecomposeRTPpacket (p) < 0)
    {
      // this should never happen, hence exit() is ok.  We probably do not want to attempt
      // to decode a packet that obviously wasn't generated by RTP
      printf ("Errors reported by DecomposePacket(), exit\n");
      exit (-700);
    }
    assert (p->pt == H26LPAYLOADTYPE);
    assert (p->ssrc == 0x12345678);
  return p->packlen;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩制服丝袜av| 欧美韩日一区二区三区四区| 北条麻妃一区二区三区| 亚洲成人精品一区| 亚洲一区二区精品3399| 久久你懂得1024| 欧美综合一区二区| 91久久精品一区二区二区| 91理论电影在线观看| 色婷婷精品大在线视频| 欧美在线三级电影| 国产精品一区二区男女羞羞无遮挡| 日韩国产高清在线| 久久99久久精品| 国产激情视频一区二区三区欧美| 亚洲第一av色| 视频一区二区中文字幕| 美女一区二区在线观看| 国产精品综合av一区二区国产馆| 成人免费视频app| 91蜜桃在线免费视频| 欧美四级电影网| 欧美一区二区三区免费在线看| caoporn国产一区二区| 91欧美激情一区二区三区成人| 91偷拍与自偷拍精品| 欧美男人的天堂一二区| wwwwww.欧美系列| 欧美一三区三区四区免费在线看| 91国偷自产一区二区使用方法| 国产伦精品一区二区三区视频青涩 | 一本久久综合亚洲鲁鲁五月天| 91国在线观看| 91精品国产综合久久婷婷香蕉 | 亚洲成av人片在线观看无码| 国产精品美女www爽爽爽| 亚洲精品一卡二卡| 老司机精品视频一区二区三区| 国产凹凸在线观看一区二区| 久久国产精品99久久人人澡| 国产成人一级电影| 在线观看av不卡| 精品福利二区三区| 日韩欧美视频在线| 欧美一区二区视频在线观看| 欧美日韩国产一级| 在线观看日韩精品| 久久婷婷久久一区二区三区| 日韩美女久久久| 另类调教123区| 在线观看www91| 精品成人在线观看| 国产精品美女久久久久高潮| 日韩福利视频网| 麻豆国产一区二区| 91啪亚洲精品| 国产性天天综合网| 国产欧美一区二区三区鸳鸯浴| 亚洲自拍都市欧美小说| 国产一区91精品张津瑜| 欧美日韩卡一卡二| 久久色在线观看| 一区二区三区高清不卡| 一区二区久久久久| 一区二区三区在线观看国产| 亚洲成人午夜影院| 亚洲国产精品影院| 亚洲综合一二区| 亚洲综合色婷婷| 一区二区三区中文字幕精品精品| 肉色丝袜一区二区| 午夜精品视频在线观看| 国产精品自拍av| 粉嫩一区二区三区在线看| 国精产品一区一区三区mba视频| 久草精品在线观看| 欧美体内she精高潮| 国产精品久久久久久久久久免费看 | 欧美激情一区二区| 韩国成人福利片在线播放| 欧美色精品在线视频| 最新国产の精品合集bt伙计| 亚洲精品视频免费观看| 性做久久久久久久久| 久久精品免费观看| 欧美剧情片在线观看| 亚洲视频在线一区观看| 日韩国产在线一| 激情综合色丁香一区二区| 欧美日产国产精品| 亚洲国产精品久久久久婷婷884| 91在线精品一区二区| 国产精品久久久久aaaa| 国产精品一级黄| 欧美日韩一区二区在线观看视频| 亚洲视频一二三| 一本久久精品一区二区| 亚洲精品第1页| 激情综合亚洲精品| 精品国产一区二区三区久久影院| 日韩综合在线视频| 91精品国产丝袜白色高跟鞋| 国产清纯白嫩初高生在线观看91 | 亚洲视频你懂的| 99re在线精品| 成人欧美一区二区三区白人| 日韩在线a电影| 欧美精品第1页| 麻豆一区二区三区| 精品国产1区二区| 丁香五精品蜜臀久久久久99网站| 在线播放视频一区| 午夜精品福利久久久| 不卡的av电影| 亚洲精品高清在线| 欧美久久久久久久久久| 日韩成人一区二区三区在线观看| av成人免费在线| 亚洲丝袜精品丝袜在线| 欧美在线观看你懂的| 青娱乐精品视频| 久久久久久久av麻豆果冻| av网站免费线看精品| 亚洲精品一区二区三区蜜桃下载 | 成人av网站在线| 亚洲一区二区精品久久av| 成人av一区二区三区| 亚洲麻豆国产自偷在线| 国产自产2019最新不卡| 国产亚洲va综合人人澡精品| 91视频一区二区| 久久久一区二区三区捆绑**| 免费成人在线影院| 欧美韩日一区二区三区| 色狠狠桃花综合| 久久av资源网| 欧美成人r级一区二区三区| 国产成人免费视频网站| 亚洲精品一区二区精华| 91香蕉国产在线观看软件| 日韩制服丝袜先锋影音| 国产精品网友自拍| 欧美理论片在线| 成人深夜福利app| 日本一二三四高清不卡| 国产精品一区二区在线观看不卡| 亚洲男人电影天堂| 色婷婷av一区二区三区软件| 蜜桃视频在线一区| 亚洲色欲色欲www在线观看| 成人爽a毛片一区二区免费| 国产三级一区二区三区| 久久国产尿小便嘘嘘| 中文字幕一区二区三区色视频| 播五月开心婷婷综合| 日韩在线一二三区| 日韩伦理电影网| 91在线观看高清| 国产在线精品一区二区三区不卡 | 久久精品国产澳门| 亚洲私人影院在线观看| 精品成人一区二区三区四区| 国产永久精品大片wwwapp| 久久久另类综合| 风间由美一区二区三区在线观看| 一区二区三区在线播放| 欧美日韩视频不卡| 日韩电影一区二区三区| 欧美一区二区三区不卡| 久久精品理论片| 国产欧美精品国产国产专区| 成人精品国产一区二区4080| 男女性色大片免费观看一区二区| 精品乱人伦一区二区三区| 在线视频你懂得一区| 成人黄色在线网站| 国产一区欧美日韩| 日韩av二区在线播放| 亚洲一区二区三区四区在线免费观看| 欧美色大人视频| 色综合天天综合网天天看片| 无码av免费一区二区三区试看 | jizz一区二区| 国产精品一区在线| 激情综合色播激情啊| 国产精品久久久久国产精品日日| 欧美亚洲国产一区在线观看网站| 高清shemale亚洲人妖| 国产酒店精品激情| 国产在线一区观看| 久久精品国产亚洲5555| 理论电影国产精品| 蜜桃精品视频在线| 琪琪久久久久日韩精品| 欧美国产一区在线| 欧美性猛片xxxx免费看久爱| 久久99在线观看| 另类小说一区二区三区| 丝袜亚洲另类欧美| 欧美国产欧美综合|