Help,problem with navigation bar(java code

Help
Jim Stam
2010-09-05
2013-04-26
  • Jim Stam
    Jim Stam
    2010-09-05

    Hello there,i am programming a code in java (in  netbeans) for playing media files with xine.The problem is that when a media file is playing,i want to have the option to hear some parts of the music with the help of a navigation bar.Is there a method in lib-xine which will offer me methods like skipping some secs or minutes of a song or fast forward the song?
    As i can see there is some methods like getStreamLength, getStremPos but there isn't any sets methods..How can i do that??

     
  • Hi Ronins. I didn't touch libxine-java since almost 2 years but you're welcome to use it. I never tried seeking, but I found this bit of documentation in xine.h:

    /*
    * set xine to a trick mode for fast forward, backwards playback,
    * low latency seeking. Please note that this works only with some
    * input plugins. mode constants see below.
    *
    * returns 1 if OK, 0 on error (use xine_get_error for details)
    */
    int  xine_trick_mode (xine_stream_t *stream, int mode, int value) XINE_PROTECTED XINE_DEPRECATED;

    /* trick modes */
    #define XINE_TRICK_MODE_OFF                0
    #define XINE_TRICK_MODE_SEEK_TO_POSITION   1
    #define XINE_TRICK_MODE_SEEK_TO_TIME       2
    #define XINE_TRICK_MODE_FAST_FORWARD       3
    #define XINE_TRICK_MODE_FAST_REWIND        4

    libxine-java uses  SWIG to just wrap all xine functions to Java, so the generated Java method would be:
    public static int xine_trick_mode(SWIGTYPE_p_xine_stream_s stream, int mode, int value) {
        return XineLibJNI.xine_trick_mode(SWIGTYPE_p_xine_stream_s.getCPtr(stream), mode, value);
    }

    So you just lack the SWIGTYPE_p_xine_stream_s stream, which you can get from the XineController.getNativeStream() method. I'd suggest to give it a try. If you need to make additional changes to libxine-java, I'm happy to review your patches. :)

    Best
    Matthias

     
  • Jim Stam
    Jim Stam
    2010-09-07

    hmmm,nice work by the way(about xine lib).I do a project in java for streaming media and i am using jmf and xine for media players..I didn' t think of reading the documentation in xine.h because i don't know how to make native methods. I just only read the java files inside libxine for finding the methods that i want to use but there was a method for seeking(very importand for a player) .I will give a try now with the method that you wrote me..thks by the way for the informations..I will reply to you soon..