[vlc-devel] [PATCH] Symbian Specific Initialization routine

Pankaj yadav pankajdnapster at gmail.com
Tue Jan 11 18:52:59 CET 2011


/*This function set the psz_vlcpath allocated on heap*/
static void set_libvlc_path (void)
{
    char drive[11]="C:\\sys\\bin";
    const char * letter;

    letter=GetConstPrivatePath();

    drive[0]=*letter;
    free(letter);
    psz_vlcpath = strdup(drive);
}

/*This function frees the memory allocated in the last function*/
static void unset_libvlc_path (void)
{
    free (psz_vlcpath);
}

/*This is a structure containing an already initialized Static mutex and
refs = 0*/
static struct
{
    vlc_mutex_t lock;
    unsigned refs;
} once = { VLC_STATIC_MUTEX, 0 };


void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
{
    ret = pthread_create( &threadid, NULL, ThreadController, &quit );
/*As the Libvlc starts this hreadcontroller starts running which quits
cleaning all its resources only if quit=1*/

/*Increase refs and set libvlc path*/
    vlc_mutex_lock ( &once.lock );
    if (once.refs++ == 0)
        set_libvlc_path ();
    vlc_mutex_unlock ( &once.lock );

    VLC_UNUSED(libvlc);
    VLC_UNUSED(argc);
    VLC_UNUSED(argv);
}

void system_Configure (libvlc_int_t *libvlc,
                       int argc, const char *const argv[])
{
/*Nothing in configure*/
    VLC_UNUSED(libvlc);
    VLC_UNUSED(argc);
    VLC_UNUSED(argv);
}

void system_End (libvlc_int_t *libvlc)
{
    quit=1;  /*quit becomes 1 ThreadController quits..we dont need to join
as i am sure the thread never deadlocks ..You can see ThreadController() in
patch 4*/

    vlc_mutex_lock (&once.lock);
    if (--once.refs == 0)
        unset_libvlc_path ();
    vlc_mutex_unlock (&once.lock);

    VLC_UNUSED(libvlc);
}



/*Which part you did not understand*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110111/4ee62c99/attachment.html>


More information about the vlc-devel mailing list