]> git.sesse.net Git - vlc/commitdiff
Je vous avais pr�venu. Le demoronifier a frapp�.
authorSam Hocevar <sam@videolan.org>
Sun, 13 Feb 2000 04:31:35 +0000 (04:31 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 13 Feb 2000 04:31:35 +0000 (04:31 +0000)
 D�sol� pour le flood. Les en-t�tes de fonctions ne font plus 81
caract�res, et il n'y a plus d'espaces inutiles, Tous les trailing
spaces ont disparu, j'ai essay� de v�rifier que �a ne p�tait rien,
mais j'ai pu oublier un truc con. J'accepte tous types de ch�timents
� base d'orties fra�ches.

 D�sol� d'avoir aussi modifi� les fichiers de ceux qui formataient
bien proprement leurs en-t�tes � 80 et pas 79 sans emb�ter personne,
mais j'ai d� choisir entre les deux.

 Dor�navant ce serait bien de formater les en-t�tes et les commentaires
justifi�s � droite � 79 colonnes, ou au pire � 80.

 . 1343 moronic long lines destroyed
 . 12893 trailing spaces eradicated
 . 115 ugly macros fixed
 . 959 innocent a_bit_long lines shortened
 But hey, 40054 lines were OK !

97 files changed:
include/ac3_decoder.h
include/audio_constants.h
include/audio_decoder.h
include/audio_dsp.h
include/audio_math.h
include/audio_output.h
include/common.h
include/config.h
include/control.h
include/debug.h
include/decoder_fifo.h
include/generic_decoder.h
include/input.h
include/input_ctrl.h
include/input_file.h
include/input_netlist.h
include/input_network.h
include/input_pcr.h
include/input_psi.h
include/input_vlan.h
include/interface.h
include/intf_cmd.h
include/intf_console.h
include/intf_ctrl.h
include/intf_msg.h
include/intf_sys.h
include/main.h
include/mtime.h
include/netutils.h
include/rsc_files.h
include/spu_decoder.h
include/vdec_idct.h
include/vdec_motion.h
include/video.h
include/video_decoder.h
include/video_fifo.h
include/video_graphics.h
include/video_output.h
include/video_parser.h
include/video_sys.h
include/video_text.h
include/video_x11.h
include/video_yuv.h
include/vlc.h
include/vlc_thread.h
include/vpar_blocks.h
include/vpar_headers.h
include/vpar_synchro.h
src/ac3_decoder/ac3_bit_allocate.c
src/ac3_decoder/ac3_downmix.c
src/ac3_decoder/ac3_exponent.c
src/ac3_decoder/ac3_imdct.c
src/ac3_decoder/ac3_parse.c
src/ac3_decoder/ac3_rematrix.c
src/audio_decoder/audio_decoder.c
src/audio_decoder/audio_math.c
src/audio_output/audio_dsp.c
src/audio_output/audio_output.c
src/generic_decoder/generic_decoder.c
src/input/input.c
src/input/input_ctrl.c
src/input/input_file.c
src/input/input_netlist.c
src/input/input_network.c
src/input/input_pcr.c
src/input/input_psi.c
src/input/input_vlan.c
src/interface/control.c
src/interface/interface.c
src/interface/intf_3dfx.c
src/interface/intf_cmd.c
src/interface/intf_console.c
src/interface/intf_ctrl.c
src/interface/intf_msg.c
src/interface/main.c
src/misc/mtime.c
src/misc/netutils.c
src/misc/rsc_files.c
src/spu_decoder/spu_decoder.c
src/video_decoder/idctmmx.S
src/video_decoder/vdec_idct.c
src/video_decoder/vdec_motion.c
src/video_decoder/video_decoder.c
src/video_output/video_3dfx.c
src/video_output/video_dummy.c
src/video_output/video_fb.c
src/video_output/video_ggi.c
src/video_output/video_output.c
src/video_output/video_text.c
src/video_output/video_x11.c
src/video_output/video_yuv.c
src/video_output/video_yuv_mmx.S
src/video_parser/video_fifo.c
src/video_parser/video_parser.c
src/video_parser/vpar_blocks.c
src/video_parser/vpar_headers.c
src/video_parser/vpar_synchro.c

index f7b7082953ba5c1e7640dce29d8d64abe2631d67..df840ef9b5acb5b8769d025e762ea1049d5fc5e6 100644 (file)
@@ -279,7 +279,7 @@ typedef struct audblk_s
 
        /* Bit allocation pointer results */
        u16 fbw_bap[5][256];
-       //FIXME figure out exactly how many entries there should be (253-37?) 
+       //FIXME figure out exactly how many entries there should be (253-37?)
        u16 cpl_bap[256];
        u16 lfe_bap[7];
 
index 03daaec4bcd1bbb959974580306788dd5d579b0c..1d4893beec005dc31efb3dabc83e72450c515cbc 100644 (file)
@@ -1,12 +1,12 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_constants.h : defines the MPEG1 Layer I-II audio constants and tables
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
 
-/******************************************************************************
+/*****************************************************************************
  * 32 bits (4 bytes) audio frame header definitions
- ******************************************************************************/
+ *****************************************************************************/
 /*
  * syncword == `1111 1111 1111'
  */
@@ -91,9 +91,9 @@
 #define ADEC_HEADER_EMPHASIS_SHIFT              0
 
 
-/******************************************************************************
+/*****************************************************************************
  * frame sizes = f( layer, padding_bit, sampling_frequency, bitrate_index )
- ******************************************************************************
+ *****************************************************************************
  * ISO/IEC 11172-3 2.4.3.1 explains how to find out the number of bytes between
  * two consecutive syncwords. In order to work out the body size of the frame,
  * we just have to substract 4 bytes for the header size.
  *
  * The frame sizes are stored in the following array :
  * frame_size = ADEC_FRAME_SIZE[ 128*layer + 64*padding_bit + 16*sampling_frequency + bitrate_index ]
- ******************************************************************************/
+ *****************************************************************************/
 #if 0
 #define ADEC_FRAME_SIZE \
 { \
 #endif
 
 
-/******************************************************************************
+/*****************************************************************************
  * scale factors = f( scalefactor ) (Layer I & II, see ISO/IEC 11172-3 2.4.1)
- ******************************************************************************
+ *****************************************************************************
  * Theses values are 2^(1 - index/3) (see ISO/IEC 11172-3 2.4.2.5)
- ******************************************************************************/
+ *****************************************************************************/
 #define ADEC_SCALE_FACTOR \
 { \
-    /* 0*/ 2.00000000000000, /* 1*/ 1.58740105196820, /* 2*/ 1.25992104989487, \
-    /* 3*/ 1.00000000000000, /* 4*/ 0.79370052598410, /* 5*/ 0.62996052494744, \
-    /* 6*/ 0.50000000000000, /* 7*/ 0.39685026299205, /* 8*/ 0.31498026247372, \
-    /* 9*/ 0.25000000000000, /*10*/ 0.19842513149602, /*11*/ 0.15749013123686, \
-    /*12*/ 0.12500000000000, /*13*/ 0.09921256574801, /*14*/ 0.07874506561843, \
-    /*15*/ 0.06250000000000, /*16*/ 0.04960628287401, /*17*/ 0.03937253280921, \
-    /*18*/ 0.03125000000000, /*19*/ 0.02480314143700, /*20*/ 0.01968626640461, \
-    /*21*/ 0.01562500000000, /*22*/ 0.01240157071850, /*23*/ 0.00984313320230, \
-    /*24*/ 0.00781250000000, /*25*/ 0.00620078535925, /*26*/ 0.00492156660115, \
-    /*27*/ 0.00390625000000, /*28*/ 0.00310039267963, /*29*/ 0.00246078330058, \
-    /*30*/ 0.00195312500000, /*31*/ 0.00155019633981, /*32*/ 0.00123039165029, \
-    /*33*/ 0.00097656250000, /*34*/ 0.00077509816991, /*35*/ 0.00061519582514, \
-    /*36*/ 0.00048828125000, /*37*/ 0.00038754908495, /*38*/ 0.00030759791257, \
-    /*39*/ 0.00024414062500, /*40*/ 0.00019377454248, /*41*/ 0.00015379895629, \
-    /*42*/ 0.00012207031250, /*43*/ 0.00009688727124, /*44*/ 0.00007689947814, \
-    /*45*/ 0.00006103515625, /*46*/ 0.00004844363562, /*47*/ 0.00003844973907, \
-    /*48*/ 0.00003051757813, /*49*/ 0.00002422181781, /*50*/ 0.00001922486954, \
-    /*51*/ 0.00001525878906, /*52*/ 0.00001211090890, /*53*/ 0.00000961243477, \
-    /*54*/ 0.00000762939453, /*55*/ 0.00000605545445, /*56*/ 0.00000480621738, \
-    /*57*/ 0.00000381469727, /*58*/ 0.00000302772723, /*59*/ 0.00000240310869, \
-    /*60*/ 0.00000190734863, /*61*/ 0.00000151386361, /*62*/ 0.00000120155435, \
+    /* 0*/ 2.00000000000000, /* 1*/ 1.58740105196820, /* 2*/ 1.25992104989487,\
+    /* 3*/ 1.00000000000000, /* 4*/ 0.79370052598410, /* 5*/ 0.62996052494744,\
+    /* 6*/ 0.50000000000000, /* 7*/ 0.39685026299205, /* 8*/ 0.31498026247372,\
+    /* 9*/ 0.25000000000000, /*10*/ 0.19842513149602, /*11*/ 0.15749013123686,\
+    /*12*/ 0.12500000000000, /*13*/ 0.09921256574801, /*14*/ 0.07874506561843,\
+    /*15*/ 0.06250000000000, /*16*/ 0.04960628287401, /*17*/ 0.03937253280921,\
+    /*18*/ 0.03125000000000, /*19*/ 0.02480314143700, /*20*/ 0.01968626640461,\
+    /*21*/ 0.01562500000000, /*22*/ 0.01240157071850, /*23*/ 0.00984313320230,\
+    /*24*/ 0.00781250000000, /*25*/ 0.00620078535925, /*26*/ 0.00492156660115,\
+    /*27*/ 0.00390625000000, /*28*/ 0.00310039267963, /*29*/ 0.00246078330058,\
+    /*30*/ 0.00195312500000, /*31*/ 0.00155019633981, /*32*/ 0.00123039165029,\
+    /*33*/ 0.00097656250000, /*34*/ 0.00077509816991, /*35*/ 0.00061519582514,\
+    /*36*/ 0.00048828125000, /*37*/ 0.00038754908495, /*38*/ 0.00030759791257,\
+    /*39*/ 0.00024414062500, /*40*/ 0.00019377454248, /*41*/ 0.00015379895629,\
+    /*42*/ 0.00012207031250, /*43*/ 0.00009688727124, /*44*/ 0.00007689947814,\
+    /*45*/ 0.00006103515625, /*46*/ 0.00004844363562, /*47*/ 0.00003844973907,\
+    /*48*/ 0.00003051757813, /*49*/ 0.00002422181781, /*50*/ 0.00001922486954,\
+    /*51*/ 0.00001525878906, /*52*/ 0.00001211090890, /*53*/ 0.00000961243477,\
+    /*54*/ 0.00000762939453, /*55*/ 0.00000605545445, /*56*/ 0.00000480621738,\
+    /*57*/ 0.00000381469727, /*58*/ 0.00000302772723, /*59*/ 0.00000240310869,\
+    /*60*/ 0.00000190734863, /*61*/ 0.00000151386361, /*62*/ 0.00000120155435,\
     /*63*/ 0.0 /* ?? invalid scale factor ?? */ \
 }
 
 
-/******************************************************************************
+/*****************************************************************************
  * Layer I definitions
- ******************************************************************************/
+ *****************************************************************************/
 
 /*
  * slope table = f( allocation[ch][sb] (see ISO/IEC 11171-3 2.4.1) )
 }
 
 
-/******************************************************************************
+/*****************************************************************************
  * Layer II definitions
- ******************************************************************************/
+ *****************************************************************************/
 
 /*
  * Bitrate PER CHANNEL index = f( mode, bitrate_index )
  */
 #define ADEC_LAYER2_REQUANTIZATION_CD \
 { \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  0 */ \
-    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation ==  1 */ \
-    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation ==  2 */ \
-    {10, pf_ungroup9, .0               ,  .0           }, /* allocation ==  3 */ \
-    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation ==  4 */ \
-    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation ==  5 */ \
-    { 6,        NULL, .0317460317459   , -.984126984124}, /* allocation ==  6 */ \
-    { 7,        NULL, .0157480314961   , -.992125984254}, /* allocation ==  7 */ \
-    { 8,        NULL, .00784313725492  , -.996078431375}, /* allocation ==  8 */ \
-    { 9,        NULL, .00391389432484  , -.998043052835}, /* allocation ==  9 */ \
-    {10,        NULL, .00195503421311  , -.999022482897}, /* allocation == 10 */ \
-    {11,        NULL, .000977039570107 , -.99951148022 }, /* allocation == 11 */ \
-    {12,        NULL, .000488400488398 , -.999755799752}, /* allocation == 12 */ \
-    {13,        NULL, .000244170430962 , -.999877914789}, /* allocation == 13 */ \
-    {14,        NULL, .000122077763535 , -.999938961117}, /* allocation == 14 */ \
-    {15,        NULL, .000061037018952 , -.999969481491}  /* allocation == 15 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  0 */ \
+    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation  1 */ \
+    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation  2 */ \
+    {10, pf_ungroup9, .0               ,  .0           }, /* allocation  3 */ \
+    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation  4 */ \
+    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation  5 */ \
+    { 6,        NULL, .0317460317459   , -.984126984124}, /* allocation  6 */ \
+    { 7,        NULL, .0157480314961   , -.992125984254}, /* allocation  7 */ \
+    { 8,        NULL, .00784313725492  , -.996078431375}, /* allocation  8 */ \
+    { 9,        NULL, .00391389432484  , -.998043052835}, /* allocation  9 */ \
+    {10,        NULL, .00195503421311  , -.999022482897}, /* allocation 10 */ \
+    {11,        NULL, .000977039570107 , -.99951148022 }, /* allocation 11 */ \
+    {12,        NULL, .000488400488398 , -.999755799752}, /* allocation 12 */ \
+    {13,        NULL, .000244170430962 , -.999877914789}, /* allocation 13 */ \
+    {14,        NULL, .000122077763535 , -.999938961117}, /* allocation 14 */ \
+    {15,        NULL, .000061037018952 , -.999969481491}  /* allocation 15 */ \
 }
 
 #define ADEC_LAYER2_REQUANTIZATION_AB1 \
 { \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  0 */ \
-    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation ==  1 */ \
-    { 3,        NULL, .285714285715    , -.857142857145}, /* allocation ==  2 */ \
-    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation ==  3 */ \
-    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation ==  4 */ \
-    { 6,        NULL, .0317460317459   , -.984126984124}, /* allocation ==  5 */ \
-    { 7,        NULL, .0157480314961   , -.992125984254}, /* allocation ==  6 */ \
-    { 8,        NULL, .00784313725492  , -.996078431375}, /* allocation ==  7 */ \
-    { 9,        NULL, .00391389432484  , -.998043052835}, /* allocation ==  8 */ \
-    {10,        NULL, .00195503421311  , -.999022482897}, /* allocation ==  9 */ \
-    {11,        NULL, .000977039570107 , -.99951148022 }, /* allocation == 10 */ \
-    {12,        NULL, .000488400488398 , -.999755799752}, /* allocation == 11 */ \
-    {13,        NULL, .000244170430962 , -.999877914789}, /* allocation == 12 */ \
-    {14,        NULL, .000122077763535 , -.999938961117}, /* allocation == 13 */ \
-    {15,        NULL, .000061037018952 , -.999969481491}, /* allocation == 14 */ \
-    {16,        NULL, .0000305180437933, -.999984740976}  /* allocation == 15 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  0 */ \
+    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation  1 */ \
+    { 3,        NULL, .285714285715    , -.857142857145}, /* allocation  2 */ \
+    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation  3 */ \
+    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation  4 */ \
+    { 6,        NULL, .0317460317459   , -.984126984124}, /* allocation  5 */ \
+    { 7,        NULL, .0157480314961   , -.992125984254}, /* allocation  6 */ \
+    { 8,        NULL, .00784313725492  , -.996078431375}, /* allocation  7 */ \
+    { 9,        NULL, .00391389432484  , -.998043052835}, /* allocation  8 */ \
+    {10,        NULL, .00195503421311  , -.999022482897}, /* allocation  9 */ \
+    {11,        NULL, .000977039570107 , -.99951148022 }, /* allocation 10 */ \
+    {12,        NULL, .000488400488398 , -.999755799752}, /* allocation 11 */ \
+    {13,        NULL, .000244170430962 , -.999877914789}, /* allocation 12 */ \
+    {14,        NULL, .000122077763535 , -.999938961117}, /* allocation 13 */ \
+    {15,        NULL, .000061037018952 , -.999969481491}, /* allocation 14 */ \
+    {16,        NULL, .0000305180437933, -.999984740976}  /* allocation 15 */ \
 }
 
 #define ADEC_LAYER2_REQUANTIZATION_AB2 \
 { \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  0 */ \
-    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation ==  1 */ \
-    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation ==  2 */ \
-    { 3,        NULL, .285714285715    , -.857142857145}, /* allocation ==  3 */ \
-    {10, pf_ungroup9, .0               ,  .0           }, /* allocation ==  4 */ \
-    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation ==  5 */ \
-    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation ==  6 */ \
-    { 6,        NULL, .0317460317459   , -.984126984124}, /* allocation ==  7 */ \
-    { 7,        NULL, .0157480314961   , -.992125984254}, /* allocation ==  8 */ \
-    { 8,        NULL, .00784313725492  , -.996078431375}, /* allocation ==  9 */ \
-    { 9,        NULL, .00391389432484  , -.998043052835}, /* allocation == 10 */ \
-    {10,        NULL, .00195503421311  , -.999022482897}, /* allocation == 11 */ \
-    {11,        NULL, .000977039570107 , -.99951148022 }, /* allocation == 12 */ \
-    {12,        NULL, .000488400488398 , -.999755799752}, /* allocation == 13 */ \
-    {13,        NULL, .000244170430962 , -.999877914789}, /* allocation == 14 */ \
-    {16,        NULL, .0000305180437933, -.999984740976}  /* allocation == 15 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  0 */ \
+    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation  1 */ \
+    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation  2 */ \
+    { 3,        NULL, .285714285715    , -.857142857145}, /* allocation  3 */ \
+    {10, pf_ungroup9, .0               ,  .0           }, /* allocation  4 */ \
+    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation  5 */ \
+    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation  6 */ \
+    { 6,        NULL, .0317460317459   , -.984126984124}, /* allocation  7 */ \
+    { 7,        NULL, .0157480314961   , -.992125984254}, /* allocation  8 */ \
+    { 8,        NULL, .00784313725492  , -.996078431375}, /* allocation  9 */ \
+    { 9,        NULL, .00391389432484  , -.998043052835}, /* allocation 10 */ \
+    {10,        NULL, .00195503421311  , -.999022482897}, /* allocation 11 */ \
+    {11,        NULL, .000977039570107 , -.99951148022 }, /* allocation 12 */ \
+    {12,        NULL, .000488400488398 , -.999755799752}, /* allocation 13 */ \
+    {13,        NULL, .000244170430962 , -.999877914789}, /* allocation 14 */ \
+    {16,        NULL, .0000305180437933, -.999984740976}  /* allocation 15 */ \
 }
 
 #define ADEC_LAYER2_REQUANTIZATION_AB3 \
 { \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  0 */ \
-    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation ==  1 */ \
-    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation ==  2 */ \
-    { 3,        NULL, .285714285715    , -.857142857145}, /* allocation ==  3 */ \
-    {10, pf_ungroup9, .0               ,  .0           }, /* allocation ==  4 */ \
-    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation ==  5 */ \
-    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation ==  6 */ \
-    {16,        NULL, .0000305180437933, -.999984740976}, /* allocation ==  7 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  8 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  9 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 10 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 11 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 12 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 13 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 14 */ \
-    { 0,        NULL, .0               ,  .0           }  /* allocation == 15 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  0 */ \
+    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation  1 */ \
+    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation  2 */ \
+    { 3,        NULL, .285714285715    , -.857142857145}, /* allocation  3 */ \
+    {10, pf_ungroup9, .0               ,  .0           }, /* allocation  4 */ \
+    { 4,        NULL, .133333333332    , -.933333333328}, /* allocation  5 */ \
+    { 5,        NULL, .0645161290325   , -.967741935488}, /* allocation  6 */ \
+    {16,        NULL, .0000305180437933, -.999984740976}, /* allocation  7 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  8 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  9 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 10 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 11 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 12 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 13 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 14 */ \
+    { 0,        NULL, .0               ,  .0           }  /* allocation 15 */ \
 }
 
 #define ADEC_LAYER2_REQUANTIZATION_AB4 \
 { \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  0 */ \
-    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation ==  1 */ \
-    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation ==  2 */ \
-    {16,        NULL, .0000305180437933, -.999984740976}, /* allocation ==  3 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  4 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  5 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  6 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  7 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  8 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation ==  9 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 10 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 11 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 12 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 13 */ \
-    { 0,        NULL, .0               ,  .0           }, /* allocation == 14 */ \
-    { 0,        NULL, .0               ,  .0           }  /* allocation == 15 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  0 */ \
+    { 5, pf_ungroup3, .0               ,  .0           }, /* allocation  1 */ \
+    { 7, pf_ungroup5, .0               ,  .0           }, /* allocation  2 */ \
+    {16,        NULL, .0000305180437933, -.999984740976}, /* allocation  3 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  4 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  5 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  6 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  7 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  8 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation  9 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 10 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 11 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 12 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 13 */ \
+    { 0,        NULL, .0               ,  .0           }, /* allocation 14 */ \
+    { 0,        NULL, .0               ,  .0           }  /* allocation 15 */ \
 }
 
 #define ADEC_LAYER2_REQUANTIZATION_AB \
index 7d99258b24a3f817d16d3860a0048d8585dffad9..45ea6aa58a0b10caf0f79f0894052ad119d69b95 100644 (file)
@@ -1,7 +1,7 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_decoder.h : audio decoder thread interface
  * (c)1999 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * = Prototyped functions are implemented in audio_decoder/audio_decoder.c
  *
  * = Required headers :
@@ -16,7 +16,7 @@
  *
  * = - MSb = Most Significant bit
  *   - MSB = Most Significant Byte
- ******************************************************************************/
+ *****************************************************************************/
 
 /*
  * TODO :
 
 #define ADEC_FRAME_SIZE 384
 
-/******************************************************************************
+/*****************************************************************************
  * adec_frame_t
- ******************************************************************************/
+ *****************************************************************************/
 typedef s16 adec_frame_t[ ADEC_FRAME_SIZE ];
 
-/******************************************************************************
+/*****************************************************************************
  * adec_bank_t
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct adec_bank_s
 {
     float               v1[512];
@@ -45,24 +45,24 @@ typedef struct adec_bank_s
 
 } adec_bank_t;
 
-/******************************************************************************
+/*****************************************************************************
  * adec_thread_t : audio decoder thread descriptor
- ******************************************************************************
+ *****************************************************************************
  * This type describes an audio decoder thread
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct adec_thread_s
 {
     /*
      * Thread properties
      */
-    vlc_thread_t        thread_id;                 /* id for thread functions */
-    boolean_t           b_die;                                  /* `die' flag */
-    boolean_t           b_error;                              /* `error' flag */
+    vlc_thread_t        thread_id;                /* id for thread functions */
+    boolean_t           b_die;                                 /* `die' flag */
+    boolean_t           b_error;                             /* `error' flag */
 
     /*
      * Input properties
      */
-    decoder_fifo_t      fifo;                   /* stores the PES stream data */
+    decoder_fifo_t      fifo;                  /* stores the PES stream data */
     /* The bit stream structure handles the PES stream at the bit level */
     bit_stream_t        bit_stream;
 
@@ -75,13 +75,13 @@ typedef struct adec_thread_s
     /*
      * Output properties
      */
-    aout_fifo_t *       p_aout_fifo;  /* stores the decompressed audio frames */
-    aout_thread_t *     p_aout;            /* needed to create the audio fifo */
+    aout_fifo_t *       p_aout_fifo; /* stores the decompressed audio frames */
+    aout_thread_t *     p_aout;           /* needed to create the audio fifo */
 
 } adec_thread_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 adec_thread_t * adec_CreateThread       ( input_thread_t * p_input /* !! , aout_thread_t * p_aout !! */ );
 void            adec_DestroyThread      ( adec_thread_t * p_adec );
index 9b668c9108fb4a8a3c33e8f5aee3e87ea71e4b96..85d8d6d08a6adffdfce6c6aa9b5cde73cbee8860 100644 (file)
@@ -1,15 +1,15 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_dsp.h : header of the dsp functions library
  * (c)1999 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * Required headers:
  * - "common.h" ( byte_t )
  * - "audio_output.h" ( aout_dsp_t )
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int  aout_dspOpen       ( aout_dsp_t *p_dsp );
 int  aout_dspReset      ( aout_dsp_t *p_dsp );
 int  aout_dspSetFormat  ( aout_dsp_t *p_dsp );
index 4b9ca474aca65d02af452e2dc6d9b61141db8170..f68c9dbf727657753e57fc2240b1ae2dc88ce2fc 100644 (file)
@@ -1,11 +1,11 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_math.h : PCM and DCT
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 void     DCT32(float *x, adec_bank_t *b);
 void     PCM(adec_bank_t *b, s16 **pcm, int jump);
 
index e72b10f1c7a98e127c4a655a62c444b991ae7ce3..f12ac9e16b45d15bdc1d71f71ec4a1d0af920c63 100644 (file)
@@ -1,13 +1,13 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_output.h : audio output thread interface
  * (c)1999 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * Required headers:
  * - <sys/soundcard.h>                                       ( audio_buf_info )
  * - "common.h"                                                   ( boolean_t )
  * - "mtime.h"                                                      ( mtime_t )
  * - "vlc_thread.h"                                            ( vlc_thread_t )
- ******************************************************************************/
+ *****************************************************************************/
 
 /* TODO :
  *
@@ -59,9 +59,9 @@
 #define AOUT_FIFO_ISEMPTY( fifo )       ( (fifo).l_end_frame == (fifo).i_start_frame )
 #define AOUT_FIFO_ISFULL( fifo )        ( ((((fifo).l_end_frame + 1) - (fifo).l_start_frame) & AOUT_FIFO_SIZE) == 0 )
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dsp_t
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* Path to the audio output device (default is set to "/dev/dsp") */
@@ -81,13 +81,13 @@ typedef struct
 
 } aout_dsp_t;
 
-/******************************************************************************
+/*****************************************************************************
  * aout_increment_t
- ******************************************************************************
+ *****************************************************************************
  * This structure is used to keep the progression of an index up-to-date, in
  * order to avoid rounding problems and heavy computations, as the function
  * that handles this structure only uses additions.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* The remainder is used to keep track of the fractional part of the
@@ -109,9 +109,9 @@ typedef struct
 
 } aout_increment_t;
 
-/******************************************************************************
+/*****************************************************************************
  * aout_fifo_t
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* See the fifo types below */
@@ -155,9 +155,9 @@ typedef struct
 #define AOUT_ADEC_MONO_FIFO     3
 #define AOUT_ADEC_STEREO_FIFO   4
 
-/******************************************************************************
+/*****************************************************************************
  * aout_thread_t
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct aout_thread_s
 {
     vlc_thread_t        thread_id;
@@ -184,9 +184,9 @@ typedef struct aout_thread_s
 
 } aout_thread_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 aout_thread_t * aout_CreateThread       ( int *pi_status );
 void            aout_DestroyThread      ( aout_thread_t *p_aout, int *pi_status );
 
index d40741f2952c08eaaca91d00ff5fdca864e0da5b..e484a3201be6f55e9a5c9feedfaa1da6cb50c4d6 100644 (file)
@@ -1,16 +1,16 @@
-/*******************************************************************************
+/*****************************************************************************
  * common.h: common definitions
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Collection of usefull common types and macros definitions
- *******************************************************************************
+ *****************************************************************************
  * required headers:
  *  config.h
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Basic types definitions
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Basic types definitions */
 typedef signed char         s8;
@@ -23,16 +23,16 @@ typedef unsigned int        u32;
 typedef unsigned long long  u64;
 
 typedef u8                  byte_t;
+
 /* Boolean type */
 typedef int                 boolean_t;
 
 /* Counter for statistics and profiling */
 typedef unsigned long       count_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Classes declaration
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Interface */
 struct intf_thread_s;
@@ -76,9 +76,9 @@ typedef struct vdec_thread_s *          p_vdec_thread_t;
 typedef struct vpar_thread_s *          p_vpar_thread_t;
 typedef struct video_parser_s *         p_video_parser_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Macros and inline functions
- *******************************************************************************/
+ *****************************************************************************/
 
 /* CEIL: division with round to nearest greater integer */
 #define CEIL(n, d)  ( ((n) / (d)) + ( ((n) % (d)) ? 1 : 0) )
@@ -90,7 +90,7 @@ typedef struct video_parser_s *         p_video_parser_t;
 #define MAX(a, b)   ( ((a) > (b)) ? (a) : (b) )
 #define MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
 
-/* MSB (big endian)/LSB (little endian) convertions - network order is always 
+/* MSB (big endian)/LSB (little endian) convertions - network order is always
  * MSB, and should be used for both network communications and files. Note that
  * byte orders other than little and big endians are not supported, but only
  * the VAX seems to have such exotic properties - note that these 'functions'
@@ -101,13 +101,13 @@ typedef struct video_parser_s *         p_video_parser_t;
 #define hton16      htons
 #define hton32      htonl
 #define hton64(i)   ( ((u64)(htonl((i) & 0xffffffff)) << 32) | htonl(((i) >> 32) & 0xffffffff ) )
-#define ntoh16      ntohs                              
+#define ntoh16      ntohs
 #define ntoh32      ntohl
 #define ntoh64      hton64
 #elif __BYTE_ORDER == __BIG_ENDIAN
 #define hton16      htons
 #define hton32      htonl
-#define hton64(i)   ( i )                            
+#define hton64(i)   ( i )
 #define ntoh16      ntohs
 #define ntoh32      ntohl
 #define ntoh64(i)   ( i )
index 6ef4e910f7e8987d44c9b670186a99d1941376c8..5f48529c086e18db707bbb563f7d327da0f9e21f 100644 (file)
@@ -1,9 +1,9 @@
-/*******************************************************************************
+/*****************************************************************************
  * config.h: limits and configuration
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Defines all compilation-time configuration constants and size limits
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Conventions regarding names of symbols and variables
  * ----------------------------------------------------
  * - Symbols should begin with a prefix indicating in which module they are
  *   used, such as INTF_, VOUT_ or ADEC_.
  *
- * - Regarding environment variables, which are used as initialization parameters 
+ * - Regarding environment variables, which are used as initialization parameters
  *   for threads :
  *   + variable names should end with '_VAR'
  *   + environment variable default value should end with '_DEFAULT'
- *   + values having a special meaning with '_VAL' 
- *   
+ *   + values having a special meaning with '_VAL'
+ *
  */
 
-/*******************************************************************************
+/*****************************************************************************
  * Program information
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Program version and copyright message */
 #define COPYRIGHT_MESSAGE              "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN"
@@ -29,9 +29,9 @@
                                         "version " PROGRAM_VERSION " ( " PROGRAM_BUILD " )\n" \
                                         "compilation options: " PROGRAM_OPTIONS
 
-/*******************************************************************************
+/*****************************************************************************
  * General compilation options
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Define for DVB support - Note that some extensions or restrictions may be
  * incompatible with native MPEG2 streams */
@@ -50,9 +50,9 @@
 /* Define for unthreaded version of the program - ?? not yet implemented */
 //#define NO_THREAD
 
-/*******************************************************************************
+/*****************************************************************************
  * Debugging options - define or undefine symbols
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 /* General debugging support, which depends of the DEBUG define, is determined
  * in the Makefile */
@@ -72,9 +72,9 @@
 
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * General configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Automagically spawn input, audio and video threads ? */
 // ?? used ?
@@ -92,9 +92,9 @@
 #define FIFO_SIZE                       1023
 
 
-/*******************************************************************************
+/*****************************************************************************
  * Interface configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Environment variable used to store startup script name and default value */
 #define INTF_INIT_SCRIPT_VAR           "vlc_init"
 /* Title of the X11 window */
 #define VOUT_TITLE                      "VideoLAN Client"
 
-/*******************************************************************************
+/*****************************************************************************
  * Input thread configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 /* ?? */
 #define INPUT_IDLE_SLEEP                100000
  * INPUT_MAX_TS + 1 must be a power of 2, to optimize the %(INPUT_MAX_TS+1)
  * operation with a &INPUT_MAX_TS in the case of a fifo netlist.
  * It should be > number of fifos * FIFO_SIZE to avoid input deadlock. */
-#define INPUT_MAX_TS                    32767      /* INPUT_MAX_TS + 1 = 2^15 */
+#define INPUT_MAX_TS                    32767     /* INPUT_MAX_TS + 1 = 2^15 */
 
 /* Same thing with PES packets */
 #define INPUT_MAX_PES                   16383
 #define INPUT_PORT_DEFAULT              1234
 
 /*
- * Vlan method 
- */ 
+ * Vlan method
+ */
 
 /* Default network interface and environment variable */
 #define INPUT_IFACE_VAR                 "vlc_iface"
 #define INPUT_VLAN_PORT_VAR             "vlc_vlan_port"
 #define INPUT_VLAN_PORT_DEFAULT         6010
 
-/* Delay between vlan changes - this is required to avoid flooding the VLAN 
+/* Delay between vlan changes - this is required to avoid flooding the VLAN
  * server */
 #define INPUT_VLAN_CHANGE_DELAY         5000000
 
  * mark it to be presented */
 #define INPUT_PTS_DELAY                 2000000
 
-/*******************************************************************************
+/*****************************************************************************
  * Audio configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Environment variable used to store dsp device name, and default value */
 #define AOUT_DSP_VAR                    "vlc_dsp"
 
 /* Environment variable for output rate, and default value */
 #define AOUT_RATE_VAR                   "vlc_audio_rate"
-#define AOUT_RATE_DEFAULT               44100 
+#define AOUT_RATE_DEFAULT               44100
 
-/*******************************************************************************
+/*****************************************************************************
  * Video configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 /*
  * Default settings for video output threads
 /* Environment variable used in place of DISPLAY if available */
 #define VOUT_DISPLAY_VAR                "vlc_display"
 
-/* Default dimensions for display window - these dimensions are enough for the 
+/* Default dimensions for display window - these dimensions are enough for the
  * standard width and height broadcasted MPEG-2 streams */
 #define VOUT_WIDTH_VAR                  "vlc_width"
 #define VOUT_HEIGHT_VAR                 "vlc_height"
 #define VOUT_WIDTH_DEFAULT              640
 #define VOUT_HEIGHT_DEFAULT             480
 
-/* Maximum width of a scaled source picture - this should be relatively high, 
+/* Maximum width of a scaled source picture - this should be relatively high,
  * since higher stream values will result in no display at all. */
 #define VOUT_MAX_WIDTH                  4096
 
-/* Video heap size - remember that a decompressed picture is big 
+/* Video heap size - remember that a decompressed picture is big
  * (~1 Mbyte) before using huge values */
 #define VOUT_MAX_PICTURES               10
 
 /* Maximum number of active areas in a rendering buffer. Active areas are areas
- * of the picture which need to be cleared before re-using the buffer. If a 
+ * of the picture which need to be cleared before re-using the buffer. If a
  * picture, including its many additions such as subtitles, additionnal user
- * informations and interface, has too many active areas, some of them are 
+ * informations and interface, has too many active areas, some of them are
  * joined. */
 #define VOUT_MAX_AREAS                  5
 
  * Time settings
  */
 
-/* Time during which the thread will sleep if it has nothing to 
+/* Time during which the thread will sleep if it has nothing to
  * display (in micro-seconds) */
 #define VOUT_IDLE_SLEEP                 20000
 
 #define VOUT_FB_DEV_VAR                 "vlc_fb_dev"
 #define VOUT_FB_DEV_DEFAULT             "/dev/fb0"
 
-/*******************************************************************************
+/*****************************************************************************
  * Video parser configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 #define VPAR_IDLE_SLEEP                 100000
 
-/* Time to sleep when waiting for a buffer (from vout or the video fifo). 
+/* Time to sleep when waiting for a buffer (from vout or the video fifo).
  * It should be approximately the time needed to perform a complete picture
  * loop. Since it only happens when the video heap is full, it does not need
  * to be too low, even if it blocks the decoder. */
 /* Maximum number of macroblocks in a picture. */
 #define MAX_MB                          2048
 
-/*******************************************************************************
+/*****************************************************************************
  * Video decoder configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 //#define VDEC_SMP
 
 /* Maximum range of values out of the IDCT + motion compensation. */
 #define VDEC_CROPRANGE                  2048
 
-/*******************************************************************************
+/*****************************************************************************
  * Generic decoder configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 #define GDEC_IDLE_SLEEP                 100000
 
-/*******************************************************************************
+/*****************************************************************************
  * Messages and console interfaces configuration
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Maximal size of the message queue - in case of overflow, all messages in the
  * queue are printed by the calling thread */
index 9d6c3df73df4f7c97f71ba1cddf92c4f7ff842c5..def17409667765dce9f22dbed0cf346c246c8037 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * control.h: user control functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Library of functions common to all interfaces, allowing access to various
  * structures and settings. Interfaces should only use those functions
  * to read or write informations from other threads.
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
   *  <sys/uio.h>
  *  <X11/Xlib.h>
  *  "video_output.h"
  *  "xconsole.h"
  *  "interface.h"
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int     intf_SelectAudioStream  ( intf_thread_t *p_intf, int i_input, int i_id );
 void    intf_DeselectAudioStream( intf_thread_t *p_intf, int i_input, int i_id );
-int     intf_SelectVideoStream  ( intf_thread_t *p_intf, int i_input, 
+int     intf_SelectVideoStream  ( intf_thread_t *p_intf, int i_input,
                                   int i_vout, int i_id );
 void    intf_DeselectVideoStream( intf_thread_t *p_intf, int i_input, int i_id );
 
index cc02f8234bff4631ef12df165eb67c295dc39e3e..c237eac5a630812444208be4ac2e013d363321d2 100644 (file)
@@ -1,22 +1,22 @@
-/*******************************************************************************
+/*****************************************************************************
  * debug.h: vlc debug macros
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Stand alone file
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
  * - <string.h>
  * - intf_msg.h
- *******************************************************************************/
+ *****************************************************************************/
 
 
-/*******************************************************************************
+/*****************************************************************************
  * ASSERT
- *******************************************************************************
+ *****************************************************************************
  * This macro is used to test that a pointer is not nul. It insert the needed
  * code when the program is compiled with the debug option, but does nothing
  * in release program.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 #define ASSERT(p_Mem)                                                          \
 if (!(p_Mem))                                                                  \
@@ -27,15 +27,15 @@ if (!(p_Mem))                                                                       \
 #define ASSERT(p_Mem)
 
 #endif
-    
 
-/*******************************************************************************
+
+/*****************************************************************************
  * RZERO
- *******************************************************************************
+ *****************************************************************************
  * This macro is used to initialise a variable to 0. It is very useful when
  * used with the ASSERT macro. It also only insert the needed code when the
  * program is compiled with the debug option.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 #define RZERO(r_Var)                                                           \
 bzero(&(r_Var), sizeof((r_Var)));
@@ -46,12 +46,12 @@ bzero(&(r_Var), sizeof((r_Var)));
 #endif
 
 
-/*******************************************************************************
+/*****************************************************************************
  * PZERO
- *******************************************************************************
+ *****************************************************************************
  * This macro is used to initiase the memory pointed out by a pointer to 0.
  * It has the same purpose than RZERO, but for pointers.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 #define PZERO(p_Mem)                                                           \
 bzero((p_Mem), sizeof(*(p_Mem)));
@@ -62,12 +62,12 @@ bzero((p_Mem), sizeof(*(p_Mem)));
 #endif
 
 
-/*******************************************************************************
+/*****************************************************************************
  * AZERO
- *******************************************************************************
+ *****************************************************************************
  * This macro is used to initiase an array of variables to 0.
  * It has the same purpose than RZERO or PZERO, but for array
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 #define AZERO(p_Array, i_Size)                                                 \
 bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
index ca4d77f1bf6ea72b43ab40b99913d61d4020bdfd..c72fbbfa92556f9ede201ccb1ff844f39238521b 100644 (file)
@@ -1,38 +1,38 @@
-/******************************************************************************
+/*****************************************************************************
  * decoder_fifo.h: interface for decoders PES fifo
  * (c)1999 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * Required headers:
  * - "config.h"
  * - "common.h"
  * - "vlc_thread.h"
  * - "input.h"
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Macros
- ******************************************************************************/
+ *****************************************************************************/
 
 /* ?? move to inline functions */
 #define DECODER_FIFO_ISEMPTY( fifo )    ( (fifo).i_start == (fifo).i_end )
 #define DECODER_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start ) \
                                           & FIFO_SIZE ) == 0 )
 #define DECODER_FIFO_START( fifo )      ( (fifo).buffer[ (fifo).i_start ] )
-#define DECODER_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1) \
-                                                           & FIFO_SIZE ) 
+#define DECODER_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1)\
+                                                           & FIFO_SIZE )
 #define DECODER_FIFO_END( fifo )        ( (fifo).buffer[ (fifo).i_end ] )
 #define DECODER_FIFO_INCEND( fifo )     ( (fifo).i_end = ((fifo).i_end + 1) \
                                                          & FIFO_SIZE )
 
-/******************************************************************************
+/*****************************************************************************
  * decoder_fifo_t
- ******************************************************************************
+ *****************************************************************************
  * This rotative FIFO contains PES packets that are to be decoded...
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
-    vlc_mutex_t         data_lock;                          /* fifo data lock */
-    vlc_cond_t          data_wait;          /* fifo data conditional variable */
+    vlc_mutex_t         data_lock;                         /* fifo data lock */
+    vlc_cond_t          data_wait;         /* fifo data conditional variable */
 
     /* buffer is an array of PES packets pointers */
     pes_packet_t *      buffer[FIFO_SIZE + 1];
@@ -41,12 +41,12 @@ typedef struct
 
 } decoder_fifo_t;
 
-/******************************************************************************
+/*****************************************************************************
  * bit_fifo_t : bit fifo descriptor
- ******************************************************************************
+ *****************************************************************************
  * This type describes a bit fifo used to store bits while working with the
  * input stream at the bit level.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct bit_fifo_s
 {
     /* This unsigned integer allows us to work at the bit level. This buffer
@@ -59,12 +59,12 @@ typedef struct bit_fifo_s
 
 } bit_fifo_t;
 
-/******************************************************************************
+/*****************************************************************************
  * bit_stream_t : bit stream descriptor
- ******************************************************************************
+ *****************************************************************************
  * This type, based on a PES stream, includes all the structures needed to
  * handle the input stream like a bit stream.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct bit_stream_s
 {
     /*
@@ -163,10 +163,10 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * NeedBits : reads i_bits new bits in the bit stream and stores them in the
  *            bit buffer
- ******************************************************************************
+ *****************************************************************************
  * - i_bits must be less or equal 32 !
  * - There is something important to notice with that function : if the number
  * of bits available in the bit buffer when calling NeedBits() is greater than
@@ -174,7 +174,7 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
  * (i_available < i_bits), the byte returned by GetByte() will be shifted with
  * a negative value and the number of bits available in the bit buffer will be
  * set to more than 32 !
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void NeedBits( bit_stream_t * p_bit_stream, int i_bits )
 {
     while ( p_bit_stream->fifo.i_available < i_bits )
@@ -184,24 +184,24 @@ static __inline__ void NeedBits( bit_stream_t * p_bit_stream, int i_bits )
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DumpBits : removes i_bits bits from the bit buffer
- ******************************************************************************
+ *****************************************************************************
  * - i_bits <= i_available
  * - i_bits < 32 (because (u32 << 32) <=> (u32 = u32))
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void DumpBits( bit_stream_t * p_bit_stream, int i_bits )
 {
     p_bit_stream->fifo.buffer <<= i_bits;
     p_bit_stream->fifo.i_available -= i_bits;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DumpBits32 : removes 32 bits from the bit buffer
- ******************************************************************************
+ *****************************************************************************
  * This function actually believes that you have already put 32 bits in the
  * bit buffer, so you can't you use it anytime.
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void DumpBits32( bit_stream_t * p_bit_stream )
 {
     p_bit_stream->fifo.buffer = 0;
@@ -215,36 +215,36 @@ static __inline__ void DumpBits32( bit_stream_t * p_bit_stream )
  * need to call RealignBits() before).
  */
 
-/******************************************************************************
+/*****************************************************************************
  * RemoveBits : removes i_bits bits from the bit buffer
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void RemoveBits( bit_stream_t * p_bit_stream, int i_bits )
 {
     NeedBits( p_bit_stream, i_bits );
     DumpBits( p_bit_stream, i_bits );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RemoveBits32 : removes 32 bits from the bit buffer
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void RemoveBits32( bit_stream_t * p_bit_stream )
 {
     NeedBits( p_bit_stream, 32 );
     DumpBits32( p_bit_stream );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * ShowBits : return i_bits bits from the bit stream
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ u32 ShowBits( bit_stream_t * p_bit_stream, int i_bits )
 {
     NeedBits( p_bit_stream, i_bits );
     return( p_bit_stream->fifo.buffer >> (32 - i_bits) );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * GetBits : returns i_bits bits from the bit stream and removes them
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ u32 GetBits( bit_stream_t * p_bit_stream, int i_bits )
 {
     u32 i_buffer;
@@ -255,9 +255,9 @@ static __inline__ u32 GetBits( bit_stream_t * p_bit_stream, int i_bits )
     return( i_buffer );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * GetBits32 : returns 32 bits from the bit stream and removes them
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ u32 GetBits32( bit_stream_t * p_bit_stream )
 {
     u32 i_buffer;
@@ -268,9 +268,9 @@ static __inline__ u32 GetBits32( bit_stream_t * p_bit_stream )
     return( i_buffer );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RealignBits : realigns the bit buffer on an 8-bit boundary
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void RealignBits( bit_stream_t * p_bit_stream )
 {
     DumpBits( p_bit_stream, p_bit_stream->fifo.i_available & 7 );
index 65a19302db88a61cc7784e1c41d64f440f55d2c8..27f4e3ef8bf19f318b44bc4f3de147459bbc8da0 100644 (file)
@@ -1,7 +1,7 @@
-/*******************************************************************************
+/*****************************************************************************
  * generic_decoder.h : generic decoder thread
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Requires:
  *  "config.h"
  *  "common.h"
  *  "input.h"
  *  "decoder_fifo.h"
  * ??
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * gdec_cfg_t: generic decoder configuration structure
- *******************************************************************************
+ *****************************************************************************
  * This structure is passed as an initializer when a generic decoder thread is
  * created.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct gdec_cfg_s
 {
     u64         i_properties;
 
-    int         i_actions;                                  /* decoder actions */
-    char *      psz_base_filename;                     /* base demux file name */
+    int         i_actions;                                /* decoder actions */
+    char *      psz_base_filename;                   /* base demux file name */
 } gdec_cfg_t;
 
 /* Properties flags */
 #define GDEC_CFG_ACTIONS    (1 << 0)
 #define GDEC_CFG_FILENAME   (1 << 1)
 
-/*******************************************************************************
+/*****************************************************************************
  * gdec_thread_t: generic decoder thread descriptor
- *******************************************************************************
+ *****************************************************************************
  * This type describes a generic decoder thread.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct gdec_thread_s
 {
     /* Thread properties and locks */
-    boolean_t           b_die;                                   /* `die' flag */
-    boolean_t           b_error;                               /* `error' flag */
-    boolean_t           b_active;                             /* `active' flag */
-    vlc_thread_t        thread_id;                  /* id for thread functions */
+    boolean_t           b_die;                                 /* `die' flag */
+    boolean_t           b_error;                             /* `error' flag */
+    boolean_t           b_active;                           /* `active' flag */
+    vlc_thread_t        thread_id;                /* id for thread functions */
 
     /* Thread configuration */
-    int                 i_actions;                          /* decoder actions */
-    
+    int                 i_actions;                        /* decoder actions */
+
     /* Input properties */
-    input_thread_t *    p_input;                               /* input thread */
-    decoder_fifo_t      fifo;                                /* PES input fifo */
+    input_thread_t *    p_input;                             /* input thread */
+    decoder_fifo_t      fifo;                              /* PES input fifo */
 
     /* ?? status info */
     int *               pi_status;
-    
 
-    /* Files array - these files are used to extract ES streams from a 
+
+    /* Files array - these files are used to extract ES streams from a
      * demultiplexed stream */
     /* ?? */
 
 #ifdef STATS
     /* Statistics */
-    count_t         c_loops;                               /* number of loops */
-    count_t         c_idle_loops;                     /* number of idle loops */
-    count_t         c_pes;                      /* number of PES packets read */
+    count_t         c_loops;                              /* number of loops */
+    count_t         c_idle_loops;                    /* number of idle loops */
+    count_t         c_pes;                     /* number of PES packets read */
 #endif
 } gdec_thread_t;
 
 /* Decoder actions - this flags select which actions the decoder will perform
  * when it receives a PES packet */
-#define GDEC_IDENTIFY   (1 << 0)                   /* update input's ES tables */
-#define GDEC_SAVE       (1 << 1)                /* save all PES to a same file */
-#define GDEC_SAVE_DEMUX (1 << 2)             /* save PES to files by stream id */
-#define GDEC_PRINT      (1 << 3)                     /* print PES informations */
+#define GDEC_IDENTIFY   (1 << 0)                 /* update input's ES tables */
+#define GDEC_SAVE       (1 << 1)              /* save all PES to a same file */
+#define GDEC_SAVE_DEMUX (1 << 2)           /* save PES to files by stream id */
+#define GDEC_PRINT      (1 << 3)                   /* print PES informations */
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Thread management functions */
-gdec_thread_t * gdec_CreateThread       ( gdec_cfg_t *p_cfg, 
+gdec_thread_t * gdec_CreateThread       ( gdec_cfg_t *p_cfg,
                                           input_thread_t *p_input, int *pi_status );
 void            gdec_DestroyThread      ( gdec_thread_t *p_gdec, int *pi_status );
 
index 15694374e70b5604f40438cb324d3301c41eb83a..e0d7c104e841862fecf782012e63c0bb8fa0a2bd 100644 (file)
@@ -1,41 +1,41 @@
-/******************************************************************************
+/*****************************************************************************
  * input.h: input thread interface
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Constants related to input
- ******************************************************************************/
-#define TS_PACKET_SIZE      188                        /* size of a TS packet */
-#define PES_HEADER_SIZE     14      /* size of the first part of a PES header */
-#define PSI_SECTION_SIZE    4096             /* Maximum size of a PSI section */
+ *****************************************************************************/
+#define TS_PACKET_SIZE      188                       /* size of a TS packet */
+#define PES_HEADER_SIZE     14     /* size of the first part of a PES header */
+#define PSI_SECTION_SIZE    4096            /* Maximum size of a PSI section */
 
-/******************************************************************************
+/*****************************************************************************
  * ts_packet_t
- ******************************************************************************
+ *****************************************************************************
  * Describe a TS packet.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct ts_packet_s
 {
     /* Nothing before this line, the code relies on that */
-    byte_t                  buffer[TS_PACKET_SIZE];     /* raw TS data packet */
+    byte_t                  buffer[TS_PACKET_SIZE];    /* raw TS data packet */
 
     /* Decoders information */
     unsigned int            i_payload_start;
-                                   /* start of the PES payload in this packet */
-    unsigned int            i_payload_end;                     /* guess ? :-) */
+                                  /* start of the PES payload in this packet */
+    unsigned int            i_payload_end;                    /* guess ? :-) */
 
     /* Used to chain the TS packets that carry data for a same PES or PSI */
     struct ts_packet_s      *  p_prev_ts;
     struct ts_packet_s      *  p_next_ts;
 } ts_packet_t;
 
-/******************************************************************************
+/*****************************************************************************
  * pes_packet_t
- ******************************************************************************
+ *****************************************************************************
  * Describes an PES packet, with its properties, and pointers to the TS packets
  * containing it.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct pes_packet_s
 {
     /* PES properties */
@@ -43,22 +43,22 @@ typedef struct pes_packet_s
             * has been lost. The decoders will have to find a way to recover. */
     boolean_t               b_data_alignment; /* used to find the beginning of a
                                                * video or audio unit          */
-    boolean_t               b_has_pts;        /* is the following field set ? */
-    mtime_t                 i_pts;  /* the PTS for this packet (if set above) */
+    boolean_t               b_has_pts;       /* is the following field set ? */
+    mtime_t                 i_pts; /* the PTS for this packet (if set above) */
     boolean_t               b_random_access;
-             /* if TRUE, in the payload of this packet, there is the first byte 
+             /* if TRUE, in the payload of this packet, there is the first byte
               * of a video sequence header, or the first byte of an audio frame.
               */
-    u8                      i_stream_id;               /* payload type and id */
-    int                     i_pes_size;     /* size of the current PES packet */
-    int                     i_ts_packets; /* number of TS packets in this PES */
+    u8                      i_stream_id;              /* payload type and id */
+    int                     i_pes_size;    /* size of the current PES packet */
+    int                     i_ts_packets;/* number of TS packets in this PES */
 
     /* Demultiplexer environment */
-    boolean_t               b_discard_payload;   /* is the packet messed up ? */
-    byte_t *                p_pes_header;        /* pointer to the PES header */
-    byte_t *                p_pes_header_save;            /* temporary buffer */
+    boolean_t               b_discard_payload;  /* is the packet messed up ? */
+    byte_t *                p_pes_header;       /* pointer to the PES header */
+    byte_t *                p_pes_header_save;           /* temporary buffer */
 
-    /* Pointers to TS packets (TS packets are then linked by the p_prev_ts and 
+    /* Pointers to TS packets (TS packets are then linked by the p_prev_ts and
        p_next_ts fields of the ts_packet_t struct) */
     ts_packet_t *           p_first_ts;   /* The first TS packet containing this
                                            * PES (used by decoders). */
@@ -66,35 +66,35 @@ typedef struct pes_packet_s
                                         * (used by the demultiplexer). */
 } pes_packet_t;
 
-/******************************************************************************
+/*****************************************************************************
  * psi_section_t
- ******************************************************************************
+ *****************************************************************************
  * Describes a PSI section. Beware, it doesn't contain pointers to the TS
  * packets that contain it as for a PES, but the data themselves
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct psi_section_s
 {
     byte_t        buffer[PSI_SECTION_SIZE];
-  
-    boolean_t     b_running_section;    /* Is there a section being decoded ? */
+
+    boolean_t     b_running_section;   /* Is there a section being decoded ? */
 
     u16 i_length;
     u16 i_current_position;
 } psi_section_t;
 
 
-/******************************************************************************
+/*****************************************************************************
  * es_descriptor_t: elementary stream descriptor
- ******************************************************************************
+ *****************************************************************************
  * Describes an elementary stream, and includes fields required to handle and
  * demultiplex this elementary stream.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct es_descriptor_t
-{   
-    u16                     i_id;            /* stream ID, PID for TS streams */
-    u8                      i_type;                            /* stream type */
+{
+    u16                     i_id;           /* stream ID, PID for TS streams */
+    u8                      i_type;                           /* stream type */
 
-    boolean_t               b_pcr;         /* does the stream include a PCR ? */
+    boolean_t               b_pcr;        /* does the stream include a PCR ? */
     /* ?? b_pcr will be replaced by something else: since a PCR can't be shared
      * between several ES, we will probably store the PCR fields directly here,
      * and one of those fields will probably (again) be used as a test of the
@@ -108,10 +108,10 @@ typedef struct es_descriptor_t
 
     /* PES packets */
     pes_packet_t *          p_pes_packet;
-                                       /* current PES packet we are gathering */
+                                      /* current PES packet we are gathering */
 
     /* PSI packets */
-    psi_section_t *         p_psi_section;           /* idem for a PSI stream */
+    psi_section_t *         p_psi_section;          /* idem for a PSI stream */
 
     /* Decoder informations */
     void *                  p_dec;     /* p_dec is void *, since we don't know a
@@ -128,19 +128,19 @@ typedef struct es_descriptor_t
 
 #ifdef STATS
     /* Stats */
-    count_t                 c_bytes;                      /* total bytes read */
+    count_t                 c_bytes;                     /* total bytes read */
     count_t                 c_payload_bytes;/* total of payload usefull bytes */
-    count_t                 c_packets;                  /* total packets read */
-    count_t                 c_invalid_packets;        /* invalid packets read */
+    count_t                 c_packets;                 /* total packets read */
+    count_t                 c_invalid_packets;       /* invalid packets read */
     /* ?? ... other stats */
 #endif
 } es_descriptor_t;
 
 /* Special PID values - note that the PID is only on 13 bits, and that values
  * greater than 0x1fff have no meaning in a stream */
-#define PROGRAM_ASSOCIATION_TABLE_PID   0x0000 
-#define CONDITIONNAL_ACCESS_TABLE_PID   0x0001                    /* not used */
-#define EMPTY_PID                       0xffff     /* empty record in a table */
+#define PROGRAM_ASSOCIATION_TABLE_PID   0x0000
+#define CONDITIONNAL_ACCESS_TABLE_PID   0x0001                   /* not used */
+#define EMPTY_PID                       0xffff    /* empty record in a table */
 
 /* ES streams types - see ISO/IEC 13818-1 table 2-29 numbers */
 #define MPEG1_VIDEO_ES          0x01
@@ -150,22 +150,22 @@ typedef struct es_descriptor_t
 #define AC3_AUDIO_ES            0x81
 #define DVD_SPU_ES             0x82           /* 0x82 might violate the norm */
 
-/******************************************************************************
+/*****************************************************************************
  * program_descriptor_t
- ******************************************************************************
+ *****************************************************************************
  * Describes a program and list associated elementary streams. It is build by
- * the PSI decoder upon the informations carried in program map sections 
- ******************************************************************************/
+ * the PSI decoder upon the informations carried in program map sections
+ *****************************************************************************/
 typedef struct
 {
     /* Program characteristics */
-    u16                     i_number;                       /* program number */
-    u8                      i_version;                      /* version number */ 
-    boolean_t               b_is_ok;        /* Is the description up to date ?*/
-    u16                     i_pcr_pid;                              /* PCR ES */
+    u16                     i_number;                      /* program number */
+    u8                      i_version;                     /* version number */
+    boolean_t               b_is_ok;       /* Is the description up to date ?*/
+    u16                     i_pcr_pid;                             /* PCR ES */
 
     int i_es_number;
-    es_descriptor_t **      ap_es;                 /* array of pointers to ES */
+    es_descriptor_t **      ap_es;                /* array of pointers to ES */
 
 #ifdef DVB_EXTENSIONS
     /* Service Descriptor (program name) */
@@ -183,11 +183,11 @@ typedef struct
 #endif
 } pgrm_descriptor_t;
 
-/******************************************************************************
+/*****************************************************************************
  * pcr_descriptor_t
- ******************************************************************************
+ *****************************************************************************
  * Contains informations used to synchronise the decoder with the server
- ******************************************************************************/
+ *****************************************************************************/
 
 typedef struct pcr_descriptor_struct
 {
@@ -199,45 +199,45 @@ typedef struct pcr_descriptor_struct
 
     u32                     i_synchro_state;
     count_t                 c_average_count;
-                            /* counter used to compute dynamic average values */
+                           /* counter used to compute dynamic average values */
 } pcr_descriptor_t;
 
-/******************************************************************************
+/*****************************************************************************
  * stream_descriptor_t
- ******************************************************************************
+ *****************************************************************************
  * Describes a transport stream and list its associated programs. Build upon
  * the informations carried in program association sections
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
-    u16                     i_stream_id;                         /* stream id */
+    u16                     i_stream_id;                        /* stream id */
 
     /* Program Association Table status */
-    u8                      i_PAT_version;                  /* version number */ 
-    boolean_t               b_is_PAT_complete;        /* Is the PAT complete ?*/
+    u8                      i_PAT_version;                 /* version number */
+    boolean_t               b_is_PAT_complete;       /* Is the PAT complete ?*/
     u8                      i_known_PAT_sections;
-                                      /* Number of section we received so far */
+                                     /* Number of section we received so far */
     byte_t                  a_known_PAT_sections[32];
-                                                 /* Already received sections */
+                                                /* Already received sections */
 
     /* Program Map Table status */
-    boolean_t               b_is_PMT_complete;        /* Is the PMT complete ?*/
+    boolean_t               b_is_PMT_complete;       /* Is the PMT complete ?*/
     u8                      i_known_PMT_sections;
-                                      /* Number of section we received so far */
+                                     /* Number of section we received so far */
     byte_t                  a_known_PMT_sections[32];
-                                                 /* Already received sections */
+                                                /* Already received sections */
 
     /* Service Description Table status */
-    u8                      i_SDT_version;                  /* version number */ 
-    boolean_t               b_is_SDT_complete;        /* Is the SDT complete ?*/
+    u8                      i_SDT_version;                 /* version number */
+    boolean_t               b_is_SDT_complete;       /* Is the SDT complete ?*/
     u8                      i_known_SDT_sections;
-                                      /* Number of section we received so far */
+                                     /* Number of section we received so far */
     byte_t                  a_known_SDT_sections[32];
-                                                 /* Already received sections */
+                                                /* Already received sections */
 
     /* Programs description */
-    int i_pgrm_number;                    /* Number of program number we have */
-    pgrm_descriptor_t **    ap_programs;         /* Array of pointers to pgrm */
+    int i_pgrm_number;                   /* Number of program number we have */
+    pgrm_descriptor_t **    ap_programs;        /* Array of pointers to pgrm */
 
 #ifdef STATS
     /* Stats */
@@ -245,21 +245,21 @@ typedef struct
 #endif
 } stream_descriptor_t;
 
-/******************************************************************************
+/*****************************************************************************
  * input_netlist_t
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
-    vlc_mutex_t             lock;                /* netlist modification lock */
+    vlc_mutex_t             lock;               /* netlist modification lock */
     struct iovec            p_ts_free[INPUT_MAX_TS + INPUT_TS_READ_ONCE];
-                                           /* FIFO or LIFO of free TS packets */
+                                          /* FIFO or LIFO of free TS packets */
     ts_packet_t *           p_ts_packets;
-                               /* pointer to the first TS packet we allocated */
+                              /* pointer to the first TS packet we allocated */
 
     pes_packet_t *          p_pes_free[INPUT_MAX_PES + 1];
-                                          /* FIFO or LIFO of free PES packets */
+                                         /* FIFO or LIFO of free PES packets */
     pes_packet_t *          p_pes_packets;
-                              /* pointer to the first PES packet we allocated */
+                             /* pointer to the first PES packet we allocated */
 
     /* To use the efficiency of the scatter/gather IO operations. We implemented
      * it in 2 ways, as we don't know yet which one is better : as a FIFO (code
@@ -279,14 +279,14 @@ typedef struct
 
 
 
-/******************************************************************************
+/*****************************************************************************
  * input_thread_t
- ******************************************************************************
+ *****************************************************************************
  * This structure includes all the local static variables of an input thread,
  * including the netlist and the ES descriptors
  * Note that p_es must be defined as a static table, otherwise we would have to
- * update all reference to it each time the table would be reallocated 
- ******************************************************************************/
+ * update all reference to it each time the table would be reallocated
+ *****************************************************************************/
 
 /* Function pointers used in structure */
 typedef int  (input_open_t)     ( p_input_thread_t p_input );
@@ -298,61 +298,61 @@ typedef void (input_close_t)    ( p_input_thread_t p_input );
 typedef struct input_thread_s
 {
     /* Thread properties and locks */
-    boolean_t                   b_die;                          /* 'die' flag */
-    boolean_t                   b_error;                          /* deadlock */
-    vlc_thread_t                thread_id;         /* id for thread functions */
-    vlc_mutex_t                 programs_lock;  /* programs modification lock */
-    vlc_mutex_t                 es_lock;              /* es modification lock */
-    int *                       pi_status;           /* temporary status flag */
+    boolean_t                   b_die;                         /* 'die' flag */
+    boolean_t                   b_error;                         /* deadlock */
+    vlc_thread_t                thread_id;        /* id for thread functions */
+    vlc_mutex_t                 programs_lock; /* programs modification lock */
+    vlc_mutex_t                 es_lock;             /* es modification lock */
+    int *                       pi_status;          /* temporary status flag */
 
     /* Input method description */
-    int                         i_method;                     /* input method */
-    int                         i_handle;           /* file/socket descriptor */    
-    char *                      psz_source;                         /* source */
+    int                         i_method;                    /* input method */
+    int                         i_handle;          /* file/socket descriptor */
+    char *                      psz_source;                        /* source */
     int                         i_port;                     /* port number */
-    int                         i_vlan;                 /* id for vlan method */
-    input_open_t *              p_Open;               /* opener of the method */
-    input_read_t *              p_Read;                   /* reading function */
-    input_close_t *             p_Close;               /* destroying function */
+    int                         i_vlan;                /* id for vlan method */
+    input_open_t *              p_Open;              /* opener of the method */
+    input_read_t *              p_Read;                  /* reading function */
+    input_close_t *             p_Close;              /* destroying function */
 
     /* General stream description */
-    stream_descriptor_t *   p_stream;                           /* PAT tables */
-    es_descriptor_t         p_es[INPUT_MAX_ES]; /* carried elementary streams */
-    pcr_descriptor_t *      p_pcr;     /* PCR struct used for synchronisation */
+    stream_descriptor_t *   p_stream;                          /* PAT tables */
+    es_descriptor_t         p_es[INPUT_MAX_ES];/* carried elementary streams */
+    pcr_descriptor_t *      p_pcr;    /* PCR struct used for synchronisation */
 
     /* List of streams to demux */
     es_descriptor_t *       pp_selected_es[INPUT_MAX_SELECTED_ES];
-    
+
     /* Netlists */
-    input_netlist_t         netlist;                             /* see above */
+    input_netlist_t         netlist;                            /* see above */
 
     /* Default settings for spawned decoders */
-    p_aout_thread_t             p_aout;      /* audio output thread structure */
-    p_vout_thread_t             p_vout;                /* video output thread */    
+    p_aout_thread_t             p_aout;     /* audio output thread structure */
+    p_vout_thread_t             p_vout;               /* video output thread */
 
 #ifdef STATS
     /* Statistics */
-    count_t                     c_loops;                   /* number of loops */
-    count_t                     c_bytes;                        /* bytes read */
-    count_t                     c_payload_bytes;      /* payload useful bytes */
-    count_t                     c_packets_read;               /* packets read */
-    count_t                     c_packets_trashed;         /* trashed packets */
+    count_t                     c_loops;                  /* number of loops */
+    count_t                     c_bytes;                       /* bytes read */
+    count_t                     c_payload_bytes;     /* payload useful bytes */
+    count_t                     c_packets_read;              /* packets read */
+    count_t                     c_packets_trashed;        /* trashed packets */
 #endif
 } input_thread_t;
 
 /* Input methods */
-#define INPUT_METHOD_NONE           0             /* input thread is inactive */
-#define INPUT_METHOD_TS_FILE       10        /* TS stream is read from a file */
-#define INPUT_METHOD_TS_UCAST      20                       /* TS UDP unicast */
-#define INPUT_METHOD_TS_MCAST      21                     /* TS UDP multicast */
-#define INPUT_METHOD_TS_BCAST      22                     /* TS UDP broadcast */
-#define INPUT_METHOD_TS_VLAN_BCAST 32          /* TS UDP broadcast with VLANs */
+#define INPUT_METHOD_NONE           0            /* input thread is inactive */
+#define INPUT_METHOD_TS_FILE       10       /* TS stream is read from a file */
+#define INPUT_METHOD_TS_UCAST      20                      /* TS UDP unicast */
+#define INPUT_METHOD_TS_MCAST      21                    /* TS UDP multicast */
+#define INPUT_METHOD_TS_BCAST      22                    /* TS UDP broadcast */
+#define INPUT_METHOD_TS_VLAN_BCAST 32         /* TS UDP broadcast with VLANs */
 
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-input_thread_t *input_CreateThread      ( int i_method, char *psz_source, int i_port, 
-                                          int i_vlan, p_vout_thread_t p_vout, 
+input_thread_t *input_CreateThread      ( int i_method, char *psz_source, int i_port,
+                                          int i_vlan, p_vout_thread_t p_vout,
                                           p_aout_thread_t p_aout, int *pi_status );
 void            input_DestroyThread     ( input_thread_t *p_input, int *pi_status );
 
index 1bf1eaccf03719ffe35df3a74244a69d6b2c7e06..9ec254e4133fdaef5b6243cd4eb245c6f5a32496 100644 (file)
@@ -1,21 +1,21 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_ctrl.h: Decodeur control
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Requires:
  *  "config.h"
  *  "common.h"
  *  "mtime.h"
- ******************************************************************************/
+ *****************************************************************************/
 
 
 
 
 
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int input_AddPgrmElem( input_thread_t *p_input, int i_current_pid );
 int input_DelPgrmElem( input_thread_t *p_input, int i_current_pid );
 boolean_t input_IsElemRecv( input_thread_t *p_input, int i_pid );
index 2d2bd268c74f68488f0b0c4096b588183d631545..3a1d3111ffef5de7951536632c9b45334b43e31d 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_file.h: file streams functions interface
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int     input_FileOpen  ( input_thread_t *p_input );
 int     input_FileRead  ( input_thread_t *p_input, const struct iovec *p_vector,
                           size_t i_count );
index 684b15d5e529ad5ce8912802878054e5367adc74..a25b5fa2cb60757cfc09a85485c03b13abed640c 100644 (file)
@@ -1,15 +1,15 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_netlist.h: netlist interface
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * The netlists are an essential part of the input structure. We maintain a
  * list of free TS packets and free PES packets to avoid continuous malloc
  * and free.
- *******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int     input_NetlistInit       ( input_thread_t *p_input );
 void    input_NetlistEnd        ( input_thread_t *p_input );
 
@@ -17,13 +17,13 @@ static __inline__ void input_NetlistFreePES( input_thread_t *p_input, pes_packet
 static __inline__ void input_NetlistFreeTS( input_thread_t *p_input, ts_packet_t *p_ts_packet );
 static __inline__ pes_packet_t* input_NetlistGetPES( input_thread_t *p_input );
 
-/******************************************************************************
+/*****************************************************************************
  * input_NetlistFreePES: add a PES packet to the netlist
- *******************************************************************************
+ *****************************************************************************
  * Add a PES packet to the PES netlist, so that the packet can immediately be
  * reused by the demultiplexer. We put this function directly in the .h file,
  * because it is very frequently called.
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void input_NetlistFreePES( input_thread_t *p_input,
                                   pes_packet_t *p_pes_packet )
 {
@@ -53,7 +53,7 @@ static __inline__ void input_NetlistFreePES( input_thread_t *p_input,
 #endif
         p_ts_packet = p_ts_packet->p_next_ts;
     }
-    
+
     /* Free the PES structure. */
 #ifdef INPUT_LIFO_PES_NETLIST
     p_input->netlist.i_pes_index--;
@@ -67,13 +67,13 @@ static __inline__ void input_NetlistFreePES( input_thread_t *p_input,
     vlc_mutex_unlock( &p_input->netlist.lock );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_NetlistFreeTS: add a TS packet to the netlist
- *******************************************************************************
+ *****************************************************************************
  * Add a TS packet to the TS netlist, so that the packet can immediately be
  * reused by the demultiplexer. Shouldn't be called by other threads (they
  * should only use input_FreePES.
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void input_NetlistFreeTS( input_thread_t *p_input,
                                             ts_packet_t *p_ts_packet )
 {
@@ -95,19 +95,19 @@ static __inline__ void input_NetlistFreeTS( input_thread_t *p_input,
     vlc_mutex_unlock( &p_input->netlist.lock );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_NetlistGetPES: remove a PES packet from the netlist
- *******************************************************************************
+ *****************************************************************************
  * Add a TS packet to the TS netlist, so that the packet can immediately be
  * reused by the demultiplexer. Shouldn't be called by other threads (they
  * should only use input_FreePES.
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ pes_packet_t* input_NetlistGetPES( input_thread_t *p_input )
 {
     pes_packet_t *          p_pes_packet;
 
 #ifdef INPUT_LIFO_PES_NETLIST
-    /* i_pes_index might be accessed by a decoder thread to give back a 
+    /* i_pes_index might be accessed by a decoder thread to give back a
      * packet. */
     vlc_mutex_lock( &p_input->netlist.lock );
 
index 2686026003f160f97c04693c58726d2c50643e08..1e0d153ffc32dd46b33f9f6007df03ae74adddbe 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_network.h: network functions interface
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int input_NetworkOpen   ( input_thread_t *p_input );
 int input_NetworkRead   ( input_thread_t *p_input, const struct iovec *p_vector,
                           size_t i_count );
index 8b6f68bb60c30c1b441e291ba5b50a9357b28dc7..b25dff0cde4a735d0cc4f915c6dfdbd9b62b57d7 100644 (file)
@@ -1,7 +1,7 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_pcr.h: PCR management interface
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Maximum number of samples used to compute the dynamic average value,
  * it is also the maximum of c_average in the pcr_descriptor_struct.
 #define SYNCHRO_START       2
 #define SYNCHRO_REINIT      3
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int            input_PcrInit        ( input_thread_t *p_input );
-void           input_PcrDecode      ( input_thread_t *p_input, es_descriptor_t* p_es, 
+void           input_PcrDecode      ( input_thread_t *p_input, es_descriptor_t* p_es,
                                        u8* p_pcr_data );
 void           input_PcrEnd         ( input_thread_t *p_input );
index 107a3a6b518dc02263f4bd24ee86294fb4a31b86..9a358d1593bf379af25081fde2e570b812690c62 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * psi.h: PSI management interface
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 int     input_PsiInit   ( input_thread_t *p_input );
 void    input_PsiDecode ( input_thread_t *p_input, psi_section_t* p_psi_section );
 void    input_PsiRead   ( input_thread_t *p_input );
index 2185bd8db98b5e085f0af7668e3e353359d78ada..8519996331ba7e03e7ac737989aca52ceb5bd84a 100644 (file)
@@ -1,17 +1,17 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_vlan.h: vlan input method
  * (c)1999 VideoLAN
- *******************************************************************************
- * ?? 
- *******************************************************************************
+ *****************************************************************************
+ * ??
+ *****************************************************************************
  * Required headers:
  * <netinet/in.h>
  * "vlc_thread.h"
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int     input_VlanCreate        ( void );
 void    input_VlanDestroy       ( void );
 int     input_VlanJoin          ( int i_vlan_id );
index 3791abb631e45f5b2c13962564fb6c9ae19d03e6..56834891042ffb528574b59e435e76952e7d516a 100644 (file)
@@ -1,10 +1,10 @@
-/******************************************************************************
+/*****************************************************************************
  * interface.h: interface access for other threads
  * (c)1999 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * This library provides basic functions for threads to interact with user
  * interface, such as message output.
- ******************************************************************************
+ *****************************************************************************
  * Required headers:
  *  <sys/uio.h>
  *  <X11/Xlib.h>
  *  "video_output.h"
  *  "audio_output.h"
  *  "xconsole.h"
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * intf_thread_t: describe an interface thread
- ******************************************************************************
+ *****************************************************************************
  * This structe describes all interface-specific data of the main (interface)
  * thread.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct intf_thread_s
 {
-    boolean_t           b_die;                                  /* `die' flag */
+    boolean_t           b_die;                                 /* `die' flag */
 
-    /* Specific interfaces */     
-    p_intf_console_t    p_console;                                 /* console */
-    p_intf_sys_t        p_sys;                            /* system interface */
+    /* Specific interfaces */
+    p_intf_console_t    p_console;                                /* console */
+    p_intf_sys_t        p_sys;                           /* system interface */
 
     /* Channels array - NULL if not used */
-    p_intf_channel_t    p_channel;                 /* description of channels */    
+    p_intf_channel_t    p_channel;                /* description of channels */
 
     /* Main threads - NULL if not active */
     p_vout_thread_t     p_vout;
-    p_input_thread_t    p_input;        
+    p_input_thread_t    p_input;
 } intf_thread_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 intf_thread_t * intf_Create             ( void );
 void            intf_Run                ( intf_thread_t * p_intf );
 void            intf_Destroy            ( intf_thread_t * p_intf );
index 8f835c56da50c2f59594a474644660855dfdea3d..c83ebe02f4fae5d748761248d6a39ef950ecc39f 100644 (file)
@@ -1,81 +1,81 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_cmd.h: interface commands parsing and executions functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This file implements the interface commands execution functions. It is used
  * by command-line oriented interfaces and scripts. The commands themselves are
  * implemented in intf_ctrl.
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
  *  none
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_arg_t: control fonction argument descriptor
- *******************************************************************************
+ *****************************************************************************
  * This structure is used to control an argument type and to transmit
  * arguments to control functions. It is also used to parse format string and
  * build an easier to use array of arguments.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* Argument type */
-    int         i_flags;                            /* argument type and flags */
-    int         i_index;                     /* index of mask in format string */
+    int         i_flags;                          /* argument type and flags */
+    int         i_index;                   /* index of mask in format string */
 
     /* Converted arguments value */
-    char *      psz_str;                                       /* string value */
-    char *      ps_name;                /* name, can be '\0' or '=' terminated */
-    long        i_num;                                        /* integer value */
-    float       f_num;                                          /* float value */
+    char *      psz_str;                                     /* string value */
+    char *      ps_name;              /* name, can be '\0' or '=' terminated */
+    long        i_num;                                      /* integer value */
+    float       f_num;                                        /* float value */
 } intf_arg_t;
 
 /* Arguments flags */
-#define INTF_STR_ARG            1                           /* string argument */
-#define INTF_INT_ARG            2                          /* integer argument */
-#define INTF_FLOAT_ARG          4                            /* float argument */
-#define INTF_NAMED_ARG          16                           /* named argument */
-#define INTF_OPT_ARG            256                      /* optionnal argument */
-#define INTF_REP_ARG            512                /* argument can be repeated */
-#define INTF_PRESENT_ARG        1024          /* argument has been encountered */
+#define INTF_STR_ARG            1                         /* string argument */
+#define INTF_INT_ARG            2                        /* integer argument */
+#define INTF_FLOAT_ARG          4                          /* float argument */
+#define INTF_NAMED_ARG          16                         /* named argument */
+#define INTF_OPT_ARG            256                    /* optionnal argument */
+#define INTF_REP_ARG            512              /* argument can be repeated */
+#define INTF_PRESENT_ARG        1024        /* argument has been encountered */
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_command_t: control command descriptor
- *******************************************************************************
+ *****************************************************************************
  * This structure describes a control commands. It stores informations needed
  * for argument type checking, command execution but also a short inline help.
  * See control.c for more informations about fields.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* Function control */
-    char *          psz_name;                                  /* command name */
-    int (* function)( int i_argc, intf_arg_t *p_argv );            /* function */
-    char *          psz_format;                            /* arguments format */
+    char *          psz_name;                                /* command name */
+    int (* function)( int i_argc, intf_arg_t *p_argv );          /* function */
+    char *          psz_format;                          /* arguments format */
 
     /* Function informations */
-    char *          psz_summary;                                  /* info text */
-    char *          psz_usage;                                   /* usage text */
-    char *          psz_help;                                     /* help text */
+    char *          psz_summary;                                /* info text */
+    char *          psz_usage;                                 /* usage text */
+    char *          psz_help;                                   /* help text */
 } intf_command_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Error constants
- *******************************************************************************
+ *****************************************************************************
  * These errors should be used as return values for control functions (see
  * control.c). The intf_ExecCommand function as different behaviour depending
  * of the error it received. Other errors numbers can be used, but their valued
  * should be positive to avoid conflict with future error codes.
- *******************************************************************************/
+ *****************************************************************************/
 
-#define INTF_NO_ERROR       0                                       /* success */
-#define INTF_FATAL_ERROR    -1            /* fatal error: the program will end */
-#define INTF_CRITICAL_ERROR -2        /* critical error: the program will exit */
+#define INTF_NO_ERROR       0                                     /* success */
+#define INTF_FATAL_ERROR    -1          /* fatal error: the program will end */
+#define INTF_CRITICAL_ERROR -2      /* critical error: the program will exit */
 #define INTF_USAGE_ERROR    -3 /* usage error: command usage will be displayed */
-#define INTF_OTHER_ERROR    -4  /* other error: command prints its own message */
+#define INTF_OTHER_ERROR    -4/* other error: command prints its own message */
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int intf_ExecCommand    ( char *psz_cmd );
 int intf_ExecScript     ( char *psz_filename );
index 3dff0898c6854d081f83c2d3593e2bb31566553e..97358cd4a571735813b9214c40d5ad4fd803ccee 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_console.h: generic console methods for interface
  * (c)1998 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 p_intf_console_t  intf_ConsoleCreate    ( void );
 void              intf_ConsoleDestroy   ( p_intf_console_t p_console );
 
index a18be921a5fdb0a542b2917da99f06c503f7fc8d..88f7bce7e043fa4f3d0111d6eb62e60852ce3800 100644 (file)
@@ -1,17 +1,17 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_ctrl.h: interface commands access to control functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Library of functions common to all interfaces, allowing access to various
  * structures and settings. Interfaces should only use those functions
  * to read or write informations from other threads.
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
  *  none
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Extern variables
- *******************************************************************************/
+ *****************************************************************************/
 extern const intf_command_t control_command[];
 
index 40621721c11da960f8ebe724247985dbfbfa8a48..5b44f17c71b3c2deb5e04ae7d6e97e74cdf5e9fb 100644 (file)
@@ -1,24 +1,24 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_msg.h: messages interface
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This library provides basic functions for threads to interact with user
  * interface, such as message output. See config.h for output configuration.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_DbgMsg macros and functions
- *******************************************************************************
- * The intf_DbgMsg* functions are defined as macro to be able to use the 
+ *****************************************************************************
+ * The intf_DbgMsg* functions are defined as macro to be able to use the
  * compiler extensions and print the file, the function and the line number
  * from which they have been called. They call _intf_DbgMsg*() functions after
  * having added debugging informations.
  * Outside DEBUG mode, intf_DbgMsg* functions do nothing.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 
 /* DEBUG mode */
-void    _intf_DbgMsg        ( char *psz_file, char *psz_function, int i_line, 
+void    _intf_DbgMsg        ( char *psz_file, char *psz_function, int i_line,
                               char *psz_format, ... );
 void    _intf_DbgMsgImm     ( char *psz_file, char *psz_function, int i_line,
                               char *psz_format, ... );
@@ -31,18 +31,18 @@ void    _intf_DbgMsgImm     ( char *psz_file, char *psz_function, int i_line,
 #else
 
 /* Non-DEBUG mode */
-#define intf_DbgMsg( format, args... )      
-#define intf_DbgMsgImm( format, args...)    
+#define intf_DbgMsg( format, args... )
+#define intf_DbgMsgImm( format, args...)
 
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_FlushMsg macro and function
- *******************************************************************************
+ *****************************************************************************
  * intf_FlushMsg is a function which flushs message queue and print all messages
  * remaining. It is only usefull if INTF_MSG_QUEUE is defined. In this case, it
  * is really a function. In the other case, it is a macro doing nothing.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef INTF_MSG_QUEUE
 
 /* Message queue mode */
@@ -55,9 +55,9 @@ void    intf_FlushMsg       ( void );
 
 #endif
 
-/*******************************************************************************
- * Prototypes                                                      
- *******************************************************************************/
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
 p_intf_msg_t intf_MsgCreate      ( void );
 void         intf_MsgDestroy     ( void );
 
index f42e45bddb1507f977740de8727c864b8ce9938e..980b626425931a58ecab14992538162e94f41cdf 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_sys.h: system dependant interface API
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int     intf_SysCreate ( p_intf_thread_t p_intf );
 void    intf_SysDestroy( p_intf_thread_t p_intf );
 void    intf_SysManage ( p_intf_thread_t p_intf );
index ec07ba60b8bf6fffa050102132b4fc5a0139bd7c..b1ae2416379ea3cfb7de039893e7b566b1d3db27 100644 (file)
@@ -1,48 +1,48 @@
-/*******************************************************************************
+/*****************************************************************************
  * main.h: access to all program variables
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Declaration and extern access to global program object.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * main_t, p_main (global variable)
- *******************************************************************************
+ *****************************************************************************
  * This structure has an unique instance, declared in main and pointed by the
  * only global variable of the program. It should allow access to any variable
  * of the program, for user-interface purposes or more easier call of interface
  * and common functions (example: the intf_*Msg functions). Please avoid using
  * it when you can access the members you need in an other way. In fact, it
  * should only be used by interface thread.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* Global properties */
-    int                    i_argc;             /* command line arguments count */
-    char **                ppsz_argv;                /* command line arguments */
-    char **                ppsz_env;                  /* environment variables */
+    int                    i_argc;           /* command line arguments count */
+    char **                ppsz_argv;              /* command line arguments */
+    char **                ppsz_env;                /* environment variables */
 
     /* Generic settings */
-    boolean_t              b_audio;               /* is audio output allowed ? */
-    boolean_t              b_video;               /* is video output allowed ? */
-    boolean_t              b_vlans;                   /* are vlans supported ? */
-    
+    boolean_t              b_audio;             /* is audio output allowed ? */
+    boolean_t              b_video;             /* is video output allowed ? */
+    boolean_t              b_vlans;                 /* are vlans supported ? */
+
     /* Unique threads */
-    p_aout_thread_t        p_aout;                      /* audio output thread */
-    p_intf_thread_t        p_intf;                    /* main interface thread */
+    p_aout_thread_t        p_aout;                    /* audio output thread */
+    p_intf_thread_t        p_intf;                  /* main interface thread */
 
     /* Shared data - these structures are accessed directly from p_main by
      * several modules */
-    p_intf_msg_t           p_msg;                   /* messages interface data */
-    p_input_vlan_t         p_vlan;                        /* vlan library data */
+    p_intf_msg_t           p_msg;                 /* messages interface data */
+    p_input_vlan_t         p_vlan;                      /* vlan library data */
 } main_t;
 
 extern main_t *p_main;
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes - these methods are used to get default values for some threads
  * and modules.
- *******************************************************************************/
+ *****************************************************************************/
 int    main_GetIntVariable( char *psz_name, int i_default );
 char * main_GetPszVariable( char *psz_name, char *psz_default );
 void   main_PutIntVariable( char *psz_name, int i_value );
index cbc74b09c6e270452e50389a4cc3526e0562330a..a3bc2a0d837f3dffe5cea848c6b8458691121645 100644 (file)
@@ -1,7 +1,7 @@
-/*******************************************************************************
+/*****************************************************************************
  * mtime.h: high rezolution time management functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This header provides portable high precision time management functions,
  * which should be the only ones used in other segments of the program, since
  * functions like gettimeofday() and ftime() are not always supported.
@@ -9,46 +9,46 @@
  * interfaces to system calls and have to be called frequently.
  * 'm' stands for 'micro', since maximum resolution is the microsecond.
  * Functions prototyped are implemented in interface/mtime.c.
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
  *  none
  * this header includes inline functions
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * mtime_t: high precision date or time interval
- *******************************************************************************
+ *****************************************************************************
  * Store an high precision date or time interval. The maximum precision is the
  * micro-second, and a 64 bits integer is used to avoid any overflow (maximum
  * time interval is then 292271 years, which should be length enough for any
  * video). Date are stored as a time interval since a common date.
  * Note that date and time intervals can be manipulated using regular arithmetic
  * operators, and that no special functions are required.
- *******************************************************************************/
+ *****************************************************************************/
 typedef s64 mtime_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * LAST_MDATE: date which will never happen
- *******************************************************************************
+ *****************************************************************************
  * This date can be used as a 'never' date, to mark missing events in a function
  * supposed to return a date, such as nothing to display in a function
  * returning the date of the first image to be displayed. It can be used in
  * comparaison with other values: all existing dates will be earlier.
- *******************************************************************************/
+ *****************************************************************************/
 #define LAST_MDATE ((mtime_t)((u64)(-1)/2))
 
-/*******************************************************************************
+/*****************************************************************************
  * MSTRTIME_MAX_SIZE: maximum possible size of mstrtime
- *******************************************************************************
+ *****************************************************************************
  * This values is the maximal possible size of the string returned by the
  * mstrtime() function, including '-' and the final '\0'. It should be used to
  * allocate the buffer.
- *******************************************************************************/
+ *****************************************************************************/
 #define MSTRTIME_MAX_SIZE 22
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 char *  mstrtime ( char *psz_buffer, mtime_t date );
 mtime_t mdate    ( void );
 void    mwait    ( mtime_t date );
index 626f859582709ac72e057b9d68c3f0fda23ea59d..902f657ead7b5ac21f2dfa194e08ecd69e7d1363 100644 (file)
@@ -1,27 +1,27 @@
-/*******************************************************************************
+/*****************************************************************************
  * netutils.h: various network functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This header describe miscellanous utility functions shared between several
  * modules.
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
  *  <netinet/in.h>
- *******************************************************************************/
+ *****************************************************************************/
 
 
-/*******************************************************************************
+/*****************************************************************************
  * if_descr_t: describes a network interface.
- *******************************************************************************
+ *****************************************************************************
  * Note that if the interface is a point to point one, the broadcast address is
  * set to the destination address of that interface
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* Interface device name (e.g. "eth0") */
     char* psz_ifname;
     /* Interface physical address */
-    struct sockaddr sa_phys_addr;  
+    struct sockaddr sa_phys_addr;
     /* Interface network address */
     struct sockaddr_in sa_net_addr;
     /* Interface broadcast address */
@@ -31,11 +31,11 @@ typedef struct
 } if_descr_t;
 
 
-/*******************************************************************************
+/*****************************************************************************
  * net_descr_t: describes all the interfaces of the computer
- *******************************************************************************
+ *****************************************************************************
  * Nothing special to say :)
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* Number of networks interfaces described below */
@@ -45,9 +45,9 @@ typedef struct
 } net_descr_t;
 
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int ReadIfConf      (int i_sockfd, if_descr_t* p_ifdescr, char* psz_name);
 int ReadNetConf     (int i_sockfd, net_descr_t* p_net_descr);
 int BuildInetAddr   ( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port );
index 78fb43bdb43571a47b561e8d38f4039ecb7fd844..7d3861dc98e6daf50e274b4e032c8f4c61bc146b 100644 (file)
@@ -1,65 +1,65 @@
-/*******************************************************************************
+/*****************************************************************************
  * rsc_files.h: resources files manipulation functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This library describe a general format used to store 'resources'. Resources
  * can be anything, including pictures, audio streams, and so on.
- *******************************************************************************
+ *****************************************************************************
  * Requires:
  *  config.h
- *  common.h 
- *******************************************************************************/
+ *  common.h
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Constants
- *******************************************************************************/
+ *****************************************************************************/
 
-/* Maximum length of a resource name (not including the final '\0') - this 
+/* Maximum length of a resource name (not including the final '\0') - this
  * constant should not be changed without extreme care */
 #define RESOURCE_MAX_NAME   32
 
-/*******************************************************************************
+/*****************************************************************************
  * resource_descriptor_t: resource descriptor
- *******************************************************************************
+ *****************************************************************************
  * This type describe an entry in the resource table.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
-    char    psz_name[RESOURCE_MAX_NAME + 1];                           /* name */
-    u16     i_type;                                                    /* type */
-    u64     i_offset;                                           /* data offset */
-    u64     i_size;                                               /* data size */
+    char    psz_name[RESOURCE_MAX_NAME + 1];                         /* name */
+    u16     i_type;                                                  /* type */
+    u64     i_offset;                                         /* data offset */
+    u64     i_size;                                             /* data size */
 } resource_descriptor_t;
 
 /* Resources types */
-#define EMPTY_RESOURCE      0                          /* empty place in table */
-#define PICTURE_RESOURCE    10                         /* native video picture */
+#define EMPTY_RESOURCE      0                        /* empty place in table */
+#define PICTURE_RESOURCE    10                       /* native video picture */
 
-/*******************************************************************************
+/*****************************************************************************
  * resource_file_t: resource file descriptor
- *******************************************************************************
+ *****************************************************************************
  * This type describes a resource file and store it's resources table. It can
  * be used through the *Resource functions, or directly with the i_file field.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
     /* File informations */
-    int                     i_file;                         /* file descriptor */
-    int                     i_type;                               /* file type */
-    boolean_t               b_up_to_date;              /* is file up to date ? */
-    boolean_t               b_read_only;                     /* read-only mode */
+    int                     i_file;                       /* file descriptor */
+    int                     i_type;                             /* file type */
+    boolean_t               b_up_to_date;            /* is file up to date ? */
+    boolean_t               b_read_only;                   /* read-only mode */
 
     /* Resources table */
-    int                     i_size;                              /* table size */
-    resource_descriptor_t * p_resource;                     /* resources table */
+    int                     i_size;                            /* table size */
+    resource_descriptor_t * p_resource;                   /* resources table */
 } resource_file_t;
 
 /* Resources files types */
-#define VLC_RESOURCE_FILE   0                 /* VideoLAN Client resource file */
+#define VLC_RESOURCE_FILE   0               /* VideoLAN Client resource file */
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 resource_file_t *   CreateResourceFile  ( char *psz_filename, int i_type, int i_size, int i_mode );
 resource_file_t *   OpenResourceFile    ( char *psz_filename, int i_type, int i_flags );
 int                 UpdateResourceFile  ( resource_file_t *p_file );
@@ -68,6 +68,6 @@ int                 CloseResourceFile   ( resource_file_t *p_file );
 int                 SeekResource        ( resource_file_t *p_file, char *psz_name, int i_type );
 int                 ReadResource        ( resource_file_t *p_file, char *psz_name, int i_type,
                                           size_t max_size, byte_t *p_data );
-int                 WriteResource       ( resource_file_t *p_file, char *psz_name, int i_type, 
+int                 WriteResource       ( resource_file_t *p_file, char *psz_name, int i_type,
                                           size_t size, byte_t *p_data );
 
index 55ee93ec44de7f85b86437f95151574ce72da709..0a373320cca4f190392f373274e9240b221aeb16 100644 (file)
@@ -1,26 +1,26 @@
-/******************************************************************************
+/*****************************************************************************
  * spu_decoder.h : sub picture unit decoder thread interface
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * spudec_thread_t : sub picture unit decoder thread descriptor
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct spudec_thread_s
 {
     /*
      * Thread properties and locks
      */
-    boolean_t           b_die;                                  /* `die' flag */
-    boolean_t           b_run;                                  /* `run' flag */
-    boolean_t           b_active;                            /* `active' flag */
-    boolean_t           b_error;                              /* `error' flag */
-    vlc_thread_t        thread_id;                 /* id for thread functions */
+    boolean_t           b_die;                                 /* `die' flag */
+    boolean_t           b_run;                                 /* `run' flag */
+    boolean_t           b_active;                           /* `active' flag */
+    boolean_t           b_error;                             /* `error' flag */
+    vlc_thread_t        thread_id;                /* id for thread functions */
 
     /*
      * Input properties
      */
-    decoder_fifo_t      fifo;                   /* stores the PES stream data */
+    decoder_fifo_t      fifo;                  /* stores the PES stream data */
     /* The bit stream structure handles the PES stream at the bit level */
     bit_stream_t        bit_stream;
 
@@ -32,9 +32,9 @@ typedef struct spudec_thread_s
 
 } spudec_thread_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 spudec_thread_t *       spudec_CreateThread( input_thread_t * p_input );
 void                    spudec_DestroyThread( spudec_thread_t * p_spudec );
 
index 0d0704c62b51b6ea9d6edd6c0777eb6bc3ae9693..8238cca5427f84b36d0e3e55b359d1b7e46a380b 100644 (file)
@@ -12,7 +12,7 @@
 
 /*****************************************************************************
  * Common declarations
- *****************************************************************************/ 
+ *****************************************************************************/
 
 #ifndef VDEC_DFT
 typedef short dctelem_t;
@@ -87,7 +87,7 @@ struct vdec_thread_s;
  */
 
 #define CONST_BITS 8       /* Jimmy chose this constant :) */
+
 #ifdef EIGHT_BIT_SAMPLES
 #define PASS1_BITS  2
 #else
index 2958b786490395826b52c0fa6cacd3cbcfeb49b3..e9e145b82369acb66b38f5a6021b332f9b8214f1 100644 (file)
@@ -10,7 +10,7 @@
  *  "video_parser.h"
  *  "undec_picture.h"
  *****************************************************************************/
+
 /*****************************************************************************
  * Function pointers
  *****************************************************************************/
index 3d4fee4c65e4c57f66227c4f97d6ddf90f08cd12..038420fcafee4867469e757c86924124da37a5ed 100644 (file)
-/*******************************************************************************
+/*****************************************************************************
  * video.h: common video definitions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This header is required by all modules which have to handle pictures. It
  * includes all common video types and constants.
- *******************************************************************************
+ *****************************************************************************
  * Requires:
  *  "config.h"
  *  "common.h"
  *  "mtime.h"
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * yuv_data_t: type for storing one Y, U or V sample.
- *******************************************************************************/
+ *****************************************************************************/
 typedef u8 yuv_data_t;
 
-/*******************************************************************************
- * picture_t: video picture                                            
- *******************************************************************************
- * Any picture destined to be displayed by a video output thread should be 
+/*****************************************************************************
+ * picture_t: video picture
+ *****************************************************************************
+ * Any picture destined to be displayed by a video output thread should be
  * stored in this structure from it's creation to it's effective display.
  * Picture type and flags should only be modified by the output thread. Note
  * that an empty picture MUST have its flags set to 0.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct picture_s
 {
     /* Type and flags - should NOT be modified except by the vout thread */
-    int             i_type;                                    /* picture type */
-    int             i_status;                                 /* picture flags */
-    int             i_matrix_coefficients;       /* in YUV type, encoding type */    
+    int             i_type;                                  /* picture type */
+    int             i_status;                               /* picture flags */
+    int             i_matrix_coefficients;     /* in YUV type, encoding type */
 
     /* Picture management properties - these properties can be modified using
      * the video output thread API, but should ne be written directly */
-    int             i_refcount;                      /* link reference counter */
-    mtime_t         date;                                      /* display date */
-    
+    int             i_refcount;                    /* link reference counter */
+    mtime_t         date;                                    /* display date */
+
     /* Picture static properties - those properties are fixed at initialization
      * and should NOT be modified */
-    int             i_width;                                  /* picture width */
-    int             i_height;                                /* picture height */
-    int             i_chroma_width;                            /* chroma width */
+    int             i_width;                                /* picture width */
+    int             i_height;                              /* picture height */
+    int             i_chroma_width;                          /* chroma width */
 
-    /* Picture dynamic properties - those properties can be changed by the 
+    /* Picture dynamic properties - those properties can be changed by the
      * decoder */
-    int             i_display_horizontal_offset;     /* ISO/IEC 13818-2 6.3.12 */
-    int             i_display_vertical_offset;       /* ISO/IEC 13818-2 6.3.12 */
-    int             i_display_width;                   /* useful picture width */
-    int             i_display_height;                 /* useful picture height */
-    int             i_aspect_ratio;                            /* aspect ratio */  
-    
+    int             i_display_horizontal_offset;   /* ISO/IEC 13818-2 6.3.12 */
+    int             i_display_vertical_offset;     /* ISO/IEC 13818-2 6.3.12 */
+    int             i_display_width;                 /* useful picture width */
+    int             i_display_height;               /* useful picture height */
+    int             i_aspect_ratio;                          /* aspect ratio */
+
     /* Macroblock counter - the decoder use it to verify if it has
      * decoded all the macroblocks of the picture */
     int             i_deccount;
     vlc_mutex_t     lock_deccount;
-    
-    /* Picture data - data can always be freely modified. p_data itself 
+
+    /* Picture data - data can always be freely modified. p_data itself
      * (the pointer) should NEVER be modified. In YUV format, the p_y, p_u and
      * p_v data pointers refers to different areas of p_data, and should not
-     * be freed */   
-    void *          p_data;                                    /* picture data */
-    yuv_data_t *    p_y;          /* pointer to beginning of Y image in p_data */
-    yuv_data_t *    p_u;          /* pointer to beginning of U image in p_data */
-    yuv_data_t *    p_v;          /* pointer to beginning of V image in p_data */
+     * be freed */
+    void *          p_data;                                  /* picture data */
+    yuv_data_t *    p_y;        /* pointer to beginning of Y image in p_data */
+    yuv_data_t *    p_u;        /* pointer to beginning of U image in p_data */
+    yuv_data_t *    p_v;        /* pointer to beginning of V image in p_data */
 } picture_t;
 
 /* Pictures types */
-#define EMPTY_PICTURE           0       /* picture slot is empty and available */
-#define YUV_420_PICTURE         100                       /* 4:2:0 YUV picture */
-#define YUV_422_PICTURE         101                       /* 4:2:2 YUV picture */
-#define YUV_444_PICTURE         102                       /* 4:4:4 YUV picture */
+#define EMPTY_PICTURE           0     /* picture slot is empty and available */
+#define YUV_420_PICTURE         100                     /* 4:2:0 YUV picture */
+#define YUV_422_PICTURE         101                     /* 4:2:2 YUV picture */
+#define YUV_444_PICTURE         102                     /* 4:4:4 YUV picture */
 
 /* Pictures status */
-#define FREE_PICTURE            0         /* picture is free and not allocated */
-#define RESERVED_PICTURE        1         /* picture is allocated and reserved */
-#define RESERVED_DATED_PICTURE  2     /* picture is waiting for DisplayPicture */
-#define RESERVED_DISP_PICTURE   3      /* picture is waiting for a DatePixture */
-#define READY_PICTURE           4              /* picture is ready for display */
-#define DISPLAYED_PICTURE       5  /* picture has been displayed but is linked */
-#define DESTROYED_PICTURE       6     /* picture is allocated but no more used */
+#define FREE_PICTURE            0       /* picture is free and not allocated */
+#define RESERVED_PICTURE        1       /* picture is allocated and reserved */
+#define RESERVED_DATED_PICTURE  2   /* picture is waiting for DisplayPicture */
+#define RESERVED_DISP_PICTURE   3    /* picture is waiting for a DatePixture */
+#define READY_PICTURE           4            /* picture is ready for display */
+#define DISPLAYED_PICTURE       5/* picture has been displayed but is linked */
+#define DESTROYED_PICTURE       6   /* picture is allocated but no more used */
 
 /* Aspect ratios (ISO/IEC 13818-2 section 6.3.3, table 6-3) */
-#define AR_SQUARE_PICTURE       1                             /* square pixels */
-#define AR_3_4_PICTURE          2                          /* 3:4 picture (TV) */
-#define AR_16_9_PICTURE         3                /* 16:9 picture (wide screen) */
-#define AR_221_1_PICTURE        4                    /* 2.21:1 picture (movie) */
-
-/*******************************************************************************
- * subpicture_t: video sub picture unit                                            
- *******************************************************************************
+#define AR_SQUARE_PICTURE       1                           /* square pixels */
+#define AR_3_4_PICTURE          2                        /* 3:4 picture (TV) */
+#define AR_16_9_PICTURE         3              /* 16:9 picture (wide screen) */
+#define AR_221_1_PICTURE        4                  /* 2.21:1 picture (movie) */
+
+/*****************************************************************************
+ * subpicture_t: video sub picture unit
+ *****************************************************************************
  * Any sub picture unit destined to be displayed by a video output thread should
  * be stored in this structure from it's creation to it's effective display.
  * Subtitle type and flags should only be modified by the output thread. Note
  * that an empty subtitle MUST have its flags set to 0.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct subpicture_s
 {
     /* Type and flags - should NOT be modified except by the vout thread */
-    int             i_type;                                            /* type */
-    int             i_status;                                         /* flags */
-    int             i_size;                                       /* data size */
-    
+    int             i_type;                                          /* type */
+    int             i_status;                                       /* flags */
+    int             i_size;                                     /* data size */
+
     /* Other properties */
-    mtime_t         begin_date;                   /* beginning of display date */
-    mtime_t         end_date;                           /* end of display date */
+    mtime_t         begin_date;                 /* beginning of display date */
+    mtime_t         end_date;                         /* end of display date */
 
     /* Display properties - these properties are only indicative and may be
      * changed by the video output thread, or simply ignored depending of the
      * subpicture type. */
-    int             i_x;                     /* offset from alignment position */
-    int             i_y;                     /* offset from alignment position */
-    int             i_width;                                  /* picture width */
-    int             i_height;                                /* picture height */
-    int             i_horizontal_align;                /* horizontal alignment */
-    int             i_vertical_align;                    /* vertical alignment */
+    int             i_x;                   /* offset from alignment position */
+    int             i_y;                   /* offset from alignment position */
+    int             i_width;                                /* picture width */
+    int             i_height;                              /* picture height */
+    int             i_horizontal_align;              /* horizontal alignment */
+    int             i_vertical_align;                  /* vertical alignment */
 
     /* Additionnal properties depending of the subpicture type */
-    union 
+    union
     {
         /* Text subpictures properties - text is stored in data area, in ASCIIZ
          * format */
-        struct          
+        struct
         {
-            p_vout_font_t       p_font;              /* font, NULL for default */    
-            int                 i_style;                         /* text style */
-            u32                 i_char_color;               /* character color */
-            u32                 i_border_color;                /* border color */
-            u32                 i_bg_color;                /* background color */
-        } text;                
-    } type;        
-
-    /* Subpicture data, format depends of type - data can always be freely 
+            p_vout_font_t       p_font;            /* font, NULL for default */
+            int                 i_style;                       /* text style */
+            u32                 i_char_color;             /* character color */
+            u32                 i_border_color;              /* border color */
+            u32                 i_bg_color;              /* background color */
+        } text;
+    } type;
+
+    /* Subpicture data, format depends of type - data can always be freely
      * modified. p_data itself (the pointer) should NEVER be modified. */
-    void *          p_data;                                 /* subpicture data */    
+    void *          p_data;                               /* subpicture data */
 } subpicture_t;
 
 /* Subpicture type */
-#define EMPTY_SUBPICTURE        0      /* subtitle slot is empty and available */
-#define RLE_SUBPICTURE          100                    /* RLE encoded subtitle */
-#define TEXT_SUBPICTURE         200                        /* single line text */
+#define EMPTY_SUBPICTURE        0    /* subtitle slot is empty and available */
+#define RLE_SUBPICTURE          100                  /* RLE encoded subtitle */
+#define TEXT_SUBPICTURE         200                      /* single line text */
 
 /* Subpicture status */
-#define FREE_SUBPICTURE         0      /* subpicture is free and not allocated */
-#define RESERVED_SUBPICTURE     1      /* subpicture is allocated and reserved */
-#define READY_SUBPICTURE        2           /* subpicture is ready for display */
-#define DESTROYED_SUBPICTURE    3  /* subpicture is allocated but no more used */
+#define FREE_SUBPICTURE         0    /* subpicture is free and not allocated */
+#define RESERVED_SUBPICTURE     1    /* subpicture is allocated and reserved */
+#define READY_SUBPICTURE        2         /* subpicture is ready for display */
+#define DESTROYED_SUBPICTURE    3/* subpicture is allocated but no more used */
 
 /* Alignment types */
-#define RIGHT_ALIGN             10                  /* x is absolute for right */
-#define LEFT_ALIGN              11                   /* x is absolute for left */
-#define RIGHT_RALIGN            12       /* x is relative for right from right */
-#define LEFT_RALIGN             13         /* x is relative for left from left */
+#define RIGHT_ALIGN             10                /* x is absolute for right */
+#define LEFT_ALIGN              11                 /* x is absolute for left */
+#define RIGHT_RALIGN            12     /* x is relative for right from right */
+#define LEFT_RALIGN             13       /* x is relative for left from left */
 
-#define CENTER_ALIGN            20             /* x, y are absolute for center */
+#define CENTER_ALIGN            20           /* x, y are absolute for center */
 #define CENTER_RALIGN           21 /* x, y are relative for center from center */
 
-#define BOTTOM_ALIGN            30                 /* y is absolute for bottom */
-#define TOP_ALIGN               31                    /* y is absolute for top */
-#define BOTTOM_RALIGN           32     /* y is relative for bottom from bottom */
-#define TOP_RALIGN              33           /* y is relative for top from top */
-#define SUBTITLE_RALIGN         34   /* y is relative for center from subtitle */
+#define BOTTOM_ALIGN            30               /* y is absolute for bottom */
+#define TOP_ALIGN               31                  /* y is absolute for top */
+#define BOTTOM_RALIGN           32   /* y is relative for bottom from bottom */
+#define TOP_RALIGN              33         /* y is relative for top from top */
+#define SUBTITLE_RALIGN         34 /* y is relative for center from subtitle */
 
 
index 48767e94b75fec396fe81d0ad7d9d1b2eccecb88..87f1b83d678d9c242ba5c952697a7f39244e6fbd 100644 (file)
@@ -56,7 +56,7 @@ typedef struct vdec_thread_s
     u8 *            pi_crop;
 //#endif
 #endif
-        
+
 #ifdef STATS
     /* Statistics */
     count_t         c_loops;                              /* number of loops */
@@ -65,7 +65,7 @@ typedef struct vdec_thread_s
     count_t         c_pictures;                   /* number of pictures read */
     count_t         c_i_pictures;               /* number of I pictures read */
     count_t         c_p_pictures;               /* number of P pictures read */
-    count_t         c_b_pictures;               /* number of B pictures read */    
+    count_t         c_b_pictures;               /* number of B pictures read */
 #endif
     count_t         c_decoded_pictures;        /* number of pictures decoded */
     count_t         c_decoded_i_pictures;    /* number of I pictures decoded */
index c9e5a37a230551728f2f9bdb06d0269c0fd83685..adbfe848178336de5cb64aac0881ab870ad038e0 100644 (file)
 #ifdef VDEC_SMP
 /* ?? move to inline functions */
 #define VIDEO_FIFO_ISEMPTY( fifo )    ( (fifo).i_start == (fifo).i_end )
-#define VIDEO_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start ) \
+#define VIDEO_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start )\
                                           & VFIFO_SIZE ) == 0 )
 #define VIDEO_FIFO_START( fifo )      ( (fifo).buffer[ (fifo).i_start ] )
 #define VIDEO_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1) \
-                                                           & VFIFO_SIZE ) 
+                                                           & VFIFO_SIZE )
 #define VIDEO_FIFO_END( fifo )        ( (fifo).buffer[ (fifo).i_end ] )
 #define VIDEO_FIFO_INCEND( fifo )     ( (fifo).i_end = ((fifo).i_end + 1) \
                                                          & VFIFO_SIZE )
@@ -46,12 +46,12 @@ static __inline__ macroblock_t * vpar_GetMacroblock( video_fifo_t * p_fifo )
             return( NULL );
         }
     }
-    
+
     p_mb = VIDEO_FIFO_START( *p_fifo );
     VIDEO_FIFO_INCSTART( *p_fifo );
 
     vlc_mutex_unlock( &p_fifo->lock );
-    
+
     return( p_mb );
 #else
     /* Shouldn't normally be used without SMP. */
@@ -101,7 +101,7 @@ static __inline__ void vpar_DecodeMacroblock( video_fifo_t * p_fifo,
 #ifdef VDEC_SMP
     /* Place picture in the video FIFO */
     vlc_mutex_lock( &p_fifo->lock );
-        
+
     /* By construction, the video FIFO cannot be full */
     VIDEO_FIFO_END( *p_fifo ) = p_mb;
     VIDEO_FIFO_INCEND( *p_fifo );
@@ -136,7 +136,7 @@ static __inline__ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo,
 
         /* Warn Synchro for its records. */
         vpar_SynchroEnd( p_fifo->p_vpar );
-     
+
         /* Unlink referenced pictures */
         if( p_mb->p_forward != NULL )
         {
index 852bb3df82c78f3b6e04dfcc8ec9e7c85b4e1267..b2b63927024ce2c34d34c9213f15996db9cd9a91 100644 (file)
@@ -1,19 +1,19 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_graphics.h: pictures manipulation primitives
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Includes function to compose, convert and display pictures, and also basic
- * functions to copy pictures data or descriptors. 
- *******************************************************************************
+ * functions to copy pictures data or descriptors.
+ *****************************************************************************
  * Requires:
  *  "config.h"
  *  "common.h"
  *  "mtime.h"
  *  "video.h"
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 
 
index 288645b8d28de9a7e869fdf978717361abc746c7..874d3672f3247d4a1ce4909d56645da1649ff5b6 100644 (file)
-/*******************************************************************************
+/*****************************************************************************
  * video_output.h : video output thread
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This module describes the programming interface for video output threads.
  * It includes functions allowing to open a new thread, send pictures to a
  * thread, and destroy a previously oppenned video output thread.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_yuv_convert_t: YUV convertion function
- *******************************************************************************
+ *****************************************************************************
  * This is the prototype common to all convertion functions. The type of p_pic
  * will change depending of the screen depth treated.
  * Parameters:
  *      p_vout                          video output thread
- *      p_pic                           picture address 
+ *      p_pic                           picture address
  *      p_y, p_u, p_v                   Y,U,V samples addresses
  *      i_width, i_height               Y samples extension
  *      i_pic_width, i_pic_height       picture extension
  *      i_pic_line_width                picture total line width
  *      i_matrix_coefficients           matrix coefficients
  * Picture width and source dimensions must be multiples of 16.
- *******************************************************************************/
+ *****************************************************************************/
 typedef void (vout_yuv_convert_t)( p_vout_thread_t p_vout, void *p_pic,
                                    yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
                                    int i_width, int i_height,
                                    int i_pic_width, int i_pic_height, int i_pic_line_width,
                                    int i_matrix_coefficients );
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_yuv_t: pre-calculated YUV convertion tables
- *******************************************************************************
+ *****************************************************************************
  * These tables are used by convertion and scaling functions.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_yuv_s
 {
     /* Convertion functions */
-    vout_yuv_convert_t *        p_Convert420;          /* YUV 4:2:0 converter */
-    vout_yuv_convert_t *        p_Convert422;          /* YUV 4:2:2 converter */
-    vout_yuv_convert_t *        p_Convert444;          /* YUV 4:4:4 converter */
+    vout_yuv_convert_t *        p_Convert420;         /* YUV 4:2:0 converter */
+    vout_yuv_convert_t *        p_Convert422;         /* YUV 4:2:2 converter */
+    vout_yuv_convert_t *        p_Convert444;         /* YUV 4:4:4 converter */
 
     /* Pre-calculated convertion tables */
-    void *              p_base;             /* base for all conversion tables */
+    void *              p_base;            /* base for all conversion tables */
     union
     {
-        u8 *            p_gray8;                         /* gray 8 bits table */
-        u16 *           p_gray16;                       /* gray 16 bits table */
-        u32 *           p_gray32;                       /* gray 32 bits table */
-        u8 *            p_rgb8;                           /* RGB 8 bits table */
-        u16 *           p_rgb16;                         /* RGB 16 bits table */
-        u32 *           p_rgb32;                         /* RGB 32 bits table */
+        u8 *            p_gray8;                        /* gray 8 bits table */
+        u16 *           p_gray16;                      /* gray 16 bits table */
+        u32 *           p_gray32;                      /* gray 32 bits table */
+        u8 *            p_rgb8;                          /* RGB 8 bits table */
+        u16 *           p_rgb16;                        /* RGB 16 bits table */
+        u32 *           p_rgb32;                        /* RGB 32 bits table */
     } yuv;
 
     /* Temporary convertion buffer and offset array */
-    void *              p_buffer;                        /* convertion buffer */
-    int *               p_offset;                             /* offset array */
+    void *              p_buffer;                       /* convertion buffer */
+    int *               p_offset;                            /* offset array */
 } vout_yuv_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_buffer_t: rendering buffer
- *******************************************************************************
+ *****************************************************************************
  * This structure store informations about a buffer. Buffers are not completely
  * cleared between displays, and modified areas needs to be stored.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_buffer_s
-{     
+{
     /* Picture area */
-    int         i_pic_x, i_pic_y;                        /* picture position  */
-    int         i_pic_width, i_pic_height;               /* picture extension */
-    
+    int         i_pic_x, i_pic_y;                       /* picture position  */
+    int         i_pic_width, i_pic_height;              /* picture extension */
+
     /* Other areas - only vertical extensions of areas are stored */
-    int         i_areas;                                   /* number of areas */
-    int         pi_area_begin[VOUT_MAX_AREAS];           /* beginning of area */
-    int         pi_area_end[VOUT_MAX_AREAS];                   /* end of area */
-    
+    int         i_areas;                                  /* number of areas */
+    int         pi_area_begin[VOUT_MAX_AREAS];          /* beginning of area */
+    int         pi_area_end[VOUT_MAX_AREAS];                  /* end of area */
+
     /* Picture data */
-    byte_t *    p_data;                                     /* memory address */
+    byte_t *    p_data;                                    /* memory address */
 } vout_buffer_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_thread_t: video output thread descriptor
- *******************************************************************************
+ *****************************************************************************
  * Any independant video output device, such as an X11 window or a GGI device,
- * is represented by a video output thread, and described using following 
+ * is represented by a video output thread, and described using following
  * structure.
- *******************************************************************************/
+ *****************************************************************************/
 typedef void (vout_set_palette_t)( p_vout_thread_t p_vout,
                                    u16 *red, u16 *green, u16 *blue, u16 *transp );
 
 typedef struct vout_thread_s
 {
     /* Thread properties and lock */
-    boolean_t           b_die;                                  /* `die' flag */
-    boolean_t           b_error;                              /* `error' flag */
-    boolean_t           b_active;                            /* `active' flag */
-    vlc_thread_t        thread_id;                /* id for pthread functions */
-    vlc_mutex_t         picture_lock;                    /* picture heap lock */
-    vlc_mutex_t         subpicture_lock;              /* subpicture heap lock */
-    vlc_mutex_t         change_lock;                    /* thread change lock */
-    int *               pi_status;                   /* temporary status flag */
-    p_vout_sys_t        p_sys;                        /* system output method */
-
-    /* Current display properties */    
-    u16                 i_changes;              /* changes made to the thread */
-    int                 i_width;               /* current output method width */
-    int                 i_height;             /* current output method height */
-    int                 i_bytes_per_line;   /* bytes per line (incl. virtual) */
-    int                 i_screen_depth;   /* significant bpp: 8, 15, 16 or 24 */
-    int                 i_bytes_per_pixel; /* real screen depth: 1, 2, 3 or 4 */
-    float               f_gamma;                                     /* gamma */
-
-    /* Color masks and shifts in RGB mode - masks are set by system 
-     * initialization, shifts are calculated. A pixel color value can be 
+    boolean_t           b_die;                                 /* `die' flag */
+    boolean_t           b_error;                             /* `error' flag */
+    boolean_t           b_active;                           /* `active' flag */
+    vlc_thread_t        thread_id;               /* id for pthread functions */
+    vlc_mutex_t         picture_lock;                   /* picture heap lock */
+    vlc_mutex_t         subpicture_lock;             /* subpicture heap lock */
+    vlc_mutex_t         change_lock;                   /* thread change lock */
+    int *               pi_status;                  /* temporary status flag */
+    p_vout_sys_t        p_sys;                       /* system output method */
+
+    /* Current display properties */
+    u16                 i_changes;             /* changes made to the thread */
+    int                 i_width;              /* current output method width */
+    int                 i_height;            /* current output method height */
+    int                 i_bytes_per_line;  /* bytes per line (incl. virtual) */
+    int                 i_screen_depth;  /* significant bpp: 8, 15, 16 or 24 */
+    int                 i_bytes_per_pixel;/* real screen depth: 1, 2, 3 or 4 */
+    float               f_gamma;                                    /* gamma */
+
+    /* Color masks and shifts in RGB mode - masks are set by system
+     * initialization, shifts are calculated. A pixel color value can be
      * obtained using the formula ((value >> rshift) << lshift) */
-    u32                 i_red_mask;                               /* red mask */
-    u32                 i_green_mask;                           /* green mask */
-    u32                 i_blue_mask;                             /* blue mask */
-    int                 i_red_lshift, i_red_rshift;             /* red shifts */
-    int                 i_green_lshift, i_green_rshift;       /* green shifts */
-    int                 i_blue_lshift, i_blue_rshift;          /* blue shifts */
-
-    /* Useful pre-calculated pixel values - these are not supposed to be 
+    u32                 i_red_mask;                              /* red mask */
+    u32                 i_green_mask;                          /* green mask */
+    u32                 i_blue_mask;                            /* blue mask */
+    int                 i_red_lshift, i_red_rshift;            /* red shifts */
+    int                 i_green_lshift, i_green_rshift;      /* green shifts */
+    int                 i_blue_lshift, i_blue_rshift;         /* blue shifts */
+
+    /* Useful pre-calculated pixel values - these are not supposed to be
      * accurate values, but rather values looking nice, given their usage. */
-    u32                 i_white_pixel;                               /* white */
-    u32                 i_black_pixel;                               /* black */
-    u32                 i_gray_pixel;                                 /* gray */
-    u32                 i_blue_pixel;                                 /* blue */
+    u32                 i_white_pixel;                              /* white */
+    u32                 i_black_pixel;                              /* black */
+    u32                 i_gray_pixel;                                /* gray */
+    u32                 i_blue_pixel;                                /* blue */
 
     /* Pictures and rendering properties */
-    boolean_t           b_grayscale;            /* color or grayscale display */
-    boolean_t           b_info;             /* print additionnal informations */
-    boolean_t           b_interface;                      /* render interface */
-    boolean_t           b_scale;                     /* allow picture scaling */
-    vout_set_palette_t *p_set_palette;                   /* sets 8bpp palette */
+    boolean_t           b_grayscale;           /* color or grayscale display */
+    boolean_t           b_info;            /* print additionnal informations */
+    boolean_t           b_interface;                     /* render interface */
+    boolean_t           b_scale;                    /* allow picture scaling */
+    vout_set_palette_t *p_set_palette;                  /* sets 8bpp palette */
 
     /* Idle screens management */
-    mtime_t             last_display_date;      /* last non idle display date */
-    mtime_t             last_idle_date;             /* last idle display date */
+    mtime_t             last_display_date;     /* last non idle display date */
+    mtime_t             last_idle_date;            /* last idle display date */
 
-#ifdef STATS    
+#ifdef STATS
     /* Statistics - these numbers are not supposed to be accurate, but are a
      * good indication of the thread status */
-    mtime_t             render_time;              /* last picture render time */
-    count_t             c_fps_samples;                      /* picture counts */
+    mtime_t             render_time;             /* last picture render time */
+    count_t             c_fps_samples;                     /* picture counts */
     mtime_t             p_fps_sample[ VOUT_FPS_SAMPLES ];/* FPS samples dates */
 #endif
 
     /* Rendering buffers */
-    int                 i_buffer_index;                       /* buffer index */
-    vout_buffer_t       p_buffer[2];                    /* buffers properties */
+    int                 i_buffer_index;                      /* buffer index */
+    vout_buffer_t       p_buffer[2];                   /* buffers properties */
 
     /* Videos heap and translation tables */
-    picture_t           p_picture[VOUT_MAX_PICTURES];             /* pictures */
-    subpicture_t        p_subpicture[VOUT_MAX_PICTURES];       /* subpictures */
-    vout_yuv_t          yuv;                            /* translation tables */
+    picture_t           p_picture[VOUT_MAX_PICTURES];            /* pictures */
+    subpicture_t        p_subpicture[VOUT_MAX_PICTURES];      /* subpictures */
+    vout_yuv_t          yuv;                           /* translation tables */
 
     /* Bitmap fonts */
-    p_vout_font_t       p_default_font;                       /* default font */
-    p_vout_font_t       p_large_font;                           /* large font */
+    p_vout_font_t       p_default_font;                      /* default font */
+    p_vout_font_t       p_large_font;                          /* large font */
 } vout_thread_t;
 
 /* Flags for changes - these flags are set in the i_changes field when another
  * thread changed a variable */
-#define VOUT_INFO_CHANGE        0x0001                      /* b_info changed */
-#define VOUT_GRAYSCALE_CHANGE   0x0002                 /* b_grayscale changed */
-#define VOUT_INTF_CHANGE        0x0004                 /* b_interface changed */
-#define VOUT_SCALE_CHANGE       0x0008                     /* b_scale changed */
-#define VOUT_SIZE_CHANGE        0x0200                        /* size changed */
-#define VOUT_DEPTH_CHANGE       0x0400                       /* depth changed */
-#define VOUT_GAMMA_CHANGE       0x0010                       /* gamma changed */
-#define VOUT_YUV_CHANGE         0x0800                   /* change yuv tables */
-#define VOUT_NODISPLAY_CHANGE   0xff00     /* changes which forbidden display */
-
-/*******************************************************************************
+#define VOUT_INFO_CHANGE        0x0001                     /* b_info changed */
+#define VOUT_GRAYSCALE_CHANGE   0x0002                /* b_grayscale changed */
+#define VOUT_INTF_CHANGE        0x0004                /* b_interface changed */
+#define VOUT_SCALE_CHANGE       0x0008                    /* b_scale changed */
+#define VOUT_SIZE_CHANGE        0x0200                       /* size changed */
+#define VOUT_DEPTH_CHANGE       0x0400                      /* depth changed */
+#define VOUT_GAMMA_CHANGE       0x0010                      /* gamma changed */
+#define VOUT_YUV_CHANGE         0x0800                  /* change yuv tables */
+#define VOUT_NODISPLAY_CHANGE   0xff00    /* changes which forbidden display */
+
+/*****************************************************************************
  * Macros
- *******************************************************************************/
+ *****************************************************************************/
 
 /* RGB2PIXEL: assemble RGB components to a pixel value, returns a u32 */
-#define RGB2PIXEL( p_vout, i_red, i_green, i_blue )                            \
-    (((((u32)i_red)   >> p_vout->i_red_rshift)   << p_vout->i_red_lshift)   |  \
-     ((((u32)i_green) >> p_vout->i_green_rshift) << p_vout->i_green_lshift) |  \
+#define RGB2PIXEL( p_vout, i_red, i_green, i_blue )                           \
+    (((((u32)i_red)   >> p_vout->i_red_rshift)   << p_vout->i_red_lshift)   | \
+     ((((u32)i_green) >> p_vout->i_green_rshift) << p_vout->i_green_lshift) | \
      ((((u32)i_blue)  >> p_vout->i_blue_rshift)  << p_vout->i_blue_lshift))
 
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
-vout_thread_t * vout_CreateThread       ( char *psz_display, int i_root_window, 
+ *****************************************************************************/
+vout_thread_t * vout_CreateThread       ( char *psz_display, int i_root_window,
                                           int i_width, int i_height, int *pi_status );
 void            vout_DestroyThread      ( vout_thread_t *p_vout, int *pi_status );
-picture_t *     vout_CreatePicture      ( vout_thread_t *p_vout, int i_type, 
+picture_t *     vout_CreatePicture      ( vout_thread_t *p_vout, int i_type,
                                           int i_width, int i_height );
 void            vout_DestroyPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
 void            vout_DisplayPicture     ( vout_thread_t *p_vout, picture_t *p_pic );
index 2187bcc38cbc926fe8862d0e0f8c4e50c5ceffd7..1df692dfc507b16b2ad1ad8f162ea32aa37b2d40 100644 (file)
@@ -75,7 +75,7 @@ typedef struct vpar_thread_s
     /* ?? */
  /*??*/
 //    int *pi_status;
-    
+
 
     /* Input properties */
     decoder_fifo_t      fifo;                              /* PES input fifo */
@@ -85,7 +85,7 @@ typedef struct vpar_thread_s
 
     /* Output properties */
     vout_thread_t *     p_vout;                       /* video output thread */
-    
+
     /* Decoder properties */
     struct vdec_thread_s *      pp_vdec[NB_VDEC];
     video_fifo_t                vfifo;
index ec983a86f0ce547d93b06f5c7f69c431e2f27ce0..802e08f1b84a645f4373a5aad5f0ef92c3d6ee06 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_sys.h: system dependant video output display method API
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int          vout_SysCreate     ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
 int          vout_SysInit       ( p_vout_thread_t p_vout );
 void         vout_SysEnd        ( p_vout_thread_t p_vout );
index c35e8d6dafab777db745671c6b4b49f81534f8c6..cc60e935730e4e4a7a32ffbfef51ea1810942416 100644 (file)
@@ -1,26 +1,26 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_text.h : text manipulation functions
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Text styles - these are primary text styles, used by the vout_Print function.
  * They may be ignored or interpreted by higher level functions */
-#define WIDE_TEXT                       1           /* interspacing is doubled */
-#define ITALIC_TEXT                     2                            /* italic */
-#define OPAQUE_TEXT                     4              /* text with background */
-#define OUTLINED_TEXT                   8             /* border around letters */
-#define VOID_TEXT                      16                     /* no foreground */
+#define WIDE_TEXT                       1         /* interspacing is doubled */
+#define ITALIC_TEXT                     2                          /* italic */
+#define OPAQUE_TEXT                     4            /* text with background */
+#define OUTLINED_TEXT                   8           /* border around letters */
+#define VOID_TEXT                      16                   /* no foreground */
 
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 p_vout_font_t   vout_LoadFont   ( const char *psz_name );
 void            vout_UnloadFont ( p_vout_font_t p_font );
-void            vout_TextSize   ( p_vout_font_t p_font, int i_style, 
+void            vout_TextSize   ( p_vout_font_t p_font, int i_style,
                                   const char *psz_text,
                                   int *pi_width, int *pi_height );
-void            vout_Print      ( p_vout_font_t p_font, byte_t *p_pic, 
+void            vout_Print      ( p_vout_font_t p_font, byte_t *p_pic,
                                   int i_bytes_per_pixel, int i_bytes_per_line,
                                   u32 i_char_color, u32 i_border_color, u32 i_bg_color,
                                   int i_style, const char *psz_text );
index e2d2c5dbab18e9e323b986c7028fc05d862715d1..989003e174832d9fcaa1ffcfff069bd88aeec1cc 100644 (file)
@@ -1,10 +1,10 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_x11.h: X11 video output display method
  * (c)1999 VideoLAN
- *******************************************************************************
- * The X11 method for video output thread. The functions declared here should 
+ *****************************************************************************
+ * The X11 method for video output thread. The functions declared here should
  * not be needed by any other module than video_output.c.
- *******************************************************************************
+ *****************************************************************************
  * Required headers:
  * <X11/Xlib.h>
  * <X11/Xutil.h>
  * "mtime.h"
  * "video.h"
  * "video_output.h"
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_x11_t: video output X11 method descriptor
- *******************************************************************************
+ *****************************************************************************
  * This structure is part of the video output thread descriptor.
- * It describes the X11 specific properties of an output thread. X11 video 
+ * It describes the X11 specific properties of an output thread. X11 video
  * output is performed through regular resizable windows. Windows can be
  * dynamically resized to adapt to the size of the streams.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_x11_s
 {
     /* User settings */
-    boolean_t           b_shm_ext;             /* shared memory extension flag */
+    boolean_t           b_shm_ext;           /* shared memory extension flag */
 
-    /* Thread configuration - these properties are copied from a video_cfg_t 
+    /* Thread configuration - these properties are copied from a video_cfg_t
      * structure to be used in second step of initialization */
-    char *              psz_display;                           /* display name */
-    char *              psz_title;                             /* window title */
+    char *              psz_display;                         /* display name */
+    char *              psz_title;                           /* window title */
 
     /* Internal settings and properties */
-    Display *           p_display;                          /* display pointer */
-    int                 i_screen;                             /* screen number */
-    Window              window;                     /* window instance handler */
-    GC                  gc;                /* graphic context instance handler */    
+    Display *           p_display;                        /* display pointer */
+    int                 i_screen;                           /* screen number */
+    Window              window;                   /* window instance handler */
+    GC                  gc;              /* graphic context instance handler */
 
     /* Window manager hints and atoms */
-    Atom                wm_protocols;                     /* WM_PROTOCOLS atom */
-    Atom                wm_delete_window;             /* WM_DELETE_WINDOW atom */
+    Atom                wm_protocols;                   /* WM_PROTOCOLS atom */
+    Atom                wm_delete_window;           /* WM_DELETE_WINDOW atom */
 
     /* Color maps and translation tables - some of those tables are shifted,
      * see x11.c for more informations. */
-    u8 *                trans_16bpp_red;           /* red (16 bpp) (SHIFTED !) */
-    u8 *                trans_16bpp_green;       /* green (16 bpp) (SHIFTED !) */
-    u8 *                trans_16bpp_blue;         /* blue (16 bpp) (SHIFTED !) */
+    u8 *                trans_16bpp_red;         /* red (16 bpp) (SHIFTED !) */
+    u8 *                trans_16bpp_green;     /* green (16 bpp) (SHIFTED !) */
+    u8 *                trans_16bpp_blue;       /* blue (16 bpp) (SHIFTED !) */
 
     /* ?? colormaps ? */
-    boolean_t           b_private_colormap;          /* private color map flag */
-    Colormap            private_colormap;                 /* private color map */
+    boolean_t           b_private_colormap;        /* private color map flag */
+    Colormap            private_colormap;               /* private color map */
 
     /* Display buffers and shared memory information */
-    int                 i_buffer_index;                        /* buffer index */
-    XImage *            p_ximage[2];                         /* XImage pointer */   
-    XShmSegmentInfo     shm_info[2];         /* shared memory zone information */
+    int                 i_buffer_index;                      /* buffer index */
+    XImage *            p_ximage[2];                       /* XImage pointer */
+    XShmSegmentInfo     shm_info[2];       /* shared memory zone information */
 
-    int                 i_completion_type;                               /* ?? */
+    int                 i_completion_type;                             /* ?? */
 } vout_x11_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int     vout_X11AllocOutputMethod   ( vout_thread_t *p_vout, video_cfg_t *p_cfg );
-void    vout_X11FreeOutputMethod    ( vout_thread_t *p_vout );    
+void    vout_X11FreeOutputMethod    ( vout_thread_t *p_vout );
 int     vout_X11CreateOutputMethod  ( vout_thread_t *p_vout );
 void    vout_X11DestroyOutputMethod ( vout_thread_t *p_vout );
 int     vout_X11ManageOutputMethod  ( vout_thread_t *p_vout );
index 52396b9acd3a78feaa21240f6da2e97c869958e1..22db32a68edf390ad2c26cb404b382a727d8c93e 100644 (file)
@@ -1,24 +1,24 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_yuv.h: YUV transformation functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Provides functions prototypes to perform the YUV conversion. The functions
  * may be implemented in one of the video_yuv_* files.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Prototypes
- *******************************************************************************/
+ *****************************************************************************/
 int             vout_InitYUV      ( vout_thread_t *p_vout );
 int             vout_ResetYUV     ( vout_thread_t *p_vout );
 void            vout_EndYUV       ( vout_thread_t *p_vout );
 
-/*******************************************************************************
+/*****************************************************************************
  * External prototypes
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef HAVE_MMX
 
-/* YUV transformations for MMX - in video_yuv_mmx.S 
+/* YUV transformations for MMX - in video_yuv_mmx.S
  *      p_y, p_u, p_v:          Y U and V planes
  *      i_width, i_height:      frames dimensions (pixels)
  *      i_ypitch, i_vpitch:     Y and V lines sizes (bytes)
@@ -28,10 +28,10 @@ void            vout_EndYUV       ( vout_thread_t *p_vout );
  *      i_offset_to_line_0:     ?? x offset for left image border
  *      i_pitch:                RGB line size (bytes)
  *      i_colortype:            0 for 565, 1 for 555 */
-void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v, 
+void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v,
                             unsigned int i_width, unsigned int i_height,
                             unsigned int i_ypitch, unsigned int i_vpitch,
-                            unsigned int i_aspect, u8 *p_pic, 
+                            unsigned int i_aspect, u8 *p_pic,
                             u32 i_dci_offset, u32 i_offset_to_line_0,
                             int i_pitch, int i_colortype );
 #endif
index d776a3f30723c1b76ef2967dcae7e636a0284b98..be7cbff4cf8a1320e3e50e6159c70c2569eee3ef 100644 (file)
@@ -1,15 +1,15 @@
-/*******************************************************************************
+/*****************************************************************************
  * vlc.h: all headers
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This header includes all vlc .h headers and depending headers. A source file
  * including it would also be able to use any of the structures of the project.
  * Note that functions or system headers specific to the file itself are not
  * included.
- *******************************************************************************
+ *****************************************************************************
  * required headers:
  *  none
- *******************************************************************************/
+ *****************************************************************************/
 
 /* System headers */
 #include <errno.h>
index e6ecd428a9c025f5cfaa7a27980000b6e3e80a4b..b2ae5671626b47169f2bdc1cfa3a363ac5a0ab70 100644 (file)
@@ -1,50 +1,50 @@
-/*******************************************************************************
+/*****************************************************************************
  * vlc_thread.h : thread implementation for vieolan client
  * (c)1999 VideoLAN
- *******************************************************************************
- * This header is supposed to provide a portable threads implementation. 
+ *****************************************************************************
+ * This header is supposed to provide a portable threads implementation.
  * Currently, it is a wrapper to the POSIX pthreads library.
- *******************************************************************************/
+ *****************************************************************************/
 #include <pthread.h>
 
-/******************************************************************************
+/*****************************************************************************
  * Constants
- ******************************************************************************
- * These constants are used by all threads in *_CreateThread() and 
+ *****************************************************************************
+ * These constants are used by all threads in *_CreateThread() and
  * *_DestroyThreads() functions. Since those calls are non-blocking, an integer
  * value is used as a shared flag to represent the status of the thread.
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Void status - this value can be used to be sure, in an array of recorded
  * threads, that no operation is currently in progress on the concerned thread */
-#define THREAD_NOP          0                              /* nothing happened */
+#define THREAD_NOP          0                            /* nothing happened */
 
 /* Creation status */
-#define THREAD_CREATE       10                       /* thread is initializing */
-#define THREAD_START        11                            /* thread has forked */
-#define THREAD_READY        19                              /* thread is ready */
+#define THREAD_CREATE       10                     /* thread is initializing */
+#define THREAD_START        11                          /* thread has forked */
+#define THREAD_READY        19                            /* thread is ready */
 
 /* Destructions status */
-#define THREAD_DESTROY      20              /* destruction order has been sent */
-#define THREAD_END          21          /* destruction order has been received */
-#define THREAD_OVER         29               /* thread does not exist any more */
+#define THREAD_DESTROY      20            /* destruction order has been sent */
+#define THREAD_END          21        /* destruction order has been received */
+#define THREAD_OVER         29             /* thread does not exist any more */
 
 /* Error status */
-#define THREAD_ERROR        30                             /* an error occured */
-#define THREAD_FATAL        31    /* an fatal error occured - program must end */
+#define THREAD_ERROR        30                           /* an error occured */
+#define THREAD_FATAL        31  /* an fatal error occured - program must end */
 
-/******************************************************************************
+/*****************************************************************************
  * Types definition
- ******************************************************************************/
+ *****************************************************************************/
 typedef pthread_t        vlc_thread_t;
 typedef pthread_mutex_t  vlc_mutex_t;
 typedef pthread_cond_t   vlc_cond_t;
 
 typedef void *(*vlc_thread_func_t)(void *p_data);
 
-/******************************************************************************
+/*****************************************************************************
  * Prototypes
- ******************************************************************************/
+ *****************************************************************************/
 
 static __inline__ int  vlc_thread_create( vlc_thread_t *p_thread, char *psz_name,
                                          vlc_thread_func_t func, void *p_data );
@@ -62,9 +62,9 @@ static __inline__ int  vlc_cond_wait    ( vlc_cond_t *p_condvar, vlc_mutex_t *p_
 //static _inline__ int    vlc_cond_timedwait   ( vlc_cond_t * condvar, vlc_mutex_t * mutex,
 //                              mtime_t absoute_timeout_time );
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_thread_create: create a thread
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
                                         char *psz_name, vlc_thread_func_t func,
                                         void *p_data)
@@ -72,65 +72,65 @@ static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
     return pthread_create( p_thread, NULL, func, p_data );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vlc_thread_exit: terminate a thread
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void vlc_thread_exit( void )
 {
     pthread_exit( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_thread_join: wait until a thread exits
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void vlc_thread_join( vlc_thread_t thread )
 {
     pthread_join( thread, NULL );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_mutex_init: initialize a mutex
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_mutex_init( vlc_mutex_t *p_mutex )
 {
     return pthread_mutex_init( p_mutex, NULL );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_mutex_lock: lock a mutex
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_mutex_lock( vlc_mutex_t *p_mutex )
 {
     return pthread_mutex_lock( p_mutex );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_mutex_unlock: unlock a mutex
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_mutex_unlock( vlc_mutex_t *p_mutex )
 {
     return pthread_mutex_unlock( p_mutex );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_cond_init: initialize a condition
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_cond_init( vlc_cond_t *p_condvar )
 {
     return pthread_cond_init( p_condvar, NULL );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_cond_signal: start a thread on condition completion
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_cond_signal( vlc_cond_t *p_condvar )
 {
     return pthread_cond_signal( p_condvar );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vlc_cond_wait: wait until condition completion
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int vlc_cond_wait( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex )
 {
     return pthread_cond_wait( p_condvar, p_mutex );
index 0bedd16589d458f23665c93a773cb123c864d845..5750985a86fe27f2656e9633976d48e332bf9908 100644 (file)
@@ -28,7 +28,7 @@ typedef struct macroblock_s
                                                  /* which blocks are coded ? */
     int                     i_chroma_nb_blocks;         /* number of blocks for
                                                          * chroma components */
-    
+
     /* IDCT information */
     dctelem_t               ppi_blocks[12][64];                    /* blocks */
     f_idct_t                pf_idct[12];             /* sparse IDCT or not ? */
@@ -47,7 +47,7 @@ typedef struct macroblock_s
     int                     i_l_x, i_c_x;
     int                     i_motion_l_y;
     int                     i_motion_c_y;
-    int                     i_l_stride;         /* number of yuv_data_t to 
+    int                     i_l_stride;         /* number of yuv_data_t to
                                                  * ignore when changing line */
     int                     i_c_stride;                  /* idem, for chroma */
     boolean_t               b_P_second;  /* Second field of a P picture ?
@@ -91,9 +91,9 @@ typedef struct lookup_s
     int    i_length;
 } lookup_t;
 
-/******************************************************************************
+/*****************************************************************************
  * ac_lookup_t : special entry type for lookup tables about ac coefficients
- *****************************************************************************/ 
+ *****************************************************************************/
 typedef struct dct_lookup_s
 {
     char   i_run;
index 8c4a39b27d9029a4cf1e5b0e0a8a72ca2600e97c..382b023759132f9ed195927b4e265f0106313162 100644 (file)
@@ -14,7 +14,7 @@
  *  "decoder_fifo.h"
  *  "video_fifo.h"
  *****************************************************************************/
+
 /*****************************************************************************
  * quant_matrix_t : Quantization Matrix
  *****************************************************************************/
index e01589d4e01746d02bc61063307452eab7606aa0..7a0eae41848b329ca9bfeb5b7892ea93600af072 100644 (file)
@@ -25,7 +25,7 @@ typedef struct video_synchro_tab_s
 {
     double mean;
     double deviation;
-    
+
 } video_synchro_tab_t;
 
 typedef struct video_synchro_fifo_s
@@ -34,7 +34,7 @@ typedef struct video_synchro_fifo_s
     int i_image_type;
     mtime_t i_decode_date;
     mtime_t i_pts;
-    
+
 } video_synchro_fifo_t;
 
 typedef struct video_synchro_s
@@ -47,12 +47,12 @@ typedef struct video_synchro_s
     /* mean decoding time */
     mtime_t i_mean_decode_time;
     /* dates */
-    mtime_t i_last_display_pts;            /* pts of the last displayed image */
-    mtime_t i_last_decode_pts;               /* pts of the last decoded image */
-    mtime_t i_last_i_pts;                          /* pts of the last I image */
-    mtime_t i_last_nondropped_i_pts;       /* pts of last non-dropped I image */
+    mtime_t i_last_display_pts;           /* pts of the last displayed image */
+    mtime_t i_last_decode_pts;              /* pts of the last decoded image */
+    mtime_t i_last_i_pts;                         /* pts of the last I image */
+    mtime_t i_last_nondropped_i_pts;      /* pts of last non-dropped I image */
     unsigned int i_images_since_pts;
-    
+
     /* il manquait un compteur */
     unsigned int modulo;
 
index fe8c1597152e3eea0b5168d3fb22b48aea573d53..526171a2333f99d13453d059a51ee64806a42ffc 100644 (file)
@@ -29,7 +29,7 @@ static s16 calc_lowcomp(s16 a,s16 b0,s16 b1,s16 bin);
 static inline u16 min(s16 a,s16 b);
 static inline u16 max(s16 a,s16 b);
 */
-static void ba_compute_psd(s16 start, s16 end, s16 exps[], 
+static void ba_compute_psd(s16 start, s16 end, s16 exps[],
                s16 psd[], s16 bndpsd[]);
 
 static void ba_compute_excitation(s16 start, s16 end,s16 fgain,
@@ -52,7 +52,7 @@ static u16 floortab[] = { 0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf80
 static s16 fastgain[] = { 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400  };
 
 
-static s16 bndtab[] = {  0,  1,  2,   3,   4,   5,   6,   7,   8,   9, 
+static s16 bndtab[] = {  0,  1,  2,   3,   4,   5,   6,   7,   8,   9,
                      10, 11, 12,  13,  14,  15,  16,  17,  18,  19,
                      20, 21, 22,  23,  24,  25,  26,  27,  28,  31,
                      34, 37, 40,  43,  46,  49,  55,  61,  67,  73,
@@ -116,33 +116,33 @@ static s16 latab[] = { 0x0040, 0x003f, 0x003e, 0x003d, 0x003c, 0x003b, 0x003a, 0
                     0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
                     0x0000, 0x0000, 0x0000, 0x0000};
 
-static s16 hth[][50] = {{ 0x04d0, 0x04d0, 0x0440, 0x0400, 0x03e0, 0x03c0, 0x03b0, 0x03b0,  
-                      0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x0390, 0x0390, 0x0390,  
-                      0x0380, 0x0380, 0x0370, 0x0370, 0x0360, 0x0360, 0x0350, 0x0350,  
+static s16 hth[][50] = {{ 0x04d0, 0x04d0, 0x0440, 0x0400, 0x03e0, 0x03c0, 0x03b0, 0x03b0,
+                      0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x0390, 0x0390, 0x0390,
+                      0x0380, 0x0380, 0x0370, 0x0370, 0x0360, 0x0360, 0x0350, 0x0350,
                       0x0340, 0x0340, 0x0330, 0x0320, 0x0310, 0x0300, 0x02f0, 0x02f0,
                       0x02f0, 0x02f0, 0x0300, 0x0310, 0x0340, 0x0390, 0x03e0, 0x0420,
                       0x0460, 0x0490, 0x04a0, 0x0460, 0x0440, 0x0440, 0x0520, 0x0800,
                       0x0840, 0x0840 },
-                      
-                    { 0x04f0, 0x04f0, 0x0460, 0x0410, 0x03e0, 0x03d0, 0x03c0, 0x03b0, 
-                      0x03b0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x0390, 0x0390, 
-                      0x0390, 0x0380, 0x0380, 0x0380, 0x0370, 0x0370, 0x0360, 0x0360, 
-                      0x0350, 0x0350, 0x0340, 0x0340, 0x0320, 0x0310, 0x0300, 0x02f0, 
-                      0x02f0, 0x02f0, 0x02f0, 0x0300, 0x0320, 0x0350, 0x0390, 0x03e0, 
-                      0x0420, 0x0450, 0x04a0, 0x0490, 0x0460, 0x0440, 0x0480, 0x0630, 
+
+                    { 0x04f0, 0x04f0, 0x0460, 0x0410, 0x03e0, 0x03d0, 0x03c0, 0x03b0,
+                      0x03b0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x0390, 0x0390,
+                      0x0390, 0x0380, 0x0380, 0x0380, 0x0370, 0x0370, 0x0360, 0x0360,
+                      0x0350, 0x0350, 0x0340, 0x0340, 0x0320, 0x0310, 0x0300, 0x02f0,
+                      0x02f0, 0x02f0, 0x02f0, 0x0300, 0x0320, 0x0350, 0x0390, 0x03e0,
+                      0x0420, 0x0450, 0x04a0, 0x0490, 0x0460, 0x0440, 0x0480, 0x0630,
                       0x0840, 0x0840 },
-                      
-                    { 0x0580, 0x0580, 0x04b0, 0x0450, 0x0420, 0x03f0, 0x03e0, 0x03d0, 
-                      0x03c0, 0x03b0, 0x03b0, 0x03b0, 0x03a0, 0x03a0, 0x03a0, 0x03a0, 
-                      0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x0390, 0x0390, 0x0390, 0x0390, 
-                      0x0380, 0x0380, 0x0380, 0x0370, 0x0360, 0x0350, 0x0340, 0x0330, 
-                      0x0320, 0x0310, 0x0300, 0x02f0, 0x02f0, 0x02f0, 0x0300, 0x0310, 
-                      0x0330, 0x0350, 0x03c0, 0x0410, 0x0470, 0x04a0, 0x0460, 0x0440, 
+
+                    { 0x0580, 0x0580, 0x04b0, 0x0450, 0x0420, 0x03f0, 0x03e0, 0x03d0,
+                      0x03c0, 0x03b0, 0x03b0, 0x03b0, 0x03a0, 0x03a0, 0x03a0, 0x03a0,
+                      0x03a0, 0x03a0, 0x03a0, 0x03a0, 0x0390, 0x0390, 0x0390, 0x0390,
+                      0x0380, 0x0380, 0x0380, 0x0370, 0x0360, 0x0350, 0x0340, 0x0330,
+                      0x0320, 0x0310, 0x0300, 0x02f0, 0x02f0, 0x02f0, 0x0300, 0x0310,
+                      0x0330, 0x0350, 0x03c0, 0x0410, 0x0470, 0x04a0, 0x0460, 0x0440,
                       0x0450, 0x04e0 }};
 
 
 static s16 baptab[] = { 0,  1,  1,  1,  1,  1,  2,  2,  3,  3,  3,  4,  4,  5,  5,  6,
-                     6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9, 10, 
+                     6,  6,  6,  7,  7,  7,  7,  8,  8,  8,  8,  9,  9,  9,  9, 10,
                      10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14,
                      14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15 };
 
@@ -182,22 +182,22 @@ static __inline__ s16 logadd( s16 a, s16 b )
 
 static __inline__ s16 calc_lowcomp( s16 a, s16 b0, s16 b1, s16 bin )
 {
-       if (bin < 7) 
-       { 
+       if (bin < 7)
+       {
+               if ((b0 + 256) == b1)
+                       a = 384;
+               else if (b0 > b1)
+                       a = max(0, a - 64);
+       }
+       else if (bin < 20)
+       {
                if ((b0 + 256) == b1)
-                       a = 384; 
-               else if (b0 > b1) 
-                       a = max(0, a - 64); 
-       } 
-       else if (bin < 20) 
-       { 
-               if ((b0 + 256) == b1) 
-                       a = 320; 
-               else if (b0 > b1) 
-                       a = max(0, a - 64) ; 
+                       a = 320;
+               else if (b0 > b1)
+                       a = max(0, a - 64) ;
        }
-       else  
-               a = max(0, a - 128); 
+       else
+               a = max(0, a - 128);
        
        return(a);
 }
@@ -222,15 +222,15 @@ void bit_allocate( ac3dec_thread_t * p_ac3dec )
                return;
 
        /* Do some setup before we do the bit alloc */
-       sdecay = slowdec[p_ac3dec->audblk.sdcycod]; 
+       sdecay = slowdec[p_ac3dec->audblk.sdcycod];
        fdecay = fastdec[p_ac3dec->audblk.fdcycod];
-       sgain = slowgain[p_ac3dec->audblk.sgaincod]; 
-       dbknee = dbpbtab[p_ac3dec->audblk.dbpbcod]; 
-       floor = floortab[p_ac3dec->audblk.floorcod]; 
+       sgain = slowgain[p_ac3dec->audblk.sgaincod];
+       dbknee = dbpbtab[p_ac3dec->audblk.dbpbcod];
+       floor = floortab[p_ac3dec->audblk.floorcod];
 
        /* if all the SNR offset constants are zero then the whole block is zero */
-       if(!p_ac3dec->audblk.csnroffst    && !p_ac3dec->audblk.fsnroffst[0] && 
-                !p_ac3dec->audblk.fsnroffst[1] && !p_ac3dec->audblk.fsnroffst[2] && 
+       if(!p_ac3dec->audblk.csnroffst    && !p_ac3dec->audblk.fsnroffst[0] &&
+                !p_ac3dec->audblk.fsnroffst[1] && !p_ac3dec->audblk.fsnroffst[2] &&
                 !p_ac3dec->audblk.fsnroffst[3] && !p_ac3dec->audblk.fsnroffst[4] &&
                 !p_ac3dec->audblk.cplfsnroffst && !p_ac3dec->audblk.lfefsnroffst)
        {
@@ -243,8 +243,8 @@ void bit_allocate( ac3dec_thread_t * p_ac3dec )
        for(i = 0; i < p_ac3dec->bsi.nfchans; i++)
        {
                start = 0;
-               end = p_ac3dec->audblk.endmant[i] ; 
-               fgain = fastgain[p_ac3dec->audblk.fgaincod[i]]; 
+               end = p_ac3dec->audblk.endmant[i] ;
+               fgain = fastgain[p_ac3dec->audblk.fgaincod[i]];
                snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.fsnroffst[i]) << 2 ;
                fastleak = 0;
                slowleak = 0;
@@ -260,11 +260,11 @@ void bit_allocate( ac3dec_thread_t * p_ac3dec )
 
        if(p_ac3dec->audblk.cplinu)
        {
-               start = p_ac3dec->audblk.cplstrtmant; 
-               end = p_ac3dec->audblk.cplendmant; 
+               start = p_ac3dec->audblk.cplstrtmant;
+               end = p_ac3dec->audblk.cplendmant;
                fgain = fastgain[p_ac3dec->audblk.cplfgaincod];
                snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.cplfsnroffst) << 2 ;
-               fastleak = (p_ac3dec->audblk.cplfleak << 8) + 768; 
+               fastleak = (p_ac3dec->audblk.cplfleak << 8) + 768;
                slowleak = (p_ac3dec->audblk.cplsleak << 8) + 768;
 
                ba_compute_psd(start, end, p_ac3dec->audblk.cpl_exp, psd, bndpsd);
@@ -296,35 +296,35 @@ void bit_allocate( ac3dec_thread_t * p_ac3dec )
 }
 
 
-static void ba_compute_psd(s16 start, s16 end, s16 exps[], 
+static void ba_compute_psd(s16 start, s16 end, s16 exps[],
                s16 psd[], s16 bndpsd[])
 {
        int bin,i,j,k;
        s16 lastbin = 0;
        
        /* Map the exponents into dBs */
-       for (bin=start; bin<end; bin++) 
-       { 
-               psd[bin] = (3072 - (exps[bin] << 7)); 
+       for (bin=start; bin<end; bin++)
+       {
+               psd[bin] = (3072 - (exps[bin] << 7));
        }
 
        /* Integrate the psd function over each bit allocation band */
-       j = start; 
-       k = masktab[start]; 
+       j = start;
+       k = masktab[start];
        
-       do 
-       { 
-               lastbin = min(bndtab[k] + bndsz[k], end); 
-               bndpsd[k] = psd[j]; 
-               j++; 
-
-               for (i = j; i < lastbin; i++) 
-               { 
+       do
+       {
+               lastbin = min(bndtab[k] + bndsz[k], end);
+               bndpsd[k] = psd[j];
+               j++;
+
+               for (i = j; i < lastbin; i++)
+               {
                        bndpsd[k] = logadd(bndpsd[k], psd[j]);
-                       j++; 
-               } 
+                       j++;
+               }
                
-               k++; 
+               k++;
        } while (end > lastbin);
 }
 
@@ -339,61 +339,61 @@ static void ba_compute_excitation(s16 start, s16 end,s16 fgain,
        s16 begin = 0;
 
        /* Compute excitation function */
-       bndstrt = masktab[start]; 
-       bndend = masktab[end - 1] + 1; 
+       bndstrt = masktab[start];
+       bndend = masktab[end - 1] + 1;
        
-       if (bndstrt == 0) /* For fbw and lfe channels */ 
-       { 
-               lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0); 
-               excite[0] = bndpsd[0] - fgain - lowcomp; 
+       if (bndstrt == 0) /* For fbw and lfe channels */
+       {
+               lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0);
+               excite[0] = bndpsd[0] - fgain - lowcomp;
                lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1);
-               excite[1] = bndpsd[1] - fgain - lowcomp; 
-               begin = 7 ; 
+               excite[1] = bndpsd[1] - fgain - lowcomp;
+               begin = 7 ;
                
-               /* Note: Do not call calc_lowcomp() for the last band of the lfe channel, (bin = 6) */ 
-               for (bin = 2; bin < 7; bin++) 
-               { 
+               /* Note: Do not call calc_lowcomp() for the last band of the lfe channel, (bin = 6) */
+               for (bin = 2; bin < 7; bin++)
+               {
                        if (!(is_lfe && (bin == 6)))
-                               lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin); 
-                       fastleak = bndpsd[bin] - fgain; 
-                       slowleak = bndpsd[bin] - sgain; 
-                       excite[bin] = fastleak - lowcomp; 
+                               lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
+                       fastleak = bndpsd[bin] - fgain;
+                       slowleak = bndpsd[bin] - sgain;
+                       excite[bin] = fastleak - lowcomp;
                        
                        if (!(is_lfe && (bin == 6)))
                        {
-                               if (bndpsd[bin] <= bndpsd[bin+1]) 
+                               if (bndpsd[bin] <= bndpsd[bin+1])
                                {
-                                       begin = bin + 1 ; 
-                                       break; 
-                               } 
+                                       begin = bin + 1 ;
+                                       break;
+                               }
                        }
-               } 
+               }
                
-               for (bin = begin; bin < min(bndend, 22); bin++) 
-               { 
+               for (bin = begin; bin < min(bndend, 22); bin++)
+               {
                        if (!(is_lfe && (bin == 6)))
-                               lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin); 
-                       fastleak -= fdecay ; 
-                       fastleak = max(fastleak, bndpsd[bin] - fgain); 
-                       slowleak -= sdecay ; 
-                       slowleak = max(slowleak, bndpsd[bin] - sgain); 
-                       excite[bin] = max(fastleak - lowcomp, slowleak); 
-               } 
-               begin = 22; 
-       } 
-       else /* For coupling channel */ 
-       { 
-               begin = bndstrt; 
-       } 
-
-       for (bin = begin; bin < bndend; bin++) 
-       { 
-               fastleak -= fdecay; 
-               fastleak = max(fastleak, bndpsd[bin] - fgain); 
-               slowleak -= sdecay; 
-               slowleak = max(slowleak, bndpsd[bin] - sgain); 
-               excite[bin] = max(fastleak, slowleak) ; 
-       } 
+                               lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
+                       fastleak -= fdecay ;
+                       fastleak = max(fastleak, bndpsd[bin] - fgain);
+                       slowleak -= sdecay ;
+                       slowleak = max(slowleak, bndpsd[bin] - sgain);
+                       excite[bin] = max(fastleak - lowcomp, slowleak);
+               }
+               begin = 22;
+       }
+       else /* For coupling channel */
+       {
+               begin = bndstrt;
+       }
+
+       for (bin = begin; bin < bndend; bin++)
+       {
+               fastleak -= fdecay;
+               fastleak = max(fastleak, bndpsd[bin] - fgain);
+               slowleak -= sdecay;
+               slowleak = max(slowleak, bndpsd[bin] - sgain);
+               excite[bin] = max(fastleak, slowleak) ;
+       }
 }
 
 static void ba_compute_mask(s16 start, s16 end, u16 fscod,
@@ -452,27 +452,27 @@ static void ba_compute_bap(s16 start, s16 end, s16 snroffset,
        s16 address = 0;
 
        /* Compute the bit allocation pointer for each bin */
-       i = start; 
-       j = masktab[start]; 
-
-       do 
-       { 
-               lastbin = min(bndtab[j] + bndsz[j], end); 
-               mask[j] -= snroffset; 
-               mask[j] -= floor; 
+       i = start;
+       j = masktab[start];
+
+       do
+       {
+               lastbin = min(bndtab[j] + bndsz[j], end);
+               mask[j] -= snroffset;
+               mask[j] -= floor;
                
-               if (mask[j] < 0) 
-                       mask[j] = 0; 
+               if (mask[j] < 0)
+                       mask[j] = 0;
 
                mask[j] &= 0x1fe0;
-               mask[j] += floor; 
-               for (k = i; k < lastbin; k++) 
-               { 
-                       address = (psd[i] - mask[j]) >> 5; 
-                       address = min(63, max(0, address)); 
-                       bap[i] = baptab[address]; 
-                       i++; 
-               } 
-               j++; 
+               mask[j] += floor;
+               for (k = i; k < lastbin; k++)
+               {
+                       address = (psd[i] - mask[j]) >> 5;
+                       address = min(63, max(0, address));
+                       bap[i] = baptab[address];
+                       i++;
+               }
+               j++;
        } while (end > lastbin);
 }
index 2bd8780279b4c441d11cb5c29ab67cfe35b71769..3a8fb8772f16eb04506fa94cf79b8f24904770fb 100644 (file)
@@ -52,7 +52,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
 
        /*
        if(p_ac3dec->bsi.acmod > 7)
-               dprintf("(downmix) invalid acmod number\n"); 
+               dprintf("(downmix) invalid acmod number\n");
        */
 
        //There are two main cases, with or without Dolby Surround
@@ -91,7 +91,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                left_sur  = p_ac3dec->samples.channel[2];
                                right_sur = p_ac3dec->samples.channel[3];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
                                        left_tmp  = -1 * right_tmp;
@@ -115,7 +115,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                //Mono surround
                                right_sur = p_ac3dec->samples.channel[3];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp =  0.2265f * *right_sur++;
                                        left_tmp  = - right_tmp;
@@ -138,11 +138,11 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                //Mono surround
                                right_sur = p_ac3dec->samples.channel[2];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp =  0.2265f * *right_sur++;
                                        left_tmp  = - right_tmp;
-                                       right_tmp += 0.3204f * *right++; 
+                                       right_tmp += 0.3204f * *right++;
                                        left_tmp  += 0.3204f * *left++;
 
                                        *(out_buf++) = left_tmp * NORM;
@@ -160,7 +160,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                centre    = p_ac3dec->samples.channel[1];
                                right     = p_ac3dec->samples.channel[2];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp = 0.3204f * *right++ + 0.2265f * *centre;
                                        left_tmp  = 0.3204f * *left++  + 0.2265f * *centre++;
@@ -191,7 +191,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                //Mono program!
                                right = p_ac3dec->samples.channel[0];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp = 0.7071f * *right++;
 
@@ -209,7 +209,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                //Dual mono, output selected by user
                                right = p_ac3dec->samples.channel[global_prefs.dual_mono_channel_select];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp = 0.7071f * *right++;
 
@@ -239,7 +239,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
                                slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp= 0.4142f * *right++ + clev * *centre   + slev * *right_sur++;
                                        left_tmp = 0.4142f * *left++  + clev * *centre++ + slev * *left_sur++;
@@ -262,7 +262,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
 
                                slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp= 0.4142f * *right++ + slev * *right_sur++;
                                        left_tmp = 0.4142f * *left++  + slev * *left_sur++;
@@ -287,7 +287,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
                                slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp= 0.4142f * *right++ + clev * *centre   + slev * *right_sur;
                                        left_tmp = 0.4142f * *left++  + clev * *centre++ + slev * *right_sur++;
@@ -310,7 +310,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
 
                                slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp= 0.4142f * *right++ + slev * *right_sur;
                                        left_tmp = 0.4142f * *left++  + slev * *right_sur++;
@@ -332,10 +332,10 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
 
                                clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
-                                       right_tmp= 0.4142f * *right++ + clev * *centre;   
-                                       left_tmp = 0.4142f * *left++  + clev * *centre++; 
+                                       right_tmp= 0.4142f * *right++ + clev * *centre;
+                                       left_tmp = 0.4142f * *left++  + clev * *centre++;
 
                                        *(out_buf++) = left_tmp * NORM;
                                        *(out_buf++) = right_tmp * NORM;
@@ -362,7 +362,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                //Mono program!
                                right = p_ac3dec->samples.channel[0];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp = 0.7071f * *right++;
 
@@ -380,7 +380,7 @@ void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
                                //Dual mono, output selected by user
                                right = p_ac3dec->samples.channel[global_prefs.dual_mono_channel_select];
 
-                               for (j = 0; j < 256; j++) 
+                               for (j = 0; j < 256; j++)
                                {
                                        right_tmp = 0.7071f * *right++;
 
index 4c139c5d5c91c9e689c80927b4ece1ab99d45088..290d764ca8cad36eee413d62d676e66c90eefa05 100644 (file)
@@ -43,7 +43,7 @@ static __inline__ void exp_unpack_ch( ac3dec_thread_t * p_ac3dec, u16 type, u16
        exp_acc = initial_exp;
        j = 0;
 
-       /* In the case of a fbw channel then the initial absolute values is 
+       /* In the case of a fbw channel then the initial absolute values is
         * also an exponent */
        if ( type != UNPACK_CPL )
        {
index 88fed2dff5422663f9e755286d1c823b9ba2ed1c..e2972dc3066486e9815bb622c9d9b7878e975f63 100644 (file)
@@ -40,31 +40,31 @@ static complex_t buf[N/4];
 
 /* 128 point bit-reverse LUT */
 static u8 bit_reverse_512[] = {
-       0x00, 0x40, 0x20, 0x60, 0x10, 0x50, 0x30, 0x70, 
-       0x08, 0x48, 0x28, 0x68, 0x18, 0x58, 0x38, 0x78, 
-       0x04, 0x44, 0x24, 0x64, 0x14, 0x54, 0x34, 0x74, 
-       0x0c, 0x4c, 0x2c, 0x6c, 0x1c, 0x5c, 0x3c, 0x7c, 
-       0x02, 0x42, 0x22, 0x62, 0x12, 0x52, 0x32, 0x72, 
-       0x0a, 0x4a, 0x2a, 0x6a, 0x1a, 0x5a, 0x3a, 0x7a, 
-       0x06, 0x46, 0x26, 0x66, 0x16, 0x56, 0x36, 0x76, 
-       0x0e, 0x4e, 0x2e, 0x6e, 0x1e, 0x5e, 0x3e, 0x7e, 
-       0x01, 0x41, 0x21, 0x61, 0x11, 0x51, 0x31, 0x71, 
-       0x09, 0x49, 0x29, 0x69, 0x19, 0x59, 0x39, 0x79, 
-       0x05, 0x45, 0x25, 0x65, 0x15, 0x55, 0x35, 0x75, 
-       0x0d, 0x4d, 0x2d, 0x6d, 0x1d, 0x5d, 0x3d, 0x7d, 
-       0x03, 0x43, 0x23, 0x63, 0x13, 0x53, 0x33, 0x73, 
-       0x0b, 0x4b, 0x2b, 0x6b, 0x1b, 0x5b, 0x3b, 0x7b, 
-       0x07, 0x47, 0x27, 0x67, 0x17, 0x57, 0x37, 0x77, 
+       0x00, 0x40, 0x20, 0x60, 0x10, 0x50, 0x30, 0x70,
+       0x08, 0x48, 0x28, 0x68, 0x18, 0x58, 0x38, 0x78,
+       0x04, 0x44, 0x24, 0x64, 0x14, 0x54, 0x34, 0x74,
+       0x0c, 0x4c, 0x2c, 0x6c, 0x1c, 0x5c, 0x3c, 0x7c,
+       0x02, 0x42, 0x22, 0x62, 0x12, 0x52, 0x32, 0x72,
+       0x0a, 0x4a, 0x2a, 0x6a, 0x1a, 0x5a, 0x3a, 0x7a,
+       0x06, 0x46, 0x26, 0x66, 0x16, 0x56, 0x36, 0x76,
+       0x0e, 0x4e, 0x2e, 0x6e, 0x1e, 0x5e, 0x3e, 0x7e,
+       0x01, 0x41, 0x21, 0x61, 0x11, 0x51, 0x31, 0x71,
+       0x09, 0x49, 0x29, 0x69, 0x19, 0x59, 0x39, 0x79,
+       0x05, 0x45, 0x25, 0x65, 0x15, 0x55, 0x35, 0x75,
+       0x0d, 0x4d, 0x2d, 0x6d, 0x1d, 0x5d, 0x3d, 0x7d,
+       0x03, 0x43, 0x23, 0x63, 0x13, 0x53, 0x33, 0x73,
+       0x0b, 0x4b, 0x2b, 0x6b, 0x1b, 0x5b, 0x3b, 0x7b,
+       0x07, 0x47, 0x27, 0x67, 0x17, 0x57, 0x37, 0x77,
        0x0f, 0x4f, 0x2f, 0x6f, 0x1f, 0x5f, 0x3f, 0x7f};
 
 static u8 bit_reverse_256[] = {
-       0x00, 0x20, 0x10, 0x30, 0x08, 0x28, 0x18, 0x38, 
-       0x04, 0x24, 0x14, 0x34, 0x0c, 0x2c, 0x1c, 0x3c, 
-       0x02, 0x22, 0x12, 0x32, 0x0a, 0x2a, 0x1a, 0x3a, 
-       0x06, 0x26, 0x16, 0x36, 0x0e, 0x2e, 0x1e, 0x3e, 
-       0x01, 0x21, 0x11, 0x31, 0x09, 0x29, 0x19, 0x39, 
-       0x05, 0x25, 0x15, 0x35, 0x0d, 0x2d, 0x1d, 0x3d, 
-       0x03, 0x23, 0x13, 0x33, 0x0b, 0x2b, 0x1b, 0x3b, 
+       0x00, 0x20, 0x10, 0x30, 0x08, 0x28, 0x18, 0x38,
+       0x04, 0x24, 0x14, 0x34, 0x0c, 0x2c, 0x1c, 0x3c,
+       0x02, 0x22, 0x12, 0x32, 0x0a, 0x2a, 0x1a, 0x3a,
+       0x06, 0x26, 0x16, 0x36, 0x0e, 0x2e, 0x1e, 0x3e,
+       0x01, 0x21, 0x11, 0x31, 0x09, 0x29, 0x19, 0x39,
+       0x05, 0x25, 0x15, 0x35, 0x0d, 0x2d, 0x1d, 0x3d,
+       0x03, 0x23, 0x13, 0x33, 0x0b, 0x2b, 0x1b, 0x3b,
        0x07, 0x27, 0x17, 0x37, 0x0f, 0x2f, 0x1f, 0x3f};
 
 /* Twiddle factor LUT */
@@ -149,14 +149,14 @@ void imdct_init(void)
        /* Twiddle factors to turn IFFT into IMDCT */
        for( i=0; i < N/4; i++)
        {
-               xcos1[i] = -cos(2 * M_PI * (8*i+1)/(8*N)) ; 
+               xcos1[i] = -cos(2 * M_PI * (8*i+1)/(8*N)) ;
                xsin1[i] = -sin(2 * M_PI * (8*i+1)/(8*N)) ;
        }
        
        /* More twiddle factors to turn IFFT into IMDCT */
        for( i=0; i < N/8; i++)
        {
-               xcos2[i] = -cos(2 * M_PI * (8*i+1)/(4*N)) ; 
+               xcos2[i] = -cos(2 * M_PI * (8*i+1)/(4*N)) ;
                xsin2[i] = -sin(2 * M_PI * (8*i+1)/(4*N)) ;
        }
 
@@ -223,17 +223,17 @@ imdct_do_512(float x[],float y[],float delay[])
        float *delay_ptr;
        float *window_ptr;
 
-       // Pre IFFT complex multiply plus IFFT cmplx conjugate 
+       // Pre IFFT complex multiply plus IFFT cmplx conjugate
        for( i=0; i < N/4; i++)
        {
-               /* z[i] = (X[N/2-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */ 
+               /* z[i] = (X[N/2-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */
                buf[i].real =   (x[N/2-2*i-1] * xcos1[i])  -  (x[2*i]       * xsin1[i]);
          buf[i].imag = -((x[2*i]       * xcos1[i])  +  (x[N/2-2*i-1] * xsin1[i]));
        }
 
        //Bit reversed shuffling
-       for(i=0; i<N/4; i++) 
-       { 
+       for(i=0; i<N/4; i++)
+       {
                k = bit_reverse_512[i];
                if (k < i)
                        swap_cmplx(&buf[i],&buf[k]);
@@ -278,31 +278,31 @@ imdct_do_512(float x[],float y[],float delay[])
        delay_ptr = delay;
        window_ptr = window;
        /* Window and convert to real valued signal */
-       for(i=0; i<N/8; i++) 
-       { 
-               *y_ptr++   = 2.0f * (-buf[N/8+i].imag   * *window_ptr++ + *delay_ptr++); 
-               *y_ptr++   = 2.0f * ( buf[N/8-i-1].real * *window_ptr++ + *delay_ptr++); 
+       for(i=0; i<N/8; i++)
+       {
+               *y_ptr++   = 2.0f * (-buf[N/8+i].imag   * *window_ptr++ + *delay_ptr++);
+               *y_ptr++   = 2.0f * ( buf[N/8-i-1].real * *window_ptr++ + *delay_ptr++);
        }
 
-       for(i=0; i<N/8; i++) 
-       { 
-               *y_ptr++  = 2.0f * (-buf[i].real       * *window_ptr++ + *delay_ptr++); 
-               *y_ptr++  = 2.0f * ( buf[N/4-i-1].imag * *window_ptr++ + *delay_ptr++); 
+       for(i=0; i<N/8; i++)
+       {
+               *y_ptr++  = 2.0f * (-buf[i].real       * *window_ptr++ + *delay_ptr++);
+               *y_ptr++  = 2.0f * ( buf[N/4-i-1].imag * *window_ptr++ + *delay_ptr++);
        }
 
        /* The trailing edge of the window goes into the delay line */
        delay_ptr = delay;
 
-       for(i=0; i<N/8; i++) 
-       { 
-               *delay_ptr++  = -buf[N/8+i].real   * *--window_ptr; 
-               *delay_ptr++  =  buf[N/8-i-1].imag * *--window_ptr; 
+       for(i=0; i<N/8; i++)
+       {
+               *delay_ptr++  = -buf[N/8+i].real   * *--window_ptr;
+               *delay_ptr++  =  buf[N/8-i-1].imag * *--window_ptr;
        }
 
-       for(i=0; i<N/8; i++) 
+       for(i=0; i<N/8; i++)
        {
-               *delay_ptr++  =  buf[i].imag       * *--window_ptr; 
-               *delay_ptr++  = -buf[N/4-i-1].real * *--window_ptr; 
+               *delay_ptr++  =  buf[i].imag       * *--window_ptr;
+               *delay_ptr++  = -buf[N/4-i-1].real * *--window_ptr;
        }
 }
 
@@ -326,25 +326,25 @@ imdct_do_256(float x[],float y[],float delay[])
        buf_2 = &buf[64];
 
        /* Pre IFFT complex multiply plus IFFT cmplx conjugate */
-       for(k=0; k<N/8; k++) 
-       { 
+       for(k=0; k<N/8; k++)
+       {
                /* X1[k] = X[2*k]  */
                /* X2[k] = X[2*k+1]     */
 
                p = 2 * (N/4-2*k-1);
                q = 2 * (2 * k);
 
-               /* Z1[k] = (X1[N/4-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */ 
+               /* Z1[k] = (X1[N/4-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */
                buf_1[k].real =    x[p] * xcos2[k] - x[q] * xsin2[k];
-         buf_1[k].imag = - (x[q] * xcos2[k] + x[p] * xsin2[k]); 
-               /* Z2[k] = (X2[N/4-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */ 
+         buf_1[k].imag = - (x[q] * xcos2[k] + x[p] * xsin2[k]);
+               /* Z2[k] = (X2[N/4-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */
                buf_2[k].real =    x[p + 1] * xcos2[k] - x[q + 1] * xsin2[k];
-         buf_2[k].imag = - (x[q + 1] * xcos2[k] + x[p + 1] * xsin2[k]); 
+         buf_2[k].imag = - (x[q + 1] * xcos2[k] + x[p + 1] * xsin2[k]);
        }
 
        //IFFT Bit reversed shuffling
-       for(i=0; i<N/8; i++) 
-       { 
+       for(i=0; i<N/8; i++)
+       {
                k = bit_reverse_256[i];
                if (k < i)
                {
@@ -392,12 +392,12 @@ imdct_do_256(float x[],float y[],float delay[])
        /* Post IFFT complex multiply */
        for( i=0; i < N/8; i++)
        {
-               /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */ 
+               /* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
                tmp_a_r =   buf_1[i].real;
                tmp_a_i = - buf_1[i].imag;
                buf_1[i].real =(tmp_a_r * xcos2[i])  -  (tmp_a_i  * xsin2[i]);
          buf_1[i].imag =(tmp_a_r * xsin2[i])  +  (tmp_a_i  * xcos2[i]);
-               /* y2[n] = z2[n] * (xcos2[n] + j * xsin2[n]) ; */ 
+               /* y2[n] = z2[n] * (xcos2[n] + j * xsin2[n]) ; */
                tmp_a_r =   buf_2[i].real;
                tmp_a_i = - buf_2[i].imag;
                buf_2[i].real =(tmp_a_r * xcos2[i])  -  (tmp_a_i  * xsin2[i]);
@@ -405,22 +405,22 @@ imdct_do_256(float x[],float y[],float delay[])
        }
        
        /* Window and convert to real valued signal */
-       for(i=0; i<N/8; i++) 
-       { 
+       for(i=0; i<N/8; i++)
+       {
                y[2*i]        = -buf_1[i].imag       * window[2*i];
-               y[2*i+1]      =  buf_1[N/8-i-1].real * window[2*i+1]; 
-               y[N/4+2*i]    = -buf_1[i].real       * window[N/4+2*i]; 
+               y[2*i+1]      =  buf_1[N/8-i-1].real * window[2*i+1];
+               y[N/4+2*i]    = -buf_1[i].real       * window[N/4+2*i];
                y[N/4+2*i+1]  =  buf_1[N/8-i-1].imag * window[N/4+2*i+1];
-               y[N/2+2*i]    = -buf_2[i].real       * window[N/2-2*i-1]; 
-               y[N/2+2*i+1]  =  buf_2[N/8-i-1].imag * window[N/2-2*i-2]; 
-               y[3*N/4+2*i]   =  buf_2[i].imag       * window[N/4-2*i-1]; 
-               y[3*N/4+2*i+1] = -buf_2[N/8-i-1].real * window[N/4-2*i-2]; 
+               y[N/2+2*i]    = -buf_2[i].real       * window[N/2-2*i-1];
+               y[N/2+2*i+1]  =  buf_2[N/8-i-1].imag * window[N/2-2*i-2];
+               y[3*N/4+2*i]   =  buf_2[i].imag       * window[N/4-2*i-1];
+               y[3*N/4+2*i+1] = -buf_2[N/8-i-1].real * window[N/4-2*i-2];
        }
        
        /* Overlap and add */
-       for(i=0; i<N/2; i++) 
-       { 
-               y[i] = 2 * (y[i] + delay[i]); 
-               delay[i] = y[N/2+i]; 
+       for(i=0; i<N/2; i++)
+       {
+               y[i] = 2 * (y[i] + delay[i]);
+               delay[i] = y[N/2+i];
        }
 }
index ba7724d62b7531bc87906afaaaae12d92b765a7f..78e280e61433377bd45fe58232f2bd493885b040 100644 (file)
@@ -429,12 +429,12 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
                        p_ac3dec->audblk.ncplsubnd = (p_ac3dec->audblk.cplendf + 2) - p_ac3dec->audblk.cplbegf + 1;
 
                        /* Calculate the start and end bins of the coupling channel */
-                       p_ac3dec->audblk.cplstrtmant = (p_ac3dec->audblk.cplbegf * 12) + 37 ; 
+                       p_ac3dec->audblk.cplstrtmant = (p_ac3dec->audblk.cplbegf * 12) + 37 ;
                        p_ac3dec->audblk.cplendmant =  ((p_ac3dec->audblk.cplendf + 3) * 12) + 37;
 
                        /* The number of combined subbands is ncplsubnd minus each combined
                         * band */
-                       p_ac3dec->audblk.ncplbnd = p_ac3dec->audblk.ncplsubnd; 
+                       p_ac3dec->audblk.ncplbnd = p_ac3dec->audblk.ncplsubnd;
 
                        for(i=1; i< p_ac3dec->audblk.ncplsubnd; i++)
                        {
@@ -482,7 +482,7 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
                }
 
                /* If we're in dual mono mode, there's going to be some phase info */
-               if( (p_ac3dec->bsi.acmod == 0x2) && p_ac3dec->audblk.phsflginu && 
+               if( (p_ac3dec->bsi.acmod == 0x2) && p_ac3dec->audblk.phsflginu &&
                                (p_ac3dec->audblk.cplcoe[0] || p_ac3dec->audblk.cplcoe[1]))
                {
                        for(j=0;j < p_ac3dec->audblk.ncplbnd; j++)
@@ -505,9 +505,9 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
                p_ac3dec->total_bits_read += 1;
                if(p_ac3dec->audblk.rematstr)
                {
-                       if (p_ac3dec->audblk.cplinu == 0) 
-                       { 
-                               for(i = 0; i < 4; i++) 
+                       if (p_ac3dec->audblk.cplinu == 0)
+                       {
+                               for(i = 0; i < 4; i++)
                                {
                                        NeedBits( &(p_ac3dec->bit_stream), 1 );
                                        p_ac3dec->audblk.rematflg[i] = (u16)(p_ac3dec->bit_stream.fifo.buffer >> (32 - 1));
@@ -515,9 +515,9 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
                                        p_ac3dec->total_bits_read += 1;
                                }
                        }
-                       if((p_ac3dec->audblk.cplbegf > 2) && p_ac3dec->audblk.cplinu) 
+                       if((p_ac3dec->audblk.cplbegf > 2) && p_ac3dec->audblk.cplinu)
                        {
-                               for(i = 0; i < 4; i++) 
+                               for(i = 0; i < 4; i++)
                                {
                                        NeedBits( &(p_ac3dec->bit_stream), 1 );
                                        p_ac3dec->audblk.rematflg[i] = (u16)(p_ac3dec->bit_stream.fifo.buffer >> (32 - 1));
@@ -525,18 +525,18 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
                                        p_ac3dec->total_bits_read += 1;
                                }
                        }
-                       if((p_ac3dec->audblk.cplbegf <= 2) && p_ac3dec->audblk.cplinu) 
-                       { 
-                               for(i = 0; i < 3; i++) 
+                       if((p_ac3dec->audblk.cplbegf <= 2) && p_ac3dec->audblk.cplinu)
+                       {
+                               for(i = 0; i < 3; i++)
                                {
                                        NeedBits( &(p_ac3dec->bit_stream), 1 );
                                        p_ac3dec->audblk.rematflg[i] = (u16)(p_ac3dec->bit_stream.fifo.buffer >> (32 - 1));
                                        DumpBits( &(p_ac3dec->bit_stream), 1 );
                                        p_ac3dec->total_bits_read += 1;
                                }
-                       } 
-                       if((p_ac3dec->audblk.cplbegf == 0) && p_ac3dec->audblk.cplinu) 
-                               for(i = 0; i < 2; i++) 
+                       }
+                       if((p_ac3dec->audblk.cplbegf == 0) && p_ac3dec->audblk.cplinu)
+                               for(i = 0; i < 2; i++)
                                {
                                        NeedBits( &(p_ac3dec->bit_stream), 1 );
                                        p_ac3dec->audblk.rematflg[i] = (u16)(p_ac3dec->bit_stream.fifo.buffer >> (32 - 1));
@@ -555,10 +555,10 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
                DumpBits( &(p_ac3dec->bit_stream), 2 );
                p_ac3dec->total_bits_read += 2;
 
-               if(p_ac3dec->audblk.cplexpstr==0) 
+               if(p_ac3dec->audblk.cplexpstr==0)
                        p_ac3dec->audblk.ncplgrps = 0;
                else
-                       p_ac3dec->audblk.ncplgrps = (p_ac3dec->audblk.cplendmant - p_ac3dec->audblk.cplstrtmant) / 
+                       p_ac3dec->audblk.ncplgrps = (p_ac3dec->audblk.cplendmant - p_ac3dec->audblk.cplstrtmant) /
                                (3 << (p_ac3dec->audblk.cplexpstr-1));
 
        }
@@ -572,7 +572,7 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
        }
 
        /* Get the exponent strategy for lfe channel */
-       if(p_ac3dec->bsi.lfeon) 
+       if(p_ac3dec->bsi.lfeon)
        {
                NeedBits( &(p_ac3dec->bit_stream), 1 );
                p_ac3dec->audblk.lfeexpstr = (u16)(p_ac3dec->bit_stream.fifo.buffer >> (32 - 1));
@@ -581,13 +581,13 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
        }
 
        /* Determine the bandwidths of all the fbw channels */
-       for(i = 0; i < p_ac3dec->bsi.nfchans; i++) 
-       { 
+       for(i = 0; i < p_ac3dec->bsi.nfchans; i++)
+       {
                u16 grp_size;
 
-               if(p_ac3dec->audblk.chexpstr[i] != EXP_REUSE) 
-               { 
-                       if (p_ac3dec->audblk.cplinu && p_ac3dec->audblk.chincpl[i]) 
+               if(p_ac3dec->audblk.chexpstr[i] != EXP_REUSE)
+               {
+                       if (p_ac3dec->audblk.cplinu && p_ac3dec->audblk.chincpl[i])
                        {
                                p_ac3dec->audblk.endmant[i] = p_ac3dec->audblk.cplstrtmant;
                        }
index e2da5521591f96f3c5c978fdda1d758be9df7e58..cd40173ae41db48d99003c2ba8ea8dc1362b5528 100644 (file)
@@ -40,7 +40,7 @@ static __inline__ u32 min( u32 a, u32 b )
        return( a < b ? a : b );
 }
 
-/* This routine simply does stereo rematixing for the 2 channel 
+/* This routine simply does stereo rematixing for the 2 channel
  * stereo mode */
 void rematrix( ac3dec_thread_t * p_ac3dec )
 {
index 71df19eec8a7211208da5b77a6b2f1e7eeebdf25..65176e92b4040be331959cdee3412be34840fb79 100644 (file)
@@ -1,7 +1,7 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_decoder.c: MPEG1 Layer I-II audio decoder thread
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
 /*
  * TODO :
  *
  */
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 #include <unistd.h>
 
-#include <stdio.h>                                            /* "intf_msg.h" */
-#include <stdlib.h>                                       /* malloc(), free() */
+#include <stdio.h>                                           /* "intf_msg.h" */
+#include <stdlib.h>                                      /* malloc(), free() */
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <netinet/in.h>                                            /* ntohl() */
-#include <sys/soundcard.h>                                /* "audio_output.h" */
-#include <sys/uio.h>                                             /* "input.h" */
+#include <netinet/in.h>                                           /* ntohl() */
+#include <sys/soundcard.h>                               /* "audio_output.h" */
+#include <sys/uio.h>                                            /* "input.h" */
 
 #include "common.h"
 #include "config.h"
 #include "mtime.h"
 #include "vlc_thread.h"
-#include "debug.h"                                       /* "input_netlist.h" */
+#include "debug.h"                                      /* "input_netlist.h" */
 
-#include "intf_msg.h"                         /* intf_DbgMsg(), intf_ErrMsg() */
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 
-#include "input.h"                                            /* pes_packet_t */
-#include "input_netlist.h"                          /* input_NetlistFreePES() */
-#include "decoder_fifo.h"          /* DECODER_FIFO_(ISEMPTY|START|INCSTART)() */
+#include "input.h"                                           /* pes_packet_t */
+#include "input_netlist.h"                         /* input_NetlistFreePES() */
+#include "decoder_fifo.h"         /* DECODER_FIFO_(ISEMPTY|START|INCSTART)() */
 
 #include "audio_output.h"
 
@@ -42,9 +42,9 @@
 #include "audio_decoder.h"
 #include "audio_math.h"
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 static int      InitThread              ( adec_thread_t * p_adec );
 static void     RunThread               ( adec_thread_t * p_adec );
 static void     ErrorThread             ( adec_thread_t * p_adec );
@@ -62,12 +62,12 @@ static void     DumpBits                ( bit_stream_t * p_bit_stream, int i_bit
 static int      FindHeader              ( adec_thread_t * p_adec );
 */
 
-/******************************************************************************
+/*****************************************************************************
  * adec_CreateThread: creates an audio decoder thread
- ******************************************************************************
+ *****************************************************************************
  * This function creates a new audio decoder thread, and returns a pointer to
  * its description. On error, it returns NULL.
- ******************************************************************************/
+ *****************************************************************************/
 adec_thread_t * adec_CreateThread( input_thread_t * p_input )
 {
     adec_thread_t *     p_adec;
@@ -128,15 +128,15 @@ adec_thread_t * adec_CreateThread( input_thread_t * p_input )
     return( p_adec );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * adec_DestroyThread: destroys an audio decoder thread
- ******************************************************************************
+ *****************************************************************************
  * This function asks an audio decoder thread to terminate. This function has
  * not to wait until the decoder thread has really died, because the killer (ie
  * this function's caller) is the input thread, that's why we are sure that no
  * other thread will try to access to this thread's descriptor after its
  * destruction.
- ******************************************************************************/
+ *****************************************************************************/
 void adec_DestroyThread( adec_thread_t * p_adec )
 {
     intf_DbgMsg("adec debug: requesting termination of audio decoder thread %p\n", p_adec);
@@ -156,13 +156,13 @@ void adec_DestroyThread( adec_thread_t * p_adec )
 
 /* Following functions are local */
 
-/******************************************************************************
+/*****************************************************************************
  * FindHeader : parses an input stream until an audio frame header could be
  *              found
- ******************************************************************************
+ *****************************************************************************
  * When this function returns successfully, the header can be found in the
  * buffer of the bit stream fifo.
- ******************************************************************************/
+ *****************************************************************************/
 static int FindHeader( adec_thread_t * p_adec )
 {
     while ( (!p_adec->b_die) && (!p_adec->b_error) )
@@ -178,18 +178,18 @@ static int FindHeader( adec_thread_t * p_adec )
     return( -1 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * adec_Layer`L'_`M': decodes an mpeg 1, layer `L', mode `M', audio frame
- ******************************************************************************
+ *****************************************************************************
  * These functions decode the audio frame which has already its header loaded
  * in the i_header member of the audio decoder thread structure and its first
  * byte of data described by the bit stream structure of the audio decoder
  * thread (there is no bit available in the bit buffer yet)
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * adec_Layer1_Mono
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ int adec_Layer1_Mono( adec_thread_t * p_adec )
 {
     p_adec->bit_stream.fifo.buffer = 0;
@@ -197,9 +197,9 @@ static __inline__ int adec_Layer1_Mono( adec_thread_t * p_adec )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * adec_Layer1_Stereo
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ int adec_Layer1_Stereo( adec_thread_t * p_adec )
 {
     p_adec->bit_stream.fifo.buffer = 0;
@@ -207,9 +207,9 @@ static __inline__ int adec_Layer1_Stereo( adec_thread_t * p_adec )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * adec_Layer2_Mono
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ int adec_Layer2_Mono( adec_thread_t * p_adec )
 {
     p_adec->bit_stream.fifo.buffer = 0;
@@ -217,9 +217,9 @@ static __inline__ int adec_Layer2_Mono( adec_thread_t * p_adec )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * adec_Layer2_Stereo
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ int adec_Layer2_Stereo( adec_thread_t * p_adec )
 {
     typedef struct requantization_s
@@ -298,7 +298,7 @@ static __inline__ int adec_Layer2_Stereo( adec_thread_t * p_adec )
     /* Check if the frame is valid or not */
     if ( i_sblimit == 0 )
     {
-        return( 0 );                                  /* the frame is invalid */
+        return( 0 );                                 /* the frame is invalid */
     }
     /* Find out the number of bits allocated */
     pi_nbal = ppi_nbal[ (i_bitrate_per_channel_index <= 2) ? 0 : 1 ];
@@ -411,7 +411,7 @@ static __inline__ int adec_Layer2_Stereo( adec_thread_t * p_adec )
         MACRO( pp_requantization_ab[i_sb] )
     }
 
-#define SWITCH( pi_scfsi, pf_scalefactor_0, pf_scalefactor_1, pf_scalefactor_2 ) \
+#define SWITCH( pi_scfsi, pf_scalefactor_0, pf_scalefactor_1, pf_scalefactor_2 )\
     switch ( (pi_scfsi)[i_sb] ) \
     { \
         case 0: \
@@ -696,12 +696,12 @@ static __inline__ int adec_Layer2_Stereo( adec_thread_t * p_adec )
     return( 6 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * InitThread : initialize an audio decoder thread
- ******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success.
- ******************************************************************************/
+ *****************************************************************************/
 static int InitThread( adec_thread_t * p_adec )
 {
     aout_fifo_t         aout_fifo;
@@ -727,7 +727,7 @@ static int InitThread( adec_thread_t * p_adec )
     /* Now we look for an audio frame header in the input stream */
     if ( FindHeader(p_adec) )
     {
-        return( -1 );                              /* b_die or b_error is set */
+        return( -1 );                             /* b_die or b_error is set */
     }
 
     /*
@@ -785,12 +785,12 @@ static int InitThread( adec_thread_t * p_adec )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RunThread : audio decoder thread
- ******************************************************************************
+ *****************************************************************************
  * Audio decoder thread. This function does only returns when the thread is
  * terminated.
- ******************************************************************************/
+ *****************************************************************************/
 static void RunThread( adec_thread_t * p_adec )
 {
 //    static const int    pi_framesize[512] = ADEC_FRAME_SIZE;
@@ -924,13 +924,13 @@ static void RunThread( adec_thread_t * p_adec )
     EndThread( p_adec );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * ErrorThread : audio decoder's RunThread() error loop
- ******************************************************************************
+ *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
- ******************************************************************************/
+ *****************************************************************************/
 static void ErrorThread( adec_thread_t *p_adec )
 {
     /* We take the lock, because we are going to read/write the start/end
@@ -955,12 +955,12 @@ static void ErrorThread( adec_thread_t *p_adec )
     vlc_mutex_unlock( &p_adec->fifo.data_lock );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * EndThread : audio decoder thread destruction
- ******************************************************************************
- * This function is called when the thread ends after a sucessfull 
+ *****************************************************************************
+ * This function is called when the thread ends after a sucessfull
  * initialization.
- ******************************************************************************/
+ *****************************************************************************/
 static void EndThread( adec_thread_t *p_adec )
 {
     intf_DbgMsg("adec debug: destroying audio decoder thread %p\n", p_adec);
index 2e8ae4cac1d249784a63f0c35495e0a223bab60e..09a4e91fce3acab479b853e8615115a2d5e1640f 100644 (file)
@@ -6,12 +6,12 @@
  * Preamble
  *****************************************************************************/
 #include <unistd.h>
-#include <stdio.h>                                            /* "intf_msg.h" */
-#include <stdlib.h>                                       /* malloc(), free() */
+#include <stdio.h>                                           /* "intf_msg.h" */
+#include <stdlib.h>                                      /* malloc(), free() */
 #include <sys/types.h>
 #include <sys/socket.h>
-#include <netinet/in.h>                                            /* ntohl() */
-#include <sys/soundcard.h>                                /* "audio_output.h" */
+#include <netinet/in.h>                                           /* ntohl() */
+#include <sys/soundcard.h>                               /* "audio_output.h" */
 #include <sys/uio.h>
 
 #include "config.h"
@@ -20,7 +20,7 @@
 #include "vlc_thread.h"
 #include "debug.h"
 
-#include "intf_msg.h"                         /* intf_DbgMsg(), intf_ErrMsg() */
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 
 #include "input.h"
 #include "input_netlist.h"
@@ -85,7 +85,7 @@ void DCT32(float *x, adec_bank_t *b)
            tt9 , tt10, tt11, tt12, tt13, tt14, tt15, tt16,
            tt17, tt18, tt19, tt20, tt21, tt22, tt23, tt24,
            tt25, tt26, tt27, tt28, tt29, tt30, tt31, tt32, *y;
-    
+
     /* We unrolled the loops */
     /* Odd-even ordering is integrated before the 1st stage */
     t17 = c17 * (x[0] - x[31]);
@@ -458,9 +458,9 @@ void PCM(adec_bank_t *b, s16 **pcm, int jump)
     int i;
     float tmp, *v;
     const float *f;
-    
+
     f = c;
-    
+
     switch(b->pos) {
        case 0:
            v = b->actual;
index 7a9059f78d92b41a12fe47c0de21727580ac333f..02391bb6ad38d2087f622cc328e4bb6f56443d64 100644 (file)
@@ -1,7 +1,7 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_dsp.c : dsp functions library
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
 /* TODO:
  *
  *
  */
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
-#include <fcntl.h>                                        /* open(), O_WRONLY */
-#include <sys/ioctl.h>                                             /* ioctl() */
-#include <unistd.h>                                       /* write(), close() */
+ *****************************************************************************/
+#include <fcntl.h>                                       /* open(), O_WRONLY */
+#include <sys/ioctl.h>                                            /* ioctl() */
+#include <unistd.h>                                      /* write(), close() */
 /* SNDCTL_DSP_RESET, SNDCTL_DSP_SETFMT, SNDCTL_DSP_STEREO, SNDCTL_DSP_SPEED, SNDCTL_DSP_GETOSPACE */
 #include <sys/soundcard.h>
 
-#include "common.h"                                      /* boolean_t, byte_t */
+#include "common.h"                                     /* boolean_t, byte_t */
 #include "mtime.h"
 #include "vlc_thread.h"
 
-#include "audio_output.h"                                       /* aout_dsp_t */
+#include "audio_output.h"                                      /* aout_dsp_t */
 #include "audio_dsp.h"
 
-#include "intf_msg.h"                         /* intf_DbgMsg(), intf_ErrMsg() */
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspOpen: opens the audio device (the digital sound processor)
- ******************************************************************************
+ *****************************************************************************
  * - This function opens the dsp as an usual non-blocking write-only file, and
  *   modifies the p_dsp->i_fd with the file's descriptor.
  * - p_dsp->psz_device must be set before calling this function !
- ******************************************************************************/
+ *****************************************************************************/
 int aout_dspOpen( aout_dsp_t *p_dsp )
 {
     if ( (p_dsp->i_fd = open( p_dsp->psz_device, O_WRONLY )) < 0 )
@@ -48,9 +48,9 @@ int aout_dspOpen( aout_dsp_t *p_dsp )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspReset: resets the dsp
- ******************************************************************************/
+ *****************************************************************************/
 int aout_dspReset( aout_dsp_t *p_dsp )
 {
     if ( ioctl( p_dsp->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
@@ -62,13 +62,13 @@ int aout_dspReset( aout_dsp_t *p_dsp )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspSetFormat: sets the dsp output format
- ******************************************************************************
+ *****************************************************************************
  * This functions tries to initialize the dsp output format with the value
  * contained in the dsp structure, and if this value could not be set, the
  * default value returned by ioctl is set.
- ******************************************************************************/
+ *****************************************************************************/
 int aout_dspSetFormat( aout_dsp_t *p_dsp )
 {
     int i_format;
@@ -89,11 +89,11 @@ int aout_dspSetFormat( aout_dsp_t *p_dsp )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspSetChannels: sets the dsp's stereo or mono mode
- ******************************************************************************
+ *****************************************************************************
  * This function acts just like the previous one...
- ******************************************************************************/
+ *****************************************************************************/
 int aout_dspSetChannels( aout_dsp_t *p_dsp )
 {
     boolean_t b_stereo;
@@ -114,13 +114,13 @@ int aout_dspSetChannels( aout_dsp_t *p_dsp )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspSetRate: sets the dsp's audio output rate
- ******************************************************************************
+ *****************************************************************************
  * This function tries to initialize the dsp with the rate contained in the
  * dsp structure, but if the dsp doesn't support this value, the function uses
  * the value returned by ioctl...
- ******************************************************************************/
+ *****************************************************************************/
 int aout_dspSetRate( aout_dsp_t *p_dsp )
 {
     long l_rate;
@@ -141,9 +141,9 @@ int aout_dspSetRate( aout_dsp_t *p_dsp )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspGetBufInfo: buffer status query
- ******************************************************************************
+ *****************************************************************************
  * This function fills in the audio_buf_info structure :
  * - int fragments : number of available fragments (partially usend ones not
  *   counted)
@@ -151,25 +151,25 @@ int aout_dspSetRate( aout_dsp_t *p_dsp )
  * - int fragsize : size of a fragment in bytes
  * - int bytes : available space in bytes (includes partially used fragments)
  * Note! 'bytes' could be more than fragments*fragsize
- ******************************************************************************/
+ *****************************************************************************/
 void aout_dspGetBufInfo( aout_dsp_t *p_dsp )
 {
     ioctl( p_dsp->i_fd, SNDCTL_DSP_GETOSPACE, &p_dsp->buf_info );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspPlaySamples: plays a sound samples buffer
- ******************************************************************************
+ *****************************************************************************
  * This function writes a buffer of i_length bytes in the dsp
- ******************************************************************************/
+ *****************************************************************************/
 void aout_dspPlaySamples( aout_dsp_t *p_dsp, byte_t *buffer, int i_size )
 {
     write( p_dsp->i_fd, buffer, i_size );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_dspClose: closes the dsp audio device
- ******************************************************************************/
+ *****************************************************************************/
 void aout_dspClose( aout_dsp_t *p_dsp )
 {
     close( p_dsp->i_fd );
index e64282165daaef0a1b8b22b89eb791ec34e5405b..cfa2fd9df375a35f60b115045bc6970c10f54e9f 100644 (file)
@@ -1,7 +1,7 @@
-/******************************************************************************
+/*****************************************************************************
  * audio_output.c : audio output thread
  * (c)1999 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
 /* TODO:
  *
  *
  */
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 #include <unistd.h>
 
 #include <sys/soundcard.h>
-#include <stdio.h>                                            /* "intf_msg.h" */
-#include <stdlib.h>                             /* calloc(), malloc(), free() */
+#include <stdio.h>                                           /* "intf_msg.h" */
+#include <stdlib.h>                            /* calloc(), malloc(), free() */
 
 #include "common.h"
 #include "config.h"
-#include "mtime.h"                              /* mtime_t, mdate(), msleep() */
+#include "mtime.h"                             /* mtime_t, mdate(), msleep() */
 #include "vlc_thread.h"
 
-#include "intf_msg.h"                         /* intf_DbgMsg(), intf_ErrMsg() */
+#include "intf_msg.h"                        /* intf_DbgMsg(), intf_ErrMsg() */
 
 #include "audio_output.h"
 #include "audio_dsp.h"
 #include "main.h"
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 
 static int aout_SpawnThread( aout_thread_t * p_aout );
 
@@ -56,14 +56,14 @@ void aout_Thread_U16_Stereo     ( aout_thread_t * p_aout );
 static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator );
 static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, mtime_t aout_date );
 
-/******************************************************************************
+/*****************************************************************************
  * aout_CreateThread: initialize audio thread
- ******************************************************************************/
+ *****************************************************************************/
 aout_thread_t *aout_CreateThread( int *pi_status )
 {
-    aout_thread_t * p_aout;                               /* thread descriptor */
+    aout_thread_t * p_aout;                             /* thread descriptor */
 //    int             i_status;                                 /* thread status */
-   
+
     /* Allocate descriptor */
     p_aout = (aout_thread_t *) malloc( sizeof(aout_thread_t) );
     if( p_aout == NULL )
@@ -76,11 +76,11 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     p_aout->dsp.i_format = AOUT_DEFAULT_FORMAT;
     p_aout->dsp.psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
     p_aout->dsp.b_stereo   = main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
-    p_aout->dsp.l_rate     = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );    
+    p_aout->dsp.l_rate     = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
     // ???? end of kludge
 
-    /* 
-     * Initialize DSP 
+    /*
+     * Initialize DSP
      */
     if ( aout_dspOpen( &p_aout->dsp ) )
     {
@@ -129,9 +129,9 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     return( p_aout );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_SpawnThread
- ******************************************************************************/
+ *****************************************************************************/
 static int aout_SpawnThread( aout_thread_t * p_aout )
 {
     int             i_fifo;
@@ -266,12 +266,12 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_DestroyThread
- ******************************************************************************/
+ *****************************************************************************/
 void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
 {
-    //???? pi_status is not handled correctly: check vout how to do! 
+    //???? pi_status is not handled correctly: check vout how to do!
 
     intf_DbgMsg("aout debug: requesting termination of audio output thread (%p)\n", p_aout);
 
@@ -289,9 +289,9 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
     free( p_aout );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_CreateFifo
- ******************************************************************************/
+ *****************************************************************************/
 aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
 {
     int i_fifo;
@@ -390,9 +390,9 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
     return( &p_aout->fifo[i_fifo] );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * aout_DestroyFifo
- ******************************************************************************/
+ *****************************************************************************/
 void aout_DestroyFifo( aout_fifo_t * p_fifo )
 {
     intf_DbgMsg("aout debug: requesting destruction of audio output fifo (%p)\n", p_fifo);
@@ -402,7 +402,7 @@ void aout_DestroyFifo( aout_fifo_t * p_fifo )
 /* Here are the local macros */
 
 #define UPDATE_INCREMENT( increment, integer ) \
-    if ( ((increment).l_remainder += (increment).l_euclidean_remainder) >= 0 ) \
+    if ( ((increment).l_remainder += (increment).l_euclidean_remainder) >= 0 )\
     { \
         (integer) += (increment).l_euclidean_integer + 1; \
         (increment).l_remainder -= (increment).l_euclidean_denominator; \
@@ -414,9 +414,9 @@ void aout_DestroyFifo( aout_fifo_t * p_fifo )
 
 /* Following functions are local */
 
-/******************************************************************************
+/*****************************************************************************
  * InitializeIncrement
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long l_numerator, long l_denominator )
 {
     p_increment->l_remainder = -l_denominator;
@@ -433,9 +433,9 @@ static __inline__ void InitializeIncrement( aout_increment_t * p_increment, long
     p_increment->l_euclidean_denominator = l_denominator;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * NextFrame
- ******************************************************************************/
+ *****************************************************************************/
 static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, mtime_t aout_date )
 {
     long l_units, l_rate;
index eecb901e762054c17b02f2e066bdbd087e1d14ed..6019ef4b064b21b9c461abf94e4be3436ed5844b 100644 (file)
@@ -1,20 +1,20 @@
-/******************************************************************************
+/*****************************************************************************
  * generic_decoder.c : generic decoder thread
  * (c)1999 VideoLAN
- ******************************************************************************
- * This decoder provides a way to parse packets which do not belong to any 
- * known stream type, or to redirect packets to files. It can extract PES files 
- * from a multiplexed stream, identify automatically ES in a stream missing 
+ *****************************************************************************
+ * This decoder provides a way to parse packets which do not belong to any
+ * known stream type, or to redirect packets to files. It can extract PES files
+ * from a multiplexed stream, identify automatically ES in a stream missing
  * stream informations (i.e. a TS stream without PSI) and update ES tables in
- * its input thread, or just print informations about what it receives in DEBUG 
+ * its input thread, or just print informations about what it receives in DEBUG
  * mode.
  * A single generic decoder is able to handle several ES, therefore it can be
  * used as a 'default' decoder by the input thread.
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include "vlc.h"
 
 /*#include <errno.h>
@@ -31,7 +31,7 @@
 #include "thread.h"
 
 #include "intf_msg.h"
-#include "debug.h"   */               
+#include "debug.h"   */
 /*
 #include "input.h"
 #include "input_netlist.h"
@@ -52,27 +52,27 @@ static void     RunThread           ( gdec_thread_t *p_gdec );
 static void     ErrorThread         ( gdec_thread_t *p_gdec );
 static void     EndThread           ( gdec_thread_t *p_gdec );
 
-static void     IdentifyPES         ( gdec_thread_t *p_gdec, pes_packet_t *p_pes, 
+static void     IdentifyPES         ( gdec_thread_t *p_gdec, pes_packet_t *p_pes,
                                       int i_stream_id );
 static void     PrintPES            ( pes_packet_t *p_pes, int i_stream_id );
 
-/******************************************************************************
+/*****************************************************************************
  * gdec_CreateThread: create a generic decoder thread
- ******************************************************************************
+ *****************************************************************************
  * This function creates a new generic decoder thread, and returns a pointer
  * to its description. On error, it returns NULL.
  * Following configuration properties are used:
  *  GDEC_CFG_ACTIONS    (required)
  * ??
- ******************************************************************************/
+ *****************************************************************************/
 gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
                                    int *pi_status )
 {
-    gdec_thread_t * p_gdec;                              /* thread descriptor */
-    int             i_status;                                /* thread status */
-    
+    gdec_thread_t * p_gdec;                             /* thread descriptor */
+    int             i_status;                               /* thread status */
+
     /*
-     * Check configuration 
+     * Check configuration
      */
     if( CheckConfiguration( p_cfg ) )
     {
@@ -81,13 +81,13 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
 
     /* Allocate descriptor and initialize flags */
     p_gdec = (gdec_thread_t *) malloc( sizeof(gdec_thread_t) );
-    if( p_gdec == NULL )                                             /* error */
+    if( p_gdec == NULL )                                            /* error */
     {
         return( NULL );
     }
 
     /* Copy configuration */
-    p_gdec->i_actions = p_cfg->i_actions;    
+    p_gdec->i_actions = p_cfg->i_actions;
     /* ?? */
 
     /* Set status */
@@ -96,52 +96,52 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
 
     /* Initialize flags */
     p_gdec->b_die = 0;
-    p_gdec->b_error = 0;    
+    p_gdec->b_error = 0;
     p_gdec->b_active = 1;
 
     /* Create thread */
     if( vlc_thread_create( &p_gdec->thread_id, "generic decoder", (vlc_thread_func)RunThread, (void *) p_gdec) )
     {
         intf_ErrMsg("gdec error: %s\n", strerror(ENOMEM));
-        intf_DbgMsg("failed\n");        
+        intf_DbgMsg("failed\n");
         free( p_gdec );
         return( NULL );
-    }   
+    }
 
     /* If status is NULL, wait until the thread is created */
     if( pi_status == NULL )
     {
         do
-        {            
+        {
             msleep( THREAD_SLEEP );
-        }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR) 
+        }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR)
                 && (i_status != THREAD_FATAL) );
         if( i_status != THREAD_READY )
         {
-            intf_DbgMsg("failed\n");            
-            return( NULL );            
-        }        
+            intf_DbgMsg("failed\n");
+            return( NULL );
+        }
     }
 
-    intf_DbgMsg("succeeded -> %p\n", p_gdec);    
+    intf_DbgMsg("succeeded -> %p\n", p_gdec);
     return( p_gdec );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * gdec_DestroyThread: destroy a generic decoder thread
- ******************************************************************************
+ *****************************************************************************
  * Destroy a terminated thread. This function will return 0 if the thread could
  * be destroyed, and non 0 else. The last case probably means that the thread
  * was still active, and another try may succeed.
- ******************************************************************************/
+ *****************************************************************************/
 void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
 {
-    int     i_status;                                        /* thread status */
+    int     i_status;                                       /* thread status */
 
     /* Set status */
     p_gdec->pi_status = (pi_status != NULL) ? pi_status : &i_status;
     *p_gdec->pi_status = THREAD_DESTROY;
-     
+
     /* Request thread destruction */
     p_gdec->b_die = 1;
     /* Make sure the decoder thread leaves the GetByte() function */
@@ -155,8 +155,8 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
         do
         {
             msleep( THREAD_SLEEP );
-        }while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR) 
-                && (i_status != THREAD_FATAL) );   
+        }while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR)
+                && (i_status != THREAD_FATAL) );
     }
 
     intf_DbgMsg("%p -> succeeded\n", p_gdec);
@@ -164,38 +164,38 @@ void gdec_DestroyThread( gdec_thread_t *p_gdec, int *pi_status )
 
 /* following functions are local */
 
-/******************************************************************************
+/*****************************************************************************
  * CheckConfiguration: check gdec_CreateThread() configuration
- ******************************************************************************
+ *****************************************************************************
  * Set default parameters where required. In DEBUG mode, check if configuration
  * is valid.
- ******************************************************************************/
+ *****************************************************************************/
 static int CheckConfiguration( gdec_cfg_t *p_cfg )
 {
 #ifdef DEBUG
     /* Actions (required) */
     if( !(p_cfg->i_properties & GDEC_CFG_ACTIONS) )
     {
-        return( 1 );        
-    }    
+        return( 1 );
+    }
 #endif
 
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * InitThread: initialize gdec thread
- ******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
- ******************************************************************************/
+ *****************************************************************************/
 static int InitThread( gdec_thread_t *p_gdec )
 {
     /* ?? */
 
     /* Update status */
-    *p_gdec->pi_status = THREAD_START;    
+    *p_gdec->pi_status = THREAD_START;
 
     /* Initialize other properties */
 #ifdef STATS
@@ -205,29 +205,29 @@ static int InitThread( gdec_thread_t *p_gdec )
 #endif
 
     /* Mark thread as running and return */
-    *p_gdec->pi_status = THREAD_READY;    
-    intf_DbgMsg("%p -> succeeded\n", p_gdec);    
-    return(0);    
+    *p_gdec->pi_status = THREAD_READY;
+    intf_DbgMsg("%p -> succeeded\n", p_gdec);
+    return(0);
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RunThread: generic decoder thread
- ******************************************************************************
+ *****************************************************************************
  * Generic decoder thread. This function does only returns when the thread is
- * terminated. 
- ******************************************************************************/
+ * terminated.
+ *****************************************************************************/
 static void RunThread( gdec_thread_t *p_gdec )
 {
-    pes_packet_t *  p_pes;                                  /* current packet */
-    int             i_stream_id;                             /* PES stream id */
-    
-    /* 
-     * Initialize thread and free configuration 
+    pes_packet_t *  p_pes;                                 /* current packet */
+    int             i_stream_id;                            /* PES stream id */
+
+    /*
+     * Initialize thread and free configuration
      */
     p_gdec->b_error = InitThread( p_gdec );
     if( p_gdec->b_error )
     {
-        free( p_gdec );                                 /* destroy descriptor */
+        free( p_gdec );                                /* destroy descriptor */
         return;
     }
 
@@ -240,7 +240,7 @@ static void RunThread( gdec_thread_t *p_gdec )
         /* ?? locks à rajouter ? - vérifier les macros (transformer en inline ?) */
         /* ?? on idle loop, increment c_idle_loops */
         while( !DECODER_FIFO_ISEMPTY( p_gdec->fifo ) )
-        {            
+        {
             p_pes = DECODER_FIFO_START( p_gdec->fifo );
             DECODER_FIFO_INCSTART( p_gdec->fifo );
 
@@ -248,8 +248,8 @@ static void RunThread( gdec_thread_t *p_gdec )
              * by GDEC_IDENTIFY, GDEC_SAVE_DEMUX and GDEC_PRINT */
             if( p_gdec->i_actions & (GDEC_IDENTIFY | GDEC_SAVE_DEMUX | GDEC_PRINT) )
             {
-                i_stream_id = p_pes->p_pes_header[3];                    
-            }            
+                i_stream_id = p_pes->p_pes_header[3];
+            }
 
             /* PES identification */
             if( p_gdec->i_actions & GDEC_IDENTIFY )
@@ -268,77 +268,77 @@ static void RunThread( gdec_thread_t *p_gdec )
             {
                 /* ?? */
             }
-                       
+
             /* PES information printing */
             if( p_gdec->i_actions & GDEC_PRINT )
             {
                 PrintPES( p_pes, i_stream_id );
-            }                        
+            }
 
             /* Trash PES packet (give it back to fifo) */
-            input_NetlistFreePES( p_gdec->p_input, p_pes );            
+            input_NetlistFreePES( p_gdec->p_input, p_pes );
 
 #ifdef STATS
-            p_gdec->c_pes++;            
+            p_gdec->c_pes++;
 #endif
         }
 #ifdef STATS
-        p_gdec->c_loops++;        
-#endif        
-    } 
+        p_gdec->c_loops++;
+#endif
+    }
 
     /*
      * Error loop
      */
     if( p_gdec->b_error )
     {
-        ErrorThread( p_gdec );        
+        ErrorThread( p_gdec );
     }
 
     /* End of thread */
     EndThread( p_gdec );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * ErrorThread: RunThread() error loop
- ******************************************************************************
+ *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
- ******************************************************************************/
+ *****************************************************************************/
 static void ErrorThread( gdec_thread_t *p_gdec )
 {
-    pes_packet_t *  p_pes;                                      /* pes packet */
-    
+    pes_packet_t *  p_pes;                                     /* pes packet */
+
     /* Wait until a `die' order */
     while( !p_gdec->b_die )
     {
         /* Trash all received PES packets */
         while( !DECODER_FIFO_ISEMPTY( p_gdec->fifo ) )
-        {            
+        {
             p_pes = DECODER_FIFO_START( p_gdec->fifo );
             DECODER_FIFO_INCSTART( p_gdec->fifo );
-            input_NetlistFreePES( p_gdec->p_input, p_pes );            
+            input_NetlistFreePES( p_gdec->p_input, p_pes );
         }
 
         /* Sleep a while */
-        msleep( GDEC_IDLE_SLEEP );                
+        msleep( GDEC_IDLE_SLEEP );
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * EndThread: thread destruction
- ******************************************************************************
- * This function is called when the thread ends after a sucessfull 
+ *****************************************************************************
+ * This function is called when the thread ends after a sucessfull
  * initialization.
- ******************************************************************************/
+ *****************************************************************************/
 static void EndThread( gdec_thread_t *p_gdec )
 {
-    int *   pi_status;                                       /* thread status */    
-    
+    int *   pi_status;                                      /* thread status */
+
     /* Store status */
-    pi_status = p_gdec->pi_status;    
-    *pi_status = THREAD_END;    
+    pi_status = p_gdec->pi_status;
+    *pi_status = THREAD_END;
 
 #ifdef DEBUG
     /* Check for remaining PES packets */
@@ -346,27 +346,27 @@ static void EndThread( gdec_thread_t *p_gdec )
 #endif
 
     /* Destroy thread structures allocated by InitThread */
-    free( p_gdec );                                     /* destroy descriptor */
+    free( p_gdec );                                    /* destroy descriptor */
 
-    *pi_status = THREAD_OVER;    
+    *pi_status = THREAD_OVER;
     intf_DbgMsg("%p\n", p_gdec);
 }
 
-/******************************************************************************
+/*****************************************************************************
  * IdentifyPES: identify a PES packet
- ******************************************************************************
+ *****************************************************************************
  * Update ES tables in the input thread according to the stream_id value. See
  * ISO 13818-1, table 2-18.
- ******************************************************************************/
+ *****************************************************************************/
 static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_stream_id )
 {
-    int i_id;                                        /* stream id in es table */
-    int i_type;           /* stream type according ISO/IEC 13818-1 table 2-29 */
-    
+    int i_id;                                       /* stream id in es table */
+    int i_type;          /* stream type according ISO/IEC 13818-1 table 2-29 */
+
     /* Search where the elementary stream id does come from */
     switch( p_gdec->p_input->i_method )
     {
-    case INPUT_METHOD_TS_FILE:                    /* TS methods: id is TS PID */
+    case INPUT_METHOD_TS_FILE:                   /* TS methods: id is TS PID */
     case INPUT_METHOD_TS_UCAST:
     case INPUT_METHOD_TS_BCAST:
     case INPUT_METHOD_TS_VLAN_BCAST:
@@ -374,16 +374,16 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
          * in a readable place, i.e. the TS packet descriptor, rather than to
          * re-extract it now */
         i_id = U16_AT(&p_pes->p_first_ts->buffer[1]) & 0x1fff;
-        break;        
+        break;
 
 #ifdef DEBUG
-    default:                                             /* unknown id origin */
-        intf_DbgMsg("unable to identify PES using input method %d\n", 
+    default:                                            /* unknown id origin */
+        intf_DbgMsg("unable to identify PES using input method %d\n",
                     p_gdec->p_input->i_method );
-        break;        
+        break;
 #endif
     }
-    
+
     /* Try to identify PES stream_id - see ISO 13818-1 table 2-18 */
     if( i_stream_id == 0xbd )
     {
@@ -391,7 +391,7 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
         i_type = MPEG2_AUDIO_ES;
         intf_DbgMsg("PES %p identified as AUDIO AC3\n", p_pes);
     }
-    else if( (i_stream_id & 0xe0) == 0xc0 ) 
+    else if( (i_stream_id & 0xe0) == 0xc0 )
     {
         /* ISO/IEC 13818-3 or ISO/IEC 11172-3 audio stream - since there is no
          * way to make the difference between the two possibilities, and since
@@ -405,7 +405,7 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
         /* ISO/IEC 13818-2 or ISO/IEC 11172-2 video stream - since there is no
          * way to make the difference between the two possibilities, and since
          * an ISO/IEC 13818-2 is capable of decoding an ISO/IEC 11172-2 stream,
-         * the first one is used */        
+         * the first one is used */
         i_type = MPEG2_VIDEO_ES;
         intf_DbgMsg("PES %p identified as VIDEO\n", p_pes);
     }
@@ -413,25 +413,25 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
     {
         /* The stream could not be identified - just return */
         intf_DbgMsg("PES %p could not be identified\n", p_pes);
-        return;        
+        return;
     }
-    
+
     /* Update ES table */
     /* ?? */
 }
 
-/******************************************************************************
+/*****************************************************************************
  * PrintPES: print informations about a PES packet
- ******************************************************************************
+ *****************************************************************************
  * This function will print information about a received PES packet. It is
  * probably usefull only for debugging purposes, or before demultiplexing a
- * stream. It has two different formats, depending of the presence of the DEBUG 
+ * stream. It has two different formats, depending of the presence of the DEBUG
  * symbol.
- ******************************************************************************/
+ *****************************************************************************/
 static void PrintPES( pes_packet_t *p_pes, int i_stream_id )
 {
-    char psz_pes[128];                                   /* descriptor buffer */
+    char psz_pes[128];                                  /* descriptor buffer */
+
 #ifdef DEBUG
     /* PES informations, long (DEBUG) format - this string is maximum 70 bytes
      * long */
index 79b71f5ec8db3b9cf087b0149d264f35363a4f00..54a2ab6b71fcf3af23901e6381f5b94aff2c466c 100644 (file)
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * input.c: input thread 
+/*****************************************************************************
+ * input.c: input thread
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Read an MPEG2 stream, demultiplex and parse it before sending it to
  * decoders.
- ******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include "vlc.h"
 
 /*
 #include <errno.h>
-#include <sys/uio.h>                                               
+#include <sys/uio.h>
 #include <string.h>
 
-#include <stdlib.h>                            
+#include <stdlib.h>
 #include <stdio.h>
-#include <sys/ioctl.h>                                            
-#include <net/if.h>                                                
+#include <sys/ioctl.h>
+#include <net/if.h>
 #include <netinet/in.h>
 
 #include "common.h"
@@ -45,9 +45,9 @@
 #include "video_decoder.h"
 */
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 static void RunThread   ( input_thread_t *p_input );
 static void ErrorThread ( input_thread_t *p_input );
 static void EndThread   ( input_thread_t *p_input );
@@ -67,21 +67,21 @@ static __inline__ void  input_DemuxPSI( input_thread_t *p_input,
                                         es_descriptor_t *p_es_descriptor,
                                         boolean_t b_unit_start, boolean_t b_packet_lost );
 
-/*******************************************************************************
+/*****************************************************************************
  * input_CreateThread: creates a new input thread
- *******************************************************************************
+ *****************************************************************************
  * This function creates a new input, and returns a pointer
  * to its description. On error, it returns NULL.
  * If pi_status is NULL, then the function will block until the thread is ready.
  * If not, it will be updated using one of the THREAD_* constants.
- *******************************************************************************/
+ *****************************************************************************/
 input_thread_t *input_CreateThread ( int i_method, char *psz_source, int i_port, int i_vlan,
                                      p_vout_thread_t p_vout, p_aout_thread_t p_aout, int *pi_status )
 {
-    input_thread_t *    p_input;                          /* thread descriptor */
-    int                 i_status;                             /* thread status */    
-    int                 i_index;            /* index for tables initialization */    
-    
+    input_thread_t *    p_input;                        /* thread descriptor */
+    int                 i_status;                           /* thread status */
+    int                 i_index;          /* index for tables initialization */
+
     /* Allocate descriptor */
     intf_DbgMsg("\n");
     p_input = (input_thread_t *)malloc( sizeof(input_thread_t) );
@@ -104,20 +104,20 @@ input_thread_t *input_CreateThread ( int i_method, char *psz_source, int i_port,
     p_input->i_vlan             = i_vlan;
     switch( i_method )
     {
-    case INPUT_METHOD_TS_FILE:                                 /* file methods */
+    case INPUT_METHOD_TS_FILE:                               /* file methods */
         p_input->p_Open =   input_FileOpen;
         p_input->p_Read =   input_FileRead;
         p_input->p_Close =  input_FileClose;
         break;
-    case INPUT_METHOD_TS_VLAN_BCAST:                    /* vlan network method */        
+    case INPUT_METHOD_TS_VLAN_BCAST:                  /* vlan network method */
         if( !p_main->b_vlans )
         {
             intf_ErrMsg("error: vlans are not activated\n");
             free( p_input );
-            return( NULL );            
-        }        
+            return( NULL );
+        }
         /* ... pass through */
-    case INPUT_METHOD_TS_UCAST:                             /* network methods */
+    case INPUT_METHOD_TS_UCAST:                           /* network methods */
     case INPUT_METHOD_TS_MCAST:
     case INPUT_METHOD_TS_BCAST:
         p_input->p_Open =   input_NetworkOpen;
@@ -127,8 +127,8 @@ input_thread_t *input_CreateThread ( int i_method, char *psz_source, int i_port,
     default:
         intf_ErrMsg("error: unknow input method\n");
         free( p_input );
-        return( NULL );  
-        break;            
+        return( NULL );
+        break;
     }
 
     /* Initialize stream description */
@@ -137,14 +137,14 @@ input_thread_t *input_CreateThread ( int i_method, char *psz_source, int i_port,
         p_input->p_es[i_index].i_id = EMPTY_PID;
         p_input->pp_selected_es[i_index] = NULL;
     }
-    
+
     /* Initialize default settings for spawned decoders */
     p_input->p_aout                     = p_aout;
-    p_input->p_vout                     = p_vout; 
+    p_input->p_vout                     = p_vout;
 
 #ifdef STATS
     /* Initialize statistics */
-    p_input->c_loops                    = 0;    
+    p_input->c_loops                    = 0;
     p_input->c_bytes                    = 0;
     p_input->c_payload_bytes            = 0;
     p_input->c_packets_read             = 0;
@@ -174,8 +174,8 @@ input_thread_t *input_CreateThread ( int i_method, char *psz_source, int i_port,
         return( NULL );
     }
 
-    intf_DbgMsg("configuration: method=%d, source=%s, port=%d, vlan=%d\n", 
-                i_method, psz_source, i_port, i_vlan );    
+    intf_DbgMsg("configuration: method=%d, source=%s, port=%d, vlan=%d\n",
+                i_method, psz_source, i_port, i_vlan );
 
     /* Let the appropriate method open the socket. */
     if( p_input->p_Open( p_input ) )
@@ -201,38 +201,38 @@ input_thread_t *input_CreateThread ( int i_method, char *psz_source, int i_port,
         free( p_input );
         return( NULL );
     }
+
     intf_Msg("Input initialized\n");
+
     /* If status is NULL, wait until the thread is created */
     if( pi_status == NULL )
     {
         do
-        {            
+        {
             msleep( THREAD_SLEEP );
-        }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR) 
+        }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR)
                 && (i_status != THREAD_FATAL) );
         if( i_status != THREAD_READY )
         {
-            return( NULL );            
-        }        
+            return( NULL );
+        }
     }
     return( p_input );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_DestroyThread: mark an input thread as zombie
- ******************************************************************************
+ *****************************************************************************
  * This function should not return until the thread is effectively cancelled.
- ******************************************************************************/
+ *****************************************************************************/
 void input_DestroyThread( input_thread_t *p_input, int *pi_status )
 {
-    int         i_status;                                    /* thread status */
+    int         i_status;                                   /* thread status */
 
     /* Set status */
     p_input->pi_status = (pi_status != NULL) ? pi_status : &i_status;
-    *p_input->pi_status = THREAD_DESTROY;    
-     
+    *p_input->pi_status = THREAD_DESTROY;
+
     /* Request thread destruction */
     p_input->b_die = 1;
 
@@ -242,49 +242,49 @@ void input_DestroyThread( input_thread_t *p_input, int *pi_status )
         do
         {
             msleep( THREAD_SLEEP );
-        }while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR) 
-                && (i_status != THREAD_FATAL) );   
+        }while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR)
+                && (i_status != THREAD_FATAL) );
     }
 }
 
 #if 0
-/*******************************************************************************
+/*****************************************************************************
  * input_OpenAudioStream: open an audio stream
- *******************************************************************************
+ *****************************************************************************
  * This function spawns an audio decoder and plugs it on the audio output
  * thread.
- *******************************************************************************/
+ *****************************************************************************/
 int input_OpenAudioStream( input_thread_t *p_input, int i_id )
 {
     /* ?? */
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_CloseAudioStream: close an audio stream
- *******************************************************************************
+ *****************************************************************************
  * This function destroys an audio decoder.
- *******************************************************************************/
+ *****************************************************************************/
 void input_CloseAudioStream( input_thread_t *p_input, int i_id )
 {
     /* ?? */
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_OpenVideoStream: open a video stream
- *******************************************************************************
+ *****************************************************************************
  * This function spawns a video decoder and plugs it on a video output thread.
- *******************************************************************************/
-int input_OpenVideoStream( input_thread_t *p_input, 
+ *****************************************************************************/
+int input_OpenVideoStream( input_thread_t *p_input,
                            struct vout_thread_s *p_vout, struct video_cfg_s * p_cfg )
 {
     /* ?? */
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_CloseVideoStream: close a video stream
- *******************************************************************************
+ *****************************************************************************
  * This function destroys an video decoder.
- *******************************************************************************/
+ *****************************************************************************/
 void input_CloseVideoStream( input_thread_t *p_input, int i_id )
 {
     /* ?? */
@@ -293,37 +293,37 @@ void input_CloseVideoStream( input_thread_t *p_input, int i_id )
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * InitThread: initialize input thread
- *******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
- *******************************************************************************/
+ *****************************************************************************/
 static int InitThread( input_thread_t *p_input )
 {
     /* Mark thread as running and return */
     intf_DbgMsg("\n");
-    *p_input->pi_status =        THREAD_READY;    
-    intf_DbgMsg("thread ready\n");    
-    return( 0 );    
+    *p_input->pi_status =        THREAD_READY;
+    intf_DbgMsg("thread ready\n");
+    return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * RunThread: main thread loop
- *******************************************************************************
+ *****************************************************************************
  * Thread in charge of processing the network packets and demultiplexing.
- *******************************************************************************/
+ *****************************************************************************/
 static void RunThread( input_thread_t *p_input )
 {
-    /* 
-     * Initialize thread and free configuration 
+    /*
+     * Initialize thread and free configuration
      */
     p_input->b_error = InitThread( p_input );
     if( p_input->b_error )
     {
-        free( p_input );                                 /* destroy descriptor */
-        return;        
+        free( p_input );                               /* destroy descriptor */
+        return;
     }
 
     /*
@@ -359,11 +359,11 @@ static void RunThread( input_thread_t *p_input )
 }
 
 
-/******************************************************************************
+/*****************************************************************************
  * ErrorThread: RunThread() error loop
- *******************************************************************************
- * This function is called when an error occured during thread main's loop. 
- ******************************************************************************/
+ *****************************************************************************
+ * This function is called when an error occured during thread main's loop.
+ *****************************************************************************/
 static void ErrorThread( input_thread_t *p_input )
 {
     /* Wait until a `die' order */
@@ -375,25 +375,25 @@ static void ErrorThread( input_thread_t *p_input )
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * EndThread: end the input thread
- *******************************************************************************/
+ *****************************************************************************/
 static void EndThread( input_thread_t * p_input )
 {
-    int *       pi_status;                                    /* threas status */
-    int         i_es_loop;                                         /* es index */
+    int *       pi_status;                                  /* threas status */
+    int         i_es_loop;                                       /* es index */
 
     /* Store status */
     intf_DbgMsg("\n");
-    pi_status = p_input->pi_status;    
-    *pi_status = THREAD_END;  
+    pi_status = p_input->pi_status;
+    *pi_status = THREAD_END;
 
     /* Close input method */
     p_input->p_Close( p_input );
 
     /* Destroy all decoder threads */
-    for( i_es_loop = 0; 
-         (i_es_loop < INPUT_MAX_ES) && (p_input->pp_selected_es[i_es_loop] != NULL) ; 
+    for( i_es_loop = 0;
+         (i_es_loop < INPUT_MAX_ES) && (p_input->pp_selected_es[i_es_loop] != NULL) ;
          i_es_loop++ )
     {
         switch( p_input->pp_selected_es[i_es_loop]->i_type )
@@ -405,7 +405,7 @@ static void EndThread( input_thread_t * p_input )
 #else
             vpar_DestroyThread( (vpar_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
 #endif
-            break;            
+            break;
         case MPEG1_AUDIO_ES:
         case MPEG2_AUDIO_ES:
             adec_DestroyThread( (adec_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) );
@@ -422,23 +422,23 @@ static void EndThread( input_thread_t * p_input )
 #ifdef DEBUG
         default:
             intf_DbgMsg("error: unknown decoder type %d\n", p_input->pp_selected_es[i_es_loop]->i_type );
-            break;                
+            break;
 #endif
         }
     }
 
-    input_NetlistEnd( p_input );                              /* clean netlist */
-    input_PsiEnd( p_input );                          /* clean PSI information */
-    input_PcrEnd( p_input );                          /* clean PCR information */
-    free( p_input );                            /* free input_thread structure */
+    input_NetlistEnd( p_input );                            /* clean netlist */
+    input_PsiEnd( p_input );                        /* clean PSI information */
+    input_PcrEnd( p_input );                        /* clean PCR information */
+    free( p_input );                          /* free input_thread structure */
 
     /* Update status */
-    *pi_status = THREAD_OVER;    
+    *pi_status = THREAD_OVER;
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_ReadPacket: reads a packet from the network or the file
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ int input_ReadPacket( input_thread_t *p_input )
 {
     int                 i_base_index; /* index of the first free iovec */
@@ -504,7 +504,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
         /* No packet has been received, so stop here. */
         return( 0 );
     }
-     
+
     /* Demultiplex the TS packets (1..INPUT_TS_READ_ONCE) received. */
     for( i_current_index = i_base_index;
          (i_packet_size -= TS_PACKET_SIZE) >= 0;
@@ -539,7 +539,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
            efficiency reasons, other threads (including ourselves, with
            input_DemuxPacket) might have released packets to the netlist.
            So we have to copy these iovec where they should go.
-           
+
            BTW, that explains why the TS netlist is
            (INPUT_MAX_TS +1) + (TS_READ_ONCE -1) large. */
 
@@ -584,9 +584,9 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_SortPacket: find out whether we need that packet
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void input_SortPacket( input_thread_t *p_input,
                                          ts_packet_t *p_ts_packet )
 {
@@ -611,7 +611,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
 
         /* Lock current ES state. */
         vlc_mutex_lock( &p_input->es_lock );
-        
+
        /* Verify that we actually want this PID. */
         for( i_es_loop = 0; i_es_loop < INPUT_MAX_SELECTED_ES; i_es_loop++ )
         {
@@ -652,21 +652,21 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
 #endif
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_DemuxTS: first step of demultiplexing: the TS header
- *******************************************************************************
+ *****************************************************************************
  * Stream must also only contain PES and PSI, so PID must have been filtered
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void input_DemuxTS( input_thread_t *p_input,
                                       ts_packet_t *p_ts_packet,
                                       es_descriptor_t *p_es_descriptor )
 {
     int         i_dummy;
-    boolean_t   b_adaption;                       /* Adaption field is present */
-    boolean_t   b_payload;                           /* Packet carries payload */
-    boolean_t   b_unit_start;            /* A PSI or a PES start in the packet */
-    boolean_t   b_trash = 0;                   /* Must the packet be trashed ? */
-    boolean_t   b_lost = 0;                      /* Was there a packet lost ? */
+    boolean_t   b_adaption;                     /* Adaption field is present */
+    boolean_t   b_payload;                         /* Packet carries payload */
+    boolean_t   b_unit_start;          /* A PSI or a PES start in the packet */
+    boolean_t   b_trash = 0;                 /* Must the packet be trashed ? */
+    boolean_t   b_lost = 0;                     /* Was there a packet lost ? */
 
     ASSERT(p_input);
     ASSERT(p_ts_packet);
@@ -686,7 +686,7 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
     b_unit_start = (p[1] & 0x40);
     b_adaption = (p[3] & 0x20);
     b_payload = (p[3] & 0x10);
-    
+
     /* Extract adaption field informations if any */
     if( !b_adaption )
     {
@@ -729,7 +729,7 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
                     /* If the PID carries the PCR, there will be a system time-base
                        discontinuity. We let the PCR decoder handle that. */
                     p_es_descriptor->b_discontinuity = 1;
-                    
+
                     /* There also may be a continuity_counter discontinuity:
                       resynchronise our counter with the one of the stream */
                     p_es_descriptor->i_continuity_counter = (p[3] & 0x0f) - 1;
@@ -781,7 +781,7 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
         {
             /* This means that the packet is the first one we receive for this
                ES since the continuity counter ranges between 0 and 0x0F
-               excepts when it has been initialized by the input: Init the 
+               excepts when it has been initialized by the input: Init the
                counter to the correct value. */
             intf_DbgMsg("First packet for PID %d received by TS demux\n",
                         p_es_descriptor->i_id);
@@ -819,7 +819,7 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
         }
         else
         {
-            /* The payload carries a PES stream */ 
+            /* The payload carries a PES stream */
             input_DemuxPES( p_input, p_ts_packet, p_es_descriptor,
                             b_unit_start, b_lost );
         }
@@ -831,11 +831,11 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
 
 
 
-/*******************************************************************************
- * input_DemuxPES: 
- *******************************************************************************
+/*****************************************************************************
+ * input_DemuxPES:
+ *****************************************************************************
  * Gather a PES packet and analyzes its header.
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void input_DemuxPES( input_thread_t *p_input,
                                        ts_packet_t *p_ts_packet,
                                        es_descriptor_t *p_es_descriptor,
@@ -848,7 +848,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
     pes_packet_t*               p_last_pes;
     ts_packet_t *               p_ts;
     int                         i_ts_payload_size;
-    
+
 
 #define p_pes (p_es_descriptor->p_pes_packet)
 
@@ -875,7 +875,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
     {
 //        intf_DbgMsg("End of PES packet %p\n", p_pes);
 
-        /* Parse the header. The header has a variable length, but in order 
+        /* Parse the header. The header has a variable length, but in order
            to improve the algorithm, we will read the 14 bytes we may be
            interested in */
         p_ts = p_pes->p_first_ts;
@@ -884,7 +884,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
 
         if(i_ts_payload_size >= PES_HEADER_SIZE)
         {
-            /* This part of the header entirely fits in the payload of   
+            /* This part of the header entirely fits in the payload of
                the first TS packet */
             p_pes->p_pes_header = &(p_ts->buffer[p_ts->i_payload_start]);
         }
@@ -897,14 +897,14 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
               occur. */
             intf_DbgMsg("Code never tested encountered, WARNING ! (benny)\n");
            if( !p_pes->p_pes_header_save )
-               p_pes->p_pes_header_save = malloc(PES_HEADER_SIZE); 
+               p_pes->p_pes_header_save = malloc(PES_HEADER_SIZE);
 
             do
             {
                 memcpy(p_pes->p_pes_header_save + i_dummy,
                        &p_ts->buffer[p_ts->i_payload_start], i_ts_payload_size);
                 i_dummy += i_ts_payload_size;
-            
+
                 p_ts = p_ts->p_next_ts;
                 if(!p_ts)
                 {
@@ -919,7 +919,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                   /* Stats ?? */
                   return;
                 }
-                
+
                 i_ts_payload_size = p_ts->i_payload_end - p_ts->i_payload_start;
             }
             while(i_ts_payload_size + i_dummy < PES_HEADER_SIZE);
@@ -933,7 +933,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
             /* The header must be read in the buffer not in any TS packet */
            p_pes->p_pes_header = p_pes->p_pes_header_save;
         }
-        
+
         /* Now we have the part of the PES header we were interested in:
            parse it */
 
@@ -987,13 +987,13 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
                     pcr_descriptor_t * p_pcr;
 
                     p_pcr = p_input->p_pcr;
-                    
-                    p_pes->i_pts = 
+
+                    p_pes->i_pts =
                         ( ((mtime_t)(p_pes->p_pes_header[9] & 0x0E) << 29) |
                           (((mtime_t)U16_AT(p_pes->p_pes_header + 10) << 14) - (1 << 14)) |
                           ((mtime_t)U16_AT(p_pes->p_pes_header + 12) >> 1) ) * 300;
                     p_pes->i_pts /= 27;
-                    
+
                     if( p_pcr->i_synchro_state )
                     {
                         switch( p_pcr->i_synchro_state )
@@ -1043,7 +1043,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
             /* This last packet is partly header, partly payload. */
             p_ts->i_payload_start += i_pes_header_size;
 
-           
+       
             /* Now we can eventually put the PES packet in the decoder's
                PES fifo */
             switch( p_es_descriptor->i_type )
@@ -1124,7 +1124,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
     /* If we are at the beginning of a new PES packet, we must fetch a new
        PES buffer to begin with the reassembly of this PES packet. This is
        also here that we can synchronise with the stream if we we lost
-       packets or if the decoder has just started */ 
+       packets or if the decoder has just started */
     if( b_unit_start )
     {
         p_last_pes = p_pes;
@@ -1150,7 +1150,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
             if( !p_last_pes )
                 p_pes->b_data_loss = 1;
 
-            /* Read the b_random_access flag status and then reinit it */     
+            /* Read the b_random_access flag status and then reinit it */
             p_pes->b_random_access = p_es_descriptor->b_random;
             p_es_descriptor->b_random = 0;
         }
@@ -1195,30 +1195,30 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
         /* Since we don't use the TS packet to build a PES packet, we don't
            need it anymore, so give it back to the netlist */
 //        intf_DbgMsg("Trashing TS %p: no PES being build\n", p_ts_packet);
-        input_NetlistFreeTS( p_input, p_ts_packet );     
+        input_NetlistFreeTS( p_input, p_ts_packet );
     }
-    
+
 #undef p_pes
 }
 
 
 
 
-/*******************************************************************************
+/*****************************************************************************
  * input_DemuxPSI:
- *******************************************************************************
+ *****************************************************************************
  * Notice that current ES state has been locked by input_SortPacket. (No more true,
  * changed by benny - See if it's ok, and definitely change the code ???????? )
- *******************************************************************************/
+ *****************************************************************************/
 static __inline__ void input_DemuxPSI( input_thread_t *p_input,
                                        ts_packet_t *p_ts_packet,
                                        es_descriptor_t *p_es_descriptor,
                                        boolean_t b_unit_start, boolean_t b_packet_lost )
 {
-    int i_data_offset;      /* Offset of the interesting data in the TS packet */
-    u16 i_data_length;                                 /* Length of those data */
+    int i_data_offset;    /* Offset of the interesting data in the TS packet */
+    u16 i_data_length;                               /* Length of those data */
     //boolean_t b_first_section; /* Was there another section in the TS packet ? */
-    
+
     ASSERT(p_input);
     ASSERT(p_ts_packet);
     ASSERT(p_es_descriptor);
@@ -1274,7 +1274,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
         else
         {
             /* This may either mean that the TS is bad or that the packet contains
-               the end of a section that had been discarded in a previous loop: 
+               the end of a section that had been discarded in a previous loop:
                trash the TS packet since we cannot do anything with those data: */
             p_psi->b_running_section = 0;
             p_psi->i_current_position = 0;
@@ -1309,8 +1309,8 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
             p_psi->b_running_section = 1;
             p_psi->i_current_position = 0;
         }
-        
-        /* Compute the length of data related to the section in this TS packet */
+
+      /* Compute the length of data related to the section in this TS packet */
         if( p_psi->i_length - p_psi->i_current_position > TS_PACKET_SIZE - i_data_offset)
             i_data_length = TS_PACKET_SIZE - i_data_offset;
         else
@@ -1334,7 +1334,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
             /* Prepare the buffer to receive a new section */
             p_psi->i_current_position = 0;
             p_psi->b_running_section = 0;
-        
+
             /* The new section won't be the first anymore */
             //b_first_section = 0;
         }
@@ -1344,7 +1344,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
           p_psi->i_current_position += i_data_length;
 //          intf_DbgMsg( "Section not complete, waiting for the end\n" );
         }
-    
+
 //        intf_DbgMsg( "Must loop ? Next data offset: %d, stuffing: %d\n",
 //                     i_data_offset, p_ts_packet->buffer[i_data_offset] );
     }
@@ -1352,5 +1352,5 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
     /* Relase the TS packet, we don't need it anymore */
     input_NetlistFreeTS( p_input, p_ts_packet );
 
-#undef p_psi  
+#undef p_psi
 }
index d6a8c71a7109afdeb7110a7b68dc200873496db4..048c34d28001b8ce7434e6c7f152429fda7f085c 100644 (file)
@@ -1,26 +1,26 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_ctrl.c: Decodeur control
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Control the extraction and the decoding of the programs elements carried in
  * a stream.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 
 #include "vlc.h"
 
 #if 0
 #include <errno.h>
-#include <sys/uio.h>                                                 /* iovec */
-#include <stdlib.h>                               /* atoi(), malloc(), free() */
+#include <sys/uio.h>                                                /* iovec */
+#include <stdlib.h>                              /* atoi(), malloc(), free() */
 #include <string.h>
 #include <stdio.h>
 #include <unistd.h>
 
-#include <netinet/in.h>                                              /* ntohs */
+#include <netinet/in.h>                                             /* ntohs */
 
 #include "common.h"
 #include "config.h"
 
 #endif
 
-/******************************************************************************
+/*****************************************************************************
  * input_AddPgrmElem: Start the extraction and the decoding of a program element
- ******************************************************************************
+ *****************************************************************************
  * Add the element given by its PID in the list of PID to extract and spawn
- * the decoding thread. 
+ * the decoding thread.
  * This function only modifies the table of selected es, but must NOT modify
  * the table of ES itself.
- ******************************************************************************/
+ *****************************************************************************/
 int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
 {
     int i_es_loop, i_selected_es_loop;
-    
+
     /* Since this function is intended to be called by interface, lock the
      * elementary stream structure. */
     vlc_mutex_lock( &p_input->es_lock );
@@ -80,7 +80,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
             /* Find a free spot in pp_selected_es. */
             for( i_selected_es_loop = 0; p_input->pp_selected_es[i_selected_es_loop] != NULL
                   && i_selected_es_loop < INPUT_MAX_SELECTED_ES; i_selected_es_loop++ );
-            
+
             if( i_selected_es_loop == INPUT_MAX_SELECTED_ES )
             {
                 /* array full */
@@ -178,21 +178,21 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
             }
         }
     }
-    
+
     /* We haven't found this PID in the current stream. */
     vlc_mutex_unlock( &p_input->es_lock );
     intf_ErrMsg("input error: can't find PID %d\n", i_current_id);
     return( -1 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_DelPgrmElem: Stop the decoding of a program element
- ******************************************************************************
+ *****************************************************************************
  * Stop the extraction of the element given by its PID and kill the associated
  * decoder thread
  * This function only modifies the table of selected es, but must NOT modify
  * the table of ES itself.
- ******************************************************************************/
+ *****************************************************************************/
 int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
 {
     int i_selected_es_loop, i_last_selected;
@@ -257,7 +257,7 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
                      i_last_selected++ );
 
                 /* Exchange streams. */
-                p_input->pp_selected_es[i_selected_es_loop] = 
+                p_input->pp_selected_es[i_selected_es_loop] =
                             p_input->pp_selected_es[i_last_selected];
                 p_input->pp_selected_es[i_last_selected] = NULL;
 
@@ -275,12 +275,12 @@ int input_DelPgrmElem( input_thread_t *p_input, int i_current_id )
 
 
 
-/******************************************************************************
+/*****************************************************************************
  * input_IsElemRecv: Test if an element given by its PID is currently received
- ******************************************************************************
+ *****************************************************************************
  * Cannot return the position of the es in the pp_selected_es, for it can
  * change once we have released the lock
- ******************************************************************************/
+ *****************************************************************************/
 boolean_t input_IsElemRecv( input_thread_t *p_input, int i_id )
 {
   boolean_t b_is_recv = 0;
index 7e40dc7cd8cdf0243cd8ca4df99b6395e2263204..9871bd9b94de426df97ca55cd37ca84ee9660bdf 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
- * input_file.c: functions to read from a file 
+/*****************************************************************************
+ * input_file.c: functions to read from a file
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <sys/types.h>
 #include <sys/uio.h>
 
 #include "input.h"
 #include "input_file.h"
 
-/******************************************************************************
+/*****************************************************************************
  * input_FileOpen : open a file descriptor
- ******************************************************************************/
+ *****************************************************************************/
 int input_FileOpen( input_thread_t *p_input )
 {
     //??
     return( 1 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_FileRead : read from a file
- ******************************************************************************/
+ *****************************************************************************/
 int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector,
                     size_t i_count )
 {
@@ -36,9 +36,9 @@ int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector,
     return( -1 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_FileClose : close a file descriptor
- ******************************************************************************/
+ *****************************************************************************/
 void input_FileClose( input_thread_t *p_input )
 {
     //??
index 740d0b8797c61b66229b1885dbea0062ddc366b1..053c196db576ead38bda9b97ad4aed52a6d788fb 100644 (file)
@@ -1,13 +1,13 @@
-/*******************************************************************************
- * netlist.c: input thread 
+/*****************************************************************************
+ * netlist.c: input thread
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Manages the TS and PES netlists (see netlist.h).
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <stdlib.h>
 #include "input.h"
 #include "input_netlist.h"
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * input_NetlistOpen: initialize the netlists buffers
- ******************************************************************************/
+ *****************************************************************************/
 int input_NetlistInit( input_thread_t *p_input )
 {
     int                 i_base, i_packets, i_iovec;
@@ -64,7 +64,7 @@ int input_NetlistInit( input_thread_t *p_input )
         return( -1 );
     }
 
-    /* Allocate a big piece of memory to contain the INPUT_MAX_PES PES packets */
+  /* Allocate a big piece of memory to contain the INPUT_MAX_PES PES packets */
     if( !( p_input->netlist.p_pes_packets = malloc( (INPUT_MAX_PES + 1)
                                              * sizeof(pes_packet_t) ) ) )
     {
@@ -116,9 +116,9 @@ int input_NetlistInit( input_thread_t *p_input )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_NetlistClean: clean the netlists buffers
- ******************************************************************************/
+ *****************************************************************************/
 void input_NetlistEnd( input_thread_t *p_input )
 {
     int i;
index 598cf2a8437eaa027939a3156a4b7f344dce54e6..be3dbc5fca28088ab8176eeeb7b8c31a708a3e09 100644 (file)
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * network.c: functions to read from the network 
+/*****************************************************************************
+ * network.c: functions to read from the network
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Manages a socket.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <string.h>
 #include <stdio.h>
-#include <netdb.h>      /* servent, getservbyname(), hostent, gethostbyname() */
-#include <sys/socket.h>          /* socket(), setsockopt(), bind(), connect() */
-#include <unistd.h>                                                /* close() */
-#include <netinet/in.h>                      /* sockaddr_in, htons(), htonl() */
+#include <netdb.h>     /* servent, getservbyname(), hostent, gethostbyname() */
+#include <sys/socket.h>         /* socket(), setsockopt(), bind(), connect() */
+#include <unistd.h>                                               /* close() */
+#include <netinet/in.h>                     /* sockaddr_in, htons(), htonl() */
 #include <errno.h>
 #include <sys/time.h>
 #include <unistd.h>
@@ -33,9 +33,9 @@
 #include "intf_msg.h"
 #include "main.h"
 
-/******************************************************************************
+/*****************************************************************************
  * input_NetworkOpen: initialize a network stream
- ******************************************************************************/
+ *****************************************************************************/
 int input_NetworkOpen( input_thread_t *p_input )
 {
     int                     i_socket_option;
@@ -47,9 +47,9 @@ int input_NetworkOpen( input_thread_t *p_input )
     {
         if( input_VlanJoin( p_input->i_vlan ) )
         {
-            intf_ErrMsg("error: can't join vlan %d\n", p_input->i_vlan);            
-            return( 1 );            
-        }        
+            intf_ErrMsg("error: can't join vlan %d\n", p_input->i_vlan);
+            return( 1 );
+        }
     }
 
     /* Open a SOCK_DGRAM (UDP) socket, in the AF_INET domain, automatic (0)
@@ -60,8 +60,8 @@ int input_NetworkOpen( input_thread_t *p_input )
         return( 1 );
     }
 
-    /* 
-     * Set up the options of the socket 
+    /*
+     * Set up the options of the socket
      */
 
     /* Set SO_REUSEADDR option which allows to re-bind() a busy port */
@@ -90,15 +90,15 @@ int input_NetworkOpen( input_thread_t *p_input )
         close( p_input->i_handle );
         return( 1 );
     }
-    
-    /* 
+
+    /*
      * Bind the socket
      */
 
     /* Use default port if not specified */
     if( p_input->i_port == 0 )
     {
-        p_input->i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );        
+        p_input->i_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
     }
 
     /* Find the address. */
@@ -121,7 +121,7 @@ int input_NetworkOpen( input_thread_t *p_input )
         if( BuildInetAddr( &sa_in, NULL, p_input->i_port ) == (-1) )
         {
             close( p_input->i_handle );
-            return( -1 );            
+            return( -1 );
         }
 #endif
         break;
@@ -159,7 +159,7 @@ int input_NetworkOpen( input_thread_t *p_input )
         return( 1 );
     }
 
-    /* 
+    /*
      * Connect the socket to the remote server
      */
 
@@ -168,7 +168,7 @@ int input_NetworkOpen( input_thread_t *p_input )
     {
         p_input->psz_source = main_GetPszVariable( INPUT_SERVER_VAR, INPUT_SERVER_DEFAULT );
     }
-    
+
     if( BuildInetAddr( &sa_in, p_input->psz_source, htons(0) ) == (-1) )
     {
         close( p_input->i_handle );
@@ -176,7 +176,7 @@ int input_NetworkOpen( input_thread_t *p_input )
     }
 
     /* Connect the socket. */
-    if( connect( p_input->i_handle, (struct sockaddr *) &sa_in,  
+    if( connect( p_input->i_handle, (struct sockaddr *) &sa_in,
                  sizeof( sa_in ) ) == (-1) )
     {
         intf_ErrMsg("error: can't connect socket\n" );
@@ -186,15 +186,15 @@ int input_NetworkOpen( input_thread_t *p_input )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_NetworkRead: read a stream from the network
- ******************************************************************************
+ *****************************************************************************
  * Wait for data during up to 1 second and then abort if none is arrived. The
  * number of bytes read is returned or -1 if an error occurs (so 0 is returned
  * after a timeout)
  * We don't have to make any test on presentation times, since we suppose
  * the network server sends us data when we need it.
- ******************************************************************************/
+ *****************************************************************************/
 int input_NetworkRead( input_thread_t *p_input, const struct iovec *p_vector,
                        size_t i_count )
 {
@@ -205,7 +205,7 @@ int input_NetworkRead( input_thread_t *p_input, const struct iovec *p_vector,
     /* Watch the given fd to see when it has input */
     FD_ZERO(&rfds);
     FD_SET(p_input->i_handle, &rfds);
-  
+
     /* Wait up to 1 second */
     tv.tv_sec = 1;
     tv.tv_usec = 0;
@@ -221,9 +221,9 @@ int input_NetworkRead( input_thread_t *p_input, const struct iovec *p_vector,
     return( i_rc );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_NetworkClose: close a network stream
- ******************************************************************************/
+ *****************************************************************************/
 void input_NetworkClose( input_thread_t *p_input )
 {
     /* Close local socket. */
@@ -234,8 +234,8 @@ void input_NetworkClose( input_thread_t *p_input )
 
     /* Leave vlan if required */
     if( p_input->i_method == INPUT_METHOD_TS_VLAN_BCAST )
-    {        
+    {
         input_VlanLeave( p_input->i_vlan );
-    }    
+    }
 }
 
index 60fa843f8cfaf2b8c67911b2544aa89468b005f3..38bad8232a81e1d05ef59902a94cf79fab41533e 100644 (file)
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * pcr.c: PCR management 
+/*****************************************************************************
+ * pcr.c: PCR management
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Manages structures containing PCR information.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <stdio.h>
 #include <sys/types.h>
-#include <sys/uio.h>                                                 /* iovec */
-#include <stdlib.h>                               /* atoi(), malloc(), free() */
+#include <sys/uio.h>                                                /* iovec */
+#include <stdlib.h>                              /* atoi(), malloc(), free() */
 #include <sys/socket.h>
 #include <netinet/in.h>
 
 #include "input_pcr.h"
 
 /* Note:
- *   
+ *
  *   SYNCHRONIZATION METHOD
- *   
+ *
  *   We compute an average for the pcr because we want to eliminate the
  *   network jitter and keep the low frequency variations. The average is
  *   in fact a low pass filter and the jitter is a high frequency signal
  *   that is why it is eliminated by the filter/average.
- *   
+ *
  *   The low frequency variations enable us to synchronize the client clock
  *   with the server clock because they represent the time variation between
  *   the 2 clocks. Those variations (ie the filtered pcr) are used to compute
  *   we can decoding (or trashing) the MPEG2 stream at "exactly" the same rate
  *   as it is sent by the server and so we keep the synchronization between
  *   the server and the client.
- *   
+ *
  *   It is a very important matter if you want to avoid underflow or overflow
  *   in all the FIFOs, but it may be not enough.
  *
  */
 
-/******************************************************************************
+/*****************************************************************************
  * input_PcrReInit : Reinitialize the pcr_descriptor
- ******************************************************************************/
+ *****************************************************************************/
 void input_PcrReInit( input_thread_t *p_input )
 {
     ASSERT( p_input );
@@ -58,9 +58,9 @@ void input_PcrReInit( input_thread_t *p_input )
     p_input->p_pcr->c_average_count = 0;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_PcrInit : Initialize PCR decoder
- ******************************************************************************/
+ *****************************************************************************/
 int input_PcrInit( input_thread_t *p_input )
 {
     ASSERT( p_input );
@@ -71,33 +71,33 @@ int input_PcrInit( input_thread_t *p_input )
     }
     input_PcrReInit(p_input);
     p_input->p_pcr->i_synchro_state = SYNCHRO_NOT_STARTED;
-    
+
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_PcrDecode : Decode a PCR frame
- ******************************************************************************/
+ *****************************************************************************/
 void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
                       u8* p_pcr_data )
 {
     mtime_t pcr_time, sys_time, delta_pcr;
     pcr_descriptor_t *p_pcr;
-        
+
     ASSERT( p_pcr_data );
     ASSERT( p_input );
     ASSERT( p_es );
 
     p_pcr = p_input->p_pcr;
-    
+
     /* Convert the PCR in microseconde
      * WARNING: do not remove the casts in the following calculation ! */
     pcr_time  = ( (( (mtime_t)U32_AT((u32*)p_pcr_data) << 1 ) | ( p_pcr_data[4] >> 7 )) * 300 ) / 27;
     sys_time  = mdate();
     delta_pcr = sys_time - pcr_time;
-    
+
     if( p_es->b_discontinuity ||
-        ( p_pcr->last_pcr != 0 && 
+        ( p_pcr->last_pcr != 0 &&
              (    (p_pcr->last_pcr - pcr_time) > PCR_MAX_GAP
                || (p_pcr->last_pcr - pcr_time) < - PCR_MAX_GAP ) ) )
     {
@@ -110,7 +110,7 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
 
     if( p_pcr->c_average_count == PCR_MAX_AVERAGE_COUNTER )
     {
-        p_pcr->delta_pcr = 
+        p_pcr->delta_pcr =
             ( delta_pcr + (p_pcr->delta_pcr * (PCR_MAX_AVERAGE_COUNTER-1)) )
             / PCR_MAX_AVERAGE_COUNTER;
     }
@@ -128,9 +128,9 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_PcrEnd : Clean PCR structures before dying
- ******************************************************************************/
+ *****************************************************************************/
 void input_PcrEnd( input_thread_t *p_input )
 {
     ASSERT( p_input );
index 7da8f755fa2520f83570be61576fb960e16302ca..8c3170574f1baf03ee9e83c9ac6158ee0677fc8b 100644 (file)
@@ -1,14 +1,14 @@
-/*******************************************************************************
- * psi.c: PSI management 
+/*****************************************************************************
+ * psi.c: PSI management
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Manages structures containing PSI information, and affiliated decoders.
  * TO DO: Fonctions d'init des structures
- ******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include "vlc.h"
 
 /*
 #include <pthread.h>
 #include <errno.h>
 #include <stdio.h>
-#include <sys/uio.h>                                                 
-#include <stdlib.h>                              
+#include <sys/uio.h>
+#include <stdlib.h>
 #include <string.h>
-#include <netinet/in.h>                                             
+#include <netinet/in.h>
 #include <sys/soundcard.h>
 
 #include "common.h"
@@ -88,7 +88,7 @@ static stream_descriptor_t* AddStreamDescr( input_thread_t* p_input,
 static void DestroyStreamDescr( input_thread_t* p_input, u16 i_stream_id );
 static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
                                        u16 i_pgrm_id );
-static void DestroyPgrmDescr( input_thread_t* p_input, 
+static void DestroyPgrmDescr( input_thread_t* p_input,
                               stream_descriptor_t* p_stream, u16 i_pgrm_id );
 static es_descriptor_t* AddESDescr( input_thread_t* p_input,
                                     pgrm_descriptor_t* p_pgrm, u16 i_es_pid );
@@ -101,16 +101,16 @@ static boolean_t Is_known( byte_t* a_known_section, u8 i_section );
 static void Set_known( byte_t* a_known_section, u8 i_section );
 static void Unset_known( byte_t* a_known_section, u8 i_section );
 
-/******************************************************************************
+/*****************************************************************************
  * input_PsiInit: Initialize PSI decoder
- ******************************************************************************
+ *****************************************************************************
  * Init the structures in which the PSI decoder will put the informations it
  * got from PSI tables and request for the reception of the PAT.
- ******************************************************************************/
+ *****************************************************************************/
 int input_PsiInit( input_thread_t *p_input )
 {
   ASSERT(p_input);
-  
+
   /* Precalculate the 32-bit CRC table if not already done ???
      TO DO -> Put a lock or do that at pgrm init */
   if( !b_crc_initialised )
@@ -118,7 +118,7 @@ int input_PsiInit( input_thread_t *p_input )
     BuildCrc32Table();
     b_crc_initialised = 1;
   }
-  
+
   /* Init the structure that describes the stream we are receiving */
   AddStreamDescr( p_input, PSI_UNINITIALISED );
 
@@ -133,9 +133,9 @@ int input_PsiInit( input_thread_t *p_input )
   return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_PsiClean: Clean PSI structures before dying
- ******************************************************************************/
+ *****************************************************************************/
 int input_PsiEnd( input_thread_t *p_input )
 {
   ASSERT(p_input);
@@ -152,19 +152,19 @@ int input_PsiEnd( input_thread_t *p_input )
   return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_PsiRead: Read the table of programs
- ******************************************************************************
+ *****************************************************************************
  * Ugly debugging function at that time ???????
- ******************************************************************************/
+ *****************************************************************************/
 void input_PsiRead( input_thread_t *p_input /* ??? */ )
 {
   int i_index;
   int i_index2;
   pgrm_descriptor_t* p_pgrm;
-  
+
   ASSERT( p_input );
+
   /* Lock the tables, since this method can be called from any thread */
   //vlc_mutex_lock()
 
@@ -173,7 +173,7 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
   {
     intf_IntfMsg( "Warning: PMT not yet complete\n" );
   }
-  
+
   /* Read the table */
   for( i_index = 0; i_index < p_input->p_stream->i_pgrm_number; i_index++ )
   {
@@ -201,12 +201,12 @@ void input_PsiRead( input_thread_t *p_input /* ??? */ )
   //vlc_mutex_unlock()
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_PsiDecode: Decode a PSI section
- ******************************************************************************
+ *****************************************************************************
  * This funtion is essentially a wrapper that will  perform basic checks on
  * the section and then call the right function according to its type.
- ******************************************************************************/
+ *****************************************************************************/
 void input_PsiDecode( input_thread_t *p_input, psi_section_t* p_psi_section )
 {
   ASSERT(p_input);
@@ -228,7 +228,7 @@ void input_PsiDecode( input_thread_t *p_input, psi_section_t* p_psi_section )
     }
   }
 #endif
-  
+
   /* If the section is not immediatly applicable, trash it (DVB drafts disallow
      transmission of such sections, so we didn't implement it) */
   if( !p_psi_section->buffer[5] & 0x01 )
@@ -236,7 +236,7 @@ void input_PsiDecode( input_thread_t *p_input, psi_section_t* p_psi_section )
     intf_DbgMsg( "PSI not yet applicable: trash it\n" );
     return;
   }
-  
+
   /* Handle the packet according to it's type given it the table_id  */
   switch ( p_psi_section->buffer[0] )
   {
@@ -261,26 +261,26 @@ void input_PsiDecode( input_thread_t *p_input, psi_section_t* p_psi_section )
   }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DecodeAssocSection: Decode a PAS
- ******************************************************************************
+ *****************************************************************************
  * No check is made to known if the table is currently applicable or not, so
  * that unapplicable sections must be filtered before calling this function
  * The Program Association Table can be segmented to occupy multiple sections
  * so that we have to know which sections we have already received (IsKnown() /
  * SetKnown() calls)
- ******************************************************************************/
+ *****************************************************************************/
 static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
 {
-    u8 i_stream_id;             /* Id of the stream described in that section */
-    u8 i_version;              /* Version of the table carried in the section */
+    u8 i_stream_id;            /* Id of the stream described in that section */
+    u8 i_version;             /* Version of the table carried in the section */
 
-    u16 i_pgrm_id;                       /* Id of the current described  pgrm */
-    u16 i_pgrm_map_pid;            /* PID of the associated program map table */
-    int i_pgrm_number;         /* Number of programs described in the section */
+    u16 i_pgrm_id;                      /* Id of the current described  pgrm */
+    u16 i_pgrm_map_pid;           /* PID of the associated program map table */
+    int i_pgrm_number;        /* Number of programs described in the section */
 
     boolean_t b_is_invalid = 0;
-    
+
     u8 i_current_section;
     u8 i_last_section;
 
@@ -321,7 +321,7 @@ static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
             b_is_invalid = 1;
         }
     }
-    
+
     /* Clear the table if needed */
     if( b_is_invalid )
     {
@@ -334,7 +334,7 @@ static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
         /* Stop the reception of all programs and PSI informations
            associated with this stream, excepted the PAT on PID 0 and the SDT
            on PID 17 */
-        for( i_es_index = 0; i_es_index < INPUT_MAX_SELECTED_ES && 
+        for( i_es_index = 0; i_es_index < INPUT_MAX_SELECTED_ES &&
              p_input->pp_selected_es[i_es_index]; i_es_index++ )
         {
           if( p_input->pp_selected_es[i_es_index]->b_psi )
@@ -405,7 +405,7 @@ static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
                 intf_DbgMsg("Already receiving pid %d", i_pgrm_map_pid);
                 i_es_index = INPUT_MAX_ES+1;
                 break;
-              } 
+              }
             }
             /* Start to receive that PID if we're not already doing it */
             if( i_es_index <= INPUT_MAX_ES )
@@ -420,10 +420,10 @@ static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
               AddPgrmDescr(p_descr, i_pgrm_id);
             }
           }
-          
+
           /* We now know the info carried in this section */
           Set_known(p_descr->a_known_PAT_sections, i_current_section);
-        
+
           /* Check if the table is now complete */
           p_descr->i_known_PAT_sections++;
           if( p_descr->i_known_PAT_sections >= i_last_section)
@@ -434,9 +434,9 @@ static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
 #undef p_descr
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DecodePgrmMapSection: Decode a PMS
- ******************************************************************************
+ *****************************************************************************
  * No check is made to known if the table is currently applicable or not, so
  * that unapplicable sections must be filtered before calling this function
  * The Program Map Table can be segmented to occupy multiple sections so that
@@ -445,16 +445,16 @@ static void DecodePgrmAssocSection(u8* p_pas, input_thread_t *p_input )
  * Note that the processing of those sections is different from the one of the
  * others since here a section refers to a single program, and a program cannot
  * be segmented into multiple sections
- ******************************************************************************/
+ *****************************************************************************/
 static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
 {
-  u16 i_pgrm_number;           /* Id of the program described in that section */
-  u8 i_version;                /* Version of the description for that program */
-  
+  u16 i_pgrm_number;          /* Id of the program described in that section */
+  u8 i_version;               /* Version of the description for that program */
+
   u16 i_offset;
   u16 i_section_length;
   u16 i_descr_end;
-  
+
   u8 i_last_section;
   u8 i_current_section;
 
@@ -516,7 +516,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
           intf_DbgMsg( "Invalidating PID %d\n", p_pgrm->ap_es[i_index]->i_id );
           DestroyESDescr(p_input, p_pgrm, p_pgrm->ap_es[i_index]->i_id);
         }
-        
+
        /* Update version number */
         p_pgrm->i_version = i_version;
 
@@ -596,7 +596,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
                 p_es->b_pcr = 1;
               else
                 p_es->b_pcr = 0;
-              
+
               /* Read additional info given by the descriptors */
               i_offset += 5;
               intf_DbgMsg("description length for PID %d: %d\n", p_es->i_id,
@@ -617,7 +617,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
           intf_DbgMsg("Description of program %d complete\n", p_pgrm->i_number);
           p_pgrm->b_is_ok = 1;
           Set_known(p_descr->a_known_PMT_sections, i_current_section);
-        
+
           /* Check if the PMT is now complete */
           p_descr->i_known_PMT_sections++;
           if( p_descr->i_known_PMT_sections >= i_last_section)
@@ -680,28 +680,28 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
 #undef p_descr
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DecodeSrvDescrSection
- ******************************************************************************
+ *****************************************************************************
  * A finir et a refaire proprement ????
- ******************************************************************************/
+ *****************************************************************************/
 void DecodeSrvDescrSection( byte_t* p_sdt, input_thread_t *p_input )
 {
   u16 i_stream_id;
   u8 i_version;
   u16 i_length;
-  
+
   int i_index;
   int i_offset;
   boolean_t b_must_update = 0;
-  
+
   int i_descr_end;
 
   ASSERT(p_sdt);
   ASSERT(p_input);
 
 #define p_stream (p_input->p_stream)
-  
+
    /* Read stream id and version number immediately, to be sure they will be
       initialised in all the cases in which we will need them */
    i_stream_id = U16_AT(&p_sdt[3]);
@@ -737,7 +737,7 @@ void DecodeSrvDescrSection( byte_t* p_sdt, input_thread_t *p_input )
 
      while(i_offset < i_length)
      {
-       
+
        /* Find the program to which the description applies */
        for( i_index = 0; i_index < p_stream->i_pgrm_number; i_index++ )
        {
@@ -766,11 +766,11 @@ void DecodeSrvDescrSection( byte_t* p_sdt, input_thread_t *p_input )
 #undef p_stream
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DecodePgrmDescr
- ******************************************************************************
+ *****************************************************************************
  * Decode any descriptor applying to the definition of a program
- ******************************************************************************/
+ *****************************************************************************/
 static void DecodePgrmDescriptor( byte_t* p_descriptor,
                                   pgrm_descriptor_t* p_pgrm )
 {
@@ -790,7 +790,7 @@ static void DecodePgrmDescriptor( byte_t* p_descriptor,
     /* Handle specific descriptor info */
     switch(i_type)
     {
-#ifdef DVB_EXTENSIONS        
+#ifdef DVB_EXTENSIONS
     case PSI_SERVICE_DESCRIPTOR:
     {
         /* Store service type */
@@ -823,11 +823,11 @@ static void DecodePgrmDescriptor( byte_t* p_descriptor,
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DecodeESDescriptor
- ******************************************************************************
+ *****************************************************************************
  * Decode any descriptor applying to the definition of an ES
- ******************************************************************************/
+ *****************************************************************************/
 static void DecodeESDescriptor( byte_t* p_descriptor, es_descriptor_t* p_es )
 {
     u8 i_type;                                     /* Type of the descriptor */
@@ -857,7 +857,7 @@ static void DecodeESDescriptor( byte_t* p_descriptor, es_descriptor_t* p_es )
     {
         intf_DbgMsg("Target background descriptor received\n");
         break;
-    }   
+    }
     case PSI_VIDEO_WINDOW_DESCRIPTOR:
     {
         intf_DbgMsg("Video window descriptor received\n");
@@ -869,22 +869,22 @@ static void DecodeESDescriptor( byte_t* p_descriptor, es_descriptor_t* p_es )
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_AddPsiPID: Start to receive the PSI info contained in a PID
- ******************************************************************************
+ *****************************************************************************
  * Add a descriptor to the table of es descriptor for that es and mark the es
  * as being to be received by the input (since all PSI must be received to
  * build the description of the program)
- ******************************************************************************/
+ *****************************************************************************/
 static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
 {
   int i_index;
   es_descriptor_t* p_psi_es;
-  int i_rc = 0;  
+  int i_rc = 0;
 
   /* Store the description of this stream in the input thread */
   p_psi_es = AddESDescr(p_input, NULL, i_pid);
-  
+
   if(p_psi_es)
   {
     /* Precise this ES carries PSI */
@@ -930,26 +930,26 @@ static int input_AddPsiPID( input_thread_t *p_input, int i_pid )
   return( i_rc );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * input_DelPsiPID: Stop to receive the PSI info contained in a PID
- ******************************************************************************
+ *****************************************************************************
  * Remove the PID from the list of ES descriptors and from the list of ES that
  * the input must receive.
  * Known PID for PSI should always be received, so that their description
  * should be pointed out by a member of pp_selected_es. But as INPUT_MAX_ES
  * can be different of INPUT_MAX_SELECTED_ES, this may happen, so that we must
  * do 2 loops.
- ******************************************************************************/
+ *****************************************************************************/
 static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
 {
-  int i_es_index, i_last_sel;  
+  int i_es_index, i_last_sel;
 
   intf_DbgMsg( "Deleting PSI PID %d\n", i_pid );
 
   /* Stop to receive the ES. Since the interface can also access the table
      of selected es, lock the elementary stream structure */
   vlc_mutex_lock( &p_input->es_lock );
-  
+
   for( i_es_index = 0; i_es_index < INPUT_MAX_SELECTED_ES; i_es_index++ )
   {
     if( p_input->pp_selected_es[i_es_index] &&
@@ -984,12 +984,12 @@ static int input_DelPsiPID( input_thread_t *p_input, int i_pid )
   return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Precalculate the 32-bit CRC table
- ******************************************************************************
+ *****************************************************************************
  * This table is a global variable shared by all decoders, so it has to be
  * initialised only once
- ******************************************************************************/
+ *****************************************************************************/
 void BuildCrc32Table( )
 {
     u32 i, j, k;
@@ -1002,15 +1002,15 @@ void BuildCrc32Table( )
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Test the validity of a checksum
- ******************************************************************************
+ *****************************************************************************
  * The checksum must be stored at the end of the data, and the given size must
  * include the 32 bits of the CRC.
  * Return 0 if the checksum is OK, any other value if the data are corrupted
- ******************************************************************************/
+ *****************************************************************************/
 int CheckCRC32(byte_t* p_data, int i_data_size)
-{  
+{
   int i;
   u32 i_crc = 0xffffffff;
 
@@ -1022,60 +1022,60 @@ int CheckCRC32(byte_t* p_data, int i_data_size)
   return i_crc;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Is_known: check if a given section has already been received
- ******************************************************************************
+ *****************************************************************************
  * As a table cannot be segmented into more than 256 sections, we store a 256
  * bits long table, each bit set to one indicating that the corresponding
  * saction has been received
- ******************************************************************************/
+ *****************************************************************************/
 boolean_t Is_known( byte_t* a_known_section, u8 i_section )
 {
   byte_t mask;
   boolean_t b_is_known;
-  
+
   /* Where to get the information ? */
   int i_bit_in_byte = i_section % 8;
   int i_byte_in_table = (i_section - i_bit_in_byte) / 8;
 
   /* Build mask to read the Is_known flag */
   mask = 0x01 << i_bit_in_byte;
-  
+
   /* Read the flag */
   b_is_known = a_known_section[i_byte_in_table] & mask;
 
   return b_is_known;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Set_known: mark a given section has having been received
- ******************************************************************************
+ *****************************************************************************
  *
- ******************************************************************************/
+ *****************************************************************************/
 static void Set_known( byte_t* a_known_section, u8 i_section )
 {
   byte_t mask;
-  
+
   /* Where to get the information ? */
   int i_bit_in_byte = i_section % 8;
   int i_byte_in_table = (i_section - i_bit_in_byte) / 8;
 
   /* Build mask to read the Is_known flag */
   mask = 0x01 << i_bit_in_byte;
-  
+
   /* Set the flag */
   a_known_section[i_byte_in_table] |= mask;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Unset_known: remove the 'received' mark for a given section
- ******************************************************************************
- * 
- ******************************************************************************/
+ *****************************************************************************
+ *
+ *****************************************************************************/
 static void Unset_known( byte_t* a_known_section, u8 i_section )
 {
   byte_t mask;
-  
+
   /* Where to get the information ? */
   int i_bit_in_byte = i_section % 8;
   int i_byte_in_table = (i_section - i_bit_in_byte) / 8;
@@ -1083,21 +1083,21 @@ static void Unset_known( byte_t* a_known_section, u8 i_section )
   /* Build mask to read the Is_known flag */
   mask = 0x01 << i_bit_in_byte;
   mask = ~mask;
-  
+
   /* Unset the flag */
   a_known_section[i_byte_in_table] &= mask;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * AddStreamDescr: add and init the stream descriptor of the given input
- ******************************************************************************
- * 
- ******************************************************************************/
+ *****************************************************************************
+ *
+ *****************************************************************************/
 static stream_descriptor_t* AddStreamDescr(input_thread_t* p_input,
                                            u16 i_stream_id)
 {
   ASSERT(p_input);
-  
+
   intf_DbgMsg("Adding description for stream %d\n", i_stream_id);
 
   p_input->p_stream = malloc( sizeof(stream_descriptor_t) );
@@ -1129,11 +1129,11 @@ static stream_descriptor_t* AddStreamDescr(input_thread_t* p_input,
   return p_input->p_stream;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DestroyStreamDescr: destroy the stream desciptor of the given input
- ******************************************************************************
- * 
- ******************************************************************************/
+ *****************************************************************************
+ *
+ *****************************************************************************/
 static void DestroyStreamDescr(input_thread_t* p_input, u16 i_stream_id)
 {
   int i_index;
@@ -1157,16 +1157,16 @@ static void DestroyStreamDescr(input_thread_t* p_input, u16 i_stream_id)
   p_input->p_stream = NULL;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * AddPgrmDescr: add and init a program descriptor
- ******************************************************************************
+ *****************************************************************************
  * This program descriptor will be referenced in the given stream descriptor
- ******************************************************************************/
+ *****************************************************************************/
 static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
                                         u16 i_pgrm_id)
 {
-  int i_pgrm_index = p_stream->i_pgrm_number;        /* Where to add the pgrm */
-  
+  int i_pgrm_index = p_stream->i_pgrm_number;       /* Where to add the pgrm */
+
   ASSERT(p_stream);
 
   intf_DbgMsg("Adding description for pgrm %d\n", i_pgrm_id);
@@ -1192,11 +1192,11 @@ static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
   return p_stream->ap_programs[i_pgrm_index];
 }
 
-/******************************************************************************
+/*****************************************************************************
  * AddPgrmDescr: destroy a program descriptor
- ******************************************************************************
+ *****************************************************************************
  * All ES descriptions referenced in the descriptor will be deleted.
- ******************************************************************************/
+ *****************************************************************************/
 static void DestroyPgrmDescr( input_thread_t * p_input,
                               stream_descriptor_t * p_stream, u16 i_pgrm_id )
 {
@@ -1221,7 +1221,7 @@ static void DestroyPgrmDescr( input_thread_t * p_input,
   /* Make sure that the pgrm exists */
   ASSERT(i_pgrm_index >= 0);
   ASSERT(p_pgrm);
-  
+
   /* Free the structures that describe the es that belongs to that program */
   for( i_index = 0; i_index < p_pgrm->i_es_number; i_index++ )
   {
@@ -1236,27 +1236,27 @@ static void DestroyPgrmDescr( input_thread_t * p_input,
 
   /* Remove this program from the stream's list of programs */
   p_stream->i_pgrm_number--;
-  p_stream->ap_programs[i_pgrm_index] = 
+  p_stream->ap_programs[i_pgrm_index] =
                                  p_stream->ap_programs[p_stream->i_pgrm_number];
   p_stream->ap_programs = realloc( p_stream->ap_programs,
                           p_stream->i_pgrm_number*sizeof(pgrm_descriptor_t *) );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * AddESDescr:
- ******************************************************************************
+ *****************************************************************************
  * Reserve a slot in the table of ES descritors for the ES and add it to the
  * list of ES of p_pgrm. If p_pgrm if NULL, then the ES is considered as stand
  * alone (PSI ?)
- ******************************************************************************/
+ *****************************************************************************/
 static es_descriptor_t* AddESDescr(input_thread_t* p_input,
                                    pgrm_descriptor_t* p_pgrm, u16 i_es_pid)
 {
   int i_index;
   es_descriptor_t* p_es = NULL;
-  
+
   ASSERT(p_input);
-  
+
   intf_DbgMsg("Adding description for ES %d\n", i_es_pid);
 
   /* Find an empty slot to store the description of that es */
@@ -1274,13 +1274,13 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
     p_es = &p_input->p_es[i_index];
     p_es->i_id = i_es_pid;
     intf_DbgMsg("Slot %d in p_es table assigned to ES %d\n", i_index, i_es_pid);
-    
+
     /* Init its values */
     p_es->i_type = 0;  /* ??? */
     p_es->b_psi = 0;
     p_es->b_pcr = 0;
     p_es->i_continuity_counter = 0xFF;
-    
+
     p_es->p_pes_packet = NULL;
 //    p_es->p_next_pes_packet = NULL;
     p_es->p_dec = NULL;
@@ -1299,20 +1299,20 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
       intf_DbgMsg( "Added ES %d not added to the definition of any pgrm\n",
                    i_es_pid );
   }
-  
+
   return p_es;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * DestroyESDescr:
- ******************************************************************************
- * 
- ******************************************************************************/
+ *****************************************************************************
+ *
+ *****************************************************************************/
 static void DestroyESDescr(input_thread_t* p_input,
                            pgrm_descriptor_t* p_pgrm, u16 i_pid)
 {
   int i_index;
-  
+
   /* Look for the description of the ES */
   for(i_index = 0; i_index < INPUT_MAX_ES; i_index++)
   {
index 26170b399a039a03195510e2840def56e13fabdb..988af88de37ff3f26fa898a6a03934e243bba66f 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * input_vlan.c: vlan management library
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdio.h>
 #include <unistd.h>
 #include "intf_msg.h"
 #include "main.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * input_vlan_t: vlan library data
- *******************************************************************************
+ *****************************************************************************
  * Store global vlan library data.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct input_vlan_s
-{    
-    int         i_vlan_id;                              /* current vlan number */
-    mtime_t     last_change;                               /* last change date */
+{
+    int         i_vlan_id;                            /* current vlan number */
+    mtime_t     last_change;                             /* last change date */
 } input_vlan_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Local prototypes
- *******************************************************************************/
+ *****************************************************************************/
 static int ZeTrucMucheFunction( int Channel );
 
-/*******************************************************************************
+/*****************************************************************************
  * input_VlanCreate: initialize global vlan method data
- *******************************************************************************
+ *****************************************************************************
  * Initialize vlan input method global data. This function should be called
  * once before any input thread is created or any call to other input_Vlan*()
  * function is attempted.
- *******************************************************************************/
+ *****************************************************************************/
 int input_VlanCreate( void )
 {
     /* Allocate structure */
@@ -57,67 +57,67 @@ int input_VlanCreate( void )
     if( p_main->p_vlan == NULL )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
-        return( 1 );        
+        return( 1 );
     }
 
     /* Initialize structure */
     p_main->p_vlan->i_vlan_id   = 0;
-    p_main->p_vlan->last_change = 0;    
+    p_main->p_vlan->last_change = 0;
 
-    intf_Msg("VLANs initialized\n");    
-    return( 0 );    
+    intf_Msg("VLANs initialized\n");
+    return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_VlanDestroy: free global vlan method data
- *******************************************************************************
+ *****************************************************************************
  * Free resources allocated by input_VlanMethodInit. This function should be
  * called at the end of the program.
- *******************************************************************************/
+ *****************************************************************************/
 void input_VlanDestroy( void )
 {
     /* Return to default vlan */
     if( p_main->p_vlan->i_vlan_id != 0 )
     {
-        input_VlanJoin( 0 );        
-    }    
-    
+        input_VlanJoin( 0 );
+    }
+
     /* Free structure */
-    free( p_main->p_vlan );        
+    free( p_main->p_vlan );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_VlanJoin: join a vlan
- *******************************************************************************
+ *****************************************************************************
  * This function will try to join a vlan. If the relevant interface is already
- * on the good vlan, nothing will be done. Else, and if possible (if the 
+ * on the good vlan, nothing will be done. Else, and if possible (if the
  * interface is not locked), the vlan server will be contacted and a change will
  * be requested. The function will block until the change is effective. Note
  * that once a vlan is no more used, it's interface should be unlocked using
  * input_VlanLeave().
  * Non 0 will be returned in case of error.
- *******************************************************************************/
+ *****************************************************************************/
 int input_VlanJoin( int i_vlan_id )
-{    
+{
     /* If last change is too recent, wait a while */
     if( mdate() - p_main->p_vlan->last_change < INPUT_VLAN_CHANGE_DELAY )
     {
         intf_Msg("Waiting before changing VLAN...\n");
-        mwait( p_main->p_vlan->last_change + INPUT_VLAN_CHANGE_DELAY );        
+        mwait( p_main->p_vlan->last_change + INPUT_VLAN_CHANGE_DELAY );
     }
     p_main->p_vlan->last_change = mdate();
-    p_main->p_vlan->i_vlan_id = i_vlan_id;    
+    p_main->p_vlan->i_vlan_id = i_vlan_id;
 
     intf_Msg("Joining VLAN %d (channel %d)\n", i_vlan_id + 2, i_vlan_id );
     return( ZeTrucMucheFunction( i_vlan_id ) ); // ?? join vlan
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * input_VlanLeave: leave a vlan
- *******************************************************************************
+ *****************************************************************************
  * This function tells the vlan library that the designed interface is no more
  * locked and than vlan changes can occur.
- *******************************************************************************/
+ *****************************************************************************/
 void input_VlanLeave( int i_vlan_id )
 {
     // ??
@@ -134,7 +134,7 @@ static int ZeTrucMucheFunction( int Channel)
        struct sockaddr_in      sa_client;
         char mess[80];
 
-       /*      
+       /*
         *Looking for informations about the eth0 interface
         */
 
@@ -145,13 +145,13 @@ static int ZeTrucMucheFunction( int Channel)
 
        /* Looking for the interface IP address */
        ioctl( i_socket, SIOCGIFDSTADDR, &interface );
-       ipaddr = inet_ntoa((*(struct sockaddr_in *)(&(interface.ifr_addr))).sin_addr ); 
+       ipaddr = inet_ntoa((*(struct sockaddr_in *)(&(interface.ifr_addr))).sin_addr );
 
        /* Looking for the interface MAC address */
        ioctl( i_socket, SIOCGIFHWADDR, &interface );
        close( i_socket );
        
-       /* 
+       /*
         * Getting address, port, ... of the server
         */
 
@@ -165,7 +165,7 @@ static int ZeTrucMucheFunction( int Channel)
        inet_aton( main_GetPszVariable( INPUT_VLAN_SERVER_VAR, INPUT_VLAN_SERVER_DEFAULT ), &(sa_server.sin_addr) );
        
        /*
-        * Getting address, port, ... of the client 
+        * Getting address, port, ... of the client
         */
 
        /* Initialize */
index 5e74bb52f5bb9d0b3518099cd652863564148840..3c18d17e8c1918f48302ef81166a49602698abf7 100644 (file)
@@ -1,15 +1,15 @@
-/*******************************************************************************
+/*****************************************************************************
  * control.c: user control functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Library of functions common to all threads, allowing access to various
  * structures and settings. Interfaces should only use those functions
  * to read or write informations from other threads.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include "vlc.h"
 /*??
 #include <pthread.h>
index e56f03f80cd1421db60d2514d148f6a57336647c..412be62257f879e9ef235792afe2645923af5b57 100644 (file)
@@ -1,14 +1,14 @@
-/*******************************************************************************
+/*****************************************************************************
  * interface.c: interface access for other threads
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This library provides basic functions for threads to interact with user
  * interface, such as command line.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "intf_sys.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_channel_t: channel description
- *******************************************************************************
+ *****************************************************************************
  * A 'channel' is a descriptor of an input method. It is used to switch easily
- * from source to source without having to specify the whole input thread 
+ * from source to source without having to specify the whole input thread
  * configuration. The channels array, stored in the interface thread object, is
  * loaded in intf_Create, and unloaded in intf_Destroy.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct intf_channel_s
 {
     /* Channel description */
-    int         i_channel;              /* channel number, -1 for end of array */
-    char *      psz_description;                /* channel description (owned) */
-    
+    int         i_channel;            /* channel number, -1 for end of array */
+    char *      psz_description;              /* channel description (owned) */
+
     /* Input configuration */
-    int         i_input_method;                     /* input method descriptor */
-    char *      psz_input_source;                     /* source string (owned) */
-    int         i_input_port;                                          /* port */
-    int         i_input_vlan;                                          /* vlan */
+    int         i_input_method;                   /* input method descriptor */
+    char *      psz_input_source;                   /* source string (owned) */
+    int         i_input_port;                                        /* port */
+    int         i_input_vlan;                                        /* vlan */
 } intf_channel_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Local prototypes
- *******************************************************************************/
+ *****************************************************************************/
 static int      LoadChannels    ( intf_thread_t *p_intf, char *psz_filename );
 static void     UnloadChannels  ( intf_thread_t *p_intf );
 static int      ParseChannel    ( intf_channel_t *p_channel, char *psz_str );
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_Create: prepare interface before main loop
- *******************************************************************************
+ *****************************************************************************
  * This function opens output devices and create specific interfaces. It send
  * it's own error messages.
- *******************************************************************************/
+ *****************************************************************************/
 intf_thread_t* intf_Create( void )
-{    
-    intf_thread_t *p_intf;                                        
+{
+    intf_thread_t *p_intf;
 
     /* Allocate structure */
     p_intf = malloc( sizeof( intf_thread_t ) );
     if( !p_intf )
     {
-        intf_ErrMsg("error: %s\n", strerror( ENOMEM ) );        
+        intf_ErrMsg("error: %s\n", strerror( ENOMEM ) );
        return( NULL );
     }
 
     /* Initialize structure */
-    p_intf->b_die =     0;    
+    p_intf->b_die =     0;
     p_intf->p_vout =    NULL;
-    p_intf->p_input =   NULL;   
+    p_intf->p_input =   NULL;
 
-    /* Load channels - the pointer will be set to NULL on failure. The 
-     * return value is ignored since the program can work without 
+    /* Load channels - the pointer will be set to NULL on failure. The
+     * return value is ignored since the program can work without
      * channels */
-    LoadChannels( p_intf, main_GetPszVariable( INTF_CHANNELS_VAR, INTF_CHANNELS_DEFAULT ));    
+    LoadChannels( p_intf, main_GetPszVariable( INTF_CHANNELS_VAR, INTF_CHANNELS_DEFAULT ));
 
     /* Start interfaces */
     p_intf->p_console = intf_ConsoleCreate();
@@ -101,20 +101,20 @@ intf_thread_t* intf_Create( void )
        intf_ConsoleDestroy( p_intf->p_console );
        free( p_intf );
        return( NULL );
-    }   
+    }
 
-    intf_Msg("Interface initialized\n");    
+    intf_Msg("Interface initialized\n");
     return( p_intf );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_Run
- *******************************************************************************
+ *****************************************************************************
  * Initialization script and main interface loop.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_Run( intf_thread_t *p_intf )
-{ 
-    /* Execute the initialization script - if a positive number is returned, 
+{
+    /* Execute the initialization script - if a positive number is returned,
      * the script could be executed but failed */
     if( intf_ExecScript( main_GetPszVariable( INTF_INIT_SCRIPT_VAR, INTF_INIT_SCRIPT_DEFAULT ) ) > 0 )
     {
@@ -134,49 +134,49 @@ void intf_Run( intf_thread_t *p_intf )
         if( (p_intf->p_vout != NULL) && p_intf->p_vout->b_error )
         {
             //?? add aout error detection
-            p_intf->b_die = 1;            
-        }    
+            p_intf->b_die = 1;
+        }
         if( (p_intf->p_input != NULL) && p_intf->p_input->b_error )
         {
-            input_DestroyThread( p_intf->p_input, NULL );            
-            p_intf->p_input = NULL;            
-            intf_DbgMsg("Input thread destroyed\n");            
+            input_DestroyThread( p_intf->p_input, NULL );
+            p_intf->p_input = NULL;
+            intf_DbgMsg("Input thread destroyed\n");
         }
 
-        /* Sleep to avoid using all CPU - since some interfaces needs to access 
+        /* Sleep to avoid using all CPU - since some interfaces needs to access
          * keyboard events, a 100ms delay is a good compromise */
         msleep( INTF_IDLE_SLEEP );
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_Destroy: clean interface after main loop
- *******************************************************************************
+ *****************************************************************************
  * This function destroys specific interfaces and close output devices.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_Destroy( intf_thread_t *p_intf )
 {
     /* Destroy interfaces */
     intf_SysDestroy( p_intf );
     intf_ConsoleDestroy( p_intf->p_console );
-        
+
     /* Unload channels */
-    UnloadChannels( p_intf );    
+    UnloadChannels( p_intf );
 
     /* Free structure */
     free( p_intf );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_SelectChannel: change channel
- *******************************************************************************
+ *****************************************************************************
  * Kill existing input, if any, and try to open a new one, using an input
  * configuration table.
- *******************************************************************************/
+ *****************************************************************************/
 int intf_SelectChannel( intf_thread_t * p_intf, int i_channel )
 {
-    intf_channel_t *    p_channel;                                  /* channel */
-    
+    intf_channel_t *    p_channel;                                /* channel */
+
     /* Look for channel in array */
     if( p_intf->p_channel != NULL )
     {
@@ -190,24 +190,24 @@ int intf_SelectChannel( intf_thread_t * p_intf, int i_channel )
 
                 /* Kill existing input, if any */
                 if( p_intf->p_input != NULL )
-                {        
+                {
                     input_DestroyThread( p_intf->p_input, NULL );
                 }
-                
-                intf_Msg("Channel %d: %s\n", i_channel, p_channel->psz_description );                
+
+                intf_Msg("Channel %d: %s\n", i_channel, p_channel->psz_description );
 
                 /* Open a new input */
                 p_intf->p_input = input_CreateThread( p_channel->i_input_method, p_channel->psz_input_source,
-                                                      p_channel->i_input_port, p_channel->i_input_vlan, 
-                                                      p_intf->p_vout, p_main->p_aout, NULL );        
-                return( p_intf->p_input == NULL );             
-            }            
-        }        
+                                                      p_channel->i_input_port, p_channel->i_input_vlan,
+                                                      p_intf->p_vout, p_main->p_aout, NULL );
+                return( p_intf->p_input == NULL );
+            }
+        }
     }
 
     /* Channel does not exist */
     intf_Msg("Channel %d does not exist\n", i_channel );
-    return( 1 );    
+    return( 1 );
 }
 
 /*****************************************************************************
@@ -225,7 +225,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
     case 27:                                                   /* escape key */
     case 3:                                                            /* ^C */
         p_intf->b_die = 1;
-        break;  
+        break;
     case '0':                                               /* source change */
     case '1':
     case '2':
@@ -235,10 +235,10 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
     case '6':
     case '7':
     case '8':
-    case '9':                    
+    case '9':
         /* Change channel - return code is ignored since SelectChannel displays
          * its own error messages */
-        intf_SelectChannel( p_intf, i_key - '0' );        
+        intf_SelectChannel( p_intf, i_key - '0' );
         break;
     case '+':                                                    /* volume + */
         // ??
@@ -247,78 +247,78 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
         // ??
         break;
     case 'M':                                                 /* toggle mute */
-    case 'm':                    
+    case 'm':
         // ??
-        break;     
+        break; 
     case 'g':                                                     /* gamma - */
         if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
         {
             vlc_mutex_lock( &p_intf->p_vout->change_lock );
-            p_intf->p_vout->f_gamma   -= INTF_GAMMA_STEP;                        
+            p_intf->p_vout->f_gamma   -= INTF_GAMMA_STEP;
             p_intf->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
             vlc_mutex_unlock( &p_intf->p_vout->change_lock );
-        }                    
-        break;                                        
+        }
+        break;
     case 'G':                                                     /* gamma + */
         if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma < INTF_GAMMA_LIMIT) )
-        {       
+        {
             vlc_mutex_lock( &p_intf->p_vout->change_lock );
             p_intf->p_vout->f_gamma   += INTF_GAMMA_STEP;
             p_intf->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
             vlc_mutex_unlock( &p_intf->p_vout->change_lock );
-        }                    
-        break;  
+        }
+        break;
     case 'c':                                            /* toggle grayscale */
         if( p_intf->p_vout != NULL )
         {
-            vlc_mutex_lock( &p_intf->p_vout->change_lock );                        
-            p_intf->p_vout->b_grayscale = !p_intf->p_vout->b_grayscale;                    
-            p_intf->p_vout->i_changes  |= VOUT_GRAYSCALE_CHANGE;                        
-            vlc_mutex_unlock( &p_intf->p_vout->change_lock );      
+            vlc_mutex_lock( &p_intf->p_vout->change_lock );
+            p_intf->p_vout->b_grayscale = !p_intf->p_vout->b_grayscale;
+            p_intf->p_vout->i_changes  |= VOUT_GRAYSCALE_CHANGE;
+            vlc_mutex_unlock( &p_intf->p_vout->change_lock );
         }
-        break;  
+        break;
     case ' ':                                            /* toggle interface */
         if( p_intf->p_vout != NULL )
         {
-            vlc_mutex_lock( &p_intf->p_vout->change_lock );                        
-            p_intf->p_vout->b_interface     = !p_intf->p_vout->b_interface;                    
-            p_intf->p_vout->i_changes |= VOUT_INTF_CHANGE;                        
-            vlc_mutex_unlock( &p_intf->p_vout->change_lock );      
+            vlc_mutex_lock( &p_intf->p_vout->change_lock );
+            p_intf->p_vout->b_interface     = !p_intf->p_vout->b_interface;
+            p_intf->p_vout->i_changes |= VOUT_INTF_CHANGE;
+            vlc_mutex_unlock( &p_intf->p_vout->change_lock );
         }
-        break;                                
+        break;
     case 'i':                                                 /* toggle info */
         if( p_intf->p_vout != NULL )
         {
-            vlc_mutex_lock( &p_intf->p_vout->change_lock );                        
-            p_intf->p_vout->b_info     = !p_intf->p_vout->b_info;                    
-            p_intf->p_vout->i_changes |= VOUT_INFO_CHANGE;                        
-            vlc_mutex_unlock( &p_intf->p_vout->change_lock );      
+            vlc_mutex_lock( &p_intf->p_vout->change_lock );
+            p_intf->p_vout->b_info     = !p_intf->p_vout->b_info;
+            p_intf->p_vout->i_changes |= VOUT_INFO_CHANGE;
+            vlc_mutex_unlock( &p_intf->p_vout->change_lock );
         }
-        break;                                
+        break;
     case 's':                                              /* toggle scaling */
         if( p_intf->p_vout != NULL )
         {
-            vlc_mutex_lock( &p_intf->p_vout->change_lock );                        
-            p_intf->p_vout->b_scale    = !p_intf->p_vout->b_scale;                    
-            p_intf->p_vout->i_changes |= VOUT_SCALE_CHANGE;                        
-            vlc_mutex_unlock( &p_intf->p_vout->change_lock );      
+            vlc_mutex_lock( &p_intf->p_vout->change_lock );
+            p_intf->p_vout->b_scale    = !p_intf->p_vout->b_scale;
+            p_intf->p_vout->i_changes |= VOUT_SCALE_CHANGE;
+            vlc_mutex_unlock( &p_intf->p_vout->change_lock );
         }
-        break;                                
+        break;
    default:                                                   /* unknown key */
-        return( 1 );        
+        return( 1 );
     }
 
-    return( 0 );    
+    return( 0 );
 }
 
 /* following functions are local */
-                    
-/*******************************************************************************
+
+/*****************************************************************************
  * LoadChannels: load channels description from a file
- *******************************************************************************
+ *****************************************************************************
  * This structe describes all interface-specific data of the main (interface)
  * thread.
- * Each line of the file is a semicolon separated list of the following 
+ * Each line of the file is a semicolon separated list of the following
  * fields :
  *      integer         channel number
  *      string          channel description
@@ -329,33 +329,33 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
  * The last field must end with a semicolon.
  * Comments and empty lines are not explicitely allowed, but lines with parsing
  * errors are ignored without warning.
- *******************************************************************************/
+ *****************************************************************************/
 static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
 {
-    FILE *              p_file;                                        /* file */
-    intf_channel_t *    p_channel;                          /* current channel */    
-    char                psz_line[INTF_MAX_CMD_SIZE];            /* line buffer */
-    int                 i_index;                     /* channel or field index */        
+    FILE *              p_file;                                      /* file */
+    intf_channel_t *    p_channel;                        /* current channel */
+    char                psz_line[INTF_MAX_CMD_SIZE];          /* line buffer */
+    int                 i_index;                   /* channel or field index */
 
     /* Set default value */
-    p_intf->p_channel = NULL;    
-    
+    p_intf->p_channel = NULL;
+
     /* Open file */
     p_file = fopen( psz_filename, "r" );
     if( p_file == NULL )
     {
         intf_ErrMsg("error: can't open %s (%s)\n", psz_filename, strerror(errno));
-        return( 1 );        
+        return( 1 );
     }
 
     /* First pass: count number of lines */
     for( i_index = 0; fgets( psz_line, INTF_MAX_CMD_SIZE, p_file ) != NULL; i_index++ )
     {
-        ;        
+        ;
     }
 
     if( i_index != 0 )
-    {        
+    {
         /* Allocate array and rewind - some of the lines may be invalid, and the
          * array will probably be larger than the actual number of channels, but
          * it has no consequence. */
@@ -364,9 +364,9 @@ static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
         {
             intf_ErrMsg("error: %s\n", strerror(ENOMEM));
             fclose( p_file );
-            return( 1 );            
-        }        
-        p_channel = p_intf->p_channel;        
+            return( 1 );
+        }
+        p_channel = p_intf->p_channel;
         rewind( p_file );
 
         /* Second pass: read channels descriptions */
@@ -377,64 +377,64 @@ static int LoadChannels( intf_thread_t *p_intf, char *psz_filename )
                 intf_DbgMsg("channel [%d] %s : method %d (%s:%d vlan %d)\n",
                             p_channel->i_channel, p_channel->psz_description,
                             p_channel->i_input_method, p_channel->psz_input_source,
-                            p_channel->i_input_port, p_channel->i_input_vlan );                
-                p_channel++;                
+                            p_channel->i_input_port, p_channel->i_input_vlan );
+                p_channel++;
             }
         }
-        
+
         /* Add marker at the end of the array */
         p_channel->i_channel = -1;
     }
 
     /* Close file */
-    fclose( p_file );    
+    fclose( p_file );
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * UnloadChannels: unload channels description
- ******************************************************************************
+ *****************************************************************************
  * This function free all resources allocated by LoadChannels, if any.
- ******************************************************************************/
+ *****************************************************************************/
 static void UnloadChannels( intf_thread_t *p_intf )
 {
-    int i_channel;                                           /* channel index */    
-    
+    int i_channel;                                          /* channel index */
+
     if( p_intf->p_channel != NULL )
     {
         /* Free allocated strings */
-        for( i_channel = 0; 
-             p_intf->p_channel[ i_channel ].i_channel != -1; 
+        for( i_channel = 0;
+             p_intf->p_channel[ i_channel ].i_channel != -1;
              i_channel++ )
         {
             if( p_intf->p_channel[ i_channel ].psz_description != NULL )
-            {                
+            {
                 free( p_intf->p_channel[ i_channel ].psz_description );
             }
             if( p_intf->p_channel[ i_channel ].psz_input_source != NULL )
-            {                
-                free( p_intf->p_channel[ i_channel ].psz_input_source );            
-            }            
-        }        
+            {
+                free( p_intf->p_channel[ i_channel ].psz_input_source );
+            }
+        }
 
         /* Free array */
-        free( p_intf->p_channel );        
-        p_intf->p_channel = NULL;        
-    }    
+        free( p_intf->p_channel );
+        p_intf->p_channel = NULL;
+    }
 }
 
 
-/*******************************************************************************
+/*****************************************************************************
  * ParseChannel: parse a channel description line
- *******************************************************************************
+ *****************************************************************************
  * See LoadChannels. This function return non 0 on parsing error.
- *******************************************************************************/
+ *****************************************************************************/
 static int ParseChannel( intf_channel_t *p_channel, char *psz_str )
 {
-    char *      psz_index;                                /* current character */
-    char *      psz_end;                             /* end pointer for strtol */    
-    int         i_field;                          /* field number, -1 on error */
-    int         i_field_length;               /* field length, for text fields */
+    char *      psz_index;                              /* current character */
+    char *      psz_end;                           /* end pointer for strtol */
+    int         i_field;                        /* field number, -1 on error */
+    int         i_field_length;             /* field length, for text fields */
 
     /* Set some default fields */
     p_channel->i_channel =              0;
@@ -442,7 +442,7 @@ static int ParseChannel( intf_channel_t *p_channel, char *psz_str )
     p_channel->i_input_method =         0;
     p_channel->psz_input_source =       NULL;
     p_channel->i_input_port =           0;
-    p_channel->i_input_vlan =           0;    
+    p_channel->i_input_vlan =           0;
 
     /* Parse string */
     i_field = 0;
@@ -456,90 +456,90 @@ static int ParseChannel( intf_channel_t *p_channel, char *psz_str )
             /* Parse field */
             switch( i_field++ )
             {
-            case 0:                                          /* channel number */
+            case 0:                                        /* channel number */
                 p_channel->i_channel = strtol( psz_str, &psz_end, 0);
                 if( (*psz_str == '\0') || (*psz_end != '\0') )
                 {
                     i_field = -1;
                 }
-                break;                
-            case 1:                                     /* channel description */
-                i_field_length = strlen( psz_str );                
+                break;
+            case 1:                                   /* channel description */
+                i_field_length = strlen( psz_str );
                 if( i_field_length != 0 )
                 {
                     p_channel->psz_description = malloc( i_field_length + 1 );
                     if( p_channel->psz_description == NULL )
                     {
-                        intf_ErrMsg("error: %s\n", strerror( ENOMEM ));                        
-                        i_field = -1;                        
+                        intf_ErrMsg("error: %s\n", strerror( ENOMEM ));
+                        i_field = -1;
                     }
                     else
-                    {                        
-                        strcpy( p_channel->psz_description, psz_str );                        
-                    }                        
+                    {
+                        strcpy( p_channel->psz_description, psz_str );
+                    }
                 }
-                break;                
-            case 2:                                            /* input method */
+                break;
+            case 2:                                          /* input method */
                 p_channel->i_input_method = strtol( psz_str, &psz_end, 0);
                 if( (*psz_str == '\0') || (*psz_end != '\0') )
                 {
                     i_field = -1;
                 }
-                break;                
-            case 3:                                            /* input source */
-                i_field_length = strlen( psz_str );                
+                break;
+            case 3:                                          /* input source */
+                i_field_length = strlen( psz_str );
                 if( i_field_length != 0 )
                 {
                     p_channel->psz_input_source = malloc( i_field_length + 1 );
                     if( p_channel->psz_input_source == NULL )
                     {
-                        intf_ErrMsg("error: %s\n", strerror( ENOMEM ));                        
-                        i_field = -1;                        
+                        intf_ErrMsg("error: %s\n", strerror( ENOMEM ));
+                        i_field = -1;
                     }
                     else
-                    {                        
-                        strcpy( p_channel->psz_input_source, psz_str );                        
-                    }                        
+                    {
+                        strcpy( p_channel->psz_input_source, psz_str );
+                    }
                 }
-                break;                
-            case 4:                                              /* input port */
+                break;
+            case 4:                                            /* input port */
                 p_channel->i_input_port = strtol( psz_str, &psz_end, 0);
                 if( (*psz_str == '\0') || (*psz_end != '\0') )
                 {
                     i_field = -1;
                 }
-                break;                                
-            case 5:                                              /* input vlan */
+                break;
+            case 5:                                            /* input vlan */
                 p_channel->i_channel = strtol( psz_str, &psz_end, 0);
                 if( (*psz_str == '\0') || (*psz_end != '\0') )
                 {
                     i_field = -1;
                 }
-                break;                
+                break;
                 /* ... following fields are ignored */
             }
 
             /* Set new beginning of field */
             psz_str = psz_index + 1;
         }
-    }      
+    }
 
     /* At least the first three fields must be parsed sucessfully for function
-     * success. Other parsing errors are returned using i_field = -1. */    
+     * success. Other parsing errors are returned using i_field = -1. */
     if( i_field < 3 )
     {
         /* Function fails. Free allocated strings */
         if( p_channel->psz_description != NULL )
         {
-            free( p_channel->psz_description );            
+            free( p_channel->psz_description );
         }
         if( p_channel->psz_input_source != NULL )
         {
-            free( p_channel->psz_input_source );            
-        }                
-        return( 1 );        
+            free( p_channel->psz_input_source );
+        }
+        return( 1 );
     }
 
     /* Return success */
-    return( 0 );    
+    return( 0 );
 }
index 713b34ac7bfe192126503a3ff4ac5b382c3758a4..661398bab74fad1c58ddcc5e0abcbd9ef2e69f93 100644 (file)
@@ -1,20 +1,20 @@
-/******************************************************************************
+/*****************************************************************************
  * intf_3dfx.c: 3dfx interface
  * (c)2000 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <signal.h>
 #include <stdio.h> /* stderr */
 #include <stdlib.h>
 #include <string.h>
 #include <termios.h>
-#include <unistd.h>                                                /* close() */
-#include <sys/uio.h>                                           /* for input.h */
-#include <linutil.h>                             /* Glide kbhit() and getch() */
+#include <unistd.h>                                               /* close() */
+#include <sys/uio.h>                                          /* for input.h */
+#include <linutil.h>                            /* Glide kbhit() and getch() */
 
 #include <sys/types.h>              /* open() */
 #include <sys/stat.h>
 #include "interface.h"
 #include "main.h"
 
-/******************************************************************************
+/*****************************************************************************
  * intf_sys_t: description and status of 3dfx interface
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct intf_sys_s
 {
-   
+
 } intf_sys_t;
 
-/******************************************************************************
+/*****************************************************************************
  * intf_SysCreate: initialize 3dfx interface
- ******************************************************************************/
+ *****************************************************************************/
 int intf_SysCreate( intf_thread_t *p_intf )
 {
     /* Allocate instance and initialize some members */
@@ -67,9 +67,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * intf_SysDestroy: destroy 3dfx interface
- ******************************************************************************/
+ *****************************************************************************/
 void intf_SysDestroy( intf_thread_t *p_intf )
 {
     /* Close input thread, if any (blocking) */
@@ -89,9 +89,9 @@ void intf_SysDestroy( intf_thread_t *p_intf )
 }
 
 
-/******************************************************************************
+/*****************************************************************************
  * intf_SysManage: event loop
- ******************************************************************************/
+ *****************************************************************************/
 void intf_SysManage( intf_thread_t *p_intf )
 {
     unsigned int buf;
index c35380d8e1e9f5358ff6f988bfd96d4ac72e3356..d2e0723f126738688cdd92b0a2319a7fa0724c0e 100644 (file)
@@ -1,15 +1,15 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_cmd.c: interface commands parsing and executions functions
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This file implements the interface commands execution functions. It is used
  * by command-line oriented interfaces and scripts. The commands themselves are
  * implemented in intf_ctrl.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
  * Local prototypes
  */
 static int  ParseCommandArguments   ( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd );
-static int  CheckCommandArguments   ( intf_arg_t argv[INTF_MAX_ARGS], int i_argc, 
+static int  CheckCommandArguments   ( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                                       char *psz_argv[INTF_MAX_ARGS], char *psz_format );
 static void ParseFormatString       ( intf_arg_t format[INTF_MAX_ARGS], char *psz_format );
 static int  ConvertArgument         ( intf_arg_t *p_arg, int i_flags, char *psz_str );
 
-/*******************************************************************************
- * intf_ExecCommand: parse and execute a command               
- *******************************************************************************
+/*****************************************************************************
+ * intf_ExecCommand: parse and execute a command
+ *****************************************************************************
  * This function is called when a command needs to be executed. It parse the
  * command line, build an argument array, find the command in control commands
  * array and run the command. It returns the return value of the command, or
- * EINVAL if no command could be executed. Command line is modified by this 
+ * EINVAL if no command could be executed. Command line is modified by this
  * function.
  * Note that this function may terminate abruptly the program or signify it's
  * end to the interface thread.
- *******************************************************************************/
+ *****************************************************************************/
 int intf_ExecCommand( char *psz_cmd )
 {
-    char *          psz_argv[INTF_MAX_ARGS];             /* arguments pointers */
-    intf_arg_t      argv[INTF_MAX_ARGS];                /* converted arguments */
-    int             i_argc;                             /* number of arguments */
-    int             i_index;                           /* multi-purposes index */
-    int             i_return;                          /* command return value */
+    char *          psz_argv[INTF_MAX_ARGS];           /* arguments pointers */
+    intf_arg_t      argv[INTF_MAX_ARGS];              /* converted arguments */
+    int             i_argc;                           /* number of arguments */
+    int             i_index;                         /* multi-purposes index */
+    int             i_return;                        /* command return value */
 
     intf_DbgMsg("command `%s'\n", psz_cmd);
 
-    /* Parse command line (separate arguments). If nothing has been found, 
+    /* Parse command line (separate arguments). If nothing has been found,
      * the function returns without error */
     i_argc = ParseCommandArguments( psz_argv, psz_cmd );
     if( !i_argc )
@@ -65,13 +65,13 @@ int intf_ExecCommand( char *psz_cmd )
     }
 
     /* Find command. Command is always the first token on the line */
-    for( i_index = 0; 
-         control_command[i_index].psz_name && strcmp( psz_argv[0], control_command[i_index].psz_name ); 
+    for( i_index = 0;
+         control_command[i_index].psz_name && strcmp( psz_argv[0], control_command[i_index].psz_name );
          i_index++ )
     {
         ;
     }
-    if( !control_command[i_index].psz_name )                /* unknown command */
+    if( !control_command[i_index].psz_name )              /* unknown command */
     {
         /* Print error message */
         intf_IntfMsg( "error: unknown command `%s'. Try `help'", psz_argv[0] );
@@ -81,25 +81,25 @@ int intf_ExecCommand( char *psz_cmd )
     /* Check arguments validity */
     if( CheckCommandArguments( argv, i_argc, psz_argv, control_command[i_index].psz_format ) )
     {
-        /* The given arguments does not match the format string. An error message has 
+        /* The given arguments does not match the format string. An error message has
          * already been displayed, so only the usage string is printed */
         intf_IntfMsg( "usage: %s", control_command[i_index].psz_usage );
         return( INTF_USAGE_ERROR );
     }
 
-    /* Execute command */    
+    /* Execute command */
     i_return = control_command[i_index].function( i_argc, argv );
 
     /* Manage special error codes */
     switch( i_return )
     {
-    case INTF_FATAL_ERROR:                                      /* fatal error */
+    case INTF_FATAL_ERROR:                                    /* fatal error */
         /* Print message and terminates the interface thread */
         intf_ErrMsg( "fatal error in command `%s'\n", psz_argv[0] );
         p_main->p_intf->b_die = 1;
         break;
 
-    case INTF_CRITICAL_ERROR:                                /* critical error */
+    case INTF_CRITICAL_ERROR:                              /* critical error */
         /* 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... */
@@ -108,7 +108,7 @@ int intf_ExecCommand( char *psz_cmd )
         exit( INTF_CRITICAL_ERROR );
         break;
 
-    case INTF_USAGE_ERROR:                                      /* usage error */
+    case INTF_USAGE_ERROR:                                    /* usage error */
         /* Print error message and usage */
         intf_IntfMsg( "usage: %s", control_command[i_index].psz_usage );
         break;
@@ -118,57 +118,57 @@ int intf_ExecCommand( char *psz_cmd )
     return( i_return );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ExecScript: parse and execute a command script
- *******************************************************************************
+ *****************************************************************************
  * This function, based on ExecCommand read a file and tries to execute each
  * of its line as a command. It returns 0 if everything succeeded, a negative
  * number if the script could not be executed and a positive one if an error
  * occured during execution.
- *******************************************************************************/
+ *****************************************************************************/
 int intf_ExecScript( char *psz_filename )
 {
-    FILE *  p_file;                                                    /* file */
-    char    psz_line[INTF_MAX_CMD_SIZE];                               /* line */
-    char *  psz_index;                                      /* index in string */
-    int     i_err;                                          /* error indicator */    
-    
+    FILE *  p_file;                                                  /* file */
+    char    psz_line[INTF_MAX_CMD_SIZE];                             /* line */
+    char *  psz_index;                                    /* index in string */
+    int     i_err;                                        /* error indicator */
+
     /* Open file */
-    i_err = 0;    
+    i_err = 0;
     p_file = fopen( psz_filename, "r" );
     if( p_file == NULL )
     {
         intf_ErrMsg("warning: %s: %s\n", psz_filename, strerror(errno));
-        return( -1 );        
+        return( -1 );
     }
-    
-    /* For each line: read and execute */    
+
+    /* For each line: read and execute */
     while( fgets( psz_line, INTF_MAX_CMD_SIZE, p_file ) != NULL )
     {
         /* If line begins with a '#', it is a comment and shoule be ignored,
          * else, execute it */
         if( psz_line[0] != '#' )
-        {            
+        {
             /* The final '\n' needs to be removed before execution */
             for( psz_index = psz_line; *psz_index && (*psz_index != '\n'); psz_index++ )
-            {                
-                ;                
+            {
+                ;
             }
             if( *psz_index == '\n' )
             {
-                *psz_index = '\0';                
-            }            
+                *psz_index = '\0';
+            }
 
             /* Execute command */
-            i_err |= intf_ExecCommand( psz_line );    
-        }                
+            i_err |= intf_ExecCommand( psz_line );
+        }
     }
     if( !feof( p_file ) )
     {
         intf_ErrMsg("error: %s: %s\n", psz_filename, strerror(errno));
-        return( -1 );        
+        return( -1 );
     }
-    
+
     /* Close file */
     fclose( p_file );
     return( i_err != 0 );
@@ -176,21 +176,21 @@ int intf_ExecScript( char *psz_filename )
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * ParseCommandArguments: isolate arguments in a command line
- *******************************************************************************
+ *****************************************************************************
  * This function modify the original command line, adding '\0' and completes
  * an array of pointers to beginning of arguments. It return the number of
  * arguments.
- *******************************************************************************/
+ *****************************************************************************/
 static int ParseCommandArguments( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd )
 {
-    int         i_argc;                                 /* number of arguments */
-    char *      psz_index;                                            /* index */
-    boolean_t   b_block;                         /* block (argument) indicator */
+    int         i_argc;                               /* number of arguments */
+    char *      psz_index;                                          /* index */
+    boolean_t   b_block;                       /* block (argument) indicator */
 
     /* Initialize parser state */
-    b_block = 0;     /* we start outside a block to remove spaces at beginning */
+    b_block = 0;   /* we start outside a block to remove spaces at beginning */
     i_argc = 0;
 
     /* Go through command until end has been reached or maximal number of
@@ -202,10 +202,10 @@ static int ParseCommandArguments( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd )
         {
             if( *psz_index == ' ' )
             {
-                *psz_index = '\0';                 /* mark the end of argument */
-                b_block = 0;                                 /* exit the block */
+                *psz_index = '\0';               /* mark the end of argument */
+                b_block = 0;                               /* exit the block */
             }
-            
+
         }
         /* Outside a block, beginning of blocks are marked by any character
          * different from space */
@@ -213,8 +213,8 @@ static int ParseCommandArguments( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd )
         {
             if( *psz_index != ' ' )
             {
-                psz_argv[i_argc++] = psz_index;              /* store argument */
-                b_block = 1;                                /* enter the block */            
+                psz_argv[i_argc++] = psz_index;            /* store argument */
+                b_block = 1;                              /* enter the block */
             }
         }
     }
@@ -223,33 +223,33 @@ static int ParseCommandArguments( char *psz_argv[INTF_MAX_ARGS], char *psz_cmd )
     return( i_argc );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * CheckCommandArguments: check arguments agains format
- *******************************************************************************
+ *****************************************************************************
  * This function parse each argument and tries to find a match in the format
  * string. It fills the argv array.
  * If all arguments have been sucessfuly identified and converted, it returns
  * 0, else, an error message is issued and non 0 is returned.
  * Note that no memory is allocated by this function, but that the arguments
  * can be modified.
- *******************************************************************************/
-static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc, 
+ *****************************************************************************/
+static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                                   char *psz_argv[INTF_MAX_ARGS], char *psz_format )
 {
-    intf_arg_t  format[INTF_MAX_ARGS];             /* parsed format indicators */
-    int         i_arg;                                       /* argument index */
-    int         i_format;                                      /* format index */    
-    char *      psz_index;                                     /* string index */
-    char *      psz_cmp_index;                     /* string comparaison index */
-    int         i_index;                                      /* generic index */    
-    boolean_t   b_found;                              /* `argument found' flag */
+    intf_arg_t  format[INTF_MAX_ARGS];           /* parsed format indicators */
+    int         i_arg;                                     /* argument index */
+    int         i_format;                                    /* format index */
+    char *      psz_index;                                   /* string index */
+    char *      psz_cmp_index;                   /* string comparaison index */
+    int         i_index;                                    /* generic index */
+    boolean_t   b_found;                            /* `argument found' flag */
 
 
     /* Build format array */
     ParseFormatString( format, psz_format );
 
     /* Initialize parser: i_format must be the first non named formatter */
-    for( i_format = 0; ( i_format < INTF_MAX_ARGS ) 
+    for( i_format = 0; ( i_format < INTF_MAX_ARGS )
              && (format[i_format].i_flags & INTF_NAMED_ARG);
          i_format++ )
     {
@@ -263,32 +263,32 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
 
         /* Test if argument can be taken as a named argument: try to find a
          * '=' in the string */
-        for( psz_index = psz_argv[i_arg]; *psz_index && ( *psz_index != '=' ); psz_index++ ) 
+        for( psz_index = psz_argv[i_arg]; *psz_index && ( *psz_index != '=' ); psz_index++ )
         {
             ;
         }
-        if( *psz_index == '=' )                                   /* '=' found */
+        if( *psz_index == '=' )                                 /* '=' found */
         {
             /* Browse all named arguments to check if there is one matching */
-            for( i_index = 0; (i_index < INTF_MAX_ARGS) 
+            for( i_index = 0; (i_index < INTF_MAX_ARGS)
                      && ( format[i_index].i_flags & INTF_NAMED_ARG )
                      && !b_found;
                  i_index++ )
             {
-                /* Current format string is named... compare start of two 
+                /* Current format string is named... compare start of two
                  * names. A local inline ntation of a strcmp is used since
                  * string isn't ended by '\0' but by '=' */
-                for( psz_index = psz_argv[i_arg], psz_cmp_index = format[i_index].ps_name; 
+                for( psz_index = psz_argv[i_arg], psz_cmp_index = format[i_index].ps_name;
                      (*psz_index == *psz_cmp_index) && (*psz_index != '=') && (*psz_cmp_index != '=');
                      psz_index++, psz_cmp_index++ )
                 {
                     ;
                 }
-                if( *psz_index == *psz_cmp_index )          /* the names match */
+                if( *psz_index == *psz_cmp_index )        /* the names match */
                 {
                     /* The argument is a named argument which name match the
                      * named argument i_index. To be valid, the argument should
-                     * not have been already encountered and the type must 
+                     * not have been already encountered and the type must
                      * match. Before going further, the '=' is replaced by
                      * a '\0'. */
                     *psz_index = '\0';
@@ -306,7 +306,7 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                     format[i_index].i_flags |= INTF_PRESENT_ARG;
                     argv[i_arg].i_flags = INTF_NAMED_ARG;
                     argv[i_arg].i_index = i_index;
-                    argv[i_arg].ps_name = psz_argv[i_arg];                    
+                    argv[i_arg].ps_name = psz_argv[i_arg];
 
                     /* Check type and store value */
                     psz_index++;
@@ -317,7 +317,7 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                     }
                 }
             }
-        }  
+        }
 
         /* If argument is not a named argument, the format string will
          * be browsed starting from last position until the argument is
@@ -329,12 +329,12 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
 
             /* If argument is not a named argument, the format string will
              * be browsed starting from last position until the argument is
-             * found, an error occurs or the last format argument is 
+             * found, an error occurs or the last format argument is
              * reached */
             while( !b_found && (i_format < INTF_MAX_ARGS) && format[i_format].i_flags )
             {
                 /* Try to convert argument */
-                if( !ConvertArgument( &argv[i_arg], format[i_format].i_flags, psz_argv[i_arg] ) ) 
+                if( !ConvertArgument( &argv[i_arg], format[i_format].i_flags, psz_argv[i_arg] ) )
                 {
                     /* Matching format has been found */
                     b_found = 1;
@@ -350,9 +350,9 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
                 else
                 {
                     /* Argument does not match format. This can be an error, or
-                     * just a missing optionnal parameter, or the end of a 
-                     * repeated argument */                       
-                    if( (format[i_format].i_flags & INTF_OPT_ARG) 
+                     * just a missing optionnal parameter, or the end of a
+                     * repeated argument */
+                    if( (format[i_format].i_flags & INTF_OPT_ARG)
                         || (format[i_format].i_flags & INTF_PRESENT_ARG) )
                     {
                         /* This is not an error */
@@ -399,32 +399,32 @@ static int CheckCommandArguments( intf_arg_t argv[INTF_MAX_ARGS], int i_argc,
             return( 1 );
         }
     }
-    
+
     /* If an error occured, the function already exited, so if this point is
      * reached, everything is fine */
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * ConvertArgument: try to convert an argument to a given type
- *******************************************************************************
+ *****************************************************************************
  * This function tries to convert the string argument given in psz_str to
  * a type specified in i_flags. It updates p_arg and returns O on success,
  * or 1 on error. No error message is issued.
- *******************************************************************************/
+ *****************************************************************************/
 static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
 {
-    char *psz_end;                     /* end pointer for conversion functions */
+    char *psz_end;                   /* end pointer for conversion functions */
 
-    if( i_flags & INTF_STR_ARG )                                     /* string */
+    if( i_flags & INTF_STR_ARG )                                   /* string */
     {
         /* A conversion from a string to a string will always succeed... */
         p_arg->psz_str = psz_str;
         p_arg->i_flags |= INTF_STR_ARG;
     }
-    else if( i_flags & INTF_INT_ARG )                               /* integer */
-    {        
-        p_arg->i_num = strtol( psz_str, &psz_end, 0 );       /* convert string */
+    else if( i_flags & INTF_INT_ARG )                             /* integer */
+    {
+        p_arg->i_num = strtol( psz_str, &psz_end, 0 );     /* convert string */
         /* If the conversion failed, return 1 and do not modify argument
          * flags. Else, add 'int' flag and continue. */
         if( !*psz_str || *psz_end )
@@ -433,9 +433,9 @@ static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
         }
         p_arg->i_flags |= INTF_INT_ARG;
     }
-    else if( i_flags & INTF_FLOAT_ARG )                               /* float */
+    else if( i_flags & INTF_FLOAT_ARG )                             /* float */
     {
-        p_arg->f_num = strtod( psz_str, &psz_end );          /* convert string */
+        p_arg->f_num = strtod( psz_str, &psz_end );        /* convert string */
         /* If the conversion failed, return 1 and do not modify argument
          * flags. Else, add 'float' flag and continue. */
         if( !*psz_str || *psz_end )
@@ -445,7 +445,7 @@ static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
         p_arg->i_flags |= INTF_FLOAT_ARG;
     }
 #ifdef DEBUG
-    else                                      /* error: missing type specifier */
+    else                                    /* error: missing type specifier */
     {
         intf_ErrMsg("error: missing type specifier for `%s' (0x%x)\n", psz_str, i_flags);
         return( 1 );
@@ -455,9 +455,9 @@ static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * ParseFormatString: parse a format string                              (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function read a format string, as specified in the control_command
  * array, and fill a format array, to allow easier argument identification.
  * Note that no memory is allocated by this function, but that, in a named
@@ -466,17 +466,17 @@ static int ConvertArgument( intf_arg_t *p_arg, int i_flags, char *psz_str )
  * Note that this function is designed to be efficient, not to check everything
  * in a format string, which should be entered by a developper and therefore
  * should be correct (TRUST !).
- *******************************************************************************/
+ *****************************************************************************/
 static void ParseFormatString( intf_arg_t format[INTF_MAX_ARGS], char *psz_format )
 {
-    char *  psz_index;                                  /* format string index */
-    char *  psz_start;                                /* argument format start */
-    char *  psz_item;                                            /* item index */
-    int     i_index;                                           /* format index */
+    char *  psz_index;                                /* format string index */
+    char *  psz_start;                              /* argument format start */
+    char *  psz_item;                                          /* item index */
+    int     i_index;                                         /* format index */
 
     /* Initialize parser */
     i_index = 0;
-    psz_start = psz_format;      
+    psz_start = psz_format;
 
     /* Reset first format indicator */
     format[ 0 ].i_flags = 0;
@@ -486,47 +486,47 @@ static void ParseFormatString( intf_arg_t format[INTF_MAX_ARGS], char *psz_forma
     {
         /* A space is always an item terminator */
         if( *psz_index == ' ' )
-        {        
+        {
             /* Parse format item. Items are parsed from end to beginning or to
              * first '=' */
-            for( psz_item = psz_index - 1; 
-                 (psz_item >= psz_start) && !( format[i_index].i_flags & INTF_NAMED_ARG); 
+            for( psz_item = psz_index - 1;
+                 (psz_item >= psz_start) && !( format[i_index].i_flags & INTF_NAMED_ARG);
                  psz_item-- )
             {
                 switch( *psz_item )
                 {
-                case 's':                                            /* string */
+                case 's':                                          /* string */
                     format[i_index].i_flags |= INTF_STR_ARG;
                     break;
-                case 'i':                                           /* integer */
+                case 'i':                                         /* integer */
                     format[i_index].i_flags |= INTF_INT_ARG;
                     break;
-                case 'f':                                             /* float */
+                case 'f':                                           /* float */
                     format[i_index].i_flags |= INTF_FLOAT_ARG;
                     break;
-                case '*':                                   /* can be repeated */
+                case '*':                                 /* can be repeated */
                     format[i_index].i_flags |= INTF_REP_ARG;
                     break;
-                case '?':                                /* optionnal argument */
+                case '?':                              /* optionnal argument */
                     format[i_index].i_flags |= INTF_OPT_ARG;
                     break;
-                case '=':                                     /* name argument */
+                case '=':                                   /* name argument */
                     format[i_index].i_flags |= INTF_NAMED_ARG;
-                    format[i_index].ps_name = psz_start;    
+                    format[i_index].ps_name = psz_start;
                     break;
 #ifdef DEBUG
-                default:  /* error which should never happen: incorrect format */
+                default:/* error which should never happen: incorrect format */
                     intf_DbgMsg("error: incorrect format string `%s'\n", psz_format);
                     break;
 #endif
                 }
             }
 
-            /* Mark next item start, increase items counter and reset next 
+            /* Mark next item start, increase items counter and reset next
              * format indicator, if it wasn't the last one. */
             i_index++;
-            psz_start = psz_index + 1;    
-            if( i_index != INTF_MAX_ARGS )         /* end of array not reached */
+            psz_start = psz_index + 1;
+            if( i_index != INTF_MAX_ARGS )       /* end of array not reached */
             {
                 format[ i_index ].i_flags = 0;
             }
index 9ad16005dfa2821f0f8d8bc7bc734f47e72fab16..03cf71381ec64151f8c8dfb55c078a5d700be54d 100644 (file)
@@ -1,38 +1,38 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_console.c: generic console for interface
  * (c)1998 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <stdlib.h>
 
 #include "config.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_console_t: console descriptor
- *******************************************************************************
+ *****************************************************************************
  * Generic console object. This object will have a representation depending of
  * the interface.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct intf_console_s
 {
     /* Text and history arrays - last line/command has indice 0 */
     char *                  psz_text[INTF_CONSOLE_MAX_TEXT];
-    char *                  psz_history[INTF_CONSOLE_MAX_HISTORY]; 
+    char *                  psz_history[INTF_CONSOLE_MAX_HISTORY];
 } intf_console_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Local prototypes
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ConsoleCreate: create console
- *******************************************************************************
+ *****************************************************************************
  * This function will initialize the console object.
  * It returns NULL on error.
- *******************************************************************************/
+ *****************************************************************************/
 intf_console_t *intf_ConsoleCreate( void )
 {
     intf_console_t *p_console;
@@ -41,42 +41,42 @@ intf_console_t *intf_ConsoleCreate( void )
     return( p_console );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ConsoleDestroy
- *******************************************************************************
+ *****************************************************************************
  * Destroy the console instance initialized by intf_ConsoleCreate.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_ConsoleDestroy( intf_console_t *p_console )
 {
     free( p_console );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ConsoleClear: clear console
- *******************************************************************************
+ *****************************************************************************
  * Empty all text.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_ConsoleClear( intf_console_t *p_console )
 {
     //??
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ConsolePrint: print a message to console
- *******************************************************************************
+ *****************************************************************************
  * Print a message to the console.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_ConsolePrint( intf_console_t *p_console, char *psz_str )
 {
     //??
 }
 
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ConsoleExec: execute a command in console
- *******************************************************************************
+ *****************************************************************************
  * This function will run a command and print its result in console.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_ConsoleExec( intf_console_t *p_console, char *psz_str )
 {
     //??
index e982e9eb575ca9ff995c2427e10b048ac65b8486..32abbd640a41d5d968d7dac1f35e4fa22bf821ed 100644 (file)
@@ -1,7 +1,7 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_ctrl.c: interface commands access to control functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Library of functions common to all interfaces, allowing access to various
  * structures and settings. Interfaces should only use those functions
  * to read or write informations from other threads.
  * error codes defined in command.h. Custom error codes are allowed, but should
  * be positive.
  * More informations about parameters stand in `list of commands' section.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include "vlc.h"
 #include <sys/stat.h>
 /*??#include <errno.h>
@@ -89,7 +89,7 @@ static int Psi                  ( int i_argc, intf_arg_t *p_argv );
 /*
  * List of commands.
  * This list is used by intf_ExecCommand function to find functions to
- * execute and prepare its arguments. It is terminated by an element  which name 
+ * execute and prepare its arguments. It is terminated by an element  which name
  * is a null pointer. intf_command_t is defined in command.h.
  *
  * Here is a description of a command description elements:
@@ -98,12 +98,12 @@ static int Psi                  ( int i_argc, intf_arg_t *p_argv );
  *  format is an argument descriptor (see below),
  *  summary is a text string displayed in regard of the command name when `help'
  *      is called without parameters, and whith usage on syntax error,
- *  usage is a short syntax indicator displayed with summary when the command 
+ *  usage is a short syntax indicator displayed with summary when the command
  *      causes a syntax error,
  *  help is a complete help about the command, displayed when `help' is called with
  *      the command name as parameter.
  *
- * Format string is a list of ' ' separated strings, which have following 
+ * Format string is a list of ' ' separated strings, which have following
  * meanings:
  *  s       string argument
  *  i       integer argument
@@ -111,68 +111,68 @@ static int Psi                  ( int i_argc, intf_arg_t *p_argv );
  *  ?       optionnal argument
  *  *       argument can be repeated
  *  name=   named argument
- * Example: "channel=i? s*? i " means that any number of string arguments, 
+ * Example: "channel=i? s*? i " means that any number of string arguments,
  * followed by a single mandatory integer argument are waited. A named argument,
  * which name is `channel' and must have an integer value can be optionnaly
  * specified at beginning. The last space is mandatory if there is at least one
  * element, since it acts as an item terminator.
  * Named arguments MUST be at the beginning of the format string, and in
- * alphabetic order, but their order on command line has no importance. 
+ * alphabetic order, but their order on command line has no importance.
  * The format string can't have more than INTF_MAX_ARGS elements.
  */
 const intf_command_t control_command[] =
 {
-  { "demo", Demo,                                                      /* demo */
-    /* format: */   "", 
-    /* summary: */  "program demonstration", 
-    /* usage: */    "demo", 
+  { "demo", Demo,                                                    /* demo */
+    /* format: */   "",
+    /* summary: */  "program demonstration",
+    /* usage: */    "demo",
     /* help: */     "Start program capabilities demonstration." },
-  { "display", DisplayImage,                                        /* display */
+  { "display", DisplayImage,                                      /* display */
     /* format: */   "s ",
     /* summary: */  "load and display an image",
     /* usage: */    "display <file>",
-    /* help: */     "Load and display an image. Image format is automatically " \
+    /* help: */     "Load and display an image. Image format is automatically "\
     "identified from file name extension." },
-  { "exec", Exec,                                                      /* exec */
+  { "exec", Exec,                                                    /* exec */
     /* format: */   "s ",
     /* summary: */  "execute a script file",
     /* usage: */    "exec <file>",
-    /* help: */     "Load an execute a script." },      
-  { "exit", Quit,                                         /* exit (quit alias) */
+    /* help: */     "Load an execute a script." },
+  { "exit", Quit,                                       /* exit (quit alias) */
     /* format: */   "",
     /* summary: */  "quit program",
     /* usage: */    "exit",
     /* help: */     "see `quit'." },
-  { "help", Help,                                                      /* help */
-    /* format: */   "s? ", 
-    /* summary: */  "list all functions or print help about a specific function", 
-    /* usage: */    "help [command]", 
+  { "help", Help,                                                    /* help */
+    /* format: */   "s? ",
+    /* summary: */  "list all functions or print help about a specific function",
+    /* usage: */    "help [command]",
     /* help: */     "If called without argument, list all available " \
-    " functions.\nIf a command name is provided as argument, displays a short " \
+    " functions.\nIf a command name is provided as argument, displays a short "\
     "inline help about the command.\n" },
-  { "play-audio", PlayAudio,                                     /* play-audio */
-    /* format: */   "stereo=i? rate=i? s ", 
+  { "play-audio", PlayAudio,                                   /* play-audio */
+    /* format: */   "stereo=i? rate=i? s ",
     /* summary: */  "play an audio file",
     /* usage: */    "play-audio [stereo=1/0] [rate=r] <file>",
     /* help: */     "Load and play an audio file." },
   { "play-video", PlayVideo,                                      /* play-video */
-    /* format: */   "s ", 
+    /* format: */   "s ",
     /* summary: */  "play a video (.vlp) file",
     /* usage: */    "play-video <file>",
     /* help: */     "Load and play a video file." },
-  { "quit", Quit,                                                      /* quit */
+  { "quit", Quit,                                                    /* quit */
     /* format: */   "",
     /* summary: */  "quit program",
     /* usage: */    "quit",
-    /* help: */     "Terminates the program execution... There is not much to" \
+    /* help: */     "Terminates the program execution... There is not much to"\
     " say about it !" },
-  { "select-pid", SelectPID,                                     /* select-pid */
+  { "select-pid", SelectPID,                                   /* select-pid */
     /* format: */   "i i ",
     /* summary: */  "spawn a decoder thread for a specified PID",
     /* summary: */  "select-pid <input> <pid>",
     /* help: */     "Spawn a decoder thread for <pid>. The stream will be" \
     " received by <input>." },
-  { "spawn-input", SpawnInput,                                  /* spawn-input */
+  { "spawn-input", SpawnInput,                                /* spawn-input */
     /* format: */   "method=i? filename=s? hostname=s? ip=s? port=i? vlan=i?",
     /* summary: */  "spawn an input thread",
     /* summary: */  "spawn-input [method=<method>]\n" \
@@ -181,12 +181,12 @@ const intf_command_t control_command[] =
     /* help: */     "Spawn an input thread. Method is 10, 20, 21, 22, 32, "\
     "hostname is the fully-qualified domain name, ip is a dotted-decimal address." },
 #ifdef DEBUG
-  { "test", Test,                                                      /* test */
+  { "test", Test,                                                    /* test */
     /* format: */   "i? ",
     /* summary: */  "crazy developper's test",
     /* usage: */    "depends on the last coder :-)",
     /* help: */     "`test' works only in DEBUG mode, and is provide for " \
-    "developpers as an easy way to test part of their code. If you don't know " \
+    "developpers as an easy way to test part of their code. If you don't know "\
     "what it should do, just try !" },
 #endif
   { "vlan", Vlan,
@@ -197,7 +197,7 @@ const intf_command_t control_command[] =
     "vlan [intf=<interface>] join <vlan>\n" \
     "vlan [intf=<interface>] leave",
     /* help: */     "Perform various operations on vlans. 'synchro' resynchronize " \
-    "with the server. 'request' ask which is the current vlan (for the default " \
+    "with the server. 'request' ask which is the current vlan (for the default "\
     "interface or for a given one). 'join' and 'leave' try to change vlan." },
   { "psi", Psi,
     /* format: */   "i ",
@@ -205,16 +205,16 @@ const intf_command_t control_command[] =
     /* usage: */    "psi <input thread index>",
     /* help: */     "Display the PSI tables on the console. Warning: this is debug" \
     "command, it can leads to pb since locks are not taken yet" },
-  { 0, 0, 0, 0, 0 }                                        /* array terminator */
+  { 0, 0, 0, 0, 0 }                                      /* array terminator */
 };
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * Demo: demo
- *******************************************************************************
- * This function is provided to display a demo of program possibilities. 
- *******************************************************************************/
+ *****************************************************************************
+ * This function is provided to display a demo of program possibilities.
+ *****************************************************************************/
 static int Demo( int i_argc, intf_arg_t *p_argv )
 {
     intf_IntfMsg( COPYRIGHT_MESSAGE );
@@ -222,45 +222,45 @@ static int Demo( int i_argc, intf_arg_t *p_argv )
     return( INTF_NO_ERROR );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Exec: execute a script
- *******************************************************************************
+ *****************************************************************************
  * This function load and execute a script.
- *******************************************************************************/
+ *****************************************************************************/
 static int Exec( int i_argc, intf_arg_t *p_argv )
 {
-    int i_err;                                                   /* error code */
-    
+    int i_err;                                                 /* error code */
+
     i_err = intf_ExecScript( p_argv[1].psz_str );
-    return( i_err ? INTF_OTHER_ERROR : INTF_NO_ERROR );     
+    return( i_err ? INTF_OTHER_ERROR : INTF_NO_ERROR );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * DisplayImage: load and display an image                               (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * Try to load an image identified by it's filename and displays it as a still
  * image using interface video heap.
- *******************************************************************************/
+ *****************************************************************************/
 static int DisplayImage( int i_argc, intf_arg_t *p_argv )
 {
     /* ?? */
     return( INTF_NO_ERROR );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Help: list all available commands                                     (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function print a list of available commands
- *******************************************************************************/
+ *****************************************************************************/
 static int Help( int i_argc, intf_arg_t *p_argv )
 {
-    int     i_index;                                          /* command index */
+    int     i_index;                                        /* command index */
 
-    /* If called with an argument: look for the command and display it's help */
+   /* If called with an argument: look for the command and display it's help */
     if( i_argc == 2 )
     {
 fprintf( stderr, "maxx debug: coin\n" );
-        for( i_index = 0; control_command[i_index].psz_name 
+        for( i_index = 0; control_command[i_index].psz_name
                  && strcmp( control_command[i_index].psz_name, p_argv[1].psz_str );
              i_index++ )
         {
@@ -288,7 +288,7 @@ fprintf( stderr, "maxx debug: blih\n" );
     {
         for( i_index = 0; control_command[i_index].psz_name; i_index++ )
         {
-            intf_IntfMsg( "%s: %s",  control_command[i_index].psz_name, 
+            intf_IntfMsg( "%s: %s",  control_command[i_index].psz_name,
                           control_command[i_index].psz_summary );
         }
     }
@@ -296,18 +296,18 @@ fprintf( stderr, "maxx debug: blih\n" );
     return( INTF_NO_ERROR );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * PlayAudio: play an audio file                                         (ok ?)
- ******************************************************************************
+ *****************************************************************************
  * Play a raw audio file from a file, at a given rate.
- ******************************************************************************/
+ *****************************************************************************/
 static int PlayAudio( int i_argc, intf_arg_t *p_argv )
 {
-    char * psz_file = NULL;               /* name of the audio raw file (s16) */
-    int i_fd;       /* file descriptor of the audio file that is to be loaded */
-    aout_fifo_t fifo;          /* fifo stores the informations about the file */
-    struct stat stat_buffer;       /* needed to find out the size of psz_file */
-    int i_arg;                                              /* argument index */
+    char * psz_file = NULL;              /* name of the audio raw file (s16) */
+    int i_fd;      /* file descriptor of the audio file that is to be loaded */
+    aout_fifo_t fifo;         /* fifo stores the informations about the file */
+    struct stat stat_buffer;      /* needed to find out the size of psz_file */
+    int i_arg;                                             /* argument index */
 
     if ( !p_main->b_audio )                  /* audio is disabled */
     {
@@ -325,13 +325,13 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
     {
         switch( p_argv[i_arg].i_index )
         {
-        case 0:                                                     /* stereo */
+        case 0:                                                    /* stereo */
             fifo.b_stereo = p_argv[i_arg].i_num;
             break;
-        case 1:                                                       /* rate */
+        case 1:                                                      /* rate */
             fifo.l_rate = p_argv[i_arg].i_num;
             break;
-        case 2:                                                   /* filename */
+        case 2:                                                  /* filename */
             psz_file = p_argv[i_arg].psz_str;
             break;
         }
@@ -355,7 +355,7 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
 
     /* Open file */
     i_fd =  open( psz_file, O_RDONLY );
-    if ( i_fd < 0 )                                                  /* error */
+    if ( i_fd < 0 )                                                 /* error */
     {
         intf_IntfMsg("play-audio error: can't open `%s'", psz_file);
         return( INTF_OTHER_ERROR );
@@ -369,7 +369,7 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
     if ( (fifo.buffer = malloc(sizeof(s16)*(fifo.l_units << fifo.b_stereo))) == NULL ) /* !! */
     {
         intf_IntfMsg("play-audio error: not enough memory to read `%s'", psz_file );
-        close( i_fd );                                          /* close file */
+        close( i_fd );                                         /* close file */
         return( INTF_OTHER_ERROR );
     }
     if ( read(i_fd, fifo.buffer, sizeof(s16)*(fifo.l_units << fifo.b_stereo))
@@ -382,7 +382,7 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
     }
     close( i_fd );
 
-    /* Now we can work out how many output units we can compute with the fifo */
+   /* Now we can work out how many output units we can compute with the fifo */
     fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->dsp.l_rate)/(s64)fifo.l_rate);
 
     /* Create the fifo */
@@ -396,22 +396,22 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
     return( INTF_NO_ERROR );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * PlayVideo: play a video sequence from a file
- *******************************************************************************
+ *****************************************************************************
  * ??
- *******************************************************************************/
+ *****************************************************************************/
 static int PlayVideo( int i_argc, intf_arg_t *p_argv )
 {
     /* ?? */
-    return( INTF_NO_ERROR );    
+    return( INTF_NO_ERROR );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Quit: quit program                                                    (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function set `die' flag of interface, asking the program to terminate.
- *******************************************************************************/
+ *****************************************************************************/
 static int Quit( int i_argc, intf_arg_t *p_argv )
 {
     p_main->p_intf->b_die = 1;
@@ -419,16 +419,16 @@ static int Quit( int i_argc, intf_arg_t *p_argv )
 }
 
 
-/******************************************************************************
+/*****************************************************************************
  *
- ******************************************************************************
+ *****************************************************************************
  *
- ******************************************************************************/
+ *****************************************************************************/
 static int SelectPID( int i_argc, intf_arg_t *p_argv )
 {
     int i_input = -1, i_pid = -1;
     int i_arg;
-  
+
     /* Parse parameters - see command list above */
     for ( i_arg = 1; i_arg < i_argc; i_arg++ )
     {
@@ -453,36 +453,36 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
 }
 
 
-/******************************************************************************
+/*****************************************************************************
  * SpawnInput: spawn an input thread                                     (ok ?)
- ******************************************************************************
+ *****************************************************************************
  * Spawn an input thread
- ******************************************************************************/
+ *****************************************************************************/
 static int SpawnInput( int i_argc, intf_arg_t *p_argv )
 {
     int                 i_arg;
-    int                 i_method = 0;                     /* method parameter */
-    char *              psz_source = NULL;                /* source parameter */
-    int                 i_port = 0;                         /* port parameter */
-    int                 i_vlan = 0;                         /* vlan parameter */
+    int                 i_method = 0;                    /* method parameter */
+    char *              psz_source = NULL;               /* source parameter */
+    int                 i_port = 0;                        /* port parameter */
+    int                 i_vlan = 0;                        /* vlan parameter */
 
     /* Parse parameters - see command list above */
     for ( i_arg = 1; i_arg < i_argc; i_arg++ )
     {
         switch( p_argv[i_arg].i_index )
         {
-        case 0:                                                     /* method */
+        case 0:                                                    /* method */
             i_method = p_argv[i_arg].i_num;
             break;
-        case 1:                                     /* filename, hostname, ip */
+        case 1:                                    /* filename, hostname, ip */
         case 2:
-        case 3:            
+        case 3:
             psz_source = p_argv[i_arg].psz_str;
             break;
-        case 4:                                                       /* port */
+        case 4:                                                      /* port */
             i_port = p_argv[i_arg].i_num;
             break;
-        case 5:                                                       /* VLAN */
+        case 5:                                                      /* VLAN */
             i_vlan = p_argv[i_arg].i_num;
             break;
         }
@@ -490,51 +490,51 @@ static int SpawnInput( int i_argc, intf_arg_t *p_argv )
 
     /* Destroy current input, if any */
     if( p_main->p_intf->p_input != NULL )
-    {        
+    {
         input_DestroyThread( p_main->p_intf->p_input, NULL );
     }
 
     p_main->p_intf->p_input = input_CreateThread( i_method, psz_source, i_port, i_vlan,
-                                                  p_main->p_intf->p_vout, p_main->p_aout, 
+                                                  p_main->p_intf->p_vout, p_main->p_aout,
                                                   NULL );
     return( INTF_NO_ERROR );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Test: test function
- *******************************************************************************
+ *****************************************************************************
  * This function is provided to test new functions in the program. Fell free
- * to modify ! 
+ * to modify !
  * This function is only defined in DEBUG mode.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 static int Test( int i_argc, intf_arg_t *p_argv )
 {
-    int i_thread;    
+    int i_thread;
 
 /*??    if( i_argc == 1 )
     {
         i_thread = intf_CreateVoutThread( &p_main->intf_thread, NULL, -1, -1);
-        intf_IntfMsg("return value: %d", i_thread );        
+        intf_IntfMsg("return value: %d", i_thread );
     }
     else*/
     {
-        i_thread = p_argv[1].i_num;        
-    //??    intf_DestroyVoutThread( &p_main->intf_thread, i_thread );        
-    }    
+        i_thread = p_argv[1].i_num;
+    //??    intf_DestroyVoutThread( &p_main->intf_thread, i_thread );
+    }
 
     return( INTF_NO_ERROR );
 }
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * Vlan: vlan operations
- *******************************************************************************
+ *****************************************************************************
  * This function performs various vlan operations.
- *******************************************************************************/
+ *****************************************************************************/
 static int Vlan( int i_argc, intf_arg_t *p_argv  )
 {
-    int i_command;                                  /* command argument number */
+    int i_command;                                /* command argument number */
 
     /* Do not try anything if vlans are desactivated */
     if( !p_main->b_vlans )
@@ -542,19 +542,19 @@ static int Vlan( int i_argc, intf_arg_t *p_argv  )
         intf_IntfMsg("vlans are desactivated");
         return( INTF_OTHER_ERROR );
     }
-    
+
     /* Look for command in list of arguments - this argument is mandatory and
      * imposed by the calling function */
     for( i_command = 1; p_argv[i_command].i_index == 1; i_command++ )
     {
-        ;        
+        ;
     }
-    
+
     /* Command is 'join' */
     if( !strcmp(p_argv[i_command].psz_str, "join") )
     {
         /* ?? */
-    }    
+    }
     /* Command is 'leave' */
     else if( !strcmp(p_argv[i_command].psz_str, "leave") )
     {
@@ -564,22 +564,22 @@ static int Vlan( int i_argc, intf_arg_t *p_argv  )
     else
     {
         intf_IntfMsg("vlan error: unknown command %s", p_argv[i_command].psz_str );
-        return( INTF_USAGE_ERROR );        
+        return( INTF_USAGE_ERROR );
     }
-         
+
     return( INTF_NO_ERROR );
 }
 
 
-/*******************************************************************************
+/*****************************************************************************
  * Psi
- *******************************************************************************
- * This function is provided to display PSI tables. 
- *******************************************************************************/
+ *****************************************************************************
+ * This function is provided to display PSI tables.
+ *****************************************************************************/
 static int Psi( int i_argc, intf_arg_t *p_argv )
 {
     int i_index = p_argv[1].i_num;
-  
+
     intf_IntfMsg("Reading PSI table for input %d\n", i_index);
 //????    input_PsiRead(p_main->p_intf->p_x11->p_input );
     return( INTF_NO_ERROR );
index 5269c6371cd39753ead50f28593b905b47381502..da593aab9733c9031a2b5642e147a869e010ef7b 100644 (file)
@@ -1,14 +1,14 @@
-/*******************************************************************************
+/*****************************************************************************
  * intf_msg.c: messages interface
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This library provides basic functions for threads to interact with user
  * interface, such as message output. See config.h for output configuration.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include "intf_console.h"
 #include "main.h"
 
-/*******************************************************************************
- * intf_msg_item_t                                             
- *******************************************************************************
+/*****************************************************************************
+ * intf_msg_item_t
+ *****************************************************************************
  * Store a single message. Messages have a maximal size of INTF_MSG_MSGSIZE.
  * If DEBUG is defined, messages have a date field and debug messages are
  * printed with a date to allow more precise profiling.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct
 {
-    int     i_type;                                 /* message type, see below */
-    char *  psz_msg;                                     /* the message itself */
+    int     i_type;                               /* message type, see below */
+    char *  psz_msg;                                   /* the message itself */
 
 #ifdef DEBUG
-    /* Debugging informations - in DEBUG mode, debug messages have calling 
+    /* Debugging informations - in DEBUG mode, debug messages have calling
      * location informations printed */
-    mtime_t date;                                       /* date of the message */
-    char *  psz_file;                 /* file in which the function was called */
-    char *  psz_function;       /* function from which the function was called */
-    int     i_line;                   /* line at which the function was called */
+    mtime_t date;                                     /* date of the message */
+    char *  psz_file;               /* file in which the function was called */
+    char *  psz_function;     /* function from which the function was called */
+    int     i_line;                 /* line at which the function was called */
 #endif
 } intf_msg_item_t;
 
 /* Message types */
-#define INTF_MSG_STD    0                                  /* standard message */
-#define INTF_MSG_ERR    1                                     /* error message */
-#define INTF_MSG_INTF   2                                 /* interface message */
-#define INTF_MSG_DBG    3                                     /* debug message */
-
-/*******************************************************************************
- * intf_msg_t                                                    
- *******************************************************************************
+#define INTF_MSG_STD    0                                /* standard message */
+#define INTF_MSG_ERR    1                                   /* error message */
+#define INTF_MSG_INTF   2                               /* interface message */
+#define INTF_MSG_DBG    3                                   /* debug message */
+
+/*****************************************************************************
+ * intf_msg_t
+ *****************************************************************************
  * Store all data requiered by messages interfaces. It has a single reference
  * int p_main.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct intf_msg_s
 {
 #ifdef INTF_MSG_QUEUE
     /* Message queue */
-    vlc_mutex_t             lock;                        /* message queue lock */
-    int                     i_count;              /* number of messages stored */
-    intf_msg_item_t         msg[INTF_MSG_QSIZE];              /* message queue */
+    vlc_mutex_t             lock;                      /* message queue lock */
+    int                     i_count;            /* number of messages stored */
+    intf_msg_item_t         msg[INTF_MSG_QSIZE];            /* message queue */
 #endif
 
 #ifdef DEBUG_LOG
     /* Log file */
-    int                     i_log_file;                            /* log file */
+    int                     i_log_file;                          /* log file */
 #endif
 
 #if !defined(INTF_MSG_QUEUE) && !defined(DEBUG_LOG)
     /* If neither messages queue, neither log file is used, then the structure
      * is empty. However, empty structures are not allowed in C. Therefore, a
      * dummy integer is used to fill it. */
-    int                     i_dummy;                          /* unused filler */
+    int                     i_dummy;                        /* unused filler */
 #endif
 } intf_msg_t;
 
@@ -86,12 +86,12 @@ typedef struct intf_msg_s
  * Local prototypes
  *****************************************************************************/
 
-static void QueueMsg        ( intf_msg_t *p_msg, int i_type, 
+static void QueueMsg        ( intf_msg_t *p_msg, int i_type,
                              char *psz_format, va_list ap );
 static void PrintMsg        ( intf_msg_item_t *p_msg );
 #ifdef DEBUG
-static void QueueDbgMsg     ( intf_msg_t *p_msg, char *psz_file, 
-                              char *psz_function, int i_line, 
+static void QueueDbgMsg     ( intf_msg_t *p_msg, char *psz_file,
+                              char *psz_function, int i_line,
                               char *psz_format, va_list ap );
 #endif
 #ifdef INTF_MSG_QUEUE
@@ -99,18 +99,18 @@ static void FlushLockedMsg  ( intf_msg_t *p_msg );
 #endif
 
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_MsgCreate: initialize messages interface                            (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This functions has to be called before any call to other intf_*Msg functions.
  * It set up the locks and the message queue if it is used.
- *******************************************************************************/
+ *****************************************************************************/
 p_intf_msg_t intf_MsgCreate( void )
 {
     p_intf_msg_t p_msg;
 
     /* Allocate structure */
-    p_msg = malloc( sizeof( intf_msg_t ) );  
+    p_msg = malloc( sizeof( intf_msg_t ) );
     if( p_msg == NULL )
     {
        errno = ENOMEM;
@@ -119,15 +119,15 @@ p_intf_msg_t intf_MsgCreate( void )
     {
 #ifdef INTF_MSG_QUEUE
     /* Message queue initialization */
-    vlc_mutex_init( &p_msg->lock );                          /* intialize lock */
-    p_msg->i_count = 0;                                      /* queue is empty */
+    vlc_mutex_init( &p_msg->lock );                        /* intialize lock */
+    p_msg->i_count = 0;                                    /* queue is empty */
 #endif
 
 #ifdef DEBUG_LOG
        /* Log file initialization - on failure, file pointer will be null,
-        * and no log will be issued, but this is not considered as an 
+        * and no log will be issued, but this is not considered as an
         * error */
-       p_msg->i_log_file = open( DEBUG_LOG, 
+       p_msg->i_log_file = open( DEBUG_LOG,
                                   O_CREAT | O_TRUNC | O_SYNC | O_WRONLY,
                                   0666 );
 #endif
@@ -135,16 +135,16 @@ p_intf_msg_t intf_MsgCreate( void )
     return( p_msg );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_MsgDestroy: free resources allocated by intf_InitMsg            (ok ?)
- *******************************************************************************
- * This functions prints all messages remaining in queue, then free all the 
+ *****************************************************************************
+ * This functions prints all messages remaining in queue, then free all the
  * resources allocated by intf_InitMsg.
  * No other messages interface functions should be called after this one.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_MsgDestroy( void )
 {
-    intf_FlushMsg();                           /* print all remaining messages */
+    intf_FlushMsg();                         /* print all remaining messages */
 
 #ifdef DEBUG_LOG
     /* Close log file if any */
@@ -158,12 +158,12 @@ void intf_MsgDestroy( void )
     free( p_main->p_msg );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_Msg: print a message                                              (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function queue a message for later printing, or print it immediately
  * if the queue isn't used.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_Msg( char *psz_format, ... )
 {
     va_list ap;
@@ -172,13 +172,13 @@ void intf_Msg( char *psz_format, ... )
     QueueMsg( p_main->p_msg, INTF_MSG_STD, psz_format, ap );
     va_end( ap );
 }
-/*******************************************************************************
+
+/*****************************************************************************
  * intf_ErrMsg : print an error message                                   (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function is the same as intf_Msg, except that it prints its messages
  * on stderr.
- *******************************************************************************/ 
+ *****************************************************************************/
 void intf_ErrMsg( char *psz_format, ...)
 {
     va_list ap;
@@ -188,17 +188,17 @@ void intf_ErrMsg( char *psz_format, ...)
     va_end( ap );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_IntfMsg : print an interface message                              (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * In opposition to all other intf_*Msg function, this function does not print
- * it's message on default terminal (stdout or stderr), but send it to 
+ * it's message on default terminal (stdout or stderr), but send it to
  * interface (in fact to the X11 console). This means that the interface MUST
  * be initialized and a X11 console openned before this function is used, and
  * that once the console is closed, this call is vorbidden.
- * Practically, only the interface thread itself should call this function, and 
+ * Practically, only the interface thread itself should call this function, and
  * flush all messages before intf_CloseX11Console() is called.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_IntfMsg(char *psz_format, ...)
 {
     va_list ap;
@@ -208,33 +208,33 @@ void intf_IntfMsg(char *psz_format, ...)
     va_end( ap );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * _intf_DbgMsg: print a debugging message                                (ok ?)
- *******************************************************************************
- * This function prints a debugging message. Compared to other intf_*Msg 
+ *****************************************************************************
+ * This function prints a debugging message. Compared to other intf_*Msg
  * functions, it is only defined if DEBUG is defined and require a file name,
  * a function name and a line number as additionnal debugging informations. It
  * also prints a debugging header for each received line.
- *******************************************************************************/ 
+ *****************************************************************************/
 #ifdef DEBUG
-void _intf_DbgMsg( char *psz_file, char *psz_function, int i_line, 
+void _intf_DbgMsg( char *psz_file, char *psz_function, int i_line,
                    char *psz_format, ...)
 {
     va_list ap;
 
     va_start( ap, psz_format );
-    QueueDbgMsg( p_main->p_msg, psz_file, psz_function, i_line, 
+    QueueDbgMsg( p_main->p_msg, psz_file, psz_function, i_line,
                  psz_format, ap );
     va_end( ap );
 }
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_ErrMsgImm: print a message                                        (ok ?)
- *******************************************************************************
- * This function prints a message immediately. If the queue is used, all 
+ *****************************************************************************
+ * This function prints a message immediately. If the queue is used, all
  * waiting messages are also printed.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_MsgImm( char *psz_format, ... )
 {
     va_list ap;
@@ -244,13 +244,13 @@ void intf_MsgImm( char *psz_format, ... )
     va_end( ap );
     intf_FlushMsg();
 }
-/*******************************************************************************
+
+/*****************************************************************************
  * intf_ErrMsgImm: print an error message immediately                     (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function is the same as intf_MsgImm, except that it prints its message
  * on stderr.
- *******************************************************************************/
+ *****************************************************************************/
 void intf_ErrMsgImm(char *psz_format, ...)
 {
     va_list ap;
@@ -261,127 +261,127 @@ void intf_ErrMsgImm(char *psz_format, ...)
     intf_FlushMsg();
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * _intf_DbgMsgImm: print a debugging message immediately                 (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * This function is the same as intf_DbgMsgImm, except that it prints its
- * message immediately. It should only be called through the macro 
+ * message immediately. It should only be called through the macro
  * intf_DbgMsgImm().
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
-void _intf_DbgMsgImm( char *psz_file, char *psz_function, int i_line, 
+void _intf_DbgMsgImm( char *psz_file, char *psz_function, int i_line,
                       char *psz_format, ...)
 {
     va_list ap;
 
     va_start( ap, psz_format );
-    QueueDbgMsg( p_main->p_msg, psz_file, psz_function, i_line, 
+    QueueDbgMsg( p_main->p_msg, psz_file, psz_function, i_line,
                  psz_format, ap );
     va_end( ap );
     intf_FlushMsg();
 }
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * intf_FlushMsg                                                          (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * Print all messages remaining in queue: get lock and call FlushLockedMsg.
  * This function does nothing if the message queue isn't used.
  * This function is only implemented if message queue is used. If not, it is an
  * empty macro.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef INTF_MSG_QUEUE
 void intf_FlushMsg( void )
 {
-    vlc_mutex_lock( &p_main->p_msg->lock );                        /* get lock */
-    FlushLockedMsg( p_main->p_msg );                         /* flush messages */
-    vlc_mutex_unlock( &p_main->p_msg->lock );                /* give lock back */
+    vlc_mutex_lock( &p_main->p_msg->lock );                      /* get lock */
+    FlushLockedMsg( p_main->p_msg );                       /* flush messages */
+    vlc_mutex_unlock( &p_main->p_msg->lock );              /* give lock back */
 }
 #endif
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * QueueMsg: add a message to a queue
- *******************************************************************************
+ *****************************************************************************
  * This function provide basic functionnalities to other intf_*Msg functions.
  * It add a message to a queue (after having printed all stored messages if it
- * is full. If the message can't be converted to string in memory, it exit the  
+ * is full. If the message can't be converted to string in memory, it exit the
  * program. If the queue is not used, it prints the message immediately.
- *******************************************************************************/
+ *****************************************************************************/
 static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list ap )
 {
-    char *                  psz_str;               /* formatted message string */
-    intf_msg_item_t *       p_msg_item;                  /* pointer to message */
+    char *                  psz_str;             /* formatted message string */
+    intf_msg_item_t *       p_msg_item;                /* pointer to message */
 
 #ifndef INTF_MSG_QUEUE /*..................................... instant mode ...*/
-    intf_msg_item_t         msg_item;                               /* message */
+    intf_msg_item_t         msg_item;                             /* message */
     p_msg_item =           &msg_item;
 #endif /*......................................................................*/
 
-    /* 
-     * Convert message to string 
-     */   
+    /*
+     * Convert message to string
+     */
     vasprintf( &psz_str, psz_format, ap );
     if( psz_str == NULL )
     {
-        fprintf(stderr, "warning: can't store following message (%s): ", 
+        fprintf(stderr, "warning: can't store following message (%s): ",
                 strerror(errno) );
         vfprintf(stderr, psz_format, ap );
         exit( errno );
     }
 
 #ifdef INTF_MSG_QUEUE /*........................................ queue mode ...*/
-    vlc_mutex_lock( &p_msg->lock );                            /* get lock */    
-    if( p_msg->i_count == INTF_MSG_QSIZE )            /* flush queue if needed */
-    {  
-#ifdef DEBUG                 /* in debug mode, queue overflow causes a warning */
+    vlc_mutex_lock( &p_msg->lock );                            /* get lock */
+    if( p_msg->i_count == INTF_MSG_QSIZE )          /* flush queue if needed */
+    {
+#ifdef DEBUG               /* in debug mode, queue overflow causes a warning */
         fprintf(stderr, "warning: message queue overflow\n" );
 #endif
         FlushLockedMsg( p_msg );
     }
-    p_msg_item = p_msg->msg + p_msg->i_count++;              /* select message */
+    p_msg_item = p_msg->msg + p_msg->i_count++;            /* select message */
 #endif /*................................................ end of queue mode ...*/
 
-    /* 
-     * Fill message information fields 
+    /*
+     * Fill message information fields
      */
     p_msg_item->i_type =     i_type;
-    p_msg_item->psz_msg =    psz_str;    
+    p_msg_item->psz_msg =    psz_str;
 
 #ifdef INTF_MSG_QUEUE /*........................................... queue mode */
-    vlc_mutex_unlock( &p_msg->lock );                        /* give lock back */
+    vlc_mutex_unlock( &p_msg->lock );                      /* give lock back */
 #else /*......................................................... instant mode */
-    PrintMsg( p_msg_item );                                   /* print message */
-    free( psz_str );                                      /* free message data */
+    PrintMsg( p_msg_item );                                 /* print message */
+    free( psz_str );                                    /* free message data */
 #endif /*......................................................................*/
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * QueueDbgMsg: add a message to a queue with debugging informations
- *******************************************************************************
+ *****************************************************************************
  * This function is the same as QueueMsg, except that it is only defined when
  * DEBUG is define, and require additionnal debugging informations.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
                        int i_line, char *psz_format, va_list ap)
 {
-    char *                  psz_str;               /* formatted message string */
-    intf_msg_item_t *       p_msg_item;                  /* pointer to message */
+    char *                  psz_str;             /* formatted message string */
+    intf_msg_item_t *       p_msg_item;                /* pointer to message */
 
 #ifndef INTF_MSG_QUEUE /*..................................... instant mode ...*/
-    intf_msg_item_t         msg_item;                               /* message */
+    intf_msg_item_t         msg_item;                             /* message */
     p_msg_item =           &msg_item;
 #endif /*......................................................................*/
 
-    /* 
-     * Convert message to string 
-     */   
+    /*
+     * Convert message to string
+     */
     vasprintf( &psz_str, psz_format, ap );
     if( psz_str == NULL )
     {
-        fprintf(stderr, "warning: can't store following message (%s): ", 
+        fprintf(stderr, "warning: can't store following message (%s): ",
                 strerror(errno) );
         fprintf(stderr, INTF_MSG_DBG_FORMAT, psz_file, psz_function, i_line );
        vfprintf(stderr, psz_format, ap );
@@ -389,43 +389,43 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
     }
 
 #ifdef INTF_MSG_QUEUE /*........................................ queue mode ...*/
-    vlc_mutex_lock( &p_msg->lock );                            /* get lock */    
-    if( p_msg->i_count == INTF_MSG_QSIZE )            /* flush queue if needed */
-    {  
-#ifdef DEBUG                 /* in debug mode, queue overflow causes a warning */
+    vlc_mutex_lock( &p_msg->lock );                            /* get lock */
+    if( p_msg->i_count == INTF_MSG_QSIZE )          /* flush queue if needed */
+    {
+#ifdef DEBUG               /* in debug mode, queue overflow causes a warning */
         fprintf(stderr, "warning: message queue overflow\n" );
 #endif
         FlushLockedMsg( p_msg );
     }
-    p_msg_item = p_msg->msg + p_msg->i_count++;              /* select message */
+    p_msg_item = p_msg->msg + p_msg->i_count++;            /* select message */
 #endif /*................................................ end of queue mode ...*/
 
-    /* 
-     * Fill message information fields 
+    /*
+     * Fill message information fields
      */
     p_msg_item->i_type =       INTF_MSG_DBG;
-    p_msg_item->psz_msg =      psz_str;        
+    p_msg_item->psz_msg =      psz_str;
     p_msg_item->psz_file =     psz_file;
     p_msg_item->psz_function = psz_function;
     p_msg_item->i_line =       i_line;
     p_msg_item->date =         mdate();
 
 #ifdef INTF_MSG_QUEUE /*........................................... queue mode */
-    vlc_mutex_unlock( &p_msg->lock );                        /* give lock back */
+    vlc_mutex_unlock( &p_msg->lock );                      /* give lock back */
 #else /*......................................................... instant mode */
-    PrintMsg( p_msg_item );                                   /* print message */
-    free( psz_str );                                      /* free message data */
+    PrintMsg( p_msg_item );                                 /* print message */
+    free( psz_str );                                    /* free message data */
 #endif /*......................................................................*/
 }
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * FlushLockedMsg                                                        (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * Print all messages remaining in queue. MESSAGE QUEUE MUST BE LOCKED, since
  * this function does not check the lock. This function is only defined if
  * INTF_MSG_QUEUE is defined.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef INTF_MSG_QUEUE
 static void FlushLockedMsg ( intf_msg_t *p_msg )
 {
@@ -434,56 +434,56 @@ static void FlushLockedMsg ( intf_msg_t *p_msg )
     for( i_index = 0; i_index < p_msg->i_count; i_index++ )
     {
         /* Print message and free message data */
-        PrintMsg( &p_msg->msg[i_index] );      
+        PrintMsg( &p_msg->msg[i_index] );
         free( p_msg->msg[i_index].psz_msg );
     }
-    
+
     p_msg->i_count = 0;
 }
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * PrintMsg: print a message                                              (ok ?)
- *******************************************************************************
+ *****************************************************************************
  * Print a single message. The message data is not freed. This function exists
  * in two version. The DEBUG version prints a date with each message, and is
  * able to log messages (if DEBUG_LOG is defined).
  * The normal one just prints messages to the screen.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef DEBUG
 
 static void PrintMsg( intf_msg_item_t *p_msg )
 {
-    char    psz_date[MSTRTIME_MAX_SIZE];              /* formatted time buffer */
-    char *  psz_msg;                                         /* message buffer */
-    
+    char    psz_date[MSTRTIME_MAX_SIZE];            /* formatted time buffer */
+    char *  psz_msg;                                       /* message buffer */
+
     /* Format message - the message is formatted here because in case the log
      * file is used, it avoids another format string parsing */
     switch( p_msg->i_type )
     {
-    case INTF_MSG_STD:                                     /* regular messages */
+    case INTF_MSG_STD:                                   /* regular messages */
     case INTF_MSG_ERR:
         asprintf( &psz_msg, "%s", p_msg->psz_msg );
         break;
 
-    case INTF_MSG_INTF:                                  /* interface messages */
+    case INTF_MSG_INTF:                                /* interface messages */
         asprintf( &psz_msg, "%s", p_msg->psz_msg );
         break;
 
-    case INTF_MSG_DBG:                                       /* debug messages */
+    case INTF_MSG_DBG:                                     /* debug messages */
         mstrtime( psz_date, p_msg->date );
-        asprintf( &psz_msg, "(%s) " INTF_MSG_DBG_FORMAT "%s", 
-                  psz_date, p_msg->psz_file, p_msg->psz_function, p_msg->i_line, 
-                  p_msg->psz_msg );            
-        break;                
+        asprintf( &psz_msg, "(%s) " INTF_MSG_DBG_FORMAT "%s",
+                  psz_date, p_msg->psz_file, p_msg->psz_function, p_msg->i_line,
+                  p_msg->psz_msg );
+        break;
     }
+
     /* Check if formatting function suceeded */
     if( psz_msg == NULL )
     {
-        fprintf( stderr, "error: can not format message (%s): %s\n", 
-                 strerror( errno ), p_msg->psz_msg );        
-        return;        
+        fprintf( stderr, "error: can not format message (%s): %s\n",
+                 strerror( errno ), p_msg->psz_msg );
+        return;
     }
 
     /*
@@ -491,20 +491,20 @@ static void PrintMsg( intf_msg_item_t *p_msg )
      */
     switch( p_msg->i_type )
     {
-    case INTF_MSG_STD:                                    /* standard messages */
+    case INTF_MSG_STD:                                  /* standard messages */
         fprintf( stdout, psz_msg );
         break;
-    case INTF_MSG_ERR:                                       /* error messages */
+    case INTF_MSG_ERR:                                     /* error messages */
 #ifndef DEBUG_LOG_ONLY
-    case INTF_MSG_DBG:                                   /* debugging messages */
+    case INTF_MSG_DBG:                                 /* debugging messages */
 #endif
         fprintf( stderr, psz_msg );
         break;
-    case INTF_MSG_INTF:                                  /* interface messages */
+    case INTF_MSG_INTF:                                /* interface messages */
         intf_ConsolePrint( p_main->p_intf->p_console, psz_msg );
         break;
     }
-    
+
 #ifdef DEBUG_LOG
     /* Append all messages to log file */
     if( p_main->p_msg->i_log_file >= 0 )
@@ -514,7 +514,7 @@ static void PrintMsg( intf_msg_item_t *p_msg )
 #endif
 
     /* Free formatted message */
-    free( psz_msg );    
+    free( psz_msg );
 }
 
 #else
@@ -522,21 +522,21 @@ static void PrintMsg( intf_msg_item_t *p_msg )
 static void PrintMsg( intf_msg_item_t *p_msg )
 {
     /*
-     * Print messages on screen 
+     * Print messages on screen
      */
     switch( p_msg->i_type )
     {
-    case INTF_MSG_STD:                                    /* standard messages */
-    case INTF_MSG_DBG:                                       /* debug messages */
+    case INTF_MSG_STD:                                  /* standard messages */
+    case INTF_MSG_DBG:                                     /* debug messages */
         fprintf( stdout, p_msg->psz_msg );
         break;
-    case INTF_MSG_ERR:                                       /* error messages */
+    case INTF_MSG_ERR:                                     /* error messages */
         fprintf( stderr, p_msg->psz_msg );
         break;
-    case INTF_MSG_INTF:                                  /* interface messages */
+    case INTF_MSG_INTF:                                /* interface messages */
         intf_ConsolePrint( p_main->p_intf->p_console, p_msg->psz_msg );
         break;
-    } 
+    }
 }
 
 #endif
index 07bc65bb3acff338215215e5d792363b6b9787bc..568f1d48b2244a3e592efe7a0797c014b446dd5c 100644 (file)
@@ -1,14 +1,14 @@
-/*******************************************************************************
+/*****************************************************************************
  * main.c: main vlc source
  * (c)1998 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Includes the main() function for vlc. Parses command line, start interface
  * and spawn threads.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <getopt.h>
 #include <signal.h>
@@ -16,7 +16,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <sys/soundcard.h>                                   /* audio_output.h */
+#include <sys/soundcard.h>                                 /* audio_output.h */
 
 #include "config.h"
 #include "common.h"
 #include "audio_output.h"
 #include "main.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * Command line options constants. If something is changed here, be sure that
  * GetConfiguration and Usage are also changed.
- *******************************************************************************/
+ *****************************************************************************/
 
 /* Long options return values - note that values corresponding to short options
  * chars, and in general any regular char, should be avoided */
 #define OPT_NOVLANS             170
 #define OPT_SERVER              171
 #define OPT_PORT                172
+
 /* Long options */
 static const struct option longopts[] =
-{   
-    /*  name,               has_arg,    flag,   val */     
+{
+    /*  name,               has_arg,    flag,   val */
 
     /* General/common options */
-    {   "help",             0,          0,      'h' },          
-    {   "version",          0,          0,      'v' },        
+    {   "help",             0,          0,      'h' },
+    {   "version",          0,          0,      'v' },
 
     /* Audio options */
-    {   "noaudio",          0,          0,      OPT_NOAUDIO },       
+    {   "noaudio",          0,          0,      OPT_NOAUDIO },
     {   "stereo",           0,          0,      OPT_STEREO },
-    {   "mono",             0,          0,      OPT_MONO },      
+    {   "mono",             0,          0,      OPT_MONO },
 
     /* Video options */
-    {   "novideo",          0,          0,      OPT_NOVIDEO },           
-    {   "display",          1,          0,      OPT_DISPLAY },  
+    {   "novideo",          0,          0,      OPT_NOVIDEO },
+    {   "display",          1,          0,      OPT_DISPLAY },
     {   "width",            1,          0,      OPT_WIDTH },
-    {   "height",           1,          0,      OPT_HEIGHT },                
-    {   "grayscale",        0,          0,      'g' },    
-    {   "color",            0,          0,      OPT_COLOR },                
+    {   "height",           1,          0,      OPT_HEIGHT },
+    {   "grayscale",        0,          0,      'g' },
+    {   "color",            0,          0,      OPT_COLOR },
 
     /* Input options */
     {   "novlans",          0,          0,      OPT_NOVLANS },
@@ -82,14 +82,14 @@ static const struct option longopts[] =
 /* Short options */
 static const char *psz_shortopts = "hvg";
 
-/*******************************************************************************
+/*****************************************************************************
  * Global variable program_data - this is the one and only, see main.h
- *******************************************************************************/
+ *****************************************************************************/
 main_t *p_main;
 
-/*******************************************************************************
+/*****************************************************************************
  * Local prototypes
- *******************************************************************************/
+ *****************************************************************************/
 static void SetDefaultConfiguration ( void );
 static int  GetConfiguration        ( int i_argc, char *ppsz_argv[], char *ppsz_env[] );
 static void Usage                   ( void );
@@ -98,26 +98,26 @@ static void Version                 ( void );
 static void InitSignalHandler       ( void );
 static void SignalHandler           ( int i_signal );
 
-/*******************************************************************************
+/*****************************************************************************
  * main: parse command line, start interface and spawn threads
- *******************************************************************************
+ *****************************************************************************
  * Steps during program execution are:
  *      -configuration parsing and messages interface initialization
  *      -openning of audio output device and some global modules
  *      -execution of interface, which exit on error or on user request
  *      -closing of audio output device and some global modules
  * On error, the spawned threads are cancelled, and the openned devices closed.
- *******************************************************************************/
+ *****************************************************************************/
 int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 {
-    main_t  main_data;                        /* root of all data - see main.h */
-    p_main = &main_data;                         /* set up the global variable */   
+    main_t  main_data;                      /* root of all data - see main.h */
+    p_main = &main_data;                       /* set up the global variable */
 
     /*
      * Read configuration, initialize messages interface and set up program
-     */    
+     */
     p_main->p_msg = intf_MsgCreate();
-    if( !p_main->p_msg )                           /* start messages interface */
+    if( !p_main->p_msg )                         /* start messages interface */
     {
         fprintf(stderr, "critical error: can't initialize messages interface (%s)\n",
                 strerror(errno));
@@ -128,7 +128,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
         intf_MsgDestroy();
         return(errno);
     }
-    intf_MsgImm( COPYRIGHT_MESSAGE "\n" );            /* print welcome message */
+    intf_MsgImm( COPYRIGHT_MESSAGE "\n" );          /* print welcome message */
 
     /*
      * Initialize shared resources and libraries
@@ -139,7 +139,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
         intf_Msg("Virtual LANs initialization failed : vlans management is desactivated\n");
         main_data.b_vlans = 0;
     }
-    
+
     /*
      * Open audio device and start aout thread
      */
@@ -153,7 +153,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
             main_data.b_audio = 0;
        }
     }
-    
+
     /*
      * Run interface
      */
@@ -177,9 +177,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
      * Free shared resources and libraries
      */
     if( main_data.b_vlans )
-    {        
-        input_VlanDestroy();    
-    }    
+    {
+        input_VlanDestroy();
+    }
 
     /*
      * Terminate messages interface and program
@@ -189,34 +189,34 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * main_GetIntVariable: get the int value of an environment variable
- *******************************************************************************
+ *****************************************************************************
  * This function is used to read some default parameters in modules.
- *******************************************************************************/
+ *****************************************************************************/
 int main_GetIntVariable( char *psz_name, int i_default )
 {
-    char *      psz_env;                                  /* environment value */
-    char *      psz_end;                               /* end of parsing index */
-    long int    i_value;                                              /* value */
+    char *      psz_env;                                /* environment value */
+    char *      psz_end;                             /* end of parsing index */
+    long int    i_value;                                            /* value */
 
     psz_env = getenv( psz_name );
     if( psz_env )
-    {        
+    {
         i_value = strtol( psz_env, &psz_end, 0 );
         if( (*psz_env != '\0') && (*psz_end == '\0') )
         {
             return( i_value );
-        }        
+        }
     }  
     return( i_default );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * main_GetPszVariable: get the string value of an environment variable
- *******************************************************************************
+ *****************************************************************************
  * This function is used to read some default parameters in modules.
- *******************************************************************************/
+ *****************************************************************************/
 char * main_GetPszVariable( char *psz_name, char *psz_default )
 {
     char *psz_env;
@@ -226,16 +226,16 @@ char * main_GetPszVariable( char *psz_name, char *psz_default )
     {
         return( psz_env );
     }
-    return( psz_default );    
+    return( psz_default );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * main_PutPszVariable: set the string value of an environment variable
- *******************************************************************************
+ *****************************************************************************
  * This function is used to set some default parameters in modules. The use of
  * this function will cause some memory leak: since some systems use the pointer
  * passed to putenv to store the environment string, it can't be freed.
- *******************************************************************************/
+ *****************************************************************************/
 void main_PutPszVariable( char *psz_name, char *psz_value )
 {
     char *psz_env;
@@ -243,7 +243,7 @@ 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\n", strerror(ENOMEM));        
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
     }
     else
     {
@@ -251,35 +251,35 @@ void main_PutPszVariable( char *psz_name, char *psz_value )
         if( putenv( psz_env ) )
         {
             intf_ErrMsg("error: %s\n", strerror(errno));
-        }        
+        }
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * main_PutIntVariable: set the integer value of an environment variable
- *******************************************************************************
+ *****************************************************************************
  * This function is used to set some default parameters in modules. The use of
  * this function will cause some memory leak: since some systems use the pointer
  * passed to putenv to store the environment string, it can't be freed.
- *******************************************************************************/
+ *****************************************************************************/
 void main_PutIntVariable( char *psz_name, int i_value )
 {
-    char psz_value[ 256 ];                                 /* buffer for value */    
+    char psz_value[ 256 ];                               /* buffer for value */
 
-    sprintf(psz_value, "%d", i_value );        
-    main_PutPszVariable( psz_name, psz_value );    
+    sprintf(psz_value, "%d", i_value );
+    main_PutPszVariable( psz_name, psz_value );
 }
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * SetDefaultConfiguration: set default options
- *******************************************************************************
+ *****************************************************************************
  * This function is called by GetConfiguration before command line is parsed.
  * It sets all the default values required later by the program. At this stage,
  * most structure are not yet allocated, so initialization must be done using
  * environment.
- *******************************************************************************/
+ *****************************************************************************/
 static void SetDefaultConfiguration( void )
 {
     /*
@@ -290,15 +290,15 @@ static void SetDefaultConfiguration( void )
     p_main->b_vlans  = 1;
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * GetConfiguration: parse command line
- *******************************************************************************
+ *****************************************************************************
  * Parse command line and configuration file for configuration. If the inline
  * help is requested, the function Usage() is called and the function returns
- * -1 (causing main() to exit). The messages interface is initialized at this 
+ * -1 (causing main() to exit). The messages interface is initialized at this
  * stage, but most structures are not allocated, so only environment should
  * be used.
- *******************************************************************************/
+ *****************************************************************************/
 static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 {
     int c, i_opt;
@@ -306,7 +306,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /* Set default configuration and copy arguments */
     p_main->i_argc    = i_argc;
     p_main->ppsz_argv = ppsz_argv;
-    p_main->ppsz_env  = ppsz_env;    
+    p_main->ppsz_env  = ppsz_env;
     SetDefaultConfiguration();
 
     /* Parse command line options */
@@ -315,61 +315,61 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     {
         switch( c )
         {
-        /* General/common options */   
-        case 'h':                                                /* -h, --help */
+        /* General/common options */
+        case 'h':                                              /* -h, --help */
             Usage();
             return( -1 );
             break;
-        case 'v':                                             /* -v, --version */
+        case 'v':                                           /* -v, --version */
             Version();
             return( -1 );
-            break;            
+            break;
 
         /* Audio options */
-        case OPT_NOAUDIO:                                         /* --noaudio */
+        case OPT_NOAUDIO:                                       /* --noaudio */
            p_main->b_audio = 0;
             break;
-        case OPT_STEREO:                                           /* --stereo */
+        case OPT_STEREO:                                         /* --stereo */
             main_PutIntVariable( AOUT_STEREO_VAR, 1 );
             break;
-        case OPT_MONO:                                               /* --mono */
+        case OPT_MONO:                                             /* --mono */
             main_PutIntVariable( AOUT_STEREO_VAR, 0 );
             break;
 
         /* Video options */
-        case OPT_NOVIDEO:                                         /* --novideo */
+        case OPT_NOVIDEO:                                       /* --novideo */
             p_main->b_video = 0;
-            break;       
-        case OPT_DISPLAY:                                         /* --display */
+            break;
+        case OPT_DISPLAY:                                       /* --display */
             main_PutPszVariable( VOUT_DISPLAY_VAR, optarg );
-            break;            
-        case OPT_WIDTH:                                             /* --width */
+            break;
+        case OPT_WIDTH:                                           /* --width */
             main_PutPszVariable( VOUT_WIDTH_VAR, optarg );
-            break;            
-        case OPT_HEIGHT:                                           /* --height */            
-            main_PutPszVariable( VOUT_HEIGHT_VAR, optarg );            
-            break;            
-            
-        case 'g':                                           /* -g, --grayscale */
+            break;
+        case OPT_HEIGHT:                                         /* --height */
+            main_PutPszVariable( VOUT_HEIGHT_VAR, optarg );
+            break;
+
+        case 'g':                                         /* -g, --grayscale */
             main_PutIntVariable( VOUT_GRAYSCALE_VAR, 1 );
-            break;            
-        case OPT_COLOR:                                             /* --color */
+            break;
+        case OPT_COLOR:                                           /* --color */
             main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 );
-            break;            
+            break;
 
         /* Input options */
-        case OPT_NOVLANS:                                         /* --novlans */
+        case OPT_NOVLANS:                                       /* --novlans */
             p_main->b_vlans = 0;
-            break;      
-        case OPT_SERVER:                                           /* --server */
+            break;
+        case OPT_SERVER:                                         /* --server */
             main_PutPszVariable( INPUT_SERVER_VAR, optarg );
-            break;            
-        case OPT_PORT:                                               /* --port */
+            break;
+        case OPT_PORT:                                             /* --port */
             main_PutPszVariable( INPUT_PORT_VAR, optarg );
-            break;            
-           
+            break;
+       
         /* Internal error: unknown option */
-        case '?':                          
+        case '?':
         default:
             intf_ErrMsg("intf error: unknown option '%s'\n", ppsz_argv[optind - 1]);
             return( EINVAL );
@@ -385,11 +385,11 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Usage: print program usage
- *******************************************************************************
+ *****************************************************************************
  * Print a short inline help. Message interface is initialized at this stage.
- *******************************************************************************/
+ *****************************************************************************/
 static void Usage( void )
 {
     intf_Msg(COPYRIGHT_MESSAGE "\n");
@@ -412,7 +412,7 @@ static void Usage( void )
     /* Interface parameters */
     intf_Msg("Interface parameters:\n" \
             "  " INTF_INIT_SCRIPT_VAR "=<filename>             \tinitialization script\n" \
-             "  " INTF_CHANNELS_VAR "=<filename>            \tchannels list\n" \
+             "  " INTF_CHANNELS_VAR "=<filename>            \tchannels list\n"\
             );
 
     /* Audio parameters */
@@ -429,7 +429,7 @@ static void Usage( void )
              "  " VOUT_HEIGHT_VAR "=<height>             \tdislay height\n" \
              "  " VOUT_FB_DEV_VAR "=<filename>           \tframebuffer device path\n" \
              "  " VOUT_GRAYSCALE_VAR "={1|0}             \tgrayscale or color output\n" \
-            ); 
+            );
 
     /* Input parameters */
     intf_Msg("Input parameters:\n" \
@@ -437,15 +437,15 @@ static void Usage( void )
              "  " INPUT_PORT_VAR "=<port>            \tvideo server port\n" \
             "  " INPUT_IFACE_VAR "=<interface>          \tnetwork interface\n" \
              "  " INPUT_VLAN_SERVER_VAR "=<hostname>     \tvlan server\n" \
-             "  " INPUT_VLAN_PORT_VAR "=<port>           \tvlan server port\n" \
+             "  " INPUT_VLAN_PORT_VAR "=<port>           \tvlan server port\n"\
             );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Version: print complete program version
- *******************************************************************************
+ *****************************************************************************
  * Print complete program version and build number.
- *******************************************************************************/
+ *****************************************************************************/
 static void Version( void )
 {
     intf_Msg(VERSION_MESSAGE "\n\n");
@@ -456,15 +456,15 @@ static void Version( void )
              "provided without any warranty, including the implied warranties of\n" \
              "merchantibility and fitness for a particular purpose.\n" \
             );
-}    
+}
 
-/*******************************************************************************
+/*****************************************************************************
  * InitSignalHandler: system signal handler initialization
- *******************************************************************************
+ *****************************************************************************
  * Set the signal handlers. SIGTERM is not intercepted, because we need at
- * at least a method to kill the program when all other methods failed, and 
+ * at least a method to kill the program when all other methods failed, and
  * when we don't want to use SIGKILL.
- *******************************************************************************/
+ *****************************************************************************/
 static void InitSignalHandler( void )
 {
     /* Termination signals */
@@ -473,15 +473,15 @@ static void InitSignalHandler( void )
     signal( SIGQUIT, SignalHandler );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * SignalHandler: system signal handler
- *******************************************************************************
+ *****************************************************************************
  * This function is called when a signal is received by the program. It tries to
  * end the program in a clean way.
- *******************************************************************************/
+ *****************************************************************************/
 static void SignalHandler( int i_signal )
 {
-    /* Once a signal has been trapped, the termination sequence will be armed and 
+    /* Once a signal has been trapped, the termination sequence will be armed and
      * following signals will be ignored to avoid sending messages to an interface
      * having been destroyed */
     signal( SIGHUP,  SIG_IGN );
@@ -491,7 +491,7 @@ static void SignalHandler( int i_signal )
     /* Acknowledge the signal received */
     intf_ErrMsgImm("intf: signal %d received\n", i_signal );
 
-    /* Try to terminate everything - this is done by requesting the end of the 
+    /* Try to terminate everything - this is done by requesting the end of the
      * interface thread */
     p_main->p_intf->b_die = 1;
 }
index b33f5f66668cf24026eec336fb17da47b45b2cac..6d2393c0512b3ab4387a36cd75531045525850d8 100644 (file)
@@ -1,16 +1,16 @@
-/******************************************************************************
+/*****************************************************************************
  * mtime.c: high rezolution time management functions
  * (c)1998 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * Functions are prototyped in mtime.h.
- ******************************************************************************
+ *****************************************************************************
  * to-do list:
  *  see if using Linux real-time extensions is possible and profitable
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 #include <stdio.h>
 #include <unistd.h>
 #include <sys/time.h>
 #include "common.h"
 #include "mtime.h"
 
-/******************************************************************************
+/*****************************************************************************
  * mstrtime: return a date in a readable format
- ******************************************************************************
+ *****************************************************************************
  * This functions is provided for any interface function which need to print a
  * date. psz_buffer should be a buffer long enough to store the formatted
  * date.
- ******************************************************************************/
+ *****************************************************************************/
 char *mstrtime( char *psz_buffer, mtime_t date )
 {
     sprintf( psz_buffer, "%02d:%02d:%02d-%03d.%03d",
@@ -36,12 +36,12 @@ char *mstrtime( char *psz_buffer, mtime_t date )
     return( psz_buffer );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * mdate: return high precision date (inline function)
- ******************************************************************************
+ *****************************************************************************
  * Uses the gettimeofday() function when possible (1 MHz resolution) or the
  * ftime() function (1 kHz resolution).
- ******************************************************************************/
+ *****************************************************************************/
 mtime_t mdate( void )
 {
     struct timeval tv_date;
@@ -53,24 +53,24 @@ mtime_t mdate( void )
     return( (mtime_t) tv_date.tv_sec * 1000000 + (mtime_t) tv_date.tv_usec );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * mwait: wait for a date (inline function)
- ******************************************************************************
+ *****************************************************************************
  * This function uses select() and an system date function to wake up at a
  * precise date. It should be used for process synchronization. If current date
  * is posterior to wished date, the function returns immediately.
- ******************************************************************************/
+ *****************************************************************************/
 void mwait( mtime_t date )
 {
     struct timeval tv_date, tv_delay;
-    mtime_t        delay;           /* delay in msec, signed to detect errors */
+    mtime_t        delay;          /* delay in msec, signed to detect errors */
 
     /* see mdate() about gettimeofday() possible errors */
     gettimeofday( &tv_date, NULL );
 
     /* calculate delay and check if current date is before wished date */
     delay = date - (mtime_t) tv_date.tv_sec * 1000000 - (mtime_t) tv_date.tv_usec;
-    if( delay <= 0 )                  /* wished date is now or already passed */
+    if( delay <= 0 )                 /* wished date is now or already passed */
     {
         return;
     }
@@ -81,15 +81,15 @@ void mwait( mtime_t date )
     /* see msleep() about select() errors */
     select( 0, NULL, NULL, NULL, &tv_delay );
 #else
-    usleep( delay );    
+    usleep( delay );
 #endif
 }
 
-/******************************************************************************
+/*****************************************************************************
  * msleep: more precise sleep() (inline function)                        (ok ?)
- ******************************************************************************
+ *****************************************************************************
  * Portable usleep() function.
- ******************************************************************************/
+ *****************************************************************************/
 void msleep( mtime_t delay )
 {
 #ifndef usleep
index 19e70b7a5adc7db754f6207ceb7fb49dad34602a..ce9f6044ca589064b8ebea84c9441b1e3195dfaf 100644 (file)
@@ -1,16 +1,16 @@
-/*******************************************************************************
+/*****************************************************************************
  * netutils.c: various network functions
  * (c)1999 VideoLAN
- *******************************************************************************
- * ?? 
- *******************************************************************************
+ *****************************************************************************
+ * ??
+ *****************************************************************************
  * Required headers:
  * <netinet/in.h>
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <netdb.h>
 #include <stdlib.h>
 #include <stdio.h>
 
 #include "netutils.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * BuildInetAddr: build an Internet address descriptor
- *******************************************************************************
+ *****************************************************************************
  * Build an internet socket descriptor from a host name, or an ip, and a port.
  * If the address is NULL, then INADDR_ANY will be used, allowing to receive
  * on any address for a local socket. Usually, in this case, 'port' is also null
  * and the function always succeeds.
- *******************************************************************************/
+ *****************************************************************************/
 int BuildInetAddr( struct sockaddr_in *p_sa_in, char *psz_in_addr, int i_port )
 {
-    struct hostent *p_hostent;                              /* host descriptor */
+    struct hostent *p_hostent;                            /* host descriptor */
 
     bzero( p_sa_in, sizeof( struct sockaddr_in ) );
-    p_sa_in->sin_family = AF_INET;                                   /* family */
-    p_sa_in->sin_port = htons( i_port );                               /* port */
+    p_sa_in->sin_family = AF_INET;                                 /* family */
+    p_sa_in->sin_port = htons( i_port );                             /* port */
 
     /* Use INADDR_ANY if psz_in_addr is NULL */
     if( psz_in_addr == NULL )
-    {        
+    {
         p_sa_in->sin_addr.s_addr = htonl(INADDR_ANY);
-    }    
-    /* Try to convert address directly from in_addr - this will work if 
-     * psz_in_addr is dotted decimal. */    
+    }
+    /* Try to convert address directly from in_addr - this will work if
+     * psz_in_addr is dotted decimal. */
     else if( !inet_aton( psz_in_addr, &p_sa_in->sin_addr) )
     {
         /* The convertion failed: the address is an host name, which needs
          * to be resolved */
-        intf_DbgMsg("debug: resolving internet address %s...\n", psz_in_addr);        
+        intf_DbgMsg("debug: resolving internet address %s...\n", psz_in_addr);
         if ( (p_hostent = gethostbyname(psz_in_addr)) == NULL)
         {
             intf_ErrMsg("error: unknown host %s\n", psz_in_addr);
-            return( -1 );            
+            return( -1 );
         }
 
         /* Copy the first address of the host in the socket address */
         bcopy( p_hostent->h_addr_list[0], &p_sa_in->sin_addr, p_hostent->h_length);
     }
-    return( 0 );    
+    return( 0 );
 }
 
 
-/*******************************************************************************
+/*****************************************************************************
  * ServerPort: extract port from a "server:port" adress
- *******************************************************************************
+ *****************************************************************************
  * Returns the port number in a "server:port" address and replace the ":" by
  * a NUL character, or returns -1.
- *******************************************************************************/
+ *****************************************************************************/
 int ServerPort( char *psz_addr )
 {
     char *psz_index;
@@ -87,8 +87,8 @@ int ServerPort( char *psz_addr )
     for( psz_index = psz_addr; *psz_index && (*psz_index != ':'); psz_index++ )
     {
         ;
-    }        
-    
+    }
+
     /* If a port number has been found, convert it and return it */
     if( *psz_index == ':' )
     {
@@ -96,23 +96,23 @@ int ServerPort( char *psz_addr )
         return( atoi( psz_index + 1 ) );
     }
 
-    return( - 1 );    
+    return( - 1 );
 }
 
 
-/*******************************************************************************
+/*****************************************************************************
  * ReadIfConf: Read the configuration of an interface
- *******************************************************************************
+ *****************************************************************************
  * i_sockfd must reference a socket open as follow: AF_INET, DOCK_DGRAM, 0
- *******************************************************************************/
+ *****************************************************************************/
 int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
-{             
+{
     struct ifreq ifr_config;
     int i_rc = 0;
-  
+
     ASSERT(p_ifdescr);
     ASSERT(psz_name);
-  
+
     /* Which interface are we interested in ? */
     strcpy(ifr_config.ifr_name, psz_name);
 
@@ -130,7 +130,7 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
         return -1;
     }
 
-    /* Read physical address of the interface and store it in our description */
+   /* Read physical address of the interface and store it in our description */
     i_rc = ioctl(i_sockfd, SIOCGIFHWADDR, (byte_t *)&ifr_config);
     if( !i_rc )
     {
@@ -149,7 +149,7 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
                     psz_name, strerror(errno));
         return -1;
     }
-  
+
     /* Read IP address of the interface and store it in our description */
     i_rc = ioctl(i_sockfd, SIOCGIFADDR, (byte_t *)&ifr_config);
     if( !i_rc )
@@ -164,8 +164,8 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
                     psz_name, strerror(errno));
         return -1;
     }
-  
-    /* Read broadcast address of the interface and store it in our description */
+
+  /* Read broadcast address of the interface and store it in our description */
     if(p_ifdescr->i_flags & IFF_POINTOPOINT)
     {
         intf_DbgMsg("%s doen't not support broadcast\n", psz_name);
@@ -188,24 +188,24 @@ int ReadIfConf(int i_sockfd, if_descr_t* p_ifdescr, char* psz_name)
                     psz_name, strerror(errno));
         return -1;
     }
-  
+
     return i_rc;
 }
 
 
 
-/*******************************************************************************
+/*****************************************************************************
  * ReadNetConf: Retrieve the network configuration of the host
- *******************************************************************************
+ *****************************************************************************
  * Only IP interfaces are listed, and only if they are up
  * i_sockfd must reference a socket open as follow: AF_INET, DOCK_DGRAM, 0
- *******************************************************************************/
+ *****************************************************************************/
 int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
 {
     struct ifreq* a_ifr_ifconf = NULL;
     struct ifreq* p_ifr_current_if;
     struct ifconf ifc_netconf;
-  
+
     int i_if_number;
     int i_remaining;
     int i_rc = 0;
@@ -281,7 +281,7 @@ int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
             }
         }
     }
-  
+
     /* Don't need the a_ifr_ifconf anymore */
     free( a_ifr_ifconf );
     return i_rc;
index 7139f6060c0d79c02b9ce543a5a4f88159bcbd2f..9137f710becc3e8c647c640828202443121789e2 100644 (file)
@@ -1,12 +1,12 @@
-/*******************************************************************************
+/*****************************************************************************
  * rsc_files.c: resources files manipulation functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * This library describe a general format used to store 'resources'. Resources
  * can be anything, including pictures, audio streams, and so on.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Format of a resource file:
  *  offset      type        meaning
  *  0           char[2]     "RF" (magic number)
  *  +34         u64         data offset in bytes, from beginning of file
  *  +42         u64         data size in bytes
  * } * i_size
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 
 #include "intf_msg.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * CreateResourceFile: create a new resource file
- *******************************************************************************
+ *****************************************************************************
  * Creates a new resource file. The file is opened read/write and erased if
  * it already exists.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 101
- *******************************************************************************/
-resource_file_t *CreateResourceFile( char *psz_filename, int i_type, int i_size, 
+ *****************************************************************************/
+resource_file_t *CreateResourceFile( char *psz_filename, int i_type, int i_size,
                                      int i_mode )
 {
-    resource_file_t *   p_file;                              /* new descriptor */
-    int                 i_index;                             /* resource index */
+    resource_file_t *   p_file;                            /* new descriptor */
+    int                 i_index;                           /* resource index */
 
     /* Create descriptor and tables */
     p_file = malloc( sizeof(resource_file_t) );
@@ -67,15 +67,15 @@ resource_file_t *CreateResourceFile( char *psz_filename, int i_type, int i_size,
         intf_ErrMsg("rsc error 101-2: %s\n", strerror(errno));
         free( p_file );
         return( NULL );
-    } 
-                
+    }
+
     /* Open file */
-    p_file->i_file = open( psz_filename, O_CREAT | O_RDWR, i_mode ); 
-    if( p_file->i_file == -1 )                                        /* error */
+    p_file->i_file = open( psz_filename, O_CREAT | O_RDWR, i_mode );
+    if( p_file->i_file == -1 )                                      /* error */
     {
         intf_ErrMsg("rsc error 101-3: %s: %s\n", psz_filename, strerror(errno) );
         free( p_file->p_resource );
-        free( p_file );        
+        free( p_file );
     }
 
     /* Initialize tables */
@@ -90,19 +90,19 @@ resource_file_t *CreateResourceFile( char *psz_filename, int i_type, int i_size,
     return( p_file );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * OpenResourceFile: open an existing resource file read-only
- *******************************************************************************
+ *****************************************************************************
  * Open an existing resource file. i_flags should be O_RDONLY or O_RDWR. An
  * error will occurs if the file does not exists.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 102
- *******************************************************************************/
+ *****************************************************************************/
 resource_file_t *OpenResourceFile( char *psz_filename, int i_type, int i_flags )
 {
-    resource_file_t *   p_file;                              /* new descriptor */
-    int                 i_index;                             /* resource index */
-    byte_t              p_buffer[50];                                /* buffer */
+    resource_file_t *   p_file;                            /* new descriptor */
+    int                 i_index;                           /* resource index */
+    byte_t              p_buffer[50];                              /* buffer */
 
     /* Create descriptor and tables */
     p_file = malloc( sizeof(resource_file_t) );
@@ -110,17 +110,17 @@ resource_file_t *OpenResourceFile( char *psz_filename, int i_type, int i_flags )
     {
         intf_ErrMsg("rsc error 102-1: %s\n", strerror(errno));
         return( NULL );
-    }   
-                
+    }
+
     /* Open file */
-    p_file->i_file = open( psz_filename, i_flags ); 
-    if( p_file->i_file == -1 )                                        /* error */
+    p_file->i_file = open( psz_filename, i_flags );
+    if( p_file->i_file == -1 )                                      /* error */
     {
         intf_ErrMsg("rsc error 102-2: %s: %s\n", psz_filename, strerror(errno) );
-        free( p_file );         
+        free( p_file );
         return( NULL );
-    }   
-    
+    }
+
     /* Read header */
     if( read( p_file->i_file, p_buffer, 8 ) != 8)
     {
@@ -148,8 +148,8 @@ resource_file_t *OpenResourceFile( char *psz_filename, int i_type, int i_flags )
         close( p_file->i_file );
         free( p_file );
         return( NULL );
-    } 
-    
+    }
+
     /* Initialize table */
     p_file->b_up_to_date = 1;
     p_file->b_read_only = ( i_flags & O_RDWR ) ? 0 : 1;
@@ -173,19 +173,19 @@ resource_file_t *OpenResourceFile( char *psz_filename, int i_type, int i_flags )
     return( p_file );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * UpdateResourceFile: write the resources table in a resource file
- *******************************************************************************
- * This function writes resources table in the resource file. This is 
+ *****************************************************************************
+ * This function writes resources table in the resource file. This is
  * automatically done when the file is closed, but can also be done manually.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 103
- *******************************************************************************/
+ *****************************************************************************/
 int UpdateResourceFile( resource_file_t *p_file )
 {
-    byte_t      p_buffer[50];                                        /* buffer */
-    int         i_index;                                     /* resource index */
-                             
+    byte_t      p_buffer[50];                                      /* buffer */
+    int         i_index;                                   /* resource index */
+
 #ifdef DEBUG
     if( p_file->b_read_only )
     {
@@ -210,7 +210,7 @@ int UpdateResourceFile( resource_file_t *p_file )
     *(u16 *)(p_buffer + 6) =    p_file->i_size;
     if( write( p_file->i_file, p_buffer, 8 ) != 8 )
     {
-        intf_ErrMsg("rsc error 103-2: %s\n", strerror(errno)); 
+        intf_ErrMsg("rsc error 103-2: %s\n", strerror(errno));
         return( -3 );
     }
 
@@ -220,12 +220,12 @@ int UpdateResourceFile( resource_file_t *p_file )
         memcpy( p_buffer, p_file->p_resource[i_index].psz_name, 32 );
         *(u16 *)(p_buffer + 32) =   p_file->p_resource[i_index].i_type;
         *(u64 *)(p_buffer + 34) =   p_file->p_resource[i_index].i_offset;
-        *(u64 *)(p_buffer + 42) =   p_file->p_resource[i_index].i_size;            
+        *(u64 *)(p_buffer + 42) =   p_file->p_resource[i_index].i_size;
         if( write( p_file->i_file, p_buffer, 8 ) != 8 )
         {
-            intf_ErrMsg("rsc error 103-3: %s\n", strerror(errno)); 
+            intf_ErrMsg("rsc error 103-3: %s\n", strerror(errno));
             return( -4 );
-        }           
+        }
     }
 
     /* Mark file as up to date */
@@ -234,14 +234,14 @@ int UpdateResourceFile( resource_file_t *p_file )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * CloseResourceFile: close a resource file
- *******************************************************************************
+ *****************************************************************************
  * Updates the resources table if required, and close the file. It returns non
  * 0 in case of error.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 104
- *******************************************************************************/
+ *****************************************************************************/
 int CloseResourceFile( resource_file_t *p_file )
 {
     /* Update table */
@@ -261,23 +261,23 @@ int CloseResourceFile( resource_file_t *p_file )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * SeekResource: seek a resource in a resource file
- *******************************************************************************
+ *****************************************************************************
  * Look for a resource in file and place the "reading head" at the beginning of
  * the resource data.
  * In case of success, the resource number is returned. Else, a negative number
  * is returned.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 105
- *******************************************************************************/
+ *****************************************************************************/
 int SeekResource( resource_file_t *p_file, char *psz_name, int i_type )
 {
-    int     i_index;                                         /* resource index */
+    int     i_index;                                       /* resource index */
 
     /* Look for resource in table */
-    for( i_index = 0; 
-         (i_index < p_file->i_size) 
+    for( i_index = 0;
+         (i_index < p_file->i_size)
              && ((i_type != p_file->p_resource[i_index].i_type )
                  || strcmp(psz_name, p_file->p_resource[i_index].psz_name));
          i_index++ )
@@ -293,7 +293,7 @@ int SeekResource( resource_file_t *p_file, char *psz_name, int i_type )
     /* Seek */
     if( lseek( p_file->i_file, p_file->p_resource[i_index].i_offset, SEEK_SET ) )
     {
-        intf_ErrMsg("rsc error 105-2: can not reach %s.%d: %s\n", psz_name, 
+        intf_ErrMsg("rsc error 105-2: can not reach %s.%d: %s\n", psz_name,
                     i_type, strerror(errno));
         return( -2 );
     }
@@ -301,18 +301,18 @@ int SeekResource( resource_file_t *p_file, char *psz_name, int i_type )
     return( i_index );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * ReadResource: read a resource
- *******************************************************************************
+ *****************************************************************************
  * Read a resource from a file. The function returns a negative value in case
  * of error, and 0 in case of success.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 106
- *******************************************************************************/
+ *****************************************************************************/
 int ReadResource( resource_file_t *p_file, char *psz_name, int i_type,
                   size_t max_size, byte_t *p_data )
 {
-    int i_index;                                             /* resource index */
+    int i_index;                                           /* resource index */
 
     /* Seek resource */
     i_index = SeekResource( p_file, psz_name, i_type );
@@ -329,11 +329,11 @@ int ReadResource( resource_file_t *p_file, char *psz_name, int i_type,
     }
 
     /* Read data */
-    if( read( p_file->i_file, p_data, p_file->p_resource[i_index].i_size ) 
+    if( read( p_file->i_file, p_data, p_file->p_resource[i_index].i_size )
         != p_file->p_resource[i_index].i_size )
     {
         intf_ErrMsg("rsc error 106-2: can not read %s.%d: %s\n",
-                    p_file->p_resource[i_index].psz_name, 
+                    p_file->p_resource[i_index].psz_name,
                     p_file->p_resource[i_index].i_type,
                     strerror(errno));
         return( -3 );
@@ -342,19 +342,19 @@ int ReadResource( resource_file_t *p_file, char *psz_name, int i_type,
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * WriteResource: write a resource
- *******************************************************************************
+ *****************************************************************************
  * Append a resource at the end of the file. It returns non 0 on error.
- *******************************************************************************
+ *****************************************************************************
  * Messages type: rsc, major code 107
- *******************************************************************************/
-int WriteResource( resource_file_t *p_file, char *psz_name, int i_type, 
+ *****************************************************************************/
+int WriteResource( resource_file_t *p_file, char *psz_name, int i_type,
                    size_t size, byte_t *p_data )
 {
-    int i_index;                                             /* resource index */
-    int i_tmp_index;                               /* temporary resource index */
-    u64 i_offset;                                                    /* offset */
+    int i_index;                                           /* resource index */
+    int i_tmp_index;                             /* temporary resource index */
+    u64 i_offset;                                                  /* offset */
 
 #ifdef DEBUG
     if( p_file->b_read_only )
@@ -371,7 +371,7 @@ int WriteResource( resource_file_t *p_file, char *psz_name, int i_type,
     {
         if( p_file->p_resource[i_tmp_index].i_type != EMPTY_RESOURCE)
         {
-            i_offset = MAX( i_offset, p_file->p_resource[i_tmp_index].i_offset 
+            i_offset = MAX( i_offset, p_file->p_resource[i_tmp_index].i_offset
                             + p_file->p_resource[i_tmp_index].i_size );
         }
         else if( i_index == -1 )
@@ -401,7 +401,7 @@ int WriteResource( resource_file_t *p_file, char *psz_name, int i_type,
 
     /* Update table */
     strncpy( p_file->p_resource[i_index].psz_name, psz_name, RESOURCE_MAX_NAME );
-    p_file->p_resource[i_index].psz_name[RESOURCE_MAX_NAME] = '\0';        
+    p_file->p_resource[i_index].psz_name[RESOURCE_MAX_NAME] = '\0';
     p_file->p_resource[i_index].i_type = i_type;
     p_file->p_resource[i_index].i_offset = i_offset;
     p_file->p_resource[i_index].i_size = size;
index ebf73d419a992acf5f498f40597d5da67a74f88a..add2858db48cd5f41798c452e78814ae3a3a6323 100644 (file)
@@ -1,14 +1,14 @@
-/*******************************************************************************
+/*****************************************************************************
  * spu_decoder.c : spu decoder thread
  * (c)2000 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
 /* repompé sur video_decoder.c
  * ?? passer en terminate/destroy avec les signaux supplémentaires */
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 //#include "vlc.h"
 
 #include <errno.h>
@@ -40,9 +40,9 @@ static void     RunThread           ( spudec_thread_t *p_spudec );
 static void     ErrorThread         ( spudec_thread_t *p_spudec );
 static void     EndThread           ( spudec_thread_t *p_spudec );
 
-/******************************************************************************
+/*****************************************************************************
  * spudec_CreateThread: create a spu decoder thread
- ******************************************************************************/
+ *****************************************************************************/
 spudec_thread_t * spudec_CreateThread( input_thread_t * p_input )
 {
     spudec_thread_t *     p_spudec;
@@ -90,13 +90,13 @@ spudec_thread_t * spudec_CreateThread( input_thread_t * p_input )
     return( p_spudec );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * spudec_DestroyThread: destroy a spu decoder thread
- *******************************************************************************
+ *****************************************************************************
  * Destroy and terminate thread. This function will return 0 if the thread could
  * be destroyed, and non 0 else. The last case probably means that the thread
  * was still active, and another try may succeed.
- *******************************************************************************/
+ *****************************************************************************/
 void spudec_DestroyThread( spudec_thread_t *p_spudec )
 {
     intf_DbgMsg("spudec debug: requesting termination of spu decoder thread %p\n", p_spudec);
@@ -116,13 +116,13 @@ void spudec_DestroyThread( spudec_thread_t *p_spudec )
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * InitThread: initialize spu decoder thread
- *******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
- *******************************************************************************/
+ *****************************************************************************/
 static int InitThread( spudec_thread_t *p_spudec )
 {
     intf_DbgMsg("spudec debug: initializing spu decoder thread %p\n", p_spudec);
@@ -149,12 +149,12 @@ static int InitThread( spudec_thread_t *p_spudec )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * RunThread: spu decoder thread
- *******************************************************************************
+ *****************************************************************************
  * spu decoder thread. This function does only return when the thread is
- * terminated. 
- *******************************************************************************/
+ * terminated.
+ *****************************************************************************/
 static void RunThread( spudec_thread_t *p_spudec )
 {
     intf_DbgMsg("spudec debug: running spu decoder thread (%p) (pid == %i)\n",
@@ -199,13 +199,13 @@ static void RunThread( spudec_thread_t *p_spudec )
     EndThread( p_spudec );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * ErrorThread: RunThread() error loop
- *******************************************************************************
+ *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
- *******************************************************************************/
+ *****************************************************************************/
 static void ErrorThread( spudec_thread_t *p_spudec )
 {
     /* We take the lock, because we are going to read/write the start/end
@@ -230,12 +230,12 @@ static void ErrorThread( spudec_thread_t *p_spudec )
     vlc_mutex_unlock( &p_spudec->fifo.data_lock );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * EndThread: thread destruction
- *******************************************************************************
- * This function is called when the thread ends after a sucessfull 
+ *****************************************************************************
+ * This function is called when the thread ends after a sucessfull
  * initialization.
- *******************************************************************************/
+ *****************************************************************************/
 static void EndThread( spudec_thread_t *p_spudec )
 {
     intf_DbgMsg( "spudec debug: destroying spu decoder thread %p\n", p_spudec );
index 041b9e6b43bd5dc213dd452bff3fff31e5852e8d..0db587b4005b7ac78f1276256ac30e3d57a73643 100644 (file)
@@ -309,7 +309,7 @@ vdec_IDCT:
        psllw $1, %mm6                  /* t146=t152 */
        pmulhw 8*3(%esi), %mm5          /* V3 */
        paddsw %mm6, %mm0               /* V63 */
-/* note that V15 computation has a correction step: 
+/* note that V15 computation has a correction step:
  * this is a 'magic' constant that rebiases the results to be closer to the
  * expected result.  this magic constant can be refined to reduce the error
  * even more by doing the correction step in a later stage when the number
@@ -669,7 +669,7 @@ vdec_IDCT:
        movq scratch3, %mm0
        psraw $4, %mm7
 /* moved up from next block */
-       movq scratch5, %mm6 
+       movq scratch5, %mm6
        psubsw %mm4, %mm1               /* out14 ; free mm4 */
        paddsw %mm3, %mm5               /* out2 */
        psraw $4, %mm1
index e420604eeb163cfa257017fb51f9ad9a8452486b..b9d4c43ee8a420d1eb631b5084270bae04c79d41 100644 (file)
  * vdec_SparseIDCT : IDCT function for sparse matrices
  *****************************************************************************/
 
-void vdec_InitIDCT (vdec_thread_t * p_vdec) 
+void vdec_InitIDCT (vdec_thread_t * p_vdec)
 {
     int i;
-    
+
     dctelem_t * p_pre = p_vdec->p_pre_idct;
     memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
-    
-    for( i=0 ; i < 64 ; i++ ) 
+
+    for( i=0 ; i < 64 ; i++ )
     {
         p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
         vdec_IDCT( p_vdec, &p_pre[i*64], 0) ;
@@ -65,7 +65,7 @@ void vdec_InitIDCT (vdec_thread_t * p_vdec)
     return;
 }
 
-void vdec_SparseIDCT (vdec_thread_t * p_vdec, dctelem_t * p_block, 
+void vdec_SparseIDCT (vdec_thread_t * p_vdec, dctelem_t * p_block,
                       int i_sparse_pos)
 {
     short int val;
@@ -76,7 +76,7 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, dctelem_t * p_block,
     int coeff, rr;
 
     /* If DC Coefficient. */
-    if ( i_sparse_pos == 0 ) 
+    if ( i_sparse_pos == 0 )
     {
         dp=(int *)p_block;
         val=RIGHT_SHIFT((*p_block + 4), 3);
@@ -119,7 +119,7 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, dctelem_t * p_block,
     }
     return;
 }
-      
+
 
 /*****************************************************************************
  * vdec_IDCT : IDCT function for normal matrices
@@ -128,7 +128,7 @@ void vdec_SparseIDCT (vdec_thread_t * p_vdec, dctelem_t * p_block,
 #ifndef HAVE_MMX
 void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
 {
-#if 0 
+#if 0
     /* dct classique: pour tester la meilleure entre la classique et la */
     /* no classique */
     s32 tmp0, tmp1, tmp2, tmp3;
@@ -143,7 +143,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
   /* furthermore, we scale the results by 2**PASS1_BITS. */
 
     dataptr = p_block;
-    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) 
+    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--)
     {
     /* Due to quantization, we will usually find that many of the input
      * coefficients are zero, especially the AC terms.  We can exploit this
@@ -155,11 +155,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
      */
 
         if ((dataptr[1] | dataptr[2] | dataptr[3] | dataptr[4] |
-               dataptr[5] | dataptr[6] | dataptr[7]) == 0) 
+               dataptr[5] | dataptr[6] | dataptr[7]) == 0)
         {
       /* AC terms all zero */
             dctelem_t dcval = (dctelem_t) (dataptr[0] << PASS1_BITS);
-      
+
             dataptr[0] = dcval;
             dataptr[1] = dcval;
             dataptr[2] = dcval;
@@ -168,7 +168,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
             dataptr[5] = dcval;
             dataptr[6] = dcval;
             dataptr[7] = dcval;
-      
+
             dataptr += DCTSIZE;        /* advance pointer to next row */
             continue;
         }
@@ -190,7 +190,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         tmp13 = tmp0 - tmp3;
         tmp11 = tmp1 + tmp2;
         tmp12 = tmp1 - tmp2;
-    
+
     /* Odd part per figure 8; the matrix is unitary and hence its
      * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
      */
@@ -205,7 +205,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         z3 = tmp0 + tmp2;
         z4 = tmp1 + tmp3;
         z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */
-    
+
         tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */
         tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */
         tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */
@@ -214,10 +214,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */
         z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */
         z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */
-    
+
         z3 += z5;
         z4 += z5;
-    
+
         tmp0 += z1 + z3;
         tmp1 += z2 + z4;
         tmp2 += z2 + z3;
@@ -242,7 +242,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
   /* and also undo the PASS1_BITS scaling. */
 
     dataptr = p_block;
-    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) 
+    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--)
     {
     /* Columns of zeroes can be exploited in the same way as we did with rows.
      * However, the row calculation has created many nonzero AC terms, so the
@@ -255,11 +255,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
 #ifndef NO_ZERO_COLUMN_TEST /*ajoute un test mais evite des calculs */
         if ((dataptr[DCTSIZE*1] | dataptr[DCTSIZE*2] | dataptr[DCTSIZE*3] |
            dataptr[DCTSIZE*4] | dataptr[DCTSIZE*5] | dataptr[DCTSIZE*6] |
-           dataptr[DCTSIZE*7]) == 0) 
+           dataptr[DCTSIZE*7]) == 0)
         {
       /* AC terms all zero */
             dctelem_t dcval = (dctelem_t) DESCALE((s32) dataptr[0], PASS1_BITS+3);
-      
+
             dataptr[DCTSIZE*0] = dcval;
             dataptr[DCTSIZE*1] = dcval;
             dataptr[DCTSIZE*2] = dcval;
@@ -268,7 +268,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
             dataptr[DCTSIZE*5] = dcval;
             dataptr[DCTSIZE*6] = dcval;
             dataptr[DCTSIZE*7] = dcval;
-      
+
             dataptr++;         /* advance pointer to next column */
             continue;
         }
@@ -291,7 +291,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         tmp13 = tmp0 - tmp3;
         tmp11 = tmp1 + tmp2;
         tmp12 = tmp1 - tmp2;
-    
+
     /* Odd part per figure 8; the matrix is unitary and hence its
      * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
      */
@@ -306,7 +306,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         z3 = tmp0 + tmp2;
         z4 = tmp1 + tmp3;
         z5 = MULTIPLY(z3 + z4, FIX(1.175875602)); /* sqrt(2) * c3 */
-    
+
         tmp0 = MULTIPLY(tmp0, FIX(0.298631336)); /* sqrt(2) * (-c1+c3+c5-c7) */
         tmp1 = MULTIPLY(tmp1, FIX(2.053119869)); /* sqrt(2) * ( c1+c3-c5+c7) */
         tmp2 = MULTIPLY(tmp2, FIX(3.072711026)); /* sqrt(2) * ( c1+c3+c5-c7) */
@@ -315,10 +315,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         z2 = MULTIPLY(z2, - FIX(2.562915447)); /* sqrt(2) * (-c1-c3) */
         z3 = MULTIPLY(z3, - FIX(1.961570560)); /* sqrt(2) * (-c3-c5) */
         z4 = MULTIPLY(z4, - FIX(0.390180644)); /* sqrt(2) * (c5-c3) */
-    
+
         z3 += z5;
         z4 += z5;
-    
+
         tmp0 += z1 + z3;
         tmp1 += z2 + z4;
         tmp2 += z2 + z3;
@@ -342,29 +342,29 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                                           CONST_BITS+PASS1_BITS+3);
         dataptr[DCTSIZE*4] = (dctelem_t) DESCALE(tmp13 - tmp0,
                                           CONST_BITS+PASS1_BITS+3);
-    
+
         dataptr++;                     /* advance pointer to next column */
     }
-#endif    
+#endif
+
+#if 1  /*dct avec non classique*/
 
-#if 1  /*dct avec non classique*/    
-    
     s32 tmp0, tmp1, tmp2, tmp3;
     s32 tmp10, tmp11, tmp12, tmp13;
     s32 z1, z2, z3, z4, z5;
     s32 d0, d1, d2, d3, d4, d5, d6, d7;
     dctelem_t * dataptr;
     int rowctr;
-    
+
     SHIFT_TEMPS
-   
+
     /* Pass 1: process rows. */
     /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
     /* furthermore, we scale the results by 2**PASS1_BITS. */
 
     dataptr = p_block;
 
-    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) 
+    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--)
     {
         /* Due to quantization, we will usually find that many of the input
          * coefficients are zero, especially the AC terms.  We can exploit this
@@ -378,21 +378,21 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         register int * idataptr = (int*)dataptr;
         d0 = dataptr[0];
         d1 = dataptr[1];
-        if ( (d1 == 0) && ((idataptr[1] | idataptr[2] | idataptr[3]) == 0) ) 
+        if ( (d1 == 0) && ((idataptr[1] | idataptr[2] | idataptr[3]) == 0) )
         {
       /* AC terms all zero */
-            if (d0) 
+            if (d0)
             {
       /* Compute a 32 bit value to assign. */
                 dctelem_t dcval = (dctelem_t) (d0 << PASS1_BITS);
                 register int v = (dcval & 0xffff) | (dcval << 16);
-  
+
                 idataptr[0] = v;
                 idataptr[1] = v;
                 idataptr[2] = v;
                 idataptr[3] = v;
             }
-      
+
             dataptr += DCTSIZE;        /* advance pointer to next row */
             continue;
         }
@@ -405,13 +405,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
 
     /* Even part: reverse the even part of the forward DCT. */
     /* The rotator is sqrt(2)*c(-6). */
-        if (d6) 
+        if (d6)
         {
-            if (d4) 
+            if (d4)
             {
-                if (d2) 
+                if (d2)
                 {
-                           if (d0) 
+                           if (d0)
                     {
             /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */
                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
@@ -425,8 +425,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp13 = tmp0 - tmp3;
                         tmp11 = tmp1 + tmp2;
                         tmp12 = tmp1 - tmp2;
-                    } 
-                    else 
+                    }
+                    else
                     {
                    /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
@@ -434,21 +434,21 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
 
                         tmp0 = d4 << CONST_BITS;
-    
+
                         tmp10 = tmp0 + tmp3;
                         tmp13 = tmp0 - tmp3;
                         tmp11 = tmp2 - tmp0;
                         tmp12 = -(tmp0 + tmp2);
                        }
-                } 
-                else 
+                }
+                else
                 {
-                           if (d0) 
+                           if (d0)
                     {
             /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */
                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
-    
+
                         tmp0 = (d0 + d4) << CONST_BITS;
                         tmp1 = (d0 - d4) << CONST_BITS;
 
@@ -457,26 +457,26 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp11 = tmp1 + tmp2;
                         tmp12 = tmp1 - tmp2;
                        }
-                    else 
+                    else
                     {
                    /* d0 == 0, d2 == 0, d4 != 0, d6 != 0 */
                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
-    
+
                         tmp0 = d4 << CONST_BITS;
+
                         tmp10 = tmp0 + tmp3;
                         tmp13 = tmp0 - tmp3;
                         tmp11 = tmp2 - tmp0;
                         tmp12 = -(tmp0 + tmp2);
                        }
                 }
-            } 
-            else 
+            }
+            else
             {
-                if (d2) 
+                if (d2)
                 {
-                   if (d0) 
+                   if (d0)
                     {
             /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
@@ -484,13 +484,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp3 = z1 + MULTIPLY(d2, FIX(0.765366865));
 
                         tmp0 = d0 << CONST_BITS;
-    
+
                         tmp10 = tmp0 + tmp3;
                         tmp13 = tmp0 - tmp3;
                         tmp11 = tmp0 + tmp2;
                         tmp12 = tmp0 - tmp2;
-                    } 
-                    else 
+                    }
+                    else
                     {
                    /* d0 == 0, d2 != 0, d4 == 0, d6 != 0 */
                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
@@ -503,22 +503,22 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp12 = -tmp2;
                            }
                }
-                else 
+                else
                 {
-                    if (d0) 
+                    if (d0)
                     {
             /* d0 != 0, d2 == 0, d4 == 0, d6 != 0 */
                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
                         tmp3 = MULTIPLY(d6, FIX(0.541196100));
-    
+
                         tmp0 = d0 << CONST_BITS;
-    
+
                         tmp10 = tmp0 + tmp3;
                         tmp13 = tmp0 - tmp3;
                         tmp11 = tmp0 + tmp2;
                         tmp12 = tmp0 - tmp2;
                     }
-                    else 
+                    else
                     {
             /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
                         tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
@@ -534,30 +534,30 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         }
         else
         {
-            if (d4) 
+            if (d4)
             {
-                if (d2) 
+                if (d2)
                 {
-                    if (d0) 
+                    if (d0)
                     {
                    /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
                         tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
-    
+
                         tmp0 = (d0 + d4) << CONST_BITS;
                         tmp1 = (d0 - d4) << CONST_BITS;
-    
+
                         tmp10 = tmp0 + tmp3;
                         tmp13 = tmp0 - tmp3;
                         tmp11 = tmp1 + tmp2;
                         tmp12 = tmp1 - tmp2;
                     }
-                    else 
+                    else
                     {
             /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
                         tmp3 = MULTIPLY(d2, (FIX(1.306562965) + .5));
-    
+
                         tmp0 = d4 << CONST_BITS;
 
                         tmp10 = tmp0 + tmp3;
@@ -566,15 +566,15 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp12 = -(tmp0 + tmp2);
                     }
                 }
-                else 
+                else
                 {
                    if (d0)
                     {
             /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */
                         tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
                         tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
-                    } 
-                    else 
+                    }
+                    else
                     {
             /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
                         tmp10 = tmp13 = d4 << CONST_BITS;
@@ -582,11 +582,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     }
                 }
             }
-            else 
+            else
             {
-                if (d2) 
+                if (d2)
                 {
-                    if (d0) 
+                    if (d0)
                     {
             /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
                         tmp2 = MULTIPLY(d2, FIX(0.541196100));
@@ -617,13 +617,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     {
             /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
                         tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS;
-                    } 
+                    }
                     else
                     {
             /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
                         tmp10 = tmp13 = tmp11 = tmp12 = 0;
                     }
-                }    
+                }
             }
         }
 
@@ -632,13 +632,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
      * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
      */
 
-        if (d7) 
+        if (d7)
             {
                if (d5)
             {
-                if (d3) 
+                if (d3)
                 {
-                    if (d1) 
+                    if (d1)
                     {
             /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
                         z1 = d7 + d1;
@@ -646,8 +646,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z3 = d7 + d3;
                         z4 = d5 + d1;
                         z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
-                   
-                        tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                        tmp0 = MULTIPLY(d7, FIX(0.298631336));
                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
@@ -655,40 +655,40 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z2 = MULTIPLY(z2, - FIX(2.562915447));
                         z3 = MULTIPLY(z3, - FIX(1.961570560));
                         z4 = MULTIPLY(z4, - FIX(0.390180644));
-                   
+               
                         z3 += z5;
                         z4 += z5;
-                   
+               
                         tmp0 += z1 + z3;
                         tmp1 += z2 + z4;
                         tmp2 += z2 + z3;
                         tmp3 += z1 + z4;
-                    } 
-                    else 
+                    }
+                    else
                     {
             /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
                         z2 = d5 + d3;
                         z3 = d7 + d3;
                         z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
-                   
-                        tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                        tmp0 = MULTIPLY(d7, FIX(0.298631336));
                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
                         z1 = MULTIPLY(d7, - FIX(0.899976223));
                         z2 = MULTIPLY(z2, - FIX(2.562915447));
                         z3 = MULTIPLY(z3, - FIX(1.961570560));
                         z4 = MULTIPLY(d5, - FIX(0.390180644));
-                   
+               
                         z3 += z5;
                         z4 += z5;
-                   
+               
                         tmp0 += z1 + z3;
                         tmp1 += z2 + z4;
                         tmp2 += z2 + z3;
                         tmp3 = z1 + z4;
                        }
                    }
-                else 
+                else
                 {
                     if (d1)
                     {
@@ -696,18 +696,18 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z1 = d7 + d1;
                         z4 = d5 + d1;
                         z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
-                   
-                        tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                        tmp0 = MULTIPLY(d7, FIX(0.298631336));
                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
                         z1 = MULTIPLY(z1, - FIX(0.899976223));
                         z2 = MULTIPLY(d5, - FIX(2.562915447));
                         z3 = MULTIPLY(d7, - FIX(1.961570560));
                         z4 = MULTIPLY(z4, - FIX(0.390180644));
-                   
+               
                         z3 += z5;
                         z4 += z5;
-                   
+               
                         tmp0 += z1 + z3;
                         tmp1 += z2 + z4;
                         tmp2 = z2 + z3;
@@ -724,10 +724,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z3 = MULTIPLY(d7, - FIX(1.961570560));
                         z2 = MULTIPLY(d5, - FIX(2.562915447));
                         z4 = MULTIPLY(d5, - FIX(0.390180644));
-                   
+               
                         z3 += z5;
                         z4 += z5;
-                       
+               
                         tmp0 += z3;
                         tmp1 += z4;
                         tmp2 = z2 + z3;
@@ -735,28 +735,28 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     }
                 }
             }
-            else 
+            else
             {
-                if (d3) 
+                if (d3)
                 {
-                    if (d1) 
+                    if (d1)
                     {
             /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
                         z1 = d7 + d1;
                         z3 = d7 + d3;
                         z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
-                   
-                        tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                        tmp0 = MULTIPLY(d7, FIX(0.298631336));
                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
                         z1 = MULTIPLY(z1, - FIX(0.899976223));
                         z2 = MULTIPLY(d3, - FIX(2.562915447));
                         z3 = MULTIPLY(z3, - FIX(1.961570560));
                         z4 = MULTIPLY(d1, - FIX(0.390180644));
-                   
+               
                         z3 += z5;
                         z4 += z5;
-                   
+               
                         tmp0 += z1 + z3;
                         tmp1 = z2 + z4;
                         tmp2 += z2 + z3;
@@ -767,22 +767,22 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
             /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
                         z3 = d7 + d3;
                         z5 = MULTIPLY(z3, FIX(1.175875602));
-                   
+               
                         tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
                         tmp2 = MULTIPLY(d3, FIX(0.509795579));
                         z1 = MULTIPLY(d7, - FIX(0.899976223));
                         z2 = MULTIPLY(d3, - FIX(2.562915447));
                         z3 = MULTIPLY(z3, - FIX2(0.785694958));
-    
+
                         tmp0 += z3;
                         tmp1 = z2 + z5;
                         tmp2 += z3;
                         tmp3 = z1 + z5;
                     }
-                } 
-                else 
+                }
+                else
                 {
-                    if (d1) 
+                    if (d1)
                     {
             /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
                         z1 = d7 + d1;
@@ -793,13 +793,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z1 = MULTIPLY(z1, FIX2(0.275899379));
                         z3 = MULTIPLY(d7, - FIX(1.961570560));
                         z4 = MULTIPLY(d1, - FIX(0.390180644));
-    
+
                         tmp0 += z1;
                         tmp1 = z4 + z5;
                         tmp2 = z3 + z5;
                         tmp3 += z1;
-                    }   
-                else 
+                    }
+                else
                     {
             /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
                         tmp0 = MULTIPLY(d7, - FIX2(1.387039845));
@@ -811,10 +811,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
             }
         }
         else
-        { 
+        {
             if (d5)
             {
-                if (d3) 
+                if (d3)
                 {
                     if (d1)
                     {
@@ -822,7 +822,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z2 = d5 + d3;
                         z4 = d5 + d1;
                         z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
-                   
+               
                         tmp1 = MULTIPLY(d5, FIX(2.053119869));
                         tmp2 = MULTIPLY(d3, FIX(3.072711026));
                         tmp3 = MULTIPLY(d1, FIX(1.501321110));
@@ -830,53 +830,53 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z2 = MULTIPLY(z2, - FIX(2.562915447));
                         z3 = MULTIPLY(d3, - FIX(1.961570560));
                         z4 = MULTIPLY(z4, - FIX(0.390180644));
-                   
+               
                         z3 += z5;
                         z4 += z5;
-                   
+               
                         tmp0 = z1 + z3;
                         tmp1 += z2 + z4;
                         tmp2 += z2 + z3;
                         tmp3 += z1 + z4;
-                    } 
-                    else 
+                    }
+                    else
                     {
             /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
                         z2 = d5 + d3;
                         z5 = MULTIPLY(z2, FIX(1.175875602));
-                   
+               
                         tmp1 = MULTIPLY(d5, FIX2(1.662939225));
                         tmp2 = MULTIPLY(d3, FIX2(1.111140466));
                         z2 = MULTIPLY(z2, - FIX2(1.387039845));
                         z3 = MULTIPLY(d3, - FIX(1.961570560));
                         z4 = MULTIPLY(d5, - FIX(0.390180644));
-                   
+               
                         tmp0 = z3 + z5;
                         tmp1 += z2;
                         tmp2 += z2;
                         tmp3 = z4 + z5;
                     }
                 }
-                else 
+                else
                 {
-                    if (d1) 
+                    if (d1)
                     {
             /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
                         z4 = d5 + d1;
                         z5 = MULTIPLY(z4, FIX(1.175875602));
-                   
+               
                         tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
                         tmp3 = MULTIPLY(d1, FIX2(0.601344887));
                         z1 = MULTIPLY(d1, - FIX(0.899976223));
                         z2 = MULTIPLY(d5, - FIX(2.562915447));
                         z4 = MULTIPLY(z4, FIX2(0.785694958));
-                   
+               
                         tmp0 = z1 + z5;
                         tmp1 += z4;
                         tmp2 = z2 + z5;
                         tmp3 += z4;
                     }
-                    else 
+                    else
                     {
             /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */
                         tmp0 = MULTIPLY(d5, FIX(1.175875602));
@@ -886,11 +886,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     }
                 }
             }
-            else 
+            else
             {
                 if (d3)
                 {
-                    if (d1) 
+                    if (d1)
                     {
             /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
                         z5 = d3 + d1;
@@ -901,13 +901,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         z2 = MULTIPLY(d3, - FIX(2.172734803));
                         z4 = MULTIPLY(z5, FIX(0.785694958));
                         z5 = MULTIPLY(z5, FIX(1.175875602));
-                   
+               
                         tmp0 = z1 - z4;
                         tmp1 = z2 + z4;
                         tmp2 += z5;
                         tmp3 += z5;
                     }
-                    else 
+                    else
                     {
             /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */
                         tmp0 = MULTIPLY(d3, - FIX2(0.785694958));
@@ -916,9 +916,9 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp3 = MULTIPLY(d3, FIX(1.175875602));
                     }
                 }
-                else 
+                else
                 {
-                    if (d1) 
+                    if (d1)
                     {
             /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */
                         tmp0 = MULTIPLY(d1, FIX2(0.275899379));
@@ -926,7 +926,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp2 = MULTIPLY(d1, FIX(1.175875602));
                         tmp3 = MULTIPLY(d1, FIX2(1.387039845));
                     }
-                    else 
+                    else
                     {
             /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
                         tmp0 = tmp1 = tmp2 = tmp3 = 0;
@@ -954,7 +954,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
   /* and also undo the PASS1_BITS scaling. */
 
     dataptr = p_block;
-    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) 
+    for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--)
     {
     /* Columns of zeroes can be exploited in the same way as we did with rows.
      * However, the row calculation has created many nonzero AC terms, so the
@@ -975,9 +975,9 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
 
     /* Even part: reverse the even part of the forward DCT. */
     /* The rotator is sqrt(2)*c(-6). */
-        if (d6) 
+        if (d6)
         {
-            if (d4) 
+            if (d4)
             {
                 if (d2)
                 {
@@ -996,7 +996,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp11 = tmp1 + tmp2;
                         tmp12 = tmp1 - tmp2;
                     }
-                    else 
+                    else
                     {
             /* d0 == 0, d2 != 0, d4 != 0, d6 != 0 */
                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
@@ -1011,7 +1011,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp12 = -(tmp0 + tmp2);
                     }
                 }
-                else 
+                else
                 {
                     if (d0)
                     {
@@ -1044,9 +1044,9 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
             }
             else
             {
-                if (d2) 
+                if (d2)
                 {
-                    if (d0) 
+                    if (d0)
                     {
             /* d0 != 0, d2 != 0, d4 == 0, d6 != 0 */
                         z1 = MULTIPLY(d2 + d6, FIX(0.541196100));
@@ -1072,8 +1072,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                         tmp11 = tmp2;
                         tmp12 = -tmp2;
                     }
-                } 
-                else 
+                }
+                else
                 {
                     if (d0)
                     {
@@ -1087,8 +1087,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp13 = tmp0 - tmp3;
                     tmp11 = tmp0 + tmp2;
                     tmp12 = tmp0 - tmp2;
-                } 
-                else 
+                }
+                else
                 {
             /* d0 == 0, d2 == 0, d4 == 0, d6 != 0 */
                     tmp2 = MULTIPLY(d6, - FIX2(1.306562965));
@@ -1103,11 +1103,11 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
     }
     else
     {
-        if (d4) 
+        if (d4)
         {
-            if (d2) 
+            if (d2)
             {
-                   if (d0) 
+                   if (d0)
                 {
             /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */
                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
@@ -1121,7 +1121,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp11 = tmp1 + tmp2;
                     tmp12 = tmp1 - tmp2;
                 }
-                else 
+                else
                 {
             /* d0 == 0, d2 != 0, d4 != 0, d6 == 0 */
                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
@@ -1135,7 +1135,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp12 = -(tmp0 + tmp2);
                 }
             }
-            else 
+            else
             {
                 if (d0)
                 {
@@ -1143,19 +1143,19 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp10 = tmp13 = (d0 + d4) << CONST_BITS;
                     tmp11 = tmp12 = (d0 - d4) << CONST_BITS;
                 }
-                else 
+                else
                 {
             /* d0 == 0, d2 == 0, d4 != 0, d6 == 0 */
                     tmp10 = tmp13 = d4 << CONST_BITS;
                     tmp11 = tmp12 = -tmp10;
                 }
             }
-        } 
-        else 
+        }
+        else
         {
-        if (d2) 
+        if (d2)
         {
-           if (d0) 
+           if (d0)
             {
             /* d0 != 0, d2 != 0, d4 == 0, d6 == 0 */
                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
@@ -1168,7 +1168,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp11 = tmp0 + tmp2;
                     tmp12 = tmp0 - tmp2;
             }
-            else 
+            else
             {
             /* d0 == 0, d2 != 0, d4 == 0, d6 == 0 */
                     tmp2 = MULTIPLY(d2, FIX(0.541196100));
@@ -1180,14 +1180,14 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp12 = -tmp2;
             }
         }
-        else 
+        else
         {
-            if (d0) 
+            if (d0)
                 {
             /* d0 != 0, d2 == 0, d4 == 0, d6 == 0 */
                     tmp10 = tmp13 = tmp11 = tmp12 = d0 << CONST_BITS;
                 }
-                else 
+                else
                 {
             /* d0 == 0, d2 == 0, d4 == 0, d6 == 0 */
                     tmp10 = tmp13 = tmp11 = tmp12 = 0;
@@ -1199,13 +1199,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
     /* Odd part per figure 8; the matrix is unitary and hence its
      * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
      */
-    if (d7) 
+    if (d7)
     {
-           if (d5) 
+           if (d5)
         {
-            if (d3) 
+            if (d3)
             {
-               if (d1) 
+               if (d1)
                 {
             /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */
                     z1 = d7 + d1;
@@ -1213,8 +1213,8 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     z3 = d7 + d3;
                     z4 = d5 + d1;
                     z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
-                   
-                    tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                    tmp0 = MULTIPLY(d7, FIX(0.298631336));
                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
@@ -1222,79 +1222,79 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     z2 = MULTIPLY(z2, - FIX(2.562915447));
                     z3 = MULTIPLY(z3, - FIX(1.961570560));
                     z4 = MULTIPLY(z4, - FIX(0.390180644));
-                   
+               
                     z3 += z5;
                     z4 += z5;
-                   
+               
                     tmp0 += z1 + z3;
                     tmp1 += z2 + z4;
                     tmp2 += z2 + z3;
                     tmp3 += z1 + z4;
                 }
-                else 
+                else
                 {
             /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */
                     z2 = d5 + d3;
                     z3 = d7 + d3;
                     z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
-                   
-                    tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                    tmp0 = MULTIPLY(d7, FIX(0.298631336));
                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
                     z1 = MULTIPLY(d7, - FIX(0.899976223));
                     z2 = MULTIPLY(z2, - FIX(2.562915447));
                     z3 = MULTIPLY(z3, - FIX(1.961570560));
                     z4 = MULTIPLY(d5, - FIX(0.390180644));
-                   
+               
                     z3 += z5;
                     z4 += z5;
-                   
+               
                     tmp0 += z1 + z3;
                     tmp1 += z2 + z4;
                     tmp2 += z2 + z3;
                     tmp3 = z1 + z4;
                 }
-            } 
+            }
             else
             {
-                if (d1) 
+                if (d1)
                 {
             /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */
                     z1 = d7 + d1;
                     z4 = d5 + d1;
                     z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
-                   
-                    tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                    tmp0 = MULTIPLY(d7, FIX(0.298631336));
                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
                     z1 = MULTIPLY(z1, - FIX(0.899976223));
                     z2 = MULTIPLY(d5, - FIX(2.562915447));
                     z3 = MULTIPLY(d7, - FIX(1.961570560));
                     z4 = MULTIPLY(z4, - FIX(0.390180644));
-                   
+               
                     z3 += z5;
                     z4 += z5;
-                   
+               
                     tmp0 += z1 + z3;
                     tmp1 += z2 + z4;
                     tmp2 = z2 + z3;
                     tmp3 += z1 + z4;
                 }
-                else 
+                else
                 {
             /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */
                     z5 = MULTIPLY(d5 + d7, FIX(1.175875602));
 
-                    tmp0 = MULTIPLY(d7, - FIX2(0.601344887)); 
+                    tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
                     tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
                     z1 = MULTIPLY(d7, - FIX(0.899976223));
                     z3 = MULTIPLY(d7, - FIX(1.961570560));
                     z2 = MULTIPLY(d5, - FIX(2.562915447));
                     z4 = MULTIPLY(d5, - FIX(0.390180644));
-                   
+               
                     z3 += z5;
                     z4 += z5;
-                   
+               
                     tmp0 += z3;
                     tmp1 += z4;
                     tmp2 = z2 + z3;
@@ -1302,60 +1302,60 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                 }
             }
         }
-        else 
+        else
         {
             if (d3)
             {
-                if (d1) 
+                if (d1)
                 {
             /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */
                     z1 = d7 + d1;
                     z3 = d7 + d3;
                     z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
-                   
-                    tmp0 = MULTIPLY(d7, FIX(0.298631336)); 
+               
+                    tmp0 = MULTIPLY(d7, FIX(0.298631336));
                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
                     z1 = MULTIPLY(z1, - FIX(0.899976223));
                     z2 = MULTIPLY(d3, - FIX(2.562915447));
                     z3 = MULTIPLY(z3, - FIX(1.961570560));
                     z4 = MULTIPLY(d1, - FIX(0.390180644));
-                   
+               
                     z3 += z5;
                     z4 += z5;
-                   
+               
                     tmp0 += z1 + z3;
                     tmp1 = z2 + z4;
                     tmp2 += z2 + z3;
                     tmp3 += z1 + z4;
-                } 
-                else 
+                }
+                else
                 {
             /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
                     z3 = d7 + d3;
                     z5 = MULTIPLY(z3, FIX(1.175875602));
-                   
-                    tmp0 = MULTIPLY(d7, - FIX2(0.601344887)); 
+               
+                    tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
                     z1 = MULTIPLY(d7, - FIX(0.899976223));
                     tmp2 = MULTIPLY(d3, FIX(0.509795579));
                     z2 = MULTIPLY(d3, - FIX(2.562915447));
                     z3 = MULTIPLY(z3, - FIX2(0.785694958));
-                   
+               
                     tmp0 += z3;
                     tmp1 = z2 + z5;
                     tmp2 += z3;
                     tmp3 = z1 + z5;
                 }
-            } 
+            }
             else
             {
-                if (d1) 
+                if (d1)
                 {
             /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */
                     z1 = d7 + d1;
                     z5 = MULTIPLY(z1, FIX(1.175875602));
 
-                    tmp0 = MULTIPLY(d7, - FIX2(1.662939224)); 
+                    tmp0 = MULTIPLY(d7, - FIX2(1.662939224));
                     tmp3 = MULTIPLY(d1, FIX2(1.111140466));
                     z1 = MULTIPLY(z1, FIX2(0.275899379));
                     z3 = MULTIPLY(d7, - FIX(1.961570560));
@@ -1366,7 +1366,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp2 = z3 + z5;
                     tmp3 += z1;
                 }
-                else 
+                else
                 {
             /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */
                     tmp0 = MULTIPLY(d7, - FIX2(1.387039845));
@@ -1376,20 +1376,20 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                 }
             }
         }
-    } 
-    else 
+    }
+    else
     {
-        if (d5) 
+        if (d5)
         {
-            if (d3) 
+            if (d3)
             {
-                if (d1) 
+                if (d1)
                 {
             /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */
                     z2 = d5 + d3;
                     z4 = d5 + d1;
                     z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
-                   
+               
                     tmp1 = MULTIPLY(d5, FIX(2.053119869));
                     tmp2 = MULTIPLY(d3, FIX(3.072711026));
                     tmp3 = MULTIPLY(d1, FIX(1.501321110));
@@ -1397,16 +1397,16 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     z2 = MULTIPLY(z2, - FIX(2.562915447));
                     z3 = MULTIPLY(d3, - FIX(1.961570560));
                     z4 = MULTIPLY(z4, - FIX(0.390180644));
-                   
+               
                     z3 += z5;
                     z4 += z5;
-                   
+               
                     tmp0 = z1 + z3;
                     tmp1 += z2 + z4;
                     tmp2 += z2 + z3;
                     tmp3 += z1 + z4;
                 }
-                else 
+                else
                 {
             /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
                     z2 = d5 + d3;
@@ -1417,27 +1417,27 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     z2 = MULTIPLY(z2, - FIX2(1.387039845));
                     z3 = MULTIPLY(d3, - FIX(1.961570560));
                     z4 = MULTIPLY(d5, - FIX(0.390180644));
-                   
+               
                     tmp0 = z3 + z5;
                     tmp1 += z2;
                     tmp2 += z2;
                     tmp3 = z4 + z5;
                 }
-            } 
-            else 
+            }
+            else
             {
-                if (d1) 
+                if (d1)
                 {
             /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
                     z4 = d5 + d1;
                     z5 = MULTIPLY(z4, FIX(1.175875602));
-                   
+               
                     tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
                     tmp3 = MULTIPLY(d1, FIX2(0.601344887));
                     z1 = MULTIPLY(d1, - FIX(0.899976223));
                     z2 = MULTIPLY(d5, - FIX(2.562915447));
                     z4 = MULTIPLY(z4, FIX2(0.785694958));
-                   
+               
                     tmp0 = z1 + z5;
                     tmp1 += z4;
                     tmp2 = z2 + z5;
@@ -1457,7 +1457,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
         {
             if (d3)
             {
-                if (d1) 
+                if (d1)
                 {
             /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */
                     z5 = d3 + d1;
@@ -1468,7 +1468,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     z2 = MULTIPLY(d3, - FIX(2.172734803));
                     z4 = MULTIPLY(z5, FIX(0.785694958));
                     z5 = MULTIPLY(z5, FIX(1.175875602));
-                   
+               
                     tmp0 = z1 - z4;
                     tmp1 = z2 + z4;
                     tmp2 += z5;
@@ -1493,7 +1493,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                     tmp2 = MULTIPLY(d1, FIX(1.175875602));
                     tmp3 = MULTIPLY(d1, FIX2(1.387039845));
                 }
-                else 
+                else
                 {
             /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */
                     tmp0 = tmp1 = tmp2 = tmp3 = 0;
@@ -1520,7 +1520,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
                        CONST_BITS+PASS1_BITS+3);
     dataptr[DCTSIZE*4] = (dctelem_t) DESCALE(tmp13 - tmp0,
                        CONST_BITS+PASS1_BITS+3);
-    
+
     dataptr++;                 /* advance pointer to next column */
     }
 #endif
index 8e3aee3ce97b371d782d884603f4773dce168b57..46a93e3f90dcb389b6f5a5c5a6710d0b65b25044 100644 (file)
@@ -115,7 +115,7 @@ static __inline__ void MotionComponent(
                          {
                              p_dest[i_x+i_x1] = (unsigned int)(p_src[i_x+i_x1] + 1
                                                 + p_src[i_x+i_x1 + i_step])
-                                              >> 1;  
+                                              >> 1;
                          }
                     }
                     p_dest += i_stride;
@@ -137,7 +137,7 @@ static __inline__ void MotionComponent(
                              p_dest[i_x+i_x1]
                                 = ((unsigned int)(
                                       p_src[i_x+i_x1]
-                                    + p_src[i_x+i_x1 + 1] 
+                                    + p_src[i_x+i_x1 + 1]
                                     + p_src[i_x+i_x1 + i_step]
                                     + p_src[i_x+i_x1 + i_step + 1]
                                     + 2) >> 2);
index 2e4ad70573af66b12fcb27f6bd9b6e3e72b92eff..de2ae2310d1b650cb170c0f601ac9fd79a15d6e7 100644 (file)
@@ -1,13 +1,13 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_decoder.c : video decoder thread
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
 /* ?? passer en terminate/destroy avec les signaux supplémentaires */
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 //#include "vlc.h"
 
 #include <errno.h>
@@ -53,14 +53,14 @@ static void     RunThread           ( vdec_thread_t *p_vdec );
 static void     ErrorThread         ( vdec_thread_t *p_vdec );
 static void     EndThread           ( vdec_thread_t *p_vdec );
 
-/*******************************************************************************
+/*****************************************************************************
  * vdec_CreateThread: create a video decoder thread
- *******************************************************************************
+ *****************************************************************************
  * This function creates a new video decoder thread, and returns a pointer
  * to its description. On error, it returns NULL.
  * Following configuration properties are used:
  * ??
- *******************************************************************************/
+ *****************************************************************************/
 vdec_thread_t * vdec_CreateThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
 {
     vdec_thread_t *     p_vdec;
@@ -98,13 +98,13 @@ vdec_thread_t * vdec_CreateThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
     return( p_vdec );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vdec_DestroyThread: destroy a video decoder thread
- *******************************************************************************
+ *****************************************************************************
  * Destroy and terminate thread. This function will return 0 if the thread could
  * be destroyed, and non 0 else. The last case probably means that the thread
  * was still active, and another try may succeed.
- *******************************************************************************/
+ *****************************************************************************/
 void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
 {
     intf_DbgMsg("vdec debug: requesting termination of video decoder thread %p\n", p_vdec);
@@ -126,13 +126,13 @@ void vdec_DestroyThread( vdec_thread_t *p_vdec /*, int *pi_status */ )
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * vdec_InitThread: initialize video decoder thread
- *******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
- *******************************************************************************/
+ *****************************************************************************/
 #ifdef VDEC_SMP
 static int vdec_InitThread( vdec_thread_t *p_vdec )
 #else
@@ -145,7 +145,7 @@ int vdec_InitThread( vdec_thread_t *p_vdec )
 
     /* Initialize other properties */
 #ifdef STATS
-    p_vdec->c_loops = 0;    
+    p_vdec->c_loops = 0;
     p_vdec->c_idle_loops = 0;
     p_vdec->c_decoded_pictures = 0;
     p_vdec->c_decoded_i_pictures = 0;
@@ -169,17 +169,17 @@ int vdec_InitThread( vdec_thread_t *p_vdec )
     }
 
     /* Mark thread as running and return */
-    intf_DbgMsg("vdec debug: InitThread(%p) succeeded\n", p_vdec);    
-    return( 0 );    
+    intf_DbgMsg("vdec debug: InitThread(%p) succeeded\n", p_vdec);
+    return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * ErrorThread: RunThread() error loop
- *******************************************************************************
+ *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
- *******************************************************************************/
+ *****************************************************************************/
 static void ErrorThread( vdec_thread_t *p_vdec )
 {
     macroblock_t *       p_mb;
@@ -192,26 +192,26 @@ static void ErrorThread( vdec_thread_t *p_vdec )
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * EndThread: thread destruction
- *******************************************************************************
- * This function is called when the thread ends after a sucessfull 
+ *****************************************************************************
+ * This function is called when the thread ends after a sucessfull
  * initialization.
- *******************************************************************************/
+ *****************************************************************************/
 static void EndThread( vdec_thread_t *p_vdec )
 {
     intf_DbgMsg("vdec debug: EndThread(%p)\n", p_vdec);
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * AddBlock : add a block
- *******************************************************************************/
+ *****************************************************************************/
 #ifndef HAVE_MMX
 static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
                                  yuv_data_t * p_data, int i_incr )
 {
     int i_x, i_y;
+
     for( i_y = 0; i_y < 8; i_y++ )
     {
         for( i_x = 0; i_x < 8; i_x++ )
@@ -238,7 +238,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-            
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -248,7 +248,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-            
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -258,7 +258,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-            
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -268,7 +268,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-            
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -278,7 +278,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-            
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -288,7 +288,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-            
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -298,7 +298,7 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
             "addl       %2,%0\n\t"
-                       
+
             "movq       (%0),%%mm1\n\t"
             "movq       %%mm1,%%mm2\n\t"
             "punpckhbw  %%mm7,%%mm1\n\t"
@@ -308,15 +308,15 @@ static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
             "packuswb   %%mm1,%%mm2\n\t"
             "movq       %%mm2,(%0)\n\t"
 
-            "emms" 
+            "emms"
              :"+r" (p_data): "r" (p_block),"r" (i_incr+8));
 }
 #endif
 
 
-/*******************************************************************************
+/*****************************************************************************
  * CopyBlock : copy a block
- *******************************************************************************/
+ *****************************************************************************/
 #ifndef HAVE_MMX
 static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
                                   yuv_data_t * p_data, int i_incr )
@@ -349,14 +349,14 @@ static  __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
 
             "movq        32(%1),%%mm0\n\t"
             "packuswb   40(%1),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"           
+            "movq        %%mm0,(%0)\n\t"
             "addl           %2,%0\n\t"
-            
+
             "movq        48(%1),%%mm0\n\t"
             "packuswb   56(%1),%%mm0\n\t"
             "movq        %%mm0,(%0)\n\t"
             "addl           %2,%0\n\t"
-                                                                        
+
             "movq        64(%1),%%mm0\n\t"
             "packuswb   72(%1),%%mm0\n\t"
             "movq        %%mm0,(%0)\n\t"
@@ -381,9 +381,9 @@ static  __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
 #endif
 
 
-/*******************************************************************************
+/*****************************************************************************
  * vdec_DecodeMacroblock : decode a macroblock of a picture
- *******************************************************************************/
+ *****************************************************************************/
 #define DECODEBLOCKS( OPBLOCK )                                         \
 {                                                                       \
     int             i_b, i_mask;                                        \
@@ -460,19 +460,19 @@ void vdec_DecodeMacroblock( vdec_thread_t *p_vdec, macroblock_t * p_mb )
 }
 
 
-/*******************************************************************************
+/*****************************************************************************
  * RunThread: video decoder thread
- *******************************************************************************
+ *****************************************************************************
  * Video decoder thread. This function does only return when the thread is
- * terminated. 
- *******************************************************************************/
+ * terminated.
+ *****************************************************************************/
 static void RunThread( vdec_thread_t *p_vdec )
 {
     intf_DbgMsg("vdec debug: running video decoder thread (%p) (pid == %i)\n",
                 p_vdec, getpid());
 
-    /* 
-     * Initialize thread and free configuration 
+    /*
+     * Initialize thread and free configuration
      */
     p_vdec->b_error = vdec_InitThread( p_vdec );
     if( p_vdec->b_error )
@@ -493,7 +493,7 @@ static void RunThread( vdec_thread_t *p_vdec )
         {
             vdec_DecodeMacroblock( p_vdec, p_mb );
         }
-    } 
+    }
 
     /*
      * Error loop
index 52af642ad023ff4836e8e6074320192213852484..24736badee5f36b8c865bf476bac6fed86458d84 100644 (file)
@@ -1,11 +1,11 @@
-/******************************************************************************
+/*****************************************************************************
  * vout_3dfx.c: 3dfx video output display method for 3dfx cards
  * (c)2000 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 
 #include <errno.h>
 #include <fcntl.h>
 #define BITS_PER_PLANE 16
 #define BYTES_PER_PIXEL 2
 
-/******************************************************************************
+/*****************************************************************************
  * vout_sys_t: 3dfx video output method descriptor
- ******************************************************************************
+ *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the 3dfx specific properties of an output thread.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_sys_s
 {
-    GrLfbInfo_t                 p_buffer_info;            /* back buffer info */
+    GrLfbInfo_t                 p_buffer_info;           /* back buffer info */
 
     /* Dummy video memory */
-    byte_t *                    p_video;                       /* base adress */    
-    size_t                      i_page_size;                     /* page size */
+    byte_t *                    p_video;                      /* base adress */
+    size_t                      i_page_size;                    /* page size */
 
 } vout_sys_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 static int     GlideOpenDisplay   ( vout_thread_t *p_vout );
 static void    GlideCloseDisplay  ( vout_thread_t *p_vout );
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysCreate: allocates 3dfx video thread output method
- ******************************************************************************
+ *****************************************************************************
  * This function allocates and initializes a 3dfx vout method.
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
 {
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {   
+    {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
         return( 1 );
     }
@@ -84,50 +84,50 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysInit: initialize 3dfx video thread output method
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysEnd: terminate 3dfx video thread output method
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysEnd( vout_thread_t *p_vout )
-{       
-    ;    
+{
+    ;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysDestroy: destroy 3dfx video thread output method
- ******************************************************************************
+ *****************************************************************************
  * Terminate an output method created by vout_CreateOutputMethod
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysDestroy( vout_thread_t *p_vout )
 {
     GlideCloseDisplay( p_vout );
     free( p_vout->p_sys );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysManage: handle 3dfx events
- ******************************************************************************
+ *****************************************************************************
  * This function should be called regularly by video output thread. It manages
  * console events. It returns a non null value on error.
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysManage( vout_thread_t *p_vout )
 {
     return 0;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysDisplay: displays previously rendered output
- ******************************************************************************
+ *****************************************************************************
  * This function send the currently rendered image to 3dfx image, waits until
  * it is displayed and switch the two rendering buffers, preparing next frame.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysDisplay( vout_thread_t *p_vout )
 {
     grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
@@ -145,7 +145,7 @@ void vout_SysDisplay( vout_thread_t *p_vout )
 /* following functions are local */
 
 /*****************************************************************************
- * GlideOpenDisplay: open and initialize 3dfx device 
+ * GlideOpenDisplay: open and initialize 3dfx device
  *****************************************************************************/
 
 static int GlideOpenDisplay( vout_thread_t *p_vout )
@@ -228,18 +228,18 @@ static int GlideOpenDisplay( vout_thread_t *p_vout )
     grBufferClear( 0, 0, 0 );
 
     /* Set and initialize buffers */
-    vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer_info.lfbPtr, 
+    vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer_info.lfbPtr,
                      p_front_buffer_info.lfbPtr );
-   
+
     return( 0 );
-}    
+}
 
-/******************************************************************************
- * GlideCloseDisplay: close and reset 3dfx device 
- ******************************************************************************
+/*****************************************************************************
+ * GlideCloseDisplay: close and reset 3dfx device
+ *****************************************************************************
  * Returns all resources allocated by GlideOpenDisplay and restore the original
  * state of the device.
- ******************************************************************************/
+ *****************************************************************************/
 static void GlideCloseDisplay( vout_thread_t *p_vout )
 {
     /* unlock the hidden buffer */
index 77daa5fef8d3b339ebd9c957f4635d742f56450b..f7c24fdb28dedbc3d49559494d13555848b2f4b7 100644 (file)
@@ -1,11 +1,11 @@
-/******************************************************************************
+/*****************************************************************************
  * vout_dummy.c: Dummy video output display method for testing purposes
  * (c)2000 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 
 #include <errno.h>
 #include <fcntl.h>
 #define BITS_PER_PLANE 16
 #define BYTES_PER_PIXEL 2
 
-/******************************************************************************
+/*****************************************************************************
  * vout_sys_t: dummy video output method descriptor
- ******************************************************************************
+ *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the dummy specific properties of an output thread.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_sys_s
 {
     /* Dummy video memory */
-    byte_t *                    p_video;                       /* base adress */    
-    size_t                      i_page_size;                     /* page size */
+    byte_t *                    p_video;                      /* base adress */
+    size_t                      i_page_size;                    /* page size */
 
 } vout_sys_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 static int     DummyOpenDisplay   ( vout_thread_t *p_vout );
 static void    DummyCloseDisplay  ( vout_thread_t *p_vout );
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysCreate: allocates dummy video thread output method
- ******************************************************************************
+ *****************************************************************************
  * This function allocates and initializes a dummy vout method.
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
 {
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {   
+    {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
         return( 1 );
     }
@@ -78,50 +78,50 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysInit: initialize dummy video thread output method
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysEnd: terminate dummy video thread output method
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysEnd( vout_thread_t *p_vout )
-{       
-    ;    
+{
+    ;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysDestroy: destroy dummy video thread output method
- ******************************************************************************
+ *****************************************************************************
  * Terminate an output method created by vout_DummyCreateOutputMethod
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysDestroy( vout_thread_t *p_vout )
 {
     DummyCloseDisplay( p_vout );
     free( p_vout->p_sys );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysManage: handle dummy events
- ******************************************************************************
+ *****************************************************************************
  * This function should be called regularly by video output thread. It manages
  * console events. It returns a non null value on error.
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysManage( vout_thread_t *p_vout )
 {
     return 0;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysDisplay: displays previously rendered output
- ******************************************************************************
+ *****************************************************************************
  * This function send the currently rendered image to dummy image, waits until
  * it is displayed and switch the two rendering buffers, preparing next frame.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysDisplay( vout_thread_t *p_vout )
 {
     ;
@@ -129,14 +129,14 @@ void vout_SysDisplay( vout_thread_t *p_vout )
 
 /* following functions are local */
 
-/******************************************************************************
- * DummyOpenDisplay: open and initialize dummy device 
- ******************************************************************************
+/*****************************************************************************
+ * DummyOpenDisplay: open and initialize dummy device
+ *****************************************************************************
  * ?? The framebuffer mode is only provided as a fast and efficient way to
  * display video, providing the card is configured and the mode ok. It is
  * not portable, and is not supposed to work with many cards. Use at your
  * own risk !
- ******************************************************************************/
+ *****************************************************************************/
 
 static int DummyOpenDisplay( vout_thread_t *p_vout )
 {
@@ -157,17 +157,17 @@ static int DummyOpenDisplay( vout_thread_t *p_vout )
     }
 
     /* Set and initialize buffers */
-    vout_SetBuffers( p_vout, p_vout->p_sys->p_video, 
+    vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
                      p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
     return( 0 );
-}    
+}
 
-/******************************************************************************
- * DummyCloseDisplay: close and reset dummy device 
- ******************************************************************************
+/*****************************************************************************
+ * DummyCloseDisplay: close and reset dummy device
+ *****************************************************************************
  * Returns all resources allocated by DummyOpenDisplay and restore the original
  * state of the device.
- ******************************************************************************/
+ *****************************************************************************/
 static void DummyCloseDisplay( vout_thread_t *p_vout )
 {
     free( p_vout->p_sys->p_video );
index 56bcfa81e0a07c96656882af287f56a5d795e1b6..60907fe327a12b05a9e9d7d74d15dff1123eb77b 100644 (file)
@@ -1,11 +1,11 @@
-/******************************************************************************
+/*****************************************************************************
  * vout_fb.c: Linux framebuffer video output display method
  * (c)1998 VideoLAN
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 
 #include <errno.h>
 #include <fcntl.h>
 #include "intf_msg.h"
 #include "main.h"
 
-/******************************************************************************
+/*****************************************************************************
  * vout_sys_t: video output framebuffer method descriptor
- ******************************************************************************
+ *****************************************************************************
  * This structure is part of the video output thread descriptor.
  * It describes the FB specific properties of an output thread.
- ******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_sys_s
 {
     /* System informations */
-    int                         i_fb_dev;        /* framebuffer device handle */
-    struct fb_var_screeninfo    var_info;    /* framebuffer mode informations */
+    int                         i_fb_dev;       /* framebuffer device handle */
+    struct fb_var_screeninfo    var_info;   /* framebuffer mode informations */
 
     /* Video memory */
-    byte_t *                    p_video;                       /* base adress */    
-    size_t                      i_page_size;                     /* page size */
+    byte_t *                    p_video;                      /* base adress */
+    size_t                      i_page_size;                    /* page size */
 
-    struct fb_cmap              fb_cmap;                 /* original colormap */
-    unsigned short              *fb_palette;              /* original palette */
+    struct fb_cmap              fb_cmap;                /* original colormap */
+    unsigned short              *fb_palette;             /* original palette */
 
 } vout_sys_t;
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 static int     FBOpenDisplay   ( vout_thread_t *p_vout );
 static void    FBCloseDisplay  ( vout_thread_t *p_vout );
 static void    FBSetPalette    ( p_vout_thread_t p_vout,
                                  u16 *red, u16 *green, u16 *blue, u16 *transp );
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysCreate: allocates FB video thread output method
- ******************************************************************************
+ *****************************************************************************
  * This function allocates and initializes a FB vout method.
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
 {
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {   
+    {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
         return( 1 );
     }
@@ -86,51 +86,51 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysInit: initialize framebuffer video thread output method
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
     p_vout->p_set_palette       = FBSetPalette;
     return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysEnd: terminate FB video thread output method
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysEnd( vout_thread_t *p_vout )
-{       
-    ;    
+{
+    ;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysDestroy: destroy FB video thread output method
- ******************************************************************************
+ *****************************************************************************
  * Terminate an output method created by vout_CreateOutputMethod
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysDestroy( vout_thread_t *p_vout )
 {
     FBCloseDisplay( p_vout );
     free( p_vout->p_sys );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysManage: handle FB events
- ******************************************************************************
+ *****************************************************************************
  * This function should be called regularly by video output thread. It manages
  * console events. It returns a non null value on error.
- ******************************************************************************/
+ *****************************************************************************/
 int vout_SysManage( vout_thread_t *p_vout )
 {
     return 0;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SysDisplay: displays previously rendered output
- ******************************************************************************
+ *****************************************************************************
  * This function send the currently rendered image to FB image, waits until
  * it is displayed and switch the two rendering buffers, preparing next frame.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SysDisplay( vout_thread_t *p_vout )
 {
     /* tout est bien affiché, on peut échanger les 2 écrans */
@@ -143,20 +143,20 @@ void vout_SysDisplay( vout_thread_t *p_vout )
 
 /* following functions are local */
 
-/******************************************************************************
- * FBOpenDisplay: open and initialize framebuffer device 
- ******************************************************************************
+/*****************************************************************************
+ * FBOpenDisplay: open and initialize framebuffer device
+ *****************************************************************************
  * ?? The framebuffer mode is only provided as a fast and efficient way to
  * display video, providing the card is configured and the mode ok. It is
  * not portable, and is not supposed to work with many cards. Use at your
  * own risk !
- ******************************************************************************/
+ *****************************************************************************/
 
 static int FBOpenDisplay( vout_thread_t *p_vout )
 {
-    char *psz_device;                               /* framebuffer device path */
-    struct fb_fix_screeninfo    fix_info;       /* framebuffer fix information */
-                                            /* framebuffer palette information */
+    char *psz_device;                             /* framebuffer device path */
+    struct fb_fix_screeninfo    fix_info;     /* framebuffer fix information */
+                                          /* framebuffer palette information */
     /* Open framebuffer device */
     psz_device = main_GetPszVariable( VOUT_FB_DEV_VAR, VOUT_FB_DEV_DEFAULT );
     p_vout->p_sys->i_fb_dev = open( psz_device, O_RDWR);
@@ -166,7 +166,7 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
         return( 1 );
     }
 
-    // ?? here would be the code used to save the current mode and 
+    // ?? here would be the code used to save the current mode and
     // ?? change to the most appropriate mode...
 
     /* Get framebuffer device informations */
@@ -193,7 +193,7 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
         close( p_vout->p_sys->i_fb_dev );
         return( 1 );
     }
-    
+
     /* Get some informations again, in the definitive configuration */
     if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_FSCREENINFO, &fix_info ) ||
         ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &p_vout->p_sys->var_info ) )
@@ -209,7 +209,7 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
     p_vout->i_screen_depth =            p_vout->p_sys->var_info.bits_per_pixel;
     switch( p_vout->i_screen_depth )
     {
-    case 8:                                                          /* 8 bpp */
+    case 8:                                                         /* 8 bpp */
         p_vout->p_sys->fb_palette = malloc( 8 * 256 * sizeof(unsigned short) );
         p_vout->p_sys->fb_cmap.start = 0;
         p_vout->p_sys->fb_cmap.len = 256;
@@ -228,23 +228,23 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
         p_vout->i_bytes_per_line = p_vout->i_width;
         break;
 
-    case 15:                       /* 15 bpp (16bpp with a missing green bit) */
-    case 16:                                         /* 16 bpp (65536 colors) */
+    case 15:                      /* 15 bpp (16bpp with a missing green bit) */
+    case 16:                                        /* 16 bpp (65536 colors) */
         p_vout->i_bytes_per_pixel = 2;
         p_vout->i_bytes_per_line = p_vout->i_width * 2;
         break;
 
-    case 24:                                   /* 24 bpp (millions of colors) */
+    case 24:                                  /* 24 bpp (millions of colors) */
         p_vout->i_bytes_per_pixel = 3;
         p_vout->i_bytes_per_line = p_vout->i_width * 3;
         break;
 
-    case 32:                                   /* 32 bpp (millions of colors) */
+    case 32:                                  /* 32 bpp (millions of colors) */
         p_vout->i_bytes_per_pixel = 4;
         p_vout->i_bytes_per_line = p_vout->i_width * 4;
         break;
 
-    default:                                      /* unsupported screen depth */
+    default:                                     /* unsupported screen depth */
         intf_ErrMsg("vout error: screen depth %d is not supported\n",
                                     p_vout->i_screen_depth);
         return( 1  );
@@ -281,19 +281,19 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
     }
 
     /* Set and initialize buffers */
-    vout_SetBuffers( p_vout, p_vout->p_sys->p_video, 
+    vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
                      p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
     intf_DbgMsg("framebuffer type=%d, visual=%d, ypanstep=%d, ywrap=%d, accel=%d\n",
                 fix_info.type, fix_info.visual, fix_info.ypanstep, fix_info.ywrapstep, fix_info.accel );
     return( 0 );
-}    
+}
 
-/******************************************************************************
- * FBCloseDisplay: close and reset framebuffer device 
- ******************************************************************************
+/*****************************************************************************
+ * FBCloseDisplay: close and reset framebuffer device
+ *****************************************************************************
  * Returns all resources allocated by FBOpenDisplay and restore the original
  * state of the device.
- ******************************************************************************/
+ *****************************************************************************/
 static void FBCloseDisplay( vout_thread_t *p_vout )
 {
     /* Restore palette */
@@ -304,16 +304,16 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
     }
 
     // Destroy window and close display
-    close( p_vout->p_sys->i_fb_dev );    
+    close( p_vout->p_sys->i_fb_dev );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * FBSetPalette: sets an 8 bpp palette
- ******************************************************************************
+ *****************************************************************************
  * This function sets the palette given as an argument. It does not return
  * anything, but could later send information on which colors it was unable
  * to set.
- ******************************************************************************/
+ *****************************************************************************/
 static void    FBSetPalette   ( p_vout_thread_t p_vout,
                                 u16 *red, u16 *green, u16 *blue, u16 *transp )
 {
index 2438e87549699f978f4d550cee918375b35cb3f4..6a5936d7ad17e449cd5678e4f7ca18e5e65083da 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * vout_ggi.c: GGI video output display method
  * (c)1998 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
 #include "video_sys.h"
 #include "intf_msg.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_sys_t: video output GGI method descriptor
- *******************************************************************************
+ *****************************************************************************
  * This structure is part of the video output thread descriptor.
- * It describes the GGI specific properties of an output thread. 
- *******************************************************************************/
+ * It describes the GGI specific properties of an output thread.
+ *****************************************************************************/
 typedef struct vout_sys_s
-{ 
+{
     /* GGI system informations */
-    ggi_visual_t        p_display;                           /* display device */
+    ggi_visual_t        p_display;                         /* display device */
 
     /* Buffers informations */
-    ggi_directbuffer *  p_buffer[2];                                /* buffers */
-    boolean_t           b_must_acquire;     /* must be acquired before writing */    
+    ggi_directbuffer *  p_buffer[2];                              /* buffers */
+    boolean_t           b_must_acquire;   /* must be acquired before writing */
 } vout_sys_t;
 
-/*******************************************************************************
+/*****************************************************************************
  * Local prototypes
- *******************************************************************************/
+ *****************************************************************************/
 static int     GGIOpenDisplay   ( vout_thread_t *p_vout, char *psz_display );
 static void    GGICloseDisplay  ( vout_thread_t *p_vout );
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysCreate: allocate GGI video thread output method
- *******************************************************************************
+ *****************************************************************************
  * This function allocate and initialize a GGI vout method. It uses some of the
- * vout properties to choose the correct mode, and change them according to the 
+ * vout properties to choose the correct mode, and change them according to the
  * mode actually used.
- *******************************************************************************/
+ *****************************************************************************/
 int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
-{    
+{
     /* Allocate structure */
-    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );    
+    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
@@ -63,34 +63,34 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window
     /* Open and initialize device */
     if( GGIOpenDisplay( p_vout, psz_display ) )
     {
-        intf_ErrMsg("error: can't initialize GGI display\n");        
+        intf_ErrMsg("error: can't initialize GGI display\n");
         free( p_vout->p_sys );
-        return( 1 );        
+        return( 1 );
     }
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysInit: initialize GGI video thread output method
- *******************************************************************************
+ *****************************************************************************
  * This function initialize the GGI display device.
- *******************************************************************************/
+ *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
     /* Acquire first buffer */
     if( p_vout->p_sys->b_must_acquire )
     {
-        ggiResourceAcquire( p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->resource, GGI_ACTYPE_WRITE );        
-    }    
+        ggiResourceAcquire( p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->resource, GGI_ACTYPE_WRITE );
+    }
 
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysEnd: terminate Sys video thread output method
- *******************************************************************************
+ *****************************************************************************
  * Terminate an output method created by vout_SysCreateOutputMethod
- *******************************************************************************/
+ *****************************************************************************/
 void vout_SysEnd( vout_thread_t *p_vout )
 {
     /* Release buffer */
@@ -100,88 +100,88 @@ void vout_SysEnd( vout_thread_t *p_vout )
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysDestroy: destroy Sys video thread output method
- *******************************************************************************
+ *****************************************************************************
  * Terminate an output method created by vout_SysCreateOutputMethod
- *******************************************************************************/
+ *****************************************************************************/
 void vout_SysDestroy( vout_thread_t *p_vout )
 {
     GGICloseDisplay( p_vout );
     free( p_vout->p_sys );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysManage: handle Sys events
- *******************************************************************************
- * This function should be called regularly by video output thread. It returns 
+ *****************************************************************************
+ * This function should be called regularly by video output thread. It returns
  * a non null value if an error occured.
- *******************************************************************************/
+ *****************************************************************************/
 int vout_SysManage( vout_thread_t *p_vout )
 {
     //?? 8bpp: change palette
-    return( 0 );    
+    return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysDisplay: displays previously rendered output
- *******************************************************************************
+ *****************************************************************************
  * This function send the currently rendered image to the display, wait until
  * it is displayed and switch the two rendering buffer, preparing next frame.
- *******************************************************************************/
+ *****************************************************************************/
 void vout_SysDisplay( vout_thread_t *p_vout )
 {
     /* Change display frame */
     if( p_vout->p_sys->b_must_acquire )
-    {            
+    {
         ggiResourceRelease( p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->resource );
-    }    
-    ggiFlush( p_vout->p_sys->p_display ); // ??    
-    ggiSetDisplayFrame( p_vout->p_sys->p_display, 
-                        p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->frame );      
-        
+    }
+    ggiFlush( p_vout->p_sys->p_display ); // ??
+    ggiSetDisplayFrame( p_vout->p_sys->p_display,
+                        p_vout->p_sys->p_buffer[ p_vout->i_buffer_index ]->frame );
+
     /* Swap buffers and change write frame */
     if( p_vout->p_sys->b_must_acquire )
-    {            
-        ggiResourceAcquire( p_vout->p_sys->p_buffer[ (p_vout->i_buffer_index + 1) & 1]->resource, 
+    {
+        ggiResourceAcquire( p_vout->p_sys->p_buffer[ (p_vout->i_buffer_index + 1) & 1]->resource,
                             GGI_ACTYPE_WRITE );
-    } 
+    }
     ggiSetWriteFrame( p_vout->p_sys->p_display,
-                      p_vout->p_sys->p_buffer[ (p_vout->i_buffer_index + 1) & 1]->frame );    
+                      p_vout->p_sys->p_buffer[ (p_vout->i_buffer_index + 1) & 1]->frame );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysGetVisual: send visual to interface driver
- *******************************************************************************
+ *****************************************************************************
  * This function is not part of the regular vout_Sys* API, but is used by GGI
  * interface to get back visual display pointer once the output thread has
  * been spawned. This visual is used to keep track of keyboard events.
- *******************************************************************************/
+ *****************************************************************************/
 ggi_visual_t    vout_SysGetVisual( vout_thread_t *p_vout )
 {
-    return( p_vout->p_sys->p_display );    
+    return( p_vout->p_sys->p_display );
 }
 
 /* following functions are local */
 
-/*******************************************************************************
- * GGIOpenDisplay: open and initialize GGI device 
- *******************************************************************************
+/*****************************************************************************
+ * GGIOpenDisplay: open and initialize GGI device
+ *****************************************************************************
  * Open and initialize display according to preferences specified in the vout
  * thread fields.
- *******************************************************************************/
+ *****************************************************************************/
 static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display )
 {
-    ggi_mode    mode;                                       /* mode descriptor */    
-    ggi_color   col_fg;                                    /* foreground color */    
-    ggi_color   col_bg;                                    /* background color */    
-    int         i_index;                                 /* all purposes index */    
-    
+    ggi_mode    mode;                                     /* mode descriptor */
+    ggi_color   col_fg;                                  /* foreground color */
+    ggi_color   col_bg;                                  /* background color */
+    int         i_index;                               /* all purposes index */
+
     /* Initialize library */
     if( ggiInit() )
     {
         intf_ErrMsg("error: can't initialize GGI library\n");
-        return( 1 );        
+        return( 1 );
     }
 
     /* Open display */
@@ -190,49 +190,49 @@ static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display )
     {
         intf_ErrMsg("error: can't open GGI default display\n");
         ggiExit();
-        return( 1 );        
+        return( 1 );
     }
-    
+
     /* Find most appropriate mode */
-    mode.frames =       2;                                        /* 2 buffers */
-    mode.visible.x =    p_vout->i_width;                      /* minimum width */
-    mode.visible.y =    p_vout->i_height;                    /* minimum height */    
+    mode.frames =       2;                                      /* 2 buffers */
+    mode.visible.x =    p_vout->i_width;                    /* minimum width */
+    mode.visible.y =    p_vout->i_height;                  /* minimum height */
     mode.virt.x =       GGI_AUTO;
     mode.virt.y =       GGI_AUTO;
     mode.size.x =       GGI_AUTO;
     mode.size.y =       GGI_AUTO;
-    mode.graphtype =    GT_15BIT;               /* minimum usable screen depth */
+    mode.graphtype =    GT_15BIT;             /* minimum usable screen depth */
     mode.dpp.x =        GGI_AUTO;
-    mode.dpp.y =        GGI_AUTO;    
+    mode.dpp.y =        GGI_AUTO;
     ggiCheckMode( p_vout->p_sys->p_display, &mode );
 
     /* Check that returned mode has some minimum properties */
     //??
-    
+
     /* Set mode */
     if( ggiSetMode( p_vout->p_sys->p_display, &mode ) )
     {
         intf_ErrMsg("error: can't set GGI mode\n");
-        ggiClose( p_vout->p_sys->p_display );        
+        ggiClose( p_vout->p_sys->p_display );
         ggiExit();
-        return( 1 );        
-    }            
+        return( 1 );
+    }
 
     /* Check buffers properties */
-    p_vout->p_sys->b_must_acquire = 0;    
+    p_vout->p_sys->b_must_acquire = 0;
     for( i_index = 0; i_index < 2; i_index++ )
     {
         /* Get buffer address */
-        p_vout->p_sys->p_buffer[ i_index ] = 
+        p_vout->p_sys->p_buffer[ i_index ] =
             ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
         if( p_vout->p_sys->p_buffer[ i_index ] == NULL )
         {
             intf_ErrMsg("error: double buffering is not possible\n");
-            ggiClose( p_vout->p_sys->p_display );        
+            ggiClose( p_vout->p_sys->p_display );
             ggiExit();
-            return( 1 );            
-        }        
-        
+            return( 1 );
+        }
+
         /* Check buffer properties */
         if( ! (p_vout->p_sys->p_buffer[ i_index ]->type & GGI_DB_SIMPLE_PLB) ||
             (p_vout->p_sys->p_buffer[ i_index ]->page_size != 0) ||
@@ -241,77 +241,77 @@ static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display )
             (p_vout->p_sys->p_buffer[ i_index ]->align != 0) )
         {
             intf_ErrMsg("error: incorrect video memory type\n");
-            ggiClose( p_vout->p_sys->p_display );        
+            ggiClose( p_vout->p_sys->p_display );
             ggiExit();
-            return( 1 ); 
-        } 
+            return( 1 );
+        }
 
         /* Check if buffer needs to be acquired before write */
         if( ggiResourceMustAcquire( p_vout->p_sys->p_buffer[ i_index ]->resource ) )
         {
-            p_vout->p_sys->b_must_acquire = 1;            
-        }            
-    } 
+            p_vout->p_sys->b_must_acquire = 1;
+        }
+    }
 #ifdef DEBUG
     if( p_vout->p_sys->b_must_acquire )
     {
-        intf_DbgMsg("buffers must be acquired\n");        
-    }    
+        intf_DbgMsg("buffers must be acquired\n");
+    }
 #endif
 
     /* Set graphic context colors */
-    col_fg.r = col_fg.g = col_fg.b = -1;    
-    col_bg.r = col_bg.g = col_bg.b = 0;    
-    if( ggiSetGCForeground(p_vout->p_sys->p_display, 
+    col_fg.r = col_fg.g = col_fg.b = -1;
+    col_bg.r = col_bg.g = col_bg.b = 0;
+    if( ggiSetGCForeground(p_vout->p_sys->p_display,
                            ggiMapColor(p_vout->p_sys->p_display,&col_fg)) ||
-        ggiSetGCBackground(p_vout->p_sys->p_display, 
+        ggiSetGCBackground(p_vout->p_sys->p_display,
                            ggiMapColor(p_vout->p_sys->p_display,&col_bg)) )
     {
         intf_ErrMsg("error: can't set colors\n");
-        ggiClose( p_vout->p_sys->p_display );        
+        ggiClose( p_vout->p_sys->p_display );
         ggiExit();
-        return( 1 );  
-    }    
+        return( 1 );
+    }
 
     /* Set clipping for text */
-    if( ggiSetGCClipping(p_vout->p_sys->p_display, 0, 0, 
+    if( ggiSetGCClipping(p_vout->p_sys->p_display, 0, 0,
                          mode.visible.x, mode.visible.y ) )
     {
         intf_ErrMsg("error: can't set clipping\n");
-        ggiClose( p_vout->p_sys->p_display );        
+        ggiClose( p_vout->p_sys->p_display );
         ggiExit();
-        return( 1 );  
+        return( 1 );
     }
-    
+
     /* Set thread information */
-    p_vout->i_width =           mode.visible.x;    
+    p_vout->i_width =           mode.visible.x;
     p_vout->i_height =          mode.visible.y;
-    p_vout->i_bytes_per_line =  p_vout->p_sys->p_buffer[ 0 ]->buffer.plb.stride;    
+    p_vout->i_bytes_per_line =  p_vout->p_sys->p_buffer[ 0 ]->buffer.plb.stride;
     p_vout->i_screen_depth =    p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.depth;
-    p_vout->i_bytes_per_pixel = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.size / 8;    
+    p_vout->i_bytes_per_pixel = p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.size / 8;
     p_vout->i_red_mask =        p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.red_mask;
     p_vout->i_green_mask =      p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.green_mask;
-    p_vout->i_blue_mask =       p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.blue_mask;            
+    p_vout->i_blue_mask =       p_vout->p_sys->p_buffer[ 0 ]->buffer.plb->pixelformat.blue_mask;
     //?? palette in 8bpp
-    
+
     /* Set and initialize buffers */
     vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer[ 0 ]->write, p_vout->p_sys->p_buffer[ 1 ]->write );
 
-    return( 0 );    
+    return( 0 );
 }
 
-/*******************************************************************************
- * GGICloseDisplay: close and reset GGI device 
- *******************************************************************************
+/*****************************************************************************
+ * GGICloseDisplay: close and reset GGI device
+ *****************************************************************************
  * This function returns all resources allocated by GGIOpenDisplay and restore
  * the original state of the device.
- *******************************************************************************/
+ *****************************************************************************/
 static void GGICloseDisplay( vout_thread_t *p_vout )
 {
     // Restore original mode and close display
-    ggiClose( p_vout->p_sys->p_display );    
+    ggiClose( p_vout->p_sys->p_display );
 
     // Exit library
-    ggiExit();    
+    ggiExit();
 }
 
index b7c0dd66319827fa8c22c54090fa7ea44e5a2a36..32bf673ed61b143e28eb78075113c8a1d1fa1830 100644 (file)
@@ -1,15 +1,15 @@
-/******************************************************************************
+/*****************************************************************************
  * video_output.c : video output thread
  * (c)2000 VideoLAN
- ******************************************************************************
+ *****************************************************************************
  * This module describes the programming interface for video output threads.
  * It includes functions allowing to open a new thread, send pictures to a
  * thread, and destroy a previously oppenned video output thread.
- ******************************************************************************/
+ *****************************************************************************/
 
-/******************************************************************************
+/*****************************************************************************
  * Preamble
- ******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -27,9 +27,9 @@
 #include "intf_msg.h"
 #include "main.h"
 
-/******************************************************************************
+/*****************************************************************************
  * Local prototypes
- ******************************************************************************/
+ *****************************************************************************/
 static int      BinaryLog         ( u32 i );
 static void     MaskToShift       ( int *pi_left, int *pi_right, u32 i_mask );
 static int      InitThread        ( vout_thread_t *p_vout );
@@ -37,7 +37,7 @@ static void     RunThread         ( vout_thread_t *p_vout );
 static void     ErrorThread       ( vout_thread_t *p_vout );
 static void     EndThread         ( vout_thread_t *p_vout );
 static void     DestroyThread     ( vout_thread_t *p_vout, int i_status );
-static void     Print             ( vout_thread_t *p_vout, int i_x, int i_y, 
+static void     Print             ( vout_thread_t *p_vout, int i_x, int i_y,
                                     int i_h_align, int i_v_align,
                                     unsigned char *psz_text );
 static void     SetBufferArea     ( vout_thread_t *p_vout, int i_x, int i_y,
@@ -57,31 +57,31 @@ static int      Align             ( vout_thread_t *p_vout, int *pi_x,
 static void     SetPalette        ( p_vout_thread_t p_vout, u16 *red,
                                     u16 *green, u16 *blue, u16 *transp );
 
-/******************************************************************************
+/*****************************************************************************
  * vout_CreateThread: creates a new video output thread
- ******************************************************************************
+ *****************************************************************************
  * This function creates a new video output thread, and returns a pointer
  * to its description. On error, it returns NULL.
  * If pi_status is NULL, then the function will block until the thread is ready.
  * If not, it will be updated using one of the THREAD_* constants.
- ******************************************************************************/
-vout_thread_t * vout_CreateThread               ( char *psz_display, int i_root_window, 
+ *****************************************************************************/
+vout_thread_t * vout_CreateThread               ( char *psz_display, int i_root_window,
                                                   int i_width, int i_height, int *pi_status )
 {
-    vout_thread_t * p_vout;                              /* thread descriptor */
-    int             i_status;                                /* thread status */
-    int             i_index;                /* index for array initialization */
+    vout_thread_t * p_vout;                             /* thread descriptor */
+    int             i_status;                               /* thread status */
+    int             i_index;               /* index for array initialization */
 
     /* Allocate descriptor */
-    intf_DbgMsg("\n");    
+    intf_DbgMsg("\n");
     p_vout = (vout_thread_t *) malloc( sizeof(vout_thread_t) );
     if( p_vout == NULL )
     {
-        intf_ErrMsg("error: %s\n", strerror(ENOMEM));        
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
         return( NULL );
     }
 
-    /* Initialize thread properties - thread id and locks will be initialized 
+    /* Initialize thread properties - thread id and locks will be initialized
      * later */
     p_vout->b_die               = 0;
     p_vout->b_error             = 0;
@@ -105,7 +105,7 @@ vout_thread_t * vout_CreateThread               ( char *psz_display, int i_root_
     p_vout->b_scale             = 0;
 
     p_vout->p_set_palette       = SetPalette;
-    
+
     intf_DbgMsg("wished configuration: %dx%d, %d/%d bpp (%d Bpl)\n",
                 p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth,
                 p_vout->i_bytes_per_pixel * 8, p_vout->i_bytes_per_line );
@@ -117,15 +117,15 @@ vout_thread_t * vout_CreateThread               ( char *psz_display, int i_root_
 
 #ifdef STATS
     /* Initialize statistics fields */
-    p_vout->render_time         = 0;    
-    p_vout->c_fps_samples       = 0;    
-#endif      
+    p_vout->render_time         = 0;
+    p_vout->c_fps_samples       = 0;
+#endif
 
     /* Initialize buffer index */
     p_vout->i_buffer_index      = 0;
 
     /* Initialize pictures and subpictures - translation tables and functions
-     * will be initialized later in InitThread */    
+     * will be initialized later in InitThread */
     for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++)
     {
         p_vout->p_picture[i_index].i_type   =   EMPTY_PICTURE;
@@ -133,7 +133,7 @@ vout_thread_t * vout_CreateThread               ( char *psz_display, int i_root_
         p_vout->p_subpicture[i_index].i_type  = EMPTY_SUBPICTURE;
         p_vout->p_subpicture[i_index].i_status= FREE_SUBPICTURE;
     }
-   
+
     /* Create and initialize system-dependant method - this function issues its
      * own error messages */
     if( vout_SysCreate( p_vout, psz_display, i_root_window ) )
@@ -155,77 +155,77 @@ vout_thread_t * vout_CreateThread               ( char *psz_display, int i_root_
     p_vout->i_white_pixel = RGB2PIXEL( p_vout, 255, 255, 255 );
     p_vout->i_black_pixel = RGB2PIXEL( p_vout, 0, 0, 0 );
     p_vout->i_gray_pixel  = RGB2PIXEL( p_vout, 128, 128, 128 );
-    p_vout->i_blue_pixel  = RGB2PIXEL( p_vout, 0, 0, 50 );    
+    p_vout->i_blue_pixel  = RGB2PIXEL( p_vout, 0, 0, 50 );
 
     /* Load fonts - fonts must be initialized after the systme method since
      * they may be dependant of screen depth and other thread properties */
-    p_vout->p_default_font      = vout_LoadFont( VOUT_DEFAULT_FONT );    
+    p_vout->p_default_font      = vout_LoadFont( VOUT_DEFAULT_FONT );
     if( p_vout->p_default_font == NULL )
     {
-        vout_SysDestroy( p_vout );        
-        free( p_vout );        
-        return( NULL );        
-    }    
-    p_vout->p_large_font        = vout_LoadFont( VOUT_LARGE_FONT );        
+        vout_SysDestroy( p_vout );
+        free( p_vout );
+        return( NULL );
+    }
+    p_vout->p_large_font        = vout_LoadFont( VOUT_LARGE_FONT );
     if( p_vout->p_large_font == NULL )
     {
-        vout_UnloadFont( p_vout->p_default_font );        
-        vout_SysDestroy( p_vout );        
-        free( p_vout );        
-        return( NULL );        
-    }     
+        vout_UnloadFont( p_vout->p_default_font );
+        vout_SysDestroy( p_vout );
+        free( p_vout );
+        return( NULL );
+    }
 
     /* Create thread and set locks */
     vlc_mutex_init( &p_vout->picture_lock );
-    vlc_mutex_init( &p_vout->subpicture_lock );    
-    vlc_mutex_init( &p_vout->change_lock );    
-    vlc_mutex_lock( &p_vout->change_lock );    
+    vlc_mutex_init( &p_vout->subpicture_lock );
+    vlc_mutex_init( &p_vout->change_lock );
+    vlc_mutex_lock( &p_vout->change_lock );
     if( vlc_thread_create( &p_vout->thread_id, "video output", (void *) RunThread, (void *) p_vout) )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
         vout_UnloadFont( p_vout->p_default_font );
-        vout_UnloadFont( p_vout->p_large_font );        
+        vout_UnloadFont( p_vout->p_large_font );
        vout_SysDestroy( p_vout );
         free( p_vout );
         return( NULL );
-    }   
+    }
 
-    intf_Msg("Video display initialized (%dx%d, %d/%d bpp)\n", p_vout->i_width, 
+    intf_Msg("Video display initialized (%dx%d, %d/%d bpp)\n", p_vout->i_width,
              p_vout->i_height, p_vout->i_screen_depth, p_vout->i_bytes_per_pixel * 8 );
 
     /* If status is NULL, wait until the thread is created */
     if( pi_status == NULL )
     {
         do
-        {            
+        {
             msleep( THREAD_SLEEP );
-        }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR) 
+        }while( (i_status != THREAD_READY) && (i_status != THREAD_ERROR)
                 && (i_status != THREAD_FATAL) );
         if( i_status != THREAD_READY )
         {
-            return( NULL );            
-        }        
+            return( NULL );
+        }
     }
     return( p_vout );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_DestroyThread: destroys a previously created thread
- ******************************************************************************
- * Destroy a terminated thread. 
+ *****************************************************************************
+ * Destroy a terminated thread.
  * The function will request a destruction of the specified thread. If pi_error
- * is NULL, it will return once the thread is destroyed. Else, it will be 
+ * is NULL, it will return once the thread is destroyed. Else, it will be
  * update using one of the THREAD_* constants.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
-{  
-    int     i_status;                                        /* thread status */
+{
+    int     i_status;                                       /* thread status */
 
     /* Set status */
     intf_DbgMsg("\n");
     p_vout->pi_status = (pi_status != NULL) ? pi_status : &i_status;
-    *p_vout->pi_status = THREAD_DESTROY;    
-     
+    *p_vout->pi_status = THREAD_DESTROY;
+
     /* Request thread destruction */
     p_vout->b_die = 1;
 
@@ -235,32 +235,32 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
         do
         {
             msleep( THREAD_SLEEP );
-        }while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR) 
-                && (i_status != THREAD_FATAL) );   
+        }while( (i_status != THREAD_OVER) && (i_status != THREAD_ERROR)
+                && (i_status != THREAD_FATAL) );
     }
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_DisplaySubPicture: display a subpicture unit
- ******************************************************************************
- * Remove the reservation flag of an subpicture, which will cause it to be ready 
+ *****************************************************************************
+ * Remove the reservation flag of an subpicture, which will cause it to be ready
  * for display. The picture does not need to be locked, since it is ignored by
  * the output thread if is reserved.
- ******************************************************************************/
+ *****************************************************************************/
 void  vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
 {
 #ifdef DEBUG_VIDEO
-    char        psz_begin_date[MSTRTIME_MAX_SIZE];  /* buffer for date string */
-    char        psz_end_date[MSTRTIME_MAX_SIZE];    /* buffer for date string */
+    char        psz_begin_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */
+    char        psz_end_date[MSTRTIME_MAX_SIZE];   /* buffer for date string */
 #endif
 
 #ifdef DEBUG
     /* Check if status is valid */
     if( p_subpic->i_status != RESERVED_SUBPICTURE )
     {
-        intf_DbgMsg("error: subpicture %p has invalid status %d\n", p_subpic, 
-                    p_subpic->i_status );       
-    }   
+        intf_DbgMsg("error: subpicture %p has invalid status %d\n", p_subpic,
+                    p_subpic->i_status );
+    }
 #endif
 
     /* Remove reservation flag */
@@ -268,33 +268,33 @@ void  vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
 
 #ifdef DEBUG_VIDEO
     /* Send subpicture informations */
-    intf_DbgMsg("subpicture %p: type=%d, begin date=%s, end date=%s\n", 
-                p_subpic, p_subpic->i_type, 
-                mstrtime( psz_begin_date, p_subpic->begin_date ), 
-                mstrtime( psz_end_date, p_subpic->end_date ) );    
+    intf_DbgMsg("subpicture %p: type=%d, begin date=%s, end date=%s\n",
+                p_subpic, p_subpic->i_type,
+                mstrtime( psz_begin_date, p_subpic->begin_date ),
+                mstrtime( psz_end_date, p_subpic->end_date ) );
 #endif
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_CreateSubPicture: allocate an subpicture in the video output heap.
- ******************************************************************************
- * This function create a reserved subpicture in the video output heap. 
+ *****************************************************************************
+ * This function create a reserved subpicture in the video output heap.
  * A null pointer is returned if the function fails. This method provides an
  * already allocated zone of memory in the spu data fields. It needs locking
- * since several pictures can be created by several producers threads. 
- ******************************************************************************/
-subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type, 
+ * since several pictures can be created by several producers threads.
+ *****************************************************************************/
+subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
                                      int i_size )
 {
-    int                 i_subpic;                          /* subpicture index */
-    subpicture_t *      p_free_subpic = NULL;         /* first free subpicture */    
-    subpicture_t *      p_destroyed_subpic = NULL;   /* first destroyed subpic */
+    int                 i_subpic;                        /* subpicture index */
+    subpicture_t *      p_free_subpic = NULL;       /* first free subpicture */
+    subpicture_t *      p_destroyed_subpic = NULL; /* first destroyed subpic */
 
     /* Get lock */
     vlc_mutex_lock( &p_vout->subpicture_lock );
 
-    /* 
-     * Look for an empty place 
+    /*
+     * Look for an empty place
      */
     for( i_subpic = 0; i_subpic < VOUT_MAX_PICTURES; i_subpic++ )
     {
@@ -304,13 +304,13 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
            if( (p_vout->p_subpicture[i_subpic].i_type  == i_type)   &&
                (p_vout->p_subpicture[i_subpic].i_size  >= i_size) )
            {
-               /* Memory size do match or is smaller : memory will not be reallocated, 
-                 * and function can end immediately - this is the best possible case, 
+               /* Memory size do match or is smaller : memory will not be reallocated,
+                 * and function can end immediately - this is the best possible case,
                  * since no memory allocation needs to be done */
                p_vout->p_subpicture[i_subpic].i_status = RESERVED_SUBPICTURE;
 #ifdef DEBUG_VIDEO
-                intf_DbgMsg("subpicture %p (in destroyed subpicture slot)\n", 
-                            &p_vout->p_subpicture[i_subpic] );                
+                intf_DbgMsg("subpicture %p (in destroyed subpicture slot)\n",
+                            &p_vout->p_subpicture[i_subpic] );
 #endif
                vlc_mutex_unlock( &p_vout->subpicture_lock );
                return( &p_vout->p_subpicture[i_subpic] );
@@ -319,10 +319,10 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
            {
                /* Memory size do not match, but subpicture index will be kept in
                 * case no other place are left */
-               p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];                
-           }       
+               p_destroyed_subpic = &p_vout->p_subpicture[i_subpic];
+           }   
        }
-        else if( (p_free_subpic == NULL) && 
+        else if( (p_free_subpic == NULL) &&
                  (p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE ))
         {
            /* Subpicture is empty and ready for allocation */
@@ -332,10 +332,10 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
 
     /* If no free subpicture is available, use a destroyed subpicture */
     if( (p_free_subpic == NULL) && (p_destroyed_subpic != NULL ) )
-    { 
+    {
        /* No free subpicture or matching destroyed subpicture has been found, but
         * a destroyed subpicture is still avalaible */
-        free( p_destroyed_subpic->p_data );        
+        free( p_destroyed_subpic->p_data );
         p_free_subpic = p_destroyed_subpic;
     }
 
@@ -347,99 +347,99 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type,
         /* Allocate memory */
         switch( i_type )
         {
-        case TEXT_SUBPICTURE:                               /* text subpicture */
-            p_free_subpic->p_data = malloc( i_size + 1 );             
+        case TEXT_SUBPICTURE:                             /* text subpicture */
+            p_free_subpic->p_data = malloc( i_size + 1 );
             break;
 #ifdef DEBUG
         default:
             intf_DbgMsg("error: unknown subpicture type %d\n", i_type );
-            p_free_subpic->p_data   =  NULL;            
-            break;            
-#endif    
+            p_free_subpic->p_data   =  NULL;
+            break;
+#endif
         }
 
         if( p_free_subpic->p_data != NULL )
         {                    /* Copy subpicture informations, set some default values */
             p_free_subpic->i_type                      = i_type;
             p_free_subpic->i_status                    = RESERVED_SUBPICTURE;
-            p_free_subpic->i_size                      = i_size;            
+            p_free_subpic->i_size                      = i_size;
             p_free_subpic->i_x                         = 0;
-            p_free_subpic->i_y                         = 0;             
+            p_free_subpic->i_y                         = 0;
             p_free_subpic->i_width                     = 0;
             p_free_subpic->i_height                    = 0;
-            p_free_subpic->i_horizontal_align          = CENTER_RALIGN;             
-            p_free_subpic->i_vertical_align            = CENTER_RALIGN;             
+            p_free_subpic->i_horizontal_align          = CENTER_RALIGN;
+            p_free_subpic->i_vertical_align            = CENTER_RALIGN;
         }
         else
         {
             /* Memory allocation failed : set subpicture as empty */
-            p_free_subpic->i_type   =  EMPTY_SUBPICTURE;            
-            p_free_subpic->i_status =  FREE_SUBPICTURE;            
-            p_free_subpic =            NULL;            
-            intf_ErrMsg("warning: %s\n", strerror( ENOMEM ) );            
+            p_free_subpic->i_type   =  EMPTY_SUBPICTURE;
+            p_free_subpic->i_status =  FREE_SUBPICTURE;
+            p_free_subpic =            NULL;
+            intf_ErrMsg("warning: %s\n", strerror( ENOMEM ) );
         }
-        
+
 #ifdef DEBUG_VIDEO
-        intf_DbgMsg("subpicture %p (in free subpicture slot)\n", p_free_subpic );        
+        intf_DbgMsg("subpicture %p (in free subpicture slot)\n", p_free_subpic );
 #endif
         vlc_mutex_unlock( &p_vout->subpicture_lock );
         return( p_free_subpic );
     }
-    
+
     /* No free or destroyed subpicture could be found */
     intf_DbgMsg( "warning: heap is full\n" );
     vlc_mutex_unlock( &p_vout->subpicture_lock );
     return( NULL );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_DestroySubPicture: remove a subpicture from the heap
- ******************************************************************************
+ *****************************************************************************
  * This function frees a previously reserved subpicture.
  * It is meant to be used when the construction of a picture aborted.
- * This function does not need locking since reserved subpictures are ignored 
+ * This function does not need locking since reserved subpictures are ignored
  * by the output thread.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
 {
 #ifdef DEBUG
    /* Check if status is valid */
    if( p_subpic->i_status != RESERVED_SUBPICTURE )
    {
-       intf_DbgMsg("error: subpicture %p has invalid status %d\n", 
-                   p_subpic, p_subpic->i_status );       
-   }   
+       intf_DbgMsg("error: subpicture %p has invalid status %d\n",
+                   p_subpic, p_subpic->i_status );
+   }
 #endif
 
     p_subpic->i_status = DESTROYED_SUBPICTURE;
 
 #ifdef DEBUG_VIDEO
-    intf_DbgMsg("subpicture %p\n", p_subpic);    
+    intf_DbgMsg("subpicture %p\n", p_subpic);
 #endif
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_DisplayPicture: display a picture
- *******************************************************************************
+ *****************************************************************************
  * Remove the reservation flag of a picture, which will cause it to be ready for
- * display. The picture won't be displayed until vout_DatePicture has been 
+ * display. The picture won't be displayed until vout_DatePicture has been
  * called.
- *******************************************************************************/
+ *****************************************************************************/
 void  vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
     vlc_mutex_lock( &p_vout->picture_lock );
     switch( p_pic->i_status )
     {
-    case RESERVED_PICTURE:        
+    case RESERVED_PICTURE:
         p_pic->i_status = RESERVED_DISP_PICTURE;
-        break;        
+        break;
     case RESERVED_DATED_PICTURE:
         p_pic->i_status = READY_PICTURE;
-        break;        
+        break;
 #ifdef DEBUG
-    default:        
-        intf_DbgMsg("error: picture %p has invalid status %d\n", p_pic, p_pic->i_status );    
-        break;        
+    default:
+        intf_DbgMsg("error: picture %p has invalid status %d\n", p_pic, p_pic->i_status );
+        break;
 #endif
     }
 
@@ -449,33 +449,33 @@ void  vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
     vlc_mutex_unlock( &p_vout->picture_lock );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_DatePicture: date a picture
- *******************************************************************************
+ *****************************************************************************
  * Remove the reservation flag of a picture, which will cause it to be ready for
- * display. The picture won't be displayed until vout_DisplayPicture has been 
+ * display. The picture won't be displayed until vout_DisplayPicture has been
  * called.
- *******************************************************************************/
+ *****************************************************************************/
 void  vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
 {
 #ifdef DEBUG_VIDEO
-    char        psz_date[MSTRTIME_MAX_SIZE];                           /* date */
+    char        psz_date[MSTRTIME_MAX_SIZE];                         /* date */
 #endif
 
     vlc_mutex_lock( &p_vout->picture_lock );
-    p_pic->date = date;    
+    p_pic->date = date;
     switch( p_pic->i_status )
     {
-    case RESERVED_PICTURE:        
+    case RESERVED_PICTURE:
         p_pic->i_status = RESERVED_DATED_PICTURE;
-        break;        
+        break;
     case RESERVED_DISP_PICTURE:
         p_pic->i_status = READY_PICTURE;
-        break;        
+        break;
 #ifdef DEBUG
-    default:        
-        intf_DbgMsg("error: picture %p has invalid status %d\n", p_pic, p_pic->i_status );    
-        break;        
+    default:
+        intf_DbgMsg("error: picture %p has invalid status %d\n", p_pic, p_pic->i_status );
+        break;
 #endif
     }
 
@@ -485,34 +485,34 @@ void  vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
     vlc_mutex_unlock( &p_vout->picture_lock );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_CreatePicture: allocate a picture in the video output heap.
- ******************************************************************************
- * This function create a reserved image in the video output heap. 
+ *****************************************************************************
+ * This function create a reserved image in the video output heap.
  * A null pointer is returned if the function fails. This method provides an
  * already allocated zone of memory in the picture data fields. It needs locking
- * since several pictures can be created by several producers threads. 
- ******************************************************************************/
-picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type, 
+ * since several pictures can be created by several producers threads.
+ *****************************************************************************/
+picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
                               int i_width, int i_height )
 {
-    int         i_picture;                                   /* picture index */
-    int         i_chroma_width = 0;                           /* chroma width */    
-    picture_t * p_free_picture = NULL;                  /* first free picture */    
-    picture_t * p_destroyed_picture = NULL;        /* first destroyed picture */    
+    int         i_picture;                                  /* picture index */
+    int         i_chroma_width = 0;                          /* chroma width */
+    picture_t * p_free_picture = NULL;                 /* first free picture */
+    picture_t * p_destroyed_picture = NULL;       /* first destroyed picture */
 
     /* Get lock */
     vlc_mutex_lock( &p_vout->picture_lock );
 
-    /* 
-     * Look for an empty place 
+    /*
+     * Look for an empty place
      */
     for( i_picture = 0; i_picture < VOUT_MAX_PICTURES; i_picture++ )
     {
        if( p_vout->p_picture[i_picture].i_status == DESTROYED_PICTURE )
        {
            /* Picture is marked for destruction, but is still allocated - note
-             * that if width and type are the same for two pictures, chroma_width 
+             * that if width and type are the same for two pictures, chroma_width
              * should also be the same */
            if( (p_vout->p_picture[i_picture].i_type           == i_type)   &&
                (p_vout->p_picture[i_picture].i_height         == i_height) &&
@@ -523,8 +523,8 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
                  * memory allocation needs to be done */
                p_vout->p_picture[i_picture].i_status = RESERVED_PICTURE;
 #ifdef DEBUG_VIDEO
-                intf_DbgMsg("picture %p (in destroyed picture slot)\n", 
-                            &p_vout->p_picture[i_picture] );                
+                intf_DbgMsg("picture %p (in destroyed picture slot)\n",
+                            &p_vout->p_picture[i_picture] );
 #endif
                vlc_mutex_unlock( &p_vout->picture_lock );
                return( &p_vout->p_picture[i_picture] );
@@ -533,24 +533,24 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
            {
                /* Memory size do not match, but picture index will be kept in
                 * case no other place are left */
-               p_destroyed_picture = &p_vout->p_picture[i_picture];                
-           }       
+               p_destroyed_picture = &p_vout->p_picture[i_picture];
+           }   
        }
-        else if( (p_free_picture == NULL) && 
+        else if( (p_free_picture == NULL) &&
                  (p_vout->p_picture[i_picture].i_status == FREE_PICTURE ))
         {
            /* Picture is empty and ready for allocation */
-            p_free_picture = &p_vout->p_picture[i_picture];            
+            p_free_picture = &p_vout->p_picture[i_picture];
         }
     }
 
     /* If no free picture is available, use a destroyed picture */
     if( (p_free_picture == NULL) && (p_destroyed_picture != NULL ) )
-    { 
+    {
        /* No free picture or matching destroyed picture has been found, but
         * a destroyed picture is still avalaible */
-        free( p_destroyed_picture->p_data );        
-        p_free_picture = p_destroyed_picture;        
+        free( p_destroyed_picture->p_data );
+        p_free_picture = p_destroyed_picture;
     }
 
     /*
@@ -561,124 +561,124 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
         /* Allocate memory */
         switch( i_type )
         {
-        case YUV_420_PICTURE:          /* YUV 420: 1,1/4,1/4 samples per pixel */
-            i_chroma_width = i_width / 2;            
+        case YUV_420_PICTURE:        /* YUV 420: 1,1/4,1/4 samples per pixel */
+            i_chroma_width = i_width / 2;
             p_free_picture->p_data = malloc( i_height * i_chroma_width * 3 * sizeof( yuv_data_t ) );
             p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
             p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*4/2;
             p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*5/2;
             break;
-        case YUV_422_PICTURE:          /* YUV 422: 1,1/2,1/2 samples per pixel */
-            i_chroma_width = i_width / 2;            
+        case YUV_422_PICTURE:        /* YUV 422: 1,1/2,1/2 samples per pixel */
+            i_chroma_width = i_width / 2;
             p_free_picture->p_data = malloc( i_height * i_chroma_width * 4 * sizeof( yuv_data_t ) );
             p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
             p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*2;
             p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*3;
             break;
-        case YUV_444_PICTURE:              /* YUV 444: 1,1,1 samples per pixel */
-            i_chroma_width = i_width;            
+        case YUV_444_PICTURE:            /* YUV 444: 1,1,1 samples per pixel */
+            i_chroma_width = i_width;
             p_free_picture->p_data = malloc( i_height * i_chroma_width * 3 * sizeof( yuv_data_t ) );
             p_free_picture->p_y = (yuv_data_t *)p_free_picture->p_data;
             p_free_picture->p_u = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width;
             p_free_picture->p_v = (yuv_data_t *)p_free_picture->p_data +i_height*i_chroma_width*2;
-            break;                
+            break;
 #ifdef DEBUG
         default:
             intf_DbgMsg("error: unknown picture type %d\n", i_type );
-            p_free_picture->p_data   =  NULL;            
-            break;            
-#endif    
+            p_free_picture->p_data   =  NULL;
+            break;
+#endif
         }
 
         if( p_free_picture->p_data != NULL )
-        {        
+        {
             /* Copy picture informations, set some default values */
             p_free_picture->i_type                      = i_type;
             p_free_picture->i_status                    = RESERVED_PICTURE;
-            p_free_picture->i_matrix_coefficients       = 1; 
+            p_free_picture->i_matrix_coefficients       = 1;
             p_free_picture->i_width                     = i_width;
             p_free_picture->i_height                    = i_height;
-            p_free_picture->i_chroma_width              = i_chroma_width;            
+            p_free_picture->i_chroma_width              = i_chroma_width;
             p_free_picture->i_display_horizontal_offset = 0;
-            p_free_picture->i_display_vertical_offset   = 0;            
+            p_free_picture->i_display_vertical_offset   = 0;
             p_free_picture->i_display_width             = i_width;
             p_free_picture->i_display_height            = i_height;
-            p_free_picture->i_aspect_ratio              = AR_SQUARE_PICTURE;            
-            p_free_picture->i_refcount                  = 0;            
+            p_free_picture->i_aspect_ratio              = AR_SQUARE_PICTURE;
+            p_free_picture->i_refcount                  = 0;
         }
         else
         {
             /* Memory allocation failed : set picture as empty */
-            p_free_picture->i_type   =  EMPTY_PICTURE;            
-            p_free_picture->i_status =  FREE_PICTURE;            
-            p_free_picture =            NULL;            
-            intf_ErrMsg("warning: %s\n", strerror( ENOMEM ) );            
+            p_free_picture->i_type   =  EMPTY_PICTURE;
+            p_free_picture->i_status =  FREE_PICTURE;
+            p_free_picture =            NULL;
+            intf_ErrMsg("warning: %s\n", strerror( ENOMEM ) );
         }
-        
+
 #ifdef DEBUG_VIDEO
-        intf_DbgMsg("picture %p (in free picture slot)\n", p_free_picture );        
+        intf_DbgMsg("picture %p (in free picture slot)\n", p_free_picture );
 #endif
         vlc_mutex_unlock( &p_vout->picture_lock );
         return( p_free_picture );
     }
-    
+
     /* No free or destroyed picture could be found */
     intf_DbgMsg( "warning: heap is full\n" );
     vlc_mutex_unlock( &p_vout->picture_lock );
     return( NULL );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_DestroyPicture: remove a permanent or reserved picture from the heap
- ******************************************************************************
+ *****************************************************************************
  * This function frees a previously reserved picture or a permanent
  * picture. It is meant to be used when the construction of a picture aborted.
  * Note that the picture will be destroyed even if it is linked !
  * This function does not need locking since reserved pictures are ignored by
  * the output thread.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
 #ifdef DEBUG
    /* Check if picture status is valid */
-   if( (p_pic->i_status != RESERVED_PICTURE) && 
+   if( (p_pic->i_status != RESERVED_PICTURE) &&
        (p_pic->i_status != RESERVED_DATED_PICTURE) &&
        (p_pic->i_status != RESERVED_DISP_PICTURE) )
    {
-       intf_DbgMsg("error: picture %p has invalid status %d\n", p_pic, p_pic->i_status );       
-   }   
+       intf_DbgMsg("error: picture %p has invalid status %d\n", p_pic, p_pic->i_status );
+   }
 #endif
 
     p_pic->i_status = DESTROYED_PICTURE;
 
 #ifdef DEBUG_VIDEO
-    intf_DbgMsg("picture %p\n", p_pic);    
+    intf_DbgMsg("picture %p\n", p_pic);
 #endif
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_LinkPicture: increment reference counter of a picture
- ******************************************************************************
+ *****************************************************************************
  * This function increment the reference counter of a picture in the video
  * heap. It needs a lock since several producer threads can access the picture.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
     vlc_mutex_lock( &p_vout->picture_lock );
     p_pic->i_refcount++;
 
 #ifdef DEBUG_VIDEO
-    intf_DbgMsg("picture %p refcount=%d\n", p_pic, p_pic->i_refcount );    
+    intf_DbgMsg("picture %p refcount=%d\n", p_pic, p_pic->i_refcount );
 #endif
 
     vlc_mutex_unlock( &p_vout->picture_lock );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_UnlinkPicture: decrement reference counter of a picture
- ******************************************************************************
+ *****************************************************************************
  * This function decrement the reference counter of a picture in the video heap.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
     vlc_mutex_lock( &p_vout->picture_lock );
@@ -688,8 +688,8 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
     if( p_pic->i_refcount < 0 )
     {
         intf_DbgMsg("error: refcount < 0\n");
-        p_pic->i_refcount = 0;        
-    }    
+        p_pic->i_refcount = 0;
+    }
 #endif
 
     if( (p_pic->i_refcount == 0) && (p_pic->i_status == DISPLAYED_PICTURE) )
@@ -698,18 +698,18 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
 #ifdef DEBUG_VIDEO
-    intf_DbgMsg("picture %p refcount=%d\n", p_pic, p_pic->i_refcount );    
+    intf_DbgMsg("picture %p refcount=%d\n", p_pic, p_pic->i_refcount );
 #endif
 
     vlc_mutex_unlock( &p_vout->picture_lock );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * vout_SetBuffers: set buffers adresses
- ******************************************************************************
- * This function is called by system drivers to set buffers video memory 
+ *****************************************************************************
+ * This function is called by system drivers to set buffers video memory
  * adresses.
- ******************************************************************************/
+ *****************************************************************************/
 void vout_SetBuffers( vout_thread_t *p_vout, void *p_buf1, void *p_buf2 )
 {
     /* No picture previously */
@@ -731,8 +731,8 @@ void vout_SetBuffers( vout_thread_t *p_vout, void *p_buf1, void *p_buf2 )
     p_vout->p_buffer[1].pi_area_end[0] =          p_vout->i_height - 1;
 
     /* Set adresses */
-    p_vout->p_buffer[0].p_data = p_buf1;    
-    p_vout->p_buffer[1].p_data = p_buf2;    
+    p_vout->p_buffer[0].p_data = p_buf1;
+    p_vout->p_buffer[1].p_data = p_buf2;
 }
 
 /*****************************************************************************
@@ -753,7 +753,7 @@ void vout_Pixel2RGB( vout_thread_t *p_vout, u32 i_pixel, int *pi_red, int *pi_gr
 /*****************************************************************************
  * BinaryLog: computes the base 2 log of a binary value
  *****************************************************************************
- * This functions is used by MaskToShift, to get a bit index from a binary 
+ * This functions is used by MaskToShift, to get a bit index from a binary
  * value.
  *****************************************************************************/
 static int BinaryLog(u32 i)
@@ -761,30 +761,30 @@ static int BinaryLog(u32 i)
     int i_log;
 
     i_log = 0;
-    if (i & 0xffff0000) 
-    {        
+    if (i & 0xffff0000)
+    {
         i_log = 16;
-    }    
-    if (i & 0xff00ff00) 
-    {        
+    }
+    if (i & 0xff00ff00)
+    {
         i_log += 8;
-    }    
-    if (i & 0xf0f0f0f0) 
-    {        
+    }
+    if (i & 0xf0f0f0f0)
+    {
         i_log += 4;
-    }    
-    if (i & 0xcccccccc) 
-    {        
+    }
+    if (i & 0xcccccccc)
+    {
         i_log += 2;
-    }    
-    if (i & 0xaaaaaaaa) 
-    {        
+    }
+    if (i & 0xaaaaaaaa)
+    {
         i_log++;
-    }    
+    }
     if (i != ((u32)1 << i_log))
-    {        
-       intf_ErrMsg("internal error: binary log overflow\n");        
-    }    
+    {
+       intf_ErrMsg("internal error: binary log overflow\n");
+    }
 
     return( i_log );
 }
@@ -811,64 +811,64 @@ static void MaskToShift( int *pi_left, int *pi_right, u32 i_mask )
     *pi_right = (8 - i_high + i_low);
 }
 
-/******************************************************************************
+/*****************************************************************************
  * InitThread: initialize video output thread
- ******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
- ******************************************************************************/
+ *****************************************************************************/
 static int InitThread( vout_thread_t *p_vout )
 {
     /* Update status */
     intf_DbgMsg("\n");
-    *p_vout->pi_status = THREAD_START;    
+    *p_vout->pi_status = THREAD_START;
 
-    /* Initialize output method - this function issues its own error messages */
+   /* Initialize output method - this function issues its own error messages */
     if( vout_SysInit( p_vout ) )
     {
         return( 1 );
-    } 
+    }
 
     /* Initialize convertion tables and functions */
     if( vout_InitYUV( p_vout ) )
     {
         intf_ErrMsg("error: can't allocate YUV translation tables\n");
-        return( 1 );                
+        return( 1 );
     }
-    
+
     /* Mark thread as running and return */
-    p_vout->b_active =          1;    
-    *p_vout->pi_status =        THREAD_READY;    
-    intf_DbgMsg("thread ready\n");    
-    return( 0 );    
+    p_vout->b_active =          1;
+    *p_vout->pi_status =        THREAD_READY;
+    intf_DbgMsg("thread ready\n");
+    return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RunThread: video output thread
- ******************************************************************************
+ *****************************************************************************
  * Video output thread. This function does only returns when the thread is
  * terminated. It handles the pictures arriving in the video heap and the
  * display device events.
- ******************************************************************************/
+ *****************************************************************************/
 static void RunThread( vout_thread_t *p_vout)
 {
-    int             i_index;                                 /* index in heap */
-    mtime_t         current_date;                             /* current date */
-    mtime_t         display_date;                             /* display date */    
-    boolean_t       b_display;                                /* display flag */    
-    picture_t *     p_pic;                                 /* picture pointer */
-    subpicture_t *  p_subpic;                           /* subpicture pointer */    
-     
-    /* 
+    int             i_index;                                /* index in heap */
+    mtime_t         current_date;                            /* current date */
+    mtime_t         display_date;                            /* display date */
+    boolean_t       b_display;                               /* display flag */
+    picture_t *     p_pic;                                /* picture pointer */
+    subpicture_t *  p_subpic;                          /* subpicture pointer */
+
+    /*
      * Initialize thread
      */
     p_vout->b_error = InitThread( p_vout );
     if( p_vout->b_error )
     {
         DestroyThread( p_vout, THREAD_ERROR );
-        return;        
-    }    
+        return;
+    }
     intf_DbgMsg("\n");
 
     /*
@@ -880,30 +880,30 @@ static void RunThread( vout_thread_t *p_vout)
         /* Initialize loop variables */
         p_pic =         NULL;
         p_subpic =      NULL;
-        display_date =  0;        
+        display_date =  0;
         current_date =  mdate();
 
-        /* 
+        /*
         * Find the picture to display - this operation does not need lock,
-         * since only READY_PICTUREs are handled 
+         * since only READY_PICTUREs are handled
          */
         for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
        {
            if( (p_vout->p_picture[i_index].i_status == READY_PICTURE) &&
-               ( (p_pic == NULL) || 
+               ( (p_pic == NULL) ||
                  (p_vout->p_picture[i_index].date < display_date) ) )
            {
                 p_pic = &p_vout->p_picture[i_index];
-                display_date = p_pic->date;                
+                display_date = p_pic->date;
            }
        }
+
         if( p_pic )
         {
 #ifdef STATS
             /* Computes FPS rate */
             p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = display_date;
-#endif     
+#endif 
            if( display_date < current_date )
            {
                /* Picture is late: it will be destroyed and the thread will sleep and
@@ -912,16 +912,16 @@ static void RunThread( vout_thread_t *p_vout)
                 p_pic->i_status = p_pic->i_refcount ? DISPLAYED_PICTURE : DESTROYED_PICTURE;
                intf_DbgMsg( "warning: late picture %p skipped refcount=%d\n", p_pic, p_pic->i_refcount );
                 vlc_mutex_unlock( &p_vout->picture_lock );
-                p_pic =         NULL;                
-                display_date =  0;                
+                p_pic =         NULL;
+                display_date =  0;
            }
            else if( display_date > current_date + VOUT_DISPLAY_DELAY )
            {
                /* A picture is ready to be rendered, but its rendering date is
                 * far from the current one so the thread will perform an empty loop
                 * as if no picture were found. The picture state is unchanged */
-                p_pic =         NULL;                
-                display_date =  0;                
+                p_pic =         NULL;
+                display_date =  0;
            }
         }
 
@@ -935,56 +935,56 @@ static void RunThread( vout_thread_t *p_vout)
         /*
          * Perform rendering, sleep and display rendered picture
          */
-        if( p_pic )                          /* picture and perhaps subpicture */
+        if( p_pic )                        /* picture and perhaps subpicture */
         {
-            b_display = p_vout->b_active;            
+            b_display = p_vout->b_active;
             p_vout->last_display_date = display_date;
-            
+
             if( b_display )
-            {                
+            {
                 /* Set picture dimensions and clear buffer */
                 SetBufferPicture( p_vout, p_pic );
 
                 /* Render picture and informations */
-                RenderPicture( p_vout, p_pic );             
+                RenderPicture( p_vout, p_pic );
                 if( p_vout->b_info )
                 {
                     RenderPictureInfo( p_vout, p_pic );
-                    RenderInfo( p_vout );                
+                    RenderInfo( p_vout );
                 }
             }
-            
+
             /* Remove picture from heap */
             vlc_mutex_lock( &p_vout->picture_lock );
             p_pic->i_status = p_pic->i_refcount ? DISPLAYED_PICTURE : DESTROYED_PICTURE;
-            vlc_mutex_unlock( &p_vout->picture_lock );                          
+            vlc_mutex_unlock( &p_vout->picture_lock );
 
             /* Render interface and subpicture */
             if( b_display && p_vout->b_interface )
             {
-                RenderInterface( p_vout );                
+                RenderInterface( p_vout );
             }
             if( p_subpic )
             {
                 if( b_display )
-                {                    
+                {
                     RenderSubPicture( p_vout, p_subpic );
-                }                
+                }
 
                 /* Remove subpicture from heap */
                 vlc_mutex_lock( &p_vout->subpicture_lock );
                 p_subpic->i_status = DESTROYED_SUBPICTURE;
-                vlc_mutex_unlock( &p_vout->subpicture_lock );                          
+                vlc_mutex_unlock( &p_vout->subpicture_lock );
             }
 
         }
-        else if( p_subpic )                                /* subpicture alone */
+        else if( p_subpic )                              /* subpicture alone */
         {
             b_display = p_vout->b_active;
-            p_vout->last_display_date = display_date;            
+            p_vout->last_display_date = display_date;
 
             if( b_display )
-            {                
+            {
                 /* Clear buffer */
                 SetBufferPicture( p_vout, NULL );
 
@@ -997,40 +997,40 @@ static void RunThread( vout_thread_t *p_vout)
                 {
                     RenderInterface( p_vout );
                 }
-                RenderSubPicture( p_vout, p_subpic );            
-            }            
+                RenderSubPicture( p_vout, p_subpic );
+            }
 
             /* Remove subpicture from heap */
             vlc_mutex_lock( &p_vout->subpicture_lock );
             p_subpic->i_status = DESTROYED_SUBPICTURE;
-            vlc_mutex_unlock( &p_vout->subpicture_lock );                          
+            vlc_mutex_unlock( &p_vout->subpicture_lock );
         }
-        else if( p_vout->b_active )          /* idle or interface screen alone */
+        else if( p_vout->b_active )        /* idle or interface screen alone */
         {
             if( p_vout->b_interface && 0 /* && ?? intf_change */ )
             {
                 /* Interface has changed, so a new rendering is required - force
                  * it by setting last idle date to 0 */
-                p_vout->last_idle_date = 0;                
+                p_vout->last_idle_date = 0;
             }
 
             /* Render idle screen and update idle date, then render interface if
              * required */
             b_display = RenderIdle( p_vout );
             if( b_display )
-            {                
+            {
                 p_vout->last_idle_date = current_date;
                 if( p_vout->b_interface )
                 {
-                    RenderInterface( p_vout );                
+                    RenderInterface( p_vout );
                 }
             }
-            
-        }       
+
+        }
         else
         {
-            b_display = 0;            
-        }        
+            b_display = 0;
+        }
 
         /*
          * Sleep, wake up and display rendered picture
@@ -1042,7 +1042,7 @@ static void RunThread( vout_thread_t *p_vout)
 #endif
 
         /* Give back change lock */
-        vlc_mutex_unlock( &p_vout->change_lock );        
+        vlc_mutex_unlock( &p_vout->change_lock );
 
         /* Sleep a while or until a given date */
         if( display_date != 0 )
@@ -1051,16 +1051,16 @@ static void RunThread( vout_thread_t *p_vout)
         }
         else
         {
-            msleep( VOUT_IDLE_SLEEP );                
-        }            
+            msleep( VOUT_IDLE_SLEEP );
+        }
 
-        /* On awakening, take back lock and send immediately picture to display, 
+        /* On awakening, take back lock and send immediately picture to display,
          * then swap buffers */
-        vlc_mutex_lock( &p_vout->change_lock );        
+        vlc_mutex_lock( &p_vout->change_lock );
 #ifdef DEBUG_VIDEO
         intf_DbgMsg( "picture %p, subpicture %p in buffer %d, display=%d\n", p_pic, p_subpic,
-                     p_vout->i_buffer_index, b_display && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) );        
-#endif            
+                     p_vout->i_buffer_index, b_display && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) );
+#endif
         if( b_display && !(p_vout->i_changes & VOUT_NODISPLAY_CHANGE) )
         {
             vout_SysDisplay( p_vout );
@@ -1076,30 +1076,30 @@ static void RunThread( vout_thread_t *p_vout)
             * without displaying anything - setting b_error to 1 cause the
             * immediate end of the main while() loop. */
            p_vout->b_error = 1;
-       }  
-    } 
+       }
+    }
 
     /*
      * Error loop - wait until the thread destruction is requested
      */
     if( p_vout->b_error )
     {
-        ErrorThread( p_vout );        
+        ErrorThread( p_vout );
     }
 
     /* End of thread */
     EndThread( p_vout );
-    DestroyThread( p_vout, THREAD_OVER ); 
+    DestroyThread( p_vout, THREAD_OVER );
     intf_DbgMsg( "thread end\n" );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * ErrorThread: RunThread() error loop
- ******************************************************************************
+ *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
- ******************************************************************************/
+ *****************************************************************************/
 static void ErrorThread( vout_thread_t *p_vout )
 {
     /* Wait until a `die' order */
@@ -1107,23 +1107,23 @@ static void ErrorThread( vout_thread_t *p_vout )
     while( !p_vout->b_die )
     {
         /* Sleep a while */
-        msleep( VOUT_IDLE_SLEEP );                
+        msleep( VOUT_IDLE_SLEEP );
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * EndThread: thread destruction
- *******************************************************************************
- * This function is called when the thread ends after a sucessfull 
+ *****************************************************************************
+ * This function is called when the thread ends after a sucessfull
  * initialization. It frees all ressources allocated by InitThread.
- *******************************************************************************/
+ *****************************************************************************/
 static void EndThread( vout_thread_t *p_vout )
 {
-    int     i_index;                                          /* index in heap */
-            
+    int     i_index;                                        /* index in heap */
+
     /* Store status */
     intf_DbgMsg("\n");
-    *p_vout->pi_status = THREAD_END;    
+    *p_vout->pi_status = THREAD_END;
 
     /* Destroy all remaining pictures and subpictures */
     for( i_index = 0; i_index < VOUT_MAX_PICTURES; i_index++ )
@@ -1134,82 +1134,82 @@ static void EndThread( vout_thread_t *p_vout )
         }
         if( p_vout->p_subpicture[i_index].i_status != FREE_SUBPICTURE )
         {
-            free( p_vout->p_subpicture[i_index].p_data );            
-        }        
+            free( p_vout->p_subpicture[i_index].p_data );
+        }
     }
 
     /* Destroy translation tables */
-    vout_EndYUV( p_vout );  
-    vout_SysEnd( p_vout );    
+    vout_EndYUV( p_vout );
+    vout_SysEnd( p_vout );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * DestroyThread: thread destruction
- *******************************************************************************
+ *****************************************************************************
  * This function is called when the thread ends. It frees all ressources
  * allocated by CreateThread. Status is available at this stage.
- *******************************************************************************/
+ *****************************************************************************/
 static void DestroyThread( vout_thread_t *p_vout, int i_status )
-{  
-    int *pi_status;                                           /* status adress */
-    
+{
+    int *pi_status;                                         /* status adress */
+
     /* Store status adress */
     intf_DbgMsg("\n");
-    pi_status = p_vout->pi_status;    
-    
+    pi_status = p_vout->pi_status;
+
     /* Destroy thread structures allocated by Create and InitThread */
     vout_UnloadFont( p_vout->p_default_font );
-    vout_UnloadFont( p_vout->p_large_font ); 
+    vout_UnloadFont( p_vout->p_large_font );
     vout_SysDestroy( p_vout );
     free( p_vout );
-    *pi_status = i_status;    
+    *pi_status = i_status;
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * Print: print simple text on a picture
- *******************************************************************************
+ *****************************************************************************
  * This function will print a simple text on the picture. It is designed to
  * print debugging or general informations.
- *******************************************************************************/
+ *****************************************************************************/
 void Print( vout_thread_t *p_vout, int i_x, int i_y, int i_h_align, int i_v_align, unsigned char *psz_text )
 {
-    int                 i_text_height;                    /* total text height */
-    int                 i_text_width;                      /* total text width */
+    int                 i_text_height;                  /* total text height */
+    int                 i_text_width;                    /* total text width */
 
     /* Update upper left coordinates according to alignment */
     vout_TextSize( p_vout->p_default_font, 0, psz_text, &i_text_width, &i_text_height );
     if( !Align( p_vout, &i_x, &i_y, i_text_width, i_text_height, i_h_align, i_v_align ) )
     {
         /* Set area and print text */
-        SetBufferArea( p_vout, i_x, i_y, i_text_width, i_text_height );    
-        vout_Print( p_vout->p_default_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data + 
+        SetBufferArea( p_vout, i_x, i_y, i_text_width, i_text_height );
+        vout_Print( p_vout->p_default_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
                     i_y * p_vout->i_bytes_per_line + i_x * p_vout->i_bytes_per_pixel,
-                    p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line, 
-                    p_vout->i_white_pixel, 0, 0, 
+                    p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
+                    p_vout->i_white_pixel, 0, 0,
                     0, psz_text );
-    }    
+    }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * SetBufferArea: activate an area in current buffer
- *******************************************************************************
+ *****************************************************************************
  * This function is called when something is rendered on the current buffer.
  * It set the area as active and prepare it to be cleared on next rendering.
  * Pay attention to the fact that in this functions, i_h is in fact the end y
  * coordinate of the new area.
- *******************************************************************************/
+ *****************************************************************************/
 static void SetBufferArea( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int i_h )
 {
-    vout_buffer_t *     p_buffer;                            /* current buffer */
-    int                 i_area_begin, i_area_end;   /* area vertical extension */
-    int                 i_area, i_area_copy;                     /* area index */    
-    int                 i_area_shift;              /* shift distance for areas */    
-    
+    vout_buffer_t *     p_buffer;                          /* current buffer */
+    int                 i_area_begin, i_area_end; /* area vertical extension */
+    int                 i_area, i_area_copy;                   /* area index */
+    int                 i_area_shift;            /* shift distance for areas */
+
     /* Choose buffer and modify h to end of area position */
-    p_buffer =  &p_vout->p_buffer[ p_vout->i_buffer_index ];    
+    p_buffer =  &p_vout->p_buffer[ p_vout->i_buffer_index ];
     i_h +=      i_y - 1;
-    /* 
+
+    /*
      * Remove part of the area which is inside the picture - this is done
      * by calling again SetBufferArea with the correct areas dimensions.
      */
@@ -1221,74 +1221,74 @@ static void SetBufferArea( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int
         if( ((i_y >= i_area_begin) && (i_y <= i_area_end)) ||
             ((i_h >= i_area_begin) && (i_h <= i_area_end)) ||
             ((i_y <  i_area_begin) && (i_h > i_area_end)) )
-        {                    
+        {
             /* Keep the stripe above the picture, if any */
             if( i_y < i_area_begin )
             {
-                SetBufferArea( p_vout, i_x, i_y, i_w, i_area_begin - i_y );            
+                SetBufferArea( p_vout, i_x, i_y, i_w, i_area_begin - i_y );
             }
             /* Keep the stripe below the picture, if any */
             if( i_h > i_area_end )
             {
                 SetBufferArea( p_vout, i_x, i_area_end, i_w, i_h - i_area_end );
-            }        
+            }
             return;
-        }        
-    }   
+        }
+    }
 
     /* Skip some extensions until interesting areas */
-    for( i_area = 0; 
+    for( i_area = 0;
          (i_area < p_buffer->i_areas) &&
-             (p_buffer->pi_area_end[i_area] + 1 <= i_y); 
+             (p_buffer->pi_area_end[i_area] + 1 <= i_y);
          i_area++ )
     {
-        ;        
+        ;
     }
-    
+
     if( i_area == p_buffer->i_areas )
     {
-        /* New area is below all existing ones: just add it at the end of the 
+        /* New area is below all existing ones: just add it at the end of the
          * array, if possible - else, append it to the last one */
         if( i_area < VOUT_MAX_AREAS )
         {
             p_buffer->pi_area_begin[i_area] = i_y;
-            p_buffer->pi_area_end[i_area] = i_h;            
-            p_buffer->i_areas++;            
+            p_buffer->pi_area_end[i_area] = i_h;
+            p_buffer->i_areas++;
         }
         else
         {
 #ifdef DEBUG_VIDEO
-            intf_DbgMsg("areas overflow\n");            
+            intf_DbgMsg("areas overflow\n");
 #endif
-            p_buffer->pi_area_end[VOUT_MAX_AREAS - 1] = i_h;  
-        }        
+            p_buffer->pi_area_end[VOUT_MAX_AREAS - 1] = i_h;
+        }
     }
-    else 
+    else
     {
         i_area_begin =  p_buffer->pi_area_begin[i_area];
         i_area_end =    p_buffer->pi_area_end[i_area];
-        
-        if( i_y < i_area_begin ) 
+
+        if( i_y < i_area_begin )
         {
             if( i_h >= i_area_begin - 1 )
-            {                
+            {
                 /* Extend area above */
                 p_buffer->pi_area_begin[i_area] = i_y;
             }
             else
             {
-                /* Create a new area above : merge last area if overflow, then 
+                /* Create a new area above : merge last area if overflow, then
                  * move all old areas down */
                 if( p_buffer->i_areas == VOUT_MAX_AREAS )
-                {                    
+                {
 #ifdef DEBUG_VIDEO
-                    intf_DbgMsg("areas overflow\n");       
+                    intf_DbgMsg("areas overflow\n");
 #endif
-                    p_buffer->pi_area_end[VOUT_MAX_AREAS - 2] = p_buffer->pi_area_end[VOUT_MAX_AREAS - 1];                    
+                    p_buffer->pi_area_end[VOUT_MAX_AREAS - 2] = p_buffer->pi_area_end[VOUT_MAX_AREAS - 1];
                 }
                 else
                 {
-                    p_buffer->i_areas++;                    
+                    p_buffer->i_areas++;
                 }
                 for( i_area_copy = p_buffer->i_areas - 1; i_area_copy > i_area; i_area_copy-- )
                 {
@@ -1298,19 +1298,19 @@ static void SetBufferArea( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int
                 p_buffer->pi_area_begin[i_area] = i_y;
                 p_buffer->pi_area_end[i_area] = i_h;
                 return;
-            }              
+            }
         }
         if( i_h > i_area_end )
         {
             /* Find further areas which can be merged with the new one */
-            for( i_area_copy = i_area + 1; 
+            for( i_area_copy = i_area + 1;
                  (i_area_copy < p_buffer->i_areas) &&
                      (p_buffer->pi_area_begin[i_area] <= i_h);
                  i_area_copy++ )
             {
-                ;                
+                ;
             }
-            i_area_copy--;            
+            i_area_copy--;
 
             if( i_area_copy != i_area )
             {
@@ -1318,7 +1318,7 @@ static void SetBufferArea( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int
                 p_buffer->pi_area_end[i_area] = MAX( i_h, p_buffer->pi_area_end[i_area_copy] );
 
                 /* Shift lower areas upward */
-                i_area_shift = i_area_copy - i_area;                
+                i_area_shift = i_area_copy - i_area;
                 p_buffer->i_areas -= i_area_shift;
                 for( i_area_copy = i_area + 1; i_area_copy < p_buffer->i_areas; i_area_copy++ )
                 {
@@ -1330,95 +1330,95 @@ static void SetBufferArea( vout_thread_t *p_vout, int i_x, int i_y, int i_w, int
             {
                 /* Extend area below */
                 p_buffer->pi_area_end[i_area] = i_h;
-            }            
+            }
         }
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * SetBufferPicture: clear buffer and set picture area
- *******************************************************************************
- * This function is called before any rendering. It clears the current 
+ *****************************************************************************
+ * This function is called before any rendering. It clears the current
  * rendering buffer and set the new picture area. If the picture pointer is
  * NULL, then no picture area is defined. Floating operations are avoided since
  * some MMX calculations may follow.
- *******************************************************************************/
+ *****************************************************************************/
 static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    vout_buffer_t *     p_buffer;                            /* current buffer */
-    int                 i_pic_x, i_pic_y;                  /* picture position */
-    int                 i_pic_width, i_pic_height;       /* picture dimensions */    
-    int                 i_old_pic_y, i_old_pic_height;     /* old picture area */    
-    int                 i_vout_width, i_vout_height;     /* display dimensions */
-    int                 i_area;                                  /* area index */    
-    int                 i_data_index;                       /* area data index */    
-    int                 i_data_size;     /* area data size, in 256 bytes blocs */
-    u64 *               p_data;                     /* area data, for clearing */    
-    byte_t *            p_data8;             /* area data, for clearing (slow) */
-    
+    vout_buffer_t *     p_buffer;                          /* current buffer */
+    int                 i_pic_x, i_pic_y;                /* picture position */
+    int                 i_pic_width, i_pic_height;     /* picture dimensions */
+    int                 i_old_pic_y, i_old_pic_height;   /* old picture area */
+    int                 i_vout_width, i_vout_height;   /* display dimensions */
+    int                 i_area;                                /* area index */
+    int                 i_data_index;                     /* area data index */
+    int                 i_data_size;   /* area data size, in 256 bytes blocs */
+    u64 *               p_data;                   /* area data, for clearing */
+    byte_t *            p_data8;           /* area data, for clearing (slow) */
+
     /* Choose buffer and set display dimensions */
-    p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];    
+    p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];
     i_vout_width =      p_vout->i_width;
-    i_vout_height =     p_vout->i_height;    
+    i_vout_height =     p_vout->i_height;
 
     /*
-     * Computes new picture size 
+     * Computes new picture size
      */
     if( p_pic != NULL )
     {
         /* Try horizontal scaling first - width must be a mutiple of 16 */
-        i_pic_width = (( p_vout->b_scale || (p_pic->i_width > i_vout_width)) ? 
+        i_pic_width = (( p_vout->b_scale || (p_pic->i_width > i_vout_width)) ?
                        i_vout_width : p_pic->i_width) & ~0xf;
         switch( p_pic->i_aspect_ratio )
         {
         case AR_3_4_PICTURE:
             i_pic_height = i_pic_width * 3 / 4;
-            break;                
+            break;
         case AR_16_9_PICTURE:
             i_pic_height = i_pic_width * 9 / 16;
             break;
-        case AR_221_1_PICTURE:        
+        case AR_221_1_PICTURE:
             i_pic_height = i_pic_width * 100 / 221;
-            break;               
+            break;
         case AR_SQUARE_PICTURE:
         default:
-            i_pic_height = p_pic->i_height * i_pic_width / p_pic->i_width;            
+            i_pic_height = p_pic->i_height * i_pic_width / p_pic->i_width;
             break;
         }
 
-        /* If picture dimensions using horizontal scaling are too large, use 
+        /* If picture dimensions using horizontal scaling are too large, use
          * vertical scaling. Since width must be a multiple of 16, height is
          * adjusted again after. */
         if( i_pic_height > i_vout_height )
         {
-            i_pic_height = ( p_vout->b_scale || (p_pic->i_height > i_vout_height)) ? 
+            i_pic_height = ( p_vout->b_scale || (p_pic->i_height > i_vout_height)) ?
                 i_vout_height : p_pic->i_height;
             switch( p_pic->i_aspect_ratio )
             {
             case AR_3_4_PICTURE:
                 i_pic_width = (i_pic_height * 4 / 3) & ~0xf;
                 i_pic_height = i_pic_width * 3 / 4;
-                break;                
+                break;
             case AR_16_9_PICTURE:
                 i_pic_width = (i_pic_height * 16 / 9) & ~0xf;
                 i_pic_height = i_pic_width * 9 / 16;
                 break;
-            case AR_221_1_PICTURE:        
+            case AR_221_1_PICTURE:
                 i_pic_width = (i_pic_height * 221 / 100) & ~0xf;
                 i_pic_height = i_pic_width * 100 / 221;
-                break;               
+                break;
             case AR_SQUARE_PICTURE:
             default:
                 i_pic_width = (p_pic->i_width * i_pic_height / p_pic->i_height) & ~0xf;
                 i_pic_height = p_pic->i_height * i_pic_width / p_pic->i_width;
                 break;
-            }        
-        }        
+            }
+        }
 
         /* Set picture position */
         i_pic_x = (p_vout->i_width - i_pic_width) / 2;
-        i_pic_y = (p_vout->i_height - i_pic_height) / 2;                
-    }    
+        i_pic_y = (p_vout->i_height - i_pic_height) / 2;
+    }
     else
     {
         /* No picture: size is 0 */
@@ -1429,9 +1429,9 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
     }
 
     /*
-     * Set new picture size - if is is smaller than the previous one, clear 
+     * Set new picture size - if is is smaller than the previous one, clear
      * around it. Since picture are centered, only their size is tested.
-     */                                          
+     */
     if( (p_buffer->i_pic_width > i_pic_width) || (p_buffer->i_pic_height > i_pic_height) )
     {
         i_old_pic_y =            p_buffer->i_pic_y;
@@ -1439,7 +1439,7 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
         p_buffer->i_pic_x =      i_pic_x;
         p_buffer->i_pic_y =      i_pic_y;
         p_buffer->i_pic_width =  i_pic_width;
-        p_buffer->i_pic_height = i_pic_height;                        
+        p_buffer->i_pic_height = i_pic_height;
         SetBufferArea( p_vout, 0, i_old_pic_y, p_vout->i_width, i_old_pic_height );
     }
     else
@@ -1447,7 +1447,7 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
         p_buffer->i_pic_x =      i_pic_x;
         p_buffer->i_pic_y =      i_pic_y;
         p_buffer->i_pic_width =  i_pic_width;
-        p_buffer->i_pic_height = i_pic_height;    
+        p_buffer->i_pic_height = i_pic_height;
     }
 
     /*
@@ -1455,8 +1455,8 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
      */
     for( i_area = 0; i_area < p_buffer->i_areas; i_area++ )
     {
-#ifdef DEBUG_VIDEO    
-        intf_DbgMsg("clearing picture %p area in buffer %d: %d-%d\n", p_pic, 
+#ifdef DEBUG_VIDEO
+        intf_DbgMsg("clearing picture %p area in buffer %d: %d-%d\n", p_pic,
                     p_vout->i_buffer_index, p_buffer->pi_area_begin[i_area], p_buffer->pi_area_end[i_area] );
 #endif
         i_data_size = (p_buffer->pi_area_end[i_area] - p_buffer->pi_area_begin[i_area] + 1) * p_vout->i_bytes_per_line;
@@ -1476,15 +1476,15 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
         for( i_data_index = (i_data_size % 256) / 16; i_data_index--; )
         {
             /* Clear remaining 16 bytes blocks */
-            *p_data++ = 0;  *p_data++ = 0;            
+            *p_data++ = 0;  *p_data++ = 0;
         }
-        p_data8 = (byte_t *)p_data;        
+        p_data8 = (byte_t *)p_data;
         for( i_data_index = i_data_size % 16; i_data_index--; )
         {
             /* Clear remaining bytes */
-            *p_data8++ = 0;            
+            *p_data8++ = 0;
         }
-    }    
+    }
 
     /*
      * Clear areas array
@@ -1492,104 +1492,104 @@ static void SetBufferPicture( vout_thread_t *p_vout, picture_t *p_pic )
     p_buffer->i_areas = 0;
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RenderPicture: render a picture
- ******************************************************************************
+ *****************************************************************************
  * This function convert a picture from a video heap to a pixel-encoded image
  * and copy it to the current rendering buffer. No lock is required, since the
  * rendered picture has been determined as existant, and will only be destroyed
  * by the vout thread later.
- ******************************************************************************/
+ *****************************************************************************/
 static void RenderPicture( vout_thread_t *p_vout, picture_t *p_pic )
 {
 #ifdef DEBUG_VIDEO
-    char                psz_date[MSTRTIME_MAX_SIZE];          /* picture date */    
-    mtime_t             render_time;                /* picture rendering time */
+    char                psz_date[MSTRTIME_MAX_SIZE];         /* picture date */
+    mtime_t             render_time;               /* picture rendering time */
 #endif
-    vout_buffer_t *     p_buffer;                         /* rendering buffer */    
-    byte_t *            p_pic_data;                 /* convertion destination */
-    
+    vout_buffer_t *     p_buffer;                        /* rendering buffer */
+    byte_t *            p_pic_data;                /* convertion destination */
+
     /* Get and set rendering informations */
-    p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];    
-    p_pic_data =        p_buffer->p_data + 
+    p_buffer =          &p_vout->p_buffer[ p_vout->i_buffer_index ];
+    p_pic_data =        p_buffer->p_data +
         p_buffer->i_pic_x * p_vout->i_bytes_per_pixel +
         p_buffer->i_pic_y * p_vout->i_bytes_per_line;
 #ifdef DEBUG_VIDEO
-    render_time = mdate();    
+    render_time = mdate();
 #endif
 
     /*
-     * Choose appropriate rendering function and render picture 
+     * Choose appropriate rendering function and render picture
      */
     switch( p_pic->i_type )
     {
     case YUV_420_PICTURE:
-        p_vout->yuv.p_Convert420( p_vout, p_pic_data, 
+        p_vout->yuv.p_Convert420( p_vout, p_pic_data,
                                   p_pic->p_y, p_pic->p_u, p_pic->p_v,
                                   p_pic->i_width, p_pic->i_height,
-                                  p_buffer->i_pic_width, p_buffer->i_pic_height, 
+                                  p_buffer->i_pic_width, p_buffer->i_pic_height,
                                   p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel,
                                   p_pic->i_matrix_coefficients );
-        break;        
+        break;
     case YUV_422_PICTURE:
-        p_vout->yuv.p_Convert422( p_vout, p_pic_data, 
+        p_vout->yuv.p_Convert422( p_vout, p_pic_data,
                                   p_pic->p_y, p_pic->p_u, p_pic->p_v,
                                   p_pic->i_width, p_pic->i_height,
-                                  p_buffer->i_pic_width, p_buffer->i_pic_height, 
+                                  p_buffer->i_pic_width, p_buffer->i_pic_height,
                                   p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel,
                                   p_pic->i_matrix_coefficients );
-        break;        
+        break;
     case YUV_444_PICTURE:
-        p_vout->yuv.p_Convert444( p_vout, p_pic_data, 
+        p_vout->yuv.p_Convert444( p_vout, p_pic_data,
                                   p_pic->p_y, p_pic->p_u, p_pic->p_v,
                                   p_pic->i_width, p_pic->i_height,
-                                  p_buffer->i_pic_width, p_buffer->i_pic_height, 
+                                  p_buffer->i_pic_width, p_buffer->i_pic_height,
                                   p_vout->i_bytes_per_line / p_vout->i_bytes_per_pixel,
                                   p_pic->i_matrix_coefficients );
-        break;        
+        break;
 #ifdef DEBUG
-    default:        
+    default:
         intf_DbgMsg("error: unknown picture type %d\n", p_pic->i_type );
-        break;        
+        break;
 #endif
     }
 
 #ifdef DEBUG_VIDEO
     /* Print picture date and rendering time */
     intf_DbgMsg("picture %p rendered in buffer %d (%ld us), display date: %s\n", p_pic,
-                p_vout->i_buffer_index, (long) (mdate() - render_time), 
+                p_vout->i_buffer_index, (long) (mdate() - render_time),
                 mstrtime( psz_date, p_pic->date ));
 #endif
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RenderPictureInfo: print additionnal informations on a picture
- ******************************************************************************
+ *****************************************************************************
  * This function will print informations such as fps and other picture
  * dependant informations.
- ******************************************************************************/
+ *****************************************************************************/
 static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic )
 {
 #if defined(STATS) || defined(DEBUG)
-    char        psz_buffer[256];                             /* string buffer */
+    char        psz_buffer[256];                            /* string buffer */
 #endif
 
 #ifdef STATS
-    /* 
-     * Print FPS rate in upper right corner 
+    /*
+     * Print FPS rate in upper right corner
      */
     if( p_vout->c_fps_samples > VOUT_FPS_SAMPLES )
-    {        
+    {
         sprintf( psz_buffer, "%.2f fps", (double) VOUT_FPS_SAMPLES * 1000000 /
                  ( p_vout->p_fps_sample[ (p_vout->c_fps_samples - 1) % VOUT_FPS_SAMPLES ] -
-                   p_vout->p_fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) );        
+                   p_vout->p_fps_sample[ p_vout->c_fps_samples % VOUT_FPS_SAMPLES ] ) );
         Print( p_vout, 0, 0, RIGHT_RALIGN, TOP_RALIGN, psz_buffer );
     }
 
-    /* 
-     * Print frames count and loop time in upper left corner 
+    /*
+     * Print frames count and loop time in upper left corner
      */
-    sprintf( psz_buffer, "%ld frames   rendering: %ld us", 
+    sprintf( psz_buffer, "%ld frames   rendering: %ld us",
              (long) p_vout->c_fps_samples, (long) p_vout->render_time );
     Print( p_vout, 0, 0, LEFT_RALIGN, TOP_RALIGN, psz_buffer );
 #endif
@@ -1612,69 +1612,69 @@ static void RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic )
              p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_width,
              p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height,
              p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_x,
-             p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_y );    
+             p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_y );
     Print( p_vout, 0, 0, RIGHT_RALIGN, BOTTOM_RALIGN, psz_buffer );
 #endif
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RenderIdle: render idle picture
- ******************************************************************************
- * This function will print something on the screen. It will return 0 if 
+ *****************************************************************************
+ * This function will print something on the screen. It will return 0 if
  * nothing has been rendered, or 1 if something has been changed on the screen.
  * Note that if you absolutely want something to be printed, you will have
  * to force it by setting the last idle date to 0.
- * Unlike other rendering functions, this one calls the SetBufferPicture 
+ * Unlike other rendering functions, this one calls the SetBufferPicture
  * function when needed.
- ******************************************************************************/
+ *****************************************************************************/
 static int RenderIdle( vout_thread_t *p_vout )
 {
-    int         i_x = 0, i_y = 0;                            /* text position */    
-    int         i_width, i_height;                               /* text size */    
-    mtime_t     current_date;                                 /* current date */
-    const char *psz_text = "waiting for stream ...";       /* text to display */
-    
-    
-    current_date = mdate();    
+    int         i_x = 0, i_y = 0;                           /* text position */
+    int         i_width, i_height;                              /* text size */
+    mtime_t     current_date;                                /* current date */
+    const char *psz_text = "waiting for stream ...";      /* text to display */
+
+
+    current_date = mdate();
     if( (current_date - p_vout->last_display_date) > VOUT_IDLE_DELAY &&
         (current_date - p_vout->last_idle_date) > VOUT_IDLE_DELAY )
     {
-        SetBufferPicture( p_vout, NULL );            
+        SetBufferPicture( p_vout, NULL );
         vout_TextSize( p_vout->p_large_font, WIDE_TEXT | OUTLINED_TEXT, psz_text,
                        &i_width, &i_height );
         if( !Align( p_vout, &i_x, &i_y, i_width, i_height, CENTER_RALIGN, CENTER_RALIGN ) )
-        {  
-            vout_Print( p_vout->p_large_font, 
+        {
+            vout_Print( p_vout->p_large_font,
                         p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
                         i_x * p_vout->i_bytes_per_pixel + i_y * p_vout->i_bytes_per_line,
                         p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
                         p_vout->i_white_pixel, p_vout->i_gray_pixel, 0,
-                        WIDE_TEXT | OUTLINED_TEXT, psz_text );        
+                        WIDE_TEXT | OUTLINED_TEXT, psz_text );
             SetBufferArea( p_vout, i_x, i_y, i_width, i_height );
-        }        
-        return( 1 );        
+        }
+        return( 1 );
     }
-    return( 0 );    
+    return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * RenderInfo: render additionnal informations
- ******************************************************************************
+ *****************************************************************************
  * This function render informations which do not depend of the current picture
  * rendered.
- ******************************************************************************/
+ *****************************************************************************/
 static void RenderInfo( vout_thread_t *p_vout )
 {
 #ifdef DEBUG
-    char        psz_buffer[256];                             /* string buffer */
-    int         i_ready_pic = 0;                            /* ready pictures */
-    int         i_reserved_pic = 0;                      /* reserved pictures */
-    int         i_picture;                                   /* picture index */
+    char        psz_buffer[256];                            /* string buffer */
+    int         i_ready_pic = 0;                           /* ready pictures */
+    int         i_reserved_pic = 0;                     /* reserved pictures */
+    int         i_picture;                                  /* picture index */
 #endif
 
 #ifdef DEBUG
-    /* 
-     * Print thread state in lower left corner  
+    /*
+     * Print thread state in lower left corner
      */
     for( i_picture = 0; i_picture < VOUT_MAX_PICTURES; i_picture++ )
     {
@@ -1683,74 +1683,74 @@ static void RenderInfo( vout_thread_t *p_vout )
         case RESERVED_PICTURE:
         case RESERVED_DATED_PICTURE:
         case RESERVED_DISP_PICTURE:
-            i_reserved_pic++;            
-            break;            
+            i_reserved_pic++;
+            break;
         case READY_PICTURE:
-            i_ready_pic++;            
-            break;            
-        }        
+            i_ready_pic++;
+            break;
+        }
     }
-    sprintf( psz_buffer, "pic: %d/%d/%d", 
+    sprintf( psz_buffer, "pic: %d/%d/%d",
              i_reserved_pic, i_ready_pic, VOUT_MAX_PICTURES );
-    Print( p_vout, 0, 0, LEFT_RALIGN, BOTTOM_RALIGN, psz_buffer );    
+    Print( p_vout, 0, 0, LEFT_RALIGN, BOTTOM_RALIGN, psz_buffer );
 #endif
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * RenderSubPicture: render a subpicture
- *******************************************************************************
+ *****************************************************************************
  * This function render a sub picture unit.
- *******************************************************************************/
+ *****************************************************************************/
 static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
 {
-    p_vout_font_t       p_font;                                   /* text font */    
-    int                 i_width, i_height;            /* subpicture dimensions */    
-    
+    p_vout_font_t       p_font;                                 /* text font */
+    int                 i_width, i_height;          /* subpicture dimensions */
+
     switch( p_subpic->i_type )
     {
-    case TEXT_SUBPICTURE:                                  /* single line text */
+    case TEXT_SUBPICTURE:                                /* single line text */
         /* Select default font if not specified */
         p_font = p_subpic->type.text.p_font;
         if( p_font == NULL )
         {
-            p_font = p_vout->p_default_font;            
+            p_font = p_vout->p_default_font;
         }
 
         /* Computes text size (width and height fields are ignored) and print it */
-        vout_TextSize( p_font, p_subpic->type.text.i_style, p_subpic->p_data, &i_width, &i_height );        
+        vout_TextSize( p_font, p_subpic->type.text.i_style, p_subpic->p_data, &i_width, &i_height );
         if( !Align( p_vout, &p_subpic->i_x, &p_subpic->i_y, i_width, i_height,
                     p_subpic->i_horizontal_align, p_subpic->i_vertical_align ) )
         {
             vout_Print( p_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
                         p_subpic->i_x * p_vout->i_bytes_per_pixel +
-                        p_subpic->i_y * p_vout->i_bytes_per_line, 
+                        p_subpic->i_y * p_vout->i_bytes_per_line,
                         p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
                         p_subpic->type.text.i_char_color, p_subpic->type.text.i_border_color,
                         p_subpic->type.text.i_bg_color, p_subpic->type.text.i_style,
-                        p_subpic->p_data );            
-            SetBufferArea( p_vout, p_subpic->i_x, p_subpic->i_y, i_width, i_height );            
-        }        
-        break;        
-        
+                        p_subpic->p_data );
+            SetBufferArea( p_vout, p_subpic->i_x, p_subpic->i_y, i_width, i_height );
+        }
+        break;
+
 #ifdef DEBUG
     default:
-        intf_DbgMsg("error: unknown subpicture %p type %d\n", p_subpic, p_subpic->i_type );        
+        intf_DbgMsg("error: unknown subpicture %p type %d\n", p_subpic, p_subpic->i_type );
 #endif
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * RenderInterface: render the interface
- *******************************************************************************
+ *****************************************************************************
  * This function render the interface, if any.
- *******************************************************************************/
+ *****************************************************************************/
 static void RenderInterface( vout_thread_t *p_vout )
 {
-    int         i_height, i_text_height;              /* total and text height */
-    int         i_width_1, i_width_2;                            /* text width */
-    int         i_byte;                                          /* byte index */
+    int         i_height, i_text_height;            /* total and text height */
+    int         i_width_1, i_width_2;                          /* text width */
+    int         i_byte;                                        /* byte index */
     const char *psz_text_1 = "[1-9] Channel   [i]nfo   [c]olor     [g/G]amma";
-    const char *psz_text_2 = "[+/-] Volume    [m]ute   [s]caling   [Q]uit";    
+    const char *psz_text_2 = "[+/-] Volume    [m]ute   [s]caling   [Q]uit";
 
     /* Get text size */
     vout_TextSize( p_vout->p_large_font, OUTLINED_TEXT, psz_text_1, &i_width_1, &i_height );
@@ -1764,11 +1764,11 @@ static void RenderInterface( vout_thread_t *p_vout )
     {
         //?? noooo !
         p_vout->p_buffer[ p_vout->i_buffer_index ].p_data[ i_byte ] = p_vout->i_blue_pixel;
-    }    
+    }
 
     /* Render text, if not larger than screen */
     if( i_width_1 < p_vout->i_width )
-    {        
+    {
         vout_Print( p_vout->p_large_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
                     (p_vout->i_height - i_height) * p_vout->i_bytes_per_line,
                     p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
@@ -1776,48 +1776,48 @@ static void RenderInterface( vout_thread_t *p_vout )
                     OUTLINED_TEXT, psz_text_1 );
     }
     if( i_width_2 < p_vout->i_width )
-    {        
+    {
         vout_Print( p_vout->p_large_font, p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
                     (p_vout->i_height - i_height + i_text_height) * p_vout->i_bytes_per_line,
                     p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
                     p_vout->i_white_pixel, p_vout->i_black_pixel, 0,
                     OUTLINED_TEXT, psz_text_2 );
-    }    
+    }
 
     /* Activate modified area */
     SetBufferArea( p_vout, 0, p_vout->i_height - i_height, p_vout->i_width, i_height );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Manage: manage thread
- ******************************************************************************
+ *****************************************************************************
  * This function will handle changes in thread configuration.
- ******************************************************************************/
+ *****************************************************************************/
 static int Manage( vout_thread_t *p_vout )
 {
 #ifdef DEBUG_VIDEO
     if( p_vout->i_changes )
     {
-        intf_DbgMsg("changes: 0x%x (no display: 0x%x)\n", p_vout->i_changes, 
-                    p_vout->i_changes & VOUT_NODISPLAY_CHANGE );        
-    }    
+        intf_DbgMsg("changes: 0x%x (no display: 0x%x)\n", p_vout->i_changes,
+                    p_vout->i_changes & VOUT_NODISPLAY_CHANGE );
+    }
 #endif
 
     /* On gamma or grayscale change, rebuild tables */
-    if( p_vout->i_changes & (VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE | 
+    if( p_vout->i_changes & (VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE |
                              VOUT_YUV_CHANGE) )
     {
         if( vout_ResetYUV( p_vout ) )
         {
-            intf_ErrMsg("error: can't rebuild convertion tables\n");            
-            return( 1 );            
-        }        
+            intf_ErrMsg("error: can't rebuild convertion tables\n");
+            return( 1 );
+        }
     }
 
     /* Clear changes flags which does not need management or have been
      * handled */
-    p_vout->i_changes &= ~(VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE | 
-                           VOUT_YUV_CHANGE   | VOUT_INFO_CHANGE | 
+    p_vout->i_changes &= ~(VOUT_GAMMA_CHANGE | VOUT_GRAYSCALE_CHANGE |
+                           VOUT_YUV_CHANGE   | VOUT_INFO_CHANGE |
                            VOUT_INTF_CHANGE  | VOUT_SCALE_CHANGE );
 
     /* Detect unauthorized changes */
@@ -1825,72 +1825,72 @@ static int Manage( vout_thread_t *p_vout )
     {
         /* Some changes were not acknowledged by vout_SysManage or this function,
          * it means they should not be authorized */
-        intf_ErrMsg( "error: unauthorized changes in the video output thread\n" );        
-        return( 1 );        
+        intf_ErrMsg( "error: unauthorized changes in the video output thread\n" );
+        return( 1 );
     }
-    
-    return( 0 );    
+
+    return( 0 );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * Align: align a subpicture in the screen
- ******************************************************************************
+ *****************************************************************************
  * This function is used for rendering text or subpictures. It returns non 0
  * it the final aera is not fully included in display area. Return coordinates
  * are absolute.
- ******************************************************************************/
-static int Align( vout_thread_t *p_vout, int *pi_x, int *pi_y, 
+ *****************************************************************************/
+static int Align( vout_thread_t *p_vout, int *pi_x, int *pi_y,
                    int i_width, int i_height, int i_h_align, int i_v_align )
 {
     /* Align horizontally */
     switch( i_h_align )
     {
     case CENTER_ALIGN:
-        *pi_x -= i_width / 2;        
-        break;        
+        *pi_x -= i_width / 2;
+        break;
     case CENTER_RALIGN:
-        *pi_x += (p_vout->i_width - i_width) / 2;        
-        break;        
-    case RIGHT_ALIGN:   
-        *pi_x -= i_width;        
-        break;        
+        *pi_x += (p_vout->i_width - i_width) / 2;
+        break;
+    case RIGHT_ALIGN:
+        *pi_x -= i_width;
+        break;
     case RIGHT_RALIGN:
-        *pi_x += p_vout->i_width - i_width;        
-        break;        
+        *pi_x += p_vout->i_width - i_width;
+        break;
     }
 
     /* Align vertically */
     switch( i_v_align )
     {
     case CENTER_ALIGN:
-        *pi_y -= i_height / 2;        
+        *pi_y -= i_height / 2;
         break;
     case CENTER_RALIGN:
-        *pi_y += (p_vout->i_height - i_height) / 2;        
-        break;        
+        *pi_y += (p_vout->i_height - i_height) / 2;
+        break;
     case BOTTOM_ALIGN:
-        *pi_y -= i_height;        
-        break;        
+        *pi_y -= i_height;
+        break;
     case BOTTOM_RALIGN:
-        *pi_y += p_vout->i_height - i_height;        
-        break;        
+        *pi_y += p_vout->i_height - i_height;
+        break;
     case SUBTITLE_RALIGN:
-        *pi_y += (p_vout->i_height + p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_y + 
-                  p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height - i_height) / 2;        
-        break;        
+        *pi_y += (p_vout->i_height + p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_y +
+                  p_vout->p_buffer[ p_vout->i_buffer_index ].i_pic_height - i_height) / 2;
+        break;
     }
 
     /* Return non 0 if clipping failed */
-    return( (*pi_x < 0) || (*pi_y < 0) || 
-            (*pi_x + i_width > p_vout->i_width) || (*pi_y + i_height > p_vout->i_height) );    
+    return( (*pi_x < 0) || (*pi_y < 0) ||
+            (*pi_x + i_width > p_vout->i_width) || (*pi_y + i_height > p_vout->i_height) );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * SetPalette: sets an 8 bpp palette
- ******************************************************************************
+ *****************************************************************************
  * This function is just a prototype that does nothing. Architectures that
  * support palette allocation should override it.
- ******************************************************************************/
+ *****************************************************************************/
 static void     SetPalette        ( p_vout_thread_t p_vout, u16 *red,
                                     u16 *green, u16 *blue, u16 *transp )
 {
index 61ca913839552c14bebb744bf67594af3428f462..647bcaf93481c2e74d4a61d2081a0d74a8116e64 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_text.c : text manipulation functions
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include "video_text.h"
 #include "intf_msg.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_font_t: bitmap font
- *******************************************************************************
- * This structure is used when the system doesn't provide a convenient function 
+ *****************************************************************************
+ * This structure is used when the system doesn't provide a convenient function
  * to print simple characters in a buffer.
  * VOUT_FIXED_FONTs are stored in raw mode, character after character, with a
- * first array of characters followed by a second array of borders masks. 
+ * first array of characters followed by a second array of borders masks.
  * Therefore the border masks can't be complete if the font has pixels on the
  * border.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_font_s
 {
     int                 i_type;                                 /* font type */
@@ -44,23 +44,23 @@ typedef struct vout_font_s
 /* Font types */
 #define VOUT_FIXED_FONT       0                         /* simple fixed font */
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_put_byte_t: PutByte function
- *******************************************************************************
- * These functions will transform masks in a set of pixels. For each pixel, 
+ *****************************************************************************
+ * These functions will transform masks in a set of pixels. For each pixel,
  * character, then border and background masks are tested, and the first
  * encountered color is set.
- *******************************************************************************/
-typedef void (vout_put_byte_t)( void *p_pic, int i_byte, int i_char, int i_border, 
+ *****************************************************************************/
+typedef void (vout_put_byte_t)( void *p_pic, int i_byte, int i_char, int i_border,
                                 int i_bg, u32 i_char_color, u32 i_border_color, u32 i_bg_color );
 
 
-/*******************************************************************************
+/*****************************************************************************
  * Macros
- *******************************************************************************/
+ *****************************************************************************/
 
 /* PUT_BYTE_MASK: put pixels from a byte-wide mask. It uses a branching tree
- * to optimize the number of tests. It is used in the PutByte functions. 
+ * to optimize the number of tests. It is used in the PutByte functions.
  * This macro works for 1, 2 and 4 Bpp. */
 #define PUT_BYTE_MASK( i_mask, i_mask_color )                                 \
 if( i_mask & 0xf0 )                                       /* one from 1111 */ \
@@ -161,7 +161,7 @@ if( i_mask & 0x0f )                                                           \
 }
 
 /*****************************************************************************
- * Local prototypes 
+ * Local prototypes
  *****************************************************************************/
 static void PutByte8 ( u8 *p_pic, int i_byte, int i_char, int i_border,
                        int i_bg, u32 i_char_color, u32 i_border_color,
@@ -188,21 +188,21 @@ vout_font_t *vout_LoadFont( const char *psz_name )
     int                 i_file;                               /* source file */
     byte_t              pi_buffer[2];                         /* file buffer */
     vout_font_t *       p_font;                           /* the font itself */
-    
+
     /* Open file */
     i_file = open( psz_name, O_RDONLY );
     if( i_file == -1 )
     {
-        intf_ErrMsg("error: can't open file '%s' (%s)\n", psz_name, strerror(errno));        
-        return( NULL );        
+        intf_ErrMsg("error: can't open file '%s' (%s)\n", psz_name, strerror(errno));
+        return( NULL );
     }
 
     /* Read magick number */
     if( read( i_file, pi_buffer, 2 ) != 2 )
     {
         intf_ErrMsg("error: unexpected end of file '%s'\n", psz_name );
-        close( i_file );        
-        return( NULL );                
+        close( i_file );
+        return( NULL );
     }
 
     /* Allocate font descriptor */
@@ -211,14 +211,14 @@ vout_font_t *vout_LoadFont( const char *psz_name )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
         close( i_file );
-        return( NULL );        
+        return( NULL );
     }
-    
+
     /* Read file */
     switch( ((u16)pi_buffer[0] << 8) | pi_buffer[1] )
     {
     case 0x3604:                                              /* .psf file */
-        /* 
+        /*
          * PSF font: simple fixed font. Only the first 256 characters are read.
          * Those fonts are always 1 byte width, and 256 or 512 characters long.
          */
@@ -227,108 +227,108 @@ vout_font_t *vout_LoadFont( const char *psz_name )
         if( read( i_file, pi_buffer, 2 ) != 2)
         {
             intf_ErrMsg("error: unexpected end of file '%s'\n", psz_name );
-            free( p_font );            
-            close( i_file );        
-            return( NULL );                
+            free( p_font );
+            close( i_file );
+            return( NULL );
         }
 
         /* Copy font properties */
         p_font->i_type =                VOUT_FIXED_FONT;
         p_font->i_width =               8;
-        p_font->i_height =              pi_buffer[1];        
+        p_font->i_height =              pi_buffer[1];
         p_font->i_interspacing =        8;
         p_font->i_bytes_per_line =      1;
         p_font->i_bytes_per_char =      pi_buffer[1];
         p_font->i_first =               0;
         p_font->i_last =                255;
-        
+
         /* Allocate font space */
         p_font->p_data = malloc( 2 * 256 * pi_buffer[1] );
         if( p_font->p_data == NULL )
         {
             intf_ErrMsg("error: %s\n", strerror(ENOMEM));
-            free( p_font );            
+            free( p_font );
             close( i_file );
-            return( NULL );        
+            return( NULL );
         }
+
         /* Copy raw data */
         if( read( i_file, p_font->p_data, 256 * pi_buffer[1] ) != 256 * pi_buffer[1] )
         {
             intf_ErrMsg("error: unexpected end of file '%s'\n", psz_name );
-            free( p_font->p_data );            
-            free( p_font );            
-            close( i_file );        
-            return( NULL );                
-        } 
+            free( p_font->p_data );
+            free( p_font );
+            close( i_file );
+            return( NULL );
+        }
 
-        /* Computes border masks - remember that masks have the same matrix as 
+        /* Computes border masks - remember that masks have the same matrix as
          * characters, so an empty character border is required to have a complete
          * border mask. */
         for( i_char = 0; i_char <= 255; i_char++ )
         {
             for( i_line = 0; i_line < pi_buffer[1]; i_line++ )
             {
-                
+
                 p_font->p_data[ (i_char + 256) * pi_buffer[1] + i_line ] =
                     ((p_font->p_data[ i_char * pi_buffer[1] + i_line ] << 1) |
                      (p_font->p_data[ i_char * pi_buffer[1] + i_line ] >> 1) |
                      (i_line > 0 ? p_font->p_data[ i_char * pi_buffer[1] + i_line - 1]: 0) |
-                     (i_line < pi_buffer[1] - 1 ? p_font->p_data[ i_char * pi_buffer[1] + i_line + 1]: 0)) 
-                    & ~p_font->p_data[ i_char * pi_buffer[1] + i_line ];          
-            }            
+                     (i_line < pi_buffer[1] - 1 ? p_font->p_data[ i_char * pi_buffer[1] + i_line + 1]: 0))
+                    & ~p_font->p_data[ i_char * pi_buffer[1] + i_line ];
+            }
         }
-        
+
         break;
     default:
         intf_ErrMsg("error: file '%s' has an unknown format\n", psz_name );
-        free( p_font );        
+        free( p_font );
         close( i_file );
-        return( NULL );        
-        break;                
-    }        
-    
-    
-    intf_DbgMsg( "loaded %s: type %d, %d-%dx%d\n", psz_name, p_font->i_type, 
+        return( NULL );
+        break;
+    }
+
+
+    intf_DbgMsg( "loaded %s: type %d, %d-%dx%d\n", psz_name, p_font->i_type,
                  p_font->i_width, p_font->i_interspacing, p_font->i_height );
     return( p_font );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_UnloadFont: unload a font
- *******************************************************************************
+ *****************************************************************************
  * This function free the resources allocated by vout_LoadFont
- *******************************************************************************/
+ *****************************************************************************/
 void vout_UnloadFont( vout_font_t *p_font )
 {
-    intf_DbgMsg( "font %p\n", p_font );    
-    free( p_font->p_data );    
-    free( p_font );    
+    intf_DbgMsg( "font %p\n", p_font );
+    free( p_font->p_data );
+    free( p_font );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_TextSize: return the dimensions of a text
- *******************************************************************************
+ *****************************************************************************
  * This function is used to align text. It returns the width and height of a
- * given text. 
- *******************************************************************************/
+ * given text.
+ *****************************************************************************/
 void vout_TextSize( vout_font_t *p_font, int i_style, const char *psz_text, int *pi_width, int *pi_height )
 {
     switch( p_font->i_type )
     {
-    case VOUT_FIXED_FONT:        
-        *pi_width  = ((i_style & WIDE_TEXT) ? p_font->i_interspacing * 2 : p_font->i_interspacing) * 
+    case VOUT_FIXED_FONT:
+        *pi_width  = ((i_style & WIDE_TEXT) ? p_font->i_interspacing * 2 : p_font->i_interspacing) *
             (strlen( psz_text ) - 1) + p_font->i_width;
         *pi_height = p_font->i_height;
         if( i_style & ITALIC_TEXT )
         {
-            *pi_width = *pi_height / 3;            
-        }        
+            *pi_width = *pi_height / 3;
+        }
         break;
 #ifdef DEBUG
     default:
-        intf_DbgMsg("error: unknown font type %d\n", p_font->i_type );        
-        break;        
+        intf_DbgMsg("error: unknown font type %d\n", p_font->i_type );
+        break;
 #endif
     }
 }
@@ -339,7 +339,7 @@ void vout_TextSize( vout_font_t *p_font, int i_style, const char *psz_text, int
  * This function prints a text, without clipping, in a buffer using a
  * previously loaded bitmap font.
  *****************************************************************************/
-void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int i_bytes_per_line, 
+void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int i_bytes_per_line,
                  u32 i_char_color, u32 i_border_color, u32 i_bg_color, int i_style, const char *psz_text )
 {
     byte_t      *p_char, *p_border;        /* character and border mask data */
@@ -350,14 +350,14 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
     int         i_font_bytes_per_line, i_font_height;     /* font properties */
     vout_put_byte_t *p_PutByte;                          /* PutByte function */
 
-    //?? background: can be something else that whole byte 
+    //?? background: can be something else that whole byte
 
     /* Select output function */
     switch( i_bytes_per_pixel )
     {
     case 1:
         p_PutByte = (vout_put_byte_t *) PutByte8;
-        break;        
+        break;
     case 2:
         p_PutByte = (vout_put_byte_t *) PutByte16;
         break;
@@ -377,8 +377,8 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
 
     i_font_bytes_per_line =     p_font->i_bytes_per_line;
     i_font_height =             p_font->i_height;
-    i_interspacing =            i_bytes_per_pixel * ((i_style & WIDE_TEXT) ? 
-                                                     p_font->i_interspacing * 2 : 
+    i_interspacing =            i_bytes_per_pixel * ((i_style & WIDE_TEXT) ?
+                                                     p_font->i_interspacing * 2 :
                                                      p_font->i_interspacing);
 
     /* Print text */
@@ -386,55 +386,55 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
     {
         /* Check that the character is valid */
         if( (*psz_text >= p_font->i_first) && (*psz_text <= p_font->i_last) )
-        {       
+        {
             /* Select character - bytes per char is always valid, event for
              * non fixed fonts */
             p_char =    p_font->p_data + (*psz_text - p_font->i_first) * p_font->i_bytes_per_char;
-            p_border =  p_char + (p_font->i_last - p_font->i_first + 1) * p_font->i_bytes_per_char;            
+            p_border =  p_char + (p_font->i_last - p_font->i_first + 1) * p_font->i_bytes_per_char;
 
-            /* Select base address for output */            
+            /* Select base address for output */
             switch( p_font->i_type )
             {
             case VOUT_FIXED_FONT:
-                /* 
-                 * Simple fixed width font 
+                /*
+                 * Simple fixed width font
                  */
 
                 /* Italic text: shift picture start right */
                 if( i_style & ITALIC_TEXT )
                 {
-                    p_pic += i_bytes_per_pixel * (p_font->i_height / 3);                    
+                    p_pic += i_bytes_per_pixel * (p_font->i_height / 3);
                 }
 
                 /* Print character */
                 for( i_line = 0; i_line < i_font_height; i_line ++ )
-                {                                        
+                {
                     for( i_byte = 0; i_byte < i_font_bytes_per_line; i_byte++, p_char++, p_border++)
                     {
                         /* Put pixels */
-                        p_PutByte( p_pic + i_bytes_per_line * i_line, i_byte, 
-                                   *p_char & i_char_mask, *p_border & i_border_mask, i_bg_mask, 
+                        p_PutByte( p_pic + i_bytes_per_line * i_line, i_byte,
+                                   *p_char & i_char_mask, *p_border & i_border_mask, i_bg_mask,
                                    i_char_color, i_border_color, i_bg_color );
                     }
-                        
+
                     /* Italic text: shift picture start left */
                     if( (i_style & ITALIC_TEXT) && !(i_line % 3) )
-                    {                            
+                    {
                         p_pic -= i_bytes_per_pixel;
                     }
                 }
 
                 /* Jump to next character */
                 p_pic += i_interspacing;
-                break;                
+                break;
 #ifdef DEBUG
             default:
-                intf_DbgMsg("error: unknown font type %d\n", p_font->i_type );        
-                break;        
+                intf_DbgMsg("error: unknown font type %d\n", p_font->i_type );
+                break;
 #endif
             }
-        }       
-    }    
+        }
+    }
 }
 
 /* following functions are local */
@@ -476,7 +476,7 @@ static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
 /*****************************************************************************
  * PutByte24: print a fixed width font character byte in 3 Bpp
  *****************************************************************************/
-static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, 
+static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
                        u32 i_char_color, u32 i_border_color, u32 i_bg_color )
 {
     //??
@@ -485,7 +485,7 @@ static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border,
 /*****************************************************************************
  * PutByte32: print a fixed width font character byte in 4 Bpp
  *****************************************************************************/
-static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg, 
+static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
                        u32 i_char_color, u32 i_border_color, u32 i_bg_color )
 {
     /* Computes position offset and background mask */
index 61388b39e128934654fcd6b2db3218bf0eacefbd..e653c6c49f56cd3b872c31b56bd390d752630358 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * vout_x11.c: X11 video output display method
  * (c)1998 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 
 #include <errno.h>
 #include <stdlib.h>
 #include "video_yuv.h"
 #include "intf_msg.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_sys_t: video output X11 method descriptor
- *******************************************************************************
+ *****************************************************************************
  * This structure is part of the video output thread descriptor.
- * It describes the X11 specific properties of an output thread. X11 video 
+ * It describes the X11 specific properties of an output thread. X11 video
  * output is performed through regular resizable windows. Windows can be
  * dynamically resized to adapt to the size of the streams.
- *******************************************************************************/
+ *****************************************************************************/
 typedef struct vout_sys_s
 {
     /* User settings */
@@ -43,15 +43,15 @@ typedef struct vout_sys_s
 
     /* Internal settings and properties */
     Display *           p_display;                        /* display pointer */
-    Visual *            p_visual;                          /* visual pointer */    
+    Visual *            p_visual;                          /* visual pointer */
     int                 i_screen;                           /* screen number */
     Window              root_window;                          /* root window */
     Window              window;                   /* window instance handler */
-    GC                  gc;              /* graphic context instance handler */    
+    GC                  gc;              /* graphic context instance handler */
     Colormap            colormap;               /* colormap used (8bpp only) */
 
     /* Display buffers and shared memory information */
-    XImage *            p_ximage[2];                       /* XImage pointer */   
+    XImage *            p_ximage[2];                       /* XImage pointer */
     XShmSegmentInfo     shm_info[2];       /* shared memory zone information */
 } vout_sys_t;
 
@@ -64,27 +64,27 @@ static int  X11CreateWindow     ( vout_thread_t *p_vout );
 static void X11DestroyWindow    ( vout_thread_t *p_vout );
 static int  X11CreateImage      ( vout_thread_t *p_vout, XImage **pp_ximage );
 static void X11DestroyImage     ( XImage *p_ximage );
-static int  X11CreateShmImage   ( vout_thread_t *p_vout, XImage **pp_ximage, 
+static int  X11CreateShmImage   ( vout_thread_t *p_vout, XImage **pp_ximage,
                                   XShmSegmentInfo *p_shm_info );
-static void X11DestroyShmImage  ( vout_thread_t *p_vout, XImage *p_ximage, 
+static void X11DestroyShmImage  ( vout_thread_t *p_vout, XImage *p_ximage,
                                   XShmSegmentInfo *p_shm_info );
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysCreate: allocate X11 video thread output method
- *******************************************************************************
+ *****************************************************************************
  * This function allocate and initialize a X11 vout method. It uses some of the
  * vout properties to choose the window size, and change them according to the
  * actual properties of the display.
- *******************************************************************************/
+ *****************************************************************************/
 int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
 {
     /* Allocate structure */
-    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );    
+    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {   
-        intf_ErrMsg("error: %s\n", strerror(ENOMEM) );        
-        return( 1 );        
-    }    
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
+        return( 1 );
+    }
 
     /* Open and initialize device. This function issues its own error messages.
      * Since XLib is usually not thread-safe, we can't use the same display
@@ -94,42 +94,42 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window
     {
         intf_ErrMsg("error: can't initialize X11 display\n" );
         free( p_vout->p_sys );
-        return( 1 );               
+        return( 1 );
     }
 
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysInit: initialize X11 video thread output method
- *******************************************************************************
+ *****************************************************************************
  * This function create the XImages needed by the output thread. It is called
  * at the beginning of the thread, but also each time the window is resized.
- *******************************************************************************/
+ *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
-{ 
+{
     int i_err;
 
-    /* Create XImages using XShm extension - on failure, fall back to regular 
+    /* Create XImages using XShm extension - on failure, fall back to regular
      * way (and destroy the first image if it was created successfully) */
     if( p_vout->p_sys->b_shm )
     {
         /* Create first image */
-        i_err = X11CreateShmImage( p_vout, &p_vout->p_sys->p_ximage[0], 
+        i_err = X11CreateShmImage( p_vout, &p_vout->p_sys->p_ximage[0],
                                    &p_vout->p_sys->shm_info[0] );
-        if( !i_err )                           /* first image has been created */
+        if( !i_err )                         /* first image has been created */
         {
             /* Create second image */
-            if( X11CreateShmImage( p_vout, &p_vout->p_sys->p_ximage[1], 
+            if( X11CreateShmImage( p_vout, &p_vout->p_sys->p_ximage[1],
                                    &p_vout->p_sys->shm_info[1] ) )
-            {                               /* error creating the second image */
-                X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[0], 
+            {                             /* error creating the second image */
+                X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[0],
                                     &p_vout->p_sys->shm_info[0] );
                 i_err = 1;
             }
         }
-        if( i_err )                                        /* an error occured */
-        {                        
+        if( i_err )                                      /* an error occured */
+        {
             intf_Msg("XShm video sextension desactivated\n" );
             p_vout->p_sys->b_shm = 0;
         }
@@ -156,25 +156,25 @@ int vout_SysInit( vout_thread_t *p_vout )
     }
 
     /* Set bytes per line and initialize buffers */
-    p_vout->i_bytes_per_line = p_vout->p_sys->p_ximage[0]->bytes_per_line;    
-    vout_SetBuffers( p_vout, p_vout->p_sys->p_ximage[ 0 ]->data, 
+    p_vout->i_bytes_per_line = p_vout->p_sys->p_ximage[0]->bytes_per_line;
+    vout_SetBuffers( p_vout, p_vout->p_sys->p_ximage[ 0 ]->data,
                      p_vout->p_sys->p_ximage[ 1 ]->data );
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysEnd: terminate X11 video thread output method
- *******************************************************************************
- * Destroy the X11 XImages created by vout_SysInit. It is called at the end of 
+ *****************************************************************************
+ * Destroy the X11 XImages created by vout_SysInit. It is called at the end of
  * the thread, but also each time the window is resized.
- *******************************************************************************/
+ *****************************************************************************/
 void vout_SysEnd( vout_thread_t *p_vout )
 {
-    if( p_vout->p_sys->b_shm )                              /* Shm XImages... */
+    if( p_vout->p_sys->b_shm )                             /* Shm XImages... */
     {
-        X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[0], 
+        X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[0],
                             &p_vout->p_sys->shm_info[0] );
-        X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[1], 
+        X11DestroyShmImage( p_vout, p_vout->p_sys->p_ximage[1],
                             &p_vout->p_sys->shm_info[1] );
     }
     else                                          /* ...or regular XImages */
@@ -184,24 +184,24 @@ void vout_SysEnd( vout_thread_t *p_vout )
     }
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysDestroy: destroy X11 video thread output method
- *******************************************************************************
+ *****************************************************************************
  * Terminate an output method created by vout_X11CreateOutputMethod
- *******************************************************************************/
+ *****************************************************************************/
 void vout_SysDestroy( vout_thread_t *p_vout )
 {
     X11CloseDisplay( p_vout );
     free( p_vout->p_sys );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysManage: handle X11 events
- *******************************************************************************
+ *****************************************************************************
  * This function should be called regularly by video output thread. It manages
- * X11 events and allows window resizing. It returns a non null value on 
+ * X11 events and allows window resizing. It returns a non null value on
  * error.
- *******************************************************************************/
+ *****************************************************************************/
 int vout_SysManage( vout_thread_t *p_vout )
 {
     /*
@@ -212,17 +212,17 @@ int vout_SysManage( vout_thread_t *p_vout )
         //??
         //?? clear flags
     }
-    
+
     /*
      * Size change
      */
     if( p_vout->i_changes & VOUT_SIZE_CHANGE )
-    {        
-        intf_DbgMsg("resizing window\n");      
-        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;       
+    {
+        intf_DbgMsg("resizing window\n");
+        p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
 
         /* Resize window */
-        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window, 
+        XResizeWindow( p_vout->p_sys->p_display, p_vout->p_sys->window,
                        p_vout->i_width, p_vout->i_height );
 
         /* Destroy XImages to change their size */
@@ -232,7 +232,7 @@ int vout_SysManage( vout_thread_t *p_vout )
         if( vout_SysInit( p_vout ) )
         {
             intf_ErrMsg("error: can't resize display\n");
-            return( 1 );            
+            return( 1 );
         }
 
         /* Tell the video output thread that it will need to rebuild YUV
@@ -240,36 +240,36 @@ int vout_SysManage( vout_thread_t *p_vout )
         p_vout->i_changes |= VOUT_YUV_CHANGE;
         intf_Msg("Video display resized (%dx%d)\n", p_vout->i_width, p_vout->i_height);
     }
-    
+
     return 0;
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vout_SysDisplay: displays previously rendered output
- *******************************************************************************
+ *****************************************************************************
  * This function send the currently rendered image to X11 server, wait until
  * it is displayed and switch the two rendering buffer, preparing next frame.
- *******************************************************************************/
+ *****************************************************************************/
 void vout_SysDisplay( vout_thread_t *p_vout )
 {
-    if( p_vout->p_sys->b_shm)                                  /* XShm is used */
+    if( p_vout->p_sys->b_shm)                                /* XShm is used */
     {
         /* Display rendered image using shared memory extension */
-        XShmPutImage(p_vout->p_sys->p_display, p_vout->p_sys->window, p_vout->p_sys->gc, 
-                     p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ], 
-                     0, 0, 0, 0,  
-                     p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->width,  
+        XShmPutImage(p_vout->p_sys->p_display, p_vout->p_sys->window, p_vout->p_sys->gc,
+                     p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ],
+                     0, 0, 0, 0,
+                     p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->width,
                      p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->height, True);
 
         /* Send the order to the X server */
         XFlush(p_vout->p_sys->p_display);
     }
-    else                                  /* regular X11 capabilities are used */
+    else                                /* regular X11 capabilities are used */
     {
-        XPutImage(p_vout->p_sys->p_display, p_vout->p_sys->window, p_vout->p_sys->gc, 
-                  p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ], 
-                  0, 0, 0, 0,  
-                  p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->width,  
+        XPutImage(p_vout->p_sys->p_display, p_vout->p_sys->window, p_vout->p_sys->gc,
+                  p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ],
+                  0, 0, 0, 0,
+                  p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->width,
                   p_vout->p_sys->p_ximage[ p_vout->i_buffer_index ]->height);
 
         /* Send the order to the X server */
@@ -280,24 +280,24 @@ void vout_SysDisplay( vout_thread_t *p_vout )
 /* following functions are local */
 
 /*****************************************************************************
- * X11OpenDisplay: open and initialize X11 device 
+ * X11OpenDisplay: open and initialize X11 device
  *****************************************************************************
- * Create a window according to video output given size, and set other 
+ * Create a window according to video output given size, and set other
  * properties according to the display properties.
  *****************************************************************************/
 static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root_window )
 {
-    XPixmapFormatValues *       p_xpixmap_format;           /* pixmap formats */    
-    XVisualInfo *               p_xvisual;            /* visuals informations */
-    XVisualInfo                 xvisual_template;          /* visual template */
-    int                         i_count;                        /* array size */    
+    XPixmapFormatValues *       p_xpixmap_format;          /* pixmap formats */
+    XVisualInfo *               p_xvisual;           /* visuals informations */
+    XVisualInfo                 xvisual_template;         /* visual template */
+    int                         i_count;                       /* array size */
 
     /* Open display */
     p_vout->p_sys->p_display = XOpenDisplay( psz_display );
     if( p_vout->p_sys->p_display == NULL )
     {
-        intf_ErrMsg("error: can't open display %s\n", psz_display );        
-        return( 1 );        
+        intf_ErrMsg("error: can't open display %s\n", psz_display );
+        return( 1 );
     }
 
     /* Initialize structure */
@@ -305,12 +305,12 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
     p_vout->p_sys->b_shm        = (XShmQueryExtension(p_vout->p_sys->p_display) == True);
     p_vout->p_sys->i_screen     = DefaultScreen( p_vout->p_sys->p_display );
     if( !p_vout->p_sys->b_shm )
-    {        
-        intf_Msg("XShm video extension is not available\n");    
-    }    
+    {
+        intf_Msg("XShm video extension is not available\n");
+    }
 
     /* Get screen depth */
-    p_vout->i_screen_depth = XDefaultDepth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );    
+    p_vout->i_screen_depth = XDefaultDepth( p_vout->p_sys->p_display, p_vout->p_sys->i_screen );
     switch( p_vout->i_screen_depth )
     {
     case 8:
@@ -319,49 +319,49 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
          */
         xvisual_template.screen =   p_vout->p_sys->i_screen;
         xvisual_template.class =    DirectColor;
-        p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask, 
+        p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask,
                                     &xvisual_template, &i_count );
         if( p_xvisual == NULL )
         {
             intf_ErrMsg("error: no PseudoColor visual available\n");
             XCloseDisplay( p_vout->p_sys->p_display );
-            return( 1 );        
+            return( 1 );
         }
         //??
         //?? SetColormap;
-        p_vout->i_bytes_per_pixel = 1;        
+        p_vout->i_bytes_per_pixel = 1;
         break;
     case 15:
     case 16:
     case 24:
-    default:        
+    default:
         /*
          * Screen depth is higher than 8bpp. TrueColor visual is used.
          */
         xvisual_template.screen =   p_vout->p_sys->i_screen;
         xvisual_template.class =    TrueColor;
-        p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask, 
+        p_xvisual = XGetVisualInfo( p_vout->p_sys->p_display, VisualScreenMask | VisualClassMask,
                                     &xvisual_template, &i_count );
         if( p_xvisual == NULL )
         {
             intf_ErrMsg("error: no TrueColor visual available\n");
             XCloseDisplay( p_vout->p_sys->p_display );
-            return( 1 );        
+            return( 1 );
         }
         p_vout->i_red_mask =        p_xvisual->red_mask;
         p_vout->i_green_mask =      p_xvisual->green_mask;
         p_vout->i_blue_mask =       p_xvisual->blue_mask;
 
         /* There is no difference yet between 3 and 4 Bpp. The only way to find
-         * the actual number of bytes per pixel is to list supported pixmap 
+         * the actual number of bytes per pixel is to list supported pixmap
          * formats. */
         p_xpixmap_format = XListPixmapFormats( p_vout->p_sys->p_display, &i_count );
-        p_vout->i_bytes_per_pixel = 0;        
+        p_vout->i_bytes_per_pixel = 0;
         for( ; i_count--; p_xpixmap_format++ )
         {
             if( p_xpixmap_format->bits_per_pixel / 8 > p_vout->i_bytes_per_pixel )
             {
-                p_vout->i_bytes_per_pixel = p_xpixmap_format->bits_per_pixel / 8;                
+                p_vout->i_bytes_per_pixel = p_xpixmap_format->bits_per_pixel / 8;
             }
         }
         break;
@@ -372,19 +372,19 @@ static int X11OpenDisplay( vout_thread_t *p_vout, char *psz_display, Window root
     /* Create a window */
     if( X11CreateWindow( p_vout ) )
     {
-        intf_ErrMsg("error: can't open a window\n");        
-        XCloseDisplay( p_vout->p_sys->p_display );        
+        intf_ErrMsg("error: can't open a window\n");
+        XCloseDisplay( p_vout->p_sys->p_display );
         return( 1 );
     }
-    return( 0 );    
+    return( 0 );
 }
 
-/*******************************************************************************
- * X11CloseDisplay: close X11 device 
- *******************************************************************************
+/*****************************************************************************
+ * X11CloseDisplay: close X11 device
+ *****************************************************************************
  * Returns all resources allocated by X11OpenDisplay and restore the original
  * state of the display.
- *******************************************************************************/
+ *****************************************************************************/
 static void X11CloseDisplay( vout_thread_t *p_vout )
 {
     /* Destroy colormap */
@@ -395,42 +395,42 @@ static void X11CloseDisplay( vout_thread_t *p_vout )
 
     /* Destroy window and close display */
     X11DestroyWindow( p_vout );
-    XCloseDisplay( p_vout->p_sys->p_display );    
+    XCloseDisplay( p_vout->p_sys->p_display );
 }
 
-/******************************************************************************
+/*****************************************************************************
  * X11CreateWindow: create X11 vout window
- ******************************************************************************
- * The video output window will be created. Normally, this window is wether 
- * full screen or part of a parent window. Therefore, it does not need a 
+ *****************************************************************************
+ * The video output window will be created. Normally, this window is wether
+ * full screen or part of a parent window. Therefore, it does not need a
  * title or other hints. Thery are still supplied in case the window would be
  * spawned as a standalone one by the interface.
- ******************************************************************************/
+ *****************************************************************************/
 static int X11CreateWindow( vout_thread_t *p_vout )
 {
-    XSetWindowAttributes    xwindow_attributes;          /* window attributes */
-    XGCValues               xgcvalues;       /* graphic context configuration */
-    XEvent                  xevent;                           /* first events */
-    boolean_t               b_expose;              /* 'expose' event received */
-    boolean_t               b_map_notify;      /* 'map_notify' event received */
+    XSetWindowAttributes    xwindow_attributes;         /* window attributes */
+    XGCValues               xgcvalues;      /* graphic context configuration */
+    XEvent                  xevent;                          /* first events */
+    boolean_t               b_expose;             /* 'expose' event received */
+    boolean_t               b_map_notify;     /* 'map_notify' event received */
 
     /* Prepare window attributes */
-    xwindow_attributes.backing_store = Always;        /* save the hidden part */
+    xwindow_attributes.backing_store = Always;       /* save the hidden part */
+
     /* Create the window and set hints */
     p_vout->p_sys->window = XCreateSimpleWindow( p_vout->p_sys->p_display,
                                                 p_vout->p_sys->root_window,
-                                                0, 0, 
+                                                0, 0,
                                                 p_vout->i_width, p_vout->i_height,
                                                 0, 0, 0);
-    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window, 
+    XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window,
                   ExposureMask | StructureNotifyMask );
-    XChangeWindowAttributes( p_vout->p_sys->p_display, p_vout->p_sys->window, 
+    XChangeWindowAttributes( p_vout->p_sys->p_display, p_vout->p_sys->window,
                              CWBackingStore, &xwindow_attributes);
 
     /* Creation of a graphic context that doesn't generate a GraphicsExpose event
        when using functions like XCopyArea */
-    xgcvalues.graphics_exposures = False;    
+    xgcvalues.graphics_exposures = False;
     p_vout->p_sys->gc =  XCreateGC( p_vout->p_sys->p_display, p_vout->p_sys->window,
                                     GCGraphicsExposures, &xgcvalues);
 
@@ -443,12 +443,12 @@ static int X11CreateWindow( vout_thread_t *p_vout )
     do
     {
         XNextEvent( p_vout->p_sys->p_display, &xevent);
-        if( (xevent.type == Expose) 
+        if( (xevent.type == Expose)
             && (xevent.xexpose.window == p_vout->p_sys->window) )
         {
             b_expose = 1;
         }
-        else if( (xevent.type == MapNotify) 
+        else if( (xevent.type == MapNotify)
                  && (xevent.xmap.window == p_vout->p_sys->window) )
         {
             b_map_notify = 1;
@@ -457,16 +457,16 @@ static int X11CreateWindow( vout_thread_t *p_vout )
     while( !( b_expose && b_map_notify ) );
     XSelectInput( p_vout->p_sys->p_display, p_vout->p_sys->window, 0 );
 
-    /* At this stage, the window is openned, displayed, and ready to receive 
+    /* At this stage, the window is openned, displayed, and ready to receive
      * data */
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * X11DestroyWindow: destroy X11 window
- *******************************************************************************
+ *****************************************************************************
  * Destroy an X11 window created by vout_X11CreateWindow
- *******************************************************************************/
+ *****************************************************************************/
 static void X11DestroyWindow( vout_thread_t *p_vout )
 {
     XUnmapWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
@@ -474,23 +474,23 @@ static void X11DestroyWindow( vout_thread_t *p_vout )
     XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
 }
 
-/*******************************************************************************
- * X11CreateImage: create an XImage                                      
- *******************************************************************************
+/*****************************************************************************
+ * X11CreateImage: create an XImage
+ *****************************************************************************
  * Create a simple XImage used as a buffer.
- *******************************************************************************/
+ *****************************************************************************/
 static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
 {
-    byte_t *    pb_data;                           /* image data storage zone */
-    int         i_quantum;                      /* XImage quantum (see below) */
-  
+    byte_t *    pb_data;                          /* image data storage zone */
+    int         i_quantum;                     /* XImage quantum (see below) */
+
     /* Allocate memory for image */
-    p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;    
+    p_vout->i_bytes_per_line = p_vout->i_width * p_vout->i_bytes_per_pixel;
     pb_data = (byte_t *) malloc( p_vout->i_bytes_per_line * p_vout->i_height );
-    if( !pb_data )                                                   /* error */
+    if( !pb_data )                                                  /* error */
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
-        return( 1 );   
+        return( 1 );
     }
 
     /* Optimize the quantum of a scanline regarding its size - the quantum is
@@ -499,7 +499,7 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
     {
         i_quantum = 32;
     }
-    else    
+    else
     {
         if( !(( p_vout->i_bytes_per_line ) % 16) )
         {
@@ -510,12 +510,12 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
             i_quantum = 8;
         }
     }
-    
+
     /* Create XImage */
     *pp_ximage = XCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual,
-                               p_vout->i_screen_depth, ZPixmap, 0, pb_data, 
+                               p_vout->i_screen_depth, ZPixmap, 0, pb_data,
                                p_vout->i_width, p_vout->i_height, i_quantum, 0);
-    if(! *pp_ximage )                                                 /* error */
+    if(! *pp_ximage )                                               /* error */
     {
         intf_ErrMsg( "error: XCreateImage() failed\n" );
         free( pb_data );
@@ -525,22 +525,22 @@ static int X11CreateImage( vout_thread_t *p_vout, XImage **pp_ximage )
     return 0;
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * X11CreateShmImage: create an XImage using shared memory extension
- *******************************************************************************
+ *****************************************************************************
  * Prepare an XImage for DisplayX11ShmImage function.
- * The order of the operations respects the recommandations of the mit-shm 
- * document by J.Corbet and K.Packard. Most of the parameters were copied from 
+ * The order of the operations respects the recommandations of the mit-shm
+ * document by J.Corbet and K.Packard. Most of the parameters were copied from
  * there.
- *******************************************************************************/
-static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage, 
+ *****************************************************************************/
+static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
                               XShmSegmentInfo *p_shm_info)
 {
     /* Create XImage */
-    *pp_ximage = XShmCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual, 
-                                  p_vout->i_screen_depth, ZPixmap, 0, 
+    *pp_ximage = XShmCreateImage( p_vout->p_sys->p_display, p_vout->p_sys->p_visual,
+                                  p_vout->i_screen_depth, ZPixmap, 0,
                                   p_shm_info, p_vout->i_width, p_vout->i_height );
-    if(! *pp_ximage )                                                 /* error */
+    if(! *pp_ximage )                                               /* error */
     {
         intf_ErrMsg("error: XShmCreateImage() failed\n");
         return( 1 );
@@ -548,10 +548,10 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
 
     /* Allocate shared memory segment - 0777 set the access permission
      * rights (like umask), they are not yet supported by X servers */
-    p_shm_info->shmid = shmget( IPC_PRIVATE, 
-                                (*pp_ximage)->bytes_per_line * (*pp_ximage)->height, 
+    p_shm_info->shmid = shmget( IPC_PRIVATE,
+                                (*pp_ximage)->bytes_per_line * (*pp_ximage)->height,
                                 IPC_CREAT | 0777);
-    if( p_shm_info->shmid < 0)                                        /* error */
+    if( p_shm_info->shmid < 0)                                      /* error */
     {
         intf_ErrMsg("error: can't allocate shared image data (%s)\n",
                     strerror(errno));
@@ -562,10 +562,10 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
     /* Attach shared memory segment to process (read/write) */
     p_shm_info->shmaddr = (*pp_ximage)->data = shmat(p_shm_info->shmid, 0, 0);
     if(! p_shm_info->shmaddr )
-    {                                                                 /* error */
+    {                                                               /* error */
         intf_ErrMsg("error: can't attach shared memory (%s)\n",
                     strerror(errno));
-        shmctl( p_shm_info->shmid, IPC_RMID, 0 );        /* free shared memory */
+        shmctl( p_shm_info->shmid, IPC_RMID, 0 );      /* free shared memory */
         XDestroyImage( *pp_ximage );
         return( 1 );
     }
@@ -585,34 +585,34 @@ static int X11CreateShmImage( vout_thread_t *p_vout, XImage **pp_ximage,
         return( 1 );
     }
 
-    /* Send image to X server. This instruction is required, since having 
+    /* Send image to X server. This instruction is required, since having
      * built a Shm XImage and not using it causes an error on XCloseDisplay */
-    XFlush( p_vout->p_sys->p_display );    
+    XFlush( p_vout->p_sys->p_display );
     return( 0 );
 }
 
-/*******************************************************************************
- * X11DestroyImage: destroy an XImage                                  
- *******************************************************************************
+/*****************************************************************************
+ * X11DestroyImage: destroy an XImage
+ *****************************************************************************
  * Destroy XImage AND associated data. If pointer is NULL, the image won't be
  * destroyed (see vout_X11ManageOutputMethod())
- *******************************************************************************/
+ *****************************************************************************/
 static void X11DestroyImage( XImage *p_ximage )
 {
     if( p_ximage != NULL )
     {
-        XDestroyImage( p_ximage );                       /* no free() required */
+        XDestroyImage( p_ximage );                     /* no free() required */
     }
 }
 
-/*******************************************************************************
- * X11DestroyShmImage                                                    
- *******************************************************************************
+/*****************************************************************************
+ * X11DestroyShmImage
+ *****************************************************************************
  * Destroy XImage AND associated data. Detach shared memory segment from
  * server and process, then free it. If pointer is NULL, the image won't be
- * destroyed (see vout_X11ManageOutputMethod()) 
- *******************************************************************************/
-static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage, 
+ * destroyed (see vout_X11ManageOutputMethod())
+ *****************************************************************************/
+static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
                                 XShmSegmentInfo *p_shm_info )
 {
     /* If pointer is NULL, do nothing */
@@ -623,9 +623,9 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
 
     XShmDetach( p_vout->p_sys->p_display, p_shm_info );     /* detach from server */
     XDestroyImage( p_ximage );
-    if( shmdt( p_shm_info->shmaddr ) )    /* detach shared memory from process */
-    {                                     /* also automatic freeing...         */
-        intf_ErrMsg("error: can't detach shared memory (%s)\n", 
+    if( shmdt( p_shm_info->shmaddr ) )  /* detach shared memory from process */
+    {                                   /* also automatic freeing...         */
+        intf_ErrMsg("error: can't detach shared memory (%s)\n",
                     strerror(errno));
     }
 }
index 5f752f2ea6bb78b0cb8f5a0bb163ef990ac99fac..41c735a4ffe959137025bedf49cc847454592bee 100644 (file)
@@ -1,15 +1,15 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_yuv.c: YUV transformation functions
  * (c)1999 VideoLAN
- *******************************************************************************
+ *****************************************************************************
  * Provides functions to perform the YUV conversion. The functions provided here
  * are a complete and portable C implementation, and may be replaced in certain
  * case by optimized functions.
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <math.h>
 #include <errno.h>
 #include <string.h>
 #include "video_yuv.h"
 #include "intf_msg.h"
 
-/*******************************************************************************
+/*****************************************************************************
  * Constants
- *******************************************************************************/
+ *****************************************************************************/
 
-/* Color masks for different color depths - 8bpp masks can be choosen, since 
+/* Color masks for different color depths - 8bpp masks can be choosen, since
  * colormaps instead of hardware-defined colors are used. */
 //?? remove
 #define RED_8BPP_MASK           0xe0
@@ -90,7 +90,7 @@ const int MATRIX_COEFFICIENTS_TABLE[8][4] =
  *****************************************************************************/
 static void     SetGammaTable     ( int *pi_table, double f_gamma );
 static void     SetYUV            ( vout_thread_t *p_vout );
-static void     SetOffset         ( int i_width, int i_height, int i_pic_width, int i_pic_height, 
+static void     SetOffset         ( int i_width, int i_height, int i_pic_width, int i_pic_height,
                                     boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset );
 
 static void     ConvertY4Gray8    ( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
@@ -187,7 +187,7 @@ static void     ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
         (((*p_y++ + dither13[i_real_y]) >> 4) << 7)                           \
       + ((*p_u++ + dither23[i_real_y]) >> 5) * 9                              \
       + ((*p_v++ + dither23[i_real_y]) >> 5) ];                               \
+
 #define CONVERT_4YUV_PIXELS_SCALE( CHROMA )                                   \
     *p_pic++ = p_lookup[                                                      \
         (((*p_y + dither10[i_real_y]) >> 4) << 7)                             \
@@ -437,29 +437,29 @@ static void     ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data
 int vout_InitYUV( vout_thread_t *p_vout )
 {
     size_t      tables_size;                        /* tables size, in bytes */
-    
+
     /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
     switch( p_vout->i_bytes_per_pixel )
     {
     case 1:
         tables_size = sizeof( u8 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
-        break;        
+        break;
     case 2:
         tables_size = sizeof( u16 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
-        break;        
-    case 3:        
+        break;
+    case 3:
     case 4:
-    default:         
-        tables_size = sizeof( u32 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);        
-        break;        
+    default:
+        tables_size = sizeof( u32 ) * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
     }
-    
+
     /* Allocate memory */
     p_vout->yuv.p_base = malloc( tables_size );
     if( p_vout->yuv.p_base == NULL )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
-        return( 1 );                
+        return( 1 );
     }
 
     /* Allocate memory for conversion buffer and offset array */
@@ -468,20 +468,20 @@ int vout_InitYUV( vout_thread_t *p_vout )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
         free( p_vout->yuv.p_base );
-        return( 1 );                
+        return( 1 );
     }
-    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) );    
+    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) );
     if( p_vout->yuv.p_offset == NULL )
     {
         intf_ErrMsg("error: %s\n", strerror(ENOMEM));
         free( p_vout->yuv.p_base );
-        free( p_vout->yuv.p_buffer );        
-        return( 1 );                
+        free( p_vout->yuv.p_buffer );
+        return( 1 );
     }
 
     /* Initialize tables */
     SetYUV( p_vout );
-    return( 0 );    
+    return( 0 );
 }
 
 /*****************************************************************************
@@ -492,8 +492,8 @@ int vout_InitYUV( vout_thread_t *p_vout )
  *****************************************************************************/
 int vout_ResetYUV( vout_thread_t *p_vout )
 {
-    vout_EndYUV( p_vout );    
-    return( vout_InitYUV( p_vout ) );    
+    vout_EndYUV( p_vout );
+    return( vout_InitYUV( p_vout ) );
 }
 
 /*****************************************************************************
@@ -505,7 +505,7 @@ void vout_EndYUV( vout_thread_t *p_vout )
 {
     free( p_vout->yuv.p_base );
     free( p_vout->yuv.p_buffer );
-    free( p_vout->yuv.p_offset );    
+    free( p_vout->yuv.p_offset );
 }
 
 /* following functions are local */
@@ -537,12 +537,12 @@ static void SetYUV( vout_thread_t *p_vout )
     int         pi_gamma[256];                                /* gamma table */
     int         i_index;                                  /* index in tables */
 
-    /* Build gamma table */    
+    /* Build gamma table */
     SetGammaTable( pi_gamma, p_vout->f_gamma );
-    
+
     /*
      * Set pointers and build YUV tables
-     */        
+     */
     if( p_vout->b_grayscale )
     {
         /* Grayscale: build gray table */
@@ -557,8 +557,8 @@ static void SetYUV( vout_thread_t *p_vout )
                 {
                     p_vout->yuv.yuv.p_gray8[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
                     p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
-                }            
-                for( i_index = 0; i_index < 256; i_index++) 
+                }
+                for( i_index = 0; i_index < 256; i_index++)
                 {
                     p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
                     bright[ i_index ] = i_index << 8;
@@ -571,7 +571,7 @@ static void SetYUV( vout_thread_t *p_vout )
                 p_vout->i_gray_pixel = 0x44;
                 p_vout->i_blue_pixel = 0x3b;
 
-                break;        
+                break;
             }
         case 2:
             p_vout->yuv.yuv.p_gray16 =  (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
@@ -579,25 +579,25 @@ static void SetYUV( vout_thread_t *p_vout )
             {
                 p_vout->yuv.yuv.p_gray16[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
                 p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
-            }            
-            for( i_index = 0; i_index < 256; i_index++) 
+            }
+            for( i_index = 0; i_index < 256; i_index++)
             {
                 p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
             }
-            break;        
+            break;
         case 3:
-        case 4:        
+        case 4:
             p_vout->yuv.yuv.p_gray32 =  (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
             for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
             {
                 p_vout->yuv.yuv.p_gray32[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
                 p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
-            }            
-            for( i_index = 0; i_index < 256; i_index++) 
+            }
+            for( i_index = 0; i_index < 256; i_index++)
             {
                 p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
             }
-            break;        
+            break;
          }
     }
     else
@@ -613,16 +613,16 @@ static void SetYUV( vout_thread_t *p_vout )
                 x = x + ( x >> 3 ) - 16; \
                 if( x < 0 ) x = 0;       \
                 if( x > 255 ) x = 255;
-    
+
                 int y,u,v;
                 int r,g,b;
                 int uvr, uvg, uvb;
                 int i = 0, j = 0;
                 u16 red[256], green[256], blue[256], transp[256];
                 unsigned char lookup[PALETTE_TABLE_SIZE];
-    
+
                 p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
-    
+
                 /* this loop calculates the intersection of an YUV box
                  * and the RGB cube. */
                 for ( y = 0; y <= 256; y += 16 )
@@ -636,23 +636,23 @@ static void SetYUV( vout_thread_t *p_vout )
                         r = y + uvr;
                         g = y + uvg;
                         b = y + uvb;
-    
+
                         if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
                                 && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
                         {
                             /* this one should never happen unless someone fscked up my code */
                             if(j == 256) { intf_DbgMsg( "sorry, no colors left\n" ); exit( 1 ); }
-    
+
                             /* saturate the colors */
                             SATURATE( r );
                             SATURATE( g );
                             SATURATE( b );
-    
+
                             red[j] = r << 8;
                             green[j] = g << 8;
                             blue[j] = b << 8;
                             transp[j] = 0;
-    
+
                             /* allocate color */
                             lookup[i] = 1;
                             p_vout->yuv.yuv.p_rgb8[i++] = j;
@@ -687,13 +687,13 @@ static void SetYUV( vout_thread_t *p_vout )
                     {
                         int u2, v2;
                         int dist, mindist = 100000000;
-    
+
                         if( lookup[i] || y==0)
                         {
                             i++;
                             continue;
                         }
-                                                                                                                   
+                                                                                                               
                         /* heavy. yeah. */
                         for( u2 = 0; u2 <= 256; u2 += 32 )
                         for( v2 = 0; v2 <= 256; v2 += 32 )
@@ -721,7 +721,7 @@ static void SetYUV( vout_thread_t *p_vout )
                     i += 128-81;
                 }
 
-                break;        
+                break;
             }
         case 2:
             p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
@@ -744,9 +744,9 @@ static void SetYUV( vout_thread_t *p_vout )
             {
                 p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
                 p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
-                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] ); 
-            }            
-            break;        
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
         case 3:
         case 4:
             p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
@@ -769,11 +769,11 @@ static void SetYUV( vout_thread_t *p_vout )
             {
                 p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
                 p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
-                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] ); 
-            }            
-            break;        
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
         }
-    }    
+    }
 
     /*
      * Set functions pointers
@@ -784,26 +784,26 @@ static void SetYUV( vout_thread_t *p_vout )
         switch( p_vout->i_bytes_per_pixel )
         {
         case 1:
-            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray8;        
-            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray8;        
-            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray8;        
-            break;        
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            break;
         case 2:
-            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;        
-            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray16;        
-            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray16;        
-            break;        
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            break;
         case 3:
-            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray24;        
-            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray24;        
-            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray24;        
-            break;        
-        case 4:        
-            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray32;        
-            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray32;        
-            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray32;        
-            break;        
-        }        
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            break;
+        }
     }
     else
     {
@@ -814,24 +814,24 @@ static void SetYUV( vout_thread_t *p_vout )
             p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB8;
             p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB8;
             p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB8;
-            break;        
+            break;
         case 2:
-            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB16;        
-            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB16;        
-            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB16;        
-            break;        
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB16;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB16;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB16;
+            break;
         case 3:
-            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB24;        
-            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB24;        
-            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB24;        
-            break;        
-        case 4:        
-            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB32;        
-            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB32;        
-            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB32;        
-            break;        
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB24;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB24;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB32;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB32;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB32;
+            break;
         }
-    }        
+    }
 }
 
 /*****************************************************************************
@@ -840,29 +840,29 @@ static void SetYUV( vout_thread_t *p_vout )
  * This function will build an offset array used in later conversion functions.
  * It will also set horizontal and vertical scaling indicators.
  *****************************************************************************/
-static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height, 
+static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
                        boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset )
-{    
+{
     int i_x;                                    /* x position in destination */
     int i_scale_count;                                     /* modulo counter */
 
     /*
      * Prepare horizontal offset array
-     */      
+     */
     if( i_pic_width - i_width > 0 )
     {
         /* Prepare scaling array for horizontal extension */
-        *pb_h_scaling =  1;   
+        *pb_h_scaling =  1;
         i_scale_count =         i_pic_width;
         for( i_x = i_width; i_x--; )
         {
             while( (i_scale_count -= i_width) > 0 )
             {
-                *p_offset++ = 0;                
+                *p_offset++ = 0;
             }
-            *p_offset++ = 1;            
-            i_scale_count += i_pic_width;            
-        }        
+            *p_offset++ = 1;
+            i_scale_count += i_pic_width;
+        }
     }
     else if( i_pic_width - i_width < 0 )
     {
@@ -871,19 +871,19 @@ static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_hei
         i_scale_count =         i_pic_width;
         for( i_x = i_pic_width; i_x--; )
         {
-            *p_offset = 1;            
+            *p_offset = 1;
             while( (i_scale_count -= i_pic_width) >= 0 )
-            {                
-                *p_offset += 1;                
+            {
+                *p_offset += 1;
             }
             p_offset++;
             i_scale_count += i_width;
-        }        
+        }
     }
     else
     {
-        /* No horizontal scaling: YUV conversion is done directly to picture */          
-        *pb_h_scaling = 0;        
+        /* No horizontal scaling: YUV conversion is done directly to picture */
+        *pb_h_scaling = 0;
     }
 
     /*
@@ -891,15 +891,15 @@ static void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_hei
      */
     if( i_pic_height - i_height > 0 )
     {
-        *pi_v_scaling = 1;        
+        *pi_v_scaling = 1;
     }
     else if( i_pic_height - i_height < 0 )
     {
-        *pi_v_scaling = -1;        
+        *pi_v_scaling = -1;
     }
     else
     {
-        *pi_v_scaling = 0;        
+        *pi_v_scaling = 0;
     }
 }
 
@@ -922,15 +922,15 @@ static void ConvertY4Gray8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_y,
     u8 *        p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
-    i_pic_line_width -= i_pic_width;                                            
-    p_gray =            p_vout->yuv.yuv.p_gray8;    
-    p_buffer_start =    p_vout->yuv.p_buffer;                                   
-    p_offset_start =    p_vout->yuv.p_offset;                                   
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray8;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -956,11 +956,11 @@ static void ConvertY4Gray8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_y,
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(400, 1);        
+        SCALE_HEIGHT(400, 1);
     }
 }
 
@@ -982,15 +982,15 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y
     u16 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
-    i_pic_line_width -= i_pic_width;                                            
-    p_gray =            p_vout->yuv.yuv.p_gray16;    
-    p_buffer_start =    p_vout->yuv.p_buffer;                                   
-    p_offset_start =    p_vout->yuv.p_offset;                                   
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1002,7 +1002,7 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1016,11 +1016,11 @@ static void ConvertY4Gray16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(400, 2);        
+        SCALE_HEIGHT(400, 2);
     }
 }
 
@@ -1052,15 +1052,15 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y
     u32 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
-    i_pic_line_width -= i_pic_width;                                            
-    p_gray =            p_vout->yuv.yuv.p_gray32;    
-    p_buffer_start =    p_vout->yuv.p_buffer;                                   
-    p_offset_start =    p_vout->yuv.p_offset;                                   
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1072,7 +1072,7 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1086,11 +1086,11 @@ static void ConvertY4Gray32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
             *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(400, 4);        
+        SCALE_HEIGHT(400, 4);
     }
 }
 
@@ -1111,7 +1111,7 @@ static void ConvertYUV420RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
     int         i_chroma_width;                              /* chroma width */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
+
     int dither10[4] = { 0x0, 0x8, 0x2, 0xa };
     int dither11[4] = { 0xc, 0x4, 0xe, 0x6 };
     int dither12[4] = { 0x3, 0xb, 0x1, 0x9 };
@@ -1128,14 +1128,14 @@ static void ConvertYUV420RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
     //int dither[4][4] = { { 15, 15, 0, 0 }, { 15, 15, 0, 0 }, { 0, 0, 15, 15 }, { 0, 0, 15, 15 } };
     //int dither[4][4] = { { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 } };
     //int dither[4][4] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
     p_offset_start =    p_vout->yuv.p_offset;
     p_lookup =          p_vout->yuv.p_base;
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1172,16 +1172,16 @@ static void ConvertYUV422RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
     u8 *        p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
     p_yuv =             p_vout->yuv.yuv.p_rgb8;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1193,7 +1193,7 @@ static void ConvertYUV422RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1207,11 +1207,11 @@ static void ConvertYUV422RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
             CONVERT_YUV_PIXEL(1);  CONVERT_Y_PIXEL(1);
             CONVERT_YUV_PIXEL(1);  CONVERT_Y_PIXEL(1);
             CONVERT_YUV_PIXEL(1);  CONVERT_Y_PIXEL(1);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(422, 1);        
+        SCALE_HEIGHT(422, 1);
     }
 }
 
@@ -1236,15 +1236,15 @@ static void ConvertYUV444RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
     u8 *        p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     p_yuv =             p_vout->yuv.yuv.p_rgb8;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1256,7 +1256,7 @@ static void ConvertYUV444RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1270,11 +1270,11 @@ static void ConvertYUV444RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
             CONVERT_YUV_PIXEL(1);  CONVERT_YUV_PIXEL(1);
             CONVERT_YUV_PIXEL(1);  CONVERT_YUV_PIXEL(1);
             CONVERT_YUV_PIXEL(1);  CONVERT_YUV_PIXEL(1);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(444, 1);        
+        SCALE_HEIGHT(444, 1);
     }
 }
 
@@ -1290,11 +1290,11 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
 /*
     i_chroma_width =    i_width / 2;
     i_chroma_skip =     i_skip / 2;
-    ConvertYUV420RGB16MMX( p_y, p_u, p_v, i_width, i_height, 
-                           (i_width + i_skip) * sizeof( yuv_data_t ), 
+    ConvertYUV420RGB16MMX( p_y, p_u, p_v, i_width, i_height,
+                           (i_width + i_skip) * sizeof( yuv_data_t ),
                            (i_chroma_width + i_chroma_skip) * sizeof( yuv_data_t),
                            i_scale, (u8 *)p_pic, 0, 0, (i_width + i_pic_eol) * sizeof( u16 ),
-                           p_vout->i_screen_depth == 15 );    
+                           p_vout->i_screen_depth == 15 );
 */
     boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
     int         i_vertical_scaling;                 /* vertical scaling type */
@@ -1310,16 +1310,16 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
     u16 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
     p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1331,7 +1331,7 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1345,11 +1345,11 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
             CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
             CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
             CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(420, 2);        
+        SCALE_HEIGHT(420, 2);
     }
 }
 
@@ -1374,16 +1374,16 @@ static void ConvertYUV422RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
     u16 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
     p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1395,7 +1395,7 @@ static void ConvertYUV422RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1409,11 +1409,11 @@ static void ConvertYUV422RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
             CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
             CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
             CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(422, 2);        
+        SCALE_HEIGHT(422, 2);
     }
 }
 
@@ -1438,15 +1438,15 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
     u16 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     p_yuv =             p_vout->yuv.yuv.p_rgb16;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1458,7 +1458,7 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1472,11 +1472,11 @@ static void ConvertYUV444RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
             CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
             CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
             CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(444, 2);        
+        SCALE_HEIGHT(444, 2);
     }
 }
 
@@ -1506,7 +1506,7 @@ static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
 static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v,
                                 int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
                                 int i_matrix_coefficients )
-{    
+{
     //???
 }
 
@@ -1531,16 +1531,16 @@ static void ConvertYUV420RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
     u32 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
     p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1552,7 +1552,7 @@ static void ConvertYUV420RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1566,11 +1566,11 @@ static void ConvertYUV420RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
             CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
             CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
             CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(420, 4);        
+        SCALE_HEIGHT(420, 4);
     }
 }
 
@@ -1595,16 +1595,16 @@ static void ConvertYUV422RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
     u32 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     i_chroma_width =    i_width / 2;
     p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1616,7 +1616,7 @@ static void ConvertYUV422RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1630,11 +1630,11 @@ static void ConvertYUV422RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
             CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
             CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
             CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(422, 4);        
+        SCALE_HEIGHT(422, 4);
     }
 }
 
@@ -1659,15 +1659,15 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
     u32 *       p_buffer;                       /* conversion buffer pointer */
     int *       p_offset_start;                        /* offset array start */
     int *       p_offset;                            /* offset array pointer */
-    
-    /* 
-     * Initialize some values  - i_pic_line_width will store the line skip 
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
      */
     i_pic_line_width -= i_pic_width;
     p_yuv =             p_vout->yuv.yuv.p_rgb32;
-    p_buffer_start =    p_vout->yuv.p_buffer;        
-    p_offset_start =    p_vout->yuv.p_offset;                    
-    SetOffset( i_width, i_height, i_pic_width, i_pic_height, 
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
                &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
 
     /*
@@ -1679,7 +1679,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
         /* Mark beginnning of line for possible later line copy, and initialize
          * buffer */
         p_pic_start =   p_pic;
-        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;        
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
 
         /* Do YUV conversion to buffer - YUV picture is always formed of 16
          * pixels wide blocks */
@@ -1693,11 +1693,11 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
             CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
             CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
             CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
-        }             
+        }
 
         /* Do horizontal and vertical scaling */
         SCALE_WIDTH;
-        SCALE_HEIGHT(444, 4);        
+        SCALE_HEIGHT(444, 4);
     }
 }
 
index 1dc15797f0f852ad17b835e75bcd6031d9819dd7..de118c35b65dccf1ae8ff73e73efb826184c254d 100644 (file)
@@ -1,8 +1,8 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_yuv_mmx.S: YUV transformation, optimized for MMX processors
  * (c)1999 VideoLAN
- *******************************************************************************
- * Following functions are defined:     
+ *****************************************************************************
+ * Following functions are defined:
  * vout_YUV420_16_MMX
  *            This function performs YUV12-to-RGB16 color conversion for H26x.
  *            It handles any format in which there are three fields, the low
@@ -19,7 +19,7 @@
  *            Height may be any amount, but must be a multiple of two.  The U
  *            and V planes may have a different pitch than the Y plane, subject
  *            to the same limitations.
- *******************************************************************************/
+ *****************************************************************************/
 
 //.include iammx.inc
 //.include locals.inc
@@ -27,7 +27,7 @@
 .data
     .align 16
 
-RGB_formats: 
+RGB_formats:
     .long  RGB565
     .long  RGB555
     .long  RGB664
@@ -57,7 +57,7 @@ sixbitu:            .quad 0xc0c0c0c0c0c0c0c0
 #define YPlane                    LocalFrameSize + RegisterStorageSize +  4
 #define UPlane                    LocalFrameSize + RegisterStorageSize +  8
 #define VPlane                    LocalFrameSize + RegisterStorageSize + 12
-#define FrameWidth                LocalFrameSize + RegisterStorageSize + 16 
+#define FrameWidth                LocalFrameSize + RegisterStorageSize + 16
 #define FrameHeight               LocalFrameSize + RegisterStorageSize + 20
 #define YPitch                    LocalFrameSize + RegisterStorageSize + 24
 #define ChromaPitch               LocalFrameSize + RegisterStorageSize + 28
@@ -112,14 +112,14 @@ sixbitu:            .quad 0xc0c0c0c0c0c0c0c0
  *
  *  CCOffsetToLine0 is relative to ColorConvertedFrame.
  *  CCType  used by RGB color convertors to determine the exact conversion type.
- *    RGB565 = 0 
+ *    RGB565 = 0
  *    RGB555 = 1
  *    RGB664 = 2
  *    RGB655 = 3
  */
 
 .globl ConvertYUV420RGB16MMX
-ConvertYUV420RGB16MMX: 
+ConvertYUV420RGB16MMX:
   pushl      %esi
   pushl      %edi
 
@@ -133,7 +133,7 @@ ConvertYUV420RGB16MMX:
 
   jmp        *RGB_formats(,%eax,4)
 
-RGB555: 
+RGB555:
   xorl       %eax,%eax
   movl       $2,%ebx                 /* 10-8 for byte shift */
   movl       %ebx,RLeftShift(%esp)
@@ -154,7 +154,7 @@ RGB555:
   movq       %mm0,BUpperLimit(%esp)
   jmp        RGBEND
 
-RGB664: 
+RGB664:
   xorl       %eax,%eax
   movl       $2,%ebx                 /* 8-6 */
   movl       %ebx,RLeftShift(%esp)
@@ -177,7 +177,7 @@ RGB664:
   movq       %mm0,BUpperLimit(%esp)
   jmp        RGBEND
 
-RGB655: 
+RGB655:
   xorl       %eax,%eax
   movl       $2,%ebx                 /* 8-6 */
   movl       %ebx,RLeftShift(%esp)
@@ -200,7 +200,7 @@ RGB655:
   movq       %mm0,BUpperLimit(%esp)
   jmp        RGBEND
 
-RGB565: 
+RGB565:
   xorl       %eax,%eax
   movl       $3,%ebx                 /* 8-5 */
   movl       %ebx,RLeftShift(%esp)
@@ -223,7 +223,7 @@ RGB565:
   movq       %mm0,GUpperLimit(%esp)
 //  jmp        RGBEND
 
-RGBEND: 
+RGBEND:
   movl       VPlane(%esp),%ebx
   movl       UPlane(%esp),%ecx
   subl       %ebx,%ecx
@@ -278,7 +278,7 @@ RGBEND:
  *  Register Usage:
  */
 
-PrepareChromaLine: 
+PrepareChromaLine:
   movl       AspectCount(%esp),%ebp
   movl       FrameWidth(%esp),%ebx
   subl       $2,%ebp
@@ -289,10 +289,10 @@ PrepareChromaLine:
   xorl       %eax,%eax
   addl       AspectAdjustmentCount(%esp),%ebp
   movl       %eax,tmpCCOPitch(%esp)
-continue: 
+continue:
   movl       %ebp,AspectCount(%esp)
 
-do_next_8x2_block: 
+do_next_8x2_block:
   movl       tmpYCursorEven(%esp),%ebp
 /* here is even line */
   movd       (%edx,%ebx,),%mm1       /* 4 u values */
@@ -402,7 +402,7 @@ do_next_8x2_block:
   psllw      GLeftShift(%esp),%mm3   /* shift high G 5 positions */
   por        %mm3,%mm7               /* mm5: high RBG16 */
 
-  movl       tmpYCursorOdd(%esp),%ebp  /* moved to here to save cycles 
+  movl       tmpYCursorOdd(%esp),%ebp  /* moved to here to save cycles
                                            before odd line */
   movq       %mm1,(%edi)             /* !! aligned */
 
@@ -459,7 +459,7 @@ do_next_8x2_block:
  *        mm3- temporary results
  */
 
-  psllq      RLeftShift(%esp),%mm0   /* position R in the most significant 
+  psllq      RLeftShift(%esp),%mm0   /* position R in the most significant
                                         part of the byte */
   movq       %mm2,%mm7               /* mm7: Save B */
 
@@ -544,7 +544,7 @@ do_next_8x2_block:
 
 /******************************************************************************/
 
-finish: 
+finish:
   emms
   addl       $LocalFrameSize,%esp
 
index 61987fabe5ff78537b1c76ca7e5449563332eb61..625ce9e81d4c24bf2f1feb6f44e23297416aaf70 100644 (file)
@@ -1,11 +1,11 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_fifo.c : video FIFO management
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -19,7 +19,7 @@
 #include "vlc_thread.h"
 
 #include "intf_msg.h"
-#include "debug.h"                      /* ?? temporaire, requis par netlist.h */
+#include "debug.h"                    /* ?? temporaire, requis par netlist.h */
 
 #include "input.h"
 #include "input_netlist.h"
@@ -53,10 +53,10 @@ void vpar_InitFIFO( vpar_thread_t * p_vpar )
     vlc_mutex_init( &p_vpar->vfifo.lock );
     vlc_cond_init( &p_vpar->vfifo.wait );
     vlc_mutex_init( &p_vpar->vbuffer.lock );
-    
+
     /* Initialize FIFO properties */
     p_vpar->vfifo.i_start = p_vpar->vfifo.i_end = 0;
-    
+
     /* Initialize buffer properties */
     p_vpar->vbuffer.i_index = VFIFO_SIZE; /* all structures are available */
     for( i_dummy = 0; i_dummy < VFIFO_SIZE + 1; i_dummy++ )
index 1f4f8b3a04113dab22fce787cce1a2a87f50a95b..1bc525264cdb954a6f4e39918f4805ab295c43fa 100644 (file)
@@ -1,13 +1,13 @@
-/*******************************************************************************
+/*****************************************************************************
  * video_parser.c : video parser thread
  * (c)1999 VideoLAN
- *******************************************************************************/
+ *****************************************************************************/
 
 /* ?? passer en terminate/destroy avec les signaux supplémentaires */
 
-/*******************************************************************************
+/*****************************************************************************
  * Preamble
- *******************************************************************************/
+ *****************************************************************************/
 #include <errno.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -21,7 +21,7 @@
 #include "vlc_thread.h"
 
 #include "intf_msg.h"
-#include "debug.h"                     /* ?? temporaire, requis par netlist.h */
+#include "debug.h"                    /* ?? temporaire, requis par netlist.h */
 
 #include "input.h"
 #include "input_netlist.h"
@@ -48,14 +48,14 @@ static void     RunThread           ( vpar_thread_t *p_vpar );
 static void     ErrorThread         ( vpar_thread_t *p_vpar );
 static void     EndThread           ( vpar_thread_t *p_vpar );
 
-/*******************************************************************************
+/*****************************************************************************
  * vpar_CreateThread: create a generic parser thread
- *******************************************************************************
+ *****************************************************************************
  * This function creates a new video parser thread, and returns a pointer
  * to its description. On error, it returns NULL.
  * Following configuration properties are used:
  * ??
- *******************************************************************************/
+ *****************************************************************************/
 #include "main.h"
 #include "interface.h"
 extern main_t* p_main;
@@ -109,13 +109,13 @@ p_vpar->p_vout = p_main->p_intf->p_vout;
     return( p_vpar );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * vpar_DestroyThread: destroy a generic parser thread
- *******************************************************************************
+ *****************************************************************************
  * Destroy a terminated thread. This function will return 0 if the thread could
  * be destroyed, and non 0 else. The last case probably means that the thread
  * was still active, and another try may succeed.
- *******************************************************************************/
+ *****************************************************************************/
 void vpar_DestroyThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
 {
     intf_DbgMsg("vpar debug: requesting termination of video parser thread %p\n", p_vpar);
@@ -134,12 +134,12 @@ void vpar_DestroyThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
 
 /* following functions are local */
 
-/*******************************************************************************
+/*****************************************************************************
  * CheckConfiguration: check vpar_CreateThread() configuration
- *******************************************************************************
+ *****************************************************************************
  * Set default parameters where required. In DEBUG mode, check if configuration
  * is valid.
- *******************************************************************************/
+ *****************************************************************************/
 #if 0
 static int CheckConfiguration( video_cfg_t *p_cfg )
 {
@@ -149,13 +149,13 @@ static int CheckConfiguration( video_cfg_t *p_cfg )
 }
 #endif
 
-/*******************************************************************************
+/*****************************************************************************
  * InitThread: initialize vpar output thread
- *******************************************************************************
+ *****************************************************************************
  * This function is called from RunThread and performs the second step of the
  * initialization. It returns 0 on success. Note that the thread's flag are not
  * modified inside this function.
- *******************************************************************************/
+ *****************************************************************************/
 static int InitThread( vpar_thread_t *p_vpar )
 {
 #ifdef VDEC_SMP
@@ -203,7 +203,7 @@ static int InitThread( vpar_thread_t *p_vpar )
 
     /* Initialize other properties */
 #ifdef STATS
-    p_vpar->c_loops = 0;    
+    p_vpar->c_loops = 0;
     p_vpar->c_idle_loops = 0;
     p_vpar->c_pictures = 0;
     p_vpar->c_i_pictures = 0;
@@ -305,18 +305,18 @@ static int InitThread( vpar_thread_t *p_vpar )
     return( 0 );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * RunThread: generic parser thread
- *******************************************************************************
+ *****************************************************************************
  * Video parser thread. This function does only returns when the thread is
- * terminated. 
- *******************************************************************************/
+ * terminated.
+ *****************************************************************************/
 static void RunThread( vpar_thread_t *p_vpar )
 {
     intf_DbgMsg("vpar debug: running video parser thread (%p) (pid == %i)\n", p_vpar, getpid());
 
-    /* 
-     * Initialize thread 
+    /*
+     * Initialize thread
      */
     p_vpar->b_error = InitThread( p_vpar );
 
@@ -344,7 +344,7 @@ static void RunThread( vpar_thread_t *p_vpar )
                 break;
             };
         }
-    } 
+    }
 
     /*
      * Error loop
@@ -360,13 +360,13 @@ static void RunThread( vpar_thread_t *p_vpar )
     EndThread( p_vpar );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * ErrorThread: RunThread() error loop
- *******************************************************************************
+ *****************************************************************************
  * This function is called when an error occured during thread main's loop. The
  * thread can still receive feed, but must be ready to terminate as soon as
  * possible.
- *******************************************************************************/
+ *****************************************************************************/
 static void ErrorThread( vpar_thread_t *p_vpar )
 {
     /* We take the lock, because we are going to read/write the start/end
@@ -391,12 +391,12 @@ static void ErrorThread( vpar_thread_t *p_vpar )
     vlc_mutex_unlock( &p_vpar->fifo.data_lock );
 }
 
-/*******************************************************************************
+/*****************************************************************************
  * EndThread: thread destruction
- *******************************************************************************
- * This function is called when the thread ends after a sucessfull 
+ *****************************************************************************
+ * This function is called when the thread ends after a sucessfull
  * initialization.
- *******************************************************************************/
+ *****************************************************************************/
 static void EndThread( vpar_thread_t *p_vpar )
 {
 #ifdef VDEC_SMP
index dc421f764f6754d72492b66b386921ab70c84ba6..70e13d35427c87faf687f13ed920e1afa8354507 100644 (file)
@@ -54,7 +54,7 @@
  */
 
     /* Table for coded_block_pattern resolution */
-static lookup_t     pl_coded_pattern[512] = 
+static lookup_t     pl_coded_pattern[512] =
     { {MB_ERROR, 0}, {0, 9}, {39, 9}, {27, 9}, {59, 9}, {55, 9}, {47, 9}, {31, 9},
     {58, 8}, {58, 8}, {54, 8}, {54, 8}, {46, 8}, {46, 8}, {30, 8}, {30, 8},
     {57, 8}, {57, 8}, {53, 8}, {53, 8}, {45, 8}, {45, 8}, {29, 8}, {29, 8},
@@ -64,66 +64,66 @@ static lookup_t     pl_coded_pattern[512] =
     {41, 8}, {41, 8}, {21, 8}, {21, 8}, {49, 8}, {49, 8}, {13, 8}, {13, 8},
     {35, 8}, {35, 8}, {19, 8}, {19, 8}, {11, 8}, {11, 8}, {7, 8}, {7, 8},
     {34, 7}, {34, 7}, {34, 7}, {34, 7}, {18, 7}, {18, 7}, {18, 7}, {18, 7},
-    {10, 7}, {10, 7}, {10, 7}, {10, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7}, 
-    {33, 7}, {33, 7}, {33, 7}, {33, 7}, {17, 7}, {17, 7}, {17, 7}, {17, 7}, 
-    {9, 7}, {9, 7}, {9, 7}, {9, 7}, {5, 7}, {5, 7}, {5, 7}, {5, 7}, 
-    {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, 
-    {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, 
-    {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, 
-    {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, 
+    {10, 7}, {10, 7}, {10, 7}, {10, 7}, {6, 7}, {6, 7}, {6, 7}, {6, 7},
+    {33, 7}, {33, 7}, {33, 7}, {33, 7}, {17, 7}, {17, 7}, {17, 7}, {17, 7},
+    {9, 7}, {9, 7}, {9, 7}, {9, 7}, {5, 7}, {5, 7}, {5, 7}, {5, 7},
+    {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6}, {63, 6},
+    {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6}, {3, 6},
+    {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6}, {36, 6},
+    {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6}, {24, 6},
     {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5},
     {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5}, {62, 5},
-    {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, 
-    {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, 
-    {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, 
-    {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, 
-    {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, 
-    {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, 
-    {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, 
-    {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, 
-    {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, 
-    {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, 
-    {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, 
-    {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, 
-    {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, 
-    {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, 
-    {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, 
-    {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, 
-    {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, 
-    {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, 
-    {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, 
-    {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, 
-    {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, 
-    {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, 
-    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, 
-    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, 
-    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, 
-    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, 
-    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, 
-    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, 
-    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, 
-    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, 
-    {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, 
-    {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, 
-    {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, 
+    {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5},
+    {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5}, {2, 5},
+    {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5},
+    {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5}, {61, 5},
+    {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5},
+    {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5}, {1, 5},
+    {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5},
+    {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5}, {56, 5},
+    {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5},
+    {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5}, {52, 5},
+    {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5},
+    {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5}, {44, 5},
+    {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5},
+    {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5}, {28, 5},
+    {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5},
+    {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5}, {40, 5},
+    {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5},
+    {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5}, {20, 5},
+    {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5},
+    {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5}, {48, 5},
+    {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5},
+    {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5}, {12, 5},
+    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
+    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
+    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
+    {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4}, {32, 4},
+    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
+    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
+    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
+    {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4}, {16, 4},
     {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
+    {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
+    {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
+    {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4}, {8, 4},
+    {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
     {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
-    {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, 
-    {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, 
     {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
-    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, 
+    {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4}, {4, 4},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
+    {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3},
     {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3}, {60, 3} };
 
-    /* Tables for dc DCT coefficients 
+    /* Tables for dc DCT coefficients
      * Tables are cut in two parts to reduce memory occupation
      */
-    
+
     /* Table B-12, dct_dc_size_luminance, codes 00xxx ... 11110 */
 static lookup_t     pl_dct_dc_lum_init_table_1[32] =
     { {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
@@ -157,7 +157,7 @@ static lookup_t     pl_dct_dc_chrom_init_table_2[32] =
       {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7}, {7, 7},
       {8, 8}, {8, 8}, {8, 8}, {8, 8}, {9, 9}, {9, 9}, {10,10}, {11,10}
     };
-    
+
 
     /* Tables for ac DCT coefficients. There are cut in many parts to save space */
     /* Table B-14, DCT coefficients table zero,
@@ -383,7 +383,7 @@ void vpar_InitCrop( vpar_thread_t * p_vpar )
 
 /* Function for filling up the lookup table for mb_addr_inc */
 static void __inline__ FillMbAddrIncTable( vpar_thread_t * p_vpar,
-                                    int i_start, int i_end, int i_step, 
+                                    int i_start, int i_end, int i_step,
                                     int * pi_value, int i_length )
 {
     int i_pos, i_offset;
@@ -397,13 +397,13 @@ static void __inline__ FillMbAddrIncTable( vpar_thread_t * p_vpar,
         (*pi_value)--;
     }
 }
-    
+
 /* Function that initialize the table using the last one */
 void vpar_InitMbAddrInc( vpar_thread_t * p_vpar )
 {
     int i_dummy;
     int i_value;
-    
+
     for( i_dummy = 0 ; i_dummy < 8 ; i_dummy++ )
     {
         p_vpar->pl_mb_addr_inc[i_dummy].i_value = MB_ERROR;
@@ -413,7 +413,7 @@ void vpar_InitMbAddrInc( vpar_thread_t * p_vpar )
     p_vpar->pl_mb_addr_inc[8].i_value = MB_ADDRINC_ESCAPE;
     p_vpar->pl_mb_addr_inc[8].i_length = 11;
 
-    for( i_dummy = 9 ; i_dummy < 15 ; i_dummy ++ ) 
+    for( i_dummy = 9 ; i_dummy < 15 ; i_dummy ++ )
     {
         p_vpar->pl_mb_addr_inc[i_dummy].i_value =  MB_ERROR;
         p_vpar->pl_mb_addr_inc[i_dummy].i_length = 0;
@@ -422,14 +422,14 @@ void vpar_InitMbAddrInc( vpar_thread_t * p_vpar )
     p_vpar->pl_mb_addr_inc[15].i_value = MB_ADDRINC_STUFFING;
     p_vpar->pl_mb_addr_inc[15].i_length = 11;
 
-    for( i_dummy = 16; i_dummy < 24; i_dummy++ ) 
+    for( i_dummy = 16; i_dummy < 24; i_dummy++ )
     {
         p_vpar->pl_mb_addr_inc[i_dummy].i_value =  MB_ERROR;
         p_vpar->pl_mb_addr_inc[i_dummy].i_length = 0;
     }
-    
+
     i_value = 33;
-    
+
     FillMbAddrIncTable( p_vpar, 24, 36, 1, &i_value, 11 );
     FillMbAddrIncTable( p_vpar, 36, 48, 2, &i_value, 10 );
     FillMbAddrIncTable( p_vpar, 48, 96, 8, &i_value, 8 );
@@ -453,7 +453,7 @@ static void __inline__ FillMBType( vpar_thread_t * p_vpar,
                                    int           i_length )
 {
     int i_dummy;
-    
+
     for( i_dummy = i_start ; i_dummy < i_end ; i_dummy++ )
     {
         p_vpar->ppl_mb_type[i_mb_type][i_dummy].i_value = i_value;
@@ -524,7 +524,7 @@ static void __inline__ FillDCTTable( dct_lookup_t * p_tab_dest, dct_lookup_t * p
 /* Fonction that actually fills the table or create the pointers */
 void vpar_InitDCTTables( vpar_thread_t * p_vpar )
 {
-    /* Tables are cut in two parts to reduce memory occupation */    
+    /* Tables are cut in two parts to reduce memory occupation */
     p_vpar->pppl_dct_dc_size[0][0] = pl_dct_dc_lum_init_table_1;
     p_vpar->pppl_dct_dc_size[0][1] = pl_dct_dc_lum_init_table_2;
     p_vpar->pppl_dct_dc_size[1][0] = pl_dct_dc_chrom_init_table_1;
@@ -532,7 +532,7 @@ void vpar_InitDCTTables( vpar_thread_t * p_vpar )
 
     memset( p_vpar->ppl_dct_coef[0], MB_ERROR, 16 );
     memset( p_vpar->ppl_dct_coef[1], MB_ERROR, 16 );
-    
+
     /* For table B14 & B15, we have a pointer to tables */
     /* We fill the table thanks to the fonction defined above */
     FillDCTTable( p_vpar->ppl_dct_coef[0], pl_DCT_tab0, 256, 60,  4 );
@@ -608,7 +608,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
     int         i_level;
     boolean_t   b_sign;
     int *       pi_quant;
-    
+
     /* Lookup Table for the chromatic component */
     static int pi_cc_index[12] = { 0, 0, 0, 0, 1, 2, 1, 2, 1, 2 };
 
@@ -628,7 +628,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
     }
 
     /* Decoding of the AC coefficients */
-    
+
     i_nc = 0;
     i_coef = 0;
     for( i_parse = 0; !p_vpar->b_die; i_parse++ )
@@ -662,7 +662,7 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
             i_level =   p_vpar->ppl_dct_coef[0][i_code].i_level;
         }
 
-        
+
         RemoveBits( &p_vpar->bit_stream, i_length );
 
         switch( i_run )
@@ -702,9 +702,9 @@ static __inline__ void DecodeMPEG2NonIntra( vpar_thread_t * p_vpar,
         {
             break;
         }
-        
+
         i_pos = pi_scan[p_vpar->picture.b_alternate_scan][i_parse];
-        i_level = ( ((i_level << 1) + 1) * p_vpar->mb.i_quantizer_scale 
+        i_level = ( ((i_level << 1) + 1) * p_vpar->mb.i_quantizer_scale
                     * pi_quant[i_pos] ) >> 5;
         p_mb->ppi_blocks[i_b][i_pos] = b_sign ? -i_level : i_level;
     }
@@ -735,7 +735,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
     boolean_t   b_vlc_intra;
     boolean_t   b_sign;
     int *       pi_quant;
-    
+
     /* Lookup Table for the chromatic component */
     static int pi_cc_index[12] = { 0, 0, 0, 0, 1, 2, 1, 2, 1, 2 };
     i_cc = pi_cc_index[i_b];
@@ -753,15 +753,15 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
         pi_quant = p_vpar->sequence.chroma_intra_quant.pi_matrix;
     }
 
-#if 0    
+#if 0
     /* Decoding of the DC intra coefficient */
     /* The nb of bits to parse depends on i_type */
     i_code = ShowBits( &p_vpar->bit_stream, 9 + i_type );
-    
+
     /* To reduce memory occupation, there are two lookup tables
      * See InitDCT above */
     i_code5 = i_code >> (4+i_type);
-    
+
     /* Shall we lookup in the first or in the second table ? */
     i_select = ( i_code5 == 31 );
     /* Offset value for looking in the second table */
@@ -769,7 +769,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
     i_pos = ( i_code5 * ( ! i_select ) ) + ( ( i_code - i_offset ) * i_select );
     i_dct_dc_size = p_vpar->pppl_dct_dc_size[i_type][i_select][i_pos].i_value;
 #endif
-    
+
     if( !i_type/*i_b < 4*/ )
     {
         /* decode length */
@@ -817,9 +817,9 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
     }
 
     /* Dump the variable length code */
-    //RemoveBits( &p_vpar->bit_stream, 
+    //RemoveBits( &p_vpar->bit_stream,
     //          p_vpar->pppl_dct_dc_size[i_type][i_select][i_pos].i_length );
-    
+
     /* Read the actual code with the good length */
     p_vpar->mb.pi_dc_dct_pred[i_cc] += i_dct_dc_diff;
 
@@ -829,7 +829,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
     i_nc = ( p_vpar->mb.pi_dc_dct_pred[i_cc] != 0 );
 
     /* Decoding of the AC coefficients */
-    
+
     i_coef = 0;
     b_vlc_intra = p_vpar->picture.b_intra_vlc_format;
     for( i_parse = 1; !p_vpar->b_die/*i_parse < 64*/; i_parse++ )
@@ -863,7 +863,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
             int code = i_code;
             int intra_vlc_format = b_vlc_intra;
             dct_lookup_t tab;
-            
+
     if (code>=16384 && !intra_vlc_format)
       tab = pl_DCT_tab_ac[(code>>12)-4];
     else if (code>=1024)
@@ -905,7 +905,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
 
 
 
-        
+
         RemoveBits( &p_vpar->bit_stream, i_length );
 
         switch( i_run )
@@ -913,7 +913,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
             case DCT_ESCAPE:
                 i_run = GetBits( &p_vpar->bit_stream, 6 );
                 i_level = GetBits( &p_vpar->bit_stream, 12 );
-                /*p_mb->ppi_blocks[i_b][i_parse] = ( b_sign = ( i_level > 2047 ) ) 
+                /*p_mb->ppi_blocks[i_b][i_parse] = ( b_sign = ( i_level > 2047 ) )
                                                           ? ( -4096 + i_level )
                                                           : i_level;*/
                 i_level = (b_sign = ( i_level > 2047 )) ? 4096 - i_level
@@ -939,7 +939,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
         i_coef = i_parse;
         i_parse += i_run;
         i_nc ++;
+
         if( i_parse >= 64 )
         {
             break;
@@ -967,7 +967,7 @@ static __inline__ void DecodeMPEG2Intra( vpar_thread_t * p_vpar,
 static __inline__ int MotionCode( vpar_thread_t * p_vpar )
 {
     int i_code;
-    static lookup_t pl_mv_tab0[8] = 
+    static lookup_t pl_mv_tab0[8] =
         { {-1,0}, {3,3}, {2,2}, {2,2}, {1,1}, {1,1}, {1,1}, {1,1} };
     /* Table B-10, motion_code, codes 0000011 ... 000011x */
     static lookup_t pl_mv_tab1[8] =
@@ -977,7 +977,7 @@ static __inline__ int MotionCode( vpar_thread_t * p_vpar )
         {16,9}, {15,9}, {14,9}, {13,9},
         {12,9}, {11,9}, {10,8}, {10,8},
         {9,8},  {9,8},  {8,8},  {8,8} };
-    
+
     if( GetBits( &p_vpar->bit_stream, 1 ) )
     {
         return 0;
@@ -1007,7 +1007,7 @@ static __inline__ int MotionCode( vpar_thread_t * p_vpar )
 
     RemoveBits( &p_vpar->bit_stream, pl_mv_tab2[i_code].i_length );
     return( GetBits( &p_vpar->bit_stream, 1 ) ?
-        -pl_mv_tab2[i_code].i_value : pl_mv_tab2[i_code].i_value );            
+        -pl_mv_tab2[i_code].i_value : pl_mv_tab2[i_code].i_value );
 }
 
 /****************************************************************************
@@ -1047,7 +1047,7 @@ static __inline__ void MotionVector( vpar_thread_t * p_vpar,
     int i_motion_code, i_motion_residual;
     int i_r_size;
     int pi_dm_vector[2];
-    
+
     i_r_size = p_vpar->picture.ppi_f_code[i_s][0] - 1;
     i_motion_code = MotionCode( p_vpar );
     i_motion_residual = (i_r_size != 0 && i_motion_code != 0) ?
@@ -1067,26 +1067,26 @@ static __inline__ void MotionVector( vpar_thread_t * p_vpar,
             pi_dm_vector[0] = 0;
         }
     }
-    
+
     i_r_size = p_vpar->picture.ppi_f_code[i_s][1]-1;
     i_motion_code = MotionCode( p_vpar );
     i_motion_residual = (i_r_size != 0 && i_motion_code != 0) ?
                         GetBits( &p_vpar->bit_stream, i_r_size) : 0;
 
-   
+
     if( (p_vpar->mb.i_mv_format == MOTION_FIELD)
         && (i_structure == FRAME_STRUCTURE) )
     {
          p_vpar->mb.pppi_pmv[i_r][i_s][1] >>= 1;
     }
-    
+
     DecodeMotionVector( &p_vpar->mb.pppi_pmv[i_r][i_s][1], i_r_size,
                         i_motion_code, i_motion_residual, i_full_pel );
 
     if( (p_vpar->mb.i_mv_format == MOTION_FIELD)
         && (i_structure == FRAME_STRUCTURE) )
          p_vpar->mb.pppi_pmv[i_r][i_s][1] <<= 1;
-     
+
     p_mb->pppi_motion_vectors[i_r][i_s][1] = p_vpar->mb.pppi_pmv[i_r][i_s][1];
 
     if( p_vpar->mb.b_dmv )
@@ -1197,7 +1197,7 @@ static __inline__ int MacroblockAddressIncrement( vpar_thread_t * p_vpar )
     int i_addr_inc = 0;
     /* Index in the lookup table mb_addr_inc */
     int    i_index = ShowBits( &p_vpar->bit_stream, 11 );
-        
+
     /* Test the presence of the escape character */
     while( i_index == 8 )
     {
@@ -1205,13 +1205,13 @@ static __inline__ int MacroblockAddressIncrement( vpar_thread_t * p_vpar )
         i_addr_inc += 33;
         i_index = ShowBits( &p_vpar->bit_stream, 11 );
     }
-     
+
     /* Affect the value from the lookup table */
     i_addr_inc += p_vpar->pl_mb_addr_inc[i_index].i_value;
-    
+
     /* Dump the good number of bits */
     RemoveBits( &p_vpar->bit_stream, p_vpar->pl_mb_addr_inc[i_index].i_length );
-    
+
     return i_addr_inc;
 }
 
@@ -1222,7 +1222,7 @@ static __inline__ int IMBType( vpar_thread_t * p_vpar )
 {
     /* Take two bits for testing */
     int                 i_type = ShowBits( &p_vpar->bit_stream, 2 );
-    
+
     /* Lookup table for macroblock_type */
     static lookup_t     pl_mb_Itype[4] = { {MB_ERROR, 0},
                                            {MB_QUANT|MB_INTRA, 2},
@@ -1240,7 +1240,7 @@ static __inline__ int PMBType( vpar_thread_t * p_vpar )
 {
     /* Testing on 6 bits */
     int                i_type = ShowBits( &p_vpar->bit_stream, 6 );
-    
+
     /* Dump the good number of bits */
     RemoveBits( &p_vpar->bit_stream, p_vpar->ppl_mb_type[0][i_type].i_length );
     /* return the value from the lookup table for P type */
@@ -1254,10 +1254,10 @@ static __inline__ int BMBType( vpar_thread_t * p_vpar )
 {
      /* Testing on 6 bits */
     int                i_type = ShowBits( &p_vpar->bit_stream, 6 );
-    
+
     /* Dump the good number of bits */
     RemoveBits( &p_vpar->bit_stream, p_vpar->ppl_mb_type[1][i_type].i_length );
-    
+
     /* return the value from the lookup table for B type */
     return p_vpar->ppl_mb_type[1][i_type].i_value;
 }
@@ -1277,10 +1277,10 @@ static __inline__ int CodedPattern420( vpar_thread_t * p_vpar )
 {
     /* Take the max 9 bits length vlc code for testing */
     int      i_vlc = ShowBits( &p_vpar->bit_stream, 9 );
-    
+
     /* Trash the good number of bits read in the lookup table */
     RemoveBits( &p_vpar->bit_stream, pl_coded_pattern[i_vlc].i_length );
-    
+
     /* return the value from the vlc table */
     return pl_coded_pattern[i_vlc].i_value;
 }
@@ -1291,9 +1291,9 @@ static __inline__ int CodedPattern420( vpar_thread_t * p_vpar )
 static __inline__ int CodedPattern422( vpar_thread_t * p_vpar )
 {
     int      i_vlc = ShowBits( &p_vpar->bit_stream, 9 );
-    
+
     RemoveBits( &p_vpar->bit_stream, pl_coded_pattern[i_vlc].i_length );
-    
+
     /* Supplementary 2 bits long code for 4:2:2 format */
     return pl_coded_pattern[i_vlc].i_value |
            (GetBits( &p_vpar->bit_stream, 2 ) << 6);
@@ -1305,9 +1305,9 @@ static __inline__ int CodedPattern422( vpar_thread_t * p_vpar )
 static __inline__ int CodedPattern444( vpar_thread_t * p_vpar )
 {
     int      i_vlc = ShowBits( &p_vpar->bit_stream, 9 );
-    
+
     RemoveBits( &p_vpar->bit_stream, pl_coded_pattern[i_vlc].i_length );
-    
+
     return pl_coded_pattern[i_vlc].i_value |
            (GetBits( &p_vpar->bit_stream, 6 ) << 6);
 }
@@ -1393,7 +1393,7 @@ static __inline__ void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb,
         p_vpar->picture.b_error = 1;
         return;
     }
-    
+
     if( (p_mb = vpar_NewMacroblock( &p_vpar->vfifo )) == NULL )
     {
         /* b_die == 1 */
@@ -1405,7 +1405,7 @@ static __inline__ void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb,
 
     InitMacroblock( p_vpar, p_mb, i_coding_type, i_chroma_format,
                     i_structure, b_second_field );
-   
+
     /* Motion type is picture structure. */
     p_mb->pf_motion = pf_motion_skipped[i_chroma_format]
                                        [i_structure];
@@ -1452,11 +1452,11 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
     case D_CODING_TYPE:
         p_mb->i_mb_type = DMBType( p_vpar );
     }
-    
+
     /* SCALABILITY : warning, we don't know if spatial_temporal_weight_code
      * has to be dropped, take care if you use scalable streams. */
     /* RemoveBits( &p_vpar->bit_stream, 2 ); */
-    
+
     if( (i_coding_type == P_CODING_TYPE || i_coding_type == B_CODING_TYPE)
         && (p_mb->i_mb_type & (MB_MOTION_FORWARD | MB_MOTION_BACKWARD)) )
     {
@@ -1510,8 +1510,8 @@ if( p_vpar->picture.b_error )                                           \
     (*pi_mb_address)--;                                                 \
     vpar_DestroyMacroblock( &p_vpar->vfifo, p_mb );                     \
     return;                                                             \
-} 
+}
+
 
 #define PARSEBLOCKS( MPEG1FUNC, MPEG2FUNC )                             \
 {                                                                       \
@@ -1835,7 +1835,7 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
         }
     }
     *pi_mb_address = (i_vert_code - 1)*p_vpar->sequence.i_mb_width;
-    
+
     /* Reset DC coefficients predictors (ISO/IEC 13818-2 7.2.1). */
     p_vpar->mb.pi_dc_dct_pred[0] = p_vpar->mb.pi_dc_dct_pred[1]
         = p_vpar->mb.pi_dc_dct_pred[2]
@@ -1884,7 +1884,7 @@ static __inline__ void PictureData( vpar_thread_t * p_vpar, int i_mb_base,
             break;
         }
         RemoveBits32( &p_vpar->bit_stream );
-        
+
         /* Decode slice data. */
         SliceHeader( p_vpar, &i_mb_address, i_mb_base, i_dummy & 255,
                      b_high, b_dp_scalable, b_mpeg2, i_coding_type,
index dec30d21dc32e536186c8d03f49d6d4d3f4f6a0e..c9e4d1c7b18a2467c8605cfd9376cdbd7a537fff 100644 (file)
@@ -208,7 +208,7 @@ static void __inline__ ReferenceReplace( vpar_thread_t * p_vpar,
 static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_matrix )
 {
     int i_dummy;
-    
+
     if( !p_matrix->b_allocated )
     {
         /* Allocate a piece of memory to load the matrix. */
@@ -220,7 +220,7 @@ static __inline__ void LoadMatrix( vpar_thread_t * p_vpar, quant_matrix_t * p_ma
         }
         p_matrix->b_allocated = 1;
     }
-    
+
     for( i_dummy = 0; i_dummy < 64; i_dummy++ )
     {
         p_matrix->pi_matrix[pi_scan[SCAN_ZIGZAG][i_dummy]]
@@ -245,7 +245,7 @@ static __inline__ void LinkMatrix( quant_matrix_t * p_matrix, int * pi_array )
         free( p_matrix->pi_matrix );
         p_matrix->b_allocated = 0;
     }
-    
+
     p_matrix->pi_matrix = pi_array;
 }
 
@@ -314,7 +314,7 @@ int vpar_ParseHeader( vpar_thread_t * p_vpar )
  *****************************************************************************/
 static void SequenceHeader( vpar_thread_t * p_vpar )
 {
-#define RESERVED    -1 
+#define RESERVED    -1
     static float r_frame_rate_table[16] =
     {
         0.0,
@@ -331,7 +331,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
 #undef RESERVED
 
     int i_height_save, i_width_save;
-    
+
     i_height_save = p_vpar->sequence.i_height;
     i_width_save = p_vpar->sequence.i_width;
 
@@ -344,7 +344,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
     /* We don't need bit_rate_value, marker_bit, vbv_buffer_size,
      * constrained_parameters_flag */
     RemoveBits( &p_vpar->bit_stream, 30 );
-    
+
     /*
      * Quantization matrices
      */
@@ -357,7 +357,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
         /* Use default matrix. */
         LinkMatrix( &p_vpar->sequence.intra_quant, pi_default_intra_quant );
     }
-    
+
     if( GetBits( &p_vpar->bit_stream, 1 ) ) /* load_non_intra_quantizer_matrix */
     {
         LoadMatrix( p_vpar, &p_vpar->sequence.nonintra_quant );
@@ -367,7 +367,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
         /* Use default matrix. */
         LinkMatrix( &p_vpar->sequence.nonintra_quant, pi_default_nonintra_quant );
     }
-    
+
     /* Unless later overwritten by a matrix extension, we have the same
      * matrices for luminance and chrominance. */
     LinkMatrix( &p_vpar->sequence.chroma_intra_quant,
@@ -385,7 +385,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
 
         /* Turn the MPEG2 flag on */
         p_vpar->sequence.b_mpeg2 = 1;
-    
+
         /* Parse sequence_extension */
         RemoveBits32( &p_vpar->bit_stream );
         /* extension_start_code_identifier, profile_and_level_indication */
@@ -521,7 +521,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
 #ifdef VDEC_SMP
     int                 i_mb;
 #endif
-    
+
     RemoveBits( &p_vpar->bit_stream, 10 ); /* temporal_reference */
     p_vpar->picture.i_coding_type = GetBits( &p_vpar->bit_stream, 3 );
     RemoveBits( &p_vpar->bit_stream, 16 ); /* vbv_delay */
@@ -544,7 +544,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
         RemoveBits( &p_vpar->bit_stream, 8 );
     }
 
-    /* 
+    /*
      * Picture Coding Extension
      */
     NextStartCode( p_vpar );
@@ -554,7 +554,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
         RemoveBits32( &p_vpar->bit_stream );
         /* extension_start_code_identifier */
         RemoveBits( &p_vpar->bit_stream, 4 );
-        
+
         p_vpar->picture.ppi_f_code[0][0] = GetBits( &p_vpar->bit_stream, 4 );
         p_vpar->picture.ppi_f_code[0][1] = GetBits( &p_vpar->bit_stream, 4 );
         p_vpar->picture.ppi_f_code[1][0] = GetBits( &p_vpar->bit_stream, 4 );
@@ -574,7 +574,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
          * chroma_420_type (obsolete) */
         RemoveBits( &p_vpar->bit_stream, 1 );
         p_vpar->picture.b_progressive_frame = GetBits( &p_vpar->bit_stream, 1 );
-        
+
         /* composite_display_flag */
         if( GetBits( &p_vpar->bit_stream, 1 ) )
         {
@@ -617,7 +617,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
 #endif
             vout_DestroyPicture( p_vpar->p_vout, p_vpar->picture.p_picture );
         }
-        
+
         p_vpar->picture.i_current_structure = 0;
 
         intf_DbgMsg("vpar debug: odd number of field picture.\n");
@@ -651,7 +651,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
     {
         /* Update the reference pointers. */
         ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, NULL );
-        
+
         /* Warn Synchro we have trashed a picture. */
         vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure );
 
@@ -706,7 +706,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
         ReferenceUpdate( p_vpar, p_vpar->picture.i_coding_type, P_picture );
 
 #ifdef VDEC_SMP
-        /* Link referenced pictures for the decoder 
+        /* Link referenced pictures for the decoder
          * They are unlinked in vpar_ReleaseMacroblock() & vpar_DestroyMacroblock() */
         if( p_vpar->picture.i_coding_type == P_CODING_TYPE ||
             p_vpar->picture.i_coding_type == B_CODING_TYPE )
@@ -716,7 +716,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
         if( p_vpar->picture.i_coding_type == B_CODING_TYPE )
         {
             vout_LinkPicture( p_vpar->p_vout, p_vpar->sequence.p_backward );
-        } 
+        }
 #endif
     }
     p_vpar->picture.i_current_structure |= i_structure;
index 6b5e49aa38e6670de3f3445d8d9d667c9f245403..a457d3cb5174387ba1ab57b4925b5cc6ea35357a 100644 (file)
@@ -81,7 +81,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                        + 1000000.0 / (1 + p_vpar->synchro.actual_fps);
     }
     p_vpar->synchro.i_last_decode_pts = i_current_pts;
+
     /* see if the current image has a pts - if not, set to 0 */
     p_vpar->synchro.fifo[p_vpar->synchro.i_fifo_stop].i_pts
            = i_current_pts;
@@ -99,7 +99,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                        + 1000000.0 / (p_vpar->synchro.theorical_fps);
         //fprintf (stderr, "  ");
     }
-    
+
     decoder_fifo->buffer[decoder_fifo->i_start]->b_has_pts = 0;
 
     /* else fprintf (stderr, "R ");
@@ -144,7 +144,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                 {
                     p_vpar->synchro.actual_fps = (p_vpar->synchro.actual_fps + 1000000.0 * (1 + p_vpar->synchro.nondropped_b_count + p_vpar->synchro.nondropped_p_count) / (i_current_pts - p_vpar->synchro.i_last_nondropped_i_pts)) / 2;
                 }
-    
+
             }
 
 
@@ -210,7 +210,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
 
            p_vpar->synchro.b_count_predict = predict;
             p_vpar->synchro.current_b_count = 0;
-           
+       
             /* now we calculated all statistics, it's time to
              * decide what we have the time to display
              */
@@ -234,7 +234,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
                 p_vpar->synchro.displayable_p = 0;
 
            if( p_vpar->synchro.can_display_p
-                && !(p_vpar->synchro.can_display_b 
+                && !(p_vpar->synchro.can_display_b
                     = ( p_vpar->synchro.i_mean_decode_time
                     * (1 + p_vpar->synchro.b_count_predict
                         + p_vpar->synchro.p_count_predict)) < i_delay) )
@@ -300,7 +300,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
 
             p_vpar->synchro.displayable_p--;
             return( 1 );
-   
+
         case B_CODING_TYPE:
 
             if( p_vpar->synchro.can_display_b )
@@ -313,7 +313,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
                 //fprintf( stderr, "trashed a B\n");
                 return( 0 );
             }
+
             if( p_vpar->synchro.displayable_b <= 0 )
                 return( 0 );
 
@@ -379,7 +379,7 @@ void vpar_SynchroEnd( vpar_thread_t * p_vpar )
 mtime_t vpar_SynchroDate( vpar_thread_t * p_vpar )
 {
     mtime_t i_displaydate = p_vpar->synchro.i_last_display_pts;
-    
+
 
     static mtime_t i_delta = 0;
 #if 0
@@ -407,7 +407,7 @@ AVEC LES IMAGES MONOTRAMES */
 boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
                               int i_structure )
 {
-    switch (i_coding_type) 
+    switch (i_coding_type)
     {
     case B_CODING_TYPE:
         if ((p_vpar->synchro.kludge_level <= p_vpar->synchro.kludge_nbp))
@@ -426,7 +426,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
         return( 1 );
 
     case P_CODING_TYPE:
-        if (p_vpar->synchro.kludge_p++ >= p_vpar->synchro.kludge_level) 
+        if (p_vpar->synchro.kludge_p++ >= p_vpar->synchro.kludge_level)
         {
             return( 0 );
         }