]> git.sesse.net Git - vlc/commitdiff
* modules/demux/flac.c: few cosmetic changes.
authorGildas Bazin <gbazin@videolan.org>
Sun, 17 Aug 2003 13:56:26 +0000 (13:56 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 17 Aug 2003 13:56:26 +0000 (13:56 +0000)
* modules/codec/flacdec.c: when synchronisation on the bitstream is lost, flush the flac decoder so it can synchronise again (fixes problems on seeking).

modules/codec/flacdec.c
modules/demux/flac.c

index 3b846cf73db719d0e524e5a34dd10755567fecf4..942d1832fd77cb61bb10b73c3944408d06d7f6aa 100644 (file)
@@ -2,7 +2,7 @@
  * flac.c: flac decoder module making use of libflac
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: flacdec.c,v 1.2 2003/03/30 18:14:36 gbazin Exp $
+ * $Id: flacdec.c,v 1.3 2003/08/17 13:56:26 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -182,7 +182,7 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
         goto error;
     }
     
-    /* vorbis decoder thread's main loop */
+    /* flac decoder thread's main loop */
     while( (!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error) )
     { 
         if ( !FLAC__stream_decoder_process_single( p_dec->p_decoder ) )
@@ -437,6 +437,7 @@ static void decoder_state_error( dec_thread_t *p_dec, FLAC__StreamDecoderState s
         break;
     case FLAC__STREAM_DECODER_UNPARSEABLE_STREAM  : 
         msg_Err( p_dec->p_fifo, "The decoder encountered reserved fields in use in the stream.");
+        FLAC__stream_decoder_flush( p_dec->p_decoder );
         break;
     case FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR  : 
         msg_Err( p_dec->p_fifo, "An error occurred allocating memory.");
index 535f70037f22c6afb83fd2e5bd55047c35796463..4f61cae15e65c6a89cde1da2804c060e241c29c7 100644 (file)
@@ -1,10 +1,10 @@
 /*****************************************************************************
- * a52sys.c : A/52 input module for vlc
+ * flac.c : FLAC demuc module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: flac.c,v 1.3 2003/05/05 22:23:34 gbazin Exp $
+ * $Id: flac.c,v 1.4 2003/08/17 13:56:26 gbazin Exp $
  *
- * Authors: Arnaud de Bossoreille de Ribou <bozo@via.ecp.fr>
+ * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
  * 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
@@ -36,7 +36,7 @@
 /*****************************************************************************
  * Constants
  *****************************************************************************/
-#define A52_PACKET_SIZE 16384
+#define FLAC_PACKET_SIZE 16384
 #define MAX_PACKETS_IN_FIFO 1
 
 /*****************************************************************************
@@ -88,7 +88,8 @@ static int Init( vlc_object_t * p_this )
         if( *p_input->psz_demux && !strncmp( p_input->psz_demux, "flac", 4 ) )
         {
             /* User forced */
-            msg_Err( p_input, "this doesn't look like an flac stream, continuing" );
+            msg_Err( p_input, "this doesn't look like an flac stream, "
+                     "continuing anyway" );
         }
         else
         {
@@ -104,12 +105,11 @@ static int Init( vlc_object_t * p_this )
     input_AddProgram( p_input, 0, 0 );
     p_input->stream.p_selected_program = p_input->stream.pp_programs[0];
     vlc_mutex_lock( &p_input->stream.stream_lock );
-    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 0xBD,
+    p_es = input_AddES( p_input, p_input->stream.p_selected_program, 1,
                         AUDIO_ES, NULL, 0 );
-    p_es->i_stream_id = 0xBD;
+    p_es->i_stream_id = 1;
     p_es->i_fourcc = VLC_FOURCC('f','l','a','c');
     input_SelectES( p_input, p_es );
-    p_input->stream.p_selected_area->i_tell = 0;
     p_input->stream.p_selected_program->b_is_ok = 1;
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 
@@ -134,7 +134,7 @@ static int Demux( input_thread_t * p_input )
         return -1;
     }
 
-    i_read = input_SplitBuffer( p_input, &p_data, A52_PACKET_SIZE );
+    i_read = input_SplitBuffer( p_input, &p_data, FLAC_PACKET_SIZE );
 
     if ( i_read <= 0 )
     {
@@ -178,4 +178,3 @@ static int Demux( input_thread_t * p_input )
 
     return 1;
 }
-