1 /*****************************************************************************
2 * stream_output.c : stream output module
3 *****************************************************************************
4 * Copyright (C) 2002-2007 VLC authors and VideoLAN
6 * Authors: Christophe Massiot <massiot@via.ecp.fr>
7 * Laurent Aimar <fenrir@via.ecp.fr>
8 * Eric Petit <titer@videolan.org>
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
35 #include <vlc_common.h>
37 #include <stdlib.h> /* free() */
38 #include <stdio.h> /* sprintf() */
43 #include "stream_output.h"
46 #include <vlc_block.h>
47 #include <vlc_codec.h>
48 #include <vlc_modules.h>
50 #include "input/input_interface.h"
53 /*****************************************************************************
55 *****************************************************************************/
56 static char *sout_stream_url_to_chain( bool, const char * );
70 /* mrl_Parse: parse psz_mrl and fill p_mrl */
71 static int mrl_Parse( mrl_t
*p_mrl
, const char *psz_mrl
);
72 /* mrl_Clean: clean p_mrl after a call to mrl_Parse */
73 static void mrl_Clean( mrl_t
*p_mrl
);
75 #undef sout_NewInstance
77 /*****************************************************************************
78 * sout_NewInstance: creates a new stream output instance
79 *****************************************************************************/
80 sout_instance_t
*sout_NewInstance( vlc_object_t
*p_parent
, const char *psz_dest
)
82 sout_instance_t
*p_sout
;
85 assert( psz_dest
!= NULL
);
87 if( psz_dest
[0] == '#' )
89 psz_chain
= strdup( &psz_dest
[1] );
93 psz_chain
= sout_stream_url_to_chain(
94 var_InheritBool(p_parent
, "sout-display"), psz_dest
);
99 /* *** Allocate descriptor *** */
100 p_sout
= malloc(sizeof (*p_sout
));
107 msg_Dbg(p_parent
, "creating stream output chain `%s'", psz_chain
);
109 /* *** init descriptor *** */
110 p_sout
->psz_sout
= strdup( psz_dest
);
111 p_sout
->b_wants_substreams
= false;
113 p_sout
->p_stream
= NULL
;
115 p_sout
->p_stream
= sout_StreamChainNew(p_parent
, psz_chain
, NULL
);
116 if( p_sout
->p_stream
)
119 sout_StreamControl( p_sout
->p_stream
,
120 SOUT_STREAM_WANTS_SUBSTREAMS
,
121 &p_sout
->b_wants_substreams
);
125 msg_Err(p_parent
, "failed to create stream output chain `%s'", psz_chain
);
128 FREENULL( p_sout
->psz_sout
);
134 /*****************************************************************************
135 * sout_DeleteInstance: delete a previously allocated instance
136 *****************************************************************************/
137 void sout_DeleteInstance( sout_instance_t
* p_sout
)
139 /* remove the stream out chain */
140 sout_StreamChainDelete( p_sout
->p_stream
, NULL
);
142 /* *** free all string *** */
143 FREENULL( p_sout
->psz_sout
);
145 /* *** free structure *** */
149 bool sout_instance_ControlsPace( sout_instance_t
*sout
)
151 return !sout_StreamIsSynchronous(sout
->p_stream
);
154 /*****************************************************************************
156 *****************************************************************************/
158 struct sout_packetizer_input_t
164 sout_packetizer_input_t
*sout_InputNew( sout_instance_t
*p_sout
,
165 const es_format_t
*p_fmt
)
167 sout_packetizer_input_t
*p_input
;
169 /* *** create a packetizer input *** */
170 if( !p_fmt
->i_codec
|| !(p_input
= malloc(sizeof(sout_packetizer_input_t
))) )
173 p_input
->b_flushed
= false;
175 msg_Dbg(p_sout
->p_stream
, "adding an output ES for `%4.4s` (%p)",
176 (char *)&p_fmt
->i_codec
, (void *)p_input
);
178 /* *** add it to the stream chain */
179 p_input
->id
= sout_StreamIdAdd( p_sout
->p_stream
, p_fmt
);
181 if( p_input
->id
== NULL
)
183 msg_Warn(p_sout
->p_stream
, "failed to add output ES (%p)",
192 /*****************************************************************************
194 *****************************************************************************/
195 int sout_InputDelete( sout_instance_t
*p_sout
,
196 sout_packetizer_input_t
*p_input
)
199 msg_Dbg(p_sout
->p_stream
, "removing an output ES (%p)", (void *)p_input
);
201 sout_StreamIdDel( p_sout
->p_stream
, p_input
->id
);
204 return( VLC_SUCCESS
);
207 static int sout_InputControlVa( sout_instance_t
*p_sout
,
208 sout_packetizer_input_t
*p_input
,
209 int i_query
, va_list args
)
211 if( i_query
== SOUT_INPUT_SET_SPU_HIGHLIGHT
)
213 return sout_StreamControl( p_sout
->p_stream
,
214 SOUT_STREAM_ID_SPU_HIGHLIGHT
,
215 p_input
->id
, va_arg(args
, void *) );
220 int sout_InputControl( sout_instance_t
*p_sout
,
221 sout_packetizer_input_t
*p_input
, int i_query
, ... )
226 va_start( args
, i_query
);
227 i_result
= sout_InputControlVa( p_sout
, p_input
, i_query
, args
);
232 void sout_InputFlush( sout_instance_t
*p_sout
,
233 sout_packetizer_input_t
*p_input
)
235 sout_StreamFlush( p_sout
->p_stream
, p_input
->id
);
236 p_input
->b_flushed
= true;
239 /*****************************************************************************
241 *****************************************************************************/
242 int sout_InputSendBuffer( sout_instance_t
*p_sout
,
243 sout_packetizer_input_t
*p_input
,
246 if( p_input
->b_flushed
)
248 p_buffer
->i_flags
|= BLOCK_FLAG_DISCONTINUITY
;
249 p_input
->b_flushed
= false;
251 return sout_StreamIdSend( p_sout
->p_stream
, p_input
->id
, p_buffer
);
254 #undef sout_AccessOutNew
255 /*****************************************************************************
256 * sout_AccessOutNew: allocate a new access out
257 *****************************************************************************/
258 sout_access_out_t
*sout_AccessOutNew( vlc_object_t
*p_sout
,
259 const char *psz_access
, const char *psz_name
)
261 sout_access_out_t
*p_access
;
264 p_access
= vlc_custom_create( p_sout
, sizeof( *p_access
), "access out" );
268 psz_next
= config_ChainCreate( &p_access
->psz_access
, &p_access
->p_cfg
,
271 p_access
->psz_path
= strdup( psz_name
? psz_name
: "" );
272 if( unlikely(p_access
->psz_path
== NULL
) )
274 p_access
->p_sys
= NULL
;
275 p_access
->pf_seek
= NULL
;
276 p_access
->pf_read
= NULL
;
277 p_access
->pf_write
= NULL
;
278 p_access
->pf_control
= NULL
;
279 p_access
->p_module
= NULL
;
282 module_need( p_access
, "sout access", p_access
->psz_access
, true );
284 if( !p_access
->p_module
)
286 free( p_access
->psz_path
);
288 free( p_access
->psz_access
);
289 vlc_object_delete(p_access
);
295 /*****************************************************************************
296 * sout_AccessDelete: delete an access out
297 *****************************************************************************/
298 void sout_AccessOutDelete( sout_access_out_t
*p_access
)
300 if( p_access
->p_module
)
302 module_unneed( p_access
, p_access
->p_module
);
304 free( p_access
->psz_access
);
306 config_ChainDestroy( p_access
->p_cfg
);
308 free( p_access
->psz_path
);
310 vlc_object_delete(p_access
);
313 /*****************************************************************************
315 *****************************************************************************/
316 int sout_AccessOutSeek( sout_access_out_t
*p_access
, off_t i_pos
)
318 if (p_access
->pf_seek
== NULL
)
320 return p_access
->pf_seek( p_access
, i_pos
);
323 /*****************************************************************************
325 *****************************************************************************/
326 ssize_t
sout_AccessOutRead( sout_access_out_t
*p_access
, block_t
*p_buffer
)
328 return( p_access
->pf_read
?
329 p_access
->pf_read( p_access
, p_buffer
) : VLC_EGENERIC
);
332 /*****************************************************************************
334 *****************************************************************************/
335 ssize_t
sout_AccessOutWrite( sout_access_out_t
*p_access
, block_t
*p_buffer
)
337 return p_access
->pf_write( p_access
, p_buffer
);
341 * sout_AccessOutControl
343 int sout_AccessOutControl (sout_access_out_t
*access
, int query
, ...)
348 va_start (ap
, query
);
349 if (access
->pf_control
)
350 ret
= access
->pf_control (access
, query
, ap
);
357 /*****************************************************************************
358 * sout_MuxNew: create a new mux
359 *****************************************************************************/
360 sout_mux_t
*sout_MuxNew( sout_access_out_t
*p_access
, const char *psz_mux
)
365 p_mux
= vlc_custom_create( p_access
, sizeof( *p_mux
), "mux" );
369 psz_next
= config_ChainCreate( &p_mux
->psz_mux
, &p_mux
->p_cfg
, psz_mux
);
372 p_mux
->p_access
= p_access
;
373 p_mux
->pf_control
= NULL
;
374 p_mux
->pf_addstream
= NULL
;
375 p_mux
->pf_delstream
= NULL
;
376 p_mux
->pf_mux
= NULL
;
377 p_mux
->i_nb_inputs
= 0;
378 p_mux
->pp_inputs
= NULL
;
381 p_mux
->p_module
= NULL
;
383 p_mux
->b_add_stream_any_time
= false;
384 p_mux
->b_waiting_stream
= true;
385 p_mux
->i_add_stream_start
= VLC_TICK_INVALID
;
388 module_need( p_mux
, "sout mux", p_mux
->psz_mux
, true );
390 if( p_mux
->p_module
== NULL
)
392 FREENULL( p_mux
->psz_mux
);
394 vlc_object_delete(p_mux
);
398 /* *** probe mux capacity *** */
399 if( p_mux
->pf_control
)
401 int b_answer
= false;
403 if( sout_MuxControl( p_mux
, MUX_CAN_ADD_STREAM_WHILE_MUXING
,
411 msg_Dbg( p_access
, "muxer support adding stream at any time" );
412 p_mux
->b_add_stream_any_time
= true;
413 p_mux
->b_waiting_stream
= true;
420 /*****************************************************************************
422 *****************************************************************************/
423 void sout_MuxDelete( sout_mux_t
*p_mux
)
425 if( p_mux
->p_module
)
427 module_unneed( p_mux
, p_mux
->p_module
);
429 free( p_mux
->psz_mux
);
431 config_ChainDestroy( p_mux
->p_cfg
);
433 vlc_object_delete(p_mux
);
436 /*****************************************************************************
438 *****************************************************************************/
439 sout_input_t
*sout_MuxAddStream( sout_mux_t
*p_mux
, const es_format_t
*p_fmt
)
441 sout_input_t
*p_input
;
443 if( !p_mux
->b_add_stream_any_time
&& !p_mux
->b_waiting_stream
)
445 msg_Err( p_mux
, "cannot add a new stream (unsupported while muxing "
446 "to this format). You can try increasing sout-mux-caching value" );
450 msg_Dbg( p_mux
, "adding a new input" );
452 /* create a new sout input */
453 p_input
= malloc( sizeof( sout_input_t
) );
457 // FIXME: remove either fmt or p_fmt...
458 es_format_Copy( &p_input
->fmt
, p_fmt
);
459 p_input
->p_fmt
= &p_input
->fmt
;
461 p_input
->p_fifo
= block_FifoNew();
462 p_input
->p_sys
= NULL
;
464 TAB_APPEND( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
);
465 if( p_mux
->pf_addstream( p_mux
, p_input
) < 0 )
467 msg_Err( p_mux
, "cannot add this stream" );
468 TAB_REMOVE( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
);
469 block_FifoRelease( p_input
->p_fifo
);
470 es_format_Clean( &p_input
->fmt
);
478 /*****************************************************************************
479 * sout_MuxDeleteStream:
480 *****************************************************************************/
481 void sout_MuxDeleteStream( sout_mux_t
*p_mux
, sout_input_t
*p_input
)
485 if( p_mux
->b_waiting_stream
486 && block_FifoCount( p_input
->p_fifo
) > 0 )
488 /* We stop waiting, and call the muxer for taking care of the data
489 * before we remove this es */
490 p_mux
->b_waiting_stream
= false;
491 p_mux
->pf_mux( p_mux
);
494 TAB_FIND( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
, i_index
);
497 /* remove the entry */
498 TAB_ERASE( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, i_index
);
500 p_mux
->pf_delstream( p_mux
, p_input
);
502 if( p_mux
->i_nb_inputs
== 0 )
504 msg_Warn( p_mux
, "no more input streams for this mux" );
507 block_FifoRelease( p_input
->p_fifo
);
508 es_format_Clean( &p_input
->fmt
);
513 /*****************************************************************************
514 * sout_MuxSendBuffer:
515 *****************************************************************************/
516 int sout_MuxSendBuffer( sout_mux_t
*p_mux
, sout_input_t
*p_input
,
519 vlc_tick_t i_dts
= p_buffer
->i_dts
;
520 block_FifoPut( p_input
->p_fifo
, p_buffer
);
522 if( i_dts
== VLC_TICK_INVALID
)
523 i_dts
= p_buffer
->i_pts
;
525 if( p_mux
->b_waiting_stream
&& i_dts
!= VLC_TICK_INVALID
)
527 const vlc_tick_t i_caching
= VLC_TICK_FROM_MS(var_InheritInteger( p_mux
, "sout-mux-caching" ));
529 if( p_mux
->i_add_stream_start
== VLC_TICK_INVALID
)
530 p_mux
->i_add_stream_start
= i_dts
;
532 /* Wait until we have enough data before muxing */
533 if( llabs( i_dts
- p_mux
->i_add_stream_start
) < i_caching
)
535 p_mux
->b_waiting_stream
= false;
537 return p_mux
->pf_mux( p_mux
);
540 void sout_MuxFlush( sout_mux_t
*p_mux
, sout_input_t
*p_input
)
543 block_FifoEmpty( p_input
->p_fifo
);
546 /*****************************************************************************
547 * sout_MuxGetStream: find stream to be muxed
548 *****************************************************************************/
549 int sout_MuxGetStream( sout_mux_t
*p_mux
, unsigned i_blocks
, vlc_tick_t
*pi_dts
)
551 vlc_tick_t i_dts
= 0;
554 assert( i_blocks
> 0 );
556 for( int i
= 0; i
< p_mux
->i_nb_inputs
; i
++ )
558 sout_input_t
*p_input
= p_mux
->pp_inputs
[i
];
561 if( block_FifoCount( p_input
->p_fifo
) < i_blocks
)
563 if( (!p_mux
->b_add_stream_any_time
) &&
564 (p_input
->p_fmt
->i_cat
!= SPU_ES
) )
568 /* FIXME: SPU muxing */
572 p_data
= block_FifoShow( p_input
->p_fifo
);
573 if( i_stream
< 0 || p_data
->i_dts
< i_dts
)
576 i_dts
= p_data
->i_dts
;
580 if( pi_dts
) *pi_dts
= i_dts
;
586 /*****************************************************************************
588 *****************************************************************************/
589 static int mrl_Parse( mrl_t
*p_mrl
, const char *psz_mrl
)
591 char * psz_dup
= strdup( psz_mrl
);
592 char * psz_parser
= psz_dup
;
593 const char * psz_access
;
594 const char * psz_way
;
597 /* *** first parse psz_dest */
598 while( *psz_parser
&& *psz_parser
!= ':' )
600 if( *psz_parser
== '{' )
602 while( *psz_parser
&& *psz_parser
!= '}' )
616 #if defined( _WIN32 ) || defined( __OS2__ )
617 if( psz_parser
- psz_dup
== 1 )
619 /* msg_Warn( p_sout, "drive letter %c: found in source string",
627 psz_access
= psz_way
= "";
632 *psz_parser
++ = '\0';
634 /* let's skip '//' */
635 if( psz_parser
[0] == '/' && psz_parser
[1] == '/' )
640 psz_name
= psz_parser
;
642 /* Come back to parse the access and mux plug-ins */
643 psz_parser
= psz_dup
;
650 else if( *psz_parser
== '/' )
658 psz_access
= psz_parser
;
660 while( *psz_parser
&& *psz_parser
!= '/' )
662 if( *psz_parser
== '{' )
664 while( *psz_parser
&& *psz_parser
!= '}' )
679 if( *psz_parser
== '/' )
681 *psz_parser
++ = '\0';
692 psz_way
= psz_parser
;
696 p_mrl
->psz_access
= strdup( psz_access
);
697 p_mrl
->psz_way
= strdup( psz_way
);
698 p_mrl
->psz_name
= strdup( psz_name
);
701 return( VLC_SUCCESS
);
705 /* mrl_Clean: clean p_mrl after a call to mrl_Parse */
706 static void mrl_Clean( mrl_t
*p_mrl
)
708 FREENULL( p_mrl
->psz_access
);
709 FREENULL( p_mrl
->psz_way
);
710 FREENULL( p_mrl
->psz_name
);
714 /****************************************************************************
715 ****************************************************************************
719 ****************************************************************************
720 ****************************************************************************/
722 struct sout_stream_private
{
723 sout_stream_t stream
;
728 #define sout_stream_priv(s) \
729 container_of(s, struct sout_stream_private, stream)
731 static void sout_StreamLock(sout_stream_t
*s
)
733 vlc_mutex_lock(&sout_stream_priv(s
)->lock
);
736 static void sout_StreamUnlock(sout_stream_t
*s
)
738 vlc_mutex_unlock(&sout_stream_priv(s
)->lock
);
741 void *sout_StreamIdAdd(sout_stream_t
*s
, const es_format_t
*fmt
)
746 id
= s
->ops
->add(s
, fmt
);
747 sout_StreamUnlock(s
);
751 void sout_StreamIdDel(sout_stream_t
*s
, void *id
)
755 sout_StreamUnlock(s
);
758 int sout_StreamIdSend(sout_stream_t
*s
, void *id
, block_t
*b
)
763 val
= s
->ops
->send(s
, id
, b
);
764 sout_StreamUnlock(s
);
768 void sout_StreamFlush(sout_stream_t
*s
, void *id
)
770 if (s
->ops
->flush
!= NULL
)
773 s
->ops
->flush(s
, id
);
774 sout_StreamUnlock(s
);
778 int sout_StreamControlVa(sout_stream_t
*s
, int i_query
, va_list args
)
780 int val
= VLC_EGENERIC
;
782 if (s
->ops
->control
!= NULL
)
785 val
= s
->ops
->control(s
, i_query
, args
);
786 sout_StreamUnlock(s
);
791 /* Destroy a "stream_out" module */
792 static void sout_StreamDelete( sout_stream_t
*p_stream
)
794 struct sout_stream_private
*priv
= sout_stream_priv(p_stream
);
796 msg_Dbg( p_stream
, "destroying chain... (name=%s)", p_stream
->psz_name
);
798 if (priv
->module
!= NULL
)
799 module_unneed(p_stream
, priv
->module
);
801 FREENULL( p_stream
->psz_name
);
803 config_ChainDestroy( p_stream
->p_cfg
);
805 msg_Dbg( p_stream
, "destroying chain done" );
806 vlc_object_delete(p_stream
);
809 /* Destroy a "stream_out" modules chain
811 * p_first is the first module to be destroyed in the chain
812 * p_last is the last module to be destroyed
813 * if NULL, all modules are destroyed
814 * if not NULL, modules following it must be destroyed separately
816 void sout_StreamChainDelete(sout_stream_t
*p_first
, sout_stream_t
*end
)
818 while (p_first
!= end
)
820 sout_stream_t
*p_next
= p_first
->p_next
;
822 sout_StreamDelete(p_first
);
827 /* Create a "stream_out" module, which may forward its ES to p_next module */
829 * XXX name and p_cfg are used (-> do NOT free them)
831 static sout_stream_t
*sout_StreamNew( vlc_object_t
*parent
, char *psz_name
,
832 config_chain_t
*p_cfg
, sout_stream_t
*p_next
)
834 const char *cap
= (p_next
!= NULL
) ? "sout filter" : "sout output";
835 struct sout_stream_private
*priv
;
836 sout_stream_t
*p_stream
;
840 priv
= vlc_custom_create(parent
, sizeof (*priv
), "stream out");
841 if (unlikely(priv
== NULL
))
844 vlc_mutex_init(&priv
->lock
);
845 p_stream
= &priv
->stream
;
846 p_stream
->psz_name
= psz_name
;
847 p_stream
->p_cfg
= p_cfg
;
848 p_stream
->p_next
= p_next
;
849 p_stream
->ops
= NULL
;
850 p_stream
->p_sys
= NULL
;
852 msg_Dbg( p_stream
, "stream=`%s'", p_stream
->psz_name
);
854 priv
->module
= module_need(p_stream
, cap
, p_stream
->psz_name
, true);
856 if (priv
->module
== NULL
)
858 /* those must be freed by the caller if creation failed */
859 p_stream
->psz_name
= NULL
;
860 p_stream
->p_cfg
= NULL
;
862 sout_StreamDelete( p_stream
);
869 /* Creates a complete "stream_out" modules chain
871 * chain format: module1{option=*:option=*}[:module2{option=*:...}]
873 * The modules are created starting from the last one and linked together
875 * Returns a pointer to the first module.
877 sout_stream_t
*sout_StreamChainNew(vlc_object_t
*parent
, const char *psz_chain
,
880 if(!psz_chain
|| !*psz_chain
)
885 char *psz_parser
= strdup(psz_chain
);
889 vlc_array_t cfg
, name
;
890 vlc_array_init(&cfg
);
891 vlc_array_init(&name
);
896 config_chain_t
*p_cfg
;
898 char *psz_rest_chain
= config_ChainCreate( &psz_name
, &p_cfg
, psz_parser
);
900 psz_parser
= psz_rest_chain
;
902 vlc_array_append_or_abort(&cfg
, p_cfg
);
903 vlc_array_append_or_abort(&name
, psz_name
);
906 /* Instantiate modules from back to front of chain */
907 sout_stream_t
*front
= sink
;
908 size_t i
= vlc_array_count(&name
);
914 prev
= sout_StreamNew(parent
, vlc_array_item_at_index(&name
, i
),
915 vlc_array_item_at_index(&cfg
, i
), front
);
922 vlc_array_clear(&name
);
923 vlc_array_clear(&cfg
);
929 i
++; /* last module couldn't be created */
931 /* Destroy module instances in LIFO order */
932 while (front
!= sink
)
934 sout_stream_t
*next
= front
->p_next
;
936 sout_StreamDelete(front
);
940 /* then destroy all names and config which weren't destroyed by
941 * sout_StreamDelete */
944 free(vlc_array_item_at_index(&name
, i
));
945 config_ChainDestroy(vlc_array_item_at_index(&cfg
, i
));
947 vlc_array_clear(&name
);
948 vlc_array_clear(&cfg
);
953 static char *sout_stream_url_to_chain( bool b_sout_display
,
954 const char *psz_url
)
959 mrl_Parse( &mrl
, psz_url
);
961 /* Check if the URLs goes to #rtp - otherwise we'll use #standard */
962 static const char rtplist
[] = "dccp\0sctp\0tcp\0udplite\0";
963 for (const char *a
= rtplist
; *a
; a
+= strlen (a
) + 1)
964 if (strcmp (a
, mrl
.psz_access
) == 0)
967 if (strcmp (mrl
.psz_access
, "rtp") == 0)
970 /* For historical reasons, rtp:// means RTP over UDP */
971 strcpy (mrl
.psz_access
, "udp");
973 if (mrl
.psz_name
[0] == '[')
975 port
= strstr (mrl
.psz_name
, "]:");
980 port
= strchr (mrl
.psz_name
, ':');
982 *port
++ = '\0'; /* erase ':' */
984 if (asprintf (&psz_chain
,
985 "rtp{mux=\"%s\",proto=\"%s\",dst=\"%s%s%s\"}",
986 mrl
.psz_way
, mrl
.psz_access
, mrl
.psz_name
,
987 port
? "\",port=\"" : "", port
? port
: "") == -1)
992 /* Convert the URL to a basic standard sout chain */
993 if (asprintf (&psz_chain
,
994 "standard{mux=\"%s\",access=\"%s\",dst=\"%s\"}",
995 mrl
.psz_way
, mrl
.psz_access
, mrl
.psz_name
) == -1)
999 /* Duplicate and wrap if sout-display is on */
1000 if (psz_chain
&& b_sout_display
)
1003 if (asprintf (&tmp
, "duplicate{dst=display,dst=%s}", psz_chain
) == -1)
1013 #undef sout_EncoderCreate
1014 encoder_t
*sout_EncoderCreate( vlc_object_t
*p_this
, size_t owner_size
)
1016 assert( owner_size
>= sizeof(encoder_t
) );
1017 return vlc_custom_create( p_this
, owner_size
, "encoder" );