Commit a6785624 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

mkv: let the track init its es_format_t

So it's not created in a funny state.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent c1025a17
......@@ -204,9 +204,6 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
{
bool bSupported = true;
/* Init the track */
mkv_track_t track;
EbmlUInteger *pTrackType = static_cast<EbmlUInteger*>(m->FindElt(EBML_INFO(KaxTrackType)));
uint8 ttype;
if (likely(pTrackType != NULL))
......@@ -214,28 +211,27 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
else
ttype = 0;
enum es_format_category_e es_cat;
switch( ttype )
{
case track_audio:
es_format_Init( &track.fmt, AUDIO_ES, 0);
track.fmt.audio.i_channels = 1;
track.fmt.audio.i_rate = 8000;
track.fmt.psz_language = strdup("English");
es_cat = AUDIO_ES;
break;
case track_video:
es_format_Init( &track.fmt, VIDEO_ES, 0);
track.fmt.psz_language = strdup("English");
es_cat = VIDEO_ES;
break;
case track_subtitle:
case track_buttons:
es_format_Init( &track.fmt, SPU_ES, 0);
track.fmt.psz_language = strdup("English");
es_cat = SPU_ES;
break;
default:
es_format_Init( &track.fmt, UNKNOWN_ES, 0);
es_cat = UNKNOWN_ES;
break;
}
/* Init the track */
mkv_track_t track( es_cat );
MkvTree( sys.demuxer, 2, "Track Entry" );
struct MetaDataCapture {
......
......@@ -528,7 +528,6 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
if( !b )
{
track.b_inited = false;
if( track.fmt.i_cat == VIDEO_ES || track.fmt.i_cat == AUDIO_ES )
track.i_last_dts = VLC_TS_INVALID;
return;
......@@ -804,3 +803,49 @@ static int Demux( demux_t *p_demux)
return 1;
}
mkv_track_t::mkv_track_t(enum es_format_category_e es_cat) :
b_default(true)
,b_enabled(true)
,b_forced(false)
,i_number(0)
,i_extra_data(0)
,p_extra_data(NULL)
,b_dts_only(false)
,b_pts_only(false)
,b_no_duration(false)
,i_default_duration(0)
,f_timecodescale(1.0)
,i_last_dts(0)
,i_skip_until_fpos(-1)
,f_fps(0)
,p_es(NULL)
,i_original_rate(0)
,i_chans_to_reorder(0)
,p_sys(NULL)
,b_discontinuity(false)
,i_compression_type(MATROSKA_COMPRESSION_NONE)
,i_encoding_scope(MATROSKA_ENCODING_SCOPE_ALL_FRAMES)
,p_compression_data(NULL)
,i_seek_preroll(0)
,i_codec_delay(0)
{
std::memset( &pi_chan_table, 0, sizeof( pi_chan_table ) );
es_format_Init(&fmt, es_cat, 0);
switch( es_cat )
{
case AUDIO_ES:
fmt.audio.i_channels = 1;
fmt.audio.i_rate = 8000;
/* fall through */
case VIDEO_ES:
case SPU_ES:
fmt.psz_language = strdup("English");
break;
default:
// no language needed
break;
}
}
......@@ -183,34 +183,7 @@ public:
class mkv_track_t
{
public:
mkv_track_t() :
b_default(true)
,b_enabled(true)
,b_forced(false)
,i_number(0)
,i_extra_data(0)
,p_extra_data(NULL)
,b_dts_only(false)
,b_pts_only(false)
,b_no_duration(false)
,i_default_duration(0)
,f_timecodescale(1.0)
,i_last_dts(0)
,i_skip_until_fpos(-1)
,f_fps(0)
,p_es(NULL)
,i_original_rate(0)
,i_chans_to_reorder(0)
,p_sys(NULL)
,b_discontinuity(false)
,i_compression_type(MATROSKA_COMPRESSION_NONE)
,i_encoding_scope(MATROSKA_ENCODING_SCOPE_ALL_FRAMES)
,p_compression_data(NULL)
,i_seek_preroll(0)
,i_codec_delay(0)
{
std::memset( &pi_chan_table, 0, sizeof( pi_chan_table ) );
}
mkv_track_t(enum es_format_category_e es_cat);
typedef unsigned int track_id_t;
......
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