1 /*****************************************************************************
2 * stream_output.c : stream output module
3 *****************************************************************************
4 * Copyright (C) 2002-2007 VLC authors and VideoLAN
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8 * Laurent Aimar <fenrir@via.ecp.fr>
9 * Eric Petit <titer@videolan.org>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this program; if not, write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
36 #include <vlc_common.h>
38 #include <stdlib.h> /* free() */
39 #include <stdio.h> /* sprintf() */
44 #include "stream_output.h"
47 #include <vlc_block.h>
48 #include <vlc_codec.h>
49 #include <vlc_modules.h>
51 #include "input/input_interface.h"
54 /*****************************************************************************
56 *****************************************************************************/
57 static char *sout_stream_url_to_chain( bool, const char * );
71 /* mrl_Parse: parse psz_mrl and fill p_mrl */
72 static int mrl_Parse( mrl_t
*p_mrl
, const char *psz_mrl
);
73 /* mrl_Clean: clean p_mrl after a call to mrl_Parse */
74 static void mrl_Clean( mrl_t
*p_mrl
);
76 #undef sout_NewInstance
78 /*****************************************************************************
79 * sout_NewInstance: creates a new stream output instance
80 *****************************************************************************/
81 sout_instance_t
*sout_NewInstance( vlc_object_t
*p_parent
, const char *psz_dest
)
83 sout_instance_t
*p_sout
;
86 assert( psz_dest
!= NULL
);
88 if( psz_dest
[0] == '#' )
90 psz_chain
= strdup( &psz_dest
[1] );
94 psz_chain
= sout_stream_url_to_chain(
95 var_InheritBool(p_parent
, "sout-display"), psz_dest
);
100 /* *** Allocate descriptor *** */
101 p_sout
= vlc_custom_create( p_parent
, sizeof( *p_sout
), "stream output" );
108 msg_Dbg( p_sout
, "using sout chain=`%s'", psz_chain
);
110 /* *** init descriptor *** */
111 p_sout
->psz_sout
= strdup( psz_dest
);
112 p_sout
->i_out_pace_nocontrol
= 0;
114 vlc_mutex_init( &p_sout
->lock
);
115 p_sout
->p_stream
= NULL
;
117 var_Create( p_sout
, "sout-mux-caching", VLC_VAR_INTEGER
| VLC_VAR_DOINHERIT
);
119 p_sout
->p_stream
= sout_StreamChainNew( p_sout
, psz_chain
, NULL
, NULL
);
120 if( p_sout
->p_stream
)
126 msg_Err( p_sout
, "stream chain failed for `%s'", psz_chain
);
129 FREENULL( p_sout
->psz_sout
);
131 vlc_mutex_destroy( &p_sout
->lock
);
132 vlc_object_release( p_sout
);
136 /*****************************************************************************
137 * sout_DeleteInstance: delete a previously allocated instance
138 *****************************************************************************/
139 void sout_DeleteInstance( sout_instance_t
* p_sout
)
141 /* remove the stream out chain */
142 sout_StreamChainDelete( p_sout
->p_stream
, NULL
);
144 /* *** free all string *** */
145 FREENULL( p_sout
->psz_sout
);
147 vlc_mutex_destroy( &p_sout
->lock
);
149 /* *** free structure *** */
150 vlc_object_release( p_sout
);
153 /*****************************************************************************
155 *****************************************************************************/
156 sout_packetizer_input_t
*sout_InputNew( sout_instance_t
*p_sout
,
157 const es_format_t
*p_fmt
)
159 sout_packetizer_input_t
*p_input
;
161 /* *** create a packetizer input *** */
162 if( !p_fmt
->i_codec
|| !(p_input
= malloc(sizeof(sout_packetizer_input_t
))) )
165 p_input
->p_sout
= p_sout
;
167 msg_Dbg( p_sout
, "adding a new sout input for `%4.4s` (sout_input: %p)",
168 (char*) &p_fmt
->i_codec
, (void *)p_input
);
170 /* *** add it to the stream chain */
171 vlc_mutex_lock( &p_sout
->lock
);
172 p_input
->id
= p_sout
->p_stream
->pf_add( p_sout
->p_stream
, p_fmt
);
173 vlc_mutex_unlock( &p_sout
->lock
);
175 if( p_input
->id
== NULL
)
177 msg_Warn( p_sout
, "new sout input failed (sout_input: %p)",
186 /*****************************************************************************
188 *****************************************************************************/
189 int sout_InputDelete( sout_packetizer_input_t
*p_input
)
191 sout_instance_t
*p_sout
= p_input
->p_sout
;
193 msg_Dbg( p_sout
, "removing a sout input (sout_input: %p)",
196 vlc_mutex_lock( &p_sout
->lock
);
197 p_sout
->p_stream
->pf_del( p_sout
->p_stream
, p_input
->id
);
198 vlc_mutex_unlock( &p_sout
->lock
);
202 return( VLC_SUCCESS
);
205 bool sout_InputIsEmpty( sout_packetizer_input_t
*p_input
)
207 sout_instance_t
*p_sout
= p_input
->p_sout
;
210 vlc_mutex_lock( &p_sout
->lock
);
211 if( sout_StreamControl( p_sout
->p_stream
, SOUT_STREAM_EMPTY
, &b
) != VLC_SUCCESS
)
213 vlc_mutex_unlock( &p_sout
->lock
);
217 void sout_InputFlush( sout_packetizer_input_t
*p_input
)
219 sout_instance_t
*p_sout
= p_input
->p_sout
;
221 vlc_mutex_lock( &p_sout
->lock
);
222 sout_StreamFlush( p_sout
->p_stream
, p_input
->id
);
223 vlc_mutex_unlock( &p_sout
->lock
);
226 /*****************************************************************************
228 *****************************************************************************/
229 int sout_InputSendBuffer( sout_packetizer_input_t
*p_input
,
232 sout_instance_t
*p_sout
= p_input
->p_sout
;
235 vlc_mutex_lock( &p_sout
->lock
);
236 i_ret
= p_sout
->p_stream
->pf_send( p_sout
->p_stream
,
237 p_input
->id
, p_buffer
);
238 vlc_mutex_unlock( &p_sout
->lock
);
243 #undef sout_AccessOutNew
244 /*****************************************************************************
245 * sout_AccessOutNew: allocate a new access out
246 *****************************************************************************/
247 sout_access_out_t
*sout_AccessOutNew( vlc_object_t
*p_sout
,
248 const char *psz_access
, const char *psz_name
)
250 sout_access_out_t
*p_access
;
253 p_access
= vlc_custom_create( p_sout
, sizeof( *p_access
), "access out" );
257 psz_next
= config_ChainCreate( &p_access
->psz_access
, &p_access
->p_cfg
,
260 p_access
->psz_path
= strdup( psz_name
? psz_name
: "" );
261 p_access
->p_sys
= NULL
;
262 p_access
->pf_seek
= NULL
;
263 p_access
->pf_read
= NULL
;
264 p_access
->pf_write
= NULL
;
265 p_access
->pf_control
= NULL
;
266 p_access
->p_module
= NULL
;
269 module_need( p_access
, "sout access", p_access
->psz_access
, true );
271 if( !p_access
->p_module
)
273 free( p_access
->psz_access
);
274 free( p_access
->psz_path
);
275 vlc_object_release( p_access
);
281 /*****************************************************************************
282 * sout_AccessDelete: delete an access out
283 *****************************************************************************/
284 void sout_AccessOutDelete( sout_access_out_t
*p_access
)
286 if( p_access
->p_module
)
288 module_unneed( p_access
, p_access
->p_module
);
290 free( p_access
->psz_access
);
292 config_ChainDestroy( p_access
->p_cfg
);
294 free( p_access
->psz_path
);
296 vlc_object_release( p_access
);
299 /*****************************************************************************
301 *****************************************************************************/
302 int sout_AccessOutSeek( sout_access_out_t
*p_access
, off_t i_pos
)
304 if (p_access
->pf_seek
== NULL
)
306 return p_access
->pf_seek( p_access
, i_pos
);
309 /*****************************************************************************
311 *****************************************************************************/
312 ssize_t
sout_AccessOutRead( sout_access_out_t
*p_access
, block_t
*p_buffer
)
314 return( p_access
->pf_read
?
315 p_access
->pf_read( p_access
, p_buffer
) : VLC_EGENERIC
);
318 /*****************************************************************************
320 *****************************************************************************/
321 ssize_t
sout_AccessOutWrite( sout_access_out_t
*p_access
, block_t
*p_buffer
)
323 return p_access
->pf_write( p_access
, p_buffer
);
327 * sout_AccessOutControl
329 int sout_AccessOutControl (sout_access_out_t
*access
, int query
, ...)
334 va_start (ap
, query
);
335 if (access
->pf_control
)
336 ret
= access
->pf_control (access
, query
, ap
);
343 /*****************************************************************************
344 * sout_MuxNew: create a new mux
345 *****************************************************************************/
346 sout_mux_t
* sout_MuxNew( sout_instance_t
*p_sout
, const char *psz_mux
,
347 sout_access_out_t
*p_access
)
352 p_mux
= vlc_custom_create( p_sout
, sizeof( *p_mux
), "mux" );
356 p_mux
->p_sout
= p_sout
;
357 psz_next
= config_ChainCreate( &p_mux
->psz_mux
, &p_mux
->p_cfg
, psz_mux
);
360 p_mux
->p_access
= p_access
;
361 p_mux
->pf_control
= NULL
;
362 p_mux
->pf_addstream
= NULL
;
363 p_mux
->pf_delstream
= NULL
;
364 p_mux
->pf_mux
= NULL
;
365 p_mux
->i_nb_inputs
= 0;
366 p_mux
->pp_inputs
= NULL
;
369 p_mux
->p_module
= NULL
;
371 p_mux
->b_add_stream_any_time
= false;
372 p_mux
->b_waiting_stream
= true;
373 p_mux
->i_add_stream_start
= -1;
376 module_need( p_mux
, "sout mux", p_mux
->psz_mux
, true );
378 if( p_mux
->p_module
== NULL
)
380 FREENULL( p_mux
->psz_mux
);
382 vlc_object_release( p_mux
);
386 /* *** probe mux capacity *** */
387 if( p_mux
->pf_control
)
389 int b_answer
= false;
391 if( sout_MuxControl( p_mux
, MUX_CAN_ADD_STREAM_WHILE_MUXING
,
399 msg_Dbg( p_sout
, "muxer support adding stream at any time" );
400 p_mux
->b_add_stream_any_time
= true;
401 p_mux
->b_waiting_stream
= false;
403 /* If we control the output pace then it's better to wait before
404 * starting muxing (generates better streams/files). */
405 if( !p_sout
->i_out_pace_nocontrol
)
409 else if( sout_MuxControl( p_mux
, MUX_GET_ADD_STREAM_WAIT
,
417 msg_Dbg( p_sout
, "muxer prefers to wait for all ES before "
419 p_mux
->b_waiting_stream
= true;
427 /*****************************************************************************
429 *****************************************************************************/
430 void sout_MuxDelete( sout_mux_t
*p_mux
)
432 if( p_mux
->p_module
)
434 module_unneed( p_mux
, p_mux
->p_module
);
436 free( p_mux
->psz_mux
);
438 config_ChainDestroy( p_mux
->p_cfg
);
440 vlc_object_release( p_mux
);
443 /*****************************************************************************
445 *****************************************************************************/
446 sout_input_t
*sout_MuxAddStream( sout_mux_t
*p_mux
, const es_format_t
*p_fmt
)
448 sout_input_t
*p_input
;
450 if( !p_mux
->b_add_stream_any_time
&& !p_mux
->b_waiting_stream
)
452 msg_Err( p_mux
, "cannot add a new stream (unsupported while muxing "
453 "to this format). You can try increasing sout-mux-caching value" );
457 msg_Dbg( p_mux
, "adding a new input" );
459 /* create a new sout input */
460 p_input
= malloc( sizeof( sout_input_t
) );
464 // FIXME: remove either fmt or p_fmt...
465 es_format_Copy( &p_input
->fmt
, p_fmt
);
466 p_input
->p_fmt
= &p_input
->fmt
;
468 p_input
->p_fifo
= block_FifoNew();
469 p_input
->p_sys
= NULL
;
471 TAB_APPEND( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
);
472 if( p_mux
->pf_addstream( p_mux
, p_input
) < 0 )
474 msg_Err( p_mux
, "cannot add this stream" );
475 TAB_REMOVE( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
);
476 block_FifoRelease( p_input
->p_fifo
);
477 es_format_Clean( &p_input
->fmt
);
485 /*****************************************************************************
486 * sout_MuxDeleteStream:
487 *****************************************************************************/
488 void sout_MuxDeleteStream( sout_mux_t
*p_mux
, sout_input_t
*p_input
)
492 if( p_mux
->b_waiting_stream
493 && block_FifoCount( p_input
->p_fifo
) > 0 )
495 /* We stop waiting, and call the muxer for taking care of the data
496 * before we remove this es */
497 p_mux
->b_waiting_stream
= false;
498 p_mux
->pf_mux( p_mux
);
501 TAB_FIND( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
, i_index
);
504 p_mux
->pf_delstream( p_mux
, p_input
);
506 /* remove the entry */
507 TAB_REMOVE( p_mux
->i_nb_inputs
, p_mux
->pp_inputs
, p_input
);
509 if( p_mux
->i_nb_inputs
== 0 )
511 msg_Warn( p_mux
, "no more input streams for this mux" );
514 block_FifoRelease( p_input
->p_fifo
);
515 es_format_Clean( &p_input
->fmt
);
520 /*****************************************************************************
521 * sout_MuxSendBuffer:
522 *****************************************************************************/
523 int sout_MuxSendBuffer( sout_mux_t
*p_mux
, sout_input_t
*p_input
,
526 mtime_t i_dts
= p_buffer
->i_dts
;
527 block_FifoPut( p_input
->p_fifo
, p_buffer
);
529 if( p_mux
->p_sout
->i_out_pace_nocontrol
)
531 mtime_t current_date
= mdate();
532 if ( current_date
> i_dts
)
533 msg_Warn( p_mux
, "late buffer for mux input (%"PRId64
")",
534 current_date
- i_dts
);
537 if( p_mux
->b_waiting_stream
)
539 const int64_t i_caching
= var_GetInteger( p_mux
->p_sout
, "sout-mux-caching" ) * INT64_C(1000);
541 if( p_mux
->i_add_stream_start
< 0 )
542 p_mux
->i_add_stream_start
= i_dts
;
544 /* Wait until we have enough data before muxing */
545 if( p_mux
->i_add_stream_start
< 0 ||
546 i_dts
< p_mux
->i_add_stream_start
+ i_caching
)
548 p_mux
->b_waiting_stream
= false;
550 return p_mux
->pf_mux( p_mux
);
553 void sout_MuxFlush( sout_mux_t
*p_mux
, sout_input_t
*p_input
)
556 block_FifoEmpty( p_input
->p_fifo
);
559 /*****************************************************************************
560 * sout_MuxGetStream: find stream to be muxed
561 *****************************************************************************/
562 int sout_MuxGetStream( sout_mux_t
*p_mux
, unsigned i_blocks
, mtime_t
*pi_dts
)
567 assert( i_blocks
> 0 );
569 for( int i
= 0; i
< p_mux
->i_nb_inputs
; i
++ )
571 sout_input_t
*p_input
= p_mux
->pp_inputs
[i
];
574 if( block_FifoCount( p_input
->p_fifo
) < i_blocks
)
576 if( (!p_mux
->b_add_stream_any_time
) &&
577 (p_input
->p_fmt
->i_cat
!= SPU_ES
) )
581 /* FIXME: SPU muxing */
585 p_data
= block_FifoShow( p_input
->p_fifo
);
586 if( i_stream
< 0 || p_data
->i_dts
< i_dts
)
589 i_dts
= p_data
->i_dts
;
593 if( pi_dts
) *pi_dts
= i_dts
;
599 /*****************************************************************************
601 *****************************************************************************/
602 static int mrl_Parse( mrl_t
*p_mrl
, const char *psz_mrl
)
604 char * psz_dup
= strdup( psz_mrl
);
605 char * psz_parser
= psz_dup
;
606 const char * psz_access
;
607 const char * psz_way
;
610 /* *** first parse psz_dest */
611 while( *psz_parser
&& *psz_parser
!= ':' )
613 if( *psz_parser
== '{' )
615 while( *psz_parser
&& *psz_parser
!= '}' )
629 #if defined( _WIN32 ) || defined( __OS2__ )
630 if( psz_parser
- psz_dup
== 1 )
632 /* msg_Warn( p_sout, "drive letter %c: found in source string",
640 psz_access
= psz_way
= "";
645 *psz_parser
++ = '\0';
647 /* let's skip '//' */
648 if( psz_parser
[0] == '/' && psz_parser
[1] == '/' )
653 psz_name
= psz_parser
;
655 /* Come back to parse the access and mux plug-ins */
656 psz_parser
= psz_dup
;
663 else if( *psz_parser
== '/' )
671 psz_access
= psz_parser
;
673 while( *psz_parser
&& *psz_parser
!= '/' )
675 if( *psz_parser
== '{' )
677 while( *psz_parser
&& *psz_parser
!= '}' )
692 if( *psz_parser
== '/' )
694 *psz_parser
++ = '\0';
705 psz_way
= psz_parser
;
709 p_mrl
->psz_access
= strdup( psz_access
);
710 p_mrl
->psz_way
= strdup( psz_way
);
711 p_mrl
->psz_name
= strdup( psz_name
);
714 return( VLC_SUCCESS
);
718 /* mrl_Clean: clean p_mrl after a call to mrl_Parse */
719 static void mrl_Clean( mrl_t
*p_mrl
)
721 FREENULL( p_mrl
->psz_access
);
722 FREENULL( p_mrl
->psz_way
);
723 FREENULL( p_mrl
->psz_name
);
727 /****************************************************************************
728 ****************************************************************************
732 ****************************************************************************
733 ****************************************************************************/
735 /* Destroy a "stream_out" module */
736 static void sout_StreamDelete( sout_stream_t
*p_stream
)
738 sout_instance_t
*p_sout
= (sout_instance_t
*)(p_stream
->obj
.parent
);
740 msg_Dbg( p_stream
, "destroying chain... (name=%s)", p_stream
->psz_name
);
742 p_sout
->i_out_pace_nocontrol
-= p_stream
->pace_nocontrol
;
744 if( p_stream
->p_module
!= NULL
)
745 module_unneed( p_stream
, p_stream
->p_module
);
747 FREENULL( p_stream
->psz_name
);
749 config_ChainDestroy( p_stream
->p_cfg
);
751 msg_Dbg( p_stream
, "destroying chain done" );
752 vlc_object_release( p_stream
);
755 /* Destroy a "stream_out" modules chain
757 * p_first is the first module to be destroyed in the chain
758 * p_last is the last module to be destroyed
759 * if NULL, all modules are destroyed
760 * if not NULL, modules following it must be destroyed separately
762 void sout_StreamChainDelete(sout_stream_t
*p_first
, sout_stream_t
*p_last
)
764 while(p_first
!= NULL
)
766 sout_stream_t
*p_next
= p_first
->p_next
;
768 sout_StreamDelete(p_first
);
769 if(p_first
== p_last
)
775 /* Create a "stream_out" module, which may forward its ES to p_next module */
777 * XXX name and p_cfg are used (-> do NOT free them)
779 static sout_stream_t
*sout_StreamNew( sout_instance_t
*p_sout
, char *psz_name
,
780 config_chain_t
*p_cfg
, sout_stream_t
*p_next
)
782 sout_stream_t
*p_stream
;
786 p_stream
= vlc_custom_create( p_sout
, sizeof( *p_stream
), "stream out" );
790 p_stream
->p_sout
= p_sout
;
791 p_stream
->psz_name
= psz_name
;
792 p_stream
->p_cfg
= p_cfg
;
793 p_stream
->p_next
= p_next
;
794 p_stream
->pf_flush
= NULL
;
795 p_stream
->pf_control
= NULL
;
796 p_stream
->pace_nocontrol
= false;
797 p_stream
->p_sys
= NULL
;
799 msg_Dbg( p_sout
, "stream=`%s'", p_stream
->psz_name
);
802 module_need( p_stream
, "sout stream", p_stream
->psz_name
, true );
804 if( !p_stream
->p_module
)
806 /* those must be freed by the caller if creation failed */
807 p_stream
->psz_name
= NULL
;
808 p_stream
->p_cfg
= NULL
;
810 sout_StreamDelete( p_stream
);
814 p_sout
->i_out_pace_nocontrol
+= p_stream
->pace_nocontrol
;
818 /* Creates a complete "stream_out" modules chain
820 * chain format: module1{option=*:option=*}[:module2{option=*:...}]
822 * The modules are created starting from the last one and linked together
823 * A pointer to the last module created is stored if pp_last isn't NULL, to
824 * make sure sout_StreamChainDelete doesn't delete modules created in another
827 * Returns a pointer to the first module.
829 sout_stream_t
*sout_StreamChainNew(sout_instance_t
*p_sout
, const char *psz_chain
,
830 sout_stream_t
*p_next
, sout_stream_t
**pp_last
)
832 if(!psz_chain
|| !*psz_chain
)
834 if(pp_last
) *pp_last
= NULL
;
838 char *psz_parser
= strdup(psz_chain
);
842 vlc_array_t cfg
, name
;
843 vlc_array_init(&cfg
);
844 vlc_array_init(&name
);
849 config_chain_t
*p_cfg
;
851 char *psz_rest_chain
= config_ChainCreate( &psz_name
, &p_cfg
, psz_parser
);
853 psz_parser
= psz_rest_chain
;
855 vlc_array_append(&cfg
, p_cfg
);
856 vlc_array_append(&name
, psz_name
);
859 size_t i
= vlc_array_count(&name
);
861 vlc_array_init(&module
);
864 p_next
= sout_StreamNew( p_sout
, vlc_array_item_at_index(&name
, i
),
865 vlc_array_item_at_index(&cfg
, i
), p_next
);
870 if(i
== vlc_array_count(&name
) - 1 && pp_last
)
871 *pp_last
= p_next
; /* last module created in the chain */
873 vlc_array_append(&module
, p_next
);
876 vlc_array_clear(&name
);
877 vlc_array_clear(&cfg
);
878 vlc_array_clear(&module
);
884 i
++; /* last module couldn't be created */
886 /* destroy all modules created, starting with the last one */
887 int modules
= vlc_array_count(&module
);
889 sout_StreamDelete(vlc_array_item_at_index(&module
, modules
));
890 vlc_array_clear(&module
);
892 /* then destroy all names and config which weren't destroyed by
893 * sout_StreamDelete */
896 free(vlc_array_item_at_index(&name
, i
));
897 config_ChainDestroy(vlc_array_item_at_index(&cfg
, i
));
899 vlc_array_clear(&name
);
900 vlc_array_clear(&cfg
);
905 static char *sout_stream_url_to_chain( bool b_sout_display
,
906 const char *psz_url
)
911 mrl_Parse( &mrl
, psz_url
);
913 /* Check if the URLs goes to #rtp - otherwise we'll use #standard */
914 static const char rtplist
[] = "dccp\0sctp\0tcp\0udplite\0";
915 for (const char *a
= rtplist
; *a
; a
+= strlen (a
) + 1)
916 if (strcmp (a
, mrl
.psz_access
) == 0)
919 if (strcmp (mrl
.psz_access
, "rtp") == 0)
922 /* For historical reasons, rtp:// means RTP over UDP */
923 strcpy (mrl
.psz_access
, "udp");
925 if (mrl
.psz_name
[0] == '[')
927 port
= strstr (mrl
.psz_name
, "]:");
932 port
= strchr (mrl
.psz_name
, ':');
934 *port
++ = '\0'; /* erase ':' */
936 if (asprintf (&psz_chain
,
937 "rtp{mux=\"%s\",proto=\"%s\",dst=\"%s%s%s\"}",
938 mrl
.psz_way
, mrl
.psz_access
, mrl
.psz_name
,
939 port
? "\",port=\"" : "", port
? port
: "") == -1)
944 /* Convert the URL to a basic standard sout chain */
945 if (asprintf (&psz_chain
,
946 "standard{mux=\"%s\",access=\"%s\",dst=\"%s\"}",
947 mrl
.psz_way
, mrl
.psz_access
, mrl
.psz_name
) == -1)
951 /* Duplicate and wrap if sout-display is on */
952 if (psz_chain
&& b_sout_display
)
955 if (asprintf (&tmp
, "duplicate{dst=display,dst=%s}", psz_chain
) == -1)
965 #undef sout_EncoderCreate
966 encoder_t
*sout_EncoderCreate( vlc_object_t
*p_this
)
968 return vlc_custom_create( p_this
, sizeof( encoder_t
), "encoder" );