static OMX_ERRORTYPE alloc_data_stores (oggdmux_prc_t * ap_prc) { OMX_PARAM_PORTDEFINITIONTYPE port_def; assert (ap_prc); port_def.nSize = (OMX_U32) sizeof (OMX_PARAM_PORTDEFINITIONTYPE); port_def.nVersion.nVersion = OMX_VERSION; port_def.nPortIndex = ARATELIA_OGG_DEMUXER_AUDIO_PORT_BASE_INDEX; tiz_check_omx ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); ap_prc->aud_buf_size_ = port_def.nBufferSize; assert (ap_prc->p_aud_store_ == NULL); ap_prc->aud_store_size_ = port_def.nBufferSize; tiz_check_null_ret_oom ( (ap_prc->p_aud_store_ = tiz_mem_alloc (ap_prc->aud_store_size_))); port_def.nPortIndex = ARATELIA_OGG_DEMUXER_VIDEO_PORT_BASE_INDEX; tiz_check_omx ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); ap_prc->vid_buf_size_ = port_def.nBufferSize; assert (ap_prc->p_vid_store_ == NULL); ap_prc->vid_store_size_ = port_def.nBufferSize; tiz_check_null_ret_oom ( (ap_prc->p_vid_store_ = tiz_mem_alloc (ap_prc->vid_store_size_))); return OMX_ErrorNone; }
static OMX_ERRORTYPE obtain_next_url (dirble_prc_t * ap_prc, int a_skip_value) { OMX_ERRORTYPE rc = OMX_ErrorNone; const long pathname_max = PATH_MAX + NAME_MAX; assert (ap_prc); assert (ap_prc->p_dirble_); if (!ap_prc->p_uri_param_) { ap_prc->p_uri_param_ = tiz_mem_calloc ( 1, sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1); } tiz_check_null_ret_oom (ap_prc->p_uri_param_ != NULL); ap_prc->p_uri_param_->nSize = sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1; ap_prc->p_uri_param_->nVersion.nVersion = OMX_VERSION; { const char * p_next_url = a_skip_value > 0 ? tiz_dirble_get_next_url (ap_prc->p_dirble_, ap_prc->remove_current_url_) : tiz_dirble_get_prev_url ( ap_prc->p_dirble_, ap_prc->remove_current_url_); ap_prc->remove_current_url_ = false; tiz_check_null_ret_oom (p_next_url != NULL); { const OMX_U32 url_len = strnlen (p_next_url, pathname_max); TIZ_TRACE (handleOf (ap_prc), "URL [%s]", p_next_url); /* Verify we are getting an http scheme */ if (!p_next_url || !url_len || (memcmp (p_next_url, "http://", 7) != 0 && memcmp (p_next_url, "https://", 8) != 0)) { rc = OMX_ErrorContentURIError; } else { strncpy ((char *) ap_prc->p_uri_param_->contentURI, p_next_url, url_len); ap_prc->p_uri_param_->contentURI[url_len] = '\000'; /* Song metadata is now available, update the IL client */ rc = update_metadata (ap_prc); } } } return rc; }
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 OMX_ERRORTYPE alloc_file (oggdmux_prc_t * ap_prc) { OMX_ERRORTYPE rc = OMX_ErrorNone; assert (ap_prc); assert (!ap_prc->p_file_); tiz_check_null_ret_oom ( (ap_prc->p_file_ = fopen ((const char *) ap_prc->p_uri_->contentURI, "r"))); return rc; }
static OMX_ERRORTYPE alloc_oggz (oggdmux_prc_t * ap_prc) { assert (ap_prc); assert (!ap_prc->p_oggz_); /* Allocate the oggz object */ tiz_check_null_ret_oom ((ap_prc->p_oggz_ = oggz_new (OGGZ_READ))); /* Allocate a table */ tiz_check_null_ret_oom ((ap_prc->p_tracks_ = oggz_table_new ())); /* Set the io callbacks */ on_oggz_error_ret_omx_oom ( oggz_io_set_read (ap_prc->p_oggz_, og_io_read, ap_prc)); on_oggz_error_ret_omx_oom ( oggz_io_set_seek (ap_prc->p_oggz_, og_io_seek, ap_prc)); on_oggz_error_ret_omx_oom ( oggz_io_set_tell (ap_prc->p_oggz_, og_io_tell, ap_prc)); return OMX_ErrorNone; }
static OMX_ERRORTYPE httpr_prc_config_change (const void * ap_prc, const OMX_U32 a_pid, const OMX_INDEXTYPE a_config_idx) { const httpr_prc_t * p_prc = ap_prc; OMX_ERRORTYPE rc = OMX_ErrorNone; assert (ap_prc); if (p_prc->p_server_ && OMX_TizoniaIndexConfigIcecastMetadata == a_config_idx && ARATELIA_HTTP_RENDERER_PORT_INDEX == a_pid) { OMX_TIZONIA_ICECASTMETADATATYPE * p_metadata = (OMX_TIZONIA_ICECASTMETADATATYPE *) tiz_mem_calloc ( 1, sizeof (OMX_TIZONIA_ICECASTMETADATATYPE) + OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE + 1); tiz_check_null_ret_oom (p_metadata); /* Retrieve the updated icecast metadata from the input port */ TIZ_INIT_OMX_PORT_STRUCT (*p_metadata, ARATELIA_HTTP_RENDERER_PORT_INDEX); p_metadata->nSize = sizeof (OMX_TIZONIA_ICECASTMETADATATYPE) + OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE; if (OMX_ErrorNone != (rc = tiz_api_GetConfig ( tiz_get_krn (handleOf (p_prc)), handleOf (p_prc), OMX_TizoniaIndexConfigIcecastMetadata, p_metadata))) { TIZ_ERROR (handleOf (p_prc), "[%s] : Error retrieving " "OMX_TizoniaIndexConfigIcecastMetadata from port", tiz_err_to_str (rc)); } else { httpr_srv_set_stream_title (p_prc->p_server_, p_metadata->cStreamTitle); } tiz_mem_free (p_metadata); p_metadata = NULL; } return rc; }
static OMX_ERRORTYPE alloc_temp_data_store (vorbisd_prc_t *ap_prc) { OMX_PARAM_PORTDEFINITIONTYPE port_def; assert (NULL != ap_prc); port_def.nSize = (OMX_U32)sizeof(OMX_PARAM_PORTDEFINITIONTYPE); port_def.nVersion.nVersion = OMX_VERSION; port_def.nPortIndex = ARATELIA_VORBIS_DECODER_INPUT_PORT_INDEX; tiz_check_omx_err ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); assert (ap_prc->p_store_ == NULL); ap_prc->store_size_ = port_def.nBufferSize; tiz_check_null_ret_oom ( (ap_prc->p_store_ = tiz_mem_alloc (ap_prc->store_size_))); return OMX_ErrorNone; }
static OMX_ERRORTYPE init_vorbis_decoder (vorbisd_prc_t *ap_prc) { OMX_ERRORTYPE rc = OMX_ErrorInsufficientResources; assert (NULL != ap_prc); tiz_check_null_ret_oom ( ap_prc->p_fsnd_ = fish_sound_new (FISH_SOUND_DECODE, &(ap_prc->fsinfo_))); if (0 != fish_sound_set_interleave (ap_prc->p_fsnd_, 1)) { TIZ_ERROR (handleOf (ap_prc), "[OMX_ErrorInsufficientResources] : " "Could not set interleaved."); goto end; } if (0 != fish_sound_set_decoded_float_ilv ( ap_prc->p_fsnd_, fishsound_decoded_callback, ap_prc)) { TIZ_ERROR (handleOf (ap_prc), "[OMX_ErrorInsufficientResources] : " "Could not set 'decoded' callback."); goto end; } rc = OMX_ErrorNone; end: if (OMX_ErrorInsufficientResources == rc) { fish_sound_delete (ap_prc->p_fsnd_); ap_prc->p_fsnd_ = NULL; } return rc; }