A little more detail regarding using my github copies of the code with where it's...
[vlc/adversarial.git] / modules / stream_out / bridge.c
blobc63e94f4c9c263f7e81a4f6ac88791d25307286f
1 /*****************************************************************************
2 * bridge.c: bridge stream output module
3 *****************************************************************************
4 * Copyright (C) 2005-2008 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8 * Antoine Cellerier <dionoea at videolan dot 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 /*****************************************************************************
26 * Preamble
27 *****************************************************************************/
29 #ifdef HAVE_CONFIG_H
30 # include "config.h"
31 #endif
33 #include <vlc_common.h>
34 #include <vlc_plugin.h>
35 #include <vlc_sout.h>
36 #include <vlc_block.h>
38 /*****************************************************************************
39 * Module descriptor
40 *****************************************************************************/
41 #define ID_TEXT N_("ID")
42 #define ID_LONGTEXT N_( \
43 "Integer identifier for this elementary stream. This will be used to " \
44 "\"find\" this stream later." )
46 #define DEST_TEXT N_( "Destination bridge-in name" )
47 #define DEST_LONGTEXT N_( \
48 "Name of the destination bridge-in. If you do not need more " \
49 "than one bridge-in at a time, you can discard this option." )
51 #define DELAY_TEXT N_("Delay")
52 #define DELAY_LONGTEXT N_("Pictures coming from the picture video outputs " \
53 "will be delayed according to this value (in milliseconds, should be "\
54 ">= 100 ms). For high values, you will need to raise caching values." )
56 #define ID_OFFSET_TEXT N_("ID Offset")
57 #define ID_OFFSET_LONGTEXT N_("Offset to add to the stream IDs specified in " \
58 "bridge_out to obtain the stream IDs bridge_in will register.")
60 #define NAME_TEXT N_( "Name of current instance" )
61 #define NAME_LONGTEXT N_( \
62 "Name of this bridge-in instance. If you do not need more " \
63 "than one bridge-in at a time, you can discard this option." )
65 #define PLACEHOLDER_TEXT N_( "Fallback to placeholder stream when out of data" )
66 #define PLACEHOLDER_LONGTEXT N_( \
67 "If set to true, the bridge will discard all input elementary streams " \
68 "except if it doesn't receive data from another bridge-in. This can " \
69 "be used to configure a place holder stream when the real source " \
70 "breaks. Source and placeholder streams should have the same format. " )
72 #define PLACEHOLDER_DELAY_TEXT N_( "Placeholder delay" )
73 #define PLACEHOLDER_DELAY_LONGTEXT N_( \
74 "Delay (in ms) before the placeholder kicks in." )
76 #define PLACEHOLDER_IFRAME_TEXT N_( "Wait for I frame before toggling placeholder" )
77 #define PLACEHOLDER_IFRAME_LONGTEXT N_( \
78 "If enabled, switching between the placeholder and the normal stream " \
79 "will only occur on I frames. This will remove artifacts on stream " \
80 "switching at the expense of a slightly longer delay, depending on " \
81 "the frequence of I frames in the streams." )
83 static int OpenOut ( vlc_object_t * );
84 static void CloseOut( vlc_object_t * );
85 static int OpenIn ( vlc_object_t * );
86 static void CloseIn ( vlc_object_t * );
88 #define SOUT_CFG_PREFIX_OUT "sout-bridge-out-"
89 #define SOUT_CFG_PREFIX_IN "sout-bridge-in-"
91 vlc_module_begin ()
92 set_shortname( N_("Bridge"))
93 set_description( N_("Bridge stream output"))
94 add_submodule ()
95 set_section( N_("Bridge out"), NULL )
96 set_capability( "sout stream", 50 )
97 add_shortcut( "bridge-out" )
98 /* Only usable with VLM. No category so not in gui preferences
99 set_category( CAT_SOUT )
100 set_subcategory( SUBCAT_SOUT_STREAM )*/
101 add_integer( SOUT_CFG_PREFIX_OUT "id", 0, ID_TEXT, ID_LONGTEXT,
102 false )
103 add_string( SOUT_CFG_PREFIX_OUT "in-name", "default",
104 DEST_TEXT, DEST_LONGTEXT, false )
105 set_callbacks( OpenOut, CloseOut )
107 add_submodule ()
108 set_section( N_("Bridge in"), NULL )
109 set_capability( "sout stream", 50 )
110 add_shortcut( "bridge-in" )
111 /*set_category( CAT_SOUT )
112 set_subcategory( SUBCAT_SOUT_STREAM )*/
113 add_integer( SOUT_CFG_PREFIX_IN "delay", 0, DELAY_TEXT,
114 DELAY_LONGTEXT, false )
115 add_integer( SOUT_CFG_PREFIX_IN "id-offset", 8192, ID_OFFSET_TEXT,
116 ID_OFFSET_LONGTEXT, false )
117 add_string( SOUT_CFG_PREFIX_IN "name", "default",
118 NAME_TEXT, NAME_LONGTEXT, false )
119 add_bool( SOUT_CFG_PREFIX_IN "placeholder", false,
120 PLACEHOLDER_TEXT, PLACEHOLDER_LONGTEXT, false )
121 add_integer( SOUT_CFG_PREFIX_IN "placeholder-delay", 200,
122 PLACEHOLDER_DELAY_TEXT, PLACEHOLDER_DELAY_LONGTEXT, false )
123 add_bool( SOUT_CFG_PREFIX_IN "placeholder-switch-on-iframe", true,
124 PLACEHOLDER_IFRAME_TEXT, PLACEHOLDER_IFRAME_LONGTEXT, false )
125 set_callbacks( OpenIn, CloseIn )
127 vlc_module_end ()
130 /*****************************************************************************
131 * Local prototypes
132 *****************************************************************************/
133 static const char *const ppsz_sout_options_out[] = {
134 "id", "in-name", NULL
137 static const char *const ppsz_sout_options_in[] = {
138 "delay", "id-offset", "name",
139 "placeholder", "placeholder-delay", "placeholder-switch-on-iframe",
140 NULL
143 static sout_stream_id_sys_t *AddOut ( sout_stream_t *, es_format_t * );
144 static int DelOut ( sout_stream_t *, sout_stream_id_sys_t * );
145 static int SendOut( sout_stream_t *, sout_stream_id_sys_t *, block_t * );
147 static sout_stream_id_sys_t *AddIn ( sout_stream_t *, es_format_t * );
148 static int DelIn ( sout_stream_t *, sout_stream_id_sys_t * );
149 static int SendIn( sout_stream_t *, sout_stream_id_sys_t *, block_t * );
151 typedef struct bridged_es_t
153 es_format_t fmt;
154 block_t *p_block;
155 block_t **pp_last;
156 bool b_empty;
158 /* bridge in part */
159 sout_stream_id_sys_t *id;
160 mtime_t i_last;
161 bool b_changed;
162 } bridged_es_t;
164 typedef struct bridge_t
166 bridged_es_t **pp_es;
167 int i_es_num;
168 } bridge_t;
170 static vlc_mutex_t lock = VLC_STATIC_MUTEX;
173 * Bridge out
176 typedef struct out_sout_stream_sys_t
178 bridged_es_t *p_es;
179 int i_id;
180 bool b_inited;
182 char *psz_name;
183 } out_sout_stream_sys_t;
185 /*****************************************************************************
186 * OpenOut:
187 *****************************************************************************/
188 static int OpenOut( vlc_object_t *p_this )
190 sout_stream_t *p_stream = (sout_stream_t *)p_this;
191 out_sout_stream_sys_t *p_sys;
192 vlc_value_t val;
194 config_ChainParse( p_stream, SOUT_CFG_PREFIX_OUT, ppsz_sout_options_out,
195 p_stream->p_cfg );
197 p_sys = malloc( sizeof( out_sout_stream_sys_t ) );
198 if( unlikely( !p_sys ) )
199 return VLC_ENOMEM;
200 p_sys->b_inited = false;
202 var_Get( p_stream, SOUT_CFG_PREFIX_OUT "id", &val );
203 p_sys->i_id = val.i_int;
205 var_Get( p_stream, SOUT_CFG_PREFIX_OUT "in-name", &val );
206 if( asprintf( &p_sys->psz_name, "bridge-struct-%s", val.psz_string )<0 )
208 free( val.psz_string );
209 free( p_sys );
210 return VLC_ENOMEM;
212 free( val.psz_string );
214 p_stream->pf_add = AddOut;
215 p_stream->pf_del = DelOut;
216 p_stream->pf_send = SendOut;
218 p_stream->p_sys = (sout_stream_sys_t *)p_sys;
219 p_stream->pace_nocontrol = true;
221 return VLC_SUCCESS;
224 /*****************************************************************************
225 * CloseOut:
226 *****************************************************************************/
227 static void CloseOut( vlc_object_t * p_this )
229 sout_stream_t *p_stream = (sout_stream_t*)p_this;
230 out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
232 free( p_sys->psz_name );
233 free( p_sys );
236 static sout_stream_id_sys_t * AddOut( sout_stream_t *p_stream, es_format_t *p_fmt )
238 out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
239 bridge_t *p_bridge;
240 bridged_es_t *p_es;
241 int i;
243 if ( p_sys->b_inited )
245 msg_Err( p_stream, "bridge-out can only handle 1 es at a time." );
246 return NULL;
248 p_sys->b_inited = true;
250 vlc_mutex_lock( &lock );
252 p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name );
253 if ( p_bridge == NULL )
255 p_bridge = xmalloc( sizeof( bridge_t ) );
257 var_Create( p_stream->p_libvlc, p_sys->psz_name, VLC_VAR_ADDRESS );
258 var_SetAddress( p_stream->p_libvlc, p_sys->psz_name, p_bridge );
260 p_bridge->i_es_num = 0;
261 p_bridge->pp_es = NULL;
264 for ( i = 0; i < p_bridge->i_es_num; i++ )
266 if ( p_bridge->pp_es[i]->b_empty && !p_bridge->pp_es[i]->b_changed )
267 break;
270 if ( i == p_bridge->i_es_num )
272 p_bridge->pp_es = xrealloc( p_bridge->pp_es,
273 (p_bridge->i_es_num + 1) * sizeof(bridged_es_t *) );
274 p_bridge->i_es_num++;
275 p_bridge->pp_es[i] = xmalloc( sizeof(bridged_es_t) );
278 p_sys->p_es = p_es = p_bridge->pp_es[i];
280 p_es->fmt = *p_fmt;
281 p_es->fmt.i_id = p_sys->i_id;
282 p_es->p_block = NULL;
283 p_es->pp_last = &p_es->p_block;
284 p_es->b_empty = false;
286 p_es->id = NULL;
287 p_es->i_last = VLC_TS_INVALID;
288 p_es->b_changed = true;
290 msg_Dbg( p_stream, "bridging out input codec=%4.4s id=%d pos=%d",
291 (char*)&p_es->fmt.i_codec, p_es->fmt.i_id, i );
293 vlc_mutex_unlock( &lock );
295 return (sout_stream_id_sys_t *)p_sys;
298 static int DelOut( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
300 VLC_UNUSED(id);
301 out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
302 bridged_es_t *p_es;
304 if ( !p_sys->b_inited )
306 return VLC_SUCCESS;
309 vlc_mutex_lock( &lock );
311 p_es = p_sys->p_es;
313 p_es->b_empty = true;
314 block_ChainRelease( p_es->p_block );
315 p_es->p_block = false;
317 p_es->b_changed = true;
318 vlc_mutex_unlock( &lock );
320 p_sys->b_inited = false;
322 return VLC_SUCCESS;
325 static int SendOut( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
326 block_t *p_buffer )
328 out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
329 bridged_es_t *p_es;
331 if ( (out_sout_stream_sys_t *)id != p_sys )
333 block_ChainRelease( p_buffer );
334 return VLC_SUCCESS;
337 vlc_mutex_lock( &lock );
339 p_es = p_sys->p_es;
340 *p_es->pp_last = p_buffer;
341 while ( p_buffer != NULL )
343 p_es->pp_last = &p_buffer->p_next;
344 p_buffer = p_buffer->p_next;
347 vlc_mutex_unlock( &lock );
349 return VLC_SUCCESS;
354 * Bridge in
357 typedef struct in_sout_stream_sys_t
359 int i_id_offset;
360 mtime_t i_delay;
362 char *psz_name;
364 bool b_placeholder;
365 bool b_switch_on_iframe;
366 int i_state;
367 mtime_t i_placeholder_delay;
368 sout_stream_id_sys_t *id_video;
369 mtime_t i_last_video;
370 sout_stream_id_sys_t *id_audio;
371 mtime_t i_last_audio;
372 } in_sout_stream_sys_t;
374 enum { placeholder_on, placeholder_off };
376 /*****************************************************************************
377 * OpenIn:
378 *****************************************************************************/
379 static int OpenIn( vlc_object_t *p_this )
381 sout_stream_t *p_stream = (sout_stream_t*)p_this;
382 in_sout_stream_sys_t *p_sys;
383 vlc_value_t val;
385 p_sys = malloc( sizeof( in_sout_stream_sys_t ) );
386 if( unlikely( !p_sys ) )
387 return VLC_ENOMEM;
389 if( !p_stream->p_next )
391 msg_Err( p_stream, "cannot create chain" );
392 free( p_sys );
393 return VLC_EGENERIC;
396 config_ChainParse( p_stream, SOUT_CFG_PREFIX_IN, ppsz_sout_options_in,
397 p_stream->p_cfg );
399 var_Get( p_stream, SOUT_CFG_PREFIX_IN "id-offset", &val );
400 p_sys->i_id_offset = val.i_int;
402 var_Get( p_stream, SOUT_CFG_PREFIX_IN "delay", &val );
403 p_sys->i_delay = (mtime_t)val.i_int * 1000;
405 var_Get( p_stream, SOUT_CFG_PREFIX_IN "name", &val );
406 if( asprintf( &p_sys->psz_name, "bridge-struct-%s", val.psz_string )<0 )
408 free( val.psz_string );
409 free( p_sys );
410 return VLC_ENOMEM;
412 free( val.psz_string );
414 var_Get( p_stream, SOUT_CFG_PREFIX_IN "placeholder", &val );
415 p_sys->b_placeholder = val.b_bool;
417 var_Get( p_stream, SOUT_CFG_PREFIX_IN "placeholder-switch-on-iframe", &val);
418 p_sys->b_switch_on_iframe = val.b_bool;
420 p_sys->i_state = placeholder_on;
422 var_Get( p_stream, SOUT_CFG_PREFIX_IN "placeholder-delay", &val );
423 p_sys->i_placeholder_delay = (mtime_t)val.i_int * 1000;
425 p_sys->i_last_video = VLC_TS_INVALID;
426 p_sys->i_last_audio = VLC_TS_INVALID;
427 p_sys->id_video = NULL;
428 p_sys->id_audio = NULL;
430 p_stream->pf_add = AddIn;
431 p_stream->pf_del = DelIn;
432 p_stream->pf_send = SendIn;
434 p_stream->p_sys = (sout_stream_sys_t *)p_sys;
435 p_stream->pace_nocontrol = true;
437 return VLC_SUCCESS;
440 /*****************************************************************************
441 * CloseIn:
442 *****************************************************************************/
443 static void CloseIn( vlc_object_t * p_this )
445 sout_stream_t *p_stream = (sout_stream_t*)p_this;
446 in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;
448 free( p_sys->psz_name );
449 free( p_sys );
452 struct sout_stream_id_sys_t
454 sout_stream_id_sys_t *id;
455 int i_cat; /* es category. Used for placeholder option */
458 static sout_stream_id_sys_t * AddIn( sout_stream_t *p_stream, es_format_t *p_fmt )
460 in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;
462 sout_stream_id_sys_t *id = malloc( sizeof( sout_stream_id_sys_t ) );
463 if( !id ) return NULL;
465 id->id = p_stream->p_next->pf_add( p_stream->p_next, p_fmt );
466 if( !id->id )
468 free( id );
469 return NULL;
472 if( p_sys->b_placeholder )
474 id->i_cat = p_fmt->i_cat;
475 switch( p_fmt->i_cat )
477 case VIDEO_ES:
478 if( p_sys->id_video != NULL )
479 msg_Err( p_stream, "We already had a video es!" );
480 p_sys->id_video = id->id;
481 break;
482 case AUDIO_ES:
483 if( p_sys->id_audio != NULL )
484 msg_Err( p_stream, "We already had an audio es!" );
485 p_sys->id_audio = id->id;
486 break;
490 return id;
493 static int DelIn( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
495 in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;
497 if( id == p_sys->id_video ) p_sys->id_video = NULL;
498 if( id == p_sys->id_audio ) p_sys->id_audio = NULL;
500 int ret = p_stream->p_next->pf_del( p_stream->p_next, id->id );
502 free( id );
503 return ret;
506 static int SendIn( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
507 block_t *p_buffer )
509 in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;
510 bridge_t *p_bridge;
511 bool b_no_es = true;
512 int i;
513 int i_date = mdate();
515 /* First forward the packet for our own ES */
516 if( !p_sys->b_placeholder )
517 p_stream->p_next->pf_send( p_stream->p_next, id->id, p_buffer );
519 /* Then check all bridged streams */
520 vlc_mutex_lock( &lock );
522 p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name );
524 if( p_bridge )
526 for ( i = 0; i < p_bridge->i_es_num; i++ )
528 if ( !p_bridge->pp_es[i]->b_empty )
529 b_no_es = false;
531 while ( p_bridge->pp_es[i]->p_block != NULL
532 && (p_bridge->pp_es[i]->p_block->i_dts + p_sys->i_delay
533 < i_date
534 || p_bridge->pp_es[i]->p_block->i_dts + p_sys->i_delay
535 < p_bridge->pp_es[i]->i_last) )
537 block_t *p_block = p_bridge->pp_es[i]->p_block;
538 msg_Dbg( p_stream, "dropping a packet (%"PRId64 ")",
539 i_date - p_block->i_dts - p_sys->i_delay );
540 p_bridge->pp_es[i]->p_block
541 = p_bridge->pp_es[i]->p_block->p_next;
542 block_Release( p_block );
545 if ( p_bridge->pp_es[i]->p_block == NULL )
547 p_bridge->pp_es[i]->pp_last = &p_bridge->pp_es[i]->p_block;
550 if ( p_bridge->pp_es[i]->b_changed )
552 if ( p_bridge->pp_es[i]->b_empty && p_bridge->pp_es[i]->id != NULL )
554 p_stream->p_next->pf_del( p_stream->p_next, p_bridge->pp_es[i]->id );
556 else
558 /* We need at least two packets to enter the mux. */
559 if ( p_bridge->pp_es[i]->p_block == NULL
560 || p_bridge->pp_es[i]->p_block->p_next == NULL )
562 continue;
565 p_bridge->pp_es[i]->fmt.i_id += p_sys->i_id_offset;
566 if( !p_sys->b_placeholder )
568 p_bridge->pp_es[i]->id = p_stream->p_next->pf_add(
569 p_stream->p_next, &p_bridge->pp_es[i]->fmt );
570 if ( p_bridge->pp_es[i]->id == NULL )
572 msg_Warn( p_stream, "couldn't create chain for id %d",
573 p_bridge->pp_es[i]->fmt.i_id );
576 msg_Dbg( p_stream, "bridging in input codec=%4.4s id=%d pos=%d",
577 (char*)&p_bridge->pp_es[i]->fmt.i_codec,
578 p_bridge->pp_es[i]->fmt.i_id, i );
581 p_bridge->pp_es[i]->b_changed = false;
583 if ( p_bridge->pp_es[i]->b_empty )
584 continue;
586 if ( p_bridge->pp_es[i]->p_block == NULL )
588 if ( p_bridge->pp_es[i]->id != NULL
589 && p_bridge->pp_es[i]->i_last < i_date )
591 if( !p_sys->b_placeholder )
592 p_stream->p_next->pf_del( p_stream->p_next,
593 p_bridge->pp_es[i]->id );
594 p_bridge->pp_es[i]->fmt.i_id -= p_sys->i_id_offset;
595 p_bridge->pp_es[i]->b_changed = true;
596 p_bridge->pp_es[i]->id = NULL;
598 continue;
601 if ( p_bridge->pp_es[i]->id != NULL || p_sys->b_placeholder)
603 block_t *p_block = p_bridge->pp_es[i]->p_block;
604 while ( p_block != NULL )
606 p_bridge->pp_es[i]->i_last = p_block->i_dts;
607 p_block->i_pts += p_sys->i_delay;
608 p_block->i_dts += p_sys->i_delay;
609 p_block = p_block->p_next;
611 sout_stream_id_sys_t *newid = NULL;
612 if( p_sys->b_placeholder )
614 switch( p_bridge->pp_es[i]->fmt.i_cat )
616 case VIDEO_ES:
617 p_sys->i_last_video = i_date;
618 newid = p_sys->id_video;
619 if( !newid )
620 break;
621 if( !p_sys->b_switch_on_iframe ||
622 p_sys->i_state == placeholder_off ||
623 ( p_bridge->pp_es[i]->fmt.i_cat == VIDEO_ES &&
624 p_bridge->pp_es[i]->p_block->i_flags & BLOCK_FLAG_TYPE_I ) )
626 p_stream->p_next->pf_send( p_stream->p_next,
627 newid,
628 p_bridge->pp_es[i]->p_block );
629 p_sys->i_state = placeholder_off;
631 break;
632 case AUDIO_ES:
633 newid = p_sys->id_audio;
634 if( !newid )
635 break;
636 p_sys->i_last_audio = i_date;
637 default:
638 p_stream->p_next->pf_send( p_stream->p_next,
639 newid?newid:p_bridge->pp_es[i]->id,
640 p_bridge->pp_es[i]->p_block );
641 break;
644 else /* !b_placeholder */
645 p_stream->p_next->pf_send( p_stream->p_next,
646 p_bridge->pp_es[i]->id,
647 p_bridge->pp_es[i]->p_block );
649 else
651 block_ChainRelease( p_bridge->pp_es[i]->p_block );
654 p_bridge->pp_es[i]->p_block = NULL;
655 p_bridge->pp_es[i]->pp_last = &p_bridge->pp_es[i]->p_block;
658 if( b_no_es )
660 for ( i = 0; i < p_bridge->i_es_num; i++ )
661 free( p_bridge->pp_es[i] );
662 free( p_bridge->pp_es );
663 free( p_bridge );
664 var_Destroy( p_stream->p_libvlc, p_sys->psz_name );
668 if( p_sys->b_placeholder )
670 switch( id->i_cat )
672 case VIDEO_ES:
673 if( ( p_sys->i_last_video + p_sys->i_placeholder_delay < i_date
674 && ( !p_sys->b_switch_on_iframe
675 || p_buffer->i_flags & BLOCK_FLAG_TYPE_I ) )
676 || p_sys->i_state == placeholder_on )
678 p_stream->p_next->pf_send( p_stream->p_next, id->id, p_buffer );
679 p_sys->i_state = placeholder_on;
681 else
682 block_Release( p_buffer );
683 break;
685 case AUDIO_ES:
686 if( p_sys->i_last_audio + p_sys->i_placeholder_delay < i_date )
687 p_stream->p_next->pf_send( p_stream->p_next, id->id, p_buffer );
688 else
689 block_Release( p_buffer );
690 break;
692 default:
693 block_Release( p_buffer ); /* FIXME: placeholder subs anyone? */
694 break;
698 vlc_mutex_unlock( &lock );
700 return VLC_SUCCESS;