Commit 9139d783 authored by Steve Lhomme's avatar Steve Lhomme

mkv.cpp: fix dirent issue with the recent "fixes"

parent e2d3cfa4
......@@ -47,6 +47,12 @@
#ifdef HAVE_DIRENT_H
# include <dirent.h>
#else if defined(MSCVER)
extern "C" {
void * vlc_opendir ( const char * ) ;
void * vlc_readdir ( void * );
int vlc_closedir ( void * ) ;
}
#endif
/* libebml and matroska */
......@@ -316,24 +322,24 @@ typedef struct
class chapter_item_t
{
public:
int64_t i_start_time, i_end_time;
int64_t i_absolute_start_time; /* the time in the stream when an edition is ordered */
std::vector<chapter_item_t> sub_chapters;
int i_current_sub_chapter;
int i_seekpoint_num;
int64_t i_start_time, i_end_time;
int64_t i_absolute_start_time; /* the time in the stream when an edition is ordered */
std::vector<chapter_item_t> sub_chapters;
int i_current_sub_chapter;
int i_seekpoint_num;
};
class chapter_edition_t
{
public:
chapter_edition_t()
:i_uid(-1)
,b_ordered(false)
{}
std::vector<chapter_item_t> chapters;
int64_t i_uid;
bool b_ordered;
chapter_edition_t()
:i_uid(-1)
,b_ordered(false)
{}
std::vector<chapter_item_t> chapters;
int64_t i_uid;
bool b_ordered;
};
class demux_sys_t
......@@ -365,7 +371,7 @@ public:
,psz_date_utc(NULL)
,meta(NULL)
,title(NULL)
,i_current_edition(0)
,i_current_edition(0)
{}
vlc_stream_io_callback *in;
......@@ -413,9 +419,9 @@ public:
std::vector<KaxSegmentFamily> families;
std::vector<KaxSegment*> family_members;
std::vector<chapter_edition_t> editions;
int i_current_edition;
std::vector<chapter_edition_t> editions;
int i_current_edition;
};
#define MKVD_TIMECODESCALE 1000000
......@@ -598,7 +604,7 @@ static int Open( vlc_object_t * p_this )
if (p_src_dir != NULL)
{
while ((p_file_item = readdir(p_src_dir)))
while ((p_file_item = (dirent *) readdir(p_src_dir)))
{
if (strlen(p_file_item->d_name) > 4)
{
......@@ -1167,7 +1173,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
Seek( p_demux, (int64_t)p_sys->title->seekpoint[i_skp]->i_time_offset, -1);
p_demux->info.i_seekpoint |= INPUT_UPDATE_SEEKPOINT;
p_demux->info.i_seekpoint = i_skp;
/* p_sys->i_current_chapter = i_skp;*/
/* p_sys->i_current_chapter = i_skp;*/
return VLC_SUCCESS;
}
return VLC_EGENERIC;
......@@ -1417,14 +1423,14 @@ static void BlockDecode( demux_t *p_demux, KaxBlock *block, mtime_t i_pts,
static void UpdateCurrentChapter()
{
/* update current chapter/seekpoint */
/* update current chapter/seekpoint */
#ifdef TODO
i_chapter
if (p_sys->title->seekpoint[i_skp]->i_time_offset)
{
p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
p_demux->info.i_seekpoint = i_chapter;
}
i_chapter
if (p_sys->title->seekpoint[i_skp]->i_time_offset)
{
p_demux->info.i_update |= INPUT_UPDATE_SEEKPOINT;
p_demux->info.i_seekpoint = i_chapter;
}
#endif
}
......@@ -1601,7 +1607,7 @@ static int Demux( demux_t *p_demux)
demux_sys_t *p_sys = p_demux->p_sys;
mtime_t i_start_pts;
int i_block_count = 0;
int i_chapter;
int i_chapter;
KaxBlock *block;
int64_t i_block_duration;
......@@ -1612,15 +1618,15 @@ static int Demux( demux_t *p_demux)
for( ;; )
{
if ( p_sys->editions[p_sys->i_current_edition].b_ordered )
{
/* 1st, we need to know in which chapter we are */
/* check if we need to silently seek to a new location in the stream */
/* count the last duration time found for each track in a table (-1 not found, -2 silent) */
/* only seek after each duration >= end timecode of the current chapter */
}
if ( p_sys->editions[p_sys->i_current_edition].b_ordered )
{
/* 1st, we need to know in which chapter we are */
/* check if we need to silently seek to a new location in the stream */
/* count the last duration time found for each track in a table (-1 not found, -2 silent) */
/* only seek after each duration >= end timecode of the current chapter */
}
if( BlockGet( p_demux, &block, &i_block_ref1, &i_block_ref2, &i_block_duration ) )
{
msg_Warn( p_demux, "cannot get block EOF?" );
......@@ -1637,8 +1643,8 @@ static int Demux( demux_t *p_demux)
BlockDecode( p_demux, block, p_sys->i_pts, i_block_duration );
UpdateCurrentChapter();
UpdateCurrentChapter();
delete block;
i_block_count++;
......@@ -2789,9 +2795,9 @@ static void ParseChapterAtom( demux_t *p_demux, int i_level, EbmlMaster *ca, cha
}
else if( MKV_IS_ID( l, KaxChapterAtom ) )
{
chapter_item_t new_sub_chapter;
chapter_item_t new_sub_chapter;
ParseChapterAtom( p_demux, i_level+1, static_cast<EbmlMaster *>(l), new_sub_chapter );
chapters.sub_chapters.push_back( new_sub_chapter );
chapters.sub_chapters.push_back( new_sub_chapter );
}
}
......@@ -2818,7 +2824,7 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
EbmlMaster *m;
unsigned int i;
int i_upper_level = 0;
int i_default_edition = 0;
int i_default_edition = 0;
/* Master elements */
m = static_cast<EbmlMaster *>(chapters);
......@@ -2830,8 +2836,8 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
if( MKV_IS_ID( l, KaxEditionEntry ) )
{
chapter_edition_t edition;
chapter_edition_t edition;
EbmlMaster *E = static_cast<EbmlMaster *>(l );
unsigned int j;
msg_Dbg( p_demux, "| | + EditionEntry" );
......@@ -2841,9 +2847,9 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
if( MKV_IS_ID( l, KaxChapterAtom ) )
{
chapter_item_t new_sub_chapter;
chapter_item_t new_sub_chapter;
ParseChapterAtom( p_demux, 0, static_cast<EbmlMaster *>(l), new_sub_chapter );
edition.chapters.push_back( new_sub_chapter );
edition.chapters.push_back( new_sub_chapter );
}
else if( MKV_IS_ID( l, KaxEditionUID ) )
{
......@@ -2855,15 +2861,15 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
}
else if( MKV_IS_ID( l, KaxEditionFlagDefault ) )
{
if (uint8(*static_cast<KaxEditionFlagDefault *>(l)) != 0)
p_sys->i_current_edition = p_sys->editions.size();
if (uint8(*static_cast<KaxEditionFlagDefault *>(l)) != 0)
p_sys->i_current_edition = p_sys->editions.size();
}
else
{
msg_Dbg( p_demux, "| | | + Unknown (%s)", typeid(*l).name() );
}
}
p_sys->editions.push_back( edition );
p_sys->editions.push_back( edition );
}
else
{
......@@ -2871,12 +2877,12 @@ static void ParseChapters( demux_t *p_demux, EbmlElement *chapters )
}
}
p_sys->i_current_edition = i_default_edition;
if ( p_sys->editions[i_default_edition].b_ordered )
{
/* update the duration of the segment according to the sum of all sub chapters */
}
p_sys->i_current_edition = i_default_edition;
if ( p_sys->editions[i_default_edition].b_ordered )
{
/* update the duration of the segment according to the sum of all sub chapters */
}
}
/*****************************************************************************
......
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