* audio_output.h : audio output interface
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: audio_output.h,v 1.56 2002/08/11 22:46:34 massiot Exp $
+ * $Id: audio_output.h,v 1.57 2002/08/11 23:26:28 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
struct aout_buffer_t * p_next;
};
-#define AOUT_SPDIF_FRAME 1536
+/* Size of a frame for S/PDIF output. */
+#define AOUT_SPDIF_SIZE 6144
/*****************************************************************************
* Prototypes
* a52tospdif.c : encapsulates A/52 frames into S/PDIF packets
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: a52tospdif.c,v 1.1 2002/08/11 22:36:35 massiot Exp $
+ * $Id: a52tospdif.c,v 1.2 2002/08/11 23:26:28 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Stéphane Borel <stef@via.ecp.fr>
aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
{
static const u8 p_sync[6] = { 0x72, 0xF8, 0x1F, 0x4E, 0x01, 0x00 };
- u16 i_length = *(u16 *)p_in_buf->p_buffer;
+ u16 i_length = p_in_buf->i_nb_samples;
u16 * pi_length;
byte_t * p_in = p_in_buf->p_buffer;
byte_t * p_out = p_out_buf->p_buffer;
#ifndef WORDS_BIGENDIAN
# ifdef HAVE_SWAB
- swab( p_out + 8, p_in + sizeof(u16), i_length );
+ swab( p_out + 8, p_in, i_length );
# else
p_out += 8;
- p_in += sizeof(u16);
for ( i = 0; i < i_length / 2; i++ )
{
p_out[0] = p_in[1];
# endif
#else
- p_filter->p_vlc->pf_memcpy( p_out + 8, p_in + sizeof(u16), i_length );
+ p_filter->p_vlc->pf_memcpy( p_out + 8, p_in, i_length );
#endif
- p_out_buf->i_nb_samples = p_in_buf->i_nb_samples; /* == 1 */
+ p_filter->p_vlc->pf_memset( p_out + 8 + i_length, 0,
+ AOUT_SPDIF_SIZE - i_length - 8 );
+
+ p_out_buf->i_nb_samples = 1;
}
* spdif.c: A52 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001-2002 VideoLAN
- * $Id: spdif.c,v 1.2 2002/08/11 22:36:35 massiot Exp $
+ * $Id: spdif.c,v 1.3 2002/08/11 23:26:28 massiot Exp $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
static int InitThread ( spdif_thread_t *, decoder_fifo_t * );
static void EndThread ( spdif_thread_t * );
-int SyncInfo ( const byte_t *, int *, int *, int * );
+static int SyncInfo ( const byte_t *, int *, int *, int * );
/*****************************************************************************
* Module descriptor
/* Temporary buffer to store the raw frame to be decoded */
byte_t p_header[7];
aout_buffer_t * p_buffer;
- u16 * pi_length;
/* Look for sync word - should be 0x0b77 */
RealignBits( &p_dec->bit_stream );
continue;
}
- p_buffer = aout_BufferNew( p_dec->p_aout, p_dec->p_aout_input, 1 );
+ p_buffer = aout_BufferNew( p_dec->p_aout, p_dec->p_aout_input,
+ i_frame_size );
if ( p_buffer == NULL ) return -1;
p_buffer->start_date = last_date;
last_date += (mtime_t)(A52_FRAME_SIZE * 1000000)
/ p_dec->output_format.i_rate;
p_buffer->end_date = last_date;
- /* The first two bytes store the length of the frame - this is
- * a bit kludgy. */
- pi_length = (u16 *)p_buffer->p_buffer;
- *pi_length = i_frame_size;
-
/* Get the whole frame. */
memcpy( p_buffer->p_buffer + sizeof(u16), p_header, 7 );
GetChunk( &p_dec->bit_stream, p_buffer->p_buffer + 7 + sizeof(u16),
* audio_output.c : audio output instance
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: audio_output.c,v 1.92 2002/08/11 01:27:01 massiot Exp $
+ * $Id: audio_output.c,v 1.93 2002/08/11 23:26:28 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
/* Please note that we don't multiply by multiplier, because i_rate
* and i_nb_samples do not have any sense for S/PDIF (yes, it
* _is_ kludgy). --Meuuh */
- return AOUT_SPDIF_FRAME;
+ return AOUT_SPDIF_SIZE;
default:
return 0; /* will segfault much sooner... */