Commit abf14b8c authored by Christophe Massiot's avatar Christophe Massiot

* UDP access plug-in can now receive MPTS (Multiple Program TS) and switch

programs
* Audio and video output go to time-constrained scheduling [OS X port]
parent e0876a90
...@@ -1235,7 +1235,7 @@ else ...@@ -1235,7 +1235,7 @@ else
VLC_MAKE="gmake" VLC_MAKE="gmake"
fi fi
ALL_LINGUAS="de fr no ru" ALL_LINGUAS="de fr no ru nl"
cat >> confdefs.h <<EOF cat >> confdefs.h <<EOF
#define PACKAGE "vlc" #define PACKAGE "vlc"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* udp.c: raw UDP access plug-in * udp.c: raw UDP access plug-in
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: udp.c,v 1.5 2002/03/26 23:39:43 massiot Exp $ * $Id: udp.c,v 1.6 2002/03/27 22:15:40 massiot Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -266,11 +266,57 @@ static int UDPOpen( input_thread_t * p_input ) ...@@ -266,11 +266,57 @@ static int UDPOpen( input_thread_t * p_input )
} }
/***************************************************************************** /*****************************************************************************
* UDPSetProgram: Do nothing * UDPSetProgram: Selects another program
*****************************************************************************/ *****************************************************************************/
static int UDPSetProgram( input_thread_t * p_input, int UDPSetProgram( input_thread_t * p_input,
pgrm_descriptor_t * p_program ) pgrm_descriptor_t * p_new_prg )
{ {
int i_es_index;
if ( p_input->stream.p_selected_program )
{
for ( i_es_index = 1 ; /* 0 should be the PMT */
i_es_index < p_input->stream.p_selected_program->
i_es_number ;
i_es_index ++ )
{
#define p_es p_input->stream.p_selected_program->pp_es[i_es_index]
if ( p_es->p_decoder_fifo )
{
input_UnselectES( p_input , p_es );
p_es->p_pes = NULL; /* FIXME */
}
#undef p_es
}
}
for (i_es_index = 1 ; i_es_index < p_new_prg->i_es_number ; i_es_index ++ )
{
#define p_es p_new_prg->pp_es[i_es_index]
switch( p_es->i_cat )
{
case MPEG1_VIDEO_ES:
case MPEG2_VIDEO_ES:
if ( p_main->b_video )
{
input_SelectES( p_input , p_es );
}
break;
case MPEG1_AUDIO_ES:
case MPEG2_AUDIO_ES:
if ( p_main->b_audio )
{
input_SelectES( p_input , p_es );
}
break;
default:
input_SelectES( p_input , p_es );
break;
#undef p_es
}
}
p_input->stream.p_selected_program = p_new_prg;
return( 0 ); return( 0 );
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* aout_macosx.c : CoreAudio output plugin * aout_macosx.c : CoreAudio output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: aout_macosx.c,v 1.16 2002/03/22 00:47:47 jlj Exp $ * $Id: aout_macosx.c,v 1.17 2002/03/27 22:15:40 massiot Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Jon Lech Johansen <jon-vl@nanocrew.net> * Jon Lech Johansen <jon-vl@nanocrew.net>
...@@ -26,6 +26,11 @@ ...@@ -26,6 +26,11 @@
* Preamble * Preamble
*****************************************************************************/ *****************************************************************************/
#include <string.h> #include <string.h>
#include <mach/mach_init.h>
#include <mach/task_policy.h>
#include <mach/thread_act.h>
#include <mach/thread_policy.h>
#include <sys/sysctl.h>
#include <videolan/vlc.h> #include <videolan/vlc.h>
...@@ -99,6 +104,12 @@ static int aout_Open( aout_thread_t *p_aout ) ...@@ -99,6 +104,12 @@ static int aout_Open( aout_thread_t *p_aout )
OSStatus err; OSStatus err;
UInt32 ui_param_size; UInt32 ui_param_size;
struct thread_time_constraint_policy ttcpolicy;
int mib[2];
unsigned int miblen;
int i_busspeed;
size_t len;
/* allocate instance */ /* allocate instance */
p_aout->p_sys = malloc( sizeof( aout_sys_t ) ); p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
if( p_aout->p_sys == NULL ) if( p_aout->p_sys == NULL )
...@@ -169,6 +180,40 @@ static int aout_Open( aout_thread_t *p_aout ) ...@@ -169,6 +180,40 @@ static int aout_Open( aout_thread_t *p_aout )
return( -1 ); return( -1 );
} }
/* Go to time-constrained thread policy */
/* Get bus speed */
mib[0] = CTL_HW;
mib[1] = HW_BUS_FREQ;
miblen = 2;
len = 4;
if( sysctl(mib, miblen, &i_busspeed, &len, NULL, 0) == -1 )
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (bus speed)");
}
else
{
/* This is in AbsoluteTime units, which are equal to
* 1/4 the bus speed on most machines. */
/* FIXME : these are random numbers ! */
/* hard-coded numbers are approximations for 100 MHz bus speed.
* assume that app deals in frame-sized chunks, e.g. 30 per second.
* ttcpolicy.period = 833333; */
ttcpolicy.period = i_busspeed / 120;
/* ttcpolicy.computation = 60000; */
ttcpolicy.computation = i_busspeed / 1440;
/* ttcpolicy.constraint = 120000; */
ttcpolicy.constraint = i_busspeed / 720;
ttcpolicy.preemptible = 1;
if (thread_policy_set(mach_thread_self(),
THREAD_TIME_CONSTRAINT_POLICY, (int *)&ttcpolicy,
THREAD_TIME_CONSTRAINT_POLICY_COUNT) != KERN_SUCCESS)
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (thread_policy_set)");
}
}
return( 0 ); return( 0 );
} }
......
...@@ -28,6 +28,11 @@ ...@@ -28,6 +28,11 @@
#include <errno.h> /* ENOMEM */ #include <errno.h> /* ENOMEM */
#include <stdlib.h> /* free() */ #include <stdlib.h> /* free() */
#include <string.h> /* strerror() */ #include <string.h> /* strerror() */
#include <mach/mach_init.h>
#include <mach/task_policy.h>
#include <mach/thread_act.h>
#include <mach/thread_policy.h>
#include <sys/sysctl.h>
#include <videolan/vlc.h> #include <videolan/vlc.h>
...@@ -179,6 +184,12 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -179,6 +184,12 @@ static int vout_Init( vout_thread_t *p_vout )
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
struct thread_time_constraint_policy ttcpolicy;
int mib[2];
unsigned int miblen;
int i_busspeed;
size_t len;
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
/* Initialize the output structure; we already found a codec, /* Initialize the output structure; we already found a codec,
...@@ -226,6 +237,40 @@ static int vout_Init( vout_thread_t *p_vout ) ...@@ -226,6 +237,40 @@ static int vout_Init( vout_thread_t *p_vout )
I_OUTPUTPICTURES++; I_OUTPUTPICTURES++;
} }
/* Go to time-constrained thread policy */
/* Get bus speed */
mib[0] = CTL_HW;
mib[1] = HW_BUS_FREQ;
miblen = 2;
len = 4;
if( sysctl(mib, miblen, &i_busspeed, &len, NULL, 0) == -1 )
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (bus speed)");
}
else
{
/* This is in AbsoluteTime units, which are equal to
* 1/4 the bus speed on most machines. */
/* hard-coded numbers are approximations for 100 MHz bus speed.
* assume that app deals in frame-sized chunks, e.g. 30 per second.
* ttcpolicy.period = 833333; */
ttcpolicy.period = i_busspeed / 120;
/* ttcpolicy.computation = 60000; */
ttcpolicy.computation = i_busspeed / 1440;
/* ttcpolicy.constraint = 120000; */
ttcpolicy.constraint = i_busspeed / 720;
ttcpolicy.preemptible = 1;
if (thread_policy_set(mach_thread_self(),
THREAD_TIME_CONSTRAINT_POLICY, (int *)&ttcpolicy,
THREAD_TIME_CONSTRAINT_POLICY_COUNT) != KERN_SUCCESS)
{
intf_ErrMsg("vout error: couldn't go to time-constrained policy (thread_policy_set)");
}
}
return( 0 ); return( 0 );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment