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

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

?? rtp.c

?? jm_frext22.ZIP的壓縮文件,主要用于嵌入式系統(tǒng)圖象的編解碼的開(kāi)發(fā).
?? C
字號(hào):

/*!
 ************************************************************************
 * \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;
}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区的| 精品在线播放午夜| 56国语精品自产拍在线观看| 国产激情偷乱视频一区二区三区| 18成人在线观看| 日韩午夜在线观看| 91国偷自产一区二区三区成为亚洲经典 | 中文字幕精品一区二区精品绿巨人 | 久久嫩草精品久久久久| 日本大香伊一区二区三区| 国产伦精品一区二区三区视频青涩 | 欧美成va人片在线观看| 日本精品视频一区二区| 国产成人久久精品77777最新版本| 午夜影院久久久| 亚洲女同ⅹxx女同tv| 久久久久97国产精华液好用吗| 欧美乱妇15p| 色综合天天综合狠狠| 成人手机电影网| 精品一区二区三区在线观看国产| 美女一区二区在线观看| 久久亚洲私人国产精品va媚药| 欧美日韩国产一区| 国产精品美女久久久久av爽李琼| 欧美一级一级性生活免费录像| 91老师国产黑色丝袜在线| 国产sm精品调教视频网站| 久久精品二区亚洲w码| 污片在线观看一区二区| 亚洲一二三四区不卡| 亚洲人成小说网站色在线| 国产精品久久久久久久裸模| 久久久久久久久久电影| 欧美xxxxx牲另类人与| 91精品国产综合久久久久久久 | 欧美午夜免费电影| 欧美专区亚洲专区| 在线一区二区观看| 色婷婷综合久久久中文一区二区 | 日韩欧美国产不卡| 日韩欧美一二三| 日韩欧美一区二区视频| 日韩欧美电影一二三| 日韩视频一区在线观看| 日韩欧美中文一区二区| 精品久久久久久最新网址| 精品国产伦一区二区三区免费| 欧美va亚洲va国产综合| 欧美成人午夜电影| 久久久久免费观看| 亚洲国产精华液网站w| 中文字幕日韩一区| 亚洲精品成人少妇| 天天做天天摸天天爽国产一区| 亚洲国产精品自拍| 免费高清视频精品| 国产一区二区久久| 99久久精品国产一区| 在线观看免费成人| 欧美一区二区三区四区五区 | 久久国产人妖系列| 国产精品18久久久久久久久久久久| 国产精品中文字幕日韩精品 | 亚洲人吸女人奶水| 亚洲成人一二三| 久久国产视频网| 成人毛片视频在线观看| 欧美日本一区二区三区| 日韩免费电影网站| 国产精品青草久久| 亚洲电影激情视频网站| 福利91精品一区二区三区| 亚洲天堂免费看| 日日摸夜夜添夜夜添亚洲女人| 看电视剧不卡顿的网站| 国产精品18久久久久久久久| 91色九色蝌蚪| 91精品视频网| 国产精品国产三级国产专播品爱网 | 欧美mv日韩mv国产网站app| 久久久噜噜噜久噜久久综合| 亚洲日本在线天堂| 日本中文在线一区| av福利精品导航| 91精品国产入口在线| 国产精品欧美精品| 日日摸夜夜添夜夜添亚洲女人| 国产成人午夜精品影院观看视频| 欧洲一区二区三区免费视频| 精品国内片67194| 亚洲激情男女视频| 国产精品一区二区在线观看网站| 91丨porny丨国产| 精品99久久久久久| 亚洲mv大片欧洲mv大片精品| 国产成人午夜99999| 51午夜精品国产| 亚洲日穴在线视频| 国产精品456露脸| 91精品国产美女浴室洗澡无遮挡| 国产精品久久久久一区二区三区| 免费观看在线色综合| 色婷婷激情综合| 国产午夜精品一区二区三区嫩草 | 亚洲第一二三四区| 不卡影院免费观看| 久久亚洲免费视频| 日韩黄色在线观看| 在线观看欧美精品| 亚洲欧洲日韩av| 国产成人高清在线| 精品少妇一区二区三区在线播放| 亚洲午夜激情网页| 色综合久久中文综合久久牛| 国产午夜精品久久久久久免费视 | 99re热这里只有精品免费视频| 4438x亚洲最大成人网| 亚洲免费在线看| 精品一区二区三区视频 | 欧美本精品男人aⅴ天堂| 一区二区三区在线影院| av动漫一区二区| 国产精品久久久久久久第一福利| 经典三级视频一区| 欧美电影免费观看完整版| 五月激情综合色| 欧美日韩国产影片| 亚洲成a人片综合在线| 欧美在线制服丝袜| 亚洲一区二区三区视频在线| 色综合天天性综合| 一区二区久久久久| 在线观看不卡视频| 综合中文字幕亚洲| 91麻豆国产在线观看| 亚洲卡通动漫在线| 色噜噜狠狠成人中文综合| 亚洲免费观看在线视频| 色94色欧美sute亚洲13| 一区二区高清视频在线观看| 色婷婷av一区二区三区之一色屋| 综合久久久久久| 在线视频综合导航| 亚洲午夜精品久久久久久久久| 欧美色老头old∨ideo| 无吗不卡中文字幕| 精品理论电影在线| 国产91精品免费| 亚洲视频图片小说| 在线视频国产一区| 日韩精品一卡二卡三卡四卡无卡| 欧美一区二区视频免费观看| 麻豆国产精品官网| 国产亚洲综合性久久久影院| 成人动漫视频在线| 亚洲最大的成人av| 91精品一区二区三区久久久久久 | 亚洲一区二区影院| 777久久久精品| 久久精品国产精品亚洲综合| 国产日韩欧美在线一区| www.日韩大片| 亚洲bt欧美bt精品777| 精品国产乱码久久| 成人av网址在线观看| 亚洲高清免费在线| 欧美videos大乳护士334| 成人动漫在线一区| 午夜电影久久久| 国产亚洲欧洲997久久综合| 99久久久国产精品免费蜜臀| 香蕉成人啪国产精品视频综合网| 精品国产乱码久久久久久浪潮| 97se亚洲国产综合自在线观| 亚洲成人资源在线| 日韩av电影免费观看高清完整版 | 777欧美精品| 国产成人av一区二区三区在线| 亚洲免费在线看| 亚洲成a人片综合在线| 国产麻豆精品95视频| 亚洲老司机在线| 欧美精品一区二区高清在线观看| 91在线精品一区二区三区| 日韩av在线免费观看不卡| 国产精品理论在线观看| 在线播放91灌醉迷j高跟美女| 国产福利一区二区三区视频| 亚洲国产精品天堂| 国产欧美日韩综合精品一区二区| 日本高清视频一区二区| 国产伦精品一区二区三区视频青涩| 亚洲一区在线电影| 国产精品素人一区二区| 5566中文字幕一区二区电影| 色综合天天在线| 成人小视频免费观看| 男女性色大片免费观看一区二区| 中文字幕日本乱码精品影院|