1 /*
2 * libde265 example application "sherlock265".
3 * Copyright (c) 2013-2014 struktur AG, Dirk Farin <farin@struktur.de>
4 *
5 * This file is part of sherlock265, an example application using libde265.
6 *
7 * sherlock265 is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * sherlock265 is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with sherlock265. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "VideoPlayer.hh"
22
23
VideoPlayer(const char * filename)24 VideoPlayer::VideoPlayer(const char* filename)
25 {
26 mDecoder = new VideoDecoder;
27 mDecoder->init(filename);
28
29 videoWidget = new VideoWidget;
30
31 stopButton = new QPushButton("Stop");
32 //QObject::connect(stopButton, SIGNAL(clicked()), qApp, SLOT(stop()));
33 QObject::connect(stopButton, SIGNAL(clicked()), mDecoder, SLOT(stopDecoder()));
34
35 startButton = new QPushButton("&Start");
36 QObject::connect(startButton, SIGNAL(clicked()), mDecoder, SLOT(startDecoder()));
37
38 QPushButton* stepButton = new QPushButton("Step");
39 QObject::connect(stepButton, SIGNAL(clicked()), mDecoder, SLOT(singleStepDecoder()));
40
41
42 QObject::connect(mDecoder, SIGNAL(displayImage(QImage*)),
43 videoWidget, SLOT(setImage(QImage*)), Qt::QueuedConnection);
44
45
46
47 QPushButton* showCBPartitioningButton = new QPushButton("CB-tree");
48 showCBPartitioningButton->setCheckable(true);
49 QObject::connect(showCBPartitioningButton, SIGNAL(toggled(bool)),
50 mDecoder, SLOT(showCBPartitioning(bool)));
51
52 QPushButton* showTBPartitioningButton = new QPushButton("TB-tree");
53 showTBPartitioningButton->setCheckable(true);
54 QObject::connect(showTBPartitioningButton, SIGNAL(toggled(bool)),
55 mDecoder, SLOT(showTBPartitioning(bool)));
56
57 QPushButton* showPBPartitioningButton = new QPushButton("PB-tree");
58 showPBPartitioningButton->setCheckable(true);
59 QObject::connect(showPBPartitioningButton, SIGNAL(toggled(bool)),
60 mDecoder, SLOT(showPBPartitioning(bool)));
61
62 QPushButton* showIntraPredModeButton = new QPushButton("intra-pred");
63 showIntraPredModeButton->setCheckable(true);
64 QObject::connect(showIntraPredModeButton, SIGNAL(toggled(bool)),
65 mDecoder, SLOT(showIntraPredMode(bool)));
66
67 QPushButton* showPBPredModeButton = new QPushButton("PB-mode");
68 showPBPredModeButton->setCheckable(true);
69 QObject::connect(showPBPredModeButton, SIGNAL(toggled(bool)),
70 mDecoder, SLOT(showPBPredMode(bool)));
71
72 QPushButton* showQuantPYButton = new QPushButton("Quant");
73 showQuantPYButton->setCheckable(true);
74 QObject::connect(showQuantPYButton, SIGNAL(toggled(bool)),
75 mDecoder, SLOT(showQuantPY(bool)));
76
77 QPushButton* showMotionVecButton = new QPushButton("MotionVec");
78 showMotionVecButton->setCheckable(true);
79 QObject::connect(showMotionVecButton, SIGNAL(toggled(bool)),
80 mDecoder, SLOT(showMotionVec(bool)));
81
82 QPushButton* showTilesButton = new QPushButton("Tiles");
83 showTilesButton->setCheckable(true);
84 QObject::connect(showTilesButton, SIGNAL(toggled(bool)),
85 mDecoder, SLOT(showTiles(bool)));
86
87 QPushButton* showSlicesButton = new QPushButton("Slices");
88 showSlicesButton->setCheckable(true);
89 QObject::connect(showSlicesButton, SIGNAL(toggled(bool)),
90 mDecoder, SLOT(showSlices(bool)));
91
92 QPushButton* showDecodedImageButton = new QPushButton("image");
93 showDecodedImageButton->setCheckable(true);
94 showDecodedImageButton->setChecked(true);
95 QObject::connect(showDecodedImageButton, SIGNAL(toggled(bool)),
96 mDecoder, SLOT(showDecodedImage(bool)));
97
98 QGridLayout *layout = new QGridLayout;
99 layout->addWidget(videoWidget, 0,0,1,7);
100 layout->addWidget(startButton, 1,0,1,1);
101 layout->addWidget(stopButton, 1,1,1,1);
102 layout->addWidget(stepButton, 1,2,1,1);
103 layout->addWidget(showDecodedImageButton, 1,6,1,1);
104 layout->addWidget(showTilesButton, 1,5,1,1);
105 layout->addWidget(showSlicesButton, 1,4,1,1);
106 layout->addWidget(showCBPartitioningButton,2,0,1,1);
107 layout->addWidget(showTBPartitioningButton,2,1,1,1);
108 layout->addWidget(showPBPartitioningButton,2,2,1,1);
109 layout->addWidget(showIntraPredModeButton, 2,3,1,1);
110 layout->addWidget(showPBPredModeButton, 2,4,1,1);
111 layout->addWidget(showQuantPYButton, 2,5,1,1);
112 layout->addWidget(showMotionVecButton, 2,6,1,1);
113 setLayout(layout);
114
115
116 mDecoder->start();
117 }
118