Changeset e85a5a618dde3b1d131ffca1cd373a9d3f845fc6

Show
Ignore:
Timestamp:
09/18/06 16:16:14 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1158588974 +0000
git-parent:

[745437093217075837f234f8bc4144d8bd2b44b4]

git-author:
Clément Stenac <zorglub@videolan.org> 1158588974 +0000
Message:

A bit of cleanup and test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/libvlc_internal.h

    rf0531d5 re85a5a6  
    6060}; 
    6161 
    62 #define RAISENULL( psz ) { libvlc_exception_raise( p_e, psz ); return NULL; } 
    63 #define RAISEVOID( psz ) { libvlc_exception_raise( p_e, psz ); return; } 
    64 #define RAISEZERO( psz ) { libvlc_exception_raise( p_e, psz ); return 0; } 
     62#define RAISENULL( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \ 
     63                                return NULL; } 
     64#define RAISEVOID( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \ 
     65                                return; } 
     66#define RAISEZERO( psz,a... ) { libvlc_exception_raise( p_e, psz,##a ); \ 
     67                                return 0; } 
    6568 
    6669# ifdef __cplusplus 
  • include/vlc/libvlc.h

    rf8cece2 re85a5a6  
    123123 
    124124/** 
    125  * Destroy a libvlc instance 
     125 * Destroy a libvlc instance. 
    126126 * \param p_instance the instance to destroy 
    127127 */ 
    128 void libvlc_destroy( libvlc_instance_t *); 
     128void libvlc_destroy( libvlc_instance_t *, libvlc_exception_t * ); 
    129129 
    130130/** @}*/ 
  • src/control/core.c

    rf0531d5 re85a5a6  
    102102} 
    103103 
    104 void libvlc_destroy( libvlc_instance_t *p_instance
     104void libvlc_destroy( libvlc_instance_t *p_instance, libvlc_exception_t *p_e
    105105{ 
    106106    libvlc_InternalCleanup( p_instance->p_libvlc_int ); 
  • src/libvlc-common.c

    re9947be re85a5a6  
    869869int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release ) 
    870870{ 
    871     /* Free allocated memory */ 
    872871    if( p_libvlc->p_memcpy_module ) 
    873872    { 
     
    876875    } 
    877876 
    878     /* Free module bank !  */ 
     877    /* Free module bank. It is refcounted, so we call this each time  */ 
    879878    module_EndBank( p_libvlc ); 
    880879 
  • test/NativeLibvlcTest.py

    r4db506d re85a5a6  
    44 
    55class NativeLibvlcTestCase( unittest.TestCase ): 
    6     def testException( self ): 
     6    def test1Exception( self ): 
    77        """[LibVLC] Checks libvlc_exception""" 
    8 #     native_libvlc_test.exception_test() 
    9     def testStartup( self ): 
     8      native_libvlc_test.exception_test() 
     9    def test2Startup( self ): 
    1010        """[LibVLC] Checks creation/destroy of libvlc""" 
    11 #     native_libvlc_test.create_destroy() 
    12     def testPlaylist( self ): 
     11      native_libvlc_test.create_destroy() 
     12    def test3Playlist( self ): 
    1313        """[LibVLC] Checks basic playlist interaction""" 
    14 #     native_libvlc_test.playlist_test() 
    15     def testVLM( self ): 
     14      native_libvlc_test.playlist_test() 
     15    def test4VLM( self ): 
    1616        """[LibVLC] Checks VLM wrapper""" 
    17 #     native_libvlc_test.vlm_test() 
     17      native_libvlc_test.vlm_test() 
  • test/native/libvlc.c

    r59cd4c2 re85a5a6  
    22#include <vlc/libvlc.h> 
    33 
    4  PyObject *exception_test( PyObject *self, PyObject *args ) 
     4PyObject *exception_test( PyObject *self, PyObject *args ) 
    55{ 
    6     libvlc_exception_t exception; 
     6    libvlc_exception_t exception; 
    77 
    8     libvlc_exception_init( &exception ); 
    9     ASSERT( !libvlc_exception_raised( &exception) , "Exception raised" ); 
    10     ASSERT( !libvlc_exception_get_message( &exception) , "Exception raised" ); 
     8    libvlc_exception_init( &exception ); 
     9    ASSERT( !libvlc_exception_raised( &exception) , "Exception raised" ); 
     10    ASSERT( !libvlc_exception_get_message( &exception) , "Exception raised" ); 
    1111 
    12     libvlc_exception_raise( &exception, NULL ); 
    13     ASSERT( !libvlc_exception_get_message( &exception), "Unexpected message" ); 
    14     ASSERT( libvlc_exception_raised( &exception), "Exception not raised" ); 
     12    libvlc_exception_raise( &exception, NULL ); 
     13    ASSERT( !libvlc_exception_get_message( &exception), "Unexpected message" ); 
     14    ASSERT( libvlc_exception_raised( &exception), "Exception not raised" ); 
    1515 
    16     libvlc_exception_raise( &exception, "test" ); 
    17     ASSERT( libvlc_exception_get_message( &exception), "No Message" ); 
    18     ASSERT( libvlc_exception_raised( &exception), "Exception not raised" ); 
     16    libvlc_exception_raise( &exception, "test" ); 
     17    ASSERT( libvlc_exception_get_message( &exception), "No Message" ); 
     18    ASSERT( libvlc_exception_raised( &exception), "Exception not raised" ); 
    1919 
    20     libvlc_exception_clear( &exception ); 
    21     ASSERT( !libvlc_exception_raised( &exception ), "Exception not cleared" ); 
     20    libvlc_exception_clear( &exception ); 
     21    ASSERT( !libvlc_exception_raised( &exception ), "Exception not cleared" ); 
    2222 
    23     Py_INCREF( Py_None ); 
    24     return Py_None; 
     23    Py_INCREF( Py_None ); 
     24    return Py_None; 
    2525} 
    2626 
    27  PyObject *create_destroy( PyObject *self, PyObject *args ) 
     27PyObject *create_destroy( PyObject *self, PyObject *args ) 
    2828{ 
    29     libvlc_instance_t *p_instance; 
    30     char *argv[] = { "vlc", "--quiet" }; 
     29    libvlc_instance_t *p_i1, *p_i2; 
     30    char *argv1[] = { "vlc", "--quiet" }; 
     31    char *argv2[]= { "vlc", "-vvv" }; 
     32    int id1,id2; 
     33 
     34    printf( "\n" ); 
    3135 
    3236    libvlc_exception_t exception; 
    3337    libvlc_exception_init( &exception ); 
    3438 
    35     p_instance = libvlc_new( 2, argv, &exception ); 
     39    /* Create and destroy a single instance */ 
     40    fprintf( stderr, "Create 1\n" ); 
     41    p_i1 = libvlc_new( 2, argv1, &exception ); 
     42    ASSERT( p_i1 != NULL, "Instance creation failed" ); 
     43    ASSERT_NOEXCEPTION; 
     44    id1 = libvlc_get_vlc_id( p_i1 ); 
     45    libvlc_destroy( p_i1, &exception ); 
     46    ASSERT_NOEXCEPTION; 
    3647 
    37     ASSERT( p_instance != NULL, "Instance creation failed" ); 
     48    /* Create and destroy two instances */ 
     49    fprintf( stderr, "Create 2\n" ); 
     50    p_i1 = libvlc_new( 2, argv1, &exception ); 
     51    ASSERT( p_i1 != NULL, "Instance creation failed" ); 
     52    ASSERT_NOEXCEPTION; 
    3853 
    39     ASSERT( !libvlc_exception_raised( &exception ), 
    40              "Exception raised while creating instance" ); 
     54    fprintf( stderr, "Create 3\n" ); 
     55    p_i2 = libvlc_new( 2, argv2, &exception ); 
     56    ASSERT( p_i2 != NULL, "Instance creation failed" ); 
     57    ASSERT_NOEXCEPTION; 
    4158 
    42     libvlc_destroy( p_instance ); 
    43       
     59    fprintf( stderr, "Destroy 1\n" ); 
     60    libvlc_destroy( p_i1, &exception ); 
     61    ASSERT_NOEXCEPTION; 
     62    fprintf( stderr, "Destroy 2\n" ); 
     63    libvlc_destroy( p_i2, &exception ); 
     64    ASSERT_NOEXCEPTION; 
     65 
     66    /* Deinit */ 
     67    fprintf( stderr, "Create 4\n" ); 
     68    p_i1 = libvlc_new( 2, argv1, &exception ); 
     69    ASSERT_NOEXCEPTION; 
     70    id2 = libvlc_get_vlc_id( p_i1 ); 
     71 
     72    ASSERT( id1 == id2, "libvlc object ids do not match after deinit" ); 
     73 
    4474    Py_INCREF( Py_None ); 
    4575    return Py_None; 
  • test/test.sh

    rf834305 re85a5a6  
    99 
    1010export LD_LIBRARY_PATH=src/.libs/ 
     11 
     12# Always dump core 
     13ulimit -c unlimited 
    1114 
    1215python test/test.py -v 2>&1|perl  -e \