Commit a132d75c authored by Sam Hocevar's avatar Sam Hocevar

 . this is a coding style patch which removes all "foo(bar){" constructions
   and most of the tabulations.
 . also, fixed a bug in the default subtitle track.
 . and made a few error messages more explicit, ie. changed "error: %s" to
   "foo error: couldn't initialize bar (%s)"
parent df5793c2
......@@ -31,8 +31,8 @@ public:
// standard window member
virtual bool QuitRequested();
virtual void MessageReceived(BMessage *message);
// this is the hook controling direct screen connection
// this is the hook controling direct screen connection
virtual void DirectConnected(direct_buffer_info *info);
int32 i_bytes_per_pixel;
......
......@@ -137,7 +137,7 @@
#define INTF_CHANNELS_DEFAULT "vlc.channels"
/* Base delay in micro second for interface sleeps */
#define INTF_IDLE_SLEEP ((int)(0.100*CLOCK_FREQ))
#define INTF_IDLE_SLEEP ((int)(0.050*CLOCK_FREQ))
/* Step for changing gamma, and minimum and maximum values */
#define INTF_GAMMA_STEP .1
......@@ -169,10 +169,10 @@
#define INPUT_MAX_THREADS 10
/* Maximum size of a data packet (128 kB) */
#define INPUT_MAX_PACKET_SIZE 131072
#define INPUT_MAX_PACKET_SIZE 131072
/* Maximum length of a pre-parsed chunk (4 MB) */
#define INPUT_PREPARSE_LENGTH 4194304
#define INPUT_PREPARSE_LENGTH 4194304
/* Maximum length of a hostname or source name */
#define INPUT_MAX_SOURCE_LENGTH 100
......@@ -412,7 +412,7 @@
#define VDEC_CROPRANGE 2048
/* Nice increments for decoders -- necessary for x11 scheduling */
#define VDEC_NICE 3
#define VDEC_NICE 3
/*****************************************************************************
* Generic decoder configuration
......@@ -433,8 +433,8 @@
#define INTF_MSG_QSIZE 64
/* Interface warnig message level */
#define INTF_WARNING_VAR "warning_level"
#define INTF_WARNING_DEFAULT 12
#define INTF_WARNING_VAR "warning_level"
#define INTF_WARNING_DEFAULT 12
/* Define to enable messages queues - disabling messages queue can be usefull
* when debugging, since it allows messages which would not otherwise be printed,
......
......@@ -21,11 +21,11 @@
*****************************************************************************/
/* Basic types definitions */
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
typedef unsigned long long u64;
typedef signed long long s64;
typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;
typedef unsigned long long u64;
typedef signed long long s64;
#ifndef VLC_KEYS
#define VLC_KEYS
#define INTF_KEY_QUIT 0x01
#define INTF_KEY_SET_CHANNEL 0x02
#define INTF_KEY_DEC_VOLUME 0x03
#define INTF_KEY_INC_VOLUME 0x04
#define INTF_KEY_TOGGLE_VOLUME 0x05
#define INTF_KEY_DEC_GAMMA 0x06
#define INTF_KEY_INC_GAMMA 0x07
#define INTF_KEY_TOGGLE_GRAYSCALE 0x08
#define INTF_KEY_TOGGLE_INTERFACE 0x09
#define INTF_KEY_TOGGLE_INFO 0x0A
#define INTF_KEY_TOGGLE_SCALING 0x0B
#define INTF_KEY_UNKNOWN 0x0C
#define INTF_KEY_QUIT 0x01
#define INTF_KEY_SET_CHANNEL 0x02
#define INTF_KEY_DEC_VOLUME 0x03
#define INTF_KEY_INC_VOLUME 0x04
#define INTF_KEY_TOGGLE_VOLUME 0x05
#define INTF_KEY_DEC_GAMMA 0x06
#define INTF_KEY_INC_GAMMA 0x07
#define INTF_KEY_TOGGLE_GRAYSCALE 0x08
#define INTF_KEY_TOGGLE_INTERFACE 0x09
#define INTF_KEY_TOGGLE_INFO 0x0A
#define INTF_KEY_TOGGLE_SCALING 0x0B
#define INTF_KEY_UNKNOWN 0x0C
#endif
......@@ -212,7 +212,7 @@ static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
#elif defined(HAVE_KERNEL_SCHEDULER_H) && defined(HAVE_KERNEL_OS_H)
// check the arguments and whether it's already been initialized
/* check the arguments and whether it's already been initialized */
if( p_mutex == NULL ) return B_BAD_VALUE;
if( p_mutex->init == 9999 )
{
......
......@@ -25,7 +25,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/asoundlib.h> /* for alsa :) */
#include <sys/asoundlib.h> /* for alsa :) */
#include <fcntl.h>
#include <stdlib.h> /* malloc(), free() */
// #include <unistd.h> /* close() */
......
......@@ -63,7 +63,7 @@ typedef struct alsa_card_s
typedef struct aout_sys_s
{
snd_pcm_t * p_alsa_handle;
snd_pcm_t * p_alsa_handle;
alsa_device_t s_alsa_device;
alsa_card_t s_alsa_card;
snd_pcm_channel_params_t s_alsa_channel_params;
......
......@@ -28,7 +28,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h> /* for all the SDL stuff */
#include <SDL/SDL.h> /* for all the SDL stuff */
#include <sys/types.h> /* on BSD, uio.h needs types.h */
#include <sys/uio.h> /* for input.h */
......@@ -58,7 +58,7 @@ typedef struct intf_sys_s
{
/* SDL system information */
SDL_Surface * p_display;
boolean_t b_Fullscreen;
boolean_t b_Fullscreen;
} intf_sys_t;
typedef struct vout_sys_s
......@@ -76,7 +76,7 @@ typedef struct vout_sys_s
/* local prototype */
void intf_SDL_Keymap( intf_thread_t * p_intf );
void intf_SDL_Keymap( intf_thread_t * p_intf );
void intf_SDL_Resize( intf_thread_t * p_intf, int width, int height );
void intf_SDL_Fullscreen(intf_thread_t * p_intf);
void intf_SDL_YUVSwitch(intf_thread_t * p_intf);
......
......@@ -99,7 +99,7 @@ plugin_info_t * GetConfig( void )
#else
p_info->yuv_GetPlugin = NULL;
#endif
/* if the SDL libraries are there, assume we can enter the
* initialization part at least, even if we fail afterwards */
......
......@@ -259,7 +259,7 @@ int vout_X11Manage( vout_thread_t *p_vout )
/* Tell the video output thread that it will need to rebuild YUV
* tables. This is needed since conversion buffer size may have
* changed */
* changed */
p_vout->i_changes |= VOUT_YUV_CHANGE;
intf_Msg("Video display resized (%dx%d)", p_vout->i_width, p_vout->i_height);
}
......@@ -412,7 +412,7 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
* formats. */
p_xpixmap_format = XListPixmapFormats( p_vout->p_sys->p_display, &i_count );
/* Under XFree4.0, the list contains pixmap formats available through
* all video depths ; so we have to check against current depth. */
p_vout->i_bytes_per_pixel = 0;
......
......@@ -23,9 +23,10 @@
static __inline__ u8 GetByte (ac3_byte_stream_t * p_byte_stream)
{
/* Are there some bytes left in the current buffer ? */
if (p_byte_stream->p_byte >= p_byte_stream->p_end) {
/* no, switch to next buffer */
ac3_byte_stream_next (p_byte_stream);
if (p_byte_stream->p_byte >= p_byte_stream->p_end)
{
/* no, switch to next buffer */
ac3_byte_stream_next (p_byte_stream);
}
return *(p_byte_stream->p_byte++);
......@@ -33,9 +34,10 @@ static __inline__ u8 GetByte (ac3_byte_stream_t * p_byte_stream)
static __inline__ void NeedBits (ac3_bit_stream_t * p_bit_stream, int i_bits)
{
while (p_bit_stream->i_available < i_bits) {
while (p_bit_stream->i_available < i_bits)
{
p_bit_stream->buffer |=
((u32)GetByte (&p_bit_stream->byte_stream)) << (24 - p_bit_stream->i_available);
((u32)GetByte (&p_bit_stream->byte_stream)) << (24 - p_bit_stream->i_available);
p_bit_stream->i_available += 8;
}
}
......
......@@ -26,9 +26,9 @@
typedef struct ac3dec_s ac3dec_t;
typedef struct ac3_sync_info_s {
int sample_rate; /* sample rate in Hz */
int frame_size; /* frame size in bytes */
int bit_rate; /* nominal bit rate in kbps */
int sample_rate; /* sample rate in Hz */
int frame_size; /* frame size in bytes */
int bit_rate; /* nominal bit rate in kbps */
} ac3_sync_info_t;
typedef struct ac3_byte_stream_s {
......@@ -335,40 +335,44 @@ typedef struct audblk_s {
* approximate a 1/6 octave scale.
*/
typedef struct stream_coeffs_s {
typedef struct stream_coeffs_s
{
float fbw[5][256];
float lfe[256];
} stream_coeffs_t;
typedef struct stream_samples_s {
typedef struct stream_samples_s
{
float channel[6][256];
} stream_samples_t;
typedef struct ac3_bit_stream_s {
typedef struct ac3_bit_stream_s
{
u32 buffer;
int i_available;
ac3_byte_stream_t byte_stream;
unsigned int total_bits_read; /* temporary */
unsigned int total_bits_read; /* temporary */
} ac3_bit_stream_t;
struct ac3dec_s {
struct ac3dec_s
{
/*
* Input properties
*/
/* The bit stream structure handles the PES stream at the bit level */
ac3_bit_stream_t bit_stream;
ac3_bit_stream_t bit_stream;
/*
* Decoder properties
*/
syncinfo_t syncinfo;
bsi_t bsi;
audblk_t audblk;
syncinfo_t syncinfo;
bsi_t bsi;
audblk_t audblk;
stream_coeffs_t coeffs;
stream_samples_t samples;
stream_coeffs_t coeffs;
stream_samples_t samples;
};
/**** ac3 decoder inline functions ****/
......
......@@ -2,7 +2,7 @@
* ac3_decoder_thread.h : ac3 decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: ac3_decoder_thread.h,v 1.2 2000/12/21 13:25:50 massiot Exp $
* $Id: ac3_decoder_thread.h,v 1.3 2001/01/05 14:45:47 sam Exp $
*
* Authors:
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -37,7 +37,7 @@ typedef struct ac3dec_thread_s
*/
decoder_fifo_t * p_fifo; /* stores the PES stream data */
data_packet_t * p_data;
int sync_ptr; /* sync ptr from ac3 magic header */
int sync_ptr; /* sync ptr from ac3 magic header */
adec_config_t * p_config;
/*
......
This diff is collapsed.
......@@ -36,41 +36,48 @@
#include "ac3_internal.h"
static const s16 exps_1[128] =
{ -2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
{
-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
0, 0, 0 };
0, 0, 0
};
static const s16 exps_2[128] =
{ -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
{
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
-2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
0, 0, 0 };
0, 0, 0
};
static const s16 exps_3[128] =
{ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
{
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
0, 0, 0 };
0, 0, 0
};
#define UNPACK_FBW 1
#define UNPACK_CPL 2
#define UNPACK_LFE 4
static __inline__ int exp_unpack_ch (ac3dec_t * p_ac3dec, u16 type,
u16 expstr, u16 ngrps, u16 initial_exp,
u16 exps[], u16 * dest)
u16 expstr, u16 ngrps, u16 initial_exp,
u16 exps[], u16 * dest)
{
u16 i,j;
s16 exp_acc;
if (expstr == EXP_REUSE) {
if (expstr == EXP_REUSE)
{
return 0;
}
......@@ -80,68 +87,76 @@ static __inline__ int exp_unpack_ch (ac3dec_t * p_ac3dec, u16 type,
/* In the case of a fbw channel then the initial absolute values is
* also an exponent */
if (type != UNPACK_CPL) {
if (type != UNPACK_CPL)
{
dest[j++] = exp_acc;
}
/* Loop through the groups and fill the dest array appropriately */
switch (expstr) {
case EXP_D15: /* 1 */
for (i = 0; i < ngrps; i++) {
if (exps[i] > 124) {
intf_ErrMsg ( "ac3dec error: invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
}
break;
case EXP_D25: /* 2 */
for (i = 0; i < ngrps; i++) {
if (exps[i] > 124) {
intf_ErrMsg ( "ac3dec error: invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
}
break;
case EXP_D45: /* 3 */
for (i = 0; i < ngrps; i++) {
if (exps[i] > 124) {
intf_ErrMsg ( "ac3dec error: invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
}
break;
switch (expstr)
{
case EXP_D15: /* 1 */
for (i = 0; i < ngrps; i++)
{
if (exps[i] > 124)
{
intf_ErrMsg ( "ac3dec error: invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
}
break;
case EXP_D25: /* 2 */
for (i = 0; i < ngrps; i++)
{
if (exps[i] > 124)
{
intf_ErrMsg ( "ac3dec error: invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
}
break;
case EXP_D45: /* 3 */
for (i = 0; i < ngrps; i++)
{
if (exps[i] > 124)
{
intf_ErrMsg ( "ac3dec error: invalid exponent" );
return 1;
}
exp_acc += (exps_1[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_2[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
exp_acc += (exps_3[exps[i]] /*- 2*/);
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
dest[j++] = exp_acc;
}
break;
}
return 0;
......@@ -151,31 +166,41 @@ int exponent_unpack (ac3dec_t * p_ac3dec)
{
u16 i;
for (i = 0; i < p_ac3dec->bsi.nfchans; i++) {
if (exp_unpack_ch (p_ac3dec, UNPACK_FBW, p_ac3dec->audblk.chexpstr[i],
p_ac3dec->audblk.nchgrps[i],
p_ac3dec->audblk.exps[i][0],
&p_ac3dec->audblk.exps[i][1],
p_ac3dec->audblk.fbw_exp[i]))
return 1;
for (i = 0; i < p_ac3dec->bsi.nfchans; i++)
{
if (exp_unpack_ch (p_ac3dec, UNPACK_FBW, p_ac3dec->audblk.chexpstr[i],
p_ac3dec->audblk.nchgrps[i],
p_ac3dec->audblk.exps[i][0],
&p_ac3dec->audblk.exps[i][1],
p_ac3dec->audblk.fbw_exp[i]))
{
return 1;
}
}
if (p_ac3dec->audblk.cplinu) {
if (p_ac3dec->audblk.cplinu)
{
if (exp_unpack_ch (p_ac3dec, UNPACK_CPL, p_ac3dec->audblk.cplexpstr,
p_ac3dec->audblk.ncplgrps,
p_ac3dec->audblk.cplabsexp << 1,
p_ac3dec->audblk.cplexps,
&p_ac3dec->audblk.cpl_exp[p_ac3dec->audblk.cplstrtmant]))
return 1;
p_ac3dec->audblk.ncplgrps,
p_ac3dec->audblk.cplabsexp << 1,
p_ac3dec->audblk.cplexps,
&p_ac3dec->audblk.cpl_exp[p_ac3dec->audblk.cplstrtmant]))
{
return 1;
}
}
if (p_ac3dec->bsi.lfeon) {
if (p_ac3dec->bsi.lfeon)
{
if (exp_unpack_ch (p_ac3dec, UNPACK_LFE, p_ac3dec->audblk.lfeexpstr,
2, p_ac3dec->audblk.lfeexps[0],
&p_ac3dec->audblk.lfeexps[1],
p_ac3dec->audblk.lfe_exp))
return 1;
2, p_ac3dec->audblk.lfeexps[0],
&p_ac3dec->audblk.lfeexps[1],
p_ac3dec->audblk.lfe_exp))
{
return 1;
}
}
return 0;
}
......@@ -21,16 +21,16 @@
*****************************************************************************/
/* Exponent strategy constants */
#define EXP_REUSE (0)
#define EXP_D15 (1)
#define EXP_D25 (2)
#define EXP_D45 (3)
#define EXP_REUSE (0)
#define EXP_D15 (1)
#define EXP_D25 (2)
#define EXP_D45 (3)
/* Delta bit allocation constants */
#define DELTA_BIT_REUSE (0)
#define DELTA_BIT_NEW (1)
#define DELTA_BIT_NONE (2)
#define DELTA_BIT_RESERVED (3)
#define DELTA_BIT_REUSE (0)
#define DELTA_BIT_NEW (1)
#define DELTA_BIT_NONE (2)
#define DELTA_BIT_RESERVED (3)
/* ac3_bit_allocate.c */
void bit_allocate (ac3dec_t *);
......
This diff is collapsed.
This diff is collapsed.
......@@ -24,8 +24,8 @@ static __inline__ u8 GetByte (adec_bit_stream_t * p_bit_stream)
{
/* Are there some bytes left in the current buffer ? */
if (p_bit_stream->byte_stream.p_byte >= p_bit_stream->byte_stream.p_end) {
/* no, switch to next buffer */
adec_byte_stream_next (&p_bit_stream->byte_stream);
/* no, switch to next buffer */
adec_byte_stream_next (&p_bit_stream->byte_stream);
}
p_bit_stream->total_bytes_read++;
......@@ -37,7 +37,7 @@ static __inline__ void NeedBits (adec_bit_stream_t * p_bit_stream, int i_bits)
{
while (p_bit_stream->i_available < i_bits) {
p_bit_stream->buffer |=
((u32)GetByte (p_bit_stream)) << (24 - p_bit_stream->i_available);
((u32)GetByte (p_bit_stream)) << (24 - p_bit_stream->i_available);
p_bit_stream->i_available += 8;
}
}
......
......@@ -26,9 +26,9 @@
typedef struct audiodec_s audiodec_t;
typedef struct adec_sync_info_s {
int sample_rate; /* sample rate in Hz */
int frame_size; /* frame size in bytes */
int bit_rate; /* nominal bit rate in kbps */
int sample_rate; /* sample rate in Hz */
int frame_size; /* frame size in bytes */
int bit_rate; /* nominal bit rate in kbps */
} adec_sync_info_t;
typedef struct adec_byte_stream_s {
......@@ -72,13 +72,13 @@ struct audiodec_s {
*/
/* The bit stream structure handles the PES stream at the bit level */
adec_bit_stream_t bit_stream;
adec_bit_stream_t bit_stream;
/*
* Decoder properties
*/
u32 header;
int frame_size;
u32 header;
int frame_size;
adec_bank_t bank_0;
adec_bank_t bank_1;
};
......
......@@ -51,7 +51,9 @@ int main (void)
memset (&decoder, 0, sizeof (decoder));
if (adec_init (&decoder))
return 1;
{
return 1;
}
stream = adec_byte_stream (&decoder);
stream->p_byte = NULL;
......@@ -60,17 +62,24 @@ int main (void)
framenum = 0;
while (1) {
int i;
while (1)
{
int i;
if (adec_sync_frame (&decoder, &sync_info))
return 1;
if (adec_decode_frame (&decoder, buffer))
return 1;
if (adec_sync_frame (&decoder, &sync_info))
{
return 1;
}
if (adec_decode_frame (&decoder, buffer))
{
return 1;
}
#if 1
for (i = 0; i < (2*1152); i++)
fprintf ( stderr, "%04X\n",(u16)buffer[i] );
for (i = 0; i < (2*1152); i++)
{
fprintf ( stderr, "%04X\n",(u16)buffer[i] );
}
#endif
}
......@@ -86,11 +95,14 @@ void adec_byte_stream_next (adec_byte_stream_t * p_byte_stream)
fd = p_byte_stream->info;
size = fread (buffer, 1, 1024, fd);
if (size) {
p_byte_stream->p_byte = buffer;
p_byte_stream->p_end = buffer + size;
} else { /* end of stream, read dummy zeroes */
p_byte_stream->p_byte = &dummy;
p_byte_stream->p_end = &dummy + 1;
if (size)
{
p_byte_stream->p_byte = buffer;
p_byte_stream->p_end = buffer + size;
}
else
{ /* end of stream, read dummy zeroes */
p_byte_stream->p_byte = &dummy;
p_byte_stream->p_end = &dummy + 1;
}
}
......@@ -2,7 +2,7 @@
* audio_decoder.h : audio decoder thread interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: audio_decoder.h,v 1.3 2000/12/21 13:25:50 massiot Exp $
* $Id: audio_decoder.h,v 1.4 2001/01/05 14:45:47 sam Exp $
*
* Authors:
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -43,7 +43,7 @@ typedef struct adec_thread_s
/*
* Decoder properties
*/
audiodec_t audio_decoder;
audiodec_t audio_decoder;
/*
* Output properties
......
......@@ -4,7 +4,7 @@
* decoders.
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: input.c,v 1.64 2000/12/22 13:04:44 sam Exp $
* $Id: input.c,v 1.65 2001/01/05 14:45:47 sam Exp $
*
* Authors:
*
......@@ -80,7 +80,8 @@ input_thread_t *input_CreateThread ( input_config_t * p_config, int *pi_status )
p_input = (input_thread_t *)malloc( sizeof(input_thread_t) );
if( p_input == NULL )
{
intf_ErrMsg("error: %s", strerror(errno));
intf_ErrMsg( "input error: can't allocate input thread (%s)",
strerror(errno) );
free( p_config );
return( NULL );
}
......@@ -112,7 +113,8 @@ input_thread_t *input_CreateThread ( input_config_t * p_config, int *pi_status )
if( vlc_thread_create( &p_input->thread_id, "input", (void *) RunThread,
(void *) p_input ) )
{
intf_ErrMsg("error: %s", strerror(errno) );
intf_ErrMsg( "input error: can't create input thread (%s)",
strerror(errno) );
free( p_input );
free( p_config );
return( NULL );
......@@ -245,7 +247,7 @@ static void InitThread( input_thread_t * p_input )
case INPUT_METHOD_VLAN_BCAST: /* vlan network method */
/* if( !p_main->b_vlans )
{
intf_ErrMsg("error: vlans are not activated");
intf_ErrMsg("input error: vlans are not activated");
free( p_input );
return( NULL );
} */ /* la-lala */
......@@ -257,7 +259,8 @@ static void InitThread( input_thread_t * p_input )
break;
#ifdef DEBUG
default:
intf_ErrMsg("Unknow input method");
intf_ErrMsg( "input error: unknow method 0x%.4x",
p_input->p_config->i_method );
free( p_input->p_config );
p_input->b_error = 1;
break;
......@@ -344,63 +347,49 @@ static void FileOpen( input_thread_t * p_input )
#define p_config p_input->p_config
if( !strncmp( p_config->p_source, "-", 1 ) )
if( stat( p_config->p_source, &stat_info ) == (-1) )
{
intf_ErrMsg( "input error: cannot stat() file %s (%s)",
p_config->p_source, strerror(errno));
p_input->b_error = 1;
return;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
/* If we are here we can control the pace... */
p_input->stream.b_pace_control = 1;
if( S_ISREG(stat_info.st_mode) || S_ISCHR(stat_info.st_mode)
|| S_ISBLK(stat_info.st_mode) )
{
p_input->stream.b_seekable = 1;
p_input->stream.i_size = stat_info.st_size;
}
else if( S_ISFIFO(stat_info.st_mode) || S_ISSOCK(stat_info.st_mode) )
{
/* stdin */
p_input->i_handle = 0;
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_pace_control = 1;
p_input->stream.b_seekable = 0;
p_input->stream.i_size = 0;
p_input->stream.i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
}
else
{
if( stat( p_config->p_source, &stat_info ) == (-1) )
{
intf_ErrMsg("Cannot stat() file %s (%s)", p_config->p_source,
strerror(errno));
p_input->b_error = 1;
return;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
/* If we are here we can control the pace... */
p_input->stream.b_pace_control = 1;
if( S_ISREG(stat_info.st_mode) || S_ISCHR(stat_info.st_mode)
|| S_ISBLK(stat_info.st_mode) )
{
p_input->stream.b_seekable = 1;
p_input->stream.i_size = stat_info.st_size;
}
else if( S_ISFIFO(stat_info.st_mode) || S_ISSOCK(stat_info.st_mode) )
{
p_input->stream.b_seekable = 0;
p_input->stream.i_size = 0;
}
else
{
vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_ErrMsg("Unknown file type");
p_input->b_error = 1;
return;
}
p_input->stream.i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_ErrMsg( "input error: unknown file type for %s",
p_config->p_source );
p_input->b_error = 1;
return;
}
intf_Msg( "Opening file %s", p_config->p_source );
if( (p_input->i_handle = open( p_config->p_source,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
{
intf_ErrMsg("Cannot open file (%s)", strerror(errno));
p_input->b_error = 1;
return;
}
p_input->stream.i_tell = 0;
vlc_mutex_unlock( &p_input->stream.stream_lock );
intf_Msg( "Opening file %s", p_config->p_source );
if( (p_input->i_handle = open( p_config->p_source,
/*O_NONBLOCK | O_LARGEFILE*/0 )) == (-1) )
{
intf_ErrMsg( "input error: cannot open file %s", strerror(errno) );
p_input->b_error = 1;
return;
}
#undef p_config
......
......@@ -100,7 +100,8 @@ intf_thread_t* intf_Create( void )
p_intf = malloc( sizeof( intf_thread_t ) );
if( !p_intf )
{
intf_ErrMsg("error: %s", strerror( ENOMEM ) );
intf_ErrMsg( "intf error: cannot create interface thread (%s)",
strerror( ENOMEM ) );
return( NULL );
}
......@@ -127,7 +128,7 @@ intf_thread_t* intf_Create( void )
if( i_best_score == 0 )
{
free( p_intf );
intf_ErrMsg( "error: no suitable plugin to create interface" );
intf_ErrMsg( "intf error: no suitable plugin" );
return( NULL );
}
......@@ -153,13 +154,13 @@ intf_thread_t* intf_Create( void )
p_intf->p_console = intf_ConsoleCreate();
if( p_intf->p_console == NULL )
{
intf_ErrMsg("error: can't create control console");
intf_ErrMsg( "intf error: cannot create control console" );
free( p_intf );
return( NULL );
}
if( p_intf->p_sys_create( p_intf ) )
{
intf_ErrMsg("error: can't create interface");
intf_ErrMsg("intf error: cannot create interface");
intf_ConsoleDestroy( p_intf->p_console );
free( p_intf );
return( NULL );
......@@ -188,7 +189,7 @@ void intf_Run( intf_thread_t *p_intf )
if( (p_input_config =
(input_config_t *)malloc( sizeof(input_config_t) )) == NULL )
{
intf_ErrMsg("Out of memory");
intf_ErrMsg( "intf error: cannot create input_config_t" );
}
else
{
......@@ -206,7 +207,7 @@ void intf_Run( intf_thread_t *p_intf )
if( (p_input_config =
(input_config_t *)malloc( sizeof(input_config_t) )) == NULL )
{
intf_ErrMsg("Out of memory");
intf_ErrMsg( "intf error: cannot create input_config_t" );
}
else
{
......@@ -222,7 +223,7 @@ void intf_Run( intf_thread_t *p_intf )
* the script could be executed but failed */
else if( intf_ExecScript( main_GetPszVariable( INTF_INIT_SCRIPT_VAR, INTF_INIT_SCRIPT_DEFAULT ) ) > 0 )
{
intf_ErrMsg("warning: error(s) during startup script");
intf_ErrMsg( "intf error: errors occured during startup script" );
}
/* Main loop */
......@@ -562,7 +563,8 @@ static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
p_file = fopen( psz_filename, "r" );
if( p_file == NULL )
{
intf_ErrMsg("error: can't open %s (%s)", psz_filename, strerror(errno));
intf_ErrMsg( "intf error: cannot open %s (%s)",
psz_filename, strerror(errno) );
return( 1 );
}
......@@ -580,7 +582,8 @@ static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
p_intf->p_channel = malloc( sizeof( intf_channel_t ) * i_index );
if( p_intf->p_channel == NULL )
{
intf_ErrMsg("error: %s", strerror(ENOMEM));
intf_ErrMsg( "intf error: cannot create intf_channel_t (%s)",
strerror(ENOMEM) );
fclose( p_file );
return( 1 );
}
......@@ -689,7 +692,8 @@ static int ParseChannel( intf_channel_t *p_channel, char *psz_str )
p_channel->psz_description = malloc( i_field_length + 1 );
if( p_channel->psz_description == NULL )
{
intf_ErrMsg("error: %s", strerror( ENOMEM ));
intf_ErrMsg( "intf error: cannot create channel "
"description (%s)", strerror( ENOMEM ) );
i_field = -1;
}
else
......@@ -712,7 +716,8 @@ static int ParseChannel( intf_channel_t *p_channel, char *psz_str )
p_channel->psz_input_source = malloc( i_field_length + 1 );
if( p_channel->psz_input_source == NULL )
{
intf_ErrMsg("error: %s", strerror( ENOMEM ));
intf_ErrMsg( "intf error: cannot create input "
"source (%s)", strerror( ENOMEM ) );
i_field = -1;
}
else
......
......@@ -121,7 +121,7 @@ int intf_ExecCommand( char *psz_cmd )
{
case INTF_FATAL_ERROR: /* fatal error */
/* Print message and terminates the interface thread */
intf_ErrMsg( "fatal error in command `%s'", psz_argv[0] );
intf_ErrMsg( "intf error: fatal error in command `%s'", psz_argv[0] );
p_main->p_intf->b_die = 1;
break;
......@@ -129,9 +129,8 @@ int intf_ExecCommand( char *psz_cmd )
/* Print message, flush messages queue and exit. Note that this
* error should be very rare since it does not even try to cancel
* other threads... */
intf_ErrMsg( "critical error in command `%s', "
"please report this error !", psz_argv[0] );
intf_FlushMsg();
intf_ErrMsgImm( "intf error: critical error in command `%s', "
"please report this error !", psz_argv[0] );
exit( INTF_CRITICAL_ERROR );
break;
......@@ -203,7 +202,7 @@ int intf_ExecScript( char *psz_filename )
}
if( !feof( p_file ) )
{
intf_ErrMsg("error: %s: %s", psz_vlcrc, strerror(errno));
intf_ErrMsg( "intf error: %s: %s", psz_vlcrc, strerror(errno));
return( -1 );
}
......@@ -500,7 +499,8 @@ static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
#ifdef DEBUG
else /* error: missing type specifier */
{
intf_ErrMsg("error: missing type specifier for `%s' (0x%x)", psz_str, i_flags);
intf_ErrMsg( "intf error: missing type specifier for `%s' (0x%x)",
psz_str, i_flags );
return( 1 );
}
#endif
......
......@@ -392,14 +392,15 @@ void main_PutPszVariable( char *psz_name, char *psz_value )
psz_env = malloc( strlen(psz_name) + strlen(psz_value) + 2 );
if( psz_env == NULL )
{
intf_ErrMsg( "error: %s", strerror(ENOMEM) );
intf_ErrMsg( "intf error: cannot create psz_env (%s)",
strerror(ENOMEM) );
}
else
{
sprintf( psz_env, "%s=%s", psz_name, psz_value );
if( putenv( psz_env ) )
{
intf_ErrMsg( "error: %s", strerror(errno) );
intf_ErrMsg( "intf error: cannot putenv (%s)", strerror(errno) );
}
}
}
......@@ -437,9 +438,6 @@ static void SetDefaultConfiguration( void )
p_main->b_audio = 1;
p_main->b_video = 1;
p_main->b_vlans = 0;
/* This is |_|lt1m4t3 |<l|_|d63 */
main_PutIntVariable( INPUT_DVD_SUBTITLE_VAR, -1 );
}
/*****************************************************************************
......@@ -757,7 +755,7 @@ static void FatalSignalHandler( int i_signal )
signal( SIGQUIT, SIG_IGN );
/* Acknowledge the signal received */
intf_ErrMsgImm("intf: signal %d received, exiting", i_signal );
intf_ErrMsgImm("intf error: signal %d received, exiting", i_signal );
/* Try to terminate everything - this is done by requesting the end of the
* interface thread */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment