updated on Wed Jan 25 08:34:36 UTC 2012
[aur-mirror.git] / smplayer-svn / smplayer-display-matroska-chapter-names-2.patch
blob6cdacbb795bc5b9c26a1ab5efe241330c67b30c3
1 Index: smplayer/trunk/src/mplayerprocess.cpp
2 ===================================================================
3 --- smplayer/trunk/src/mplayerprocess.cpp (revision 3604)
4 +++ smplayer/trunk/src/mplayerprocess.cpp (working copy)
5 @@ -112,6 +112,7 @@
6 static QRegExp rx_screenshot("^\\*\\*\\* screenshot '(.*)'");
7 static QRegExp rx_endoffile("^Exiting... \\(End of file\\)|^ID_EXIT=EOF");
8 static QRegExp rx_mkvchapters("\\[mkv\\] Chapter (\\d+) from");
9 +static QRegExp rx_mkvchapters_name("^ID_CHAPTER_(\\d+)_NAME=(.*)");
10 static QRegExp rx_aspect2("^Movie-Aspect is ([0-9,.]+):1");
11 static QRegExp rx_fontcache("^\\[ass\\] Updating font cache|^\\[ass\\] Init");
12 static QRegExp rx_scanning_font("Scanning file");
13 @@ -504,6 +505,24 @@
15 else
17 + if (rx_mkvchapters_name.indexIn(line)!=-1) {
18 + int id = rx_mkvchapters_name.cap(1).toInt();
19 + QString s = rx_mkvchapters_name.cap(2);
20 + qDebug("MplayerProcess::parseLine: mkv chapters: %d", id);
21 + qDebug("MplayerProcess::parseLine: mkv chapters name: %s", s.toUtf8().data());
22 +#if GENERIC_CHAPTER_SUPPORT
23 + //Only insert the first time.
24 + //When playing mkv ordered chapter file, mplayer will scan all the file in the directory and it'll mess up the chapter's name.
25 + if(!md.chapters_name.contains(id))
26 + md.chapters_name.insert(id,s);
27 +#else
28 + if(!md.mkv_chapters_name.contains(id))
29 + md.mkv_chapters_name.insert(id,s);
30 +#endif
31 + }
33 + else
35 // VCD titles
36 if (rx_vcd.indexIn(line) > -1 ) {
37 int ID = rx_vcd.cap(1).toInt();
38 Index: smplayer/trunk/src/mediadata.h
39 ===================================================================
40 --- smplayer/trunk/src/mediadata.h (revision 3604)
41 +++ smplayer/trunk/src/mediadata.h (working copy)
42 @@ -28,8 +28,8 @@
44 #include <QString>
45 #include <QSettings>
46 +#include <QMap>
49 // Types of media
51 #define TYPE_UNKNOWN -1
52 @@ -76,11 +76,13 @@
54 #if GENERIC_CHAPTER_SUPPORT
55 int chapters;
56 + QMap<int,QString> chapters_name;
57 #else
58 //int chapters, angles; // for DVDs
60 // Matroshka chapters
61 int mkv_chapters;
62 + QMap<int,QString> mkv_chapters_name;
63 #endif
65 // Clip info
66 Index: smplayer/trunk/src/basegui.cpp
67 ===================================================================
68 --- smplayer/trunk/src/basegui.cpp (revision 3604)
69 +++ smplayer/trunk/src/basegui.cpp (working copy)
70 @@ -2894,7 +2894,7 @@
71 for (n=0; n < core->mdat.chapters; n++) {
72 QAction *a = new QAction(chapterGroup);
73 a->setCheckable(true);
74 - a->setText( QString::number(n+1) );
75 + a->setText(core->mdat.chapters_name[n]);
76 a->setData( n + Core::firstChapter() );
78 } else {
79 @@ -2918,7 +2918,7 @@
80 for (n=0; n < core->mdat.mkv_chapters; n++) {
81 QAction *a = new QAction(chapterGroup);
82 a->setCheckable(true);
83 - a->setText( QString::number(n+1) );
84 + a->setText(core->mdat.mkv_chapters_name[n]);
85 a->setData( n + Core::firstChapter() );
87 } else {
88 Index: smplayer/trunk/src/mediadata.cpp
89 ===================================================================
90 --- smplayer/trunk/src/mediadata.cpp (revision 3604)
91 +++ smplayer/trunk/src/mediadata.cpp (working copy)
92 @@ -54,11 +54,13 @@
94 #if GENERIC_CHAPTER_SUPPORT
95 chapters = 0;
96 + chapters_name.clear();
97 #else
98 //chapters=0;
99 //angles=0;
101 mkv_chapters=0;
102 + mkv_chapters_name.clear();
103 #endif
105 initialized=false;