Commit d857773c authored by Stéphane Borel's avatar Stéphane Borel
Browse files

Forgot one file.

parent e5c6a7af
* aout_spdif: ac3 passthrough output
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.1 2001/04/29 02:55:36 stef Exp $
* Authors: Michel Kaempf <>
* Stphane Borel <>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
* Preamble
#include "defs.h"
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* calloc(), malloc(), free() */
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h" /* mtime_t, mdate(), msleep() */
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
#include "audio_output.h"
#include "aout_common.h"
/* temporary blank until I've found how to build
* a real blank iec958 data frame */
static u8 pi_spdif_blank [] =
0x72, 0xf8, 0x1f, 0x4e, 0x01, 0x00, 0x00, 0x30,
0x77, 0x0b, 0x07, 0x04, 0x40, 0x1c, 0xfc, 0xe1,
0xcb, 0x01, 0x7d, 0x80, 0xb2, 0xfe, 0x40, 0xe8,
0x06, 0x75, 0x84, 0x07, 0x14, 0x04, 0x0e, 0x14,
0x84, 0x83, 0x56, 0xd5, 0xbe, 0x52, 0xad, 0x5b,
0x27, 0xf4, 0x9f, 0xcf, 0xdf, 0x3f, 0x95, 0x6a,
0x86, 0x3d, 0xba, 0xa6, 0xb0, 0x67, 0xbe, 0xa1,
0xfd, 0x52, 0x9a, 0xd2, 0xb5, 0xcf, 0x7d, 0x5a,
0xf2, 0x4d, 0x4f, 0x5a, 0xf6, 0xbd, 0xfa, 0x95,
0xe9, 0x57, 0x3e, 0x95, 0xe9, 0x54, 0x77, 0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f, 0x16, 0x49, 0xf8, 0x49,
0x5d, 0xad, 0xe3, 0x1c, 0x44, 0xeb, 0x5e, 0xfd,
0x2d, 0xe1, 0xcc, 0xc4, 0x79, 0x73, 0x8d, 0x58,
0x87, 0x7e, 0x00, 0x94, 0xb6, 0xe4, 0x85, 0x5c,
0x67, 0x84, 0x7a, 0x8d, 0xfb, 0x3f, 0x43, 0x06,
0xd0, 0xf3, 0x3d, 0xac, 0x46, 0x80, 0xcb, 0x5a,
0xc1, 0xc9, 0x49, 0xf5, 0x9d, 0xaa, 0x18, 0x57,
0x38, 0x07, 0x9b, 0x65, 0xf8, 0xbd, 0x2f, 0xfa,
0x3a, 0xad, 0x34, 0xfc, 0x5c, 0xb7, 0x0f, 0x47,
0xc2, 0xba, 0x19, 0xba, 0xca, 0x99, 0xb5, 0x3a,
0xd2, 0x2e, 0x26, 0x89, 0xcd, 0xb5, 0x54, 0x8b,
0x35, 0x43, 0x6b, 0xca, 0x1b, 0x4e, 0x8d, 0x58,
0x5b, 0x53, 0x05, 0x36, 0xb9, 0xa2, 0x69, 0x1a,
0x6b, 0x4d, 0x42, 0x5c, 0xa7, 0xaa, 0x4f, 0x39,
0xd7, 0x7a, 0x6a, 0x29, 0x61, 0x6b, 0x36, 0x0b,
0xb3, 0x0d, 0x62, 0x5b, 0xab, 0xd9, 0x91, 0x3c,
0x6d, 0x44, 0x63, 0x84, 0xc6, 0x48, 0x75, 0xb2,
0x48, 0x6d, 0xd9, 0xd6, 0x64, 0xcd, 0x82, 0x1c,
0xa2, 0xa8, 0xca, 0x29, 0x16, 0x4a, 0xd2, 0x8d,
0x6b, 0x29, 0xc7, 0x1a, 0xcd, 0x35, 0x5a, 0x74,
0x54, 0xa7, 0x29, 0x42, 0x6b, 0xb6, 0xa8, 0x9a,
0xa1, 0x31, 0x03, 0x81, 0x00, 0x96, 0x2a, 0x60,
* aout_SpdifThread: audio output thread that sends raw spdif data
* to an external decoder
* This output thread is quite specific as it can only handle one fifo.
* Now fifo #0 is hardcoded, but when the output is launched by the decoder,
* we'll be able to associate the related fifo to this output.
* Note: all this is wrong: spdif can demux up to 8 ac3 streams, and can
* even take care of time stamps (cf ac3 spec).
void aout_SpdifThread( aout_thread_t * p_aout )
u8 * pi_blank;
boolean_t b_have_data;
mtime_t date;
/* when the output is launched from the decoder,
* we won't have to use a hardcoded value for frame size */
pi_blank = malloc( 6144/*p_aout->fifo[0].l_frame_size*/ );
memset( pi_blank, 0, sizeof(pi_blank) );
memcpy( pi_blank, pi_spdif_blank, sizeof(pi_spdif_blank) );
/* the thread wait until there is some data is aout fifo */
vlc_mutex_lock( &p_aout->fifo[0].data_lock);
vlc_cond_wait( &p_aout->fifo[0].data_wait,
vlc_mutex_unlock (&p_aout->fifo[0].data_lock);
date = mdate();
while( !p_aout->b_die )
/* we leave some time for aout fifo to fill */
msleep( 20000 );
vlc_mutex_lock( &p_aout->fifo[0].data_lock );
b_have_data = !AOUT_FIFO_ISEMPTY( p_aout->fifo[0] );
vlc_mutex_unlock (&p_aout->fifo[0].data_lock);
if( b_have_data )
/* play spdif frame to the external decoder */
date = mdate();
p_aout->pf_play( p_aout,
p_aout->fifo[0].buffer +
p_aout->fifo[0].l_frame_size *
p_aout->fifo[0].l_frame_size );
vlc_mutex_lock( &p_aout->fifo[0].data_lock);
p_aout->fifo[0].l_start_frame =
(p_aout->fifo[0].l_start_frame + 1 ) & AOUT_FIFO_SIZE;
vlc_mutex_unlock (&p_aout->fifo[0].data_lock);
intf_WarnMsg( 2, "spdif warning: waiting (%lld)",
p_aout->fifo[0].date[p_aout->fifo[0].l_start_frame-1] - date );
date = mdate();
/* insert blank frame for stream continuity to
* the external decoder */
p_aout->pf_play( p_aout, pi_blank, p_aout->fifo[0].l_frame_size );
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment