[matroska] r906 - in trunk/DvdMenuXtractor: . iso
[email protected] Sat, 23 Oct 2004 18:37:54 +0400 (MSD)
Newsgroups
gmane.comp.multimedia.matroska.cvs
Message-ID
<[email protected] >
Author: robux4
Date: 2004-10-23 18:37:53 +0400 (Sat, 23 Oct 2004)
New Revision: 906
Modified:
trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
trunk/DvdMenuXtractor/IFOFile.cpp
trunk/DvdMenuXtractor/IFOFile.h
trunk/DvdMenuXtractor/iso/iso_lang.c
Log:
extract each language to its own files (audio & subs)
Modified: trunk/DvdMenuXtractor/DvdMenuXtractor.cpp
===================================================================
--- trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-10-23 10:04:52 UTC (rev 905)
+++ trunk/DvdMenuXtractor/DvdMenuXtractor.cpp 2004-10-23 14:37:53 UTC (rev 906)
@@ -25,6 +25,7 @@
#include "A52Decoder.h"
#include "SUBDecoder.h"
#include "base64.h"
+#include "iso/iso_lang.h"
// TODO : settings
// - preferred language
@@ -565,13 +566,66 @@
demuxer = new CompositeDemuxWriter();
demuxer->AddDemuxer(new VideoDemuxWriter(m2vDirectory+newFilename));
- // _TODO_ decide which audio streams to process
- demuxer->AddDemuxer(new AC3DemuxWriter(ac3Directory+newFilename));
+ int _stream;
+
+ // decide which audio streams to process
+ const AudioTrackList & _audioTracks = IfoFile->AudioTracks(title, language);
+ if (_audioTracks.GetCount())
+ {
+ for (_stream=0; _stream<_audioTracks.GetCount();_stream++)
+ {
+ wxString _langName;
+ audio_attr_t * _attr = _audioTracks.Item(_stream)->GetData();
+ if (_attr->lang_code == 0)
+ _langName = "_un";
+ else
+ _langName = wxString::Format("_%c%c", _attr->lang_code >> 8, _attr->lang_code & 0xFF);
+ switch (_audioTracks.Item(_stream)->GetData()->audio_format)
+ {
+ case 0:
+ demuxer->AddDemuxer(new AC3DemuxWriter(ac3Directory+newFilename+_langName));
+ break;
+
+ case 2:
+ myfprintf(stderr, "MPEG1 audio not supported yet");
+ break;
+
+ case 3:
+ myfprintf(stderr, "MPEG2 audio not supported yet");
+ break;
+
+ case 4:
+ myfprintf(stderr, "LPCM audio not supported yet");
+ break;
+
+ case 6:
+ myfprintf(stderr, "DTS audio not supported yet");
+ break;
+
+ default:
+ myfprintf(stderr, "Unknown audio format %d", _attr->audio_format);
+ break;
+ }
+ }
+ }
// _TODO_ decide which subs streams to process
- if(aVobParser.m_pci.btn_ns > 0)
+ const SubtitleTrackList & _subTracks = IfoFile->SubsTracks(title, language);
+ if (_subTracks.GetCount())
{
- demuxer->AddDemuxer(new SubDemuxWriter(subDirectory+newFilename));
+ for (_stream=0; _stream<_subTracks.GetCount();_stream++)
+ {
+ wxString _langName;
+ subp_attr_t * _attr = _subTracks.Item(_stream)->GetData();
+ if (_attr->lang_code == 0)
+ _langName = "_un";
+ else
+ _langName = wxString::Format("_%c%c", _attr->lang_code >> 8, _attr->lang_code & 0xFF);
+// if(aVobParser.m_pci.btn_ns > 0)
+ {
+ demuxer->AddDemuxer(new SubDemuxWriter(subDirectory+newFilename+_langName));
+ }
+ }
}
}
aVobParser.SetDemuxer(demuxer);
@@ -1214,7 +1268,7 @@
virtual void AfterShow(void)
{
- const int NbsStep = 5;
+ const int NbsStep = 4;
wxString StepString, StepStringFormat = "Step %d/%d : %s...";
m_OperationInProgress = TRUE;
@@ -1256,13 +1310,13 @@
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
ConvertStillToBMP(title, language);
-
+/*
StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting audio to wav");
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
m_lbStep->Update();
ConvertAudioToWAV(title, language);
-
+*/
StepString = StepString.Format(StepStringFormat, Step++, NbsStep, "Converting button mask to bitmap");
m_lbStep->SetLabel(StepString);
m_txtDemuxLog->AppendText(StepString+"\n");
Modified: trunk/DvdMenuXtractor/IFOFile.cpp
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.cpp 2004-10-23 10:04:52 UTC (rev 905)
+++ trunk/DvdMenuXtractor/IFOFile.cpp 2004-10-23 14:37:53 UTC (rev 906)
@@ -310,7 +310,7 @@
const AudioTrackList & IFOFile::AudioTracks(unsigned int title, bool language) const
{
- if (!title || title > m_ifos.GetCount())
+ if (title > m_ifos.GetCount())
throw;
if (language)
@@ -321,7 +321,7 @@
const SubtitleTrackList & IFOFile::SubsTracks(unsigned int title, bool language) const
{
- if (!title || title > m_ifos.GetCount())
+ if (title > m_ifos.GetCount())
throw;
if (language)
@@ -329,3 +329,38 @@
else
return m_ifos.Item(title)->GetData()->m_Subs;
}
+
+
+IfoContent::IfoContent(dvd_reader_t *dvdr, int title)
+{
+ m_handle = ifoOpen(dvdr,title);
+ if (!m_handle)
+ throw IFOInvalidFileFormatException();
+
+ if (title == 0)
+ {
+ if (m_handle->vmgi_mat)
+ {
+ if (m_handle->vmgi_mat->nr_of_vmgm_audio_streams)
+ m_langAudio.Append(&m_handle->vmgi_mat->vmgm_audio_attr);
+ if (m_handle->vmgi_mat->nr_of_vmgm_subp_streams)
+ m_langSubs.Append(&m_handle->vmgi_mat->vmgm_subp_attr);
+ }
+ }
+ else
+ {
+ if (m_handle->vtsi_mat)
+ {
+ if (m_handle->vtsi_mat->nr_of_vtsm_audio_streams)
+ m_langAudio.Append(&m_handle->vtsi_mat->vtsm_audio_attr);
+ if (m_handle->vtsi_mat->nr_of_vtsm_subp_streams)
+ m_langSubs.Append(&m_handle->vtsi_mat->vtsm_subp_attr);
+
+ uint8_t _stream;
+ for (_stream=0; _stream < m_handle->vtsi_mat->nr_of_vts_audio_streams; _stream++)
+ m_Audio.Append(&m_handle->vtsi_mat->vts_audio_attr[_stream]);
+ for (_stream=0; _stream < m_handle->vtsi_mat->nr_of_vts_subp_streams; _stream++)
+ m_Subs.Append(&m_handle->vtsi_mat->vts_subp_attr[_stream]);
+ }
+ }
+}
Modified: trunk/DvdMenuXtractor/IFOFile.h
===================================================================
--- trunk/DvdMenuXtractor/IFOFile.h 2004-10-23 10:04:52 UTC (rev 905)
+++ trunk/DvdMenuXtractor/IFOFile.h 2004-10-23 14:37:53 UTC (rev 906)
@@ -34,12 +34,7 @@
class IfoContent
{
public:
- IfoContent(dvd_reader_t *dvdr, int title)
- {
- m_handle = ifoOpen(dvdr,title);
- if (!m_handle)
- throw IFOInvalidFileFormatException();
- }
+ IfoContent(dvd_reader_t *dvdr, int title);
~IfoContent()
{
Modified: trunk/DvdMenuXtractor/iso/iso_lang.c
===================================================================
--- trunk/DvdMenuXtractor/iso/iso_lang.c 2004-10-23 10:04:52 UTC (rev 905)
+++ trunk/DvdMenuXtractor/iso/iso_lang.c 2004-10-23 14:37:53 UTC (rev 906)
@@ -55,22 +55,25 @@
const iso639_lang_t * p_lang;
uint8_t psz_code[3];
- psz_code[0] = (uint8_t)(i_code >> 8);
- psz_code[1] = (uint8_t)i_code;
- psz_code[2] = '\0';
+ if (i_code != 0)
+ {
+ psz_code[0] = (uint8_t)(i_code >> 8);
+ psz_code[1] = (uint8_t)i_code;
+ psz_code[2] = '\0';
- for( p_lang = p_languages; p_lang->psz_eng_name; p_lang++ )
- {
- if( !strncmp( p_lang->psz_iso639_1, psz_code, 2 ) )
- {
- if( *p_lang->psz_native_name )
- {
- return p_lang->psz_native_name;
- }
+ for( p_lang = p_languages; p_lang->psz_eng_name; p_lang++ )
+ {
+ if( !strncmp( p_lang->psz_iso639_1, psz_code, 2 ) )
+ {
+ if( *p_lang->psz_native_name )
+ {
+ return p_lang->psz_native_name;
+ }
- return p_lang->psz_eng_name;
- }
- }
+ return p_lang->psz_eng_name;
+ }
+ }
+ }
return "Unknown";
}