static OMX_ERRORTYPE release_all_buffers (oggdmux_prc_t * ap_prc, const OMX_U32 a_pid) { assert (ap_prc); if ((a_pid == ARATELIA_OGG_DEMUXER_AUDIO_PORT_BASE_INDEX || a_pid == OMX_ALL) && (ap_prc->p_aud_hdr_)) { void * p_krn = tiz_get_krn (handleOf (ap_prc)); tiz_check_omx (tiz_krn_release_buffer ( p_krn, ARATELIA_OGG_DEMUXER_AUDIO_PORT_BASE_INDEX, ap_prc->p_aud_hdr_)); ap_prc->p_aud_hdr_ = NULL; } if ((a_pid == ARATELIA_OGG_DEMUXER_VIDEO_PORT_BASE_INDEX || a_pid == OMX_ALL) && (ap_prc->p_vid_hdr_)) { void * p_krn = tiz_get_krn (handleOf (ap_prc)); tiz_check_omx (tiz_krn_release_buffer ( p_krn, ARATELIA_OGG_DEMUXER_VIDEO_PORT_BASE_INDEX, ap_prc->p_vid_hdr_)); ap_prc->p_vid_hdr_ = NULL; } ap_prc->awaiting_buffers_ = true; return OMX_ErrorNone; }
OMX_ERRORTYPE graph::vorbisdecops::set_vorbis_settings () { // Retrieve the current vorbis settings from the decoder's port #0 OMX_AUDIO_PARAM_VORBISTYPE vorbistype_orig; TIZ_INIT_OMX_PORT_STRUCT (vorbistype_orig, 0 /* port id */); tiz_check_omx (OMX_GetParameter (handles_[1], OMX_IndexParamAudioVorbis, &vorbistype_orig)); // Set the vorbis settings on decoder's port #0 OMX_AUDIO_PARAM_VORBISTYPE vorbistype; TIZ_INIT_OMX_PORT_STRUCT (vorbistype, 0 /* port id */); probe_ptr_->get_vorbis_codec_info (vorbistype); vorbistype.nPortIndex = 0; tiz_check_omx ( OMX_SetParameter (handles_[1], OMX_IndexParamAudioVorbis, &vorbistype)); // Record whether we need to wait for a port settings change event or not // (the decoder output port implements the "slaving" behaviour) need_port_settings_changed_evt_ = ((vorbistype_orig.nSampleRate != vorbistype.nSampleRate) || (vorbistype_orig.nChannels != vorbistype.nChannels)); return OMX_ErrorNone; }
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; }
OMX_ERRORTYPE graph::gmusicops::set_channels_and_rate_on_decoder ( const OMX_U32 channels, const OMX_U32 sampling_rate) { const OMX_HANDLETYPE handle = handles_[1]; // decoder's handle const OMX_U32 port_id = 0; // decoder's input port TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels, sampling_rate); // Retrieve the mp3 settings from the decoder component TIZ_INIT_OMX_PORT_STRUCT (decoder_mp3type_, port_id); tiz_check_omx ( OMX_GetParameter (handle, OMX_IndexParamAudioMp3, &decoder_mp3type_)); TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels, sampling_rate); // Now assign the actual settings to the pcmtype structure decoder_mp3type_.nChannels = channels; decoder_mp3type_.nSampleRate = sampling_rate; // Set the new mp3 settings tiz_check_omx ( OMX_SetParameter (handle, OMX_IndexParamAudioMp3, &decoder_mp3type_)); TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels, sampling_rate); return OMX_ErrorNone; }
static OMX_ERRORTYPE httpr_prc_prepare_to_transfer (void * ap_prc, OMX_U32 a_pid) { httpr_prc_t * p_prc = ap_prc; assert (p_prc); /* Obtain mp3 settings from port */ tiz_check_omx (retrieve_mp3_settings (ap_prc, &(p_prc->mp3type_))); httpr_srv_set_mp3_settings (p_prc->p_server_, p_prc->mp3type_.nBitRate, p_prc->mp3type_.nChannels, p_prc->mp3type_.nSampleRate); /* Obtain mount point and station-related information */ tiz_check_omx ( retrieve_mountpoint_settings (ap_prc, &(p_prc->mountpoint_))); httpr_srv_set_mountpoint_settings ( p_prc->p_server_, p_prc->mountpoint_.cMountName, p_prc->mountpoint_.cStationName, p_prc->mountpoint_.cStationDescription, p_prc->mountpoint_.cStationGenre, p_prc->mountpoint_.cStationUrl, p_prc->mountpoint_.nIcyMetadataPeriod, (p_prc->mountpoint_.bBurstOnConnect == OMX_TRUE ? p_prc->mountpoint_.nInitialBurstSize : 0), p_prc->mountpoint_.nMaxClients); tiz_check_omx ( httpr_prc_config_change (p_prc, ARATELIA_HTTP_RENDERER_PORT_INDEX, OMX_TizoniaIndexConfigIcecastMetadata)); return httpr_srv_start (p_prc->p_server_); }
static OMX_ERRORTYPE prepare_port_auto_detection (mp4dmuxflt_prc_t * ap_prc) { OMX_PARAM_PORTDEFINITIONTYPE port_def; assert (ap_prc); /* Prepare audio port */ TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_MP4_DEMUXER_FILTER_PORT_1_INDEX); tiz_check_omx ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); ap_prc->audio_coding_type_ = port_def.format.audio.eEncoding; ap_prc->audio_auto_detect_on_ = (OMX_AUDIO_CodingAutoDetect == ap_prc->audio_coding_type_) ? true : false; /* Prepare video port */ TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_MP4_DEMUXER_FILTER_PORT_2_INDEX); tiz_check_omx ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); ap_prc->video_coding_type_ = port_def.format.video.eCompressionFormat; ap_prc->video_auto_detect_on_ = (OMX_VIDEO_CodingAutoDetect == ap_prc->video_coding_type_) ? true : false; return OMX_ErrorNone; }
OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl) { tiz_role_factory_t audio_role; tiz_role_factory_t video_role; tiz_role_factory_t image_role; tiz_role_factory_t other_role; const tiz_role_factory_t *rf_list[] = { &audio_role, &video_role, &image_role, &other_role }; tiz_type_factory_t inprocrnd_prc_type; const tiz_type_factory_t *tf_list[] = { &inprocrnd_prc_type }; TIZ_LOG (TIZ_PRIORITY_TRACE, "OMX_ComponentInit: [%s]", ARATELIA_INPROC_WRITER_COMPONENT_NAME); strcpy ((OMX_STRING) audio_role.role, ARATELIA_INPROC_WRITER_AUDIO_ROLE); audio_role.pf_cport = instantiate_config_port; audio_role.pf_port[0] = instantiate_audio_port; audio_role.nports = 1; audio_role.pf_proc = instantiate_processor; strcpy ((OMX_STRING) video_role.role, ARATELIA_INPROC_WRITER_VIDEO_ROLE); video_role.pf_cport = instantiate_config_port; video_role.pf_port[0] = instantiate_video_port; video_role.nports = 1; video_role.pf_proc = instantiate_processor; strcpy ((OMX_STRING) image_role.role, ARATELIA_INPROC_WRITER_IMAGE_ROLE); image_role.pf_cport = instantiate_config_port; image_role.pf_port[0] = instantiate_image_port; image_role.nports = 1; image_role.pf_proc = instantiate_processor; strcpy ((OMX_STRING) other_role.role, ARATELIA_INPROC_WRITER_OTHER_ROLE); other_role.pf_cport = instantiate_config_port; other_role.pf_port[0] = instantiate_other_port; other_role.nports = 1; other_role.pf_proc = instantiate_processor; strcpy ((OMX_STRING) inprocrnd_prc_type.class_name, "inprocrnd_prc_class"); inprocrnd_prc_type.pf_class_init = inprocrnd_prc_class_init; strcpy ((OMX_STRING) inprocrnd_prc_type.object_name, "inprocrnd_prc"); inprocrnd_prc_type.pf_object_init = inprocrnd_prc_init; /* Initialize the component infrastructure */ tiz_check_omx (tiz_comp_init (ap_hdl, ARATELIA_INPROC_WRITER_COMPONENT_NAME)); /* Register the "inprocrnd_prc" class */ tiz_check_omx (tiz_comp_register_types (ap_hdl, tf_list, 1)); /* Register the various roles */ tiz_check_omx (tiz_comp_register_roles (ap_hdl, rf_list, 4)); return OMX_ErrorNone; }
static OMX_ERRORTYPE mp3d_proc_prepare_to_transfer (void * ap_obj, OMX_U32 a_pid) { mp3d_prc_t * p_prc = ap_obj; OMX_AUDIO_PARAM_MP3TYPE mp3type; assert (p_prc); /* NOTE: init the decoder here, as it might have been de-inited in a transition Exe->Idle */ init_mad_decoder (ap_obj); TIZ_INIT_OMX_PORT_STRUCT (mp3type, ARATELIA_MP3_DECODER_INPUT_PORT_INDEX); tiz_check_omx (tiz_api_GetParameter (tiz_get_krn (handleOf (p_prc)), handleOf (p_prc), OMX_IndexParamAudioMp3, &mp3type)); TIZ_INIT_OMX_PORT_STRUCT (p_prc->pcmmode_, ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX); tiz_check_omx (tiz_api_GetParameter (tiz_get_krn (handleOf (p_prc)), handleOf (p_prc), OMX_IndexParamAudioPcm, &(p_prc->pcmmode_))); TIZ_TRACE (handleOf (p_prc), "sample rate decoder = [%d] channels decoder = [%d]", mp3type.nSampleRate, mp3type.nChannels); TIZ_TRACE (handleOf (p_prc), "sample rate renderer = [%d] channels renderer = [%d]", p_prc->pcmmode_.nSamplingRate, p_prc->pcmmode_.nChannels); reset_stream_parameters (ap_obj); return OMX_ErrorNone; }
static OMX_ERRORTYPE sdlivr_prc_buffers_ready (const void * ap_obj) { sdlivr_prc_t * p_prc = (sdlivr_prc_t *) ap_obj; OMX_BUFFERHEADERTYPE * p_hdr = NULL; void * p_krn = tiz_get_krn (handleOf (ap_obj)); assert (p_prc); if (!p_prc->port_disabled_) { tiz_check_omx (tiz_krn_claim_buffer ( p_krn, ARATELIA_YUV_RENDERER_PORT_INDEX, 0, &p_hdr)); while (!p_prc->port_disabled_ && p_hdr) { if (p_hdr) { tiz_check_omx (sdlivr_prc_render_buffer (ap_obj, p_hdr)); if (p_hdr->nFlags & OMX_BUFFERFLAG_EOS) { TIZ_TRACE (handleOf (ap_obj), "OMX_BUFFERFLAG_EOS in HEADER [%p]", p_hdr); tiz_srv_issue_event ((OMX_PTR) ap_obj, OMX_EventBufferFlag, 0, p_hdr->nFlags, NULL); } tiz_check_omx (tiz_krn_release_buffer ( p_krn, ARATELIA_YUV_RENDERER_PORT_INDEX, p_hdr)); tiz_check_omx (tiz_krn_claim_buffer ( p_krn, ARATELIA_YUV_RENDERER_PORT_INDEX, 0, &p_hdr)); } } } return OMX_ErrorNone; }
OMX_ERRORTYPE graph::youtubeops::apply_default_config_on_decoder () { if (OMX_AUDIO_CodingVORBIS == encoding_) { const OMX_HANDLETYPE handle = handles_[2]; // vorbis decoder's handle const OMX_U32 port_id = 0; // vorbis decoder's input port OMX_U32 channels; OMX_U32 sampling_rate; tiz_check_omx ( tiz::graph::util:: get_channels_and_rate_from_audio_port< OMX_AUDIO_PARAM_VORBISTYPE > ( handle, port_id, OMX_IndexParamAudioVorbis, channels, sampling_rate)); channels = 2; sampling_rate = 44100; tiz_check_omx ( tiz::graph::util:: set_channels_and_rate_on_audio_port< OMX_AUDIO_PARAM_VORBISTYPE > ( handle, port_id, OMX_IndexParamAudioVorbis, channels, sampling_rate)); } return OMX_ErrorNone; }
OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl) { tiz_role_factory_t role_factory; const tiz_role_factory_t * rf_list[] = {&role_factory}; tiz_type_factory_t opusfiledprc_type; const tiz_type_factory_t * tf_list[] = {&opusfiledprc_type}; strcpy ((OMX_STRING) role_factory.role, ARATELIA_OPUS_DECODER_DEFAULT_ROLE); role_factory.pf_cport = instantiate_config_port; role_factory.pf_port[0] = instantiate_opus_port; role_factory.pf_port[1] = instantiate_pcm_port; role_factory.nports = 2; role_factory.pf_proc = instantiate_processor; strcpy ((OMX_STRING) opusfiledprc_type.class_name, "opusfiledprc_class"); opusfiledprc_type.pf_class_init = opusfiled_prc_class_init; strcpy ((OMX_STRING) opusfiledprc_type.object_name, "opusfiledprc"); opusfiledprc_type.pf_object_init = opusfiled_prc_init; /* Initialize the component infrastructure */ tiz_check_omx (tiz_comp_init (ap_hdl, ARATELIA_OPUS_DECODER_COMPONENT_NAME)); /* Register the "opusfiledprc" class */ tiz_check_omx (tiz_comp_register_types (ap_hdl, tf_list, 1)); /* Register the component role(s) */ tiz_check_omx (tiz_comp_register_roles (ap_hdl, rf_list, 1)); return OMX_ErrorNone; }
static OMX_ERRORTYPE oggdmux_prc_prepare_to_transfer (void * ap_obj, OMX_U32 a_pid) { oggdmux_prc_t * p_prc = ap_obj; assert (p_prc); tiz_check_omx (obtain_tracks (p_prc)); tiz_check_omx (set_read_packet_callbacks (p_prc)); return OMX_ErrorNone; }
/* * from tizsrv class */ static OMX_ERRORTYPE oggdmux_prc_allocate_resources (void * ap_obj, OMX_U32 a_pid) { oggdmux_prc_t * p_prc = ap_obj; assert (p_prc); tiz_check_omx (alloc_uri (p_prc)); tiz_check_omx (alloc_file (p_prc)); tiz_check_omx (alloc_data_stores (p_prc)); tiz_check_omx (alloc_oggz (p_prc)); return OMX_ErrorNone; }
OMX_ERRORTYPE graph::youtubeops::apply_pcm_codec_info_from_decoder () { OMX_U32 channels = 2; OMX_U32 sampling_rate = 44100; std::string encoding_str; tiz_check_omx (get_channels_and_rate_from_decoder (channels, sampling_rate, encoding_str)); tiz_check_omx (set_channels_and_rate_on_renderer (channels, sampling_rate, encoding_str)); return OMX_ErrorNone; }
OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl) { tiz_role_factory_t sink_role_factory; tiz_role_factory_t filter_role_factory; const tiz_role_factory_t * rf_list[] = {&sink_role_factory, &filter_role_factory}; tiz_type_factory_t oggmuxsnkprc_type; tiz_type_factory_t oggmuxfltprc_type; const tiz_type_factory_t * tf_list[] = {&oggmuxsnkprc_type, &oggmuxfltprc_type}; strcpy ((OMX_STRING) sink_role_factory.role, ARATELIA_OGG_MUXER_SINK_ROLE); sink_role_factory.pf_cport = instantiate_config_port; sink_role_factory.pf_port[0] = instantiate_sink_audio_input_port; sink_role_factory.pf_port[1] = instantiate_sink_video_input_port; sink_role_factory.nports = 2; sink_role_factory.pf_proc = instantiate_sink_processor; strcpy ((OMX_STRING) filter_role_factory.role, ARATELIA_OGG_MUXER_FILTER_ROLE); filter_role_factory.pf_cport = instantiate_config_port; filter_role_factory.pf_port[0] = instantiate_filter_audio_input_port; filter_role_factory.pf_port[1] = instantiate_filter_video_input_port; filter_role_factory.pf_port[2] = instantiate_filter_ogg_output_port; filter_role_factory.nports = 3; filter_role_factory.pf_proc = instantiate_filter_processor; strcpy ((OMX_STRING) oggmuxsnkprc_type.class_name, "oggmuxsnkprc_class"); oggmuxsnkprc_type.pf_class_init = oggmuxsnk_prc_class_init; strcpy ((OMX_STRING) oggmuxsnkprc_type.object_name, "oggmuxsnkprc"); oggmuxsnkprc_type.pf_object_init = oggmuxsnk_prc_init; strcpy ((OMX_STRING) oggmuxfltprc_type.class_name, "oggmuxfltprc_class"); oggmuxfltprc_type.pf_class_init = oggmuxflt_prc_class_init; strcpy ((OMX_STRING) oggmuxfltprc_type.object_name, "oggmuxfltprc"); oggmuxfltprc_type.pf_object_init = oggmuxflt_prc_init; /* Initialize the component infrastructure */ tiz_check_omx (tiz_comp_init (ap_hdl, ARATELIA_OGG_MUXER_COMPONENT_NAME)); /* Register the various classes */ tiz_check_omx (tiz_comp_register_types (ap_hdl, tf_list, 2)); /* Register the component roles */ tiz_check_omx (tiz_comp_register_roles (ap_hdl, rf_list, 2)); return OMX_ErrorNone; }
static OMX_ERRORTYPE release_headers (const void * ap_obj, OMX_U32 a_pid) { mp3d_prc_t * p_obj = (mp3d_prc_t *) ap_obj; assert (ap_obj); if (OMX_ALL == a_pid || ARATELIA_MP3_DECODER_INPUT_PORT_INDEX == a_pid) { if (p_obj->p_inhdr_) { if ((p_obj->p_inhdr_->nFlags & OMX_BUFFERFLAG_EOS) != 0) { TIZ_TRACE (handleOf (ap_obj), "EOS received"); p_obj->eos_ = true; } p_obj->p_inhdr_->nOffset = 0; tiz_check_omx (tiz_krn_release_buffer ( tiz_get_krn (handleOf (ap_obj)), ARATELIA_MP3_DECODER_INPUT_PORT_INDEX, p_obj->p_inhdr_)); p_obj->p_inhdr_ = NULL; p_obj->remaining_ = 0; } } if (OMX_ALL == a_pid || ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX == a_pid) { if (p_obj->p_outhdr_) { if (p_obj->eos_) { /* EOS has been received and all the input data has been consumed * already, so its time to propagate the EOS flag */ p_obj->p_outhdr_->nFlags |= OMX_BUFFERFLAG_EOS; p_obj->eos_ = false; } TIZ_TRACE ( handleOf (p_obj), "Releasing output HEADER [%p] nFilledLen [%d] nAllocLen [%d]", p_obj->p_outhdr_, p_obj->p_outhdr_->nFilledLen, p_obj->p_outhdr_->nAllocLen); tiz_check_omx (tiz_krn_release_buffer ( tiz_get_krn (handleOf (ap_obj)), ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX, p_obj->p_outhdr_)); p_obj->p_outhdr_ = NULL; } } return OMX_ErrorNone; }
OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl) { tiz_role_factory_t role_factory; const tiz_role_factory_t * rf_list[] = {&role_factory}; tiz_type_factory_t vp8d_inport_type; tiz_type_factory_t vp8dprc_type; const tiz_type_factory_t * tf_list[] = {&vp8d_inport_type, &vp8dprc_type}; const tiz_eglimage_hook_t egl_validation_hook = { ARATELIA_VP8_DECODER_OUTPUT_PORT_INDEX, egl_image_validation_hook, NULL }; strcpy ((OMX_STRING) role_factory.role, ARATELIA_VP8_DECODER_DEFAULT_ROLE); role_factory.pf_cport = instantiate_config_port; role_factory.pf_port[0] = instantiate_input_port; role_factory.pf_port[1] = instantiate_output_port; role_factory.nports = 2; role_factory.pf_proc = instantiate_processor; strcpy ((OMX_STRING) vp8d_inport_type.class_name, "vp8dinport_class"); vp8d_inport_type.pf_class_init = vp8d_inport_class_init; strcpy ((OMX_STRING) vp8d_inport_type.object_name, "vp8dinport"); vp8d_inport_type.pf_object_init = vp8d_inport_init; strcpy ((OMX_STRING) vp8dprc_type.class_name, "vp8dprc_class"); vp8dprc_type.pf_class_init = vp8d_prc_class_init; strcpy ((OMX_STRING) vp8dprc_type.object_name, "vp8dprc"); vp8dprc_type.pf_object_init = vp8d_prc_init; /* Initialize the component infrastructure */ tiz_check_omx (tiz_comp_init (ap_hdl, ARATELIA_VP8_DECODER_COMPONENT_NAME)); /* Register the "vp8dprc" class */ tiz_check_omx (tiz_comp_register_types (ap_hdl, tf_list, 2)); /* Register the component role */ tiz_check_omx (tiz_comp_register_roles (ap_hdl, rf_list, 1)); /* Register the egl image validation hook for the default role */ tiz_check_omx (tiz_comp_register_role_eglimage_hook ( ap_hdl, (const OMX_U8 *) ARATELIA_VP8_DECODER_DEFAULT_ROLE, &egl_validation_hook)); return OMX_ErrorNone; }
static OMX_ERRORTYPE release_buffer (scloud_prc_t * ap_prc) { assert (ap_prc); if (ap_prc->p_outhdr_) { if (ap_prc->bytes_before_eos_ > ap_prc->p_outhdr_->nFilledLen) { ap_prc->bytes_before_eos_ -= ap_prc->p_outhdr_->nFilledLen; } else { ap_prc->bytes_before_eos_ = 0; ap_prc->eos_ = true; } if (ap_prc->eos_) { ap_prc->eos_ = false; ap_prc->p_outhdr_->nFlags |= OMX_BUFFERFLAG_EOS; } tiz_check_omx (tiz_krn_release_buffer ( tiz_get_krn (handleOf (ap_prc)), ARATELIA_HTTP_SOURCE_PORT_INDEX, ap_prc->p_outhdr_)); ap_prc->p_outhdr_ = NULL; } return OMX_ErrorNone; }
static OMX_ERRORTYPE update_pcm_mode (mp3d_prc_t * ap_prc, const OMX_U32 a_samplerate, const OMX_U32 a_channels) { assert (ap_prc); if (a_samplerate != ap_prc->pcmmode_.nSamplingRate || a_channels != ap_prc->pcmmode_.nChannels) { TIZ_DEBUG (handleOf (ap_prc), "Updating pcm mode : old samplerate [%d] new samplerate [%d]", ap_prc->pcmmode_.nSamplingRate, a_samplerate); TIZ_DEBUG (handleOf (ap_prc), "Updating pcm mode : old channels [%d] new channels [%d]", ap_prc->pcmmode_.nChannels, a_channels); ap_prc->pcmmode_.nSamplingRate = a_samplerate; ap_prc->pcmmode_.nChannels = a_channels; tiz_check_omx (tiz_krn_SetParameter_internal ( tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamAudioPcm, &(ap_prc->pcmmode_))); tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventPortSettingsChanged, ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX, OMX_IndexParamAudioPcm, /* the index of the struct that has been modififed */ NULL); } return OMX_ErrorNone; }
static OMX_ERRORTYPE scloud_prc_config_change (void * ap_prc, OMX_U32 TIZ_UNUSED (a_pid), OMX_INDEXTYPE a_config_idx) { scloud_prc_t * p_prc = ap_prc; OMX_ERRORTYPE rc = OMX_ErrorNone; assert (p_prc); if (OMX_TizoniaIndexConfigPlaylistSkip == a_config_idx && p_prc->p_trans_) { TIZ_INIT_OMX_STRUCT (p_prc->playlist_skip_); tiz_check_omx (tiz_api_GetConfig ( tiz_get_krn (handleOf (p_prc)), handleOf (p_prc), OMX_TizoniaIndexConfigPlaylistSkip, &p_prc->playlist_skip_)); p_prc->playlist_skip_.nValue > 0 ? obtain_next_url (p_prc, 1) : obtain_next_url (p_prc, -1); /* Changing the URL has the side effect of halting the current download */ tiz_urltrans_set_uri (p_prc->p_trans_, p_prc->p_uri_param_); if (p_prc->port_disabled_) { /* Record that the URI has changed, so that when the port is re-enabled, we restart the transfer */ p_prc->uri_changed_ = true; } else { /* re-start the transfer */ tiz_urltrans_start (p_prc->p_trans_); } } 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 sdlivr_prc_port_enable (const void * ap_obj, OMX_U32 a_pid) { sdlivr_prc_t * p_prc = (sdlivr_prc_t *) ap_obj; OMX_ERRORTYPE rc = OMX_ErrorNone; assert (p_prc); if (OMX_ALL == a_pid || ARATELIA_YUV_RENDERER_PORT_INDEX == a_pid) { if (p_prc->port_disabled_) { p_prc->port_disabled_ = false; tiz_check_omx (sdlivr_prc_allocate_resources (p_prc, OMX_ALL)); tiz_check_omx (sdlivr_prc_prepare_to_transfer (p_prc, OMX_ALL)); } } return rc; }
static OMX_ERRORTYPE mp3d_proc_buffers_ready (const void * ap_obj) { mp3d_prc_t * p_obj = (mp3d_prc_t *) ap_obj; assert (ap_obj); TIZ_TRACE (handleOf (p_obj), "buffers ready"); while (true) { if (!p_obj->p_inhdr_) { if ((!claim_input_buffer (p_obj) && p_obj->stream_.next_frame == NULL) || (!p_obj->p_inhdr_ && p_obj->stream_.error == MAD_ERROR_BUFLEN)) { break; } } if (!p_obj->p_outhdr_) { if (!claim_output_buffer (p_obj)) { break; } } tiz_check_omx (decode_buffer (ap_obj)); if (p_obj->p_inhdr_ != NULL && (0 == p_obj->p_inhdr_->nFilledLen)) { tiz_check_omx ( release_headers (p_obj, ARATELIA_MP3_DECODER_INPUT_PORT_INDEX)); } } if (p_obj->eos_ && p_obj->p_outhdr_) { /* EOS has been received and all the input data has been consumed * already, so its time to propagate the EOS flag */ tiz_check_omx ( release_headers (p_obj, ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX)); } return OMX_ErrorNone; }
OMX_ERRORTYPE graph::gmusicops::override_decoder_and_renderer_sampling_rates () { OMX_U32 channels = 2; OMX_U32 sampling_rate = 44100; tiz_check_omx ( set_channels_and_rate_on_decoder (channels, sampling_rate)); return set_channels_and_rate_on_renderer (channels, sampling_rate); }
static OMX_ERRORTYPE cc_http_prc_store_stream_metadata (const void * p_obj) { cc_http_prc_t * p_prc = (cc_http_prc_t *) p_obj; cc_prc_t * p_cc_prc = (cc_prc_t *) p_obj; assert (p_prc); TIZ_DEBUG (handleOf (p_prc), "store_stream_metadata"); /* Station url */ { tiz_check_omx (cc_prc_store_display_title ( p_cc_prc, "Station", (const char *) p_prc->p_content_uri_->contentURI)); tiz_check_omx (cc_prc_store_stream_metadata_item ( p_cc_prc, "Station", (const char *) p_prc->p_content_uri_->contentURI)); } return OMX_ErrorNone; }
static OMX_ERRORTYPE set_auto_detect_on_port (dirble_prc_t * ap_prc) { OMX_PARAM_PORTDEFINITIONTYPE port_def; assert (ap_prc); TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_HTTP_SOURCE_PORT_INDEX); tiz_check_omx ( tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); /* Set the new value */ port_def.format.audio.eEncoding = OMX_AUDIO_CodingAutoDetect; tiz_check_omx (tiz_krn_SetParameter_internal ( tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc), OMX_IndexParamPortDefinition, &port_def)); return OMX_ErrorNone; }
OMX_ERRORTYPE graph::gmusicops::get_encoding_type_from_gmusic_source () { OMX_PARAM_PORTDEFINITIONTYPE port_def; const OMX_U32 port_id = 0; TIZ_INIT_OMX_PORT_STRUCT (port_def, port_id); tiz_check_omx ( OMX_GetParameter (handles_[0], OMX_IndexParamPortDefinition, &port_def)); encoding_ = port_def.format.audio.eEncoding; return OMX_ErrorNone; }
static OMX_ERRORTYPE httpr_prc_port_enable (const void * ap_prc, OMX_U32 a_pid) { httpr_prc_t * p_prc = (httpr_prc_t *) ap_prc; assert (ap_prc); assert (ARATELIA_HTTP_RENDERER_PORT_INDEX == a_pid); p_prc->port_disabled_ = false; tiz_check_omx (retrieve_mp3_settings (p_prc, &(p_prc->mp3type_))); httpr_srv_set_mp3_settings (p_prc->p_server_, p_prc->mp3type_.nBitRate, p_prc->mp3type_.nChannels, p_prc->mp3type_.nSampleRate); tiz_check_omx ( httpr_prc_config_change (p_prc, ARATELIA_HTTP_RENDERER_PORT_INDEX, OMX_TizoniaIndexConfigIcecastMetadata)); return OMX_ErrorNone; }
static OMX_ERRORTYPE update_metadata (dirble_prc_t * ap_prc) { assert (ap_prc); /* Clear previous metatada items */ tiz_krn_clear_metadata (tiz_get_krn (handleOf (ap_prc))); /* Station Name */ tiz_check_omx ( store_metadata (ap_prc, "Station", tiz_dirble_get_current_station_name (ap_prc->p_dirble_))); /* Country */ tiz_check_omx (store_metadata ( ap_prc, "URL", (const char *) ap_prc->p_uri_param_->contentURI)); /* Country */ tiz_check_omx (store_metadata ( ap_prc, "Country", tiz_dirble_get_current_station_country (ap_prc->p_dirble_))); /* Category */ tiz_check_omx (store_metadata ( ap_prc, "Categories", tiz_dirble_get_current_station_category (ap_prc->p_dirble_))); /* Website */ tiz_check_omx (store_metadata ( ap_prc, "Website", tiz_dirble_get_current_station_website (ap_prc->p_dirble_))); /* Signal that a new set of metatadata items is available */ (void) tiz_srv_issue_event ((OMX_PTR) ap_prc, OMX_EventIndexSettingChanged, OMX_ALL, /* no particular port associated */ OMX_IndexConfigMetadataItem, /* index of the struct that has been modififed */ NULL); return OMX_ErrorNone; }
static OMX_ERRORTYPE set_read_packet_callbacks (oggdmux_prc_t * ap_prc) { OMX_ERRORTYPE rc = OMX_ErrorNone; long serialno = 0; int n = 0; int i = 0; void * p_nth_data = NULL; assert (ap_prc); n = oggz_table_size (ap_prc->p_tracks_); TIZ_TRACE (handleOf (ap_prc), "oggz table size [%d]", n); for (i = 0; i < n; i++) { OggzStreamContent content = OGGZ_CONTENT_UNKNOWN; p_nth_data = oggz_table_nth (ap_prc->p_tracks_, i, &serialno); assert (p_nth_data); print_codec_name (ap_prc, serialno); content = oggz_stream_get_content (ap_prc->p_oggz_, serialno); if (is_audio_content (content)) { TIZ_TRACE (handleOf (ap_prc), "Set read_audio_packet callback"); tiz_check_omx ( set_read_packet_callback (ap_prc, serialno, read_audio_packet)); } if (is_video_content (content)) { TIZ_TRACE (handleOf (ap_prc), "Set read_video_packet callback"); tiz_check_omx ( set_read_packet_callback (ap_prc, serialno, read_video_packet)); } } if (0 == n) { rc = OMX_ErrorFormatNotDetected; } return rc; }