Skip to content

Commit

Permalink
Several fixes and improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlonluca committed Dec 13, 2015
1 parent f8f23b2 commit bf0e76b
Show file tree
Hide file tree
Showing 39 changed files with 1,083 additions and 195 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tools/build*
*.pro.user*
3rdparty
3rdparty*
3rdparty/*
openmaxil_backend/3rdparty/*
piomxtextures_qt_driver/mediaplayer/.qmake.conf
Expand Down
2 changes: 1 addition & 1 deletion piomxtextures_lib/piomxtextures_lib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

TEMPLATE = lib

VERSION = 5.0.0
VERSION = 5.1.0

QT += core core-private gui gui-private opengl quick quick-private
CONFIG += no_private_qt_headers_warning
Expand Down
5 changes: 3 additions & 2 deletions piomxtextures_pocplayer/qml/POC_ControlBarVideo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ POC_ControlBar {
Layout.fillWidth: true
maximumValue: 1.0
minimumValue: 0.0
stepSize: 0.01
value: videoOutputSurface.position/videoOutputSurface.duration;
stepSize: 0.0001
value:
mediaPlayer.position/mediaPlayer.duration;
updateValueWhileDragging: false

// NOTE: Remember to avoid seeking on value changed. That will result in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <lc_logging.h>
#include <QDate>

#include "QtCore/QDate"
#include "omx_logging.h"

#include "qmediametadata.h"
#include "openmaxilmetadataprovider.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
| definitions
+-----------------------------------------------------------------------------*/
//#define DEBUG_PLAYBIN
#define DEBUG_PLAYER_CONTROL
//#define DEBUG_PLAYER_CONTROL

#ifndef DEBUG_PLAYER_CONTROL
#ifdef LOG_DEBUG
#undef LOG_DEBUG
#define LOG_DEBUG(...) {(void)0}
#define LOG_DEBUG(...) {(void)0;}
#endif // LOG_DEBUG
#else
#include <lc_logging.h>
#include <omx_logging.h>
#endif // DEBUG_PLAYER_CONTROL


Expand Down
19 changes: 10 additions & 9 deletions piomxtextures_qt_driver/mediaplayer/openmaxilplayercontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
/*------------------------------------------------------------------------------
| includes
+-----------------------------------------------------------------------------*/
#include <QtCore/qobject.h>
#include <QtCore/qstack.h>
#include <QtCore/qsemaphore.h>
#include <QtCore/qmutex.h>
#include <QObject>
#include <QStack>
#include <QSemaphore>
#include <QMutex>
#include <QQuickItem>

#include <qmediacontent.h>
#include <qmediaplayer.h>
#include <qmediaplayercontrol.h>
#include <QMediaContent>
#include <QMediaPlayer>
#include <QMediaPlayerControl>
#include <QTimer>

#include <limits.h>

Expand Down Expand Up @@ -125,9 +125,10 @@ private slots:
const OMX_MediaProcessor::OMX_MediaStatus& status) const;

bool m_ownStream;

bool m_seekToStartPending;

qint64 m_pendingSeekPosition;

QMediaContent m_currentResource;

OMX_EGLBufferProviderSh m_texProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "openmaxilplayerserviceplugin.h"
#include "openmaxilplayerservice.h"

#include "lc_logging.h"
#include "omx_logging.h"

/*------------------------------------------------------------------------------
| OMX_PlayerServicePlugin::create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ void OpenMAXILVideoRendererControl::onTexturesReady()
QVideoFrame::Format_RGB565,
QAbstractVideoBuffer::GLTextureHandle
);

// This is needed to force an update of the surface format int the
// following refresh.
if (m_surface)
if (m_surface->isActive())
m_surface->stop();
}

/*------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion piomxtextures_samples/piomxtextures_samples.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ OTHER_FILES += video_*
DISTFILES += \
audio_simple.qml \
video_concurrent.qml \
video_loop.qml
video_loop.qml \
video_loop_position.qml
108 changes: 108 additions & 0 deletions piomxtextures_samples/video_audio_concurrent.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Project: PiOmxTextures
* Author: Luca Carlon
* Date: 08.08.2015
*
* Copyright (c) 2012-2015 Luca Carlon. All rights reserved.
*
* This file is part of PiOmxTextures.
*
* PiOmxTextures is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PiOmxTextures is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PiOmxTextures. If not, see <http://www.gnu.org/licenses/>.
*/

import QtQuick 2.0
import QtQml 2.2
import QtMultimedia 5.0

Rectangle {
property var videoUris: []
property var audioUris: []
property int videoIndex: 0
property int audioIndex: 0

color: "red"

Component.onCompleted: {
var arguments = Qt.application.arguments;
if (arguments.length < 6) {
console.log("Too few arguments.");
Qt.quit();
}

videoUris.push(arguments[2]);
videoUris.push(arguments[3]);
audioUris.push(arguments[4]);
audioUris.push(arguments[5]);

nextVideo(video1);
nextVideo(video2);
nextAudio(audio);
}

Video {
id: video1
width: 500
height: 450
x: parent.width/3 - width/2
y: parent.height/2 - height/2
autoPlay: false
onStopped: nextVideo(video1)
}

Video {
id: video2
width: 500
height: 450
x: parent.width/3*2 - width/2
y: parent.height/2 - height/2
autoPlay: false
onStopped: nextVideo(video2)
}

Audio {
id: audio
source: uri3
autoPlay: false
onStopped: nextAudio(audio)
}

//Timer {
// interval: 500
// running: true; repeat: true
// onTriggered: {
// console.log("Position video1: " + video1.position + ".");
// console.log("Position video2: " + video2.position + ".");
// console.log("Position audio: " + audio.position + ".");
// }
//}

Timer {
interval: 5000
running: true; repeat: true
onTriggered: {
console.log("Switching audio...");
audio.stop();
}
}

function nextVideo(element) {
element.source = videoUris[videoIndex++%2];
element.play();
}

function nextAudio(element) {
element.source = audioUris[audioIndex++%2];
element.play();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,51 +26,55 @@ import QtQml 2.2
import QtMultimedia 5.0

Rectangle {
property string uri1
property string uri2
property string uri3
property var videoUris: []
property var audioUris: []
property int videoIndex: 0
property int audioIndex: 0

color: "red"

Component.onCompleted: {
var arguments = Qt.application.arguments;
if (arguments.length < 5) {
if (arguments.length < 6) {
console.log("Too few arguments.");
Qt.quit();
}

uri1 = arguments[2];
uri2 = arguments[3];
uri3 = arguments[4];
videoUris.push(arguments[2]);
videoUris.push(arguments[3]);
audioUris.push(arguments[4]);
audioUris.push(arguments[5]);

nextVideo(video1);
nextVideo(video2);
nextAudio(audio);
}

Video {
id: video1
width: 500
height: 450
x: 100
y: 400
source: uri1
autoPlay: true
onStopped: {video1.seek(0); video1.play();}
x: parent.width/3 - width/2
y: parent.height/2 - height/2
autoPlay: false
onStopped: nextVideo(video1)
}

Video {
id: video2
x: 900
y: 400
width: 500
height: 450
source: uri2
autoPlay: true
onStopped: {video2.seek(0); video2.play();}
x: parent.width/3*2 - width/2
y: parent.height/2 - height/2
autoPlay: false
onStopped: nextVideo(video2)
}

Audio {
id: audio
source: uri3
autoPlay: true
onStopped: {audio.seek(0); audio.play();}
autoPlay: false
onStopped: nextAudio(audio)
}

Timer {
Expand All @@ -82,4 +86,23 @@ Rectangle {
console.log("Position audio: " + audio.position + ".");
}
}

Timer {
interval: 5000
running: true; repeat: true
onTriggered: {
console.log("Switching audio...");
audio.stop();
}
}

function nextVideo(element) {
element.source = videoUris[videoIndex++%2];
element.play();
}

function nextAudio(element) {
element.source = audioUris[audioIndex++%2];
element.play();
}
}
Loading

0 comments on commit bf0e76b

Please sign in to comment.