Exemple #1
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with ogg packets.
 ****************************************************************************/
static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    decoder_sys_t *p_sys = p_dec->p_sys;
    ogg_packet oggpacket;

    if( !pp_block || !*pp_block)
        return NULL;

    /* Block to Ogg packet */
    oggpacket.packet = (*pp_block)->p_buffer;
    oggpacket.bytes = (*pp_block)->i_buffer;

    oggpacket.granulepos = -1;
    oggpacket.b_o_s = 0;
    oggpacket.e_o_s = 0;
    oggpacket.packetno = 0;

    /* Check for headers */
    if( !p_sys->b_has_headers )
    {
        if( ProcessHeaders( p_dec ) )
        {
            block_Release( *pp_block );
            return NULL;
        }
        p_sys->b_has_headers = true;
    }

    return ProcessPacket( p_dec, &oggpacket, pp_block );
}
Exemple #2
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with ogg packets.
 ****************************************************************************/
static block_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    decoder_sys_t *p_sys = p_dec->p_sys;
    ogg_packet oggpacket;

    if( !pp_block ) return NULL;

    block_t *block = *pp_block;

    if( block != NULL )
    {
        /* Block to Ogg packet */
        oggpacket.packet = block->p_buffer;
        oggpacket.bytes = block->i_buffer;
    }
    else
    {
        if( p_sys->b_packetizer ) return NULL;

        /* Block to Ogg packet */
        oggpacket.packet = NULL;
        oggpacket.bytes = 0;
    }

    oggpacket.granulepos = -1;
    oggpacket.b_o_s = 0;
    oggpacket.e_o_s = 0;
    oggpacket.packetno = 0;

    /* Check for headers */
    if( !p_sys->b_has_headers )
    {
        if( !p_dec->fmt_in.p_extra )
        {
            msg_Warn( p_dec, "Header missing, using default settings" );

            if( CreateDefaultHeader( p_dec ) )
            {
                if( block != NULL )
                    block_Release( block );
                return NULL;
            }
        }
        else if( ProcessHeaders( p_dec ) )
        {
            if( block != NULL )
                block_Release( block );
            return NULL;
        }
        p_sys->b_has_headers = true;
    }

    return ProcessPacket( p_dec, &oggpacket, pp_block );
}
Exemple #3
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with kate packets.
 ****************************************************************************/
static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    decoder_sys_t *p_sys = p_dec->p_sys;
    block_t *p_block;
    kate_packet kp;

    if( !pp_block || !*pp_block )
        return NULL;

    p_block = *pp_block;
    *pp_block = NULL;

    if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
    {
#ifdef HAVE_TIGER
        if( p_block->i_flags & BLOCK_FLAG_DISCONTINUITY)
        {
            /* Hmm, should we wait before flushing the renderer ? I think not, but not certain... */
            vlc_mutex_lock( &p_sys->lock );
            tiger_renderer_seek( p_sys->p_tr, 0 );
            vlc_mutex_unlock( &p_sys->lock );
        }
#endif
        if( p_block->i_flags & BLOCK_FLAG_CORRUPTED )
        {
            p_sys->i_max_stop = VLC_TS_INVALID;
            block_Release( p_block );
            return NULL;
        }
    }

    /* Block to Kate packet */
    kate_packet_wrap(&kp, p_block->i_buffer, p_block->p_buffer);

    if( !p_sys->b_has_headers )
    {
        if( ProcessHeaders( p_dec ) )
        {
            block_Release( *pp_block );
            return NULL;
        }
        p_sys->b_has_headers = true;
    }

    return ProcessPacket( p_dec, &kp, pp_block );
}
Exemple #4
0
BOOL CMapiMessage::FetchHeaders( void)
{
  LPSPropValue pVal = CMapiApi::GetMapiProperty( m_lpMsg, PR_TRANSPORT_MESSAGE_HEADERS);
  if (pVal && CMapiApi::IsLargeProperty( pVal)) {
    m_headers.Truncate();
    CMapiApi::GetLargeStringProperty( m_lpMsg, PR_TRANSPORT_MESSAGE_HEADERS, m_headers);
  }
  else if (pVal && (PROP_TYPE( pVal->ulPropTag) == PT_TSTRING) && (pVal->Value.LPSZ) && (*(pVal->Value.LPSZ))) {
    m_headers = pVal->Value.LPSZ;
  }
  else {
    // Need to build the headers from the other stuff
    m_headers.Truncate();
    BuildHeaders();
  }

  if (pVal)
    CMapiApi::MAPIFreeBuffer( pVal);

  m_fromLine.Truncate();
  if (NeedsFromLine()) {
    BuildFromLine();
  }

  if (!m_fromLine.IsEmpty()) {
    MAPI_DUMP_STRING(m_fromLine.get());
  }
  MAPI_DUMP_STRING(m_headers.get());
  MAPI_TRACE0("\r\n");

  ProcessHeaders();

  if (!m_headers.IsEmpty()) {
    if (!m_bHasSubject)
      AddSubject( m_headers);
    if (!m_bHasFrom)
      AddFrom( m_headers);
    if (!m_bHasDate)
      AddDate( m_headers);
    m_headers.Trim( kWhitespace, PR_FALSE, PR_TRUE);
    m_headers += "\x0D\x0A";
  }

  return( !m_headers.IsEmpty());
}
void IcyConnector::socketReadyReadData()
{
    char data[1501];
    int64_t n;

    while((n=icy_socket->read(data,1500))>0) {
        data[n]=0;
        for(int64_t i=0; i<n; i++) {
            switch(0xFF&data[i]) {
            case 10:
                if((icy_recv_buffer.length()>=2)&&
                        (icy_recv_buffer.toUtf8().at(icy_recv_buffer.length()-3)==13)) {
                    icy_recv_buffer=icy_recv_buffer.left(icy_recv_buffer.length()-1);
                    ProcessHeaders(icy_recv_buffer);
                    icy_recv_buffer="";
                }
                else {
                    icy_recv_buffer+=data[i];
                }
                break;

            case 13:
                if(QString(icy_recv_buffer)=="invalid password") {
                    Log(LOG_WARNING,
                        QString().sprintf("login to \"%s:%d\" rejected: invalid password",
                                          (const char *)hostHostname().toUtf8(),
                                          0xFFFF&hostPort()));
                }
                else {
                    icy_recv_buffer+=data[i];
                }
                break;

            default:
                icy_recv_buffer+=data[i];
                break;
            }
        }
    }
}
Exemple #6
0
/****************************************************************************
 * DecodeBlock: the whole thing
 ****************************************************************************
 * This function must be fed with ogg packets.
 ****************************************************************************/
static void *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
    decoder_sys_t *p_sys = p_dec->p_sys;
    block_t *p_block;
    ogg_packet oggpacket;

    if( !pp_block || !*pp_block ) return NULL;

    p_block = *pp_block;

    /* Block to Ogg packet */
    oggpacket.packet = p_block->p_buffer;
    oggpacket.bytes = p_block->i_buffer;
    oggpacket.granulepos = p_block->i_dts;
    oggpacket.b_o_s = 0;
    oggpacket.e_o_s = 0;
    oggpacket.packetno = 0;

    /* Check for headers */
    if( !p_sys->b_has_headers )
    {
        if( ProcessHeaders( p_dec ) )
        {
            block_Release( p_block );
            return NULL;
        }
        p_sys->b_has_headers = true;
    }

    /* If we haven't seen a single keyframe yet, set to preroll,
     * otherwise we'll get display artifacts.  (This is impossible
     * in the general case, but can happen if e.g. we play a network stream
     * using a timed URL, such that the server doesn't start the video with a
     * keyframe). */
    if( !p_sys->b_decoded_first_keyframe )
        p_block->i_flags |= BLOCK_FLAG_PREROLL; /* Wait until we've decoded the first keyframe */

    return ProcessPacket( p_dec, &oggpacket, pp_block );
}