Author: robux4
Date: 2004-10-24 16:25:25 +0400 (Sun, 24 Oct 2004)
New Revision: 911
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
trunk/DvdMenuXtractor/IFOFile.cpp
trunk/DvdMenuXtractor/IFOFile.h
trunk/DvdMenuXtractor/VobParser.h
Log:
better handling of missing IFO and VOB files
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-10-24 10:13:14 UTC (rev 910)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-10-24 12:25:25 UTC (rev 911)
@@ -591,11 +591,8 @@
break;
case 2:
- myfprintf(stderr, "MPEG1 audio not supported yet");
- break;
-
case 3:
- myfprintf(stderr, "MPEG2 audio not supported yet");
+ demuxer->AddDemuxer(new MPADemuxWriter(ac3Directory+newFilename+_langName, 0xC0 + _stream));
break;
case 4:
@@ -1204,7 +1201,7 @@
// VTS Menu
if (IfoFile->LanguageUnits(title) && IfoFile->LanguageUnits(title)->nr_of_lus)
{
- timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, 1);
+ timecode_endA = HandleLanguageUnit(lvl, XmlFile, timecode_startA, *IfoFile, title);
}
// VTS content
Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp 2004-10-24 10:13:14 UTC (rev 910)
+++ trunk/DvdMenuXtractor/IFOFile.cpp 2004-10-24 12:25:25 UTC (rev 911)
@@ -9,7 +9,7 @@
#include "wx/listimpl.cpp"
WX_DEFINE_LIST(CellsListType);
-WX_DEFINE_LIST(IfoHandleList);
+WX_DEFINE_LIST(IfoHandles);
WX_DEFINE_LIST(AudioTrackList);
WX_DEFINE_LIST(SubtitleTrackList);
@@ -59,9 +59,11 @@
myfprintf(stderr, "Cannot open VIDEO_TS.IFO");
}
- if (m_ifos.GetCount() && m_ifos.Item(0)->GetData()->Handle().vmgi_mat)
+ IfoContent *_ifo = m_ifos.GetIfoTitle(0);
+
+ if (_ifo && _ifo->Handle().vmgi_mat)
{
- for (int i=1; i<=m_ifos.Item(0)->GetData()->Handle().vmgi_mat->vmg_nr_of_title_sets; i++)
+ for (int i=1; i<=_ifo->Handle().vmgi_mat->vmg_nr_of_title_sets; i++)
{
try {
m_ifos.Append(new IfoContent(m_dvd,i));
@@ -73,10 +75,6 @@
}
}
- if (m_ifos.GetCount() < 2)
- {
- throw IFOInvalidFileFormatException();
- }
ClearLanguageSelection();
}
@@ -99,9 +97,10 @@
{
m_languageList.Clear();
- for(int i=0; i < m_ifos.Item(title)->GetData()->Handle().pgci_ut->nr_of_lus; i++)
+ IfoContent *_ifo = m_ifos.GetIfoTitle(title);
+ for(int i=0; i < _ifo->Handle().pgci_ut->nr_of_lus; i++)
{
- pgci_lu_t& lu = m_ifos.Item(title)->GetData()->Handle().pgci_ut->lu[i];
+ pgci_lu_t& lu = _ifo->Handle().pgci_ut->lu[i];
m_languageList.Add(DecodeLanguage(lu.lang_code));
m_SelectionTab[i] = 1;
}
@@ -121,7 +120,8 @@
void IFOFile::ClearLanguageSelection()
{
- for(int i = 0; i < m_ifos.Item(0)->GetData()->Handle().pgci_ut->nr_of_lus; i++)
+ IfoContent *_ifo = m_ifos.GetIfoTitle(0);
+ for(int i = 0; i < _ifo->Handle().pgci_ut->nr_of_lus; i++)
{
m_SelectionTab[i] = 0;
}
@@ -141,10 +141,10 @@
const pgci_ut_t *IFOFile::LanguageUnits(unsigned int title) const
{
- if (title < m_ifos.GetCount())
+ IfoContent *_ifo = m_ifos.GetIfoTitle(title);
+ if (_ifo)
{
- if (m_ifos.Item(title))
- return m_ifos.Item(title)->GetData()->Handle().pgci_ut;
+ return _ifo->Handle().pgci_ut;
}
return NULL;
@@ -154,9 +154,10 @@
const vts_ptt_srpt_t *IFOFile::VtsTitles(unsigned int title) const
{
- if (title && title < m_ifos.GetCount())
+ IfoContent *_ifo = m_ifos.GetIfoTitle(title);
+ if (_ifo)
{
- return m_ifos.Item(title)->GetData()->Handle().vts_ptt_srpt;
+ return _ifo->Handle().vts_ptt_srpt;
}
return NULL;
}
@@ -165,9 +166,10 @@
const pgcit_t *IFOFile::VtsPGCs(unsigned int title) const
{
- if (title && title < m_ifos.GetCount())
+ IfoContent *_ifo = m_ifos.GetIfoTitle(title);
+ if (_ifo)
{
- return m_ifos.Item(title)->GetData()->Handle().vts_pgcit;
+ return _ifo->Handle().vts_pgcit;
}
return NULL;
}
@@ -245,11 +247,12 @@
{
CellsHashType CellsHash;
- if (title >= m_ifos.GetCount())
+ IfoContent *ifoc = m_ifos.GetIfoTitle(title);
+ if (!ifoc)
return NULL;
+
+ ifo_handle_t &_ifo = ifoc->Handle();
- ifo_handle_t &_ifo = m_ifos.Item(title)->GetData()->Handle();
-
if (language)
{
if (_ifo.pgci_ut)
@@ -310,28 +313,31 @@
const AudioTrackList & IFOFile::AudioTracks(unsigned int title, bool language) const
{
- if (title > m_ifos.GetCount())
+ IfoContent *_ifo = m_ifos.GetIfoTitle(title);
+ if (!_ifo)
throw;
if (language)
- return m_ifos.Item(title)->GetData()->m_langAudio;
+ return _ifo->m_langAudio;
else
- return m_ifos.Item(title)->GetData()->m_Audio;
+ return _ifo->m_Audio;
}
const SubtitleTrackList & IFOFile::SubsTracks(unsigned int title, bool language) const
{
- if (title > m_ifos.GetCount())
+ IfoContent *_ifo = m_ifos.GetIfoTitle(title);
+ if (!_ifo)
throw;
if (language)
- return m_ifos.Item(title)->GetData()->m_langSubs;
+ return _ifo->m_langSubs;
else
- return m_ifos.Item(title)->GetData()->m_Subs;
+ return _ifo->m_Subs;
}
-IfoContent::IfoContent(dvd_reader_t *dvdr, int title)
+IfoContent::IfoContent(dvd_reader_t *dvdr, int16_t title)
+ :m_title(title)
{
m_handle = ifoOpen(dvdr,title);
if (!m_handle)
@@ -364,3 +370,13 @@
}
}
}
+
+IfoContent * IfoHandleList::GetIfoTitle(int16_t title) const
+{
+ for (size_t _index = 0; _index < GetCount(); _index++)
+ {
+ if (Item(_index)->GetData()->m_title == title)
+ return Item(_index)->GetData();
+ }
+ return NULL;
+}
Modified: trunk/DvdMenuXtractor/IFOFile.h
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.h 2004-10-24 10:13:14 UTC (rev 910)
+++ trunk/DvdMenuXtractor/IFOFile.h 2004-10-24 12:25:25 UTC (rev 911)
@@ -34,7 +34,7 @@
class IfoContent
{
public:
- IfoContent(dvd_reader_t *dvdr, int title);
+ IfoContent(dvd_reader_t *dvdr, int16_t title);
~IfoContent()
{
@@ -47,6 +47,7 @@
return *m_handle;
}
+ int16_t m_title;
AudioTrackList m_langAudio;
AudioTrackList m_Audio;
SubtitleTrackList m_langSubs;
@@ -56,8 +57,15 @@
ifo_handle_t *m_handle;
};
-WX_DECLARE_LIST(IfoContent, IfoHandleList);
+WX_DECLARE_LIST(IfoContent, IfoHandles);
+class IfoHandleList: public IfoHandles
+{
+public:
+ /// look for IfoContent corresponding to the title
+ IfoContent * GetIfoTitle(int16_t title) const;
+};
+
class CellsHashType;
// ----------------------------------------------------------------------------
Modified: trunk/DvdMenuXtractor/VobParser.h
===================================================================
--- trunk/DvdMenuXtractor/VobParser.h 2004-10-24 10:13:14 UTC (rev 910)
+++ trunk/DvdMenuXtractor/VobParser.h 2004-10-24 12:25:25 UTC (rev 911)
@@ -266,6 +266,21 @@
// ----------------------------------------------------------------------------
+class MPADemuxWriter : public Demuxer, public Writer
+{
+public:
+ MPADemuxWriter(const char* filenamePrefix, const uint8_t streamID) :
+ Writer(filenamePrefix,"mpa"), m_streamID(streamID) {}
+ void ProcessAudioStream(uint8_t* buff, uint32_t size, uint8_t streamID)
+ {
+ if(m_streamID == streamID) { Write(buff,size); }
+ }
+private:
+ uint8_t m_streamID;
+};
+
+// ----------------------------------------------------------------------------
+
class SubDemuxWriter : public Demuxer, public Writer
{
public:
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.