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

« back to all changes in this revision

Viewing changes to modules/demux/playlist/playlist.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:
2
2
 * playlist.c :  Playlist import module
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2004 the VideoLAN team
5
 
 * $Id: 0be483fd61c7b1a309185cbac332eafa3a3f22c0 $
 
5
 * $Id: 657e1fc9d89ba3420a256e40e7d4ff1c6d2bd216 $
6
6
 *
7
7
 * Authors: Clément Stenac <zorglub@videolan.org>
8
8
 *
24
24
/*****************************************************************************
25
25
 * Preamble
26
26
 *****************************************************************************/
27
 
#include <vlc/vlc.h>
28
 
#include <vlc/input.h>
29
 
#include <vlc_playlist.h>
 
27
#ifdef HAVE_CONFIG_H
 
28
# include "config.h"
 
29
#endif
 
30
 
 
31
#include <vlc_common.h>
 
32
#include <vlc_plugin.h>
 
33
#include <vlc_demux.h>
30
34
 
31
35
#include "playlist.h"
32
36
 
34
38
 * Module descriptor
35
39
 *****************************************************************************/
36
40
#define AUTOSTART_TEXT N_( "Auto start" )
37
 
/// \bug [String] Why \n ?
38
41
#define AUTOSTART_LONGTEXT N_( "Automatically start playing the playlist " \
39
 
                "content once it's loaded.\n" )
 
42
                "content once it's loaded." )
40
43
 
41
44
#define SHOW_ADULT_TEXT N_( "Show shoutcast adult content" )
42
45
#define SHOW_ADULT_LONGTEXT N_( "Show NC17 rated video streams when " \
43
46
                "using shoutcast video playlists." )
44
47
 
45
 
#define EXTVLCOPT_TEXT N_( "Enable parsing of EXTVLCOPT: options" )
46
 
#define EXTVLCOPT_LONGTEXT N_( "Enable parsing of EXTVLCOPT: options in m3u " \
47
 
    "playlists. This option is default disabled to prevent untrusted sources " \
48
 
    "using VLC options without the user's knowledge." )
 
48
#define SKIP_ADS_TEXT N_( "Skip ads" )
 
49
#define SKIP_ADS_LONGTEXT N_( "Use playlist options usually used to prevent " \
 
50
    "ads skipping to detect ads and prevent adding them to the playlist." )
49
51
 
50
52
vlc_module_begin();
51
53
    add_shortcut( "playlist" );
53
55
    set_subcategory( SUBCAT_INPUT_DEMUX );
54
56
 
55
57
    add_bool( "playlist-autostart", 1, NULL,
56
 
              AUTOSTART_TEXT, AUTOSTART_LONGTEXT, VLC_FALSE );
57
 
 
58
 
    set_shortname( _("Playlist") );
59
 
    set_description( _("Playlist") );
60
 
    add_shortcut( "old-open" );
61
 
    set_capability( "demux2", 10 );
62
 
    set_callbacks( E_(Import_Old), E_(Close_Old) );
63
 
#if 0
64
 
    add_submodule();
65
 
        set_description( _("Native playlist import") );
66
 
        add_shortcut( "playlist" );
67
 
        add_shortcut( "native-open" );
68
 
        set_capability( "demux2", 10 );
69
 
        set_callbacks( E_(Import_Native), E_(Close_Native) );
70
 
#endif
71
 
    add_submodule();
72
 
        set_description( _("M3U playlist import") );
 
58
              AUTOSTART_TEXT, AUTOSTART_LONGTEXT, false );
 
59
 
 
60
    add_integer( "parent-item", 0, NULL, NULL, NULL, true );
 
61
        change_internal();
 
62
 
 
63
    add_bool( "playlist-skip-ads", 1, NULL,
 
64
              SKIP_ADS_TEXT, SKIP_ADS_LONGTEXT, false );
 
65
 
 
66
    set_shortname( N_("Playlist") );
 
67
    set_description( N_("Playlist") );
 
68
    add_submodule();
 
69
        set_description( N_("M3U playlist import") );
73
70
        add_shortcut( "m3u-open" );
74
 
        set_capability( "demux2", 10 );
75
 
        add_bool( "m3u-extvlcopt", VLC_FALSE, NULL,
76
 
                  EXTVLCOPT_TEXT, EXTVLCOPT_LONGTEXT, VLC_FALSE );
77
 
        set_callbacks( E_(Import_M3U), E_(Close_M3U) );
 
71
        set_capability( "demux", 10 );
 
72
        set_callbacks( Import_M3U, Close_M3U );
78
73
    add_submodule();
79
 
        set_description( _("PLS playlist import") );
 
74
        set_description( N_("PLS playlist import") );
80
75
        add_shortcut( "pls-open" );
81
 
        set_capability( "demux2", 10 );
82
 
        set_callbacks( E_(Import_PLS), E_(Close_PLS) );
 
76
        set_capability( "demux", 10 );
 
77
        set_callbacks( Import_PLS, Close_PLS );
83
78
    add_submodule();
84
 
        set_description( _("B4S playlist import") );
 
79
        set_description( N_("B4S playlist import") );
85
80
        add_shortcut( "b4s-open" );
86
81
        add_shortcut( "shout-b4s" );
87
 
        set_capability( "demux2", 10 );
88
 
        set_callbacks( E_(Import_B4S), E_(Close_B4S) );
 
82
        set_capability( "demux", 10 );
 
83
        set_callbacks( Import_B4S, Close_B4S );
89
84
    add_submodule();
90
 
        set_description( _("DVB playlist import") );
 
85
        set_description( N_("DVB playlist import") );
91
86
        add_shortcut( "dvb-open" );
92
 
        set_capability( "demux2", 10 );
93
 
        set_callbacks( E_(Import_DVB), E_(Close_DVB) );
 
87
        set_capability( "demux", 10 );
 
88
        set_callbacks( Import_DVB, Close_DVB );
94
89
    add_submodule();
95
 
        set_description( _("Podcast parser") );
 
90
        set_description( N_("Podcast parser") );
96
91
        add_shortcut( "podcast" );
97
 
        set_capability( "demux2", 10 );
98
 
        set_callbacks( E_(Import_podcast), E_(Close_podcast) );
 
92
        set_capability( "demux", 10 );
 
93
        set_callbacks( Import_podcast, Close_podcast );
99
94
    add_submodule();
100
 
        set_description( _("XSPF playlist import") );
 
95
        set_description( N_("XSPF playlist import") );
101
96
        add_shortcut( "xspf-open" );
102
 
        set_capability( "demux2", 10 );
103
 
        set_callbacks( E_(Import_xspf), E_(Close_xspf) );
 
97
        set_capability( "demux", 10 );
 
98
        set_callbacks( Import_xspf, Close_xspf );
104
99
    add_submodule();
105
 
        set_description( _("New winamp 5.2 shoutcast import") );
 
100
        set_description( N_("New winamp 5.2 shoutcast import") );
106
101
        add_shortcut( "shout-winamp" );
107
 
        set_capability( "demux2", 10 );
108
 
        set_callbacks( E_(Import_Shoutcast), E_(Close_Shoutcast) );
109
 
        add_bool( "shoutcast-show-adult", VLC_FALSE, NULL,
110
 
                   SHOW_ADULT_TEXT, SHOW_ADULT_LONGTEXT, VLC_FALSE );
 
102
        set_capability( "demux", 10 );
 
103
        set_callbacks( Import_Shoutcast, Close_Shoutcast );
 
104
        add_bool( "shoutcast-show-adult", false, NULL,
 
105
                   SHOW_ADULT_TEXT, SHOW_ADULT_LONGTEXT, false );
 
106
    add_submodule();
 
107
        set_description( N_("ASX playlist import") );
 
108
        add_shortcut( "asx-open" );
 
109
        set_capability( "demux", 10 );
 
110
        set_callbacks( Import_ASX, Close_ASX );
 
111
    add_submodule();
 
112
        set_description( N_("Kasenna MediaBase parser") );
 
113
        add_shortcut( "sgimb" );
 
114
        set_capability( "demux", 10 );
 
115
        set_callbacks( Import_SGIMB, Close_SGIMB );
 
116
    add_submodule();
 
117
        set_description( N_("QuickTime Media Link importer") );
 
118
        add_shortcut( "qtl" );
 
119
        set_capability( "demux", 10 );
 
120
        set_callbacks( Import_QTL, Close_QTL );
 
121
    add_submodule();
 
122
        set_description( N_("Google Video Playlist importer") );
 
123
        add_shortcut( "gvp" );
 
124
        set_capability( "demux", 10 );
 
125
        set_callbacks( Import_GVP, Close_GVP );
 
126
    add_submodule();
 
127
        set_description( N_("Dummy ifo demux") );
 
128
        set_capability( "demux", 12 );
 
129
        set_callbacks( Import_IFO, Close_IFO );
 
130
    add_submodule();
 
131
        set_description( N_("iTunes Music Library importer") );
 
132
        add_shortcut( "itml" );
 
133
        set_capability( "demux", 10 );
 
134
        set_callbacks( Import_iTML, Close_iTML );
111
135
vlc_module_end();
112
136
 
113
137
 
115
139
 * Find directory part of the path to the playlist file, in case of
116
140
 * relative paths inside
117
141
 */
118
 
char *E_(FindPrefix)( demux_t *p_demux )
 
142
char *FindPrefix( demux_t *p_demux )
119
143
{
120
144
    char *psz_name;
121
145
    char *psz_path = strdup( p_demux->psz_path );
136
160
 * Add the directory part of the playlist file to the start of the
137
161
 * mrl, if the mrl is a relative file path
138
162
 */
139
 
char *E_(ProcessMRL)( char *psz_mrl, char *psz_prefix )
 
163
char *ProcessMRL( char *psz_mrl, char *psz_prefix )
140
164
{
141
165
    /* Check for a protocol name.
142
166
     * for URL, we should look for "://"
159
183
    asprintf( &psz_mrl, "%s%s", psz_prefix, psz_mrl );
160
184
    return psz_mrl;
161
185
}
162
 
 
163
 
vlc_bool_t E_(FindItem)( demux_t *p_demux, playlist_t *p_playlist,
164
 
                     playlist_item_t **pp_item )
165
 
{
166
 
     vlc_bool_t b_play = var_CreateGetBool( p_demux, "playlist-autostart" );
167
 
 
168
 
     if( b_play && p_playlist->status.p_item &&
169
 
             &p_playlist->status.p_item->input ==
170
 
                ((input_thread_t *)p_demux->p_parent)->input.p_item )
171
 
     {
172
 
         msg_Dbg( p_playlist, "starting playlist playback" );
173
 
         *pp_item = p_playlist->status.p_item;
174
 
         b_play = VLC_TRUE;
175
 
     }
176
 
     else
177
 
     {
178
 
         input_item_t *p_current = ( (input_thread_t*)p_demux->p_parent)->
179
 
                                                        input.p_item;
180
 
         *pp_item = playlist_LockItemGetByInput( p_playlist, p_current );
181
 
         if( !*pp_item )
182
 
         {
183
 
             msg_Dbg( p_playlist, "unable to find item in playlist");
184
 
         }
185
 
         msg_Dbg( p_playlist, "not starting playlist playback");
186
 
         b_play = VLC_FALSE;
187
 
     }
188
 
     return b_play;
189
 
}