mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-04 09:11:33 +02:00
S/PDIF fixes.
This commit is contained in:
parent
ff840042a2
commit
0ef062c721
@ -2,7 +2,7 @@
|
||||
* 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>
|
||||
*
|
||||
@ -109,7 +109,8 @@ struct aout_buffer_t
|
||||
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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 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>
|
||||
@ -78,7 +78,7 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
|
||||
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;
|
||||
@ -93,10 +93,9 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
|
||||
|
||||
#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];
|
||||
@ -106,9 +105,12 @@ static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
|
||||
# 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;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 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>
|
||||
@ -77,7 +77,7 @@ static int RunDecoder ( decoder_fifo_t * );
|
||||
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
|
||||
@ -145,7 +145,6 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
|
||||
/* 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 );
|
||||
@ -209,18 +208,14 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
|
||||
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),
|
||||
|
@ -2,7 +2,7 @@
|
||||
* 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>
|
||||
*
|
||||
@ -194,7 +194,7 @@ int aout_FormatTo( audio_sample_format_t * p_format, int i_multiplier )
|
||||
/* 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... */
|
||||
|
Loading…
Reference in New Issue
Block a user