1 Index: smplayer/trunk/src/mplayerprocess.cpp
2 ===================================================================
3 --- smplayer/trunk/src/mplayerprocess.cpp (revision 3604)
4 +++ smplayer/trunk/src/mplayerprocess.cpp (working copy)
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");
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);
28 + if(!md.mkv_chapters_name.contains(id))
29 + md.mkv_chapters_name.insert(id,s);
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)
51 #define TYPE_UNKNOWN -1
54 #if GENERIC_CHAPTER_SUPPORT
56 + QMap<int,QString> chapters_name;
58 //int chapters, angles; // for DVDs
62 + QMap<int,QString> mkv_chapters_name;
66 Index: smplayer/trunk/src/basegui.cpp
67 ===================================================================
68 --- smplayer/trunk/src/basegui.cpp (revision 3604)
69 +++ smplayer/trunk/src/basegui.cpp (working copy)
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() );
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() );
88 Index: smplayer/trunk/src/mediadata.cpp
89 ===================================================================
90 --- smplayer/trunk/src/mediadata.cpp (revision 3604)
91 +++ smplayer/trunk/src/mediadata.cpp (working copy)
94 #if GENERIC_CHAPTER_SUPPORT
96 + chapters_name.clear();
102 + mkv_chapters_name.clear();