Displaying 6 results from an estimated 6 matches for "spx_bits_".
2010 Apr 15
2
Decoded output buffer size
...code a multi-frame payload.
Once have called speex_bits_read_from, I need a way to know how many
speex frames there are, how can I do this?
I try to use speex_bits_remaining, but after some cycles it returns
always 4.
UINT DecodePayload( char* payload, UINT payload_len )
{
  speex_bits_reset(&spx_bits_);
  speex_bits_read_from(&spx_bits_, payload, payload_len);
  UINT nbBytes = speex_bits_remaining(&spx_bits_);
  while (nbBytes>0)
  {
    speex_decode(spx_state_, &spx_bits_, spx_dec_frame_);
    nbBytes = speex_bits_remaining(&spx_bits_);
    // Save the speex frame into the...
2010 Apr 13
1
Another newbie question on encoding
...SC_DECODER
  };
  enum ESpeexCodecMode
  {
    SC_NARROWBAND,    //  8 kHz
    SC_WIDEBAND,      // 16 kHz
    SC_ULTRAWIDEBAND  // 32 kHz
  };
  CSpeexCodec();
  ~CSpeexCodec();
  BOOL  Init();
  UINT  Encode( sample_type *inBuff, char **outBuff, UINT BufferFrames );
private:
  SpeexBits       spx_bits_;
  void*           spx_state_;
  UINT            spx_quality_;
  UINT            frameSize_;
  char*           outBuffer_;
};
BOOL CSpeexCodec::Init()
{
  spx_state_ = speex_encoder_init(&speex_nb_mode);
  speex_encoder_ctl(spx_state_, SPEEX_GET_FRAME_SIZE, &frameSize_);
  // Create the o...
2010 Apr 14
3
Decoded output buffer size
...odec::Encode( float *inBuff,
                          const char**outBuff,
                          UINT BufferFrames )
{
  speex_encoder_ctl(spx_state_,
                    SPEEX_GET_FRAME_SIZE,
                    &spx_frame_size_);
  while (BufferFrames>0)
  {
    speex_bits_reset(&spx_bits_);
    speex_encode(spx_state_, inBuff, &spx_bits_);
    nbBytes += speex_bits_write(&spx_bits_,
                                spx_enc_frame_,
                                spx_frame_size_);
    inBuff+= spx_frame_size_;
    BufferFrames -= spx_frame_size_;
  }
  ..nbBytes is 80 bytes.....
2010 Apr 15
0
Decoded output buffer size
...called speex_bits_read_from, I need a way to know how many
> speex frames there are, how can I do this?
>
> I try to use speex_bits_remaining, but after some cycles it returns
> always 4.
>
> UINT DecodePayload( char* payload, UINT payload_len )
> {
> ?speex_bits_reset(&spx_bits_);
> ?speex_bits_read_from(&spx_bits_, payload, payload_len);
> ?UINT nbBytes = speex_bits_remaining(&spx_bits_);
>
> ?while (nbBytes>0)
> ?{
> ? ?speex_decode(spx_state_, &spx_bits_, spx_dec_frame_);
> ? ?nbBytes = speex_bits_remaining(&spx_bits_);
>
>...
2010 Apr 14
2
Decoded output buffer size
Hi,
in a VoIP application, the endpoint A send speex payload to B.
B doesn't know how A acquire audio, it only know that the channel is
narrowband so, how can B know the size of the output buffer to pass to
the speex_decode()?
Thanks,
Daniele.
2010 Apr 14
0
Decoded output buffer size
...? ? ? ? ? ? ? ? ?const char**outBuff,
> ? ? ? ? ? ? ? ? ? ? ? ? ?UINT BufferFrames )
> {
> ?speex_encoder_ctl(spx_state_,
> ? ? ? ? ? ? ? ? ? ?SPEEX_GET_FRAME_SIZE,
> ? ? ? ? ? ? ? ? ? ?&spx_frame_size_);
>
> ?while (BufferFrames>0)
> ?{
> ? ?speex_bits_reset(&spx_bits_);
> ? ?speex_encode(spx_state_, inBuff, &spx_bits_);
> ? ?nbBytes += speex_bits_write(&spx_bits_,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?spx_enc_frame_,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?spx_frame_size_);
> ? ?inBuff+= spx_frame_size_;
> ? ?BufferFrames -= spx_frame_size_;
> ?...