コード例 #1
0
/**
 * This function will handle a snapshot request and provide the image pointer
 */
static void VoutSnapshotAddr( vout_thread_t *p_vout )
{
    char *psz_format = var_GetNonEmptyString( p_vout, "snapshot-format" );
    char *psz_prefix = var_GetNonEmptyString( p_vout, "snapshot-prefix" );

    /* */
    picture_t *p_picture;
    block_t *p_image;
    video_format_t fmt;

    /* 500ms timeout
     * XXX it will cause trouble with low fps video (< 2fps) */
    if( vout_GetSnapshot( p_vout, &p_image, &p_picture, &fmt, psz_format, 500*1000 ) )
    {
        p_picture = NULL;
        p_image = NULL;
        goto exit;
    }

	msg_Dbg( p_vout, "p_image addr: %i", p_image );
	var_Create( p_vout, "snapshot-addr", VLC_VAR_ADDRESS );
    var_SetAddress( p_vout, "snapshot-addr", (void *) p_image );

exit:
    if( p_picture )
        picture_Release( p_picture );
    free( psz_prefix );
    free( psz_format );
}
コード例 #2
0
ファイル: variables.c プロジェクト: Adatan/vlc
static void test_strings( libvlc_int_t *p_libvlc )
{
    int i;
    char *psz_tmp;
    for( i = 0; i < i_var_count; i++ )
         var_Create( p_libvlc, psz_var_name[i], VLC_VAR_STRING );

    for( i = 0; i < i_var_count; i++ )
        var_SetString( p_libvlc, psz_var_name[i], psz_var_name[i] );

    for( i = 0; i < i_var_count; i++ )
    {
        psz_tmp = var_GetString( p_libvlc, psz_var_name[i] );
        assert( !strcmp( psz_tmp, psz_var_name[i] ) );
        free( psz_tmp );
    }

    for( i = 0; i < i_var_count; i++ )
        var_Destroy( p_libvlc, psz_var_name[i] );


    /* Some more test for strings */
    var_Create( p_libvlc, "bla", VLC_VAR_STRING );
    assert( var_GetNonEmptyString( p_libvlc, "bla" ) == NULL );
    var_SetString( p_libvlc, "bla", "" );
    assert( var_GetNonEmptyString( p_libvlc, "bla" ) == NULL );
    var_SetString( p_libvlc, "bla", "test" );
    psz_tmp = var_GetNonEmptyString( p_libvlc, "bla" );
    assert( !strcmp( psz_tmp, "test" ) );
    free( psz_tmp );
    var_Destroy( p_libvlc, "bla" );
}
コード例 #3
0
static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access)
{
    sout_stream_sys_t   *p_sys = p_stream->p_sys;

    static const struct addrinfo hints = {
		// sunqueen modify start
        /*.ai_family =*/ AF_UNSPEC,
        /*.ai_socktype =*/ SOCK_DGRAM,
        /*.ai_protocol =*/ 0,
        /*.ai_flags =*/ AI_NUMERICHOST | AI_NUMERICSERV | AI_IDN,
		// sunqueen modify end
    };
    char *shost = var_GetNonEmptyString (p_access, "src-addr");
    char *dhost = var_GetNonEmptyString (p_access, "dst-addr");
    int sport = var_GetInteger (p_access, "src-port");
    int dport = var_GetInteger (p_access, "dst-port");
    struct sockaddr_storage src, dst;
    socklen_t srclen = 0, dstlen = 0;
    struct addrinfo *res;

    if (!vlc_getaddrinfo (dhost, dport, &hints, &res))
    {
        memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen);
        freeaddrinfo (res);
    }

    if (!vlc_getaddrinfo (shost, sport, &hints, &res))
    {
        memcpy (&src, res->ai_addr, srclen = res->ai_addrlen);
        freeaddrinfo (res);
    }

    char *head = vlc_sdp_Start (VLC_OBJECT (p_stream), SOUT_CFG_PREFIX,
            (struct sockaddr *)&src, srclen,
            (struct sockaddr *)&dst, dstlen);
    free (shost);

    if (head != NULL)
    {
        char *psz_sdp = NULL;
        if (asprintf (&psz_sdp, "%s"
                    "m=video %d udp mpeg\r\n", head, dport) == -1)
            psz_sdp = NULL;
        free (head);

        /* Register the SDP with the SAP thread */
        if (psz_sdp)
        {
            msg_Dbg (p_stream, "Generated SDP:\n%s", psz_sdp);
            p_sys->p_session =
                sout_AnnounceRegisterSDP (p_stream, psz_sdp, dhost);
            free( psz_sdp );
        }
    }
    free (dhost);
}
コード例 #4
0
ファイル: equalizer.c プロジェクト: Flameeyes/vlc
/*****************************************************************************
* Return EQ level for all bands as a Table
*****************************************************************************/
static int vlclua_equalizer_get( lua_State *L )
{
    int bands = 9;
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( !p_input )
        return 0;
    audio_output_t *p_aout = input_GetAout( p_input );
    vlc_object_release( p_input );
    if( !p_aout )
        return 0;

    float level = 0 ;
    char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
    if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
    {
        free( psz_af );
        vlc_object_release( p_aout );
        return 0;
    }
    free( psz_af );

    char *psz_bands_origin, *psz_bands;
    psz_bands_origin = psz_bands = var_GetNonEmptyString( p_aout, "equalizer-bands" );
    if( !psz_bands )
    {
        vlc_object_release( p_aout );
        return 0;
    }
    locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
    locale_t oldloc = uselocale (loc);
    int i = 0;
    char *str;
    lua_newtable( L );
    while( bands >= 0 )
    {
        level = strtof( psz_bands, &psz_bands);
        bands--;
        if( asprintf( &str , "%f" , level ) == -1 )
            return 0;
        lua_pushstring( L, str );
        free(str);
        if( asprintf( &str , "band id=\"%d\"", i++ ) == -1 )
            return 0;
        lua_setfield( L , -2 , str );
        free( str );
    }
    free( psz_bands_origin );
    if( loc != (locale_t)0 )
    {
        uselocale (oldloc);
        freelocale (loc);
    }
    vlc_object_release( p_aout );
    return 1;
}
コード例 #5
0
/*****************************************************************************
 * Open: open the file
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    sout_access_out_t   *p_access = (sout_access_out_t*)p_this;
    sout_access_out_sys_t *p_sys;
    char *psz_idx;

    config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );

    if( !p_access->psz_path )
    {
        msg_Err( p_access, "no file name specified" );
        return VLC_EGENERIC;
    }

    if( !( p_sys = malloc ( sizeof( *p_sys ) ) ) )
        return VLC_ENOMEM;

    p_sys->i_seglen = var_GetInteger( p_access, SOUT_CFG_PREFIX "seglen" );
    p_sys->i_seglenm = CLOCK_FREQ * p_sys->i_seglen;

    p_sys->i_numsegs = var_GetInteger( p_access, SOUT_CFG_PREFIX "numsegs" );
    p_sys->b_splitanywhere = var_GetBool( p_access, SOUT_CFG_PREFIX "splitanywhere" );
    p_sys->b_delsegs = var_GetBool( p_access, SOUT_CFG_PREFIX "delsegs" );
    p_sys->b_ratecontrol = var_GetBool( p_access, SOUT_CFG_PREFIX "ratecontrol") ;

    p_sys->psz_indexPath = NULL;
    psz_idx = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index" );
    if ( psz_idx )
    {
        char *psz_tmp;
        psz_tmp = str_format( p_access, psz_idx );
        free( psz_idx );
        if ( !psz_tmp )
        {
            free( p_sys );
            return VLC_ENOMEM;
        }
        path_sanitize( psz_tmp );
        p_sys->psz_indexPath = psz_tmp;
        vlc_unlink( p_sys->psz_indexPath );
    }

    p_sys->psz_indexUrl = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "index-url" );

    p_access->p_sys = p_sys;
    p_sys->i_handle = -1;
    p_sys->i_segment = 0;
    p_sys->psz_cursegPath = NULL;

    p_access->pf_write = Write;
    p_access->pf_seek  = Seek;
    p_access->pf_control = Control;

    return VLC_SUCCESS;
}
コード例 #6
0
ファイル: vout_intf.c プロジェクト: MisTelochka/vlc
/**
 * This function will handle a snapshot request
 */
static void VoutSaveSnapshot( vout_thread_t *p_vout )
{
    char *psz_path = var_GetNonEmptyString( p_vout, "snapshot-path" );
    char *psz_format = var_GetNonEmptyString( p_vout, "snapshot-format" );
    char *psz_prefix = var_GetNonEmptyString( p_vout, "snapshot-prefix" );

    /* */
    picture_t *p_picture;
    block_t *p_image;
    video_format_t fmt;

    /* 500ms timeout
     * XXX it will cause trouble with low fps video (< 2fps) */
    if( vout_GetSnapshot( p_vout, &p_image, &p_picture, &fmt, psz_format, 500*1000 ) )
    {
        p_picture = NULL;
        p_image = NULL;
        goto exit;
    }

    if( !psz_path )
    {
        psz_path = VoutSnapshotGetDefaultDirectory();
        if( !psz_path )
        {
            msg_Err( p_vout, "no path specified for snapshots" );
            goto exit;
        }
    }

    char *psz_filename;
    if( VoutWriteSnapshot( p_vout, &psz_filename,
                           p_image,
                           psz_path, psz_format, psz_prefix ) )
        goto exit;

    VoutOsdSnapshot( p_vout, p_picture, psz_filename );

    /* Generate a media player event  - Right now just trigger a global libvlc var
        CHECK: Could not find a more local object. The goal is to communicate
        vout_thread with libvlc_media_player or its input_thread */
    var_SetString( p_vout->p_libvlc, "vout-snapshottaken", psz_filename );
    free( psz_filename );

exit:
    if( p_image )
        block_Release( p_image );
    if( p_picture )
        picture_Release( p_picture );
    free( psz_prefix );
    free( psz_format );
    free( psz_path );
}
コード例 #7
0
static void DeinterlaceAdd(vout_thread_t *vout)
{
    char *filter = var_GetNonEmptyString(vout, "video-filter");

    if (FilterFind(filter, "deinterlace")) {
        free(filter);
        return;
    }

    /* */
    if (filter) {
        char *tmp = filter;
        if (asprintf(&filter, "%s:%s", tmp, "deinterlace") < 0)
            filter = tmp;
        else
            free(tmp);
    } else {
        filter = strdup("deinterlace");
    }

    if (filter) {
        var_SetString(vout, "video-filter", filter);
        free(filter);
    }
}
コード例 #8
0
/*****************************************************************************
* Get the preamp level
*****************************************************************************/
static int vlclua_preamp_get( lua_State *L )
{
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( !p_input )
        return 0;

    audio_output_t *p_aout = input_GetAout( p_input );
    vlc_object_release( p_input );

    if( !p_aout)
        return 0;

    char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
    if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
    {
        free( psz_af );
        vlc_object_release( p_aout );
        return 0;
    }
    free( psz_af );

    lua_pushnumber( L, var_GetFloat( p_aout, "equalizer-preamp") );
    vlc_object_release( p_aout );
    return 1;
}
コード例 #9
0
/*****************************************************************************
* Set the equalizer level for the specified band
*****************************************************************************/
static int vlclua_equalizer_set( lua_State *L )
{
    int bandid = luaL_checknumber( L, 1 );
    if( bandid < 0 || bandid > 9)
        return 0;
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( !p_input )
        return 0;

    audio_output_t *p_aout = input_GetAout( p_input );
    vlc_object_release( p_input );
    if( !p_aout )
        return 0;

    char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
    if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
    {
        free( psz_af );
        vlc_object_release( p_aout );
        return 0;
    }
    free( psz_af );

    float level = luaL_checknumber( L, 2 );
    char *bands = var_GetString( p_aout, "equalizer-bands" );

    locale_t loc = newlocale (LC_NUMERIC_MASK, "C", NULL);
    locale_t oldloc = uselocale (loc);
    char *b = bands;
    while( bandid > 0 )
    {
        float dummy = strtof( b, &b );
        (void)dummy;
        bandid--;
    }
    if( *b != '\0' )
        *b++ = '\0';
    float dummy = strtof( b, &b );
    (void)dummy;

    char *newstr;
    if( asprintf( &newstr, "%s %.1f%s", bands, level, b ) != -1 )
    {
        var_SetString( p_aout, "equalizer-bands", newstr );
        free( newstr );
    }

    if( loc != (locale_t)0 )
    {
        uselocale (oldloc);
        freelocale (loc);
    }
    free( bands );
    vlc_object_release( p_aout );
    return 0;
}
コード例 #10
0
static bool DeinterlaceIsPresent(vout_thread_t *vout)
{
    char *filter = var_GetNonEmptyString(vout, "video-filter");

    bool is_found = FilterFind(filter, "deinterlace") != NULL;

    free(filter);

    return is_found;
}
コード例 #11
0
static int PPQCallback( vlc_object_t *p_this, const char *psz_var,
                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    VLC_UNUSED(psz_var); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
    filter_t *p_filter = (filter_t *)p_this;

    char *psz_name = var_GetNonEmptyString( p_filter, FILTER_PREFIX "name" );
    PPChangeMode( p_filter, psz_name, newval.i_int );
    free( psz_name );
    return VLC_SUCCESS;
}
コード例 #12
0
ファイル: video.c プロジェクト: mahaserver/MHSVLC
char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi,
                                     libvlc_exception_t *p_e )
{
    char *psz_aspect = 0;
    vout_thread_t *p_vout = GetVout( p_mi, p_e );

    if( !p_vout ) return 0;

    psz_aspect = var_GetNonEmptyString( p_vout, "aspect-ratio" );
    vlc_object_release( p_vout );
    return psz_aspect ? psz_aspect : strdup("");
}
コード例 #13
0
ファイル: video.c プロジェクト: mahaserver/MHSVLC
char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
                                   libvlc_exception_t *p_e )
{
    char *psz_geometry = 0;
    vout_thread_t *p_vout = GetVout( p_mi, p_e );

    if( !p_vout ) return 0;

    psz_geometry = var_GetNonEmptyString( p_vout, "crop" );
    vlc_object_release( p_vout );
    return psz_geometry ? psz_geometry : strdup("");
}
コード例 #14
0
static void ReplayGainSelect( aout_instance_t *p_aout, aout_input_t *p_input )
{
    char *psz_replay_gain = var_GetNonEmptyString( p_aout,
                                                   "audio-replay-gain-mode" );
    int i_mode;
    int i_use;
    float f_gain;

    p_input->mixer.multiplier = 1.0;

    if( !psz_replay_gain )
        return;

    /* Find select mode */
    if( !strcmp( psz_replay_gain, "track" ) )
        i_mode = AUDIO_REPLAY_GAIN_TRACK;
    else if( !strcmp( psz_replay_gain, "album" ) )
        i_mode = AUDIO_REPLAY_GAIN_ALBUM;
    else
        i_mode = AUDIO_REPLAY_GAIN_MAX;

    /* If the select mode is not available, prefer the other one */
    i_use = i_mode;
    if( i_use != AUDIO_REPLAY_GAIN_MAX && !p_input->replay_gain.pb_gain[i_use] )
    {
        for( i_use = 0; i_use < AUDIO_REPLAY_GAIN_MAX; i_use++ )
        {
            if( p_input->replay_gain.pb_gain[i_use] )
                break;
        }
    }

    /* */
    if( i_use != AUDIO_REPLAY_GAIN_MAX )
        f_gain = p_input->replay_gain.pf_gain[i_use] + var_GetFloat( p_aout, "audio-replay-gain-preamp" );
    else if( i_mode != AUDIO_REPLAY_GAIN_MAX )
        f_gain = var_GetFloat( p_aout, "audio-replay-gain-default" );
    else
        f_gain = 0.0;
    p_input->mixer.multiplier = pow( 10.0, f_gain / 20.0 );

    /* */
    if( p_input->replay_gain.pb_peak[i_use] &&
        var_GetBool( p_aout, "audio-replay-gain-peak-protection" ) &&
        p_input->replay_gain.pf_peak[i_use] * p_input->mixer.multiplier > 1.0 )
    {
        p_input->mixer.multiplier = 1.0f / p_input->replay_gain.pf_peak[i_use];
    }

    free( psz_replay_gain );
}
コード例 #15
0
ファイル: scene.c プロジェクト: AsamQi/vlc
/*****************************************************************************
 * Create: initialize and set pf_video_filter()
 *****************************************************************************/
static int Create( vlc_object_t *p_this )
{
    filter_t *p_filter = (filter_t *)p_this;
    filter_sys_t *p_sys;

    const vlc_chroma_description_t *p_chroma =
        vlc_fourcc_GetChromaDescription( p_filter->fmt_in.video.i_chroma );
    if( p_chroma == NULL || p_chroma->plane_count == 0 )
        return VLC_EGENERIC;

    config_ChainParse( p_filter, CFG_PREFIX, ppsz_vfilter_options,
                       p_filter->p_cfg );

    p_filter->p_sys = p_sys = calloc( 1, sizeof( filter_sys_t ) );
    if( p_filter->p_sys == NULL )
        return VLC_ENOMEM;

    p_sys->p_image = image_HandlerCreate( p_this );
    if( !p_sys->p_image )
    {
        msg_Err( p_this, "Couldn't get handle to image conversion routines." );
        free( p_sys );
        return VLC_EGENERIC;
    }

    p_sys->psz_format = var_CreateGetString( p_this, CFG_PREFIX "format" );
    p_sys->i_format = image_Type2Fourcc( p_sys->psz_format );
    if( !p_sys->i_format )
    {
        msg_Err( p_filter, "Could not find FOURCC for image type '%s'",
                 p_sys->psz_format );
        image_HandlerDelete( p_sys->p_image );
        free( p_sys->psz_format );
        free( p_sys );
        return VLC_EGENERIC;
    }
    p_sys->i_width = var_CreateGetInteger( p_this, CFG_PREFIX "width" );
    p_sys->i_height = var_CreateGetInteger( p_this, CFG_PREFIX "height" );
    p_sys->i_ratio = var_CreateGetInteger( p_this, CFG_PREFIX "ratio" );
    if( p_sys->i_ratio <= 0)
        p_sys->i_ratio = 1;
    p_sys->b_replace = var_CreateGetBool( p_this, CFG_PREFIX "replace" );
    p_sys->psz_prefix = var_CreateGetString( p_this, CFG_PREFIX "prefix" );
    p_sys->psz_path = var_GetNonEmptyString( p_this, CFG_PREFIX "path" );
    if( p_sys->psz_path == NULL )
        p_sys->psz_path = config_GetUserDir( VLC_PICTURES_DIR );

    p_filter->pf_video_filter = Filter;

    return VLC_SUCCESS;
}
コード例 #16
0
ファイル: mux.c プロジェクト: tguillem/vlc
/*****************************************************************************
 * Mux: multiplex available data in input fifos
 *****************************************************************************/
static int Mux( sout_mux_t *p_mux )
{
    sout_mux_sys_t *p_sys = p_mux->p_sys;

    if( p_sys->b_error ) return VLC_EGENERIC;

    if( p_sys->b_write_header )
    {
        int error;
        msg_Dbg( p_mux, "writing header" );

        char *psz_opts = var_GetNonEmptyString( p_mux, "sout-avformat-options" );
        AVDictionary *options = NULL;
        if (psz_opts) {
            vlc_av_get_options(psz_opts, &options);
            free(psz_opts);
        }
        av_dict_set( &p_sys->oc->metadata, "encoding_tool", "VLC "VERSION, 0 );
        error = avformat_write_header( p_sys->oc, options ? &options : NULL);
        AVDictionaryEntry *t = NULL;
        while ((t = av_dict_get(options, "", t, AV_DICT_IGNORE_SUFFIX))) {
            msg_Err( p_mux, "Unknown option \"%s\"", t->key );
        }
        av_dict_free(&options);
        if( error < 0 )
        {
            msg_Err( p_mux, "could not write header: %s",
                     vlc_strerror_c(AVUNERROR(error)) );
            p_sys->b_write_header = false;
            p_sys->b_error = true;
            return VLC_EGENERIC;
        }

        avio_flush( p_sys->oc->pb );
        p_sys->b_write_header = false;
    }

    for( ;; )
    {
        mtime_t i_dts;

        int i_stream = sout_MuxGetStream( p_mux, 1, &i_dts );
        if( i_stream < 0 )
            return VLC_SUCCESS;

        MuxBlock( p_mux, p_mux->pp_inputs[i_stream] );
    }

    return VLC_SUCCESS;
}
コード例 #17
0
ファイル: vlcproc.cpp プロジェクト: jomanmuk/vlc-2.2
void VlcProc::init_equalizer()
{
    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
    audio_output_t* pAout = playlist_GetAout( pPlaylist );
    if( pAout )
    {
        if( !var_Type( pAout, "equalizer-bands" ) )
            var_Create( pAout, "equalizer-bands",
                        VLC_VAR_STRING | VLC_VAR_DOINHERIT);
        if( !var_Type( pAout, "equalizer-preamp" ) )
            var_Create( pAout, "equalizer-preamp",
                        VLC_VAR_FLOAT | VLC_VAR_DOINHERIT);

        // New Aout (addCallbacks)
        var_AddCallback( pAout, "audio-filter",
                         onGenericCallback, this );
        var_AddCallback( pAout, "equalizer-bands",
                         onEqBandsChange, this );
        var_AddCallback( pAout, "equalizer-preamp",
                         onEqPreampChange, this );
    }

    // is equalizer enabled ?
    char *pFilters = pAout ?
                   var_GetNonEmptyString( pAout, "audio-filter" ) :
                   var_InheritString( getIntf(), "audio-filter" );
    bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
    free( pFilters );
    SET_BOOL( m_cVarEqualizer, b_equalizer );

    // retrieve initial bands
    char* bands = pAout ?
                  var_GetString( pAout, "equalizer-bands" ) :
                  var_InheritString( getIntf(), "equalizer-bands" );
    if( bands )
    {
        m_varEqBands.set( bands );
        free( bands );
    }

    // retrieve initial preamp
    float preamp = pAout ?
                   var_GetFloat( pAout, "equalizer-preamp" ) :
                   var_InheritFloat( getIntf(), "equalizer-preamp" );
    EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)m_cVarEqPreamp.get();
    pVarPreamp->set( (preamp + 20.0) / 40.0 );

    if( pAout )
        vlc_object_release( pAout);
}
コード例 #18
0
ファイル: vlcproc.cpp プロジェクト: RodrigoNieves/vlc
void VlcProc::update_equalizer()
{

    char *pFilters;
    if( m_pAout )
        pFilters = var_GetNonEmptyString( m_pAout, "audio-filter" );
    else
        pFilters = var_InheritString( getIntf(), "audio-filter" );

    bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
    free( pFilters );

    SET_BOOL( m_cVarEqualizer, b_equalizer );
}
コード例 #19
0
void EventThreadUpdateTitle( event_thread_t *p_event, const char *psz_fallback )
{
    char *psz_title = var_GetNonEmptyString( p_event->vd, "video-title" );
    if( !psz_title )
        psz_title = strdup( psz_fallback );
    if( !psz_title )
        return;

    vlc_mutex_lock( &p_event->lock );
    free( p_event->psz_title );
    p_event->psz_title = psz_title;
    vlc_mutex_unlock( &p_event->lock );

    PostMessage( p_event->hwnd, WM_VLC_CHANGE_TEXT, 0, 0 );
}
コード例 #20
0
ファイル: podcast.c プロジェクト: 0xheart0/vlc
/*****************************************************************************
 * Run: main thread
 *****************************************************************************/
VLC_NORETURN
static void *Run( void *data )
{
    services_discovery_t *p_sd = data;
    services_discovery_sys_t *p_sys  = p_sd->p_sys;

    vlc_mutex_lock( &p_sys->lock );
    mutex_cleanup_push( &p_sys->lock );
    for( ;; )
    {
        while( !p_sys->b_update )
            vlc_cond_wait( &p_sys->wait, &p_sys->lock );

        int canc = vlc_savecancel ();
        msg_Dbg( p_sd, "Update required" );

        if( p_sys->update_type == UPDATE_URLS )
        {
            char *psz_urls = var_GetNonEmptyString( p_sd->p_parent,
                                                    "podcast-urls" );
            ParseUrls( p_sd, psz_urls );
            free( psz_urls );
        }
        else if( p_sys->update_type == UPDATE_REQUEST )
            ParseRequest( p_sd );

        p_sys->b_update = false;

        for( int i = 0; i < p_sd->p_sys->i_input; i++ )
        {
            input_thread_t *p_input = p_sd->p_sys->pp_input[i];
            int state = var_GetInteger( p_input, "state" );

            if( state == END_S || state == ERROR_S )
            {
                input_Stop( p_input );
                input_Close( p_input );

                p_sd->p_sys->pp_input[i] = NULL;
                REMOVE_ELEM( p_sys->pp_input, p_sys->i_input, i );
                i--;
            }
        }
        vlc_restorecancel (canc);
    }
    vlc_cleanup_pop();
    vlc_assert_unreachable(); /* dead code */
}
コード例 #21
0
ファイル: podcast.c プロジェクト: iamnpc/myfaplayer
/*****************************************************************************
 * Run: main thread
 *****************************************************************************/
static void *Run( void *data )
{
    services_discovery_t *p_sd = data;
    services_discovery_sys_t *p_sys  = p_sd->p_sys;

    vlc_mutex_lock( &p_sys->lock );
    mutex_cleanup_push( &p_sys->lock );
    for( ;; )
    {
        while( !p_sys->b_update )
            vlc_cond_wait( &p_sys->wait, &p_sys->lock );

        int canc = vlc_savecancel ();
        msg_Dbg( p_sd, "Update required" );

        if( p_sys->update_type == UPDATE_URLS )
        {
          char* psz_urls = var_GetNonEmptyString( p_sd, "podcast-urls" );
          ParseUrls( p_sd, psz_urls );
          free( psz_urls );
        }
        else if( p_sys->update_type == UPDATE_REQUEST )
        {
          ParseRequest( p_sd );
        }

        p_sys->b_update = false;

        for( int i = 0; i < p_sd->p_sys->i_input; i++ )
        {
            input_thread_t *p_input = p_sd->p_sys->pp_input[i];

            if( p_input->b_eof || p_input->b_error )
            {
                input_Stop( p_input, false );
                vlc_thread_join( p_input );
                vlc_object_release( p_input );

                p_sd->p_sys->pp_input[i] = NULL;
                REMOVE_ELEM( p_sys->pp_input, p_sys->i_input, i );
                i--;
            }
        }
        vlc_restorecancel (canc);
    }
    vlc_cleanup_pop();
    assert(0); /* dead code */
}
コード例 #22
0
ファイル: equalizer.c プロジェクト: Flameeyes/vlc
/*****************************************************************************
* Set the equalizer level for the specified band
*****************************************************************************/
static int vlclua_equalizer_set( lua_State *L )
{
    int bandid = luaL_checknumber( L, 1 );
    if( bandid < 0 || bandid > 9)
        return 0;
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( !p_input )
        return 0;

    int i_pos = 0 , j = 0;
    audio_output_t *p_aout = input_GetAout( p_input );
    vlc_object_release( p_input );
    if( !p_aout )
        return 0;

    char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
    if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
    {
        free( psz_af );
        vlc_object_release( p_aout );
        return 0;
    }
    free( psz_af );

    float level = luaL_checknumber( L, 2 );
    char *bands = var_GetString( p_aout, "equalizer-bands" );
    char newstr[7];
    while( j != bandid )
    {
        i_pos++;
        if( bands[i_pos] == '.' )
        {
            i_pos++;
            j++;
        }
    }
    if( bandid != 0 )
        i_pos++;
    snprintf( newstr, sizeof ( newstr ) , "%6.1f", level);
    for( int i = 0 ; i < 6 ; i++ )
        bands[i_pos+i] = newstr[i];
    var_SetString( p_aout, "equalizer-bands", bands );

    vlc_object_release( p_aout );
    return 1;
}
コード例 #23
0
static void DeinterlaceRemove(vout_thread_t *vout)
{
    char *filter = var_GetNonEmptyString(vout, "video-filter");

    char *start = FilterFind(filter, "deinterlace");
    if (!start) {
        free(filter);
        return;
    }

    /* */
    strcpy(&start[0], &start[strlen("deinterlace")]);
    if (*start == ':')
        strcpy(&start[0], &start[1]);

    var_SetString(vout, "video-filter", filter);
    free(filter);
}
コード例 #24
0
void intf_sys_t::msgPlayerLoad()
{
    char *psz_mime = var_GetNonEmptyString(p_stream, SOUT_CFG_PREFIX "mime");
    if (psz_mime == NULL)
        return;

    std::stringstream ss;
    ss << "{\"type\":\"LOAD\","
       <<  "\"media\":{\"contentId\":\"http://" << serverIP << ":"
           << var_InheritInteger(p_stream, SOUT_CFG_PREFIX"http-port")
           << "/stream\","
       <<             "\"streamType\":\"LIVE\","
       <<             "\"contentType\":\"" << std::string(psz_mime) << "\"},"
       <<  "\"requestId\":" << i_requestId++ << "}";

    free(psz_mime);

    buildMessage(NAMESPACE_MEDIA, ss.str(), appTransportId);
}
コード例 #25
0
ファイル: record.c プロジェクト: AsamQi/vlc
/*****************************************************************************
 * Open:
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    sout_stream_t *p_stream = (sout_stream_t*)p_this;
    sout_stream_sys_t *p_sys;

    p_stream->pf_add    = Add;
    p_stream->pf_del    = Del;
    p_stream->pf_send   = Send;

    p_stream->p_sys = p_sys = malloc( sizeof(*p_sys) );
    if( !p_sys )
        return VLC_ENOMEM;

    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options, p_stream->p_cfg );

    p_sys->p_out = NULL;
    p_sys->psz_prefix = var_GetNonEmptyString( p_stream, SOUT_CFG_PREFIX "dst-prefix" );
    if( !p_sys->psz_prefix  )
    {
        p_sys->psz_prefix = strdup( "sout-record-" );
        if( !p_sys->psz_prefix )
        {
            free( p_sys );
            return VLC_ENOMEM;
        }
    }

    p_sys->i_date_start = -1;
    p_sys->i_size = 0;
#ifdef OPTIMIZE_MEMORY
    p_sys->i_max_wait = 5*CLOCK_FREQ; /* 5s */
    p_sys->i_max_size = 1*1024*1024; /* 1 MiB */
#else
    p_sys->i_max_wait = 30*CLOCK_FREQ; /* 30s */
    p_sys->i_max_size = 20*1024*1024; /* 20 MiB */
#endif
    p_sys->b_drop = false;
    p_sys->i_dts_start = 0;
    TAB_INIT( p_sys->i_id, p_sys->id );

    return VLC_SUCCESS;
}
コード例 #26
0
/*****************************************************************************
* Set the preset specified by preset id
*****************************************************************************/
static int vlclua_equalizer_setpreset( lua_State *L )
{
    int presetid = luaL_checknumber( L, 1 );
    if( presetid >= NB_PRESETS || presetid < 0 )
        return 0;
    input_thread_t *p_input = vlclua_get_input_internal( L );
    if( p_input )
    {
        audio_output_t *p_aout = input_GetAout( p_input );
        vlc_object_release( p_input );
        if( !p_aout )
        {
            return 0;
        }
        char *psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
        if( !psz_af || strstr ( psz_af, "equalizer" ) == NULL )
        {
            free( psz_af );
            vlc_object_release( p_aout );
            return 0;
        }
        free( psz_af );
        char *newstr;
        if( asprintf( &newstr , "%6.1f" , eqz_preset_10b[presetid].f_amp[0] ) == -1 )
            return 0;
        for ( int i = 1 ; i < 10 ; i++ )
        {
            if( asprintf( &newstr, "%s%6.1f",newstr ,eqz_preset_10b[presetid].f_amp[i]) == -1 )
                return 0;
        }
        var_SetString( p_aout, "equalizer-bands",newstr );
        var_SetFloat( p_aout, "equalizer-preamp", eqz_preset_10b[presetid].f_preamp );
        var_SetString( p_aout , "equalizer-preset" , preset_list[presetid] );
        vlc_object_release( p_aout );
        free( newstr );
        return 1;
    }
    return 0;
}
コード例 #27
0
char *vlc_sdp_Start (vlc_object_t *obj, const char *cfgpref,
                     const struct sockaddr *src, size_t srclen,
                     const struct sockaddr *addr, size_t addrlen)
{
    size_t cfglen = strlen (cfgpref);
    if (cfglen > 100)
        return NULL;

    char varname[cfglen + sizeof ("description")], *subvar = varname + cfglen;
    strcpy (varname, cfgpref);

    strcpy (subvar, "name");
    char *name = var_GetNonEmptyString (obj, varname);
    strcpy (subvar, "description");
    char *description = var_GetNonEmptyString (obj, varname);
    strcpy (subvar, "url");
    char *url = var_GetNonEmptyString (obj, varname);
    strcpy (subvar, "email");
    char *email = var_GetNonEmptyString (obj, varname);
    strcpy (subvar, "phone");
    char *phone = var_GetNonEmptyString (obj, varname);

    char *sdp = sdp_Start (name, description, url, email, phone,
                           src, srclen, addr, addrlen);
    free (name);
    free (description);
    free (url);
    free (email);
    free (phone);

    if (sdp == NULL)
        return NULL;

    strcpy (subvar, "cat");
    char *cat = var_GetNonEmptyString (obj, varname);
    if (cat != NULL)
    {
        sdp_AddAttribute (&sdp, "cat", "%s", cat);
        /* Totally non-standard */
        sdp_AddAttribute (&sdp, "x-plgroup", "%s", cat);
        free (cat);
    }

    return sdp;
}
コード例 #28
0
ファイル: cast.cpp プロジェクト: Adatan/vlc
static void msgLoad(sout_stream_t *p_stream)
{
    sout_stream_sys_t *p_sys = p_stream->p_sys;

    char *psz_mime = var_GetNonEmptyString(p_stream, SOUT_CFG_PREFIX "mime");
    if (psz_mime == NULL)
        return;

    std::stringstream ss;
    ss << "{\"type\":\"LOAD\","
       <<  "\"media\":{\"contentId\":\"http://" << p_sys->serverIP << ":"
           << var_InheritInteger(p_stream, SOUT_CFG_PREFIX"http-port")
           << "/stream\","
       <<             "\"streamType\":\"LIVE\","
       <<             "\"contentType\":\"" << std::string(psz_mime) << "\"},"
       <<  "\"requestId\":" << p_stream->p_sys->i_requestId++ << "}";

    free(psz_mime);

    castchannel::CastMessage msg = buildMessage("urn:x-cast:com.google.cast.media",
        castchannel::CastMessage_PayloadType_STRING, ss.str(), p_sys->appTransportId);

    p_sys->messagesToSend.push(msg);
}
コード例 #29
0
ファイル: shout.c プロジェクト: CSRedRat/vlc
/*****************************************************************************
 * Open: open the shout connection
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    sout_access_out_t *p_access = (sout_access_out_t*)p_this;
    sout_access_out_sys_t *p_sys;
    shout_t *p_shout;
    long i_ret;
    char *psz_val;

    char *psz_name;
    char *psz_description;
    char *psz_genre;
    char *psz_url;
    vlc_url_t url;

    config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );

    if( !p_access->psz_path )
    {
        msg_Err( p_access,
                 "please specify url=user:password@host:port/mountpoint" );
        return VLC_EGENERIC;
    }

    vlc_UrlParse( &url , p_access->psz_path, 0 );
    if( url.i_port <= 0 )
        url.i_port = 8000;

    p_sys = p_access->p_sys = malloc( sizeof( sout_access_out_sys_t ) );
    if( !p_sys )
    {
        vlc_UrlClean( &url );
        return VLC_ENOMEM;
    }

    psz_name = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "name" );
    psz_description = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "description" );
    psz_genre = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "genre" );
    psz_url = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "url" );

    p_shout = p_sys->p_shout = shout_new();
    if( !p_shout
         || shout_set_host( p_shout, url.psz_host ) != SHOUTERR_SUCCESS
         || shout_set_protocol( p_shout, SHOUT_PROTOCOL_ICY ) != SHOUTERR_SUCCESS
         || shout_set_port( p_shout, url.i_port ) != SHOUTERR_SUCCESS
         || shout_set_password( p_shout, url.psz_password ) != SHOUTERR_SUCCESS
         || shout_set_mount( p_shout, url.psz_path ) != SHOUTERR_SUCCESS
         || shout_set_user( p_shout, url.psz_username ) != SHOUTERR_SUCCESS
         || shout_set_agent( p_shout, "VLC media player " VERSION ) != SHOUTERR_SUCCESS
         || shout_set_name( p_shout, psz_name ) != SHOUTERR_SUCCESS
         || shout_set_description( p_shout, psz_description ) != SHOUTERR_SUCCESS
         || shout_set_genre( p_shout, psz_genre ) != SHOUTERR_SUCCESS
         || shout_set_url( p_shout, psz_url ) != SHOUTERR_SUCCESS
         /* || shout_set_nonblocking( p_shout, 1 ) != SHOUTERR_SUCCESS */
      )
    {
        msg_Err( p_access, "failed to initialize shout streaming to %s:%i/%s",
                 url.psz_host, url.i_port, url.psz_path );

        free( psz_name );
        free( psz_description );
        free( psz_genre );
        free( psz_url );
        goto error;
    }

    free( psz_name );
    free( psz_description );
    free( psz_genre );
    free( psz_url );

    i_ret = shout_set_format( p_shout, var_GetBool( p_access, SOUT_CFG_PREFIX "mp3" ) ?
                                       SHOUT_FORMAT_MP3 : SHOUT_FORMAT_OGG );

    if( i_ret != SHOUTERR_SUCCESS )
    {
        msg_Err( p_access, "failed to set the shoutcast streaming format" );
        goto error;
    }

    /* Don't force bitrate to 0 but only use when specified. This will otherwise
       show an empty field on icecast directory listing instead of NA */
    psz_val = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "bitrate" );
    if( psz_val )
    {
        i_ret = shout_set_audio_info( p_shout, SHOUT_AI_BITRATE, psz_val );
        free( psz_val );
        if( i_ret != SHOUTERR_SUCCESS )
        {
            msg_Err( p_access, "failed to set the information about the bitrate" );
            goto error;
        }
    }
    else
    {
        /* Bitrate information is used for icecast/shoutcast servers directory
           listings (sorting, stream info etc.) */
        msg_Warn( p_access, "no bitrate information specified (required for listing " \
                            "the server as public on the shoutcast website)" );
    }

    /* Information about samplerate, channels and quality will not be propagated
       through the YP protocol for icecast to the public directory listing when
       the icecast server is operating in shoutcast compatibility mode */

    psz_val = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "samplerate" );
    if( psz_val )
    {
        i_ret = shout_set_audio_info( p_shout, SHOUT_AI_SAMPLERATE, psz_val );
        free( psz_val );
        if( i_ret != SHOUTERR_SUCCESS )
        {
            msg_Err( p_access, "failed to set the information about the samplerate" );
            goto error;
        }
    }

    psz_val = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "channels" );
    if( psz_val )
    {
        i_ret = shout_set_audio_info( p_shout, SHOUT_AI_CHANNELS, psz_val );
        free( psz_val );
        if( i_ret != SHOUTERR_SUCCESS )
        {
            msg_Err( p_access, "failed to set the information about the number of channels" );
            goto error;
        }
    }

    psz_val = var_GetNonEmptyString( p_access, SOUT_CFG_PREFIX "quality" );
    if( psz_val )
    {
        i_ret = shout_set_audio_info( p_shout, SHOUT_AI_QUALITY, psz_val );
        free( psz_val );
        if( i_ret != SHOUTERR_SUCCESS )
        {
            msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" );
            goto error;
        }
    }

    if( var_GetBool( p_access, SOUT_CFG_PREFIX "public" ) )
    {
        i_ret = shout_set_public( p_shout, 1 );
        if( i_ret != SHOUTERR_SUCCESS )
        {
            msg_Err( p_access, "failed to set the server status setting to public" );
            goto error;
        }
    }

    /* Connect at startup. Cycle through the possible protocols. */
    i_ret = shout_get_connected( p_shout );
    while ( i_ret != SHOUTERR_CONNECTED )
    {
        /* Shout parameters cannot be changed on an open connection */
        i_ret = shout_close( p_shout );
        if( i_ret == SHOUTERR_SUCCESS )
        {
            i_ret = SHOUTERR_UNCONNECTED;
        }

        /* Re-initialize for Shoutcast using ICY protocol. Not needed for initial connection
           but it is when we are reconnecting after other protocol was tried. */
        i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_ICY );
        if( i_ret != SHOUTERR_SUCCESS )
        {
            msg_Err( p_access, "failed to set the protocol to 'icy'" );
            goto error;
        }
        i_ret = shout_open( p_shout );
        if( i_ret == SHOUTERR_SUCCESS )
        {
            i_ret = SHOUTERR_CONNECTED;
            msg_Dbg( p_access, "connected using 'icy' (shoutcast) protocol" );
        }
        else
        {
            msg_Warn( p_access, "failed to connect using 'icy' (shoutcast) protocol" );

            /* Shout parameters cannot be changed on an open connection */
            i_ret = shout_close( p_shout );
            if( i_ret == SHOUTERR_SUCCESS )
            {
                i_ret = SHOUTERR_UNCONNECTED;
            }

            /* IceCAST using HTTP protocol */
            i_ret = shout_set_protocol( p_shout, SHOUT_PROTOCOL_HTTP );
            if( i_ret != SHOUTERR_SUCCESS )
            {
                msg_Err( p_access, "failed to set the protocol to 'http'" );
                goto error;
            }
            i_ret = shout_open( p_shout );
            if( i_ret == SHOUTERR_SUCCESS )
            {
                i_ret = SHOUTERR_CONNECTED;
                msg_Dbg( p_access, "connected using 'http' (icecast 2.x) protocol" );
            }
            else
                msg_Warn( p_access, "failed to connect using 'http' (icecast 2.x) protocol " );
        }
/*
        for non-blocking, use:
        while( i_ret == SHOUTERR_BUSY )
        {
            sleep( 1 );
            i_ret = shout_get_connected( p_shout );
        }
*/
        if ( i_ret != SHOUTERR_CONNECTED )
    	{
    	    msg_Warn( p_access, "unable to establish connection, retrying..." );
            msleep( 30000000 );
        }
    }

    if( i_ret != SHOUTERR_CONNECTED )
    {
        msg_Err( p_access, "failed to open shout stream to %s:%i/%s: %s",
                 url.psz_host, url.i_port, url.psz_path, shout_get_error(p_shout) );
        goto error;
    }

    p_access->pf_write = Write;
    p_access->pf_seek  = Seek;
    p_access->pf_control = Control;

    msg_Dbg( p_access, "shout access output opened (%s@%s:%i/%s)",
             url.psz_username, url.psz_host, url.i_port, url.psz_path );

    vlc_UrlClean( &url );
    return VLC_SUCCESS;

error:
    if( p_sys->p_shout )
        shout_free( p_sys->p_shout );
    vlc_UrlClean( &url );
    free( p_sys );
    return VLC_EGENERIC;
}
コード例 #30
0
static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, const es_format_t *p_fmt )
{
    sout_stream_sys_t *p_sys = p_stream->p_sys;
    bridge_t *p_bridge;
    bridged_es_t *p_es;
    char *psz_chain;
    int i;

    if( p_sys->b_inited || p_fmt->i_cat != VIDEO_ES )
        return NULL;

    /* Create decoder object */
    p_sys->p_decoder = vlc_object_create( p_stream, sizeof( decoder_t ) );
    if( !p_sys->p_decoder )
        return NULL;
    p_sys->p_decoder->p_module = NULL;
    p_sys->p_decoder->fmt_in = *p_fmt;
    p_sys->p_decoder->b_frame_drop_allowed = true;
    p_sys->p_decoder->fmt_out = p_sys->p_decoder->fmt_in;
    p_sys->p_decoder->fmt_out.i_extra = 0;
    p_sys->p_decoder->fmt_out.p_extra = 0;
    p_sys->p_decoder->pf_decode_video = 0;
    p_sys->p_decoder->pf_vout_format_update = video_update_format_decoder;
    p_sys->p_decoder->pf_vout_buffer_new = video_new_buffer_decoder;
    p_sys->p_decoder->p_owner = malloc( sizeof(decoder_owner_sys_t) );
    if( !p_sys->p_decoder->p_owner )
    {
        vlc_object_release( p_sys->p_decoder );
        return NULL;
    }

    p_sys->p_decoder->p_owner->video = p_fmt->video;
    //p_sys->p_decoder->p_cfg = p_sys->p_video_cfg;

    p_sys->p_decoder->p_module =
        module_need( p_sys->p_decoder, "decoder", "$codec", false );

    if( !p_sys->p_decoder->p_module || !p_sys->p_decoder->pf_decode_video )
    {
        if( p_sys->p_decoder->p_module )
        {
            msg_Err( p_stream, "instanciated a non video decoder" );
            module_unneed( p_sys->p_decoder, p_sys->p_decoder->p_module );
        }
        else
        {
            msg_Err( p_stream, "cannot find decoder" );
        }
        free( p_sys->p_decoder->p_owner );
        vlc_object_release( p_sys->p_decoder );
        return NULL;
    }

    p_sys->b_inited = true;
    vlc_global_lock( VLC_MOSAIC_MUTEX );

    p_bridge = GetBridge( p_stream );
    if ( p_bridge == NULL )
    {
        vlc_object_t *p_libvlc = VLC_OBJECT( p_stream->obj.libvlc );
        vlc_value_t val;

        p_bridge = xmalloc( sizeof( bridge_t ) );

        var_Create( p_libvlc, "mosaic-struct", VLC_VAR_ADDRESS );
        val.p_address = p_bridge;
        var_Set( p_libvlc, "mosaic-struct", val );

        p_bridge->i_es_num = 0;
        p_bridge->pp_es = NULL;
    }

    for ( i = 0; i < p_bridge->i_es_num; i++ )
    {
        if ( p_bridge->pp_es[i]->b_empty )
            break;
    }

    if ( i == p_bridge->i_es_num )
    {
        p_bridge->pp_es = xrealloc( p_bridge->pp_es,
                          (p_bridge->i_es_num + 1) * sizeof(bridged_es_t *) );
        p_bridge->i_es_num++;
        p_bridge->pp_es[i] = xmalloc( sizeof(bridged_es_t) );
    }

    p_sys->p_es = p_es = p_bridge->pp_es[i];

    p_es->i_alpha = var_GetInteger( p_stream, CFG_PREFIX "alpha" );
    p_es->i_x = var_GetInteger( p_stream, CFG_PREFIX "x" );
    p_es->i_y = var_GetInteger( p_stream, CFG_PREFIX "y" );

    //p_es->fmt = *p_fmt;
    p_es->psz_id = p_sys->psz_id;
    p_es->p_picture = NULL;
    p_es->pp_last = &p_es->p_picture;
    p_es->b_empty = false;

    vlc_global_unlock( VLC_MOSAIC_MUTEX );

    if ( p_sys->i_height || p_sys->i_width )
    {
        p_sys->p_image = image_HandlerCreate( p_stream );
    }
    else
    {
        p_sys->p_image = NULL;
    }

    msg_Dbg( p_stream, "mosaic bridge id=%s pos=%d", p_es->psz_id, i );

    /* Create user specified video filters */
    psz_chain = var_GetNonEmptyString( p_stream, CFG_PREFIX "vfilter" );
    msg_Dbg( p_stream, "psz_chain: %s", psz_chain );
    if( psz_chain )
    {
        filter_owner_t owner = {
            .sys = p_sys->p_decoder->p_owner,
            .video = {
                .buffer_new = video_new_buffer_filter,
            },
        };

        p_sys->p_vf2 = filter_chain_NewVideo( p_stream, false, &owner );
        es_format_t fmt;
        es_format_Copy( &fmt, &p_sys->p_decoder->fmt_out );
        if( p_sys->i_chroma )
            fmt.video.i_chroma = p_sys->i_chroma;
        filter_chain_Reset( p_sys->p_vf2, &fmt, &fmt );
        filter_chain_AppendFromString( p_sys->p_vf2, psz_chain );
        free( psz_chain );
    }
    else
    {