Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
a2fb735b
Commit
a2fb735b
authored
Apr 28, 2016
by
Craig Watson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Podcasts on Linux: working video, no audio yet
parent
13a47116
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
560 additions
and
2 deletions
+560
-2
UBApplication.cpp
src/core/UBApplication.cpp
+0
-2
UBPodcastController.cpp
src/podcast/UBPodcastController.cpp
+4
-0
UBFFmpegVideoEncoder.cpp
src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
+396
-0
UBFFmpegVideoEncoder.h
src/podcast/ffmpeg/UBFFmpegVideoEncoder.h
+135
-0
podcast.pri
src/podcast/podcast.pri
+25
-0
No files found.
src/core/UBApplication.cpp
View file @
a2fb735b
...
@@ -520,10 +520,8 @@ void UBApplication::decorateActionMenu(QAction* action)
...
@@ -520,10 +520,8 @@ void UBApplication::decorateActionMenu(QAction* action)
menu
->
addSeparator
();
menu
->
addSeparator
();
#ifndef Q_OS_LINUX // No Podcast on Linux yet
menu
->
addAction
(
mainWindow
->
actionPodcast
);
menu
->
addAction
(
mainWindow
->
actionPodcast
);
mainWindow
->
actionPodcast
->
setText
(
tr
(
"Podcast"
));
mainWindow
->
actionPodcast
->
setText
(
tr
(
"Podcast"
));
#endif
menu
->
addSeparator
();
menu
->
addSeparator
();
menu
->
addAction
(
mainWindow
->
actionQuit
);
menu
->
addAction
(
mainWindow
->
actionQuit
);
...
...
src/podcast/UBPodcastController.cpp
View file @
a2fb735b
...
@@ -64,6 +64,8 @@
...
@@ -64,6 +64,8 @@
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_OSX)
#include "quicktime/UBQuickTimeVideoEncoder.h"
#include "quicktime/UBQuickTimeVideoEncoder.h"
#include "quicktime/UBAudioQueueRecorder.h"
#include "quicktime/UBAudioQueueRecorder.h"
#elif defined(Q_OS_LINUX)
#include "ffmpeg/UBFFmpegVideoEncoder.h"
#endif
#endif
#include "core/memcheck.h"
#include "core/memcheck.h"
...
@@ -309,6 +311,8 @@ void UBPodcastController::start()
...
@@ -309,6 +311,8 @@ void UBPodcastController::start()
mVideoEncoder
=
new
UBWindowsMediaVideoEncoder
(
this
);
//deleted on stop
mVideoEncoder
=
new
UBWindowsMediaVideoEncoder
(
this
);
//deleted on stop
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_OSX)
mVideoEncoder
=
new
UBQuickTimeVideoEncoder
(
this
);
//deleted on stop
mVideoEncoder
=
new
UBQuickTimeVideoEncoder
(
this
);
//deleted on stop
#elif defined(Q_OS_LINUX)
mVideoEncoder
=
new
UBFFmpegVideoEncoder
(
this
);
#endif
#endif
if
(
mVideoEncoder
)
if
(
mVideoEncoder
)
...
...
src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
0 → 100644
View file @
a2fb735b
This diff is collapsed.
Click to expand it.
src/podcast/ffmpeg/UBFFmpegVideoEncoder.h
0 → 100644
View file @
a2fb735b
#ifndef UBFFMPEGVIDEOENCODER_H
#define UBFFMPEGVIDEOENCODER_H
extern
"C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavutil/avutil.h>
#include <libavutil/imgutils.h>
#include <libavutil/opt.h>
#include <libavutil/mathematics.h>
#include <libswscale/swscale.h>
}
#include <atomic>
#include <stdio.h>
#include <QtCore>
#include <QImage>
#include "podcast/UBAbstractVideoEncoder.h"
class
UBFFmpegVideoEncoderWorker
;
class
UBPodcastController
;
class
UBFFmpegVideoEncoder
:
public
UBAbstractVideoEncoder
{
Q_OBJECT
friend
class
UBFFmpegVideoEncoderWorker
;
public
:
UBFFmpegVideoEncoder
(
QObject
*
parent
=
NULL
);
virtual
~
UBFFmpegVideoEncoder
();
bool
start
();
bool
stop
();
void
newPixmap
(
const
QImage
&
pImage
,
long
timestamp
);
QString
videoFileExtension
()
const
{
return
"mp4"
;
}
QString
lastErrorMessage
()
{
return
mLastErrorMessage
;
}
void
setRecordAudio
(
bool
pRecordAudio
)
{
mShouldRecordAudio
=
pRecordAudio
;
}
signals
:
void
encodingFinished
(
bool
ok
);
private
slots
:
void
setLastErrorMessage
(
const
QString
&
pMessage
);
void
finishEncoding
();
private
:
struct
ImageFrame
{
QImage
image
;
long
timestamp
;
// unit: ms
};
AVFrame
*
convertFrame
(
ImageFrame
frame
);
bool
init
();
// Queue for any pixmap that might be sent before the encoder is ready
QQueue
<
ImageFrame
>
mPendingFrames
;
QString
mLastErrorMessage
;
bool
mShouldRecordAudio
;
QThread
*
mVideoEncoderThread
;
UBFFmpegVideoEncoderWorker
*
mVideoWorker
;
// Muxer
AVFormatContext
*
mOutputFormatContext
;
int
mTimebase
;
// Video
AVStream
*
mVideoStream
;
struct
SwsContext
*
mSwsContext
;
// Audio
AVStream
*
mAudioStream
;
FILE
*
mFile
;
};
class
UBFFmpegVideoEncoderWorker
:
public
QObject
{
Q_OBJECT
friend
class
UBFFmpegVideoEncoder
;
public
:
UBFFmpegVideoEncoderWorker
(
UBFFmpegVideoEncoder
*
controller
);
~
UBFFmpegVideoEncoderWorker
();
bool
isRunning
()
{
return
mIsRunning
;
}
void
queueFrame
(
AVFrame
*
frame
);
public
slots
:
void
runEncoding
();
void
stopEncoding
();
signals
:
void
encodingFinished
();
void
error
(
QString
message
);
private
:
void
writeLatestVideoFrame
();
UBFFmpegVideoEncoder
*
mController
;
// std::atomic is C++11. This won't work with msvc2010, so a
// newer compiler must be used if this is to be used on Windows
std
::
atomic
<
bool
>
mStopRequested
;
std
::
atomic
<
bool
>
mIsRunning
;
QQueue
<
AVFrame
*>
mFrameQueue
;
QMutex
mFrameQueueMutex
;
QWaitCondition
mWaitCondition
;
AVPacket
*
mPacket
;
};
#endif // UBFFMPEGVIDEOENCODER_H
src/podcast/podcast.pri
View file @
a2fb735b
...
@@ -33,3 +33,28 @@ macx {
...
@@ -33,3 +33,28 @@ macx {
OBJECTIVE_SOURCES += src/podcast/quicktime/UBQuickTimeFile.mm
OBJECTIVE_SOURCES += src/podcast/quicktime/UBQuickTimeFile.mm
}
}
linux-g++* {
HEADERS += src/podcast/ffmpeg/UBFFmpegVideoEncoder.h
SOURCES += src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
FFMPEG = /opt/ffmpeg
INCLUDEPATH += $${FFMPEG}/include
DEPENDPATH += /usr/lib/x86_64-linux-gnu
LIBS += -L $${FFMPEG}/lib -lavformat \
-L $${FFMPEG}/lib -lavcodec \
-L $${FFMPEG}/lib -lswscale \
-L $${FFMPEG}/lib -lavutil \
-lva-x11 \
-lva \
-lxcb-shm \
-lxcb-xfixes \
-lxcb-render -lxcb-shape -lxcb -lX11 -lasound -lSDL -lx264 -lpthread -lvpx -lvorbisenc -lvorbis -ltheoraenc -ltheoradec -logg -lopus -lmp3lame -lfreetype -lfdk-aac -lass -llzma -lbz2 -lz -ldl -lswresample -lswscale -lavutil -lm
QMAKE_CXXFLAGS += -std=c++11 # move this to OpenBoard.pro when we can use C++11 on all platforms
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment