Changeset 7c1e261199a69bc92f4f0bbd774725555139cce4

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

[1d1c5f07b38cb8a7c41fd30d41eb2147ad8961b0]

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

minor changes to JVLC class

Files:

Legend:

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

    r88ff21f r7c1e261  
    4949    private VLM vlm; 
    5050     
    51     private volatile boolean released;  
     51    private volatile boolean released; 
    5252     
    5353    public JVLC() 
     
    6868    } 
    6969 
     70    /* 
     71     * Core methods 
     72     */ 
     73    private LibVlcInstance createInstance(String[] args) 
     74    { 
     75        libvlc_exception_t exception = new libvlc_exception_t(); 
     76        return libvlc.libvlc_new(args.length, args, exception); 
     77    } 
     78 
    7079    public MediaInstance play(String media) 
    7180    { 
     
    7382        MediaInstance mediaInstance = new MediaInstance(mediaDescriptor); 
    7483        mediaInstance.play(); 
     84        mediaDescriptor.release(); 
    7585        return mediaInstance; 
    7686    } 
     
    8393    } 
    8494 
    85     /* 
    86      * Core methods 
    87      */ 
    88     private LibVlcInstance createInstance(String[] args) 
    89     { 
    90         libvlc_exception_t exception = new libvlc_exception_t(); 
    91         libvlc.libvlc_exception_init(exception); 
    92  
    93         return libvlc.libvlc_new(args.length, args, exception); 
    94     } 
    95  
    9695    public Logger getLogger() 
    9796    { 
     
    9998    } 
    10099     
     100    /** 
     101     * Returns the mediaList. 
     102     * @return the mediaList 
     103     */ 
     104    public MediaList getMediaList() 
     105    { 
     106        return mediaList; 
     107    } 
     108 
    101109    public VLM getVLM() 
    102110    { 
     
    146154    public void release() 
    147155    { 
    148         if (!released) 
     156        if (released) 
    149157        { 
    150             released = true; 
    151             if (vlm != null) 
    152             { 
    153                 vlm.release(); 
    154                 vlm = null; 
    155             } 
    156             libvlc.libvlc_release(instance); 
     158            return; 
    157159        } 
     160        released = true; 
     161        if (vlm != null) 
     162        { 
     163            vlm.release(); 
     164            vlm = null; 
     165        } 
     166        libvlc.libvlc_release(instance); 
    158167    } 
    159168 
     
    165174    protected void finalize() throws Throwable 
    166175    { 
    167         if (!released) 
    168         { 
    169             released = true; 
    170             libvlc.libvlc_release(instance); 
    171         } 
     176        release(); 
    172177        super.finalize(); 
    173178    } 
    174179     
    175     /** 
    176      * Returns the mediaList. 
    177      * @return the mediaList 
    178      */ 
    179     public MediaList getMediaList() 
    180     { 
    181         return mediaList; 
    182     } 
    183      
    184180}