updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / smplayer-svn-full / smplayer-display-matroska-chapter-names.patch
blob53423b828ab25e81cd547981e33eb5643fcb2042
1 diff -Naur old/smplayer/src/basegui.cpp new/smplayer/src/basegui.cpp
2 --- old/smplayer/src/basegui.cpp 2011-01-25 18:16:30.000000000 +0200
3 +++ new/smplayer/src/basegui.cpp 2011-01-25 18:29:21.442435183 +0200
4 @@ -2894,7 +2894,7 @@
5 for (n=0; n < core->mdat.chapters; n++) {
6 QAction *a = new QAction(chapterGroup);
7 a->setCheckable(true);
8 - a->setText( QString::number(n+1) );
9 + a->setText(core->mdat.chapters_name[n]);
10 a->setData( n + Core::firstChapter() );
12 } else {
13 @@ -2918,7 +2918,7 @@
14 for (n=0; n < core->mdat.mkv_chapters; n++) {
15 QAction *a = new QAction(chapterGroup);
16 a->setCheckable(true);
17 - a->setText( QString::number(n+1) );
18 + a->setText(core->mdat.mkv_chapters_name[n]);
19 a->setData( n + Core::firstChapter() );
21 } else {
22 diff -Naur old/smplayer/src/mediadata.cpp new/smplayer/src/mediadata.cpp
23 --- old/smplayer/src/mediadata.cpp 2011-01-25 18:16:30.000000000 +0200
24 +++ new/smplayer/src/mediadata.cpp 2011-01-25 18:31:42.311989276 +0200
25 @@ -51,11 +51,13 @@
27 #if GENERIC_CHAPTER_SUPPORT
28 chapters = 0;
29 + chapters_name.clear();
30 #else
31 //chapters=0;
32 //angles=0;
34 mkv_chapters=0;
35 + mkv_chapters_name.clear();
36 #endif
38 initialized=false;
39 diff -Naur old/smplayer/src/mediadata.h new/smplayer/src/mediadata.h
40 --- old/smplayer/src/mediadata.h 2011-01-25 18:16:30.000000000 +0200
41 +++ new/smplayer/src/mediadata.h 2011-01-25 18:27:16.182462317 +0200
42 @@ -28,7 +28,7 @@
44 #include <QString>
45 #include <QSettings>
47 +#include <QMap>
49 // Types of media
51 @@ -76,11 +76,13 @@
53 #if GENERIC_CHAPTER_SUPPORT
54 int chapters;
55 + QMap<int,QString> chapters_name;
56 #else
57 //int chapters, angles; // for DVDs
59 // Matroshka chapters
60 int mkv_chapters;
61 + QMap<int,QString> mkv_chapters_name;
62 #endif
64 // Clip info
65 diff -Naur old/smplayer/src/mplayerprocess.cpp new/smplayer/src/mplayerprocess.cpp
66 --- old/smplayer/src/mplayerprocess.cpp 2011-01-25 18:16:30.000000000 +0200
67 +++ new/smplayer/src/mplayerprocess.cpp 2011-01-25 18:25:13.595751066 +0200
68 @@ -112,6 +112,7 @@
69 static QRegExp rx_screenshot("^\\*\\*\\* screenshot '(.*)'");
70 static QRegExp rx_endoffile("^Exiting... \\(End of file\\)|^ID_EXIT=EOF");
71 static QRegExp rx_mkvchapters("\\[mkv\\] Chapter (\\d+) from");
72 +static QRegExp rx_mkvchapters_name("^ID_CHAPTER_(\\d+)_NAME=(.*)");
73 static QRegExp rx_aspect2("^Movie-Aspect is ([0-9,.]+):1");
74 static QRegExp rx_fontcache("^\\[ass\\] Updating font cache|^\\[ass\\] Init");
75 static QRegExp rx_scanning_font("Scanning file");
76 @@ -504,6 +505,20 @@
78 else
80 + if (rx_mkvchapters_name.indexIn(line)!=-1) {
81 + int id = rx_mkvchapters_name.cap(1).toInt();
82 + QString s = rx_mkvchapters_name.cap(2);
83 + qDebug("MplayerProcess::parseLine: mkv chapters: %d", id);
84 + qDebug("MplayerProcess::parseLine: mkv chapters name: %s", s.toUtf8().data());
85 +#if GENERIC_CHAPTER_SUPPORT
86 + md.chapters_name.insert(id,s);
87 +#else
88 + md.mkv_chapters_name.insert(id,s);
89 +#endif
90 + }
92 + else
94 // VCD titles
95 if (rx_vcd.indexIn(line) > -1 ) {
96 int ID = rx_vcd.cap(1).toInt();