standard.c 17 KB
Newer Older
1
/*****************************************************************************
Gildas Bazin's avatar
 
Gildas Bazin committed
2
 * standard.c: standard stream output module
3
 *****************************************************************************
4
 * Copyright (C) 2003-2007 the VideoLAN team
5
 * $Id$
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 *
 * 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
Antoine Cellerier's avatar
Antoine Cellerier committed
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 23 24 25 26
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
27 28 29 30
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

31
#ifndef _WIN32_WINNT
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
32
# define _WIN32_WINNT 0x0500
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
33 34
#endif

35
#include <vlc_common.h>
36
#include <vlc_plugin.h>
Clément Stenac's avatar
Clément Stenac committed
37
#include <vlc_sout.h>
38

Clément Stenac's avatar
Clément Stenac committed
39
#include <vlc_network.h>
40
#include "vlc_url.h"
41 42

/*****************************************************************************
43
 * Module descriptor
44
 *****************************************************************************/
45 46
#define ACCESS_TEXT N_("Output access method")
#define ACCESS_LONGTEXT N_( \
Christophe Mutricy's avatar
Christophe Mutricy committed
47
    "Output method to use for the stream." )
48 49
#define MUX_TEXT N_("Output muxer")
#define MUX_LONGTEXT N_( \
Christophe Mutricy's avatar
Christophe Mutricy committed
50
    "Muxer to use for the stream." )
51 52
#define DEST_TEXT N_("Output destination")
#define DEST_LONGTEXT N_( \
53
    "Destination (URL) to use for the stream. Overrides path and bind parameters" )
54 55 56
#define BIND_TEXT N_("address to bind to (helper setting for dst)")
#define BIND_LONGTEXT N_( \
  "address:port to bind vlc to listening incoming streams "\
57
  "helper setting for dst,dst=bind+'/'+path. dst-parameter overrides this" )
58 59 60
#define PATH_TEXT N_("filename for stream (helper setting for dst)")
#define PATH_LONGTEXT N_( \
  "Filename for stream "\
61
  "helper setting for dst, dst=bind+'/'+path, dst-parameter overrides this" )
62 63
#define NAME_TEXT N_("Session name")
#define NAME_LONGTEXT N_( \
64 65
    "This is the name of the session that will be announced in the SDP " \
    "(Session Descriptor)." )
66

67 68
#define GROUP_TEXT N_("Session groupname")
#define GROUP_LONGTEXT N_( \
69 70
  "This allows you to specify a group for the session, that will be announced "\
  "if you choose to use SAP." )
71

72
#define DESC_TEXT N_("Session description")
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
#define DESC_LONGTEXT N_( \
    "This allows you to give a short description with details about the stream, " \
    "that will be announced in the SDP (Session Descriptor)." )
#define URL_TEXT N_("Session URL")
#define URL_LONGTEXT N_( \
    "This allows you to give an URL with more details about the stream " \
    "(often the website of the streaming organization), that will " \
    "be announced in the SDP (Session Descriptor)." )
#define EMAIL_TEXT N_("Session email")
#define EMAIL_LONGTEXT N_( \
    "This allows you to give a contact mail address for the stream, that will " \
    "be announced in the SDP (Session Descriptor)." )
#define PHONE_TEXT N_("Session phone number")
#define PHONE_LONGTEXT N_( \
    "This allows you to give a contact telephone number for the stream, that will " \
    "be announced in the SDP (Session Descriptor)." )


91
#define SAP_TEXT N_("SAP announcing")
92
#define SAP_LONGTEXT N_("Announce this session with SAP.")
93

94 95 96
static int      Open    ( vlc_object_t * );
static void     Close   ( vlc_object_t * );

97
#define SOUT_CFG_PREFIX "sout-standard-"
98 99

vlc_module_begin();
100 101
    set_shortname( N_("Standard"));
    set_description( N_("Standard stream output") );
102 103 104
    set_capability( "sout stream", 50 );
    add_shortcut( "standard" );
    add_shortcut( "std" );
Clément Stenac's avatar
Clément Stenac committed
105 106
    set_category( CAT_SOUT );
    set_subcategory( SUBCAT_SOUT_STREAM );
107

108
    add_string( SOUT_CFG_PREFIX "access", "", NULL, ACCESS_TEXT,
109
                ACCESS_LONGTEXT, false );
110
    add_string( SOUT_CFG_PREFIX "mux", "", NULL, MUX_TEXT,
111
                MUX_LONGTEXT, false );
112
    add_string( SOUT_CFG_PREFIX "dst", "", NULL, DEST_TEXT,
113
                DEST_LONGTEXT, false );
114
    add_string( SOUT_CFG_PREFIX "bind", "", NULL, BIND_TEXT,
115
                BIND_LONGTEXT, false );
116
    add_string( SOUT_CFG_PREFIX "path", "", NULL, PATH_TEXT,
117
                PATH_LONGTEXT, false );
118

119 120
    add_bool( SOUT_CFG_PREFIX "sap", false, NULL, SAP_TEXT, SAP_LONGTEXT,
              true );
121
    add_string( SOUT_CFG_PREFIX "name", "", NULL, NAME_TEXT, NAME_LONGTEXT,
122
                                        true );
123
    add_string( SOUT_CFG_PREFIX "group", "", NULL, GROUP_TEXT, GROUP_LONGTEXT,
124
                                        true );
125
    add_string( SOUT_CFG_PREFIX "description", "", NULL, DESC_TEXT, DESC_LONGTEXT,
126
                                        true );
127
    add_string( SOUT_CFG_PREFIX "url", "", NULL, URL_TEXT, URL_LONGTEXT,
128
                                        true );
129
    add_string( SOUT_CFG_PREFIX "email", "", NULL, EMAIL_TEXT, EMAIL_LONGTEXT,
130
                                        true );
131
    add_string( SOUT_CFG_PREFIX "phone", "", NULL, PHONE_TEXT, PHONE_LONGTEXT,
132
                                        true );
133
    add_obsolete_bool( SOUT_CFG_PREFIX "sap-ipv6" );
134

135 136 137
    set_callbacks( Open, Close );
vlc_module_end();

138 139 140 141

/*****************************************************************************
 * Exported prototypes
 *****************************************************************************/
142
static const char *const ppsz_sout_options[] = {
143
    "access", "mux", "url", "dst",
144 145
    "sap", "name", "group", "description", "url", "email", "phone",
    "bind", "path", NULL
146 147 148 149 150 151 152 153
};

#define DEFAULT_PORT 1234

static sout_stream_id_t *Add ( sout_stream_t *, es_format_t * );
static int               Del ( sout_stream_t *, sout_stream_id_t * );
static int               Send( sout_stream_t *, sout_stream_id_t *, block_t* );

154 155
struct sout_stream_sys_t
{
156
    sout_mux_t           *p_mux;
157
    session_descriptor_t *p_session;
158 159 160 161 162 163 164 165 166
};

/*****************************************************************************
 * Open:
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
    sout_stream_t       *p_stream = (sout_stream_t*)p_this;
    sout_instance_t     *p_sout = p_stream->p_sout;
167
    sout_stream_sys_t   *p_sys;
168

169 170
    char *psz_mux;
    char *psz_access;
171
    char *psz_url=NULL;
172 173
    char *psz_bind;
    char *psz_path;
Laurent Aimar's avatar
Laurent Aimar committed
174

175 176
    vlc_value_t val;

177
    sout_access_out_t   *p_access;
Laurent Aimar's avatar
Laurent Aimar committed
178
    sout_mux_t          *p_mux;
179

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
180
    const char          *psz_mux_byext = NULL;
181

182
    config_ChainParse( p_stream, SOUT_CFG_PREFIX, ppsz_sout_options,
183
                   p_stream->p_cfg );
184 185 186

    var_Get( p_stream, SOUT_CFG_PREFIX "access", &val );
    psz_access = *val.psz_string ? val.psz_string : NULL;
187
    if( !*val.psz_string ) free( val.psz_string );
188 189 190

    var_Get( p_stream, SOUT_CFG_PREFIX "mux", &val );
    psz_mux = *val.psz_string ? val.psz_string : NULL;
191 192
    if( !*val.psz_string ) free( val.psz_string );

193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
    var_Get( p_stream, SOUT_CFG_PREFIX "bind", &val );
    psz_bind = *val.psz_string ? val.psz_string : NULL;
    if( !*val.psz_string ) free( val.psz_string);

    var_Get( p_stream, SOUT_CFG_PREFIX "path", &val );
    psz_path = *val.psz_string ? val.psz_string : NULL;
    if( !*val.psz_string ) free( val.psz_string);

    if( psz_bind ) psz_url = psz_bind;
    if( psz_url && psz_path ) 
    {
        if( asprintf( &psz_url,"%s/%s",psz_url,psz_path ) == -1 )
            psz_url = NULL;
        free( psz_path );
    }

209
    var_Get( p_stream, SOUT_CFG_PREFIX "dst", &val );
210 211 212 213 214 215 216
    if( *val.psz_string ) 
    {
        free( psz_url);
        psz_url = val.psz_string;
    }
    else
        free( val.psz_string );
217

218
    p_sys = p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) );
219 220 221 222 223
    if( !p_sys )
    {
        free( psz_url );
        return VLC_ENOMEM;
    }
224 225
    p_stream->p_sys->p_session = NULL;

226
    msg_Dbg( p_this, "creating `%s/%s://%s'", psz_access, psz_mux, psz_url );
227

Laurent Aimar's avatar
Laurent Aimar committed
228 229 230
    /* ext -> muxer name */
    if( psz_url && strrchr( psz_url, '.' ) )
    {
231
        /* by extension */
232
        static struct { const char ext[6]; const char mux[32]; } exttomux[] =
Laurent Aimar's avatar
Laurent Aimar committed
233 234 235 236 237 238 239 240 241 242 243
        {
            { "avi", "avi" },
            { "ogg", "ogg" },
            { "ogm", "ogg" },
            { "mp4", "mp4" },
            { "mov", "mov" },
            { "moov","mov" },
            { "asf", "asf" },
            { "wma", "asf" },
            { "wmv", "asf" },
            { "trp", "ts" },
244
            { "ts",  "ts" },
Laurent Aimar's avatar
Laurent Aimar committed
245 246
            { "mpg", "ps" },
            { "mpeg","ps" },
247
            { "ps",  "ps" },
Laurent Aimar's avatar
Laurent Aimar committed
248
            { "mpeg1","mpeg1" },
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
249
            { "wav", "wav" },
250
            { "flv", "ffmpeg{mux=flv}" },
251
            { "mkv", "ffmpeg{mux=matroska}"},
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
252
            { "",    "" }
Laurent Aimar's avatar
Laurent Aimar committed
253
        };
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
254
        const char *psz_ext = strrchr( psz_url, '.' ) + 1;
Laurent Aimar's avatar
Laurent Aimar committed
255 256
        int  i;

257
        msg_Dbg( p_this, "extension is %s", psz_ext );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
258
        for( i = 0; exttomux[i].ext[0]; i++ )
Laurent Aimar's avatar
Laurent Aimar committed
259 260 261 262 263 264 265
        {
            if( !strcasecmp( psz_ext, exttomux[i].ext ) )
            {
                psz_mux_byext = exttomux[i].mux;
                break;
            }
        }
266
        msg_Dbg( p_this, "extension -> mux=%s", psz_mux_byext );
Laurent Aimar's avatar
Laurent Aimar committed
267 268 269 270
    }

    /* We fix access/mux to valid couple */

271
    if( !psz_access && !psz_mux )
Laurent Aimar's avatar
Laurent Aimar committed
272 273 274 275
    {
        if( psz_mux_byext )
        {
            msg_Warn( p_stream,
276
                      "no access _and_ no muxer, extension gives file/%s",
Laurent Aimar's avatar
Laurent Aimar committed
277
                      psz_mux_byext );
278 279
            psz_access = strdup("file");
            psz_mux    = strdup(psz_mux_byext);
Laurent Aimar's avatar
Laurent Aimar committed
280 281 282 283
        }
        else
        {
            msg_Err( p_stream, "no access _and_ no muxer (fatal error)" );
284
            free( psz_url );
Rémi Duraffort's avatar
Rémi Duraffort committed
285
            free( p_sys );
Laurent Aimar's avatar
Laurent Aimar committed
286 287 288 289
            return VLC_EGENERIC;
        }
    }

290
    if( psz_access && !psz_mux )
Laurent Aimar's avatar
Laurent Aimar committed
291 292
    {
        /* access given, no mux */
293
        if( !strncmp( psz_access, "mmsh", 4 ) )
Laurent Aimar's avatar
Laurent Aimar committed
294
        {
295
            psz_mux = strdup("asfh");
Laurent Aimar's avatar
Laurent Aimar committed
296
        }
297
        else if (!strcmp (psz_access, "udp"))
Laurent Aimar's avatar
Laurent Aimar committed
298
        {
299
            psz_mux = strdup("ts");
Laurent Aimar's avatar
Laurent Aimar committed
300
        }
301
        else if( psz_mux_byext )
Laurent Aimar's avatar
Laurent Aimar committed
302
        {
303
            psz_mux = strdup(psz_mux_byext);
Laurent Aimar's avatar
Laurent Aimar committed
304
        }
305 306
        else
        {
307
            msg_Err( p_stream, "no mux specified or found by extension" );
Rémi Duraffort's avatar
Rémi Duraffort committed
308
            free( p_sys );
309 310
            return VLC_EGENERIC;
        }
Laurent Aimar's avatar
Laurent Aimar committed
311
    }
312
    else if( psz_mux && !psz_access )
Laurent Aimar's avatar
Laurent Aimar committed
313 314
    {
        /* mux given, no access */
315
        if( !strncmp( psz_mux, "asfh", 4 ) )
Laurent Aimar's avatar
Laurent Aimar committed
316
        {
317
            psz_access = strdup("mmsh");
Laurent Aimar's avatar
Laurent Aimar committed
318 319 320 321
        }
        else
        {
            /* default file */
322
            psz_access = strdup("file");
Laurent Aimar's avatar
Laurent Aimar committed
323 324 325
        }
    }

Derk-Jan Hartman's avatar
Derk-Jan Hartman committed
326
    /* fix or warn of incompatible couple */
327 328
    if( !strncmp( psz_access, "mmsh", 4 ) &&
        strncmp( psz_mux, "asfh", 4 ) )
Laurent Aimar's avatar
Laurent Aimar committed
329
    {
330
        char *p = strchr( psz_mux,'{' );
331

332 333
        msg_Warn( p_stream, "fixing to mmsh/asfh" );
        if( p )
Laurent Aimar's avatar
Laurent Aimar committed
334
        {
335 336 337 338
            if( asprintf( &p, "asfh%s", p ) == -1 )
                p = NULL;
            free( psz_mux );
            psz_mux = p;
Laurent Aimar's avatar
Laurent Aimar committed
339
        }
340
        else
Laurent Aimar's avatar
Laurent Aimar committed
341
        {
342 343
            free( psz_mux );
            psz_mux = strdup("asfh");
Laurent Aimar's avatar
Laurent Aimar committed
344 345
        }
    }
346
    else if( !strncmp( psz_access, "udp", 3 ) )
347
    {
348 349 350 351
        if( !strncmp( psz_mux, "ffmpeg", 6 ) )
        {   /* why would you use ffmpeg's ts muxer ? YOU DON'T LOVE VLC ??? */
            char *psz_ffmpeg_mux = var_CreateGetString( p_this, "ffmpeg-mux" );
            if( !psz_ffmpeg_mux || strncmp( psz_ffmpeg_mux, "mpegts", 6 ) )
352
                msg_Err( p_stream, "UDP is only valid with TS" );
353 354 355 356
            free( psz_ffmpeg_mux );
        }
        else if( strncmp( psz_mux, "ts", 2 ) )
        {
357
            msg_Err( p_stream, "UDP is only valid with TS" );
358
        }
359 360 361 362 363 364 365
    }
    else if( strncmp( psz_access, "file", 4 ) &&
             ( !strncmp( psz_mux, "mov", 3 ) ||
               !strncmp( psz_mux, "mp4", 3 ) ) )
    {
        msg_Err( p_stream, "mov and mp4 work only with file output" );
    }
Laurent Aimar's avatar
Laurent Aimar committed
366 367 368

    msg_Dbg( p_this, "using `%s/%s://%s'", psz_access, psz_mux, psz_url );

369 370 371 372 373 374
    /* *** find and open appropriate access module *** */
    p_access = sout_AccessOutNew( p_sout, psz_access, psz_url );
    if( p_access == NULL )
    {
        msg_Err( p_stream, "no suitable sout access module for `%s/%s://%s'",
                 psz_access, psz_mux, psz_url );
375 376
        free( psz_access );
        free( psz_mux );
377
        free( psz_url );
Rémi Duraffort's avatar
Rémi Duraffort committed
378
        free( p_sys );
379
        return VLC_EGENERIC;
380 381 382 383 384 385 386 387 388 389 390
    }
    msg_Dbg( p_stream, "access opened" );

    /* *** find and open appropriate mux module *** */
    p_mux = sout_MuxNew( p_sout, psz_mux, p_access );
    if( p_mux == NULL )
    {
        msg_Err( p_stream, "no suitable sout mux module for `%s/%s://%s'",
                 psz_access, psz_mux, psz_url );

        sout_AccessOutDelete( p_access );
391 392
        free( psz_access );
        free( psz_mux );
393
        free( psz_url );
Rémi Duraffort's avatar
Rémi Duraffort committed
394
        free( p_sys );
395
        return VLC_EGENERIC;
396 397 398
    }
    msg_Dbg( p_stream, "mux opened" );

399
    /* *** Create the SAP Session structure *** */
400
    if( var_GetBool( p_stream, SOUT_CFG_PREFIX"sap" ) )
401
    {
402
        /* Create the SDP */
403 404 405 406
        static const struct addrinfo hints = {
            .ai_family = AF_UNSPEC,
            .ai_socktype = SOCK_DGRAM,
            .ai_protocol = 0,
407
            .ai_flags = AI_NUMERICHOST | AI_NUMERICSERV
408
        };
409 410 411 412 413 414 415
        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;
416

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
417
        if ( vlc_getaddrinfo ( VLC_OBJECT(p_stream), dhost, dport, &hints, &res) == 0)
418 419
        {
            memcpy (&dst, res->ai_addr, dstlen = res->ai_addrlen);
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
420
            vlc_freeaddrinfo (res);
421
        }
422

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
423
        if (vlc_getaddrinfo ( VLC_OBJECT(p_stream), shost, sport, &hints, &res) == 0)
424 425
        {
            memcpy (&src, res->ai_addr, srclen = res->ai_addrlen);
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
426
            vlc_freeaddrinfo (res);
427
        }
428

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

434 435
        char *psz_sdp = NULL;
        if (head != NULL)
436
        {
437 438 439 440
            if (asprintf (&psz_sdp, "%s"
                          "m=video %d udp mpeg\r\n", head, dport) == -1)
                psz_sdp = NULL;
            free (head);
441 442
        }

443 444 445 446 447 448 449
        /* Register the SDP with the SAP thread */
        if (psz_sdp != NULL)
        {
            announce_method_t *p_method = sout_SAPMethod ();
            msg_Dbg (p_stream, "Generated SDP:\n%s", psz_sdp);

            p_sys->p_session =
450
                sout_AnnounceRegisterSDP (p_sout, psz_sdp, dhost, p_method);
451
            sout_MethodRelease (p_method);
Rafaël Carré's avatar
Rafaël Carré committed
452
            free( psz_sdp );
453 454
        }
        free (dhost);
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
455
    }
456

457 458 459 460
    p_stream->pf_add    = Add;
    p_stream->pf_del    = Del;
    p_stream->pf_send   = Send;

461
    p_sys->p_mux = p_mux;
Gildas Bazin's avatar
 
Gildas Bazin committed
462

463 464 465
    free( psz_access );
    free( psz_mux );
    free( psz_url );
Clément Stenac's avatar
Clément Stenac committed
466

467 468 469
    if( !sout_AccessOutCanControlPace( p_access ) )
        p_sout->i_out_pace_nocontrol++;

470 471 472 473 474 475 476 477 478
    return VLC_SUCCESS;
}

/*****************************************************************************
 * Close:
 *****************************************************************************/
static void Close( vlc_object_t * p_this )
{
    sout_stream_t     *p_stream = (sout_stream_t*)p_this;
479
    sout_stream_sys_t *p_sys    = p_stream->p_sys;
480 481
    sout_access_out_t *p_access = p_sys->p_mux->p_access;

482 483
    if( p_sys->p_session != NULL )
        sout_AnnounceUnRegister( p_stream->p_sout, p_sys->p_session );
484 485

    sout_MuxDelete( p_sys->p_mux );
486 487
    if( !sout_AccessOutCanControlPace( p_access ) )
        p_stream->p_sout->i_out_pace_nocontrol--;
488 489 490 491 492 493 494 495 496 497 498
    sout_AccessOutDelete( p_access );

    free( p_sys );
}

struct sout_stream_id_t
{
    sout_input_t *p_input;
};


499
static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
500 501 502 503 504
{
    sout_stream_sys_t *p_sys = p_stream->p_sys;
    sout_stream_id_t  *id;

    id = malloc( sizeof( sout_stream_id_t ) );
Rémi Duraffort's avatar
Rémi Duraffort committed
505 506 507
    if( !id )
        return NULL;

508 509 510 511 512 513 514 515 516
    if( ( id->p_input = sout_MuxAddStream( p_sys->p_mux, p_fmt ) ) == NULL )
    {
        free( id );
        return NULL;
    }

    return id;
}

517
static int Del( sout_stream_t *p_stream, sout_stream_id_t *id )
518 519 520 521 522 523 524 525 526 527
{
    sout_stream_sys_t *p_sys = p_stream->p_sys;

    sout_MuxDeleteStream( p_sys->p_mux, id->p_input );

    free( id );

    return VLC_SUCCESS;
}

528
static int Send( sout_stream_t *p_stream, sout_stream_id_t *id,
529
                 block_t *p_buffer )
530 531 532 533 534 535 536
{
    sout_stream_sys_t *p_sys = p_stream->p_sys;

    sout_MuxSendBuffer( p_sys->p_mux, id->p_input, p_buffer );

    return VLC_SUCCESS;
}