/***************************************************************************** * Import_GVP: main import function *****************************************************************************/ int Import_GVP( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; int i_peek, i, b_found = false; const uint8_t *p_peek; i_peek = stream_Peek( p_demux->s, &p_peek, MAX_LINE ); for( i = 0; i < i_peek - (int)sizeof("gvp_version:"); i++ ) { if( p_peek[i] == 'g' && p_peek[i+1] == 'v' && p_peek[i+2] == 'p' && !memcmp( p_peek+i, "gvp_version:", sizeof("gvp_version:") - 1 ) ) { b_found = true; break; } } if( !b_found ) return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "using Google Video Playlist (gvp) import" ); p_demux->pf_control = Control; p_demux->pf_demux = Demux; p_demux->p_sys = malloc( sizeof( demux_sys_t ) ); if( !p_demux->p_sys ) return VLC_ENOMEM; return VLC_SUCCESS; }
/***************************************************************************** * Import_M3U: main import function *****************************************************************************/ int Import_M3U( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; CHECK_PEEK( p_peek, 8 ); char *(*pf_dup) (const char *); if( POKE( p_peek, "RTSPtext", 8 ) /* QuickTime */ || demux_IsPathExtension( p_demux, ".m3u8" ) || demux_IsForced( p_demux, "m3u8" ) ) pf_dup = strdup; /* UTF-8 */ else if( POKE( p_peek, "#EXTM3U", 7 ) || demux_IsPathExtension( p_demux, ".m3u" ) || demux_IsPathExtension( p_demux, ".vlc" ) || demux_IsForced( p_demux, "m3u" ) || ContainsURL( p_demux ) ) pf_dup = FromLocaleDup; /* locale character set (?) */ else return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" ); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); p_demux->p_sys->pf_dup = pf_dup; return VLC_SUCCESS; }
/***************************************************************************** * Import_ZPL: main import function *****************************************************************************/ int Import_ZPL( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; if(! ( demux_IsPathExtension( p_demux, ".zpl" ) || demux_IsForced( p_demux, "zpl" ))) return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "found valid ZPL playlist" ); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); return VLC_SUCCESS; }
/***************************************************************************** * Import_M3U: main import function *****************************************************************************/ int Import_M3U( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; char *(*pf_dup) (const char *) = GuessEncoding; int offset = 0; CHECK_FILE(); if( vlc_stream_Peek( p_demux->s, &p_peek, 3 ) == 3 && !memcmp( p_peek, "\xef\xbb\xbf", 3) ) { pf_dup = CheckUnicode; /* UTF-8 Byte Order Mark */ offset = 3; } if( demux_IsPathExtension( p_demux, ".m3u8" ) || demux_IsForced( p_demux, "m3u8" ) || CheckContentType( p_demux->s, "application/vnd.apple.mpegurl" ) ) pf_dup = CheckUnicode; /* UTF-8 file type */ else if( demux_IsPathExtension( p_demux, ".m3u" ) || demux_IsPathExtension( p_demux, ".vlc" ) || demux_IsForced( p_demux, "m3u" ) || ContainsURL( p_demux ) || CheckContentType( p_demux->s, "audio/x-mpegurl") ) ; /* Guess encoding */ else { if( vlc_stream_Peek( p_demux->s, &p_peek, 8 + offset ) < (8 + offset) ) return VLC_EGENERIC; p_peek += offset; if( !strncasecmp( (const char *)p_peek, "RTSPtext", 8 ) ) /* QuickTime */ pf_dup = CheckUnicode; /* UTF-8 */ else if( !memcmp( p_peek, "#EXTM3U", 7 ) ) ; /* Guess encoding */ else return VLC_EGENERIC; } vlc_stream_Seek( p_demux->s, offset ); STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" ); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); p_demux->p_sys->pf_dup = pf_dup; return VLC_SUCCESS; }
/***************************************************************************** * Import_WPL: main import function *****************************************************************************/ int Import_WPL( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; CHECK_PEEK( p_peek, 8 ); if(! ( demux_IsPathExtension( p_demux, ".wpl" ) || demux_IsForced( p_demux, "wpl" ))) return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "found valid WPL playlist" ); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); return VLC_SUCCESS; }
/***************************************************************************** * Import_Shoutcast: main import function *****************************************************************************/ int Import_Shoutcast( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; if( !demux_IsForced( p_demux, "shout-winamp" ) ) return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "using shoutcast playlist reader" ); p_demux->p_sys->p_xml = NULL; p_demux->p_sys->p_xml_reader = NULL; /* Do we want to list adult content ? */ var_Create( p_demux, "shoutcast-show-adult", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); p_demux->p_sys->b_adult = var_GetBool( p_demux, "shoutcast-show-adult" ); return VLC_SUCCESS; }
/***************************************************************************** * Import_PLS: main import function *****************************************************************************/ int Import_PLS( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; CHECK_PEEK( p_peek, 10 ); if( POKE( p_peek, "[playlist]", 10 ) || POKE( p_peek, "[Reference]", 10 ) || demux_IsPathExtension( p_demux, ".pls" ) || demux_IsForced( p_demux, "pls" ) ) { ; } else return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "found valid PLS playlist file"); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); return VLC_SUCCESS; }
int Import_ASX( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; if( demux_IsPathExtension( p_demux, ".asx" ) || demux_IsPathExtension( p_demux, ".wax" ) || demux_IsPathExtension( p_demux, ".wvx" ) || ( ( CheckContentType( p_demux->s, "video/x-ms-asf" ) || CheckContentType( p_demux->s, "audio/x-ms-wax" ) ) && PeekASX( p_demux ) ) || demux_IsForced( p_demux, "asx-open" ) ) { STANDARD_DEMUX_INIT_MSG( "found valid ASX playlist" ); return VLC_SUCCESS; } else return VLC_EGENERIC; }
/***************************************************************************** * Activate: initializes m3u demux structures *****************************************************************************/ int Import_SGIMB( vlc_object_t * p_this ) { demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; int i_size; /* Lets check the content to see if this is a sgi mediabase file */ i_size = stream_Peek( p_demux->s, &p_peek, MAX_LINE ); i_size -= sizeof("sgiNameServerHost=") - 1; if ( i_size > 0 ) { unsigned int i_len = sizeof("sgiNameServerHost=") - 1; while ( i_size && strncasecmp( (char *)p_peek, "sgiNameServerHost=", i_len ) ) { p_peek++; i_size--; } if ( !strncasecmp( (char *)p_peek, "sgiNameServerHost=", i_len ) ) { STANDARD_DEMUX_INIT_MSG( "using SGIMB playlist reader" ); p_demux->p_sys->psz_uri = NULL; p_demux->p_sys->psz_server = NULL; p_demux->p_sys->psz_location = NULL; p_demux->p_sys->psz_name = NULL; p_demux->p_sys->psz_user = NULL; p_demux->p_sys->psz_password = NULL; p_demux->p_sys->psz_mcast_ip = NULL; p_demux->p_sys->i_mcast_port = 0; p_demux->p_sys->i_packet_size = 0; p_demux->p_sys->i_duration = 0; p_demux->p_sys->i_port = 0; p_demux->p_sys->i_sid = 0; p_demux->p_sys->b_rtsp_kasenna = false; p_demux->p_sys->b_concert = false; return VLC_SUCCESS; } } return VLC_EGENERIC; }
/** * Import_RAM: main import function * @param p_this: this demux object * @return VLC_SUCCESS if everything is okay */ int Import_RAM( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; CHECK_FILE(); if(! demux_IsPathExtension( p_demux, ".ram" ) || demux_IsPathExtension( p_demux, ".rm" ) ) return VLC_EGENERIC; /* Many Real Media Files are misdetected */ if( vlc_stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC; if( !memcmp( p_peek, ".ra", 3 ) || !memcmp( p_peek, ".RMF", 4 ) ) { return VLC_EGENERIC; } STANDARD_DEMUX_INIT_MSG( "found valid RAM playlist" ); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); return VLC_SUCCESS; }