Commit 02d6384d authored by Laurent Aimar's avatar Laurent Aimar

* access.* input/*: added access_filter architecture (same API as a

 standard access_t except that it reads from an access_t).

 * timeshift.c: timeshift access filter. It works with udp/dvb streams (tested
 under linux/windows).
 It allows to pause and to fast/slow forward. To try it, use
 --access-filter timeshift.
parent e80505af
......@@ -81,11 +81,12 @@
#define CAT_INPUT 4
#define SUBCAT_INPUT_ACCESS 401
#define SUBCAT_INPUT_DEMUX 402
#define SUBCAT_INPUT_VCODEC 403
#define SUBCAT_INPUT_ACODEC 404
#define SUBCAT_INPUT_SCODEC 405
#define SUBCAT_INPUT_ADVANCED 406
#define SUBCAT_INPUT_ACCESS_FILTER 402
#define SUBCAT_INPUT_DEMUX 403
#define SUBCAT_INPUT_VCODEC 404
#define SUBCAT_INPUT_ACODEC 405
#define SUBCAT_INPUT_SCODEC 406
#define SUBCAT_INPUT_ADVANCED 407
#define CAT_SOUT 5
#define SUBCAT_SOUT_GENERAL 501
......
......@@ -70,6 +70,8 @@ struct access_t
char *psz_access;
/* Access path/url/filename/.... */
char *psz_path;
/* Access source for access_filter (NULL for regular access) */
access_t *p_source;
/* Access can fill this entry to force a demuxer
* XXX: fill it once you know for sure you will succed
......@@ -107,6 +109,7 @@ struct access_t
#define access2_New( a, b, c, d, e ) __access2_New(VLC_OBJECT(a), b, c, d, e )
VLC_EXPORT( access_t *, __access2_New, ( vlc_object_t *p_obj, char *psz_access, char *psz_demux, char *psz_path, vlc_bool_t b_quick ) );
VLC_EXPORT( access_t *, access2_FilterNew, ( access_t *p_source, char *psz_access_filter ) );
VLC_EXPORT( void, access2_Delete, ( access_t * ) );
static inline int access2_vaControl( access_t *p_access, int i_query, va_list args )
......
......@@ -101,6 +101,10 @@
"Common settings you may want to alter are HTTP proxy or " \
"caching settings." )
#define ACCESS_FILTER_TITLE N_( "Access filter modules" )
#define ACCESS_FILTER_HELP N_( \
"Settings related to the various access filter used by VLC.\n" )
#define DEMUX_TITLE N_("Demuxers")
#define DEMUX_HELP N_( "Demuxers are used to separate audio and video streams" )
......@@ -297,6 +301,7 @@ static struct config_category_t categories_array[] =
{ CAT_INPUT, INPUT_TITLE, INPUT_HELP },
{ SUBCAT_INPUT_ACCESS, ACCESS_TITLE, ACCESS_HELP },
{ SUBCAT_INPUT_ACCESS_FILTER, ACCESS_FILTER_TITLE, ACCESS_FILTER_HELP },
{ SUBCAT_INPUT_DEMUX, DEMUX_TITLE, DEMUX_HELP },
{ SUBCAT_INPUT_VCODEC, VDEC_TITLE, VDEC_HELP },
{ SUBCAT_INPUT_ACODEC, ADEC_TITLE, ADEC_HELP },
......
SOURCES_access_filter_timeshift = timeshift.c
This diff is collapsed.
......@@ -1482,8 +1482,8 @@ static vlc_bool_t GatherPES( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk )
else if( i_diff != 0 )
{
/* FIXME what to do when discontinuity_indicator is set ? */
msg_Warn( p_demux, "discontinuity received 0x%x instead of 0x%x",
i_cc, ( pid->i_cc + 1 )&0x0f );
msg_Warn( p_demux, "discontinuity received 0x%x instead of 0x%x (pid=%d)",
i_cc, ( pid->i_cc + 1 )&0x0f, pid->i_pid );
pid->i_cc = i_cc;
......
......@@ -1456,7 +1456,7 @@ static block_t *TSNew( sout_mux_t *p_mux, ts_stream_t *p_stream,
p_ts->p_buffer[7] = ( 0 )&0xff;
p_ts->p_buffer[8] = ( 0 )&0xff;
p_ts->p_buffer[9] = ( 0 )&0xff;
p_ts->p_buffer[10]= ( 0 )&0x80;
p_ts->p_buffer[10]= ( ( 0 )&0x80 ) | 0x7e;
p_ts->p_buffer[11]= 0;
for( i = 12; i < 12 + i_stuffing; i++ )
......
......@@ -28,11 +28,12 @@
#include "input_internal.h"
/*****************************************************************************
* access2_New:
* access2_InternalNew:
*****************************************************************************/
access_t *__access2_New( vlc_object_t *p_obj,
char *psz_access, char *psz_demux, char *psz_path,
vlc_bool_t b_quick )
static access_t *access2_InternalNew( vlc_object_t *p_obj,
char *psz_access, char *psz_demux, char *psz_path,
access_t *p_source,
vlc_bool_t b_quick )
{
access_t *p_access = vlc_object_create( p_obj, VLC_OBJECT_ACCESS );
......@@ -43,13 +44,21 @@ access_t *__access2_New( vlc_object_t *p_obj,
}
/* Parse URL */
p_access->psz_access = b_quick ? strdup( "file" ) : strdup( psz_access );
p_access->psz_path = strdup( psz_path );
p_access->psz_demux = strdup( "" );
if( !b_quick )
p_access->p_source = p_source;
if( p_source )
{
msg_Dbg( p_obj, "creating access filter '%s'", psz_access );
p_access->psz_access = strdup( p_source->psz_access );
p_access->psz_path = strdup( p_source->psz_path );
}
else if( !b_quick )
{
msg_Dbg( p_obj, "creating access '%s' path='%s'",
p_access->psz_access, p_access->psz_path );
psz_access, psz_path );
p_access->psz_access = b_quick ? strdup( "file" ) : strdup( psz_access );
p_access->psz_path = strdup( psz_path );
}
p_access->psz_demux = strdup( "" );
p_access->pf_read = NULL;
p_access->pf_block = NULL;
......@@ -67,9 +76,17 @@ access_t *__access2_New( vlc_object_t *p_obj,
/* Before module_Need (for var_Create...) */
vlc_object_attach( p_access, p_obj );
p_access->p_module =
module_Need( p_access, "access2", p_access->psz_access,
b_quick ? VLC_TRUE : VLC_FALSE );
if( p_source )
{
p_access->p_module =
module_Need( p_access, "access_filter", psz_access, VLC_FALSE );
}
else
{
p_access->p_module =
module_Need( p_access, "access2",p_access->psz_access,
b_quick ? VLC_TRUE : VLC_FALSE );
}
if( p_access->p_module == NULL )
{
......@@ -85,7 +102,27 @@ access_t *__access2_New( vlc_object_t *p_obj,
}
/*****************************************************************************
* demux2_Delete:
* access2_New:
*****************************************************************************/
access_t *__access2_New( vlc_object_t *p_obj,
char *psz_access, char *psz_demux, char *psz_path,
vlc_bool_t b_quick )
{
return access2_InternalNew( p_obj, psz_access, psz_demux, psz_path, NULL, b_quick );
}
/*****************************************************************************
* access2_FilterNew:
*****************************************************************************/
access_t *access2_FilterNew( access_t *p_source, char *psz_access_filter )
{
return access2_InternalNew( VLC_OBJECT(p_source),
psz_access_filter, NULL, NULL,
p_source, VLC_FALSE );
}
/*****************************************************************************
* access2_Delete:
*****************************************************************************/
void access2_Delete( access_t *p_access )
{
......@@ -96,5 +133,11 @@ void access2_Delete( access_t *p_access )
free( p_access->psz_path );
free( p_access->psz_demux );
if( p_access->p_source )
{
access2_Delete( p_access->p_source );
}
vlc_object_destroy( p_access );
}
......@@ -1912,6 +1912,7 @@ static int InputSourceInit( input_thread_t *p_input,
char *psz_access;
char *psz_demux;
char *psz_path;
char *psz;
vlc_value_t val;
/* Split uri */
......@@ -2021,6 +2022,23 @@ static int InputSourceInit( input_thread_t *p_input,
goto error;
}
/* */
psz = var_GetString( p_input, "access-filter" );
if( *psz )
{
access_t *p_access = in->p_access;
/* TODO support chained access-filter */
in->p_access = access2_FilterNew( in->p_access, psz );
if( in->p_access == NULL )
{
in->p_access = p_access;
msg_Warn( p_input, "failed to insert access filter %s",
psz );
}
}
free( psz );
/* Get infos from access */
if( !b_quick )
{
......
......@@ -439,6 +439,9 @@ void input_ConfigVarInit ( input_thread_t *p_input )
var_Create( p_input, "input-slave", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
/* */
var_Create( p_input, "access-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
/* Meta */
var_Create( p_input, "meta-title", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "meta-author", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
......
......@@ -663,6 +663,10 @@ static char *ppsz_clock_descriptions[] =
#define ACCESS_LONGTEXT N_( \
"This is a legacy entry to let you configure access modules.")
#define ACCESS_FILTER_TEXT N_("Access filter module")
#define ACCESS_FILTER_LONGTEXT N_( \
"This is a legacy entry to let you configure access filter modules.")
#define DEMUX_TEXT N_("Demux module")
#define DEMUX_LONGTEXT N_( \
"This is a legacy entry to let you configure demux modules.")
......@@ -1012,6 +1016,12 @@ vlc_module_begin();
add_category_hint( N_("Input"), INPUT_CAT_LONGTEXT , VLC_FALSE );
add_module( "access", "access2", NULL, NULL, ACCESS_TEXT,
ACCESS_LONGTEXT, VLC_TRUE );
set_subcategory( SUBCAT_INPUT_ACCESS_FILTER );
add_module_list_cat( "access-filter", SUBCAT_INPUT_ACCESS_FILTER, NULL, NULL,
ACCESS_FILTER_TEXT, ACCESS_FILTER_LONGTEXT, VLC_FALSE );
set_subcategory( SUBCAT_INPUT_DEMUX );
add_module( "demux", "demux2", NULL, NULL, DEMUX_TEXT,
DEMUX_LONGTEXT, VLC_TRUE );
......
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