forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
2,578 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
CVS | ||
.#* | ||
|
||
.hg | ||
.hgignore | ||
|
||
bin | ||
obj | ||
TestResults | ||
*.pbxuser | ||
*.perspectivev3 | ||
.DS_Store | ||
|
||
*.old | ||
*.log | ||
*.out | ||
*.cache | ||
|
||
*.deb | ||
|
||
*.git.old* | ||
Makefile* | ||
*.*pro*.user* | ||
*.[oa] | ||
*.so* | ||
*.dll | ||
*.lib | ||
*.exp | ||
*.exe | ||
*.out | ||
|
||
#vc files | ||
*.def | ||
*.dep | ||
*.idb | ||
*.layout | ||
*.manifest | ||
*.ncb | ||
*.obj | ||
*.pdb | ||
*.suo | ||
*.user | ||
*.tlh | ||
*.tli | ||
|
||
|
||
#intel compiler | ||
*.ilk | ||
|
||
#dirs | ||
.moc | ||
.rcc | ||
.obj | ||
/bin* | ||
/lib* | ||
Debug | ||
Release | ||
*.Debug | ||
*.Release | ||
|
||
*.fuse* | ||
|
||
#qt | ||
*.prl | ||
*moc_* | ||
*.moc | ||
*qrc_res.cpp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
TEMPLATE = subdirs | ||
CONFIG += ordered | ||
SUBDIRS = libqtav test | ||
|
||
libqtav.file = src/libQtAV.pro | ||
test.file = test/tst_QtAV.pro | ||
test.depends += libqtav | ||
|
||
OTHER_FILES += README | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
# qmake common template pri file | ||
# Copyright (C) 2011 Wang Bin <[email protected]> | ||
# Shanghai, China. | ||
# | ||
# This program 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 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program 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 this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
# | ||
|
||
isEmpty(COMMON_PRI_INCLUDED): { #begin COMMON_PRI_INCLUDED | ||
|
||
CONFIG += profile | ||
#profiling, -pg is not supported for msvc | ||
debug:!*msvc*:profile { | ||
QMAKE_CXXFLAGS_DEBUG += -pg | ||
QMAKE_LFLAGS_DEBUG += -pg | ||
QMAKE_CXXFLAGS_DEBUG = $$unique(QMAKE_CXXFLAGS_DEBUG) | ||
QMAKE_LFLAGS_DEBUG = $$unique(QMAKE_LFLAGS_DEBUG) | ||
} | ||
|
||
#$$[TARGET_PLATFORM] | ||
#$$[QT_ARCH] #windows symbian windowsce arm | ||
_OS = | ||
_ARCH = | ||
_EXTRA = | ||
|
||
unix { | ||
_OS = _unix | ||
*linux*: _OS = _linux | ||
*maemo* { | ||
_OS = _maemo | ||
*maemo5*:_OS = _maemo5 | ||
*maemo6*:_OS = _maemo6 | ||
} | ||
*meego*: _OS = _meego | ||
!isEmpty(MEEGO_EDITION): _OS = _$$MEEGO_EDITION | ||
} else:wince* { | ||
_OS = _wince | ||
} else:win32 { #true for wince | ||
_OS = _win32 | ||
} else:macx { | ||
_OS = _macx | ||
} | ||
|
||
#*arm*: _ARCH = $${_ARCH}_arm | ||
contains(QT_ARCH, arm.*) { | ||
_ARCH = $${_ARCH}_$${QT_ARCH} | ||
} | ||
*64: _ARCH = $${_ARCH}_x64 | ||
*llvm*: _EXTRA = _llvm | ||
#*msvc*: | ||
|
||
win32-msvc* { | ||
#Don't warn about sprintf, fopen etc being 'unsafe' | ||
DEFINES += _CRT_SECURE_NO_WARNINGS | ||
} | ||
|
||
#################################functions######################################### | ||
defineReplace(cleanPath) { | ||
win32:1 ~= s|\\\\|/|g | ||
contains(1, ^/.*):pfx = / | ||
else:pfx = | ||
segs = $$split(1, /) | ||
out = | ||
for(seg, segs) { | ||
equals(seg, ..):out = $$member(out, 0, -2) | ||
else:!equals(seg, .):out += $$seg | ||
} | ||
return($$join(out, /, $$pfx)) | ||
} | ||
|
||
#Acts like qtLibraryTarget. From qtcreator.pri | ||
defineReplace(qtLibName) { | ||
#TEMPLATE += fakelib | ||
#LIB_FULLNAME = $$qtLibraryTarget($$1) | ||
#TEMPLATE -= fakelib | ||
unset(LIBRARY_NAME) | ||
LIBRARY_NAME = $$1 | ||
CONFIG(debug, debug|release) { | ||
!debug_and_release|build_pass { | ||
mac:RET = $$member(LIBRARY_NAME, 0)_debug | ||
else:win32:RET = $$member(LIBRARY_NAME, 0)d | ||
} | ||
} | ||
isEmpty(RET):RET = $$LIBRARY_NAME | ||
!win32: return($$RET) | ||
|
||
isEmpty(2): VERSION_EXT = $$VERSION | ||
else: VERSION_EXT = $$2 | ||
!isEmpty(VERSION_EXT) { | ||
VERSION_EXT = $$section(VERSION_EXT, ., 0, 0) | ||
isEqual(VERSION_EXT, 0):unset(VERSION_EXT) | ||
} | ||
RET = $${RET}$${VERSION_EXT} | ||
unset(VERSION_EXT) | ||
return($$RET) | ||
} | ||
|
||
|
||
#fakelib | ||
defineReplace(qtStaticLib) { | ||
unset(LIB_FULLNAME) | ||
LIB_FULLNAME = $$qtLibName($$1, $$2) | ||
*msvc*: LIB_FULLNAME = $$member(LIB_FULLNAME, 0).lib | ||
else: LIB_FULLNAME = lib$$member(LIB_FULLNAME, 0).a | ||
return($$LIB_FULLNAME) | ||
} | ||
|
||
defineReplace(qtSharedLib) { | ||
unset(LIB_FULLNAME) | ||
LIB_FULLNAME = $$qtLibName($$1, $$2) | ||
win32: LIB_FULLNAME = $$member(LIB_FULLNAME, 0).dll | ||
else { | ||
macx|ios: LIB_FULLNAME = lib$$member(LIB_FULLNAME, 0).$${QMAKE_EXTENSION_SHLIB} #default_post.prf | ||
else: LIB_FULLNAME = lib$$member(LIB_FULLNAME, 0).so | ||
} | ||
return($$LIB_FULLNAME) | ||
} | ||
|
||
defineReplace(qtLongName) { | ||
unset(LONG_NAME) | ||
LONG_NAME = $$1$${_OS}$${_ARCH}$${_EXTRA} | ||
return($$LONG_NAME) | ||
} | ||
|
||
##############################paths#################################### | ||
#TRANSLATIONS += i18n/$${TARGET}_zh-cn.ts i18n/$${TARGET}_zh_CN.ts | ||
|
||
#for Qt2, Qt3 which does not have QT_VERSION. Qt4: $$[QT_VERSION] | ||
MOC_DIR = $$BUILD_DIR/.moc/$${QT_VERSION} | ||
RCC_DIR = $$BUILD_DIR/.rcc/$${QT_VERSION} | ||
UI_DIR = $$BUILD_DIR/.ui/$${QT_VERSION} | ||
#obj is platform dependent | ||
OBJECTS_DIR = $$qtLongName($$BUILD_DIR/.obj/$$TARGET) | ||
|
||
isEqual(TEMPLATE, app) { | ||
DESTDIR = $$BUILD_DIR/bin | ||
TARGET = $$qtLongName($$TARGET) | ||
EXE_EXT = | ||
win32: EXE_EXT = .exe | ||
CONFIG(release, debug|release): !isEmpty(QMAKE_STRIP): QMAKE_POST_LINK = -$$QMAKE_STRIP $$DESTDIR/$${TARGET}$${EXE_EXT} #.exe in win | ||
} | ||
else: DESTDIR = $$qtLongName($$BUILD_DIR/lib) | ||
|
||
!build_pass:message(target: $$DESTDIR/$$TARGET) | ||
|
||
COMMON_PRI_INCLUDED = 1 | ||
|
||
} #end COMMON_PRI_INCLUDED | ||
#before target name changed | ||
#TRANSLATIONS += i18n/$${TARGET}_zh-cn.ts #i18n/$${TARGET}_zh_CN.ts | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include <QtAV/AVDecoder.h> | ||
|
||
namespace QtAV { | ||
AVDecoder::AVDecoder() | ||
:codec_ctx(0),frame_(0) | ||
{ | ||
} | ||
|
||
AVDecoder::~AVDecoder() | ||
{ | ||
} | ||
|
||
void AVDecoder::setCodecContext(AVCodecContext *codecCtx) | ||
{ | ||
codec_ctx = codecCtx; | ||
} | ||
|
||
AVCodecContext* AVDecoder::codecContext() const | ||
{ | ||
return codec_ctx; | ||
} | ||
|
||
void AVDecoder::setFrame(AVFrame *frame) | ||
{ | ||
frame_ = frame; | ||
} | ||
|
||
AVFrame* AVDecoder::frame() const | ||
{ | ||
return frame_; | ||
} | ||
|
||
bool AVDecoder::decode(const QByteArray &encoded) | ||
{ | ||
decoded = encoded; | ||
return true; | ||
} | ||
|
||
QByteArray AVDecoder::data() const | ||
{ | ||
return decoded; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <QtAV/AVDemuxThread.h> | ||
|
||
namespace QtAV { | ||
AVDemuxThread::AVDemuxThread(QObject *parent) : | ||
QThread(parent) | ||
{ | ||
} | ||
|
||
|
||
void AVDemuxThread::run() | ||
{ | ||
//demuxer->read() | ||
//enqueue() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include <QtAV/AVDemuxer.h> | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#include <libavcodec/avcodec.h> | ||
#include <libavformat/avformat.h> | ||
} | ||
#endif //__cplusplus | ||
|
||
#include <QtAV/QAVPacket.h> | ||
|
||
namespace QtAV { | ||
AVDemuxer::AVDemuxer() | ||
:formatCtx(0) | ||
{ | ||
} | ||
|
||
|
||
bool AVDemuxer::readPacket(QAVPacket *packet, int stream) | ||
{ | ||
AVPacket pkt; | ||
int ret = av_read_frame(formatCtx, &pkt); | ||
|
||
if (ret == AVERROR(EAGAIN)) | ||
return true; | ||
else if (ret) | ||
return false; | ||
/* idx = pkt.stream_index; | ||
if (idx >= _streams.count()) | ||
{ | ||
loadStreams(); | ||
if ( idx >= _streams.count() ) | ||
return false; | ||
} | ||
*/ | ||
packet->data = QByteArray((const char *)pkt.data, pkt.size); | ||
#if 0 | ||
AVStream *&stream = ( AVStream *& )_streams[ idx ]; | ||
|
||
//TODO: seek by byte? | ||
if (pkt.dts == AV_NOPTS_VALUE && pkt.pts != AV_NOPTS_VALUE) | ||
packet->pts = pkt.pts; | ||
else if (pkt.dts != AV_NOPTS_VALUE) | ||
packet->pts = pkt.dts; | ||
if (packet->pts < 0.) | ||
packet->pts = 0.; | ||
packet->pts *= av_q2d(stream->time_base); | ||
if (packet->pts && packet->pts - start_time >= 0.0 ) | ||
packet->pts -= start_time; | ||
|
||
if (stream->codec->codec_type == AVMEDIA_TYPE_SUBTITLE | ||
&& ( pkt.flags & AV_PKT_FLAG_KEY ) | ||
&& pkt.convergence_duration != AV_NOPTS_VALUE) | ||
packet->duration = pkt.convergence_duration * av_q2d(stream->time_base); | ||
else if (pkt.duration > 0) | ||
packet->duration = pkt.duration * av_q2d(stream->time_base); | ||
else | ||
packet->duration = 0.; | ||
#endif | ||
return true; | ||
} | ||
|
||
} |
Oops, something went wrong.