static int encoded (FishSound * fsound, unsigned char * buf, long bytes, void * user_data) { FS_EncDec * ed = (FS_EncDec *) user_data; fish_sound_decode (ed->decoder, buf, bytes); return 0; }
int read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) { FishSound * fsound = (FishSound *)user_data; fish_sound_prepare_truncation (fsound, op->granulepos, op->e_o_s); fish_sound_decode (fsound, op->packet, op->bytes); return 0; }
static int read_packet (OGGZ * oggz, ogg_packet * op, long serialno, void * user_data) { FS_DecEnc * ed = (FS_DecEnc *) user_data; fish_sound_prepare_truncation (ed->decoder, op->granulepos, op->e_o_s); fish_sound_decode (ed->decoder, op->packet, op->bytes); return 0; }
static OMX_ERRORTYPE transform_buffer (vorbisd_prc_t *ap_prc) { OMX_ERRORTYPE rc = OMX_ErrorNone; OMX_BUFFERHEADERTYPE *p_in = tiz_filter_prc_get_header (ap_prc, ARATELIA_VORBIS_DECODER_INPUT_PORT_INDEX); OMX_BUFFERHEADERTYPE *p_out = tiz_filter_prc_get_header (ap_prc, ARATELIA_VORBIS_DECODER_OUTPUT_PORT_INDEX); if (NULL == p_in || NULL == p_out) { TIZ_TRACE (handleOf (ap_prc), "IN HEADER [%p] OUT HEADER [%p]", p_in, p_out); return OMX_ErrorNone; } assert (NULL != ap_prc); if (0 == p_in->nFilledLen) { TIZ_TRACE (handleOf (ap_prc), "HEADER [%p] nFlags [%d] is empty", p_in, p_in->nFlags); if ((p_in->nFlags & OMX_BUFFERFLAG_EOS) > 0) { /* Inmediately propagate EOS flag to output */ TIZ_TRACE (handleOf (ap_prc), "Let's propagate EOS flag to output"); p_out->nFlags |= OMX_BUFFERFLAG_EOS; p_in->nFlags &= ~(1 << OMX_BUFFERFLAG_EOS); tiz_check_omx_err (tiz_filter_prc_release_header (ap_prc, ARATELIA_VORBIS_DECODER_OUTPUT_PORT_INDEX)); } } if (p_in->nFilledLen > 0) { unsigned char *p_data = p_in->pBuffer + p_in->nOffset; const long len = p_in->nFilledLen; long bytes_consumed = fish_sound_decode (ap_prc->p_fsnd_, p_data, len); TIZ_TRACE (handleOf (ap_prc), "p_in->nFilledLen [%d] ", p_in->nFilledLen); TIZ_TRACE (handleOf (ap_prc), "bytes_consumed [%d] ", bytes_consumed); if (bytes_consumed >= 0) { assert (p_in->nFilledLen >= bytes_consumed); p_in->nFilledLen = 0; p_in->nOffset = 0; } else { switch (bytes_consumed) { case FISH_SOUND_STOP_ERR: { /* Decoding was stopped by a FishSoundDecode* */ /* callback returning FISH_SOUND_STOP_ERR before any input * bytes were consumed. */ /* This will occur when PCM is decoded from previously * buffered input, and */ /* stopping is immediately requested. */ TIZ_ERROR (handleOf (ap_prc), "[FISH_SOUND_ERR_STOP_ERR] : " "While decoding the input stream."); rc = OMX_ErrorStreamCorruptFatal; } break; case FISH_SOUND_ERR_OUT_OF_MEMORY: { TIZ_ERROR (handleOf (ap_prc), "[FISH_SOUND_ERR_OUT_OF_MEMORY] : " "While decoding the input stream."); rc = OMX_ErrorInsufficientResources; } break; case FISH_SOUND_ERR_BAD: { TIZ_ERROR (handleOf (ap_prc), "[FISH_SOUND_ERR_BAD] : " "While decoding the input stream."); rc = OMX_ErrorStreamCorruptFatal; } break; default: { TIZ_ERROR (handleOf (ap_prc), "[%s] : " "While decoding the input stream.", bytes_consumed); assert (0); rc = OMX_ErrorStreamCorruptFatal; } }; } } assert (p_in->nFilledLen >= 0); if (0 == p_in->nFilledLen) { TIZ_TRACE (handleOf (ap_prc), "HEADER [%p] nFlags [%d] is empty", p_in, p_in->nFlags); if ((p_in->nFlags & OMX_BUFFERFLAG_EOS) > 0) { /* Let's propagate EOS flag to output */ TIZ_TRACE (handleOf (ap_prc), "Let's propagate EOS flag to output"); tiz_filter_prc_update_eos_flag (ap_prc, true); p_in->nFlags &= ~(1 << OMX_BUFFERFLAG_EOS); } rc = tiz_filter_prc_release_header (ap_prc, ARATELIA_VORBIS_DECODER_INPUT_PORT_INDEX); } return rc; }
int acceptPacket(ogg_packet *p) { fish_sound_prepare_truncation(m_fishSound, p->granulepos, p->e_o_s); fish_sound_decode(m_fishSound, p->packet, p->bytes); return 0; }