~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to src/control/mediacontrol_init.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 * init.c: Core functions : init, playlist, stream management
3
 
 *****************************************************************************
4
 
 * Copyright (C) 2005 the VideoLAN team
5
 
 * $Id: 6fdf33768a28ba4958ebe8a79885ef325005bd1f $
6
 
 *
7
 
 * Authors: Olivier Aubert <olivier.aubert@liris.univ-lyon1.fr>
8
 
 *
9
 
 * This program is free software; you can redistribute it and/or modify
10
 
 * it under the terms of the GNU General Public License as published by
11
 
 * the Free Software Foundation; either version 2 of the License, or
12
 
 * (at your option) any later version.
13
 
 *
14
 
 * This program is distributed in the hope that it will be useful,
15
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 
 * GNU General Public License for more details.
18
 
 *
19
 
 * You should have received a copy of the GNU General Public License
20
 
 * along with this program; if not, write to the Free Software
21
 
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
 
 *****************************************************************************/
23
 
 
24
 
#define __VLC__
25
 
#include <mediacontrol_internal.h>
26
 
#include <vlc/mediacontrol.h>
27
 
 
28
 
mediacontrol_Instance* mediacontrol_new( char** args, mediacontrol_Exception *exception )
29
 
{
30
 
    mediacontrol_Instance* retval;
31
 
    vlc_object_t *p_vlc;
32
 
    int p_vlc_id;
33
 
    char **ppsz_argv;
34
 
    int i_count = 0;
35
 
    int i_index;
36
 
    char **p_tmp;
37
 
 
38
 
    if( args )
39
 
    {
40
 
        for ( p_tmp = args ; *p_tmp != NULL ; p_tmp++ )
41
 
            i_count++;
42
 
    }
43
 
 
44
 
    ppsz_argv = malloc( ( i_count + 2 ) * sizeof( char * ) ) ;
45
 
    if( ! ppsz_argv )
46
 
    {
47
 
        exception->code = mediacontrol_InternalException;
48
 
        exception->message = "out of memory";
49
 
        return NULL;
50
 
    }
51
 
    ppsz_argv[0] = "vlc";
52
 
    for ( i_index = 0; i_index < i_count; i_index++ )
53
 
    {
54
 
        ppsz_argv[i_index + 1] = strdup( args[i_index] );
55
 
        if( ! ppsz_argv[i_index + 1] )
56
 
        {
57
 
            exception->code = mediacontrol_InternalException;
58
 
            exception->message = "out of memory";
59
 
            return NULL;
60
 
        }
61
 
    }
62
 
 
63
 
    ppsz_argv[i_count + 1] = NULL;
64
 
 
65
 
    p_vlc_id = VLC_Create();
66
 
    if( p_vlc_id < 0 )
67
 
    {
68
 
        exception->code = mediacontrol_InternalException;
69
 
        exception->message = strdup( "unable to create VLC" );
70
 
        return NULL;
71
 
    }
72
 
 
73
 
    p_vlc = ( vlc_object_t* )vlc_current_object( p_vlc_id );
74
 
    if( ! p_vlc )
75
 
    {
76
 
        exception->code = mediacontrol_InternalException;
77
 
        exception->message = strdup( "unable to find VLC object" );
78
 
        return NULL;
79
 
    }
80
 
    retval = ( mediacontrol_Instance* )malloc( sizeof( mediacontrol_Instance ) );
81
 
    if( ! retval )
82
 
    {
83
 
        exception->code = mediacontrol_InternalException;
84
 
        exception->message = strdup( "out of memory" );
85
 
        return NULL;
86
 
    }
87
 
 
88
 
    if( VLC_Init( p_vlc_id, i_count + 1, ppsz_argv ) != VLC_SUCCESS )
89
 
    {
90
 
        exception->code = mediacontrol_InternalException;
91
 
        exception->message = strdup( "cannot initialize VLC" );
92
 
        return NULL;
93
 
    }
94
 
 
95
 
    retval->p_vlc = p_vlc;
96
 
    retval->vlc_object_id = p_vlc_id;
97
 
 
98
 
    /* We can keep references on these, which should not change. Is it true ? */
99
 
    retval->p_playlist = vlc_object_find( p_vlc,
100
 
                                         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
101
 
    retval->p_intf = vlc_object_find( p_vlc, VLC_OBJECT_INTF, FIND_ANYWHERE );
102
 
 
103
 
    if( ! retval->p_playlist || ! retval->p_intf )
104
 
    {
105
 
        exception->code = mediacontrol_InternalException;
106
 
        exception->message = strdup( "no interface available" );
107
 
        return NULL;
108
 
    }
109
 
 
110
 
    return retval;
111
 
}
112
 
 
113
 
void
114
 
mediacontrol_exit( mediacontrol_Instance *self )
115
 
{
116
 
    vlc_object_release( (vlc_object_t* )self->p_playlist );
117
 
    vlc_object_release( (vlc_object_t* )self->p_intf );
118
 
    vlc_object_release( (vlc_object_t*)self->p_vlc );
119
 
 
120
 
    VLC_CleanUp( self->vlc_object_id );
121
 
    VLC_Destroy( self->vlc_object_id );
122
 
}