[vlc-commits] demux: ts: unify standards and its options
Francois Cartegnie
git at videolan.org
Thu Mar 3 18:16:18 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 2 22:09:47 2016 +0100| [06f6d9418e18794223aeed1e3c62a8e54a3ddf82] | committer: Francois Cartegnie
demux: ts: unify standards and its options
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=06f6d9418e18794223aeed1e3c62a8e54a3ddf82
---
modules/demux/mpeg/ts.c | 58 +++++++++++++++++++++++++--------------
modules/demux/mpeg/ts.h | 19 ++++++++-----
modules/demux/mpeg/ts_psi.c | 26 ++++++++++++++----
modules/demux/mpeg/ts_psi_eit.c | 5 ++--
4 files changed, 74 insertions(+), 34 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 12907f9..7ba3793 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -112,17 +112,14 @@ static void Close ( vlc_object_t * );
#define PCR_TEXT N_("Trust in-stream PCR")
#define PCR_LONGTEXT N_("Use the stream PCR as a reference.")
-static const int const arib_mode_list[] =
- { ARIBMODE_AUTO, ARIBMODE_ENABLED, ARIBMODE_DISABLED };
-static const char *const arib_mode_list_text[] =
- { N_("Auto"), N_("Enabled"), N_("Disabled") };
+static const char *const ts_standards_list[] =
+ { "auto", "mpeg", "dvb", "arib", "atsc", "tdmb" };
+static const char *const ts_standards_list_text[] =
+ { N_("Auto"), "MPEG", "DVB", "ARIB", "ATSC", "T-DMB" };
-#define SUPPORT_ARIB_TEXT N_("ARIB STD-B24 mode")
-#define SUPPORT_ARIB_LONGTEXT N_( \
- "Forces ARIB STD-B24 mode for decoding characters." \
- "This feature affects EPG information and subtitles." )
-
-#define ATSC_MODE_TEXT N_("ATSC")
+#define STANDARD_TEXT N_("Digital TV Standard")
+#define STANDARD_LONGTEXT N_( "Selects mode for digital TV standard." \
+ "This feature affects EPG information and subtitles." )
vlc_module_begin ()
set_description( N_("MPEG Transport Stream demuxer") )
@@ -130,6 +127,9 @@ vlc_module_begin ()
set_category( CAT_INPUT )
set_subcategory( SUBCAT_INPUT_DEMUX )
+ add_string( "ts-standard", "auto", STANDARD_TEXT, STANDARD_LONGTEXT, true )
+ change_string_list( ts_standards_list, ts_standards_list_text )
+
add_string( "ts-extra-pmt", NULL, PMT_TEXT, PMT_LONGTEXT, true )
add_bool( "ts-trust-pcr", true, PCR_TEXT, PCR_LONGTEXT, true )
change_safe()
@@ -147,11 +147,6 @@ vlc_module_begin ()
add_bool( "ts-split-es", true, SPLIT_ES_TEXT, SPLIT_ES_LONGTEXT, false )
add_bool( "ts-seek-percent", false, SEEK_PERCENT_TEXT, SEEK_PERCENT_LONGTEXT, true )
- add_integer( "ts-arib", ARIBMODE_AUTO, SUPPORT_ARIB_TEXT, SUPPORT_ARIB_LONGTEXT, false )
- change_integer_list( arib_mode_list, arib_mode_list_text )
-
- add_bool( "ts-atsc", false, ATSC_MODE_TEXT, NULL, false )
-
add_obsolete_bool( "ts-silent" );
set_capability( "demux", 10 )
@@ -510,13 +505,28 @@ static int Open( vlc_object_t *p_this )
p_sys->b_canfastseek = false;
p_sys->b_force_seek_per_percent = var_InheritBool( p_demux, "ts-seek-percent" );
- p_sys->b_atsc = var_InheritBool( p_demux, "ts-atsc" );
- if( !p_sys->b_atsc )
+ p_sys->standard = TS_STANDARD_AUTO;
+ char *psz_standard = var_InheritString( p_demux, "ts-standard" );
+ if( psz_standard )
{
- p_sys->b_atsc = !strcmp( p_demux->psz_access, "atsc" ) ||
- !strcmp( p_demux->psz_access, "usdigital" );
+ for( unsigned i=0; i<ARRAY_SIZE(ts_standards_list); i++ )
+ {
+ if( !strcmp( psz_standard, ts_standards_list[i] ) )
+ {
+ TsChangeStandard( p_sys, TS_STANDARD_AUTO + i );
+ msg_Dbg( p_demux, "Standard set to %s", ts_standards_list_text[i] );
+ break;
+ }
+ }
+ free( psz_standard );
+ }
+
+ if( p_sys->standard == TS_STANDARD_AUTO &&
+ ( !strcmp( p_demux->psz_access, "atsc" ) ||
+ !strcmp( p_demux->psz_access, "usdigital" ) ) )
+ {
+ TsChangeStandard( p_sys, TS_STANDARD_ATSC );
}
- p_sys->arib.e_mode = var_InheritInteger( p_demux, "ts-arib" );
stream_Control( p_sys->stream, STREAM_CAN_SEEK, &p_sys->b_canseek );
stream_Control( p_sys->stream, STREAM_CAN_FASTSEEK, &p_sys->b_canfastseek );
@@ -2417,6 +2427,14 @@ static bool GatherPESData( demux_t *p_demux, ts_pid_t *pid, block_t *p_pkt,
return i_ret;
}
+void TsChangeStandard( demux_sys_t *p_sys, ts_standards_e v )
+{
+ if( p_sys->standard != TS_STANDARD_AUTO &&
+ p_sys->standard != v )
+ return; /* TODO */
+ p_sys->standard = v;
+}
+
bool ProgramIsSelected( demux_sys_t *p_sys, uint16_t i_pgrm )
{
for(int i=0; i<p_sys->programs.i_size; i++)
diff --git a/modules/demux/mpeg/ts.h b/modules/demux/mpeg/ts.h
index 0e8777d..952791f 100644
--- a/modules/demux/mpeg/ts.h
+++ b/modules/demux/mpeg/ts.h
@@ -32,12 +32,15 @@ typedef struct csa_t csa_t;
#define TS_PSI_PAT_PID 0x00
-typedef enum arib_modes_e
+typedef enum ts_standards_e
{
- ARIBMODE_AUTO = -1,
- ARIBMODE_DISABLED = 0,
- ARIBMODE_ENABLED = 1
-} arib_modes_e;
+ TS_STANDARD_AUTO = 0,
+ TS_STANDARD_MPEG,
+ TS_STANDARD_DVB,
+ TS_STANDARD_ARIB,
+ TS_STANDARD_ATSC,
+ TS_STANDARD_TDMB,
+} ts_standards_e;
typedef struct
{
@@ -62,10 +65,10 @@ struct demux_sys_t
bool b_force_seek_per_percent;
- bool b_atsc;
+ ts_standards_e standard;
+
struct
{
- arib_modes_e e_mode;
#ifdef HAVE_ARIBB24
arib_instance_t *p_instance;
#endif
@@ -123,6 +126,8 @@ struct demux_sys_t
bool b_start_record;
};
+void TsChangeStandard( demux_sys_t *, ts_standards_e );
+
bool ProgramIsSelected( demux_sys_t *, uint16_t i_pgrm );
void UpdatePESFilters( demux_t *p_demux, bool b_all );
diff --git a/modules/demux/mpeg/ts_psi.c b/modules/demux/mpeg/ts_psi.c
index 824db6d..05676ea 100644
--- a/modules/demux/mpeg/ts_psi.c
+++ b/modules/demux/mpeg/ts_psi.c
@@ -282,12 +282,11 @@ static void ParsePMTRegistrations( demux_t *p_demux, const dvbpsi_descriptor_t
}
}
- if ( p_sys->arib.e_mode == ARIBMODE_AUTO &&
+ if ( p_sys->standard == TS_STANDARD_AUTO &&
registration_type == TS_PMT_REGISTRATION_NONE &&
i_arib_score_flags == 0x07 ) //0b111
{
registration_type = TS_PMT_REGISTRATION_ARIB;
- p_sys->arib.e_mode = ARIBMODE_ENABLED;
}
/* Now process private descriptors >= 0x40 */
@@ -874,7 +873,7 @@ static void PMTSetupEs0x06( demux_t *p_demux, ts_pes_t *p_pes,
p_fmt->i_cat = VIDEO_ES;
p_fmt->i_codec = VLC_CODEC_HEVC;
}
- else if ( p_demux->p_sys->arib.e_mode == ARIBMODE_ENABLED )
+ else if ( p_demux->p_sys->standard == TS_STANDARD_ARIB )
{
/* Lookup our data component descriptor first ARIB STD B10 6.4 */
dvbpsi_descriptor_t *p_dr = PMTEsFindDescriptor( p_dvbpsies, 0xFD );
@@ -1467,6 +1466,23 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
ts_pmt_registration_type_t registration_type = TS_PMT_REGISTRATION_NONE;
ParsePMTRegistrations( p_demux, p_dvbpsipmt->p_first_descriptor, p_pmt, ®istration_type );
+ if( p_sys->standard == TS_STANDARD_AUTO )
+ {
+ switch( registration_type )
+ {
+ case TS_PMT_REGISTRATION_BLURAY:
+ TsChangeStandard( p_sys, TS_STANDARD_MPEG );
+ break;
+ case TS_PMT_REGISTRATION_ARIB:
+ TsChangeStandard( p_sys, TS_STANDARD_ARIB );
+ break;
+ case TS_PMT_REGISTRATION_ATSC:
+ TsChangeStandard( p_sys, TS_STANDARD_ATSC );
+ default:
+ break;
+ }
+ }
+
dvbpsi_pmt_es_t *p_dvbpsies;
for( p_dvbpsies = p_dvbpsipmt->p_first_es; p_dvbpsies != NULL; p_dvbpsies = p_dvbpsies->p_next )
{
@@ -1617,7 +1633,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
else if( stream_Control( p_sys->stream, STREAM_SET_PRIVATE_ID_CA,
p_dvbpsipmt ) != VLC_SUCCESS )
{
- if ( p_sys->arib.e_mode == ARIBMODE_ENABLED && !p_sys->arib.b25stream )
+ if ( p_sys->standard == TS_STANDARD_ARIB && !p_sys->arib.b25stream )
{
p_sys->arib.b25stream = stream_FilterNew( p_demux->s, "aribcam" );
p_sys->stream = ( p_sys->arib.b25stream ) ? p_sys->arib.b25stream : p_demux->s;
@@ -1627,7 +1643,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
}
/* Add arbitrary PID from here */
- if ( registration_type == TS_PMT_REGISTRATION_ATSC || p_sys->b_atsc )
+ if ( p_sys->standard == TS_STANDARD_ATSC )
{
ts_pid_t *atsc_base_pid = GetPID(p_sys, ATSC_BASE_PID);
if ( PIDSetup( p_demux, TYPE_PSIP, atsc_base_pid, pmtpid ) )
diff --git a/modules/demux/mpeg/ts_psi_eit.c b/modules/demux/mpeg/ts_psi_eit.c
index a807512..b1d73e9 100644
--- a/modules/demux/mpeg/ts_psi_eit.c
+++ b/modules/demux/mpeg/ts_psi_eit.c
@@ -79,7 +79,7 @@ static char *EITConvertToUTF8( demux_t *p_demux,
{
demux_sys_t *p_sys = p_demux->p_sys;
#ifdef HAVE_ARIBB24
- if( p_sys->arib.e_mode == ARIBMODE_ENABLED )
+ if( p_sys->standard == TS_STANDARD_ARIB )
{
if ( !p_sys->arib.p_instance )
p_sys->arib.p_instance = arib_instance_new( p_demux );
@@ -364,7 +364,8 @@ static void EITCallBack( demux_t *p_demux,
PSI_DEBUG_TIMESHIFT(i_start);
i_duration = EITConvertDuration( p_evt->i_duration );
- if( p_sys->arib.e_mode == ARIBMODE_ENABLED )
+ /* We have to fix ARIB-B10 as all timestamps are JST */
+ if( p_sys->standard == TS_STANDARD_ARIB )
{
time_t i_now = time(NULL);
time_t i_tot_time = 0;
More information about the vlc-commits
mailing list