int main(int argc, char** argv) try { if (argc < 2) { std::cerr << "usage: " << argv[0] << " path" << std::endl; return 1; } QCoreApplication app(argc, argv); QEventLoop loop; QString const path = QFile::decodeName(argv[1]); lastfm::Track t = lastfm::taglib(path); //see contrib //TODO mbid lastfm::Fingerprint fp(t); if (fp.id().isNull()) { lastfm::FingerprintableSource* src = factory(typeOf(path)); fp.generate(src); QNetworkReply* reply = fp.submit(); loop.connect(reply, SIGNAL(finished()), SLOT(quit())); fp.decode(reply); } QNetworkReply* reply = fp.id().getSuggestions(); loop.connect(reply, SIGNAL(finished()), SLOT(quit())); std::cout << reply->readAll().data() << std::endl; //returns XML return 0; } catch (std::exception& e) { std::cerr << e.what() << std::endl; }
static void * fr_prc_ctor (void *ap_obj, va_list * app) { fr_prc_t *p_prc = super_ctor (typeOf (ap_obj, "frprc"), ap_obj, app); assert (p_prc); return p_prc; }
static void *spfysrc_cfgport_ctor (void *ap_obj, va_list *app) { spfysrc_cfgport_t *p_obj = super_ctor (typeOf (ap_obj, "spfysrccfgport"), ap_obj, app); assert (p_obj); tiz_check_omx_err_ret_null (tiz_port_register_index ( p_obj, OMX_TizoniaIndexParamAudioSpotifySession)); tiz_check_omx_err_ret_null (tiz_port_register_index ( p_obj, OMX_TizoniaIndexParamAudioSpotifyPlaylist)); /* Initialize the OMX_TIZONIA_AUDIO_PARAM_SPOTIFYSESSIONTYPE structure */ TIZ_INIT_OMX_STRUCT (p_obj->spotifysession_); snprintf ((char *)p_obj->spotifysession_.cUserName, sizeof(p_obj->spotifysession_.cUserName), "tizonia"); snprintf ((char *)p_obj->spotifysession_.cUserPassword, sizeof(p_obj->spotifysession_.cUserPassword), "pass"); p_obj->spotifysession_.bRememberCredentials = OMX_TRUE; p_obj->spotifysession_.ePreferredBitRate = OMX_AUDIO_SpotifyBitrate320Kbps; p_obj->spotifysession_.eConnectionType = OMX_AUDIO_SpotifyConnectionMobileWired; /* Initialize the OMX_TIZONIA_AUDIO_PARAM_SPOTIFYPLAYLISTTYPE structure */ TIZ_INIT_OMX_STRUCT (p_obj->playlist_); snprintf ((char *)p_obj->playlist_.cPlaylistName, sizeof(p_obj->playlist_.cPlaylistName), "playlist"); p_obj->playlist_.bShuffle = OMX_FALSE; return p_obj; }
static OMX_ERRORTYPE pausetoidle_trans_complete (const void *ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { const tiz_state_t *p_base = (const tiz_state_t *) ap_obj; TIZ_TRACE (handleOf (ap_obj), "Trans complete to state [%s]...", tiz_fsm_state_to_str (a_new_state)); assert (OMX_StateIdle == a_new_state); assert (NULL != ap_obj); assert (NULL != ap_servant); assert (OMX_StateIdle == a_new_state); if (2 == p_base->servants_count_ + 1) { /* Reset the OMX_TIZONIA_PORTSTATUS_AWAITBUFFERSRETURN flag in all ports where this has been set */ tiz_krn_reset_tunneled_ports_status (tiz_get_krn (handleOf(ap_servant)), OMX_TIZONIA_PORTSTATUS_AWAITBUFFERSRETURN); } return tiz_state_super_trans_complete (typeOf (ap_obj, "tizpausetoidle"), ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE scloud_cfgport_GetParameter (const void * ap_obj, OMX_HANDLETYPE ap_hdl, OMX_INDEXTYPE a_index, OMX_PTR ap_struct) { const scloud_cfgport_t * p_obj = ap_obj; OMX_ERRORTYPE rc = OMX_ErrorNone; assert (p_obj); TIZ_TRACE (ap_hdl, "PORT [%d] GetParameter [%s]...", tiz_port_index (ap_obj), tiz_idx_to_str (a_index)); if (OMX_TizoniaIndexParamAudioSoundCloudSession == a_index) { memcpy (ap_struct, &(p_obj->session_), sizeof (OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDSESSIONTYPE)); } else if (OMX_TizoniaIndexParamAudioSoundCloudPlaylist == a_index) { memcpy (ap_struct, &(p_obj->playlist_), sizeof (OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDPLAYLISTTYPE)); } else { /* Delegate to the base port */ rc = super_GetParameter (typeOf (ap_obj, "scloudcfgport"), ap_obj, ap_hdl, a_index, ap_struct); } return rc; }
Type SimpleUnaryOperation::type() const { if (!m_symbolCache) return Type(); if (protoReturn().isUltimatelyNull() && !typeOf(TheOperand).isNull()) { /* mDebug() << typeOf(TheOperand)->code(); typeOf(TheOperand)->debugTree(); mDebug() << protoReturn()->code(); protoReturn()->debugTree(); mDebug() << typeOf(TheOperand).strippedTo(protoReturn())->code(); typeOf(TheOperand).strippedTo(protoReturn())->debugTree();*/ return typeOf(TheOperand).strippedTo(protoReturn()); } return protoReturn(); }
static OMX_ERRORTYPE loadedtoidle_tunneled_ports_status_update (void * ap_obj) { tiz_state_t * p_base = (tiz_state_t *) ap_obj; assert (ap_obj); { OMX_HANDLETYPE p_hdl = handleOf (p_base->p_fsm_); void * p_krn = tiz_get_krn (p_hdl); if (TIZ_KRN_MAY_INIT_ALLOC_PHASE (p_krn)) { /* OK, at this point all the tunneled non-supplier neighboring ports * are ready to receive OMX_UseBuffer calls. IL resource allocation * will take place now */ /* NOTE: This will call the 'tiz_state_state_set' function of the base * class (we are passing 'tizloaded' as the 1st parameter */ return tiz_state_super_state_set (typeOf (ap_obj, "tizloaded"), ap_obj, p_hdl, OMX_CommandStateSet, OMX_StateIdle, NULL); } } return OMX_ErrorNone; }
static void * scloud_cfgport_ctor (void * ap_obj, va_list * app) { scloud_cfgport_t * p_obj = super_ctor (typeOf (ap_obj, "scloudcfgport"), ap_obj, app); assert (p_obj); tiz_check_omx_ret_null (tiz_port_register_index ( p_obj, OMX_TizoniaIndexParamAudioSoundCloudSession)); tiz_check_omx_ret_null (tiz_port_register_index ( p_obj, OMX_TizoniaIndexParamAudioSoundCloudPlaylist)); /* Initialize the OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDSESSIONTYPE structure */ TIZ_INIT_OMX_STRUCT (p_obj->session_); snprintf ((char *) p_obj->session_.cUserName, sizeof (p_obj->session_.cUserName), "tizonia"); snprintf ((char *) p_obj->session_.cUserPassword, sizeof (p_obj->session_.cUserPassword), "pass"); snprintf ((char *) p_obj->session_.cUserOauthToken, sizeof (p_obj->session_.cUserOauthToken), "1-111111-11111111-11111111111111"); /* Initialize the OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDPLAYLISTTYPE structure */ TIZ_INIT_OMX_STRUCT (p_obj->playlist_); snprintf ((char *) p_obj->playlist_.cPlaylistName, sizeof (p_obj->playlist_.cPlaylistName), "playlist"); p_obj->playlist_.ePlaylistType = OMX_AUDIO_SoundCloudPlaylistTypeUnknown; p_obj->playlist_.bShuffle = OMX_FALSE; return p_obj; }
static void * idletoloaded_ctor (void * ap_obj, va_list * app) { tiz_idletoloaded_t * p_obj = super_ctor (typeOf (ap_obj, "tizidletoloaded"), ap_obj, app); return p_obj; }
static OMX_ERRORTYPE pausetoidle_tunneled_ports_status_update (void *ap_obj) { tiz_state_t *p_base = (tiz_state_t *) ap_obj; assert (NULL != ap_obj); { OMX_HANDLETYPE p_hdl = handleOf(p_base->p_fsm_); void *p_krn = tiz_get_krn (p_hdl); if (TIZ_KRN_MAY_INIT_EXE_TO_IDLE (p_krn)) { /* OK, at this point all the tunneled non-supplier neighboring ports are ready to receive ETB/FTB calls. NOTE: This will call the * 'tiz_state_state_set' function of the tiz_state_t base class (note * we are passing 'tizidle' as 1st parameter */ TIZ_TRACE (p_hdl, "kernel may initiate pause to idle"); return tiz_state_super_state_set (typeOf (ap_obj, "tizidle"), ap_obj, p_hdl, OMX_CommandStateSet, OMX_StateIdle, NULL); } } return OMX_ErrorNone; }
static OMX_ERRORTYPE cc_http_prc_deallocate_resources (void * ap_prc) { delete_url (ap_prc); return tiz_srv_super_deallocate_resources (typeOf (ap_prc, "cc_httpprc"), ap_prc); }
static void * fr_prc_ctor (void *ap_obj, va_list * app) { fr_prc_t *p_obj = super_ctor (typeOf (ap_obj, "frprc"), ap_obj, app); p_obj->eos_ = false; return p_obj; }
static void * oggdmux_prc_ctor (void * ap_obj, va_list * app) { oggdmux_prc_t * p_prc = super_ctor (typeOf (ap_obj, "oggdmuxprc"), ap_obj, app); assert (p_prc); p_prc->p_file_ = NULL; p_prc->p_uri_ = NULL; p_prc->p_oggz_ = NULL; p_prc->p_tracks_ = NULL; p_prc->p_aud_hdr_ = NULL; p_prc->p_vid_hdr_ = NULL; p_prc->aud_buf_size_ = 0; p_prc->vid_buf_size_ = 0; p_prc->awaiting_buffers_ = true; p_prc->p_aud_store_ = NULL; p_prc->p_vid_store_ = NULL; p_prc->aud_store_size_ = 0; p_prc->vid_store_size_ = 0; p_prc->aud_store_offset_ = 0; p_prc->vid_store_offset_ = 0; p_prc->file_eos_ = false; p_prc->aud_eos_ = false; p_prc->vid_eos_ = false; p_prc->aud_port_disabled_ = false; p_prc->vid_port_disabled_ = false; return p_prc; }
static void * cc_plex_cfgport_ctor (void * ap_obj, va_list * app) { cc_plex_cfgport_t * p_obj = super_ctor (typeOf (ap_obj, "cc_plexcfgport"), ap_obj, app); assert (p_obj); tiz_check_omx_ret_null (tiz_port_register_index ( p_obj, OMX_TizoniaIndexParamAudioPlexSession)); tiz_check_omx_ret_null (tiz_port_register_index ( p_obj, OMX_TizoniaIndexParamAudioPlexPlaylist)); /* Initialize the OMX_TIZONIA_AUDIO_PARAM_PLEXSESSIONTYPE structure */ TIZ_INIT_OMX_STRUCT (p_obj->session_); snprintf ((char *) p_obj->session_.cBaseUrl, sizeof (p_obj->session_.cBaseUrl), "xyzxyzxyzxyzxyz"); snprintf ((char *) p_obj->session_.cAuthToken, sizeof (p_obj->session_.cAuthToken), "xyzxyzxyzxyzxyz"); /* Initialize the OMX_TIZONIA_AUDIO_PARAM_PLEXPLAYLISTTYPE structure */ TIZ_INIT_OMX_STRUCT (p_obj->playlist_); snprintf ((char *) p_obj->playlist_.cPlaylistName, sizeof (p_obj->playlist_.cPlaylistName), "playlist"); p_obj->playlist_.ePlaylistType = OMX_AUDIO_PlexPlaylistTypeUnknown; p_obj->playlist_.bShuffle = OMX_FALSE; return p_obj; }
Types SimpleBinaryOperation::allowedTypes(int _index) const { if (_index == FirstOperand || _index == SecondOperand) { if (!m_symbolCache) return Types(); // mDebug() << prototypeOf(FirstOperand)->code() << prototypeOf(SecondOperand)->code() << " " << _index << " " << typeOf(FirstOperand)->code(); if (_index == SecondOperand && prototypeOf(SecondOperand).isUltimatelyNull() && !typeOf(FirstOperand).isNull()) return typeOf(FirstOperand).strippedTo(prototypeOf(SecondOperand)); if (_index == SecondOperand && prototypeOf(SecondOperand).isUltimatelyNull()) return Types(); AssertNR(!prototypeOf(_index).isNull()); return prototypeOf(_index); } return Super::allowedTypes(_index); }
static void * loadedtoidle_ctor (void * ap_obj, va_list * app) { tiz_loadedtoidle_t * p_obj = super_ctor (typeOf (ap_obj, "tizloadedtoidle"), ap_obj, app); return p_obj; }
static void * waitforresources_ctor (void *ap_obj, va_list * app) { tiz_waitforresources_t *p_obj = super_ctor (typeOf (ap_obj, "tizwaitforresources"), ap_obj, app); return p_obj; }
static void * cc_http_prc_ctor (void * ap_obj, va_list * app) { cc_http_prc_t * p_prc = super_ctor (typeOf (ap_obj, "cc_httpprc"), ap_obj, app); p_prc->p_content_uri_ = NULL; return p_prc; }
static void * binaryport_dtor (void * ap_obj) { tiz_binaryport_t * p_obj = ap_obj; assert (p_obj); factory_delete (p_obj->p_port_); return super_dtor (typeOf (ap_obj, "tizbinaryport"), ap_obj); }
static OMX_ERRORTYPE loadedtoidle_state_set (const void * ap_obj, OMX_HANDLETYPE ap_hdl, OMX_COMMANDTYPE a_cmd, OMX_U32 a_param1, OMX_PTR ap_cmd_data) { tiz_state_t * p_base = (tiz_state_t *) ap_obj; tiz_fsm_state_id_t new_state = EStateMax; assert (ap_obj); assert (ap_hdl); assert (a_cmd == OMX_CommandStateSet); TIZ_TRACE (ap_hdl, "Requested transition " "[ESubStateLoadedToIdle -> %s]...", tiz_fsm_state_to_str (a_param1)); /* Allowed transitions are OMX_StateLoaded only (a.k.a. transition * cancellation). */ switch (a_param1) { case OMX_StateLoaded: { new_state = ESubStateIdleToLoaded; } break; default: { TIZ_ERROR (ap_hdl, "[OMX_ErrorIncorrectStateTransition] : " "ESubStateLoadedToIdle -> [%s]", tiz_state_to_str (a_param1)); return OMX_ErrorIncorrectStateTransition; } }; /* reset here the servants count */ p_base->servants_count_ = 0; if (ESubStateIdleToLoaded == new_state) { OMX_ERRORTYPE rc = OMX_ErrorNone; if (OMX_ErrorNone != (rc = tiz_fsm_set_state (tiz_get_fsm (ap_hdl), new_state, ESubStateLoadedToIdle))) { return rc; } } /* IL resource deallocation should take place now */ /* NOTE: This will call the 'tiz_state_state_set' function and not * 'tizloaded_state_set' (we are passing 'tizloaded' as the 1st * parameter */ return tiz_state_super_state_set (typeOf (ap_obj, "tizloaded"), ap_obj, ap_hdl, a_cmd, a_param1, ap_cmd_data); }
static void * sdlivr_proc_ctor (void *ap_obj, va_list * app) { sdlivr_prc_t *p_prc = super_ctor (typeOf (ap_obj, "sdlivrprc"), ap_obj, app); assert (NULL != p_prc); p_prc->pinhdr_ = NULL; p_prc->pouthdr_ = NULL; p_prc->eos_ = false; return p_prc; }
static OMX_ERRORTYPE idletoloaded_trans_complete (const void * ap_obj, OMX_PTR ap_servant, OMX_STATETYPE a_new_state) { TIZ_TRACE (handleOf (ap_servant), "Trans complete to state [%s]...", tiz_fsm_state_to_str ((tiz_fsm_state_id_t) a_new_state)); assert (OMX_StateLoaded == a_new_state); return tiz_state_super_trans_complete (typeOf (ap_obj, "tizidletoloaded"), ap_obj, ap_servant, a_new_state); }
static OMX_ERRORTYPE loadedtoidle_SetParameter (const void * ap_obj, OMX_HANDLETYPE ap_hdl, OMX_INDEXTYPE a_index, OMX_PTR ap_struct) { /* In this transitional state, OMX_SetParameter should only be allowed */ /* until the first OMX_UseBuffer call is received */ TIZ_TRACE (ap_hdl, "[%s]", tiz_idx_to_str (a_index)); return super_SetParameter (typeOf (ap_obj, "tizloadedtoidle"), ap_obj, ap_hdl, a_index, ap_struct); }
static void * httpr_prc_ctor (void * ap_prc, va_list * app) { httpr_prc_t * p_prc = super_ctor (typeOf (ap_prc, "httprprc"), ap_prc, app); assert (p_prc); p_prc->mount_name_ = NULL; p_prc->port_disabled_ = false; p_prc->p_server_ = NULL; p_prc->p_inhdr_ = NULL; return p_prc; }
static void * sdlivr_prc_ctor (void * ap_obj, va_list * app) { sdlivr_prc_t * p_prc = super_ctor (typeOf (ap_obj, "sdlivrprc"), ap_obj, app); assert (p_prc); tiz_mem_set (&(p_prc->port_def_), 0, sizeof (OMX_VIDEO_PORTDEFINITIONTYPE)); p_prc->p_surface = NULL; p_prc->p_overlay = NULL; p_prc->port_disabled_ = false; return p_prc; }
static OMX_ERRORTYPE cc_http_prc_allocate_resources (void * ap_obj, OMX_U32 a_pid) { cc_http_prc_t * p_prc = ap_obj; assert (p_prc); tiz_check_omx (tiz_srv_super_allocate_resources (typeOf (p_prc, "cc_httpprc"), p_prc, a_pid)); return obtain_url (ap_obj); }
void *itr_ctor(void *_self, va_list *ap) { t_itr *self = (t_itr *)_self; t_list *list = va_arg(*ap, t_list *); assert(typeOf(list) == List); self->list = list; self->cur = list->first; self->next = (self->cur ? self->cur->next : NULL); return (_self); }
static OMX_ERRORTYPE httpr_mp3port_GetConfig (const void *ap_obj, OMX_HANDLETYPE ap_hdl, OMX_INDEXTYPE a_index, OMX_PTR ap_struct) { const httpr_mp3port_t *p_obj = ap_obj; OMX_ERRORTYPE rc = OMX_ErrorNone; TIZ_TRACE (ap_hdl, "[%s]...", tiz_idx_to_str (a_index)); assert (NULL != p_obj); if (OMX_TizoniaIndexConfigIcecastMetadata == a_index) { OMX_TIZONIA_ICECASTMETADATATYPE *p_metadata = (OMX_TIZONIA_ICECASTMETADATATYPE *)ap_struct; p_metadata->nVersion.nVersion = OMX_VERSION; if (NULL != p_obj->p_stream_title_) { OMX_U32 metadata_buf_size = p_metadata->nSize - sizeof(OMX_U32) - sizeof(OMX_VERSIONTYPE) - sizeof(OMX_U32); OMX_U32 stream_title_len = strnlen ( p_obj->p_stream_title_, OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE); assert (stream_title_len < OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE); if (metadata_buf_size < (stream_title_len + 1) && metadata_buf_size < OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE) { rc = OMX_ErrorBadParameter; } else { strncpy ((char *)p_metadata->cStreamTitle, p_obj->p_stream_title_, stream_title_len); p_metadata->cStreamTitle[stream_title_len] = '\000'; } } else { p_metadata->cStreamTitle[0] = '\000'; } } else { /* Delegate to the base port */ rc = super_GetConfig (typeOf (ap_obj, "httprmp3port"), ap_obj, ap_hdl, a_index, ap_struct); } return rc; }
void PlanRep::collapseVertices(const OrthoRep &OR, GridLayout &drawing) { for (node v : nodes) { const OrthoRep::VertexInfoUML *vi = OR.cageInfo(v); if(vi == nullptr || (typeOf(v) != Graph::highDegreeExpander && typeOf(v) != Graph::lowDegreeExpander)) continue; node vOrig = original(v); OGDF_ASSERT(vOrig != 0); node vCenter = newNode(); m_vOrig[vCenter] = vOrig; m_vCopy[vOrig] = vCenter; m_vOrig[v] = nullptr; node lowerLeft = vi->m_corner[odNorth]->theNode(); node lowerRight = vi->m_corner[odWest ]->theNode(); node upperLeft = vi->m_corner[odEast ]->theNode(); drawing.x(vCenter) = (drawing.x(lowerLeft)+drawing.x(lowerRight)) >> 1; drawing.y(vCenter) = (drawing.y(lowerLeft)+drawing.y(upperLeft )) >> 1; edge eOrig; forall_adj_edges(eOrig,vOrig) { if(eOrig->target() == vOrig) { node connect = m_eCopy[eOrig].back()->target(); edge eNew = newEdge(connect,vCenter); m_eOrig[eNew] = eOrig; m_eIterator[eNew] = m_eCopy[eOrig].pushBack(eNew); } else { node connect = m_eCopy[eOrig].front()->source(); edge eNew = newEdge(vCenter,connect); m_eOrig[eNew] = eOrig; m_eIterator[eNew] = m_eCopy[eOrig].pushFront(eNew); } } } }
static void *vorbisd_prc_ctor (void *ap_obj, va_list *app) { vorbisd_prc_t *p_prc = super_ctor (typeOf (ap_obj, "vorbisdprc"), ap_obj, app); assert (NULL != p_prc); p_prc->p_fsnd_ = NULL; reset_stream_parameters (p_prc); p_prc->p_store_ = NULL; p_prc->store_size_ = 0; p_prc->store_offset_ = 0; return p_prc; }