summaryrefslogtreecommitdiffstats
path: root/k9decmpeg/kdecmpeg2.h
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:32:19 +0000
commit0d382a262c0638d0f572fc37193ccc5ed3dc895f (patch)
tree8578dcddfce4191f3f7a142a37769df7add48475 /k9decmpeg/kdecmpeg2.h
downloadk9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.tar.gz
k9copy-0d382a262c0638d0f572fc37193ccc5ed3dc895f.zip
Added old abandoned version of k9copy
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k9copy@1091546 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'k9decmpeg/kdecmpeg2.h')
-rwxr-xr-xk9decmpeg/kdecmpeg2.h99
1 files changed, 99 insertions, 0 deletions
diff --git a/k9decmpeg/kdecmpeg2.h b/k9decmpeg/kdecmpeg2.h
new file mode 100755
index 0000000..525aa27
--- /dev/null
+++ b/k9decmpeg/kdecmpeg2.h
@@ -0,0 +1,99 @@
+/**************************************************************************
+* Copyright (C) 2005 by Jean-Michel Petit *
+* *
+* 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. *
+***************************************************************************/
+
+#ifndef KDECMPEG2_H
+#define KDECMPEG2_H
+#include "k9common.h"
+#include "mpeg2.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <qimage.h>
+#include "ac.h"
+#include <qmutex.h>
+#include <qwidget.h>
+#include <qobject.h>
+#include <qthread.h>
+#include <qdatetime.h>
+/**
+ *@author
+ */
+
+class kDecMPEG2;
+
+class k9DisplayThread:public QThread {
+
+public:
+ k9DisplayThread(kDecMPEG2 *_dec) {m_dec=_dec;}
+ void setImage(QImage _image);
+ void setRawImage(uchar *_buffer,int _width,int _height,int size);
+protected:
+ kDecMPEG2 *m_dec;
+ uchar *m_buffer;
+ int m_size,m_width,m_height;
+ QImage m_image;
+ QMutex m_mutex;
+ bool m_raw;
+ void run();
+
+};
+
+class k9DecodeThread;
+
+
+class kDecMPEG2 : public QObject {
+Q_OBJECT
+public:
+ kDecMPEG2(k9DecodeThread *_thread);
+ kDecMPEG2();
+ ~kDecMPEG2();
+ int decode (uint8_t * buf, uint8_t * end, int flags);
+ void restart();
+ void start();
+ void stop();
+ void pause();
+ void draw(QImage *image) {emit pixmapReady(image);}
+ void drawRaw(uchar *_buffer,int width,int height,int size) {emit ppmReady (_buffer,width,height,size);}
+
+ void setUseGL(bool _value) {m_useGL = _value;}
+
+private:
+ bool m_useGL;
+ bool m_pause;
+ k9DecodeThread *m_thread;
+ QImage pix;
+ QTime m_timer;
+ bool m_opened;
+ int demux_pid;
+ int demux_track;
+ QMutex mutex;
+ mpeg2dec_t * decoder;
+ k9DisplayThread *m_display;
+ int demux (uint8_t * buf, uint8_t * end, int flags);
+ void save_ppm (int width, int height, uint8_t * buf, int num);
+ void decode_mpeg2(uint8_t * current, uint8_t * end);
+ void init();
+ void sync();
+ signals: // Signals
+ /** No descriptions */
+ void pixmapReady(QImage *image);
+ void ppmReady(uchar *buffer,int width,int height,int size);
+};
+
+#endif