]> git.sesse.net Git - vlc/blobdiff - include/mediacontrol_internal.h
* Update version of libcdio. 0.78.2 is now the req. version
[vlc] / include / mediacontrol_internal.h
index 40ca6633d418b53d7dd6aefbdbd8a6efa35a81af..a6021566e4432c6c49e2f18b285027b40719580e 100644 (file)
@@ -29,14 +29,14 @@ extern "C" {
 # endif
 
 #include <vlc/vlc.h>
-#include "vlc/mediacontrol_structures.h"
+#include <vlc/mediacontrol_structures.h>
+#include <libvlc_internal.h>
+#include <vlc/libvlc.h>
 
-typedef struct mediacontrol_Instance {
-    vlc_object_t  *p_vlc;
+struct mediacontrol_Instance {
+    struct libvlc_instance_t * p_instance;
     playlist_t    *p_playlist;
-    intf_thread_t *p_intf;
-    int           vlc_object_id;
-} mediacontrol_Instance;
+};
 
 vlc_int64_t mediacontrol_unit_convert( input_thread_t *p_input,
                                        mediacontrol_PositionKey from,
@@ -46,6 +46,28 @@ vlc_int64_t mediacontrol_position2microsecond(
     input_thread_t *p_input,
     const mediacontrol_Position *pos );
 
+#define RAISE( c, m )  exception->code = c; \
+                       exception->message = strdup(m);
+
+#define RAISE_NULL( c, m ) { RAISE( c, m ); return NULL; }
+#define RAISE_VOID( c, m ) { RAISE( c, m ); return; }
+
+#define HANDLE_LIBVLC_EXCEPTION_VOID( e )  if( libvlc_exception_raised( e ) ) {        \
+       RAISE( mediacontrol_InternalException, libvlc_exception_get_message( e )); \
+        libvlc_exception_clear( e ); \
+        return; }
+
+#define HANDLE_LIBVLC_EXCEPTION_NULL( e )  if( libvlc_exception_raised( e ) ) {        \
+        RAISE( mediacontrol_InternalException, libvlc_exception_get_message( e )); \
+        libvlc_exception_clear( e ); \
+        return NULL; }
+
+#define HANDLE_LIBVLC_EXCEPTION_ZERO( e )  if( libvlc_exception_raised( e ) ) { \
+        RAISE( mediacontrol_InternalException, libvlc_exception_get_message( e )); \
+        libvlc_exception_clear( e ); \
+        return 0; }
+
+
 # ifdef __cplusplus
 }
 # endif