int main(int argc, char *argv[]) { int s; asf_packet_t packet; const char* cmd; const char* host; progname = argv[0]; if (argc != 3) { usage(); exit(1); } cmd = argv[2]; host = argv[1]; if ((s = asf_get_socket(host)) < 0) exit(2); if (!asf_get_packet(&packet, cmd)) { fprintf(stderr, "Command \"%s\" unknown.\n", cmd); usage(); exit(1); } if (!send_packet(s, &packet)) exit(2); close(s); exit(0); }
static gint xmms_asf_read (xmms_xform_t *xform, xmms_sample_t *buf, gint len, xmms_error_t *err) { xmms_asf_data_t *data; guint size; data = xmms_xform_private_data_get (xform); g_return_val_if_fail (data, -1); size = MIN (data->outbuf->len, len); while (size == 0) { gint i, ret; ret = asf_get_packet (data->file, data->packet); if (ret < 0) { return -1; } else if (ret == 0) { XMMS_DBG ("ASF EOF"); return 0; } for (i=0; i<data->packet->payload_count; i++) { asf_payload_t *payload = &data->packet->payloads[i]; if (payload->stream_number != data->track) { /* This is some stream we don't want */ continue; } g_string_append_len (data->outbuf, (gchar *) payload->data, payload->datalen); xmms_xform_auxdata_barrier (xform); } size = MIN (data->outbuf->len, len); } memcpy (buf, data->outbuf->str, size); g_string_erase (data->outbuf, 0, size); return size; }