ACCESS_GET_EOF/SIZE/POS, prepared title/seekpoint support).
/*****************************************************************************
* ninput.h
*****************************************************************************
- * Copyright (C) 1999-2001 VideoLAN
+ * Copyright (C) 1999-2004 VideoLAN
* $Id$
*
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
#include "vlc_es.h"
+/* Seek point */
+struct seekpoint_t
+{
+ int64_t i_byte_offset;
+ int64_t i_time_offset;
+ char *psz_name;
+};
+
+static inline seekpoint_t *vlc_seekpoint_New( void )
+{
+ seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) );
+ point->i_byte_offset =
+ point->i_time_offset = 0;
+ point->psz_name = NULL;
+ return point;
+}
+
+static inline void vlc_seekpoint_Delete( seekpoint_t *point )
+{
+ if( !point ) return;
+ if( point->psz_name ) free( point->psz_name );
+ free( point );
+}
+
+static inline seekpoint_t *vlc_seekpoint_Duplicate( seekpoint_t *src )
+{
+ seekpoint_t *point = vlc_seekpoint_New();
+ if( src->psz_name ) point->psz_name = strdup( src->psz_name );
+ point->i_time_offset = src->i_time_offset;
+ point->i_byte_offset = src->i_byte_offset;
+ return point;
+}
+
+typedef struct
+{
+ vlc_bool_t b_menu; /* Is it a menu or a normal entry */
+ int64_t i_length; /* length if known, else 0 */
+ int i_seekpoints;/* How many seekpoint, (0/1 has same meaning)*/
+
+ char *psz_name;
+} input_title_t;
+
+static inline input_title_t *vlc_input_title_New( )
+{
+ input_title_t *t = (input_title_t*)malloc( sizeof( input_title_t ) );
+
+ t->b_menu = VLC_FALSE;
+ t->i_length = 0;
+ t->i_seekpoints = 0;
+ t->psz_name = NULL;
+
+ return t;
+}
+static inline void vlc_input_title_Delete( input_title_t *t )
+{
+ if( t )
+ {
+ if( t->psz_name ) free( t->psz_name );
+ free( t );
+ }
+}
+
+static inline input_title_t *vlc_input_title_Duplicate( input_title_t *t )
+{
+ input_title_t *dup = vlc_input_title_New( );
+
+ dup->b_menu = t->b_menu;
+ dup->i_length = t->i_length;
+ dup->i_seekpoints= t->i_seekpoints;
+ if( t->psz_name ) dup->psz_name = strdup( t->psz_name );
+
+ return dup;
+}
+
+/**
+ * \defgroup es out Es Out
+ * @{
+ */
+
enum es_out_mode_e
{
ES_OUT_MODE_NONE, /* don't select anything */
ES_OUT_SET_PCR, /* arg1=int64_t i_pcr(microsecond!) (using default group 0)*/
ES_OUT_SET_GROUP_PCR, /* arg1= int i_group, arg2=int64_t i_pcr(microsecond!)*/
ES_OUT_RESET_PCR, /* no arg */
-
- /* ByBass automatic stream timestamp to absolute timestamp using pcr (and disable the automatic mode XXX:for all groups) */
- ES_OUT_CONVERT_TIMESTAMP, /* arg1=int64_t *pi_ts(microsecond!) */
- ES_OUT_CONVERT_GROUP_TIMESTAMP, /* arg1=int i_group, arg2=int64_t *pi_ts(microsecond!)*/
-
};
struct es_out_t
va_end( args );
return i_result;
}
+
+/**
+ * @}
+ */
+
+/* i_update field of access_t/demux_t */
+#define INPUT_UPDATE_NONE 0x0000
+#define INPUT_UPDATE_SIZE 0x0001
+#define INPUT_UPDATE_TITLE 0x0010
+#define INPUT_UPDATE_SEEKPOINT 0x0020
+
/**
* \defgroup access Access
* @{
ACCESS_CAN_CONTROL_PACE,/* arg1= vlc_bool_t* cannot fail */
/* */
- ACCESS_GET_MTU, /* arg1= int* cannot fail (0 if no sense) */
- ACCESS_GET_SIZE, /* arg1= int64_t* cannot fail (0 if unknown) */
- ACCESS_GET_POS, /* arg1= int64_t* cannot fail */
- ACCESS_GET_EOF, /* arg1= vlc_bool_t* cannot fail */
+ ACCESS_GET_MTU, /* arg1= int* cannot fail(0 if no sense)*/
ACCESS_GET_PTS_DELAY, /* arg1= int64_t* cannot fail */
+ /* */
+ ACCESS_GET_TITLE_INFO, /* arg1=input_title_t*** arg2=int* can fail */
+ ACCESS_GET_SEEKPOINT_INFO, /* arg1=seekpoint_t *** arg2=int* can fail */
/* */
- ACCESS_SET_PAUSE_STATE /* arg1= vlc_bool_t can fail if unsuported */
+ ACCESS_SET_PAUSE_STATE, /* arg1= vlc_bool_t can fail */
+
+ /* */
+ ACCESS_SET_TITLE, /* arg1= int can fail */
+ ACCESS_SET_SEEKPOINT, /* arg1= int can fail */
};
struct access_t
int (*pf_seek) ( access_t *, int64_t ); /* can be null if can't seek */
int (*pf_control)( access_t *, int i_query, va_list args); /* mandatory */
+
+ /* access has to maintain them uptodate */
+ struct
+ {
+ unsigned int i_update; /* Access sets them on change,
+ Input removes them once take into account*/
+
+ int64_t i_size; /* Write only for access, read only for input */
+ int64_t i_pos; /* idem */
+ vlc_bool_t b_eof; /* idem */
+
+ int i_title; /* idem, start from 0 (could be menu) */
+ int i_seekpoint;/* idem, start from 0 */
+ } info;
access_sys_t *p_sys;
};
/* set by demuxer */
int (*pf_demux) ( demux_t * ); /* demux one frame only */
int (*pf_control)( demux_t *, int i_query, va_list args);
+
+ /* Demux has to maintain them uptodate
+ * when it is responsible of seekpoint/title*/
+ struct
+ {
+ unsigned int i_update; /* Demux sets them on change,
+ Input removes them once take into account*/
+ /* Seekpoint/Title at demux level */
+ int i_title; /* idem, start from 0 (could be menu) */
+ int i_seekpoint; /* idem, start from 0 */
+ } info;
demux_sys_t *p_sys;
};
DEMUX_GET_POSITION, /* arg1= double * res= */
DEMUX_SET_POSITION, /* arg1= double res=can fail */
+ DEMUX_GET_LENGTH, /* arg1= int64_t * res= */
DEMUX_GET_TIME, /* arg1= int64_t * res= */
DEMUX_SET_TIME, /* arg1= int64_t res=can fail */
- DEMUX_GET_LENGTH, /* arg1= int64_t * res=can fail */
-
DEMUX_GET_FPS, /* arg1= float * res=can fail */
- DEMUX_GET_META /* arg1= vlc_meta_t ** res=can fail */
-};
+ DEMUX_GET_META, /* arg1= vlc_meta_t ** res=can fail */
-struct seekpoint_t
-{
- int64_t i_byte_offset;
- int64_t i_time_offset;
- char *psz_name;
-};
-
-static inline seekpoint_t *vlc_seekpoint_New( void )
-{
- seekpoint_t *point = (seekpoint_t*)malloc( sizeof( seekpoint_t ) );
- point->i_byte_offset = point->i_time_offset;
- point->psz_name = NULL;
- return point;
-}
-
-static inline void vlc_seekpoint_Delete( seekpoint_t *point )
-{
- if( !point ) return;
- if( point->psz_name ) free( point->psz_name );
- free( point );
-}
+ DEMUX_GET_TITLE_INFO, /* arg1=input_title_t*** arg2=int* can fail */
+ DEMUX_GET_SEEKPOINT_INFO, /* arg1=seekpoint_t *** arg2=int* can fail */
-static inline seekpoint_t *vlc_seekpoint_Duplicate( seekpoint_t *src )
-{
- seekpoint_t *point = vlc_seekpoint_New();
- if( src->psz_name ) point->psz_name = strdup( src->psz_name );
- point->i_time_offset = src->i_time_offset;
- point->i_byte_offset = src->i_byte_offset;
- return point;
-}
+ DEMUX_SET_TITLE, /* arg1= int can fail */
+ DEMUX_SET_SEEKPOINT, /* arg1= int can fail */
+};
/* Demux */
VLC_EXPORT( int, demux_vaControl, ( input_thread_t *, int i_query, va_list ) );
int fd_cmd;
int fd_data;
-
- int64_t i_size;
-
- int64_t i_tell;
-
- vlc_bool_t b_eof;
};
static int ftp_SendCommand( access_t *, char *, ... );
int i_answer;
char *psz_arg;
- /* *** allocate access_sys_t *** */
- p_sys = malloc( sizeof( access_sys_t ) );
+ /* Init p_access */
+ p_access->pf_read = Read;
+ p_access->pf_block = NULL;
+ p_access->pf_seek = Seek;
+ p_access->pf_control = Control;
+ p_access->info.i_update = 0;
+ p_access->info.i_size = 0;
+ p_access->info.i_pos = 0;
+ p_access->info.b_eof = VLC_FALSE;
+ p_access->info.i_title = 0;
+ p_access->info.i_seekpoint = 0;
+ p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
memset( p_sys, 0, sizeof( access_sys_t ) );
p_sys->fd_cmd = -1;
p_sys->fd_data = -1;
- p_sys->i_tell = 0;
/* *** Parse URL and get server addr/port and path *** */
psz = p_access->psz_path;
goto exit_error;
}
- /* set p_access->p_sys */
- p_access->p_sys = p_sys;
-
for( ;; )
{
if( ftp_ReadCommand( p_access, &i_answer, NULL ) != 1 )
msg_Err( p_access, "cannot get file size" );
goto exit_error;
}
- p_sys->i_size = atoll( &psz_arg[4] );
+ p_access->info.i_size = atoll( &psz_arg[4] );
free( psz_arg );
- msg_Dbg( p_access, "file size: "I64Fd, p_sys->i_size );
+ msg_Dbg( p_access, "file size: "I64Fd, p_access->info.i_size );
/* Start the 'stream' */
if( ftp_StartStream( p_access, 0 ) < 0 )
/* Update default_pts to a suitable value for ftp access */
var_Create( p_access, "ftp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- /* *** set exported functions *** */
- p_access->pf_read = Read;
- p_access->pf_block = NULL;
- p_access->pf_seek = Seek;
- p_access->pf_control = Control;
return VLC_SUCCESS;
exit_error:
*****************************************************************************/
static int Seek( access_t *p_access, int64_t i_pos )
{
- access_sys_t *p_sys = p_access->p_sys;
if( i_pos < 0 )
{
return VLC_EGENERIC;
ftp_StopStream( p_access );
if( ftp_StartStream( p_access, i_pos ) < 0 )
{
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
return VLC_EGENERIC;
}
- p_sys->i_tell = i_pos;
+ p_access->info.b_eof = VLC_FALSE;
+ p_access->info.i_pos = i_pos;
return VLC_SUCCESS;
}
access_sys_t *p_sys = p_access->p_sys;
int i_read;
- if( p_sys->b_eof )
+ if( p_access->info.b_eof )
return 0;
i_read = net_Read( p_access, p_sys->fd_data, p_buffer, i_len, VLC_FALSE );
if( i_read == 0 )
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
else if( i_read > 0 )
- p_sys->i_tell += i_read;
+ p_access->info.i_pos += i_read;
return i_read;
}
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
- access_sys_t *p_sys = p_access->p_sys;
vlc_bool_t *pb_bool;
int *pi_int;
int64_t *pi_64;
pi_int = (int*)va_arg( args, int * );
*pi_int = 0;
break;
- case ACCESS_GET_SIZE:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = p_sys->i_size > 0 ? p_sys->i_size : 0;
- break;
- case ACCESS_GET_POS:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = p_sys->i_tell;
- break;
- case ACCESS_GET_EOF:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = p_sys->b_eof;
- break;
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
/* Nothing to do */
break;
+ case ACCESS_GET_TITLE_INFO:
+ case ACCESS_GET_SEEKPOINT_INFO:
+ case ACCESS_SET_TITLE:
+ case ACCESS_SET_SEEKPOINT:
+ return VLC_EGENERIC;
+
default:
msg_Err( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
vlc_bool_t b_chunked;
int64_t i_chunk;
- int64_t i_tell;
- int64_t i_size;
vlc_bool_t b_seekable;
- vlc_bool_t b_eof;
};
/* */
access_sys_t *p_sys;
vlc_value_t val;
- /* Create private struct */
- p_sys = malloc( sizeof( access_sys_t ) );
- memset( p_sys, 0, sizeof( access_sys_t ) );
- p_sys->fd = -1;
- p_sys->b_proxy = VLC_FALSE;
- p_sys->i_version = 1;
- p_sys->b_seekable = VLC_TRUE;
- p_sys->psz_mime = NULL;
- p_sys->psz_location = NULL;
- p_sys->psz_user_agent = NULL;
- p_sys->b_eof = VLC_FALSE;
-
/* First set ipv4/ipv6 */
var_Create( p_access, "ipv4", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_access, "ipv6", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
}
}
- /* Pts delay */
- var_Create( p_access, "http-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+ /* Set up p_access */
+ p_access->pf_read = Read;
+ p_access->pf_block = NULL;
+ p_access->pf_control = Control;
+ p_access->pf_seek = Seek;
+ p_access->info.i_update = 0;
+ p_access->info.i_size = 0;
+ p_access->info.i_pos = 0;
+ p_access->info.b_eof = VLC_FALSE;
+ p_access->info.i_title = 0;
+ p_access->info.i_seekpoint = 0;
+ p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
+ memset( p_sys, 0, sizeof( access_sys_t ) );
+ p_sys->fd = -1;
+ p_sys->b_proxy = VLC_FALSE;
+ p_sys->i_version = 1;
+ p_sys->b_seekable = VLC_TRUE;
+ p_sys->psz_mime = NULL;
+ p_sys->psz_location = NULL;
+ p_sys->psz_user_agent = NULL;
+
/* Parse URI */
ParseURL( p_sys, p_access->psz_path );
}
/* Connect */
- p_access->p_sys = p_sys;
if( Connect( p_access, 0 ) )
{
/* Retry with http 1.0 */
p_playlist->i_index + 1 );
vlc_object_release( p_playlist );
- p_sys->i_size = 0; /* Force to stop reading */
+ p_access->info.i_size = 0; /* Force to stop reading */
}
- /* Set up p_access */
- p_access->pf_read = Read;
- p_access->pf_block = NULL;
- p_access->pf_control = Control;
- p_access->pf_seek = Seek;
- p_access->p_sys = p_sys;
if( !strcmp( p_sys->psz_protocol, "ICY" ) )
{
if( p_sys->psz_mime && !strcasecmp( p_sys->psz_mime, "video/nsv" ) )
msg_Info( p_access, "ICY server found, %s demuxer selected",
p_access->psz_demux );
}
+
+ /* Pts delay */
+ var_Create( p_access, "http-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
+
return VLC_SUCCESS;
error:
if( p_sys->fd < 0 )
{
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
return 0;
}
- if( p_sys->i_size > 0 && i_len + p_sys->i_tell > p_sys->i_size )
+ if( p_access->info.i_size > 0 &&
+ i_len + p_access->info.i_pos > p_access->info.i_size )
{
- if( ( i_len = p_sys->i_size - p_sys->i_tell ) == 0 )
+ if( ( i_len = p_access->info.i_size - p_access->info.i_pos ) == 0 )
{
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
return 0;
}
}
{
if( p_sys->i_chunk < 0 )
{
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
return 0;
}
if( p_sys->i_chunk <= 0 ) /* eof */
{
p_sys->i_chunk = -1;
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
return 0;
}
}
i_read = net_Read( p_access, p_sys->fd, p_buffer, i_len, VLC_FALSE );
if( i_read > 0 )
{
- p_sys->i_tell += i_read;
+ p_access->info.i_pos += i_read;
if( p_sys->b_chunked )
{
}
else if( i_read == 0 )
{
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
}
return i_read;
}
if( Connect( p_access, i_pos ) )
{
msg_Err( p_access, "seek failed" );
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
return VLC_EGENERIC;
}
return VLC_SUCCESS;
pi_int = (int*)va_arg( args, int * );
*pi_int = 0;
break;
- case ACCESS_GET_SIZE:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = p_sys->i_size > 0 ? p_sys->i_size : 0;
- break;
- case ACCESS_GET_POS:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = p_sys->i_tell;
- break;
- case ACCESS_GET_EOF:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = p_sys->b_eof;
- break;
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
/* */
case ACCESS_SET_PAUSE_STATE:
- /* Nothing to do */
break;
+ case ACCESS_GET_TITLE_INFO:
+ case ACCESS_GET_SEEKPOINT_INFO:
+ case ACCESS_SET_TITLE:
+ case ACCESS_SET_SEEKPOINT:
+ return VLC_EGENERIC;
+
default:
msg_Err( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
p_sys->psz_mime = NULL;
p_sys->b_chunked = VLC_FALSE;
p_sys->i_chunk = 0;
- p_sys->i_size = -1;
- p_sys->i_tell = i_tell;
+
+ p_access->info.i_size = 0;
+ p_access->info.i_pos = i_tell;
+ p_access->info.b_eof = VLC_FALSE;
/* Open connection */
if( !strcasecmp( psz, "Content-Length" ) )
{
- p_sys->i_size = i_tell + atoll( p );
- msg_Dbg( p_access, "stream size="I64Fd, p_sys->i_size );
+ p_access->info.i_size = i_tell + atoll( p );
+ msg_Dbg( p_access, "stream size="I64Fd, p_access->info.i_size );
}
else if( !strcasecmp( psz, "Location" ) )
{
* 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#include <sys/ioctl.h>
#include "videodev2.h"
-/* ivtv specific ioctls */
-#define IVTV_IOC_G_CODEC 0xFFEE7703
-#define IVTV_IOC_S_CODEC 0xFFEE7704
-
-
-/* for use with IVTV_IOC_G_CODEC and IVTV_IOC_S_CODEC */
-
-struct ivtv_ioctl_codec {
- uint32_t aspect;
- uint32_t audio_bitmask;
- uint32_t bframes;
- uint32_t bitrate_mode;
- uint32_t bitrate;
- uint32_t bitrate_peak;
- uint32_t dnr_mode;
- uint32_t dnr_spatial;
- uint32_t dnr_temporal;
- uint32_t dnr_type;
- uint32_t framerate;
- uint32_t framespergop;
- uint32_t gop_closure;
- uint32_t pulldown;
- uint32_t stream_type;
-};
-
-/*****************************************************************************
- * Prototypes
- *****************************************************************************/
-static int Open ( vlc_object_t * );
-static void Close ( vlc_object_t * );
-
-static int Read ( access_t *, uint8_t *, int );
-static int Control ( access_t *, int, va_list );
-
/*****************************************************************************
* Module descriptor
*****************************************************************************/
+static int Open ( vlc_object_t * );
+static void Close( vlc_object_t * );
#define DEVICE_TEXT N_( "Device" )
#define DEVICE_LONGTEXT N_( "PVR video device" )
#define NORM_TEXT N_( "Norm" )
#define NORM_LONGTEXT N_( "Defines the norm of the stream (Automatic, SECAM, PAL, or NTSC)" )
-static int i_norm_list[] = { V4L2_STD_UNKNOWN, V4L2_STD_SECAM, V4L2_STD_PAL,
+static int i_norm_list[] = { V4L2_STD_UNKNOWN, V4L2_STD_SECAM, V4L2_STD_PAL,
V4L2_STD_NTSC };
static char *psz_norm_list_text[] = { N_("Automatic"), N_("SECAM"),
N_("PAL"), N_("NSTC") };
"autodetect)" )
#define FREQUENCY_TEXT N_( "Frequency" )
#define FREQUENCY_LONGTEXT N_( "Frequency to capture (in kHz), if applicable" )
-#define FRAMERATE_TEXT N_( "Framerate" )
+#define FRAMERATE_TEXT N_( "Framerate" )
#define FRAMERATE_LONGTEXT N_( "Framerate to capture, if applicable (-1 for " \
"auto" )
#define KEYINT_TEXT N_( "Key interval" )
#define BFRAMES_LONGTEXT N_("If this option is set, B-Frames will be used." \
"Use this option to set the number of B-Frames")
#define BITRATE_TEXT N_( "Bitrate" )
-#define BITRATE_LONGTEXT N_( "Bitrate to use (-1 for default)" )
+#define BITRATE_LONGTEXT N_( "Bitrate to use (-1 for default)" )
#define BITRATE_PEAK_TEXT N_( "Bitrate peak" )
#define BITRATE_PEAK_LONGTEXT N_( "Peak bitrate in VBR mode" )
#define BITRATE_MODE_TEXT N_( "Bitrate mode (vbr or cbr)" )
#define BITRATE_MODE_LONGTEXT N_( "Bitrate mode to use" )
#define BITMASK_TEXT N_( "Audio bitmask" )
-#define BITMASK_LONGTEXT N_("FIXME FIXME FIXME FIXME" )
+#define BITMASK_LONGTEXT N_("FIXME FIXME FIXME FIXME" )
#define CHAN_TEXT N_( "Channel" )
#define CHAN_LONGTEXT N_( "Channel of the card to use (Usually, 0 = tuner, " \
"1 = composite, 2 = svideo )" )
NORM_LONGTEXT, VLC_FALSE );
change_integer_list( i_norm_list, psz_norm_list_text, 0 );
- add_integer( "pvr-width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE );
+ add_integer( "pvr-width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE );
add_integer( "pvr-height", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT,
- VLC_TRUE );
+ VLC_TRUE );
add_integer( "pvr-frequency", -1, NULL, FREQUENCY_TEXT, FREQUENCY_LONGTEXT,
- VLC_FALSE );
+ VLC_FALSE );
add_integer( "pvr-framerate", -1, NULL, FRAMERATE_TEXT, FRAMERATE_LONGTEXT,
- VLC_TRUE );
+ VLC_TRUE );
add_integer( "pvr-keyint", -1, NULL, KEYINT_TEXT, KEYINT_LONGTEXT,
- VLC_TRUE );
+ VLC_TRUE );
add_integer( "pvr-bframes", -1, NULL, FRAMERATE_TEXT, FRAMERATE_LONGTEXT,
- VLC_TRUE );
+ VLC_TRUE );
add_integer( "pvr-bitrate", -1, NULL, BITRATE_TEXT, BITRATE_LONGTEXT,
- VLC_FALSE );
- add_integer( "pvr-bitrate-peak", -1, NULL, BITRATE_PEAK_TEXT,
- BITRATE_PEAK_LONGTEXT, VLC_TRUE );
- add_integer( "pvr-bitrate-mode", -1, NULL, BITRATE_MODE_TEXT,
- BITRATE_MODE_LONGTEXT, VLC_TRUE );
+ VLC_FALSE );
+ add_integer( "pvr-bitrate-peak", -1, NULL, BITRATE_PEAK_TEXT,
+ BITRATE_PEAK_LONGTEXT, VLC_TRUE );
+ add_integer( "pvr-bitrate-mode", -1, NULL, BITRATE_MODE_TEXT,
+ BITRATE_MODE_LONGTEXT, VLC_TRUE );
change_integer_list( i_bitrates, psz_bitrates_list_text, 0 );
add_integer( "pvr-audio-bitmask", -1, NULL, BITMASK_TEXT,
BITMASK_LONGTEXT, VLC_TRUE );
set_callbacks( Open, Close );
vlc_module_end();
- vlc_bool_t b_eof;
-
+
/*****************************************************************************
- * Private access data
+ * Prototypes
*****************************************************************************/
+static int Read ( access_t *, uint8_t *, int );
+static int Control( access_t *, int, va_list );
+
+/* ivtv specific ioctls */
+#define IVTV_IOC_G_CODEC 0xFFEE7703
+#define IVTV_IOC_S_CODEC 0xFFEE7704
+
+/* for use with IVTV_IOC_G_CODEC and IVTV_IOC_S_CODEC */
+
+struct ivtv_ioctl_codec {
+ uint32_t aspect;
+ uint32_t audio_bitmask;
+ uint32_t bframes;
+ uint32_t bitrate_mode;
+ uint32_t bitrate;
+ uint32_t bitrate_peak;
+ uint32_t dnr_mode;
+ uint32_t dnr_spatial;
+ uint32_t dnr_temporal;
+ uint32_t dnr_type;
+ uint32_t framerate;
+ uint32_t framespergop;
+ uint32_t gop_closure;
+ uint32_t pulldown;
+ uint32_t stream_type;
+};
+
struct access_sys_t
{
/* file descriptor */
int i_fd;
- int64_t i_tell; /** Number of read bytes */
- vlc_bool_t b_eof;
-
/* options */
int i_standard;
int i_width;
p_access->pf_block = NULL;
p_access->pf_seek = NULL;
p_access->pf_control = Control;
+ p_access->info.i_update = 0;
+ p_access->info.i_size = 0;
+ p_access->info.i_pos = 0;
+ p_access->info.b_eof = VLC_FALSE;
+ p_access->info.i_title = 0;
+ p_access->info.i_seekpoint = 0;
/* create private access data */
p_sys = calloc( sizeof( access_sys_t ), 1 );
var_Get( p_access, "pvr-channel" , &val);
p_sys->i_input = val.i_int;
-
- p_sys->i_tell = 0;
-
/* parse command line options */
psz_tofree = strdup( p_access->psz_path );
psz_parser = psz_tofree;
access_sys_t * p_sys = p_access->p_sys;
int i_ret;
-
+
struct timeval timeout;
fd_set fds;
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
- if( p_sys->b_eof )
+ if( p_access->info.b_eof )
return 0;
- while( !( i_ret = select( p_sys->i_fd + 1, &fds,
- NULL, NULL, &timeout ) ) )
+ while( !( i_ret = select( p_sys->i_fd + 1, &fds, NULL, NULL, &timeout) ) )
{
FD_ZERO( &fds );
FD_SET( p_sys->i_fd, &fds );
i_ret = read( p_sys->i_fd, p_buffer, i_len );
if( i_ret == 0 )
{
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
}
- else if ( i_ret > 0 )
+ else if( i_ret > 0 )
{
- p_sys->i_tell += i_ret;
+ p_access->info.i_pos += i_ret;
}
return i_ret;
pi_int = (int*)va_arg( args, int * );
*pi_int = 0;
break;
- case ACCESS_GET_SIZE:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = 0;
- break;
- case ACCESS_GET_POS:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = p_sys->i_tell;
- break;
- case ACCESS_GET_EOF:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = p_sys->b_eof;
- break;
+
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = 1000000;
/* Nothing to do */
break;
+ case ACCESS_GET_TITLE_INFO:
+ case ACCESS_GET_SEEKPOINT_INFO:
+ case ACCESS_SET_TITLE:
+ case ACCESS_SET_SEEKPOINT:
+ return VLC_EGENERIC;
+
default:
msg_Err( p_access, "unimplemented query in control" );
return VLC_EGENERIC;
struct access_sys_t
{
int fd;
- int64_t i_tell;
- vlc_bool_t b_eof;
};
return VLC_EGENERIC;
}
- /* Connect */
+ /* Init p_access */
+ p_access->pf_read = Read;
+ p_access->pf_block = NULL;
+ p_access->pf_control = Control;
+ p_access->pf_seek = NULL;
+ p_access->info.i_update = 0;
+ p_access->info.i_size = 0;
+ p_access->info.i_pos = 0;
+ p_access->info.b_eof = VLC_FALSE;
+ p_access->info.i_title = 0;
+ p_access->info.i_seekpoint = 0;
p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
+
p_sys->fd = net_OpenTCP( p_access, psz_dup, atoi( psz_parser ) );
- p_sys->i_tell = 0;
- p_sys->b_eof = VLC_FALSE;
free( psz_dup );
if( p_sys->fd < 0 )
return VLC_EGENERIC;
}
- p_access->pf_read = Read;
- p_access->pf_block = NULL;
- p_access->pf_seek = NULL;
- p_access->pf_control = Control;
-
/* Update default_pts to a suitable value for udp access */
var_Create( p_access, "tcp-caching", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
access_sys_t *p_sys = p_access->p_sys;
int i_read;
- if( p_sys->b_eof )
+ if( p_access->info.b_eof )
return 0;
i_read = net_Read( p_access, p_sys->fd, p_buffer, i_len, VLC_FALSE );
if( i_read == 0 )
- p_sys->b_eof = VLC_TRUE;
+ p_access->info.b_eof = VLC_TRUE;
else if( i_read > 0 )
- p_sys->i_tell += i_read;
+ p_access->info.i_pos += i_read;
return i_read;
}
*****************************************************************************/
static int Control( access_t *p_access, int i_query, va_list args )
{
- access_sys_t *p_sys = p_access->p_sys;
vlc_bool_t *pb_bool;
int *pi_int;
int64_t *pi_64;
pi_int = (int*)va_arg( args, int * );
*pi_int = 0;
break;
- case ACCESS_GET_SIZE:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = 0;
- break;
- case ACCESS_GET_POS:
- pi_64 = (int64_t*)va_arg( args, int64_t * );
- *pi_64 = p_sys->i_tell;
- break;
- case ACCESS_GET_EOF:
- pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
- *pb_bool = p_sys->b_eof;
- break;
case ACCESS_GET_PTS_DELAY:
pi_64 = (int64_t*)va_arg( args, int64_t * );
/* Nothing to do */
break;
+ case ACCESS_GET_TITLE_INFO:
+ case ACCESS_GET_SEEKPOINT_INFO:
+ case ACCESS_SET_TITLE:
+ case ACCESS_SET_SEEKPOINT:
+ return VLC_EGENERIC;
+
default:
msg_Err( p_access, "unimplemented query in control" );
return VLC_EGENERIC;