Audio-XMMSClient
view release on metacpan or search on metacpan
XMMSClientResult.xs view on Meta::CPAN
xmmsc_result_t *res2;
INIT:
if (xmmsc_result_get_class (res) != XMMSC_RESULT_CLASS_SIGNAL) {
croak ("trying to restart a result that's not a signal");
}
CODE:
res2 = xmmsc_result_restart (res);
xmmsc_result_unref (res);
mg = perl_xmmsclient_get_magic_from_sv (ST(0), "Audio::XMMSClient::Result");
mg->mg_ptr = (char *)res2;
=head2 notifier_set
=over 4
=item Arguments: \&func, $data?
=item Return Value: none
=back
$result->notifier_set(sub { die 'got an answer!' });
Set up a callback for the result retrival. This callback will be called when
the answers arrives. It's arguments will be the result itself as well as an
optional userdata if C<$data> is passed.
=cut
void
xmmsc_result_notifier_set (res, func, data=NULL)
SV *res
SV *func
SV *data
PREINIT:
PerlXMMSClientCallback *cb = NULL;
PerlXMMSClientCallbackParamType param_types[1];
xmmsc_result_t *c_res;
CODE:
c_res = (xmmsc_result_t *)perl_xmmsclient_get_ptr_from_sv (res, "Audio::XMMSClient::Result");
param_types[0] = PERL_XMMSCLIENT_CALLBACK_PARAM_TYPE_RESULT;
cb = perl_xmmsclient_callback_new (func, data, res, 1, param_types);
xmmsc_result_notifier_set_full (c_res, perl_xmmsclient_xmmsc_result_notifyer_cb,
cb, (xmmsc_user_data_free_func_t)perl_xmmsclient_callback_destroy);
=head2 wait
=over 4
=item Arguments: none
=item Return Value: $result
=back
my $value = $result->wait->value;
Block for the reply. In a synchronous application this can be used to wait for
the result. Will return the C<$result> this method was called when the server
replyed.
=cut
SV *
xmmsc_result_wait (res)
SV *res
PREINIT:
xmmsc_result_t *c_res;
CODE:
c_res = (xmmsc_result_t *)perl_xmmsclient_get_ptr_from_sv (res, "Audio::XMMSClient::Result");
xmmsc_result_wait (c_res);
SvREFCNT_inc (res); /* TODO: Only do so in non-void context? */
RETVAL = res;
OUTPUT:
RETVAL
=head2 source_preference_set
=over 4
=item Arguments: @preferences
=item Return Value: none
=back
$result->source_preference_set(qw{plugin/* plugin/id3v2 client/* server});
Set source C<@preferences> to be used when fetching stuff from a propdict.
=cut
void
xmmsc_result_source_preference_set (res, ...)
xmmsc_result_t *res
PREINIT:
const char **preference = NULL;
int i;
INIT:
preference = (const char **)malloc (sizeof (char *) * items);
for (i = 1; i < items; i++) {
preference[i] = SvPV_nolen (ST (i));
}
preference[items - 1] = NULL;
C_ARGS:
res, preference
CLEANUP:
free (preference);
=head2 get_type
=over 4
=item Arguments: none
( run in 1.154 second using v1.01-cache-2.11-cpan-e1769b4cff6 )