X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fdemux%2Fplaylist%2Fdvb.c;h=1dd1461d59959788721059eec9fe8c590c97ff1b;hb=bcddfd6382fb71b0021008eb63f1bc4a1b1bae0e;hp=c0e0f5d08053832047a55b5a59bcee38abc99136;hpb=82447676341b7d303e1b1f270968b4b8cef4143c;p=vlc diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c index c0e0f5d080..1dd1461d59 100644 --- a/modules/demux/playlist/dvb.c +++ b/modules/demux/playlist/dvb.c @@ -18,17 +18,20 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ /***************************************************************************** * Preamble *****************************************************************************/ -#include /* malloc(), free() */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include -#include -#include +#include +#include +#include #include "playlist.h" @@ -51,15 +54,12 @@ static int ParseLine( char *, char **, char ***, int *); int E_(Import_DVB)( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; - uint8_t *p_peek; + const uint8_t *p_peek; int i_peek; - char *psz_ext; vlc_bool_t b_valid = VLC_FALSE; - psz_ext = strrchr ( p_demux->psz_path, '.' ); - - if( !( psz_ext && !strncasecmp( psz_ext, ".conf", 5 ) ) && - !p_demux->b_force ) return VLC_EGENERIC; + if( !demux2_IsPathExtension( p_demux, ".conf" ) && !p_demux->b_force ) + return VLC_EGENERIC; /* Check if this really is a channels file */ if( (i_peek = stream_Peek( p_demux->s, &p_peek, 1024 )) > 0 ) @@ -80,7 +80,6 @@ int E_(Import_DVB)( vlc_object_t *p_this ) if( !b_valid ) return VLC_EGENERIC; msg_Dbg( p_demux, "found valid DVB conf playlist file"); - p_demux->pf_control = Control; p_demux->pf_demux = Demux; @@ -92,6 +91,7 @@ int E_(Import_DVB)( vlc_object_t *p_this ) *****************************************************************************/ void E_(Close_DVB)( vlc_object_t *p_this ) { + VLC_UNUSED(p_this); } /***************************************************************************** @@ -99,27 +99,12 @@ void E_(Close_DVB)( vlc_object_t *p_this ) *****************************************************************************/ static int Demux( demux_t *p_demux ) { - playlist_t *p_playlist; char *psz_line; - playlist_item_t *p_current; - vlc_bool_t b_play; - - p_playlist = (playlist_t *) vlc_object_find( p_demux, VLC_OBJECT_PLAYLIST, - FIND_ANYWHERE ); - if( !p_playlist ) - { - msg_Err( p_demux, "can't find playlist" ); - return -1; - } - - b_play = E_(FindItem)( p_demux, p_playlist, &p_current ); - - playlist_ItemToNode( p_playlist, p_current ); - p_current->input.i_type = ITEM_TYPE_PLAYLIST; + input_item_t *p_input; + INIT_PLAYLIST_STUFF; while( (psz_line = stream_ReadLine( p_demux->s )) ) { - playlist_item_t *p_item; char **ppsz_options = NULL; int i, i_options = 0; char *psz_name = NULL; @@ -132,45 +117,28 @@ static int Demux( demux_t *p_demux ) EnsureUTF8( psz_name ); - p_item = playlist_ItemNew( p_playlist, "dvb:", psz_name ); + p_input = input_ItemNewExt( p_playlist, "dvb:", psz_name, 0, NULL, -1 ); for( i = 0; i< i_options; i++ ) { EnsureUTF8( ppsz_options[i] ); - playlist_ItemAddOption( p_item, ppsz_options[i] ); + input_ItemAddOption( p_input, ppsz_options[i] ); } - playlist_NodeAddItem( p_playlist, p_item, - p_current->pp_parents[0]->i_view, - p_current, PLAYLIST_APPEND, PLAYLIST_END ); - - /* We need to declare the parents of the node as the - * * same of the parent's ones */ - playlist_CopyParents( p_current, p_item ); - vlc_input_item_CopyOptions( &p_current->input, &p_item->input ); - + input_ItemAddSubItem( p_current_input, p_input ); + vlc_gc_decref( p_input ); while( i_options-- ) free( ppsz_options[i_options] ); - if( ppsz_options ) free( ppsz_options ); + free( ppsz_options ); free( psz_line ); } - /* Go back and play the playlist */ - if( b_play && p_playlist->status.p_item && - p_playlist->status.p_item->i_children > 0 ) - { - playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, - p_playlist->status.i_view, - p_playlist->status.p_item, - p_playlist->status.p_item->pp_children[0] ); - } - - vlc_object_release( p_playlist ); - return VLC_SUCCESS; + HANDLE_PLAY_AND_RELEASE; + return 0; /* Needed for correct operation of go back */ } static struct { - char *psz_name; - char *psz_option; + const char *psz_name; + const char *psz_option; } dvb_options[] = { @@ -212,6 +180,8 @@ static struct { "QAM_64", "dvb-modulation=64" }, { "QAM_128", "dvb-modulation=128" }, { "QAM_256", "dvb-modulation=256" }, + { "8VSB", "dvb-modulation=8" }, + { "16VSB", "dvb-modulation=16" }, { "TRANSMISSION_MODE_AUTO", "dvb-transmission=0" }, { "TRANSMISSION_MODE_2K", "dvb-transmission=2" }, @@ -240,7 +210,7 @@ static int ParseLine( char *psz_line, char **ppsz_name, while( psz_parse ) { - char *psz_option = 0; + const char *psz_option = 0; char *psz_end = strchr( psz_parse, ':' ); if( psz_end ) { *psz_end = 0; psz_end++; } @@ -296,9 +266,10 @@ static int ParseLine( char *psz_line, char **ppsz_name, if( psz_option && pppsz_options && pi_options ) { - psz_option = strdup( psz_option ); - INSERT_ELEM( *pppsz_options, (*pi_options), (*pi_options), - psz_option ); + char *psz_dup = strdup( psz_option ); + if (psz_dup != NULL) + INSERT_ELEM( *pppsz_options, (*pi_options), (*pi_options), + psz_dup ); } psz_parse = psz_end; @@ -309,7 +280,7 @@ static int ParseLine( char *psz_line, char **ppsz_name, { /* This isn't a valid channels file, cleanup everything */ while( (*pi_options)-- ) free( (*pppsz_options)[*pi_options] ); - if( *pppsz_options ) free( *pppsz_options ); + free( *pppsz_options ); *pppsz_options = 0; *pi_options = 0; } @@ -336,5 +307,6 @@ static int ParseLine( char *psz_line, char **ppsz_name, static int Control( demux_t *p_demux, int i_query, va_list args ) { + VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args); return VLC_EGENERIC; }