VLCLibrary.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*****************************************************************************
  2. * VLCLibrary.h: VLC.framework VLCLibrary implementation
  3. *****************************************************************************
  4. * Copyright (C) 2007 Pierre d'Herbemont
  5. * Copyright (C) 2007 the VideoLAN team
  6. * $Id$
  7. *
  8. * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23. *****************************************************************************/
  24. #import <Cocoa/Cocoa.h>
  25. #include <vlc/libvlc.h>
  26. #include <vlc/libvlc_structures.h>
  27. #import <VLC/VLCPlaylist.h>
  28. /*
  29. * VLCLibrary object
  30. */
  31. @interface VLCLibrary : NSObject
  32. + (libvlc_instance_t *)sharedInstance;
  33. @end
  34. /*
  35. * Utility function
  36. */
  37. #define quit_on_exception( ex ) __quit_on_exception( ex, __FUNCTION__, __FILE__, __LINE__ )
  38. static inline void __quit_on_exception( libvlc_exception_t * ex, const char * function, const char * file, int line_number )
  39. {
  40. if (libvlc_exception_raised( ex ))
  41. {
  42. /* XXX: localization */
  43. NSRunCriticalAlertPanel( @"Error", [NSString stringWithFormat:@"libvlc has thrown us an error: %s (%s:%d %s)", libvlc_exception_get_message(ex), file, line_number, function], @"Quit", nil, nil );
  44. exit( ex->i_code );
  45. }
  46. }
  47. /*
  48. * LibVLCBridging category
  49. */
  50. @interface VLCPlaylist (LibVLCBridging)
  51. + (id) playlistWithLibVLCMediaList: (libvlc_media_list_t *)p_new_mlist;
  52. - (libvlc_media_list_t *) libVLCMediaList;
  53. @end
  54. @interface VLCMedia (LibVLCBridging)
  55. - (id) initWithLibVLCMediaDescriptor: (libvlc_media_descriptor_t *)p_md;
  56. + (id) mediaWithLibVLCMediaDescriptor: (libvlc_media_descriptor_t *)p_md;
  57. - (libvlc_media_descriptor_t *) libVLCMediaDescriptor;
  58. @end