~ubuntu-branches/debian/squeeze/vlc/squeeze

« back to all changes in this revision

Viewing changes to src/input/decoder.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Mutricy
  • Date: 2009-09-20 01:08:41 UTC
  • mto: This revision was merged to the branch mainline in revision 9.
  • Revision ID: james.westby@ubuntu.com-20090920010841-vc6vme91a70r5w0t
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * decoder.c: Functions for the management of decoders
3
3
 *****************************************************************************
4
4
 * Copyright (C) 1999-2004 the VideoLAN team
5
 
 * $Id: 514ef7384ad24898623c312e42bc93d255c31b8b $
 
5
 * $Id: b110a1e88571146b75f320548bca6b576c0937da $
6
6
 *
7
7
 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8
8
 *          Gildas Bazin <gbazin@videolan.org>
1084
1084
    }
1085
1085
}
1086
1086
 
 
1087
/**
 
1088
 * If *pb_reject, it does nothing, otherwise it waits for the given
 
1089
 * deadline or a flush request (in which case it set *pi_reject to true.
 
1090
 */
 
1091
static void DecoderWaitDate( decoder_t *p_dec,
 
1092
                             bool *pb_reject, mtime_t i_deadline )
 
1093
{
 
1094
    decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
1095
 
 
1096
    if( *pb_reject || i_deadline < 0 )
 
1097
        return;
 
1098
 
 
1099
    for( ;; )
 
1100
    {
 
1101
        vlc_mutex_lock( &p_owner->lock );
 
1102
        if( p_owner->b_flushing || p_dec->b_die )
 
1103
        {
 
1104
            *pb_reject = true;
 
1105
            vlc_mutex_unlock( &p_owner->lock );
 
1106
            break;
 
1107
        }
 
1108
        int i_ret = vlc_cond_timedwait( &p_owner->wait_request, &p_owner->lock,
 
1109
                                        i_deadline );
 
1110
        vlc_mutex_unlock( &p_owner->lock );
 
1111
        if( i_ret )
 
1112
            break;
 
1113
    }
 
1114
}
 
1115
 
1087
1116
static void DecoderPlayAudio( decoder_t *p_dec, aout_buffer_t *p_audio,
1088
1117
                              int *pi_played_sum, int *pi_lost_sum )
1089
1118
{
1159
1188
            i_rate > INPUT_RATE_DEFAULT*AOUT_MAX_INPUT_RATE )
1160
1189
            b_reject = true;
1161
1190
 
1162
 
        /* Do not wait against unprotected date */
1163
 
        const mtime_t i_deadline = p_audio->start_date - AOUT_MAX_PREPARE_TIME;
1164
 
        while( !b_reject && i_deadline > mdate() )
1165
 
        {
1166
 
            vlc_mutex_lock( &p_owner->lock );
1167
 
            if( p_owner->b_flushing || p_dec->b_die )
1168
 
            {
1169
 
                b_reject = true;
1170
 
                vlc_mutex_unlock( &p_owner->lock );
1171
 
                break;
1172
 
            }
1173
 
            vlc_cond_timedwait( &p_owner->wait_request, &p_owner->lock, i_deadline );
1174
 
            vlc_mutex_unlock( &p_owner->lock );
1175
 
        }
 
1191
        DecoderWaitDate( p_dec, &b_reject,
 
1192
                         p_audio->start_date - AOUT_MAX_PREPARE_TIME );
1176
1193
 
1177
1194
        if( !b_reject )
1178
1195
        {
1553
1570
 
1554
1571
        vlc_mutex_unlock( &p_owner->lock );
1555
1572
 
 
1573
        if( p_subpic->i_start <= VLC_TS_INVALID )
 
1574
            b_reject = true;
 
1575
 
 
1576
        DecoderWaitDate( p_dec, &b_reject,
 
1577
                         p_subpic->i_start - SPU_MAX_PREPARE_TIME );
 
1578
 
1556
1579
        if( !b_reject )
1557
1580
            spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
1558
1581
        else
2268
2291
            var_CreateGetBool( p_dec, "hdtv-fix" ) )
2269
2292
        {
2270
2293
            p_dec->fmt_out.video.i_visible_height = 1080;
2271
 
            p_dec->fmt_out.video.i_sar_num *= 135;
2272
 
            p_dec->fmt_out.video.i_sar_den *= 136;
 
2294
            if( !(p_dec->fmt_out.video.i_sar_num % 136))
 
2295
            {
 
2296
                p_dec->fmt_out.video.i_sar_num *= 135;
 
2297
                p_dec->fmt_out.video.i_sar_den *= 136;
 
2298
            }
2273
2299
            msg_Warn( p_dec, "Fixing broken HDTV stream (display_height=1088)");
2274
2300
        }
2275
2301