comparison src/daap/daap.c @ 1978:fa9f85cebade

s/vfs_/aud_vfs_/g
author William Pitcock <nenolod@atheme.org>
date Sun, 07 Oct 2007 00:25:33 -0500
parents e8ea3a76a84e
children 3134a0987162
comparison
equal deleted inserted replaced
1977:5a6b60ceaa0f 1978:fa9f85cebade
304 } 304 }
305 305
306 306
307 307
308 308
309 VFSFile * daap_vfs_fopen_impl(const gchar * path, const gchar * mode) 309 VFSFile * daap_aud_vfs_fopen_impl(const gchar * path, const gchar * mode)
310 { 310 {
311 VFSFile *file=NULL; 311 VFSFile *file=NULL;
312 daap_handle_t *handle = g_new0(daap_handle_t, 1); 312 daap_handle_t *handle = g_new0(daap_handle_t, 1);
313 handle->url=g_strdup(path); 313 handle->url=g_strdup(path);
314 314
328 file=g_new0(VFSFile, 1); 328 file=g_new0(VFSFile, 1);
329 handle->fd=g_io_channel_unix_get_fd(handle->daap_data->channel); 329 handle->fd=g_io_channel_unix_get_fd(handle->daap_data->channel);
330 330
331 if (handle->fd < 0) 331 if (handle->fd < 0)
332 { 332 {
333 g_print("vfs_fopen got a negative FD \n"); 333 g_print("aud_vfs_fopen got a negative FD \n");
334 g_free(file); 334 g_free(file);
335 file = NULL; 335 file = NULL;
336 } 336 }
337 else 337 else
338 file->handle=(void*)handle; 338 file->handle=(void*)handle;
339 return file; 339 return file;
340 } 340 }
341 341
342 gint daap_vfs_fclose_impl(VFSFile * file) 342 gint daap_aud_vfs_fclose_impl(VFSFile * file)
343 { 343 {
344 gint ret=0; 344 gint ret=0;
345 daap_handle_t * handle = (daap_handle_t *)file->handle; 345 daap_handle_t * handle = (daap_handle_t *)file->handle;
346 if (file == NULL) 346 if (file == NULL)
347 return -1; 347 return -1;
361 return ret; 361 return ret;
362 362
363 return -1; 363 return -1;
364 } 364 }
365 365
366 size_t daap_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file) 366 size_t daap_aud_vfs_fread_impl(gpointer ptr, size_t size, size_t nmemb, VFSFile * file)
367 { 367 {
368 daap_handle_t *handle= (daap_handle_t *)file->handle; 368 daap_handle_t *handle= (daap_handle_t *)file->handle;
369 size_t ret=0; 369 size_t ret=0;
370 if (file == NULL) 370 if (file == NULL)
371 return 0; 371 return 0;
376 } 376 }
377 else 377 else
378 return 0; 378 return 0;
379 } 379 }
380 380
381 size_t daap_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile * file) 381 size_t daap_aud_vfs_fwrite_impl(gconstpointer ptr, size_t size, size_t nmemb, VFSFile * file)
382 { 382 {
383 return -1; 383 return -1;
384 } 384 }
385 385
386 gint daap_vfs_getc_impl(VFSFile * file) 386 gint daap_aud_vfs_getc_impl(VFSFile * file)
387 { 387 {
388 guchar ret=EOF; 388 guchar ret=EOF;
389 daap_handle_t *handle = (daap_handle_t *)file->handle; 389 daap_handle_t *handle = (daap_handle_t *)file->handle;
390 int status=g_io_channel_read_chars (handle->daap_data->channel,(void*)&ret,1,NULL,NULL); 390 int status=g_io_channel_read_chars (handle->daap_data->channel,(void*)&ret,1,NULL,NULL);
391 if(status==G_IO_STATUS_NORMAL) 391 if(status==G_IO_STATUS_NORMAL)
399 g_print ("fgetc failed\n"); 399 g_print ("fgetc failed\n");
400 return EOF; 400 return EOF;
401 } 401 }
402 } 402 }
403 403
404 gint daap_vfs_fseek_impl(VFSFile * file, glong offset, gint whence) 404 gint daap_aud_vfs_fseek_impl(VFSFile * file, glong offset, gint whence)
405 { 405 {
406 return -1; 406 return -1;
407 } 407 }
408 408
409 gint daap_vfs_ungetc_impl(gint c, VFSFile * stream) 409 gint daap_aud_vfs_ungetc_impl(gint c, VFSFile * stream)
410 { 410 {
411 return c; 411 return c;
412 } 412 }
413 413
414 void daap_vfs_rewind_impl(VFSFile * stream) 414 void daap_aud_vfs_rewind_impl(VFSFile * stream)
415 { 415 {
416 return; 416 return;
417 } 417 }
418 418
419 glong daap_vfs_ftell_impl(VFSFile * stream) 419 glong daap_aud_vfs_ftell_impl(VFSFile * stream)
420 { 420 {
421 daap_handle_t *handle=stream->handle; 421 daap_handle_t *handle=stream->handle;
422 return handle->pos; 422 return handle->pos;
423 } 423 }
424 424
425 gboolean daap_vfs_feof_impl(VFSFile * file) 425 gboolean daap_aud_vfs_feof_impl(VFSFile * file)
426 { 426 {
427 daap_handle_t *handle=file->handle; 427 daap_handle_t *handle=file->handle;
428 off_t at = daap_vfs_ftell_impl(file); 428 off_t at = daap_aud_vfs_ftell_impl(file);
429 return (gboolean) (at >= handle->length) ? TRUE : FALSE; 429 return (gboolean) (at >= handle->length) ? TRUE : FALSE;
430 } 430 }
431 431
432 gint daap_vfs_truncate_impl(VFSFile * file, glong size) 432 gint daap_aud_vfs_truncate_impl(VFSFile * file, glong size)
433 { 433 {
434 return -1; 434 return -1;
435 } 435 }
436 off_t daap_vfs_fsize_impl(VFSFile * file) 436 off_t daap_aud_vfs_fsize_impl(VFSFile * file)
437 { 437 {
438 return 0; 438 return 0;
439 } 439 }
440 440
441 gchar *daap_vfs_metadata_impl(VFSFile * file, const gchar * field) 441 gchar *daap_aud_vfs_metadata_impl(VFSFile * file, const gchar * field)
442 { 442 {
443 daap_handle_t *handle; 443 daap_handle_t *handle;
444 g_print("Requested metadata: '%s' \n",field); 444 g_print("Requested metadata: '%s' \n",field);
445 445
446 if(file && file->handle) 446 if(file && file->handle)
460 460
461 } 461 }
462 462
463 VFSConstructor daap_const = { 463 VFSConstructor daap_const = {
464 "daap://", 464 "daap://",
465 daap_vfs_fopen_impl, 465 daap_aud_vfs_fopen_impl,
466 daap_vfs_fclose_impl, 466 daap_aud_vfs_fclose_impl,
467 daap_vfs_fread_impl, 467 daap_aud_vfs_fread_impl,
468 daap_vfs_fwrite_impl, 468 daap_aud_vfs_fwrite_impl,
469 daap_vfs_getc_impl, 469 daap_aud_vfs_getc_impl,
470 daap_vfs_ungetc_impl, 470 daap_aud_vfs_ungetc_impl,
471 daap_vfs_fseek_impl, 471 daap_aud_vfs_fseek_impl,
472 daap_vfs_rewind_impl, 472 daap_aud_vfs_rewind_impl,
473 daap_vfs_ftell_impl, 473 daap_aud_vfs_ftell_impl,
474 daap_vfs_feof_impl, 474 daap_aud_vfs_feof_impl,
475 daap_vfs_truncate_impl, 475 daap_aud_vfs_truncate_impl,
476 daap_vfs_fsize_impl, 476 daap_aud_vfs_fsize_impl,
477 daap_vfs_metadata_impl 477 daap_aud_vfs_metadata_impl
478 }; 478 };
479 479
480 static void init(void) 480 static void init(void)
481 { 481 {
482 mutex_init = g_mutex_new(); 482 mutex_init = g_mutex_new();
483 mutex_discovery = g_mutex_new(); 483 mutex_discovery = g_mutex_new();
484 vfs_register_transport(&daap_const); 484 aud_vfs_register_transport(&daap_const);
485 daap_mdns_initialize (); 485 daap_mdns_initialize ();
486 if (!login_sessions) 486 if (!login_sessions)
487 login_sessions = g_hash_table_new (g_str_hash, g_str_equal); 487 login_sessions = g_hash_table_new (g_str_hash, g_str_equal);
488 488
489 489