Skip to content

Commit

Permalink
refine code for player
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasWang committed Apr 16, 2013
1 parent 0e62b0a commit c0ec48d
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions examples/simpleplayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,45 121,22 @@ int main(int argc, char *argv[])
QString title = "QtAV " vo " " QtAV_Version_String_Long() " [email protected]";
VideoRenderer *renderer = 0;
if (vo == "gl") {
GLWidgetRenderer *r = static_cast<GLWidgetRenderer*>(VideoRendererFactory::create(VideoRendererId_GLWidget));
if (r) {
r->show();
r->setWindowTitle(title);
}
renderer = r;
renderer = VideoRendererFactory::create(VideoRendererId_GLWidget);
} else if (vo == "d2d") {
Direct2DRenderer *r = static_cast<Direct2DRenderer*>(VideoRendererFactory::create(VideoRendererId_Direct2D));
if (r) { //may not support
r->show();
r->setWindowTitle(title);
}
renderer = r;
renderer = VideoRendererFactory::create(VideoRendererId_Direct2D);
} else if (vo == "gdi") {
GDIRenderer *r = static_cast<GDIRenderer*>(VideoRendererFactory::create(VideoRendererId_GDI));
if (r) {
r->show();
r->setWindowTitle(title);
}
renderer = r;
renderer = VideoRendererFactory::create(VideoRendererId_GDI);
} else if (vo == "xv") {
XVRenderer *r = static_cast<XVRenderer*>(VideoRendererFactory::create(VideoRendererId_XV));
if (r) {
r->show();
r->setWindowTitle(title);
}
renderer = r;
}else {
WidgetRenderer *r = static_cast<WidgetRenderer*>(VideoRendererFactory::create(VideoRendererId_Widget));
if (r) {
r->show();
r->setWindowTitle(title);
}
renderer = r;
renderer = VideoRendererFactory::create(VideoRendererId_XV);
} else {
renderer = VideoRendererFactory::create(VideoRendererId_Widget);
}
if (!renderer) {
QMessageBox::critical(0, "QtAV", "vo '" vo "' not supported");
return 1;
}
renderer->widget()->show();
renderer->widget()->setWindowTitle(title);
//renderer->scaleInRenderer(false);
renderer->setOutAspectRatioMode(VideoRenderer::VideoAspectRatio);
AVPlayer player;
Expand Down

0 comments on commit c0ec48d

Please sign in to comment.