static OMX_ERRORTYPE obtain_url (cc_http_prc_t * ap_prc) { OMX_ERRORTYPE rc = OMX_ErrorNone; const long pathname_max = PATH_MAX + NAME_MAX; assert (ap_prc); assert (!ap_prc->p_content_uri_); ap_prc->p_content_uri_ = tiz_mem_calloc (1, sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1); tiz_check_null_ret_oom (ap_prc->p_content_uri_); ap_prc->p_content_uri_->nSize = sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1; ap_prc->p_content_uri_->nVersion.nVersion = OMX_VERSION; tiz_check_omx ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamContentURI, ap_prc->p_content_uri_)); TIZ_NOTICE (handleOf (ap_prc), "URI [%s]", ap_prc->p_content_uri_->contentURI); /* Verify we are getting an http scheme */ if (strncasecmp ((const char *) ap_prc->p_content_uri_->contentURI, "http://", 7) && strncasecmp ((const char *) ap_prc->p_content_uri_->contentURI, "https://", 8)) { rc = OMX_ErrorContentURIError; } return rc; }
static void mp4_log_cback (MP4LogLevel loglevel, const char * fmt, va_list ap) { #define MAX_ALLOCA_BUF 1024 char * buffer = alloca (MAX_ALLOCA_BUF); vsnprintf (buffer, MAX_ALLOCA_BUF, fmt, ap); /* typedef enum { MP4_LOG_NONE = 0, MP4_LOG_ERROR = 1, MP4_LOG_WARNING = 2, MP4_LOG_INFO = 3, MP4_LOG_VERBOSE1 = 4, MP4_LOG_VERBOSE2 = 5, MP4_LOG_VERBOSE3 = 6, MP4_LOG_VERBOSE4 = 7 } MP4LogLevel; */ switch(loglevel) { case MP4_LOG_ERROR: { TIZ_ERROR(handleOf(gp_prc), "%s", buffer); } break; case MP4_LOG_INFO: { TIZ_NOTICE(handleOf(gp_prc), "%s", buffer); } break; case MP4_LOG_WARNING: { TIZ_DEBUG(handleOf(gp_prc), "%s", buffer); } break; default: { TIZ_TRACE(handleOf(gp_prc), "%s", buffer); } break; }; }
static OMX_ERRORTYPE alloc_uri (oggdmux_prc_t * ap_prc) { OMX_ERRORTYPE rc = OMX_ErrorNone; const long pathname_max = PATH_MAX + NAME_MAX; assert (ap_prc); assert (!ap_prc->p_uri_); if (!(ap_prc->p_uri_ = tiz_mem_calloc ( 1, sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1))) { TIZ_ERROR (handleOf (ap_prc), "Error allocating memory for the content uri struct"); rc = OMX_ErrorInsufficientResources; } else { ap_prc->p_uri_->nSize = sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1; ap_prc->p_uri_->nVersion.nVersion = OMX_VERSION; if (OMX_ErrorNone != (rc = tiz_api_GetParameter ( tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamContentURI, ap_prc->p_uri_))) { TIZ_ERROR (handleOf (ap_prc), "[%s] : Error retrieving the URI param from port", tiz_err_to_str (rc)); } else { TIZ_NOTICE (handleOf (ap_prc), "URI [%s]", ap_prc->p_uri_->contentURI); } } return rc; }
static OMX_ERRORTYPE ivrport_SetConfig (const void * ap_obj, OMX_HANDLETYPE ap_hdl, OMX_INDEXTYPE a_index, OMX_PTR ap_struct) { tiz_ivrport_t * p_obj = (tiz_ivrport_t *) ap_obj; TIZ_TRACE (handleOf (ap_obj), "PORT [%d] SetConfig [%s]", tiz_port_index (ap_obj), tiz_idx_to_str (a_index)); assert (ap_obj); switch (a_index) { case OMX_IndexConfigCommonRotate: { OMX_CONFIG_ROTATIONTYPE * p_crotate = (OMX_CONFIG_ROTATIONTYPE *) ap_struct; p_obj->crotate_.nRotation = p_crotate->nRotation; } break; case OMX_IndexConfigCommonMirror: { OMX_CONFIG_MIRRORTYPE * p_cmirror = (OMX_CONFIG_MIRRORTYPE *) ap_struct; p_obj->cmirror_.eMirror = p_cmirror->eMirror; } break; case OMX_IndexConfigCommonScale: { OMX_CONFIG_SCALEFACTORTYPE * p_cscale = (OMX_CONFIG_SCALEFACTORTYPE *) ap_struct; p_obj->cscale_.xWidth = p_cscale->xWidth; p_obj->cscale_.xHeight = p_cscale->xHeight; } break; case OMX_IndexConfigCommonInputCrop: { OMX_CONFIG_RECTTYPE * p_cincrop = (OMX_CONFIG_RECTTYPE *) ap_struct; p_obj->cincrop_.nLeft = p_cincrop->nLeft; p_obj->cincrop_.nTop = p_cincrop->nTop; p_obj->cincrop_.nWidth = p_cincrop->nWidth; p_obj->cincrop_.nHeight = p_cincrop->nHeight; } break; case OMX_IndexConfigTimeRenderingDelay: { /* This is a read-only index. Simply ignore it. */ TIZ_NOTICE (ap_hdl, "Ignoring read-only index [%s] ", tiz_idx_to_str (a_index)); } break; default: { /* Try the parent's indexes */ return super_SetConfig (typeOf (ap_obj, "tizivrport"), ap_obj, ap_hdl, a_index, ap_struct); } }; return OMX_ErrorNone; }
static int fishsound_decoded_callback (FishSound *ap_fsound, float *app_pcm[], long frames, void *ap_user_data) { int rc = FISH_SOUND_CONTINUE; vorbisd_prc_t *p_prc = ap_user_data; OMX_BUFFERHEADERTYPE *p_out = NULL; (void)ap_fsound; assert (NULL != app_pcm); assert (NULL != ap_user_data); TIZ_TRACE (handleOf (p_prc), "frames [%d] ", frames); /* Possible return values are: */ /* FISH_SOUND_CONTINUE Continue decoding */ /* FISH_SOUND_STOP_OK Stop decoding immediately and return control to the fish_sound_decode() caller */ /* FISH_SOUND_STOP_ERR Stop decoding immediately, purge buffered data, and return control to the fish_sound_decode() caller */ if (!p_prc->started_) { p_prc->started_ = true; fish_sound_command (p_prc->p_fsnd_, FISH_SOUND_GET_INFO, &(p_prc->fsinfo_), sizeof(FishSoundInfo)); if (p_prc->fsinfo_.channels > 2 || p_prc->fsinfo_.format != FISH_SOUND_VORBIS) { TIZ_ERROR (handleOf (p_prc), "Supported Vorbis " "streams up tp 2 channels only."); rc = FISH_SOUND_STOP_ERR; goto end; } TIZ_NOTICE (handleOf (p_prc), "Channels [%d] sampling rate [%d]", p_prc->fsinfo_.channels, p_prc->fsinfo_.samplerate); } p_out = tiz_filter_prc_get_header (p_prc, ARATELIA_VORBIS_DECODER_OUTPUT_PORT_INDEX); if (NULL == p_out) { TIZ_TRACE (handleOf (p_prc), "No more output buffers " "available at the moment"); rc = FISH_SOUND_STOP_OK; goto end; } { /* write decoded PCM samples */ size_t i = 0; size_t frame_len = sizeof(float) * p_prc->fsinfo_.channels; size_t frames_alloc = ((p_out->nAllocLen - p_out->nOffset) / frame_len); size_t frames_to_write = (frames > frames_alloc) ? frames_alloc : frames; size_t bytes_to_write = frames_to_write * frame_len; assert (NULL != p_out); for (i = 0; i < frames_to_write; ++i) { size_t frame_offset = i * frame_len; size_t float_offset = i * p_prc->fsinfo_.channels; float *out = (float *)(p_out->pBuffer + p_out->nOffset + frame_offset); write_frame_float_ilv (out, ((float *)app_pcm) + float_offset, p_prc->fsinfo_.channels); } p_out->nFilledLen += bytes_to_write; p_out->nOffset += bytes_to_write; if (frames_to_write < frames) { /* Temporarily store the data until an omx buffer is * available */ OMX_U32 nbytes_remaining = (frames - frames_to_write) * frame_len; TIZ_TRACE (handleOf (p_prc), "Need to store [%d] bytes", nbytes_remaining); nbytes_remaining = store_data ( p_prc, (OMX_U8 *)(app_pcm[frames_to_write * sizeof(float)]), nbytes_remaining); } if (tiz_filter_prc_is_eos (p_prc)) { /* Propagate EOS flag to output */ p_out->nFlags |= OMX_BUFFERFLAG_EOS; tiz_filter_prc_update_eos_flag (p_prc, false); TIZ_TRACE (handleOf (p_prc), "Propagating EOS flag to output"); } /* TODO: Shouldn't ignore this rc */ (void)tiz_filter_prc_release_header (p_prc, ARATELIA_VORBIS_DECODER_OUTPUT_PORT_INDEX); /* Let's process one input buffer at a time, for now */ rc = FISH_SOUND_STOP_OK; } end: return rc; }