⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sgimb.c

📁 video linux conference
💻 C
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** * sgimb.c: a meta demux to parse sgimb referrer files ***************************************************************************** * Copyright (C) 2004 VideoLAN * $Id: sgimb.c 9961 2005-02-16 22:01:41Z robux4 $ * * Authors: Derk-Jan Hartman <hartman at videolan dot org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * 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. *****************************************************************************//***************************************************************************** * This is a metademux for the Kasenna MediaBase metafile format. * Kasenna MediaBase first returns this file when you are trying to access * their MPEG streams (MIME: application/x-sgimb). Very few applications * understand this format and the format is not really documented on the net. * Following a typical MediaBase file. Notice the sgi prefix of all the elements. * This stems from the fact that the MediaBase servers were first introduced by SGI?????. * * sgiNameServerHost=host.name.tld *     Obvious: the host hosting this stream * Stream="xdma://host.name.tld/demo/a_very_cool.mpg" *     Not always present. xdma can be read as RTSP. * sgiMovieName=/demo/a_very_cool.mpg *     The path to the asset * sgiAuxState=1|2 *     AuxState=2 is always Video On Demand (so not Scheduled) *     Not present with Live streams * sgiLiveFeed=True|False *     Denounces if the stream is live or from assets (Canned?) *     Live appears as a little sattelite dish in the web interface of Kasenna * sgiFormatName=PARTNER_41_MPEG-4 *     The type of stream. One of: *       PARTNER_41_MPEG-4 (RTSP MPEG-4 fully compliant) *       MPEG1-Audio       (MP3 Audio streams in MPEG TS) *       MPEG-1            (MPEG 1 A/V in MPEG TS) *       MPEG-2            (MPEG 2 A/V in MPEG TS) * sgiWidth=720 *     The width of the to be received stream. Only present if stream is not Live. * sgiHeight=576 *     The height of the to be received stream. Only present if stream is not Live. * sgiBitrate=1630208 *     The bitrate of the to be received stream. Only present if stream is not Live. * sgiDuration=378345000 *     The duration of the to be received stream. Only present if stream is not Live. * sgiQTFileBegin * rtsptext * rtsp://host.name.tld/demo/a_very_cool.mpg * sgiQTFileEnd *     Sometimes present. QT will recognize this as a RTSP reference file, if present. * sgiApplicationName=MediaBaseURL *     Beats me !! :) * sgiElapsedTime=0 *     Time passed since the asset was started (resets for repeating non live assets?) * sgiMulticastAddress=233.81.233.15 *     The multicast IP used for the Multicast feed. *     Also defines if a stream is multicast or not. (blue dot in kasenna web interface) * sgiMulticastPort=1234 *     The multicast port for the same Multicast feed. * sgiPacketSize=16384 *     The packetsize of the UDP frames that Kasenna sends. They should have used a default *     that is a multiple of 188 (TS frame size). Most networks don't support more than 1500 anyways. *     Also, when you loose a frame of this size, imagecorruption is more likely then with smaller *     frames. * sgiServerVersion=6.1.2 *     Version of the server * sgiRtspPort=554 *     TCP port used for RTSP communication * AutoStart=True *     Start playing automatically * DeliveryService=cds *     Simulcasted (scheduled unicast) content. (Green dot in Kasenna web interface)  * sgiShowingName=A nice name that everyone likes *     A human readible descriptive title for this stream. * sgiSid=2311 *     Looks like this is the ID of the scheduled asset? * sgiUserAccount=pid=1724&time=1078527309&displayText=You%20are%20logged%20as%20guest& *     User Authentication. Above is a default guest entry. Not required for RTSP communication. * sgiUserPassword= *     Password :) * *****************************************************************************//***************************************************************************** * Preamble *****************************************************************************/#include <stdlib.h>                                      /* malloc(), free() */#include <vlc/vlc.h>#include <vlc/input.h>#include <vlc_playlist.h>/***************************************************************************** * Module descriptor *****************************************************************************/static int  Activate  ( vlc_object_t * );static void Deactivate( vlc_object_t * );vlc_module_begin();    set_description( _("Kasenna MediaBase metademux") );    set_category( CAT_INPUT );    set_subcategory( SUBCAT_INPUT_DEMUX );    set_capability( "demux2", 170 );    set_callbacks( Activate, Deactivate );    add_shortcut( "sgimb" );vlc_module_end();/***************************************************************************** * Local prototypes *****************************************************************************/#define MAX_LINE 1024struct demux_sys_t{    char        *psz_uri;       /* Stream= or sgiQTFileBegin rtsp link */    char        *psz_server;    /* sgiNameServerHost= */    char        *psz_location;  /* sgiMovieName= */    char        *psz_name;      /* sgiShowingName= */    char        *psz_user;      /* sgiUserAccount= */    char        *psz_password;  /* sgiUserPassword= */    char        *psz_mcast_ip;  /* sgiMulticastAddress= */    int         i_mcast_port;   /* sgiMulticastPort= */    int         i_packet_size;  /* sgiPacketSize= */    mtime_t     i_duration;     /* sgiDuration= */    int         i_port;         /* sgiRtspPort= */    int         i_sid;          /* sgiSid= */    vlc_bool_t  b_concert;      /* DeliveryService=cds */    vlc_bool_t  b_rtsp_kasenna; /* kasenna style RTSP */};static int Demux ( demux_t *p_demux );static int Control( demux_t *p_demux, int i_query, va_list args );/***************************************************************************** * Activate: initializes m3u demux structures *****************************************************************************/static int Activate( vlc_object_t * p_this ){    demux_t *p_demux = (demux_t *)p_this;    demux_sys_t *p_sys;    byte_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 )    {        while ( i_size && strncasecmp( p_peek, "sgiNameServerHost=",                                       sizeof("sgiNameServerHost=") - 1 ) )        {            p_peek++;            i_size--;        }        if ( !strncasecmp( p_peek, "sgiNameServerHost=",                           sizeof("sgiNameServerHost=") -1 ) )        {            p_demux->pf_demux = Demux;            p_demux->pf_control = Control;            p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );            p_sys->psz_uri = NULL;            p_sys->psz_server = NULL;            p_sys->psz_location = NULL;            p_sys->psz_name = NULL;            p_sys->psz_user = NULL;            p_sys->psz_password = NULL;            p_sys->psz_mcast_ip = NULL;            p_sys->i_mcast_port = 0;            p_sys->i_packet_size = 0;            p_sys->i_duration = 0;            p_sys->i_port = 0;            p_sys->i_sid = 0;            p_sys->b_rtsp_kasenna = VLC_FALSE;            p_sys->b_concert = VLC_FALSE;            return VLC_SUCCESS;        }    }    return VLC_EGENERIC;}/***************************************************************************** * Deactivate: frees unused data *****************************************************************************/static void Deactivate( vlc_object_t *p_this ){    demux_t *p_demux = (demux_t*)p_this;    demux_sys_t *p_sys = p_demux->p_sys;    if( p_sys->psz_uri )        free( p_sys->psz_uri );    if( p_sys->psz_server )        free( p_sys->psz_server );    if( p_sys->psz_location )        free( p_sys->psz_location );    if( p_sys->psz_name )        free( p_sys->psz_name );    if( p_sys->psz_user )        free( p_sys->psz_user );    if( p_sys->psz_password )        free( p_sys->psz_password );    if( p_sys->psz_mcast_ip )        free( p_sys->psz_mcast_ip );    free( p_demux->p_sys );    return;}static int ParseLine ( demux_t *p_demux, char *psz_line ){    char        *psz_bol;    demux_sys_t *p_sys = p_demux->p_sys;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -