Commit 1bb3f90f authored by Olivier Aubert's avatar Olivier Aubert

mediacontrol-core.c: updated the used API to the new demux2

  API. ByteCount positions are not supported anymore.
parent ee5688a0
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/vout.h> #include <vlc/vout.h>
#include <vlc/aout.h> #include <vlc/aout.h>
#include <vlc_demux.h>
#include <osd.h> #include <osd.h>
...@@ -47,13 +48,17 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -47,13 +48,17 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
{ {
case mediacontrol_MediaTime: case mediacontrol_MediaTime:
if( to == mediacontrol_ByteCount ) if( to == mediacontrol_ByteCount )
return value * 50 * p_input->stream.i_mux_rate / 1000; {
/* FIXME */
/* vlc < 0.8 API */
/* return value * 50 * p_input->stream.i_mux_rate / 1000; */
return 0;
}
if( to == mediacontrol_SampleCount ) if( to == mediacontrol_SampleCount )
{ {
double f_fps; double f_fps;
if( demux_Control( p_input, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 ) if( demux2_Control( p_input->input.p_demux, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 )
return 0; return 0;
else else
return( value * f_fps / 1000.0 ); return( value * f_fps / 1000.0 );
...@@ -66,11 +71,16 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -66,11 +71,16 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
{ {
double f_fps; double f_fps;
if( demux_Control( p_input, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 ) if( demux2_Control( p_input->input.p_demux, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 )
return 0; return 0;
if( to == mediacontrol_ByteCount ) if( to == mediacontrol_ByteCount )
return ( long long )( value * 50 * p_input->stream.i_mux_rate / f_fps ); {
/* FIXME */
/* vlc < 0.8 API */
/* return ( long long )( value * 50 * p_input->stream.i_mux_rate / f_fps ); */
return 0;
}
if( to == mediacontrol_MediaTime ) if( to == mediacontrol_MediaTime )
return( long long )( value * 1000.0 / ( double )f_fps ); return( long long )( value * 1000.0 / ( double )f_fps );
...@@ -79,24 +89,28 @@ long long mediacontrol_unit_convert( input_thread_t *p_input, ...@@ -79,24 +89,28 @@ long long mediacontrol_unit_convert( input_thread_t *p_input,
break; break;
} }
case mediacontrol_ByteCount: case mediacontrol_ByteCount:
if( p_input->stream.i_mux_rate == 0 ) /* FIXME */
return 0; return 0;
/* vlc < 0.8 API: */
/* Convert an offset into milliseconds. Taken from input_ext-intf.c.
The 50 hardcoded constant comes from the definition of i_mux_rate : // if( p_input->stream.i_mux_rate == 0 )
i_mux_rate : the rate we read the stream (in units of 50 bytes/s) ; // return 0;
0 if undef */ //
if( to == mediacontrol_MediaTime ) // /* Convert an offset into milliseconds. Taken from input_ext-intf.c.
return ( long long )( 1000 * value / 50 / p_input->stream.i_mux_rate ); // The 50 hardcoded constant comes from the definition of i_mux_rate :
// i_mux_rate : the rate we read the stream (in units of 50 bytes/s) ;
if( to == mediacontrol_SampleCount ) // 0 if undef */
{ // if( to == mediacontrol_MediaTime )
double f_fps; // return ( long long )( 1000 * value / 50 / p_input->stream.i_mux_rate );
if( demux_Control( p_input, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 ) //
return 0; // if( to == mediacontrol_SampleCount )
else // {
return ( long long )( value * f_fps / 50 / p_input->stream.i_mux_rate ); // double f_fps;
} // if( demux2_Control( p_input->input.p_demux, DEMUX_GET_FPS, &f_fps ) || f_fps < 0.1 )
// return 0;
// else
// return ( long long )( value * f_fps / 50 / p_input->stream.i_mux_rate );
// }
/* Cannot happen */ /* Cannot happen */
break; break;
} }
...@@ -328,7 +342,7 @@ mediacontrol_set_media_position( mediacontrol_Instance *self, ...@@ -328,7 +342,7 @@ mediacontrol_set_media_position( mediacontrol_Instance *self,
return; return;
} }
if( !p_input->stream.b_seekable ) if( !var_GetBool( p_input, "seekable" ) )
{ {
RAISE( mediacontrol_InvalidPosition, "Stream not seekable" ); RAISE( mediacontrol_InvalidPosition, "Stream not seekable" );
return; return;
...@@ -758,8 +772,10 @@ mediacontrol_display_text( mediacontrol_Instance *self, ...@@ -758,8 +772,10 @@ mediacontrol_display_text( mediacontrol_Instance *self,
return; return;
} }
i_now = input_ClockGetTS( p_input, NULL, 0 ); /* FIXME */
/* i_now = input_ClockGetTS( p_input, NULL, 0 ); */
i_now = 0;
i_debut = mediacontrol_position2microsecond( p_input, i_debut = mediacontrol_position2microsecond( p_input,
( mediacontrol_Position* ) begin ); ( mediacontrol_Position* ) begin );
i_debut += i_now; i_debut += i_now;
...@@ -802,23 +818,14 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self, ...@@ -802,23 +818,14 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
} }
else else
{ {
switch( p_input->stream.control.i_status ) switch( var_GetInteger( p_input, "state" ) )
{ {
case UNDEF_S :
retval->streamstatus = mediacontrol_UndefinedStatus;
break;
case PLAYING_S : case PLAYING_S :
retval->streamstatus = mediacontrol_PlayingStatus; retval->streamstatus = mediacontrol_PlayingStatus;
break; break;
case PAUSE_S : case PAUSE_S :
retval->streamstatus = mediacontrol_PauseStatus; retval->streamstatus = mediacontrol_PauseStatus;
break; break;
case FORWARD_S :
retval->streamstatus = mediacontrol_ForwardStatus;
break;
case BACKWARD_S :
retval->streamstatus = mediacontrol_BackwardStatus;
break;
case INIT_S : case INIT_S :
retval->streamstatus = mediacontrol_InitStatus; retval->streamstatus = mediacontrol_InitStatus;
break; break;
...@@ -830,7 +837,7 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self, ...@@ -830,7 +837,7 @@ mediacontrol_get_stream_information( mediacontrol_Instance *self,
break; break;
} }
retval->url = strdup( p_input->psz_source ); retval->url = strdup( p_input->input.p_item->psz_uri );
/* TIME and LENGTH are in microseconds. We want them in ms */ /* TIME and LENGTH are in microseconds. We want them in ms */
var_Get( p_input, "time", &val); var_Get( p_input, "time", &val);
......
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