📄 sgimb.c
字号:
psz_bol = psz_line; /* Remove unnecessary tabs or spaces at the beginning of line */ while( *psz_bol == ' ' || *psz_bol == '\t' || *psz_bol == '\n' || *psz_bol == '\r' ) { psz_bol++; } if( !strncasecmp( psz_bol, "rtsp://", sizeof("rtsp://") - 1 ) ) { /* We found the link, it was inside a sgiQTFileBegin */ p_sys->psz_uri = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "Stream=\"", sizeof("Stream=\"") - 1 ) ) { psz_bol += sizeof("Stream=\"") - 1; if ( !psz_bol ) return 0; strrchr( psz_bol, '"' )[0] = '\0'; /* We cheat around xdma. for some reason xdma links work different then rtsp */ if( !strncasecmp( psz_bol, "xdma://", sizeof("xdma://") - 1 ) ) { psz_bol[0] = 'r'; psz_bol[1] = 't'; psz_bol[2] = 's'; psz_bol[3] = 'p'; } p_sys->psz_uri = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiNameServerHost=", sizeof("sgiNameServerHost=") - 1 ) ) { psz_bol += sizeof("sgiNameServerHost=") - 1; p_sys->psz_server = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiMovieName=", sizeof("sgiMovieName=") - 1 ) ) { psz_bol += sizeof("sgiMovieName=") - 1; p_sys->psz_location = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiUserAccount=", sizeof("sgiUserAccount=") - 1 ) ) { psz_bol += sizeof("sgiUserAccount=") - 1; p_sys->psz_user = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiUserPassword=", sizeof("sgiUserPassword=") - 1 ) ) { psz_bol += sizeof("sgiUserPassword=") - 1; p_sys->psz_password = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiShowingName=", sizeof("sgiShowingName=") - 1 ) ) { psz_bol += sizeof("sgiShowingName=") - 1; p_sys->psz_name = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiFormatName=", sizeof("sgiFormatName=") - 1 ) ) { psz_bol += sizeof("sgiFormatName=") - 1; if( strcasestr( psz_bol, "MPEG-4") == NULL ) /*not mpeg4 found in string */ p_sys->b_rtsp_kasenna = VLC_TRUE; } else if( !strncasecmp( psz_bol, "sgiMulticastAddress=", sizeof("sgiMulticastAddress=") - 1 ) ) { psz_bol += sizeof("sgiMulticastAddress=") - 1; p_sys->psz_mcast_ip = strdup( psz_bol ); } else if( !strncasecmp( psz_bol, "sgiMulticastPort=", sizeof("sgiMulticastPort=") - 1 ) ) { psz_bol += sizeof("sgiMulticastPort=") - 1; p_sys->i_mcast_port = (int) strtol( psz_bol, NULL, 0 ); } else if( !strncasecmp( psz_bol, "sgiPacketSize=", sizeof("sgiPacketSize=") - 1 ) ) { psz_bol += sizeof("sgiPacketSize=") - 1; p_sys->i_packet_size = (int) strtol( psz_bol, NULL, 0 ); } else if( !strncasecmp( psz_bol, "sgiDuration=", sizeof("sgiDuration=") - 1 ) ) { psz_bol += sizeof("sgiDuration=") - 1; p_sys->i_duration = (mtime_t) strtol( psz_bol, NULL, 0 ); } else if( !strncasecmp( psz_bol, "sgiRtspPort=", sizeof("sgiRtspPort=") - 1 ) ) { psz_bol += sizeof("sgiRtspPort=") - 1; p_sys->i_port = (int) strtol( psz_bol, NULL, 0 ); } else if( !strncasecmp( psz_bol, "sgiSid=", sizeof("sgiSid=") - 1 ) ) { psz_bol += sizeof("sgiSid=") - 1; p_sys->i_sid = (int) strtol( psz_bol, NULL, 0 ); } else if( !strncasecmp( psz_bol, "DeliveryService=cds", sizeof("DeliveryService=cds") - 1 ) ) { p_sys->b_concert = VLC_TRUE; } else { /* This line isn't really important */ return 0; } return VLC_SUCCESS;}/***************************************************************************** * Demux: reads and demuxes data packets ***************************************************************************** * Returns -1 in case of error, 0 in case of EOF, 1 otherwise *****************************************************************************/static int Demux ( demux_t *p_demux ){ demux_sys_t *p_sys = p_demux->p_sys; playlist_t *p_playlist; playlist_item_t *p_item; char *psz_line; int i_position; 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; } p_playlist->status.p_item->i_flags = PLAYLIST_DEL_FLAG; i_position = -1; /* FIXME p_playlist->i_index + 1; */ while( ( psz_line = stream_ReadLine( p_demux->s ) ) ) { ParseLine( p_demux, psz_line ); if( psz_line ) free( psz_line ); } if( p_sys->psz_mcast_ip ) { /* Definetly schedules multicast session */ /* We don't care if it's live or not */ char *temp; asprintf( &temp, "udp://@" "%s:%i", p_sys->psz_mcast_ip, p_sys->i_mcast_port ); if( p_sys->psz_uri ) free( p_sys->psz_uri ); p_sys->psz_uri = strdup( temp ); free( temp ); } if( p_sys->psz_uri == NULL ) { if( p_sys->psz_server && p_sys->psz_location ) { char *temp; asprintf( &temp, "rtsp://" "%s:%i%s", p_sys->psz_server, p_sys->i_port > 0 ? p_sys->i_port : 554, p_sys->psz_location ); p_sys->psz_uri = strdup( temp ); free( temp ); } } if( p_sys->b_concert ) { /* It's definetly a simulcasted scheduled stream */ /* We don't care if it's live or not */ char *temp; if( p_sys->psz_uri == NULL ) { msg_Err( p_demux, "no URI was found" ); return -1; } asprintf( &temp, "%s%%3FMeDiAbAsEshowingId=%d%%26MeDiAbAsEconcert%%3FMeDiAbAsE", p_sys->psz_uri, p_sys->i_sid ); free( p_sys->psz_uri ); p_sys->psz_uri = strdup( temp ); free( temp ); } p_item = playlist_ItemNew( p_playlist, p_sys->psz_uri, p_sys->psz_name ? p_sys->psz_name : p_sys->psz_uri ); if( !p_item || !p_item->input.psz_uri ) { msg_Err( p_demux, "A valid playlistitem could not be created" ); return VLC_EGENERIC; } if( p_sys->i_packet_size && p_sys->psz_mcast_ip ) { char *psz_option; p_sys->i_packet_size += 1000; asprintf( &psz_option, "mtu=%i", p_sys->i_packet_size ); playlist_ItemAddOption( p_item, psz_option ); free( psz_option ); } if( !p_sys->psz_mcast_ip ) { char *psz_option; asprintf( &psz_option, "rtsp-caching=5000" ); playlist_ItemAddOption( p_item, psz_option ); free( psz_option ); } if( !p_sys->psz_mcast_ip && p_sys->b_rtsp_kasenna ) { char *psz_option; asprintf( &psz_option, "rtsp-kasenna" ); playlist_ItemAddOption( p_item, psz_option ); free( psz_option ); } playlist_ItemSetDuration( p_item, p_sys->i_duration ); playlist_AddItem( p_playlist, p_item, PLAYLIST_INSERT, i_position ); vlc_object_release( p_playlist ); return VLC_SUCCESS;}static int Control( demux_t *p_demux, int i_query, va_list args ){ return VLC_EGENERIC;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -