~ubuntu-branches/ubuntu/utopic/dvdstyler/utopic-proposed

« back to all changes in this revision

Viewing changes to src/DVD.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-03-22 10:17:38 UTC
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20100322101738-221vbm516ygfnmfj
Tags: upstream-1.8.0.2
ImportĀ upstreamĀ versionĀ 1.8.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
// Purpose:     The class to store a DVD Structure (Titles/Menus)
4
4
// Author:      Alex Thuering
5
5
// Created:     29.01.2003
6
 
// RCS-ID:      $Id: DVD.cpp,v 1.73 2010/01/19 21:52:33 ntalex Exp $
 
6
// RCS-ID:      $Id: DVD.cpp,v 1.74 2010/03/16 20:59:26 ntalex Exp $
7
7
// Copyright:   (c) Alex Thuering
8
8
// Licence:     GPL
9
9
/////////////////////////////////////////////////////////////////////////////
431
431
                                        val = dvd->GetPath() + fname.GetFullName();
432
432
                                SetFilename(val);
433
433
                        }
434
 
                        if (child->GetPropVal(wxT("format"), &val) && val.length() > 0
435
 
                                        && val.ToLong(&lval) && (int)m_streams.GetCount() > stIdx)
436
 
                                m_streams[stIdx++]->SetDestinationFormat(lval);
 
434
                        if (child->GetPropVal(wxT("format"), &val) && val.length() > 0 && val.ToLong(&lval)) {
 
435
                                if ((int)m_streams.GetCount() <= stIdx || m_streams[stIdx]->GetType() != stVIDEO)
 
436
                                        stIdx = 0;
 
437
                                while ((int)m_streams.GetCount() > stIdx) {
 
438
                                        if (m_streams[stIdx]->GetType() == stVIDEO) {
 
439
                                                m_streams[stIdx++]->SetDestinationFormat(lval);
 
440
                                                break;
 
441
                                        }
 
442
                                        stIdx++;
 
443
                                }
 
444
                        }
437
445
                } else if (child->GetName() == wxT("audio")) {
438
446
                        if (child->GetChildren() != NULL && child->GetChildren()->GetContent().length() > 0) {
439
447
                                val = child->GetChildren()->GetContent();
442
450
                                        val = dvd->GetPath() + fname.GetFullPath();
443
451
                                else if (!wxFileExists(val) && wxFileExists(dvd->GetPath() + fname.GetFullName()))
444
452
                                        val = dvd->GetPath() + fname.GetFullName();
445
 
                                if (AddAudioFile(val))
 
453
                                if (AddAudioFile(val) && child->GetPropVal(wxT("format"), &val) && val.length() > 0 && val.ToLong(&lval)) {
446
454
                                        stIdx = m_streams.GetCount() - 1;
447
 
                                else
448
 
                                        stIdx = m_streams.GetCount();
 
455
                                        m_streams[stIdx++]->SetDestinationFormat(lval);
 
456
                                }
 
457
                        } else if (child->GetPropVal(wxT("format"), &val) && val.length() > 0 && val.ToLong(&lval)) {
 
458
                                if ((int)m_streams.GetCount() <= stIdx || m_streams[stIdx]->GetType() != stAUDIO)
 
459
                                        stIdx = 0;
 
460
                                while ((int)m_streams.GetCount() > stIdx) {
 
461
                                        if (m_streams[stIdx]->GetType() == stAUDIO) {
 
462
                                                m_streams[stIdx++]->SetDestinationFormat(lval);
 
463
                                                break;
 
464
                                        }
 
465
                                        stIdx++;
 
466
                                }
449
467
                        }
450
 
                        if (child->GetPropVal(wxT("format"), &val) && val.length() > 0
451
 
                                        && val.ToLong(&lval) && (int)m_streams.GetCount() > stIdx)
452
 
                                m_streams[stIdx]->SetDestinationFormat(lval);
453
468
                } else if (child->GetName() == wxT("textsub")) {
454
469
                        TextSub* textsub = new TextSub;
455
470
                        textsub->PutXML(child);