]> git.sesse.net Git - vlc/blob - modules/codec/avcodec/avcodec.c
Sanitize FFmpeg modules options
[vlc] / modules / codec / avcodec / avcodec.c
1 /*****************************************************************************
2  * avcodec.c: video and audio decoder and encoder using libavcodec
3  *****************************************************************************
4  * Copyright (C) 1999-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *          Gildas Bazin <gbazin@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
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 General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
31
32 #include <vlc_common.h>
33 #include <vlc_plugin.h>
34 #include <vlc_codec.h>
35 #include <vlc_avcodec.h>
36 #include <vlc_cpu.h>
37
38 /* ffmpeg header */
39 #define HAVE_MMX 1
40 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
41 #   include <libavcodec/avcodec.h>
42 #else
43 #   include <avcodec.h>
44 #endif
45
46 #include "avcodec.h"
47 #include "chroma.h"
48 #include "avcommon.h"
49
50 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 25, 0 )
51 #   error You must update libavcodec to a version >= 52.25.0
52 #endif
53
54 /*****************************************************************************
55  * decoder_sys_t: decoder descriptor
56  *****************************************************************************/
57 struct decoder_sys_t
58 {
59     /* Common part between video and audio decoder */
60     AVCODEC_COMMON_MEMBERS
61 };
62
63 /****************************************************************************
64  * Local prototypes
65  ****************************************************************************/
66 static int OpenDecoder( vlc_object_t * );
67 static void CloseDecoder( vlc_object_t * );
68
69 static const int  nloopf_list[] = { 0, 1, 2, 3, 4 };
70 static const char *const nloopf_list_text[] =
71   { N_("None"), N_("Non-ref"), N_("Bidir"), N_("Non-key"), N_("All") };
72
73 #ifdef ENABLE_SOUT
74 static const char *const enc_hq_list[] = { "rd", "bits", "simple" };
75 static const char *const enc_hq_list_text[] = {
76     N_("rd"), N_("bits"), N_("simple") };
77 #endif
78
79 #ifdef MERGE_FFMPEG
80 # include "../../demux/avformat/avformat.h"
81 # include "../../access/avio.h"
82 #endif
83
84 /*****************************************************************************
85  * Module descriptor
86  *****************************************************************************/
87 #define MODULE_DESCRIPTION N_( "Various audio and video decoders/encoders " \
88         "delivered by the FFmpeg library. This includes (MS)MPEG4, DivX, SV1,"\
89         "H261, H263, H264, WMV, WMA, AAC, AMR, DV, MJPEG and other codecs")
90
91 vlc_module_begin ()
92     set_shortname( "FFmpeg")
93     add_shortcut( "ffmpeg" )
94     set_category( CAT_INPUT )
95     set_subcategory( SUBCAT_INPUT_VCODEC )
96     /* decoder main module */
97     set_description( N_("FFmpeg audio/video decoder") )
98     set_help( MODULE_DESCRIPTION )
99     set_capability( "decoder", 70 )
100     set_section( N_("Decoding") , NULL )
101     set_callbacks( OpenDecoder, CloseDecoder )
102
103
104     add_obsolete_bool( "ffmpeg-dr" ) /* removed since 2.1.0 */
105     add_bool( "avcodec-dr", true, DR_TEXT, DR_TEXT, true )
106     add_obsolete_integer ( "ffmpeg-error-resilience" ) /* removed since 2.1.0 */
107     add_integer ( "avcodec-error-resilience", 1, ERROR_TEXT,
108         ERROR_LONGTEXT, true )
109     add_obsolete_integer ( "ffmpeg-workaround-bugs" ) /* removed since 2.1.0 */
110     add_integer ( "avcodec-workaround-bugs", 1, BUGS_TEXT, BUGS_LONGTEXT,
111         false )
112     add_obsolete_bool( "ffmpeg-hurry-up" ) /* removed since 2.1.0 */
113     add_bool( "avcodec-hurry-up", true, HURRYUP_TEXT, HURRYUP_LONGTEXT,
114         false )
115     add_obsolete_integer( "ffmpeg-skip-frame") /* removed since 2.1.0 */
116     add_integer( "avcodec-skip-frame", 0, SKIP_FRAME_TEXT,
117         SKIP_FRAME_LONGTEXT, true )
118         change_integer_range( -1, 4 )
119     add_obsolete_integer( "ffmpeg-skip-idct" ) /* removed since 2.1.0 */
120     add_integer( "avcodec-skip-idct", 0, SKIP_IDCT_TEXT,
121         SKIP_IDCT_LONGTEXT, true )
122         change_integer_range( -1, 4 )
123     add_obsolete_integer ( "ffmpeg-vismv" ) /* removed since 2.1.0 */
124     add_integer ( "avcodec-vismv", 0, VISMV_TEXT, VISMV_LONGTEXT,
125         true )
126     add_obsolete_integer ( "ffmpeg-lowres" ) /* removed since 2.1.0 */
127     add_integer ( "avcodec-lowres", 0, LOWRES_TEXT, LOWRES_LONGTEXT,
128         true )
129         change_integer_range( 0, 2 )
130     add_obsolete_bool( "ffmpeg-fast" ) /* removed since 2.1.0 */
131     add_bool( "avcodec-fast", false, FAST_TEXT, FAST_LONGTEXT, false )
132     add_obsolete_integer ( "ffmpeg-skiploopfilter" ) /* removed since 2.1.0 */
133     add_integer ( "avcodec-skiploopfilter", 0, SKIPLOOPF_TEXT,
134                   SKIPLOOPF_LONGTEXT, false)
135         change_safe ()
136         change_integer_list( nloopf_list, nloopf_list_text )
137
138     add_obsolete_integer( "ffmpeg-debug" ) /* removed since 2.1.0 */
139     add_integer( "avcodec-debug", 0, DEBUG_TEXT, DEBUG_LONGTEXT,
140                  true )
141     add_obsolete_string( "ffmpeg-codec" ) /* removed since 2.1.0 */
142     add_string( "avcodec-codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true )
143 #if defined(HAVE_AVCODEC_VAAPI) || defined(HAVE_AVCODEC_DXVA2)
144     add_obsolete_bool( "ffmpeg-hw" ) /* removed since 2.1.0 */
145     add_bool( "avcodec-hw", false, HW_TEXT, HW_LONGTEXT, false )
146 #endif
147 #if defined(FF_THREAD_FRAME)
148     add_obsolete_integer( "ffmpeg-threads" ) /* removed since 2.1.0 */
149     add_integer( "avcodec-threads", 0, THREADS_TEXT, THREADS_LONGTEXT, true );
150 #endif
151
152
153 #ifdef ENABLE_SOUT
154     /* encoder submodule */
155     add_submodule ()
156     add_shortcut( "ffmpeg" )
157     set_section( N_("Encoding") , NULL )
158     set_description( N_("FFmpeg audio/video encoder") )
159     set_capability( "encoder", 100 )
160     set_callbacks( OpenEncoder, CloseEncoder )
161
162     /* removed in 2.1.0 */
163     add_obsolete_string( "sout-ffmpeg-codec" )
164     add_obsolete_string( "sout-ffmpeg-hq" )
165     add_obsolete_integer( "sout-ffmpeg-keyint" )
166     add_obsolete_integer( "sout-ffmpeg-bframes" )
167     add_obsolete_bool( "sout-ffmpeg-hurry-up" )
168     add_obsolete_bool( "sout-ffmpeg-interlace" )
169     add_obsolete_bool( "sout-ffmpeg-interlace-me" )
170     add_obsolete_integer( "sout-ffmpeg-vt" )
171     add_obsolete_bool( "sout-ffmpeg-pre-me" )
172     add_obsolete_integer( "sout-ffmpeg-rc-buffer-size" )
173     add_obsolete_float( "sout-ffmpeg-rc-buffer-aggressivity" )
174     add_obsolete_float( "sout-ffmpeg-i-quant-factor" )
175     add_obsolete_integer( "sout-ffmpeg-noise-reduction" )
176     add_obsolete_bool( "sout-ffmpeg-mpeg4-matrix" )
177     add_obsolete_integer( "sout-ffmpeg-qmin" )
178     add_obsolete_integer( "sout-ffmpeg-qmax" )
179     add_obsolete_bool( "sout-ffmpeg-trellis" )
180     add_obsolete_float( "sout-ffmpeg-qscale" )
181     add_obsolete_integer( "sout-ffmpeg-strict" )
182     add_obsolete_float( "sout-ffmpeg-lumi-masking" )
183     add_obsolete_float( "sout-ffmpeg-dark-masking" )
184     add_obsolete_float( "sout-ffmpeg-p-masking" )
185     add_obsolete_float( "sout-ffmpeg-border-masking" )
186     add_obsolete_integer( "sout-ffmpeg-luma-elim-threshold" )
187     add_obsolete_integer( "sout-ffmpeg-chroma-elim-threshold" )
188     add_obsolete_string( "sout-ffmpeg-aac-profile" )
189
190
191     add_string( ENC_CFG_PREFIX "codec", NULL, CODEC_TEXT, CODEC_LONGTEXT, true )
192     add_string( ENC_CFG_PREFIX "hq", "simple", ENC_HQ_TEXT,
193                 ENC_HQ_LONGTEXT, false )
194         change_string_list( enc_hq_list, enc_hq_list_text, 0 )
195     add_integer( ENC_CFG_PREFIX "keyint", 0, ENC_KEYINT_TEXT,
196                  ENC_KEYINT_LONGTEXT, false )
197     add_integer( ENC_CFG_PREFIX "bframes", 0, ENC_BFRAMES_TEXT,
198                  ENC_BFRAMES_LONGTEXT, false )
199     add_bool( ENC_CFG_PREFIX "hurry-up", false, ENC_HURRYUP_TEXT,
200               ENC_HURRYUP_LONGTEXT, false )
201     add_bool( ENC_CFG_PREFIX "interlace", false, ENC_INTERLACE_TEXT,
202               ENC_INTERLACE_LONGTEXT, true )
203     add_bool( ENC_CFG_PREFIX "interlace-me", true, ENC_INTERLACE_ME_TEXT,
204               ENC_INTERLACE_ME_LONGTEXT, true )
205     add_integer( ENC_CFG_PREFIX "vt", 0, ENC_VT_TEXT,
206                  ENC_VT_LONGTEXT, true )
207     add_bool( ENC_CFG_PREFIX "pre-me", false, ENC_PRE_ME_TEXT,
208               ENC_PRE_ME_LONGTEXT, true )
209     add_integer( ENC_CFG_PREFIX "rc-buffer-size", 224*1024*8,
210                  ENC_RC_BUF_TEXT, ENC_RC_BUF_LONGTEXT, true )
211     add_float( ENC_CFG_PREFIX "rc-buffer-aggressivity", 1.0,
212                ENC_RC_BUF_AGGR_TEXT, ENC_RC_BUF_AGGR_LONGTEXT, true )
213     add_float( ENC_CFG_PREFIX "i-quant-factor", 0,
214                ENC_IQUANT_FACTOR_TEXT, ENC_IQUANT_FACTOR_LONGTEXT, true )
215     add_integer( ENC_CFG_PREFIX "noise-reduction", 0,
216                  ENC_NOISE_RED_TEXT, ENC_NOISE_RED_LONGTEXT, true )
217     add_bool( ENC_CFG_PREFIX "mpeg4-matrix", false,
218               ENC_MPEG4_MATRIX_TEXT, ENC_MPEG4_MATRIX_LONGTEXT, true )
219     add_integer( ENC_CFG_PREFIX "qmin", 0,
220                  ENC_QMIN_TEXT, ENC_QMIN_LONGTEXT, true )
221     add_integer( ENC_CFG_PREFIX "qmax", 0,
222                  ENC_QMAX_TEXT, ENC_QMAX_LONGTEXT, true )
223     add_bool( ENC_CFG_PREFIX "trellis", false,
224               ENC_TRELLIS_TEXT, ENC_TRELLIS_LONGTEXT, true )
225     add_float( ENC_CFG_PREFIX "qscale", 0,
226                ENC_QSCALE_TEXT, ENC_QSCALE_LONGTEXT, true )
227     add_integer( ENC_CFG_PREFIX "strict", 0,
228                  ENC_STRICT_TEXT, ENC_STRICT_LONGTEXT, true )
229         change_integer_range( -2, 2 )
230     add_float( ENC_CFG_PREFIX "lumi-masking", 0.0,
231                ENC_LUMI_MASKING_TEXT, ENC_LUMI_MASKING_LONGTEXT, true )
232     add_float( ENC_CFG_PREFIX "dark-masking", 0.0,
233                ENC_DARK_MASKING_TEXT, ENC_DARK_MASKING_LONGTEXT, true )
234     add_float( ENC_CFG_PREFIX "p-masking", 0.0,
235                ENC_P_MASKING_TEXT, ENC_P_MASKING_LONGTEXT, true )
236     add_float( ENC_CFG_PREFIX "border-masking", 0.0,
237                ENC_BORDER_MASKING_TEXT, ENC_BORDER_MASKING_LONGTEXT, true )
238     add_integer( ENC_CFG_PREFIX "luma-elim-threshold", 0,
239                  ENC_LUMA_ELIM_TEXT, ENC_LUMA_ELIM_LONGTEXT, true )
240     add_integer( ENC_CFG_PREFIX "chroma-elim-threshold", 0,
241                  ENC_CHROMA_ELIM_TEXT, ENC_CHROMA_ELIM_LONGTEXT, true )
242
243     /* Audio AAC encoder profile */
244     add_string( ENC_CFG_PREFIX "aac-profile", "low",
245                 ENC_PROFILE_TEXT, ENC_PROFILE_LONGTEXT, true )
246 #endif /* ENABLE_SOUT */
247
248     /* video filter submodule */
249     add_submodule ()
250     set_capability( "video filter2", 0 )
251     set_callbacks( OpenDeinterlace, CloseDeinterlace )
252     set_description( N_("FFmpeg deinterlace video filter") )
253     add_shortcut( "ffmpeg-deinterlace" )
254
255 #ifdef MERGE_FFMPEG
256     add_submodule ()
257 #   include "../../demux/avformat/avformat.c"
258     add_submodule ()
259         AVIO_MODULE
260 #endif
261 vlc_module_end ()
262
263 /*****************************************************************************
264  * OpenDecoder: probe the decoder and return score
265  *****************************************************************************/
266 static int OpenDecoder( vlc_object_t *p_this )
267 {
268     decoder_t *p_dec = (decoder_t*) p_this;
269     int i_cat, i_codec_id, i_result;
270     const char *psz_namecodec;
271
272     AVCodecContext *p_context = NULL;
273     AVCodec        *p_codec = NULL;
274
275     /* *** determine codec type *** */
276     if( !GetFfmpegCodec( p_dec->fmt_in.i_codec, &i_cat, &i_codec_id,
277                              &psz_namecodec ) )
278     {
279         return VLC_EGENERIC;
280     }
281
282     /* Initialization must be done before avcodec_find_decoder() */
283     vlc_init_avcodec();
284
285     /* *** ask ffmpeg for a decoder *** */
286     char *psz_decoder = var_CreateGetString( p_this, "avcodec-codec" );
287     if( psz_decoder && *psz_decoder )
288     {
289         p_codec = avcodec_find_decoder_by_name( psz_decoder );
290         if( !p_codec )
291             msg_Err( p_this, "Decoder `%s' not found", psz_decoder );
292         else if( p_codec->id != i_codec_id )
293         {
294             msg_Err( p_this, "Decoder `%s' can't handle %4.4s",
295                     psz_decoder, (char*)&p_dec->fmt_in.i_codec );
296             p_codec = NULL;
297         }
298     }
299     free( psz_decoder );
300     if( !p_codec )
301         p_codec = avcodec_find_decoder( i_codec_id );
302     if( !p_codec )
303     {
304         msg_Dbg( p_dec, "codec not found (%s)", psz_namecodec );
305         return VLC_EGENERIC;
306     }
307
308     /* *** get a p_context *** */
309 #if LIBAVCODEC_VERSION_MAJOR >= 54
310     p_context = avcodec_alloc_context3(p_codec);
311 #else
312     p_context = avcodec_alloc_context();
313 #endif
314     if( !p_context )
315         return VLC_ENOMEM;
316     p_context->debug = var_InheritInteger( p_dec, "avcodec-debug" );
317     p_context->opaque = (void *)p_this;
318
319     /* Set CPU capabilities */
320     unsigned i_cpu = vlc_CPU();
321     p_context->dsp_mask = 0;
322     if( !(i_cpu & CPU_CAPABILITY_MMX) )
323     {
324         p_context->dsp_mask |= AV_CPU_FLAG_MMX;
325     }
326     if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
327     {
328         p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
329     }
330     if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
331     {
332         p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
333     }
334     if( !(i_cpu & CPU_CAPABILITY_SSE) )
335     {
336         p_context->dsp_mask |= AV_CPU_FLAG_SSE;
337     }
338     if( !(i_cpu & CPU_CAPABILITY_SSE2) )
339     {
340         p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
341     }
342 #ifdef AV_CPU_FLAG_SSE3
343     if( !(i_cpu & CPU_CAPABILITY_SSE3) )
344         p_context->dsp_mask |= AV_CPU_FLAG_SSE3;
345 #endif
346 #ifdef AV_CPU_FLAG_SSSE3
347     if( !(i_cpu & CPU_CAPABILITY_SSSE3) )
348         p_context->dsp_mask |= AV_CPU_FLAG_SSSE3;
349 #endif
350 #ifdef AV_CPU_FLAG_SSE4
351     if( !(i_cpu & CPU_CAPABILITY_SSE4_1) )
352         p_context->dsp_mask |= AV_CPU_FLAG_SSE4;
353 #endif
354 #ifdef AV_CPU_FLAG_SSE42
355     if( !(i_cpu & CPU_CAPABILITY_SSE4_2) )
356         p_context->dsp_mask |= AV_CPU_FLAG_SSE42;
357 #endif
358
359     p_dec->b_need_packetized = true;
360     switch( i_cat )
361     {
362     case VIDEO_ES:
363         p_dec->pf_decode_video = DecodeVideo;
364         i_result =  InitVideoDec ( p_dec, p_context, p_codec,
365                                        i_codec_id, psz_namecodec );
366         break;
367     case AUDIO_ES:
368         p_dec->pf_decode_audio = DecodeAudio;
369         i_result =  InitAudioDec ( p_dec, p_context, p_codec,
370                                        i_codec_id, psz_namecodec );
371         break;
372     case SPU_ES:
373         p_dec->pf_decode_sub = DecodeSubtitle;
374         i_result =  InitSubtitleDec( p_dec, p_context, p_codec,
375                                      i_codec_id, psz_namecodec );
376         break;
377     default:
378         i_result = VLC_EGENERIC;
379     }
380
381     if( i_result == VLC_SUCCESS )
382     {
383         p_dec->p_sys->i_cat = i_cat;
384         if( p_context->profile != FF_PROFILE_UNKNOWN)
385             p_dec->fmt_in.i_profile = p_context->profile;
386         if( p_context->level != FF_LEVEL_UNKNOWN)
387             p_dec->fmt_in.i_level = p_context->level;
388     }
389
390     return i_result;
391 }
392
393 /*****************************************************************************
394  * CloseDecoder: decoder destruction
395  *****************************************************************************/
396 static void CloseDecoder( vlc_object_t *p_this )
397 {
398     decoder_t *p_dec = (decoder_t *)p_this;
399     decoder_sys_t *p_sys = p_dec->p_sys;
400
401     switch( p_sys->i_cat )
402     {
403     case AUDIO_ES:
404          EndAudioDec ( p_dec );
405         break;
406     case VIDEO_ES:
407          EndVideoDec ( p_dec );
408         break;
409     case SPU_ES:
410          EndSubtitleDec( p_dec );
411         break;
412     }
413
414     if( p_sys->p_context )
415     {
416         free( p_sys->p_context->extradata );
417         p_sys->p_context->extradata = NULL;
418
419         if( !p_sys->b_delayed_open )
420         {
421             vlc_avcodec_lock();
422             avcodec_close( p_sys->p_context );
423             vlc_avcodec_unlock();
424         }
425         msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
426         av_free( p_sys->p_context );
427     }
428
429     free( p_sys );
430 }
431
432 /*****************************************************************************
433  * ffmpeg_OpenCodec:
434  *****************************************************************************/
435 int ffmpeg_OpenCodec( decoder_t *p_dec )
436 {
437     decoder_sys_t *p_sys = p_dec->p_sys;
438
439     if( p_sys->p_context->extradata_size <= 0 )
440     {
441         if( p_sys->i_codec_id == CODEC_ID_VC1 ||
442             p_sys->i_codec_id == CODEC_ID_VORBIS ||
443             p_sys->i_codec_id == CODEC_ID_THEORA ||
444             p_sys->i_codec_id == CODEC_ID_AAC )
445         {
446             msg_Warn( p_dec, "waiting for extra data for codec %s",
447                       p_sys->psz_namecodec );
448             return 1;
449         }
450     }
451     if( p_dec->fmt_in.i_cat == VIDEO_ES )
452     {
453         p_sys->p_context->width  = p_dec->fmt_in.video.i_width;
454         p_sys->p_context->height = p_dec->fmt_in.video.i_height;
455         p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.video.i_bits_per_pixel;
456     }
457     else if( p_dec->fmt_in.i_cat == AUDIO_ES )
458     {
459         p_sys->p_context->sample_rate = p_dec->fmt_in.audio.i_rate;
460         p_sys->p_context->channels = p_dec->fmt_in.audio.i_channels;
461
462         p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
463         p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
464         p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
465     }
466     int ret;
467     vlc_avcodec_lock();
468 #if LIBAVCODEC_VERSION_MAJOR >= 54
469     ret = avcodec_open2( p_sys->p_context, p_sys->p_codec, NULL /* options */ );
470 #else
471     ret = avcodec_open( p_sys->p_context, p_sys->p_codec );
472 #endif
473     vlc_avcodec_unlock();
474     if( ret < 0 )
475         return VLC_EGENERIC;
476     msg_Dbg( p_dec, "ffmpeg codec (%s) started", p_sys->psz_namecodec );
477
478 #ifdef HAVE_AVCODEC_MT
479     if( p_dec->fmt_in.i_cat == VIDEO_ES )
480     {
481         switch( p_sys->p_context->active_thread_type )
482         {
483             case FF_THREAD_FRAME:
484                 msg_Dbg( p_dec, "using frame thread mode with %d threads",
485                          p_sys->p_context->thread_count );
486                 break;
487             case FF_THREAD_SLICE:
488                 msg_Dbg( p_dec, "using slice thread mode with %d threads",
489                          p_sys->p_context->thread_count );
490                 break;
491             case 0:
492                 if( p_sys->p_context->thread_count > 1 )
493                     msg_Warn( p_dec, "failed to enable threaded decoding" );
494                 break;
495             default:
496                 msg_Warn( p_dec, "using unknown thread mode with %d threads",
497                           p_sys->p_context->thread_count );
498                 break;
499         }
500     }
501 #endif
502
503     p_sys->b_delayed_open = false;
504
505     return VLC_SUCCESS;
506 }