Changeset 21ca9ddb286c5c95059dbbcb9c24364e250a3d96

Show
Ignore:
Timestamp:
09/04/08 00:32:45 (6 months ago)
Author:
Filippo Carone <littlejohn@videolan.org>
git-committer:
Filippo Carone <littlejohn@videolan.org> 1207693965 +0200
git-parent:

[fa096e6093bfa4e4e47cfec000e5e34944e2545e]

git-author:
Filippo Carone <littlejohn@videolan.org> 1207690962 +0200
Message:

protect from null options param, and finalize added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bindings/java/core/src/main/java/org/videolan/jvlc/VLM.java

    r88ff21f r21ca9dd  
    3131public class VLM 
    3232{ 
     33 
    3334    private JVLC jvlc; 
     35     
     36    private volatile boolean released; 
    3437 
    3538    public VLM(JVLC jvlc) 
     
    4649            input, 
    4750            output, 
    48             options.length, 
     51            options == null ? 0 : options.length, 
    4952            options, 
    5053            enabled ? 1 : 0, 
     
    103106            input, 
    104107            output, 
    105             options.length, 
     108            options == null ? 0 : options.length, 
    106109            options, 
    107110            enabled ? 1 : 0, 
     
    115118        jvlc.getLibvlc().libvlc_vlm_play_media(jvlc.getInstance(), name, exception); 
    116119    } 
    117      
     120 
    118121    public void stopMedia(String name) 
    119122    { 
     
    121124        jvlc.getLibvlc().libvlc_vlm_stop_media(jvlc.getInstance(), name, exception); 
    122125    } 
    123      
     126 
    124127    public void pauseMedia(String name) 
    125128    { 
     
    141144 
    142145    /** 
    143      *  
     146     * Releases native resources related to VLM. 
    144147     */ 
    145148    public void release() 
    146149    { 
     150        if (released) 
     151        { 
     152            return; 
     153        } 
     154        released = true; 
    147155        libvlc_exception_t exception = new libvlc_exception_t(); 
    148156        jvlc.getLibvlc().libvlc_vlm_release(jvlc.getInstance(), exception); 
    149157    } 
    150158 
     159    /** 
     160     * {@inheritDoc} 
     161     */ 
     162    @Override 
     163    protected void finalize() throws Throwable 
     164    { 
     165        release(); 
     166        super.finalize(); 
     167    } 
    151168     
     169     
     170 
    152171}