Changeset 15f3b0f6fa0eac7207eec34e80e1f65506d4f599

Show
Ignore:
Timestamp:
27/08/02 01:00:23 (6 years ago)
Author:
Christophe Massiot <massiot@videolan.org>
git-committer:
Christophe Massiot <massiot@videolan.org> 1030402823 +0000
git-parent:

[44fc8c8927a693b57b9e525341167620a9915ac4]

git-author:
Christophe Massiot <massiot@videolan.org> 1030402823 +0000
Message:

* Miscellaneous S/PDIF fixes.
* New NextPTS() function, to replace CurrentPTS() (gives the PTS which will

be valid for NEXT byte).

* Fixed mono mode in the builtin mpeg audio decoder.
* Various fixes related to PTS calculation in audio decoders.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/input_ext-dec.h

    r8d5c85f r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: input_ext-dec.h,v 1.69 2002/08/12 22:12:50 massiot Exp $ 
     5 * $Id: input_ext-dec.h,v 1.70 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    227227VLC_EXPORT( u32,  UnalignedGetBits,        ( bit_stream_t *, unsigned int ) ); 
    228228VLC_EXPORT( void, CurrentPTS,              ( bit_stream_t *, mtime_t *, mtime_t * ) ); 
     229VLC_EXPORT( void, NextPTS,                 ( bit_stream_t *, mtime_t *, mtime_t * ) ); 
    229230 
    230231/***************************************************************************** 
  • include/vlc_symbols.h

    r51e9975 r15f3b0f  
    7979    void (* DecoderError_inner) ( decoder_fifo_t * p_fifo ) ; 
    8080    void (* InitBitstream_inner) ( bit_stream_t *, decoder_fifo_t *, void ( * )( bit_stream_t *, vlc_bool_t ), void * p_callback_arg ) ; 
     81    void (* NextPTS_inner) ( bit_stream_t *, mtime_t *, mtime_t * ) ; 
    8182    void (* UnalignedRemoveBits_inner) ( bit_stream_t * ) ; 
    8283    void (* __config_PutFloat_inner) (vlc_object_t *, const char *, float) ; 
     
    160161#   define InitBitstream p_symbols->InitBitstream_inner 
    161162#   define NextDataPacket p_symbols->NextDataPacket_inner 
     163#   define NextPTS p_symbols->NextPTS_inner 
    162164#   define UnalignedGetBits p_symbols->UnalignedGetBits_inner 
    163165#   define UnalignedRemoveBits p_symbols->UnalignedRemoveBits_inner 
  • modules/audio_filter/converter/a52tospdif.c

    r1c13a98 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: a52tospdif.c,v 1.9 2002/08/21 22:41:59 massiot Exp $ 
     5 * $Id: a52tospdif.c,v 1.10 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    9999    memcpy( p_out, p_sync, 6 ); 
    100100    pi_length = (u16 *)(p_out + 6); 
    101     *pi_length = i_length
     101    *pi_length = i_length * 8
    102102 
    103103    /* FIXME : if i_length is odd, the following code sucks. What should 
     
    106106#ifndef WORDS_BIGENDIAN 
    107107#   ifdef HAVE_SWAB 
    108     swab( p_out + 8, p_in, i_length ); 
     108    swab( p_in, p_out + 8, i_length ); 
    109109#   else 
    110110    p_out += 8; 
  • modules/codec/a52.c

    r1c13a98 r15f3b0f  
    55 ***************************************************************************** 
    66 * Copyright (C) 2001, 2002 VideoLAN 
    7  * $Id: a52.c,v 1.6 2002/08/21 22:41:59 massiot Exp $ 
     7 * $Id: a52.c,v 1.7 2002/08/26 23:00:22 massiot Exp $ 
    88 * 
    99 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    168168        } 
    169169 
     170        /* Set the Presentation Time Stamp */ 
     171        NextPTS( &p_dec->bit_stream, &pts, NULL ); 
     172        if ( pts != 0 && pts != aout_DateGet( &p_dec->end_date ) ) 
     173        { 
     174            aout_DateSet( &p_dec->end_date, pts ); 
     175        } 
     176 
    170177        /* Get A/52 frame header */ 
    171178        GetChunk( &p_dec->bit_stream, p_frame_buffer, 7 ); 
     
    208215        } 
    209216 
    210         /* Set the Presentation Time Stamp */ 
    211         CurrentPTS( &p_dec->bit_stream, &pts, NULL ); 
    212         if ( pts != 0 && pts != aout_DateGet( &p_dec->end_date ) ) 
    213         { 
    214             aout_DateSet( &p_dec->end_date, pts ); 
    215         } 
    216  
    217217        /* Get the complete frame */ 
    218218        GetChunk( &p_dec->bit_stream, p_frame_buffer + 7, 
  • modules/codec/a52old/a52old.c

    rf7934b1 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: a52old.c,v 1.4 2002/08/23 14:05:22 sam Exp $ 
     5 * $Id: a52old.c,v 1.5 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Michel Lespinasse <walken@zoy.org> 
     
    187187        } 
    188188 
    189         CurrentPTS( &p_a52dec->bit_stream, &i_pts, NULL ); 
     189        NextPTS( &p_a52dec->bit_stream, &i_pts, NULL ); 
    190190        if( i_pts != 0 && i_pts != aout_DateGet( &end_date ) ) 
    191191        { 
  • modules/codec/mpeg_audio/decoder.c

    r764fd89 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: decoder.c,v 1.2 2002/08/17 15:35:10 fenrir Exp $ 
     5 * $Id: decoder.c,v 1.3 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Michel Kaempf <maxx@via.ecp.fr> 
     
    3838#include "decoder.h" 
    3939 
    40 #define ADEC_FRAME_SIZE 1152 /* XXX Frame size for only one channel */ 
     40#define ADEC_FRAME_NB 1152 
    4141 
    4242/***************************************************************************** 
     
    8484static int RunDecoder( decoder_fifo_t *p_fifo ) 
    8585{ 
    86     adec_thread_t   * p_adec; 
     86    adec_thread_t   * p_dec; 
    8787     
    8888    /* Allocate the memory needed to store the thread's structure */ 
    89     if ( (p_adec = (adec_thread_t *)malloc (sizeof(adec_thread_t))) == NULL )  
     89    if ( (p_dec = (adec_thread_t *)malloc (sizeof(adec_thread_t))) == NULL )  
    9090    { 
    9191        msg_Err( p_fifo, "out of memory" ); 
     
    9797     * Initialize the thread properties 
    9898     */ 
    99     p_adec->p_fifo = p_fifo; 
     99    p_dec->p_fifo = p_fifo; 
    100100 
    101101    /*  
    102102     * Initilize the banks 
    103103     */ 
    104     p_adec->bank_0.actual = p_adec->bank_0.v1; 
    105     p_adec->bank_0.pos = 0; 
    106     p_adec->bank_1.actual = p_adec->bank_1.v1; 
    107     p_adec->bank_1.pos = 0; 
     104    p_dec->bank_0.actual = p_dec->bank_0.v1; 
     105    p_dec->bank_0.pos = 0; 
     106    p_dec->bank_1.actual = p_dec->bank_1.v1; 
     107    p_dec->bank_1.pos = 0; 
    108108     
    109109    /* 
    110110     * Initialize bit stream  
    111111     */ 
    112     InitBitstream( &p_adec->bit_stream, p_adec->p_fifo, NULL, NULL ); 
     112    InitBitstream( &p_dec->bit_stream, p_dec->p_fifo, NULL, NULL ); 
    113113 
    114114    /* We do not create the audio output fifo now, but 
    115115       it will be created when the first frame is received */ 
    116     p_adec->p_aout = NULL; 
    117     p_adec->p_aout_input = NULL; 
    118     p_adec->i_pts = 0; 
    119  
    120     p_adec->i_sync = 0; 
     116    p_dec->p_aout = NULL; 
     117    p_dec->p_aout_input = NULL; 
    121118 
    122119    /* Audio decoder thread's main loop */ 
    123     while( (!p_adec->p_fifo->b_die) && (!p_adec->p_fifo->b_error) ) 
    124     { 
    125         DecodeThread( p_adec ); 
     120    while( (!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error) ) 
     121    { 
     122        DecodeThread( p_dec ); 
    126123    } 
    127124     
    128125    /* If b_error is set, the audio decoder thread enters the error loop */ 
    129     if( p_adec->p_fifo->b_error )  
    130     { 
    131         DecoderError( p_adec->p_fifo ); 
     126    if( p_dec->p_fifo->b_error )  
     127    { 
     128        DecoderError( p_dec->p_fifo ); 
    132129    } 
    133130 
    134131    /* End of the audio decoder thread */ 
    135     EndThread( p_adec ); 
     132    EndThread( p_dec ); 
    136133 
    137134    return( 0 ); 
     
    145142 * DecodeThread: decodes a mpeg frame 
    146143 *****************************************************************************/ 
    147 static void DecodeThread( adec_thread_t * p_adec ) 
     144static void DecodeThread( adec_thread_t * p_dec ) 
    148145{ 
    149     mtime_t i_pts; 
    150     aout_buffer_t *p_aout_buffer; 
     146    mtime_t pts; 
     147    aout_buffer_t * p_aout_buffer; 
    151148 
    152149    adec_sync_info_t sync_info; 
    153150     
    154     if( ! adec_SyncFrame (p_adec, &sync_info) ) 
    155     { 
    156          
     151    /* Look for sync word - should be 0x0b77 */ 
     152    RealignBits( &p_dec->bit_stream ); 
     153    while( (ShowBits( &p_dec->bit_stream, 16 ) & 0xfff0) != 0xfff0 &&  
     154           (!p_dec->p_fifo->b_die) && (!p_dec->p_fifo->b_error)) 
     155    { 
     156        RemoveBits( &p_dec->bit_stream, 8 ); 
     157    } 
     158 
     159    /* Set the Presentation Time Stamp */ 
     160    NextPTS( &p_dec->bit_stream, &pts, NULL ); 
     161    if ( pts != 0 && pts != aout_DateGet( &p_dec->end_date ) ) 
     162    { 
     163        aout_DateSet( &p_dec->end_date, pts ); 
     164    } 
     165 
     166    if( !adec_SyncFrame( p_dec, &sync_info ) ) 
     167    { 
    157168        /* Create the output fifo if it doesn't exist yet */ 
    158         if( ( p_adec->p_aout_input == NULL )|| 
    159             ( p_adec->output_format.i_channels != ( sync_info.b_stereo ? 2 : 1 ) )|| 
    160             ( p_adec->output_format.i_rate != sync_info.sample_rate ) ) 
    161         { 
    162             if( p_adec->p_aout_input ) 
     169        if( ( p_dec->p_aout_input == NULL )|| 
     170            ( p_dec->output_format.i_channels != ( sync_info.b_stereo ? 2 : 1 ) )|| 
     171            ( p_dec->output_format.i_rate != sync_info.sample_rate ) ) 
     172        { 
     173            if( p_dec->p_aout_input ) 
    163174            { 
    164175                /* Delete old output */ 
    165                 msg_Warn( p_adec->p_fifo, "opening a new aout" ); 
    166                 aout_InputDelete( p_adec->p_aout, p_adec->p_aout_input ); 
     176                msg_Warn( p_dec->p_fifo, "opening a new aout" ); 
     177                aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input ); 
    167178            } 
    168179 
    169180            /* Set output configuration */ 
    170             p_adec->output_format.i_format   = AOUT_FMT_FLOAT32; 
    171             p_adec->output_format.i_channels = ( sync_info.b_stereo ? 2 : 1 ); 
    172             p_adec->output_format.i_rate     = sync_info.sample_rate; 
    173             p_adec->p_aout_input = aout_InputNew( p_adec->p_fifo, 
    174                                                   &p_adec->p_aout, 
    175                                                   &p_adec->output_format ); 
    176         } 
    177  
    178         if( p_adec->p_aout_input == NULL ) 
    179         { 
    180             msg_Err( p_adec->p_fifo, "failed to create aout fifo" ); 
    181             p_adec->p_fifo->b_error = 1; 
     181            p_dec->output_format.i_format   = AOUT_FMT_FLOAT32; 
     182            p_dec->output_format.i_channels = ( sync_info.b_stereo ? 2 : 1 ); 
     183            p_dec->output_format.i_rate     = sync_info.sample_rate; 
     184            aout_DateInit( &p_dec->end_date, sync_info.sample_rate ); 
     185            p_dec->p_aout_input = aout_InputNew( p_dec->p_fifo, 
     186                                                  &p_dec->p_aout, 
     187                                                  &p_dec->output_format ); 
     188        } 
     189 
     190        if( p_dec->p_aout_input == NULL ) 
     191        { 
     192            msg_Err( p_dec->p_fifo, "failed to create aout fifo" ); 
     193            p_dec->p_fifo->b_error = 1; 
    182194            return; 
    183195        } 
    184196 
    185         p_aout_buffer = aout_BufferNew( p_adec->p_aout, 
    186                                         p_adec->p_aout_input, 
    187                                         ADEC_FRAME_SIZE ); 
     197        if( !aout_DateGet( &p_dec->end_date ) ) 
     198        { 
     199            /* We've just started the stream, wait for the first PTS. */ 
     200            return; 
     201        } 
     202 
     203        p_aout_buffer = aout_BufferNew( p_dec->p_aout, 
     204                                        p_dec->p_aout_input, 
     205                                        ADEC_FRAME_NB ); 
    188206        if( !p_aout_buffer ) 
    189207        { 
    190             msg_Err( p_adec->p_fifo, "cannot get aout buffer" ); 
    191             p_adec->p_fifo->b_error = 1; 
     208            msg_Err( p_dec->p_fifo, "cannot get aout buffer" ); 
     209            p_dec->p_fifo->b_error = 1; 
    192210            return; 
    193211        } 
    194  
    195         p_adec->i_sync = 1; 
    196  
    197          
    198         CurrentPTS( &p_adec->bit_stream, &i_pts, NULL ); 
    199         if( i_pts > 0 ) 
    200         { 
    201             p_adec->i_pts = i_pts; 
    202         } 
    203         p_aout_buffer->start_date = p_adec->i_pts; 
    204         p_adec->i_pts += (mtime_t)1000000 * (mtime_t)ADEC_FRAME_SIZE / 
    205                             (mtime_t)p_adec->output_format.i_rate; 
    206         p_aout_buffer->end_date = p_adec->i_pts; 
    207  
    208         if( adec_DecodeFrame (p_adec, (float*)p_aout_buffer->p_buffer ) ) 
     212        p_aout_buffer->start_date = aout_DateGet( &p_dec->end_date ); 
     213        p_aout_buffer->end_date = aout_DateIncrement( &p_dec->end_date, 
     214                                                      ADEC_FRAME_NB ); 
     215 
     216        if( adec_DecodeFrame (p_dec, (float*)p_aout_buffer->p_buffer ) ) 
    209217        { 
    210218            /* Ouch, failed decoding... We'll have to resync */ 
    211             p_adec->i_sync = 0; 
    212             aout_BufferDelete( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer ); 
     219            aout_BufferDelete( p_dec->p_aout, p_dec->p_aout_input, p_aout_buffer ); 
    213220        } 
    214221        else 
    215222        { 
    216             aout_BufferPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer ); 
     223            aout_BufferPlay( p_dec->p_aout, p_dec->p_aout_input, p_aout_buffer ); 
    217224        } 
    218225    } 
     
    225232 * initialization. 
    226233 *****************************************************************************/ 
    227 static void EndThread ( adec_thread_t *p_adec ) 
     234static void EndThread ( adec_thread_t *p_dec ) 
    228235{ 
    229236    /* If the audio output fifo was created, we destroy it */ 
    230     if( p_adec->p_aout_input ) 
    231     { 
    232         aout_InputDelete( p_adec->p_aout, p_adec->p_aout_input ); 
     237    if( p_dec->p_aout_input ) 
     238    { 
     239        aout_InputDelete( p_dec->p_aout, p_dec->p_aout_input ); 
    233240         
    234241    } 
    235242 
    236243    /* Destroy descriptor */ 
    237     free( p_adec ); 
    238 } 
    239  
     244    free( p_dec ); 
     245} 
     246 
  • modules/codec/mpeg_audio/decoder.h

    r764fd89 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999, 2000 VideoLAN 
    5  * $Id: decoder.h,v 1.2 2002/08/17 15:35:10 fenrir Exp $ 
     5 * $Id: decoder.h,v 1.3 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Michel Kaempf <maxx@via.ecp.fr> 
     
    5353    aout_input_t        *p_aout_input; /* opaque */ 
    5454    audio_sample_format_t output_format; 
    55     mtime_t             i_pts; 
    56              
     55    audio_date_t        end_date; 
    5756} adec_thread_t; 
    5857 
  • modules/codec/mpeg_audio/generic.c

    r764fd89 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: generic.c,v 1.2 2002/08/17 15:35:10 fenrir Exp $ 
     5 * $Id: generic.c,v 1.3 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Michel Kaempf <maxx@via.ecp.fr> 
     
    4747int adec_SyncFrame( adec_thread_t * p_adec, adec_sync_info_t * p_sync_info ) 
    4848{ 
    49     static int mpeg1_sample_rate[3] = {44100, 48000, 32000}; 
    50     static int mpeg1_layer1_bit_rate[15] = 
     49    static const int mpeg1_sample_rate[3] = {44100, 48000, 32000}; 
     50    static const int mpeg1_layer1_bit_rate[15] = 
    5151    { 
    5252        0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 
    5353    }; 
    54     static int mpeg1_layer2_bit_rate[15] = 
     54    static const int mpeg1_layer2_bit_rate[15] = 
    5555    { 
    5656        0, 32, 48, 56,  64,  80,  96, 112, 128, 160, 192, 224, 256, 320, 384 
    5757    }; 
    58     static int mpeg2_layer1_bit_rate[15] = 
     58    static const int mpeg2_layer1_bit_rate[15] = 
    5959    { 
    6060        0, 32, 48, 56,  64,  80,  96, 112, 128, 144, 160, 176, 192, 224, 256 
    6161    }; 
    62     static int mpeg2_layer2_bit_rate[15] = 
     62    static const int mpeg2_layer2_bit_rate[15] = 
    6363    { 
    6464        0,  8, 16, 24,  32,  40,  48,  56,  64,  80,  96, 112, 128, 144, 160 
    6565    }; 
    66     static int * bit_rate_table[8] = 
     66    static const int * bit_rate_table[8] = 
    6767    { 
    6868        NULL, NULL, mpeg2_layer2_bit_rate, mpeg2_layer1_bit_rate, 
  • modules/codec/mpeg_audio/layer2.c

    r764fd89 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1999-2001 VideoLAN 
    5  * $Id: layer2.c,v 1.3 2002/08/17 15:35:10 fenrir Exp $ 
     5 * $Id: layer2.c,v 1.4 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: Michel Kaempf <maxx@via.ecp.fr> 
     
    435435            { 
    436436                DCT32( &p_adec->bank_0, sample[s] ); 
    437                 PCM( &p_adec->bank_0, buffer, 2 ); 
    438  
    439                 /* FIXME: one shouldn't have to do it twice ! */ 
    440                 DCT32( &p_adec->bank_1, sample[s] ); 
    441                 PCM( &p_adec->bank_1, buffer + 1, 2 ); 
    442  
    443                 buffer += 64; 
     437                PCM( &p_adec->bank_0, buffer, 1 ); 
     438 
     439                buffer += 32; 
    444440            } 
    445441        } 
  • modules/codec/spdif.c

    r5ffbc97 r15f3b0f  
    11/***************************************************************************** 
    2  * spdif.c: A52 pass-through to external decoder with enabled soundcard 
     2 * spdif.c: A/52 pass-through to external decoder with enabled soundcard 
    33 ***************************************************************************** 
    44 * Copyright (C) 2001-2002 VideoLAN 
    5  * $Id: spdif.c,v 1.6 2002/08/19 21:31:11 massiot Exp $ 
     5 * $Id: spdif.c,v 1.7 2002/08/26 23:00:22 massiot Exp $ 
    66 * 
    77 * Authors: St�ane Borel <stef@via.ecp.fr> 
     
    118118{ 
    119119    spdif_thread_t * p_dec; 
    120     mtime_t last_date = 0
     120    audio_date_t end_date
    121121     
    122122    /* Allocate the memory needed to store the thread's structure */ 
     
    155155        } 
    156156 
     157        /* Set the Presentation Time Stamp */ 
     158        NextPTS( &p_dec->bit_stream, &pts, NULL ); 
     159        if ( pts != 0 && pts != aout_DateGet( &end_date ) ) 
     160        { 
     161            aout_DateSet( &end_date, pts ); 
     162        } 
     163 
    157164        /* Get A/52 frame header */ 
    158165        GetChunk( &p_dec->bit_stream, p_header, 7 ); 
     
    184191            p_dec->output_format.i_bytes_per_frame = i_frame_size; 
    185192            p_dec->output_format.i_frame_length = A52_FRAME_NB; 
    186             /* p_dec->output_format.i_channels = i_channels; */ 
     193            aout_DateInit( &end_date, i_rate ); 
    187194            p_dec->p_aout_input = aout_InputNew( p_dec->p_fifo, 
    188195                                                 &p_dec->p_aout, 
     
    196203        } 
    197204 
    198         /* Set the Presentation Time Stamp */ 
    199         CurrentPTS( &p_dec->bit_stream, &pts, NULL ); 
    200         if ( pts != 0 ) 
    201         { 
    202             last_date = pts; 
    203         } 
    204  
    205         if ( !last_date ) 
     205        if ( !aout_DateGet( &end_date ) ) 
    206206        { 
    207207            byte_t p_junk[3840]; 
     
    215215                                   A52_FRAME_NB ); 
    216216        if ( p_buffer == NULL ) return -1; 
    217         p_buffer->start_date = last_date; 
    218         last_date += (mtime_t)(A52_FRAME_NB * 1000000) 
    219                        / p_dec->output_format.i_rate; 
    220         p_buffer->end_date = last_date; 
     217        p_buffer->start_date = aout_DateGet( &end_date ); 
     218        p_buffer->end_date = aout_DateIncrement( &end_date, 
     219                                                 A52_FRAME_NB ); 
    221220 
    222221        /* Get the whole frame. */ 
  • src/audio_output/input.c

    r711160b r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: input.c,v 1.8 2002/08/24 10:19:43 sam Exp $ 
     5 * $Id: input.c,v 1.9 2002/08/26 23:00:23 massiot Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    3030#include <vlc/vlc.h> 
    3131 
     32#ifdef HAVE_ALLOCA_H 
     33#   include <alloca.h> 
     34#endif 
     35 
    3236#include "audio_output.h" 
    3337#include "aout_internal.h" 
  • src/audio_output/mixer.c

    r1c13a98 r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: mixer.c,v 1.9 2002/08/21 22:41:59 massiot Exp $ 
     5 * $Id: mixer.c,v 1.10 2002/08/26 23:00:23 massiot Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    250250        return -1; 
    251251    } 
    252     p_output_buffer->i_nb_samples = p_aout->output.i_nb_samples; 
    253     p_output_buffer->i_nb_bytes = p_aout->output.i_nb_samples 
     252    /* This is again a bit kludgy - for the S/PDIF mixer. */ 
     253    if ( p_aout->mixer.output_alloc.i_alloc_type != AOUT_ALLOC_NONE ) 
     254    { 
     255        p_output_buffer->i_nb_samples = p_aout->output.i_nb_samples; 
     256        p_output_buffer->i_nb_bytes = p_aout->output.i_nb_samples 
    254257                              * p_aout->mixer.mixer.i_bytes_per_frame 
    255258                              / p_aout->mixer.mixer.i_frame_length; 
     259    } 
    256260    p_output_buffer->start_date = start_date; 
    257261    p_output_buffer->end_date = end_date; 
  • src/input/input_ext-dec.c

    r347c0fe r15f3b0f  
    33 ***************************************************************************** 
    44 * Copyright (C) 1998-2001 VideoLAN 
    5  * $Id: input_ext-dec.c,v 1.33 2002/07/24 15:21:47 sam Exp $ 
     5 * $Id: input_ext-dec.c,v 1.34 2002/08/26 23:00:23 massiot Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    430430    /* Check if the current PTS is already valid (ie. if the first byte 
    431431     * of the packet has already been used in the decoder). */ 
    432     ptrdiff_t p_diff = p_bit_stream->p_byte - p_bit_stream->p_pts_validity
     432    ptrdiff_t p_diff = p_bit_stream->p_pts_validity - p_bit_stream->p_byte
    433433    if( p_diff < 0 || p_diff > 4 /* We are far away so it is valid */ 
    434434         || (p_diff * 8) >= p_bit_stream->fifo.i_available 
     
    447447} 
    448448 
     449/***************************************************************************** 
     450 * NextPTS: returns the PTS and DTS for the next starting byte 
     451 *****************************************************************************/ 
     452void NextPTS( bit_stream_t * p_bit_stream, mtime_t * pi_pts, 
     453              mtime_t * pi_dts ) 
     454{ 
     455    /* Check if the current PTS is already valid (ie. if the first byte 
     456     * of the packet has already been used in the decoder). */ 
     457    ptrdiff_t p_diff = p_bit_stream->p_pts_validity - p_bit_stream->p_byte - 1; 
     458    if( p_diff < 0 || p_diff > 4 /* We are far away so it is valid */ 
     459         || (p_diff * 8) >= p_bit_stream->fifo.i_available 
     460            /* We have buffered less bytes than actually read */ ) 
     461    { 
     462        *pi_pts = p_bit_stream->i_pts; 
     463        if( pi_dts != NULL ) *pi_dts = p_bit_stream->i_dts; 
     464        p_bit_stream->i_pts = 0; 
     465        p_bit_stream->i_dts = 0; 
     466    } 
     467    else 
     468    { 
     469        *pi_pts = 0; 
     470        if( pi_dts != NULL) *pi_dts = 0; 
     471    } 
     472} 
     473 
  • src/misc/modules_plugin.h

    ra2c6740 r15f3b0f  
    215215    (p_symbols)->UnalignedGetBits_inner = UnalignedGetBits; \ 
    216216    (p_symbols)->CurrentPTS_inner = CurrentPTS; \ 
     217    (p_symbols)->NextPTS_inner = NextPTS; \ 
    217218    (p_symbols)->DecoderError_inner = DecoderError; \ 
    218219    (p_symbols)->__input_SetStatus_inner = __input_SetStatus; \