#endif
#include <vlc/vlc.h>
+#include <vlc_plugin.h>
#include <ctype.h>
#include <vlc_meta.h>
#include <vlc_epg.h>
-#include "iso_lang.h"
+#include <vlc_iso_lang.h>
#include <vlc_network.h>
#include <vlc_charset.h>
"Specify the size of the buffer here and not the number of packets." )
vlc_module_begin();
- set_description( _("MPEG Transport Stream demuxer") );
+ set_description( N_("MPEG Transport Stream demuxer") );
set_shortname ( "MPEG-TS" );
set_category( CAT_INPUT );
set_subcategory( SUBCAT_INPUT_DEMUX );
add_integer( "ts-dump-size", 16384, NULL, DUMPSIZE_TEXT,
DUMPSIZE_LONGTEXT, true );
- set_capability( "demux2", 10 );
+ set_capability( "demux", 10 );
set_callbacks( Open, Close );
add_shortcut( "ts" );
vlc_module_end();
{
uint8_t i_objectTypeIndication;
uint8_t i_streamType;
- bool b_upStream;
+ bool b_upStream;
uint32_t i_bufferSizeDB;
uint32_t i_maxBitrate;
uint32_t i_avgBitrate;
typedef struct
{
- bool b_useAccessUnitStartFlag;
- bool b_useAccessUnitEndFlag;
- bool b_useRandomAccessPointFlag;
- bool b_useRandomAccessUnitsOnlyFlag;
- bool b_usePaddingFlag;
- bool b_useTimeStampsFlags;
- bool b_useIdleFlag;
- bool b_durationFlag;
+ bool b_useAccessUnitStartFlag;
+ bool b_useAccessUnitEndFlag;
+ bool b_useRandomAccessPointFlag;
+ bool b_useRandomAccessUnitsOnlyFlag;
+ bool b_usePaddingFlag;
+ bool b_useTimeStampsFlags;
+ bool b_useIdleFlag;
+ bool b_durationFlag;
uint32_t i_timeStampResolution;
uint32_t i_OCRResolution;
uint8_t i_timeStampLength;
typedef struct
{
- bool b_ok;
+ bool b_ok;
uint16_t i_es_id;
- bool b_streamDependenceFlag;
- bool b_OCRStreamFlag;
+ bool b_streamDependenceFlag;
+ bool b_OCRStreamFlag;
uint8_t i_streamPriority;
char *psz_url;
typedef struct
{
- uint8_t i_iod_label, i_iod_label_scope;
+ uint8_t i_iod_label, i_iod_label_scope;
/* IOD */
uint16_t i_od_id;
{
int i_pid;
- bool b_seen;
- bool b_valid;
+ bool b_seen;
+ bool b_valid;
int i_cc; /* countinuity counter */
/* PSI owner (ie PMT -> PAT, ES -> PMT */
ts_pid_t **pmt;
/* */
- bool b_es_id_pid;
+ bool b_es_id_pid;
csa_t *csa;
int i_csa_pkt_size;
- bool b_silent;
+ bool b_silent;
- bool b_udp_out;
+ bool b_udp_out;
int fd; /* udp socket */
uint8_t *buffer;
- bool b_dvb_control;
+ bool b_dvb_control;
int i_dvb_program;
int64_t i_dvb_start;
int64_t i_dvb_length;
char *psz_file; /* file to dump data in */
FILE *p_file; /* filehandle */
uint64_t i_write; /* bytes written */
- bool b_file_out; /* dump mode enabled */
+ bool b_file_out; /* dump mode enabled */
/* */
- bool b_meta;
+ bool b_meta;
};
static int Demux ( demux_t *p_demux );
ts_pid_t *pat;
const char *psz_mode;
- bool b_append;
- bool b_topfield = false;
+ bool b_append;
+ bool b_topfield = false;
vlc_value_t val;
/* If in dump mode, then close the file */
if( p_sys->b_file_out )
{
- msg_Info( p_demux ,"closing %s ("I64Fd" Kbytes dumped)",
+ msg_Info( p_demux ,"closing %s (%"PRId64" Kbytes dumped)",
p_sys->psz_file, p_sys->i_write / 1024 );
if( p_sys->p_file != stdout )
/* Test continuity counter */
while( i_pos < i_data )
{
- ts_pid_t *p_pid; /* point to a PID structure */
- bool b_payload; /* indicates a packet with payload */
- bool b_adaptation; /* adaptation field */
- int i_cc = 0; /* continuity counter */
+ ts_pid_t *p_pid; /* point to a PID structure */
+ bool b_payload; /* indicates a packet with payload */
+ bool b_adaptation; /* adaptation field */
+ int i_cc = 0; /* continuity counter */
if( p_sys->buffer[i_pos] != 0x47 )
{
/* We read at most 100 TS packet or until a frame is completed */
for( i_pkt = 0; i_pkt < p_sys->i_ts_read; i_pkt++ )
{
- bool b_frame = false;
+ bool b_frame = false;
block_t *p_pkt;
ts_pid_t *p_pid;
if( p_sys->i_dvb_start <= t && t < p_sys->i_dvb_start + p_sys->i_dvb_length )
{
if( pi_length )
- *pi_length = p_sys->i_dvb_length * I64C(1000000);
+ *pi_length = p_sys->i_dvb_length * INT64_C(1000000);
if( pi_time )
- *pi_time = (t - p_sys->i_dvb_start) * I64C(1000000);
+ *pi_time = (t - p_sys->i_dvb_start) * INT64_C(1000000);
return VLC_SUCCESS;
}
}
int i_int;
if( p_sys->b_file_out )
- return demux2_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
+ return demux_vaControlHelper( p_demux->s, 0, -1, 0, 1, i_query, args );
switch( i_query )
{
pi64 = (int64_t*)va_arg( args, int64_t * );
if( p_sys->i_mux_rate > 0 )
{
- *pi64 = I64C(1000000) * ( stream_Size( p_demux->s ) / 50 ) /
+ *pi64 = INT64_C(1000000) * ( stream_Size( p_demux->s ) / 50 ) /
p_sys->i_mux_rate;
return VLC_SUCCESS;
}
static bool GatherPES( demux_t *p_demux, ts_pid_t *pid, block_t *p_bk )
{
- const uint8_t *p = p_bk->p_buffer;
+ const uint8_t *p = p_bk->p_buffer;
const bool b_unit_start = p[1]&0x40;
const bool b_adaptation = p[3]&0x20;
const bool b_payload = p[3]&0x10;
- const int i_cc = p[3]&0x0f; /* continuity counter */
+ const int i_cc = p[3]&0x0f; /* continuity counter */
bool b_discontinuity = false;/* discontinuity */
/* transport_scrambling_control is ignored */
iod_descriptor_t *p_iod;
int i;
int i_es_index;
- uint8_t i_flags, i_iod_tag, byte1, byte2, byte3;
+ uint8_t i_flags, i_iod_tag, byte1, byte2, byte3;
bool b_url;
- int i_iod_length;
+ int i_iod_length;
p_iod = malloc( sizeof( iod_descriptor_t ) );
if( !p_iod ) return NULL;
pid->es->fmt.i_cat = SPU_ES;
pid->es->fmt.i_codec = VLC_FOURCC( 't', 'e', 'l', 'x' );
pid->es->fmt.i_extra = p_dr->i_length;
- pid->es->fmt.p_extra = malloc( p_dr->i_length );
+ pid->es->fmt.p_extra = p_dr->i_length ?
+ malloc( p_dr->i_length ) : NULL;
if( pid->es->fmt.p_extra )
memcpy( pid->es->fmt.p_extra, p_dr->p_data,
p_dr->i_length );