コード例 #1
0
    __inline unsigned char * SetExtended(unsigned id, unsigned len)
    {
      m_packet[0] |= 0x10;

      unsigned char * ptr = m_packet + PluginCodec_RTP_GetCSRCHdrLength(m_packet);
      switch (id >> 16) {
        case 0 :
          PluginCodec_RTP_SetWORD(ptr, 0, id);
          PluginCodec_RTP_SetWORD(ptr, 2, (len+3)/4);
          ptr += 4;
          break;

        case 1 :
          *ptr++ = 0xbe;
          *ptr++ = 0xde;
          PluginCodec_RTP_SetWORD(ptr, 0, (len+7)/4); ptr += 2;
          *ptr++ = (unsigned char)(((id&0xf) << 4)|(len-1));
          break;

        case 2 :
          *ptr++ = 0x10;
          *ptr++ = 0x00;
          PluginCodec_RTP_SetWORD(ptr, 0, (len+8)/4); ptr += 2;
          *ptr++ = (unsigned char)(id&0xff);
          *ptr++ = (unsigned char)(len&0xff);
      }

      m_headerSize = PluginCodec_RTP_GetHeaderLength(m_packet);
      return ptr;
    }
コード例 #2
0
 PluginCodec_RTP(const void * packet, unsigned size)
   : m_packet((unsigned char *)packet)
   , m_maxSize(size)
   , m_headerSize(PluginCodec_RTP_GetHeaderLength(m_packet))
   , m_payloadSize(size - m_headerSize)
 {
 }
コード例 #3
0
ファイル: template.cpp プロジェクト: glei/opal
    virtual bool Transcode(const void * fromPtr,
                             unsigned & fromLen,
                                 void * toPtr,
                             unsigned & toLen,
                             unsigned & flags)
    {
      // At this point fromPtr and toPtr are validated as non NULL

      const PluginCodec_Video_FrameHeader * videoHeader =
                (const PluginCodec_Video_FrameHeader *)PluginCodec_RTP_GetPayloadPtr(fromPtr);
      const unsigned char * videoBuffer = OPAL_VIDEO_FRAME_DATA_PTR(videoHeader);

      /* Check for catastrophic failures, if return false, aborts the codec
        conversion completely, and will be closed and re-opened. */
      if (fromLen < videoHeader->width*videoHeader->height*3/2 + 
                    sizeof(PluginCodec_Video_FrameHeader) +
                    PluginCodec_RTP_GetHeaderLength(fromPtr))
        return false;

      /* Do conversion of source YUV420 video frame to RTP packets, do not exceed
         the size indicated in toLen for any of the output packets. If there are
         no packets generated, set the toLen to zero and no packets will be sent
         over the wire. This allows for various bit rate control algorithms. */

      // Set output packet size, including RTP header
      toLen = 1400;

      // If we determine this is an Intra (reference) frame, set flag
      if (true)
        flags |= PluginCodec_ReturnCoderIFrame;

      // If we determine this is the last RTP packet of video frame, set flag
      if (true)
        flags |= PluginCodec_ReturnCoderLastFrame;

      return true;
    }
コード例 #4
0
ファイル: opalplugin.hpp プロジェクト: glei/opal
 __inline void     SetExtended(unsigned type, unsigned sz)
 {
   PluginCodec_RTP_SetExtended(m_packet, type, sz);
   m_headerSize = PluginCodec_RTP_GetHeaderLength(m_packet);
 }