summaryrefslogtreecommitdiffstats
path: root/mpeglib/lib/yuv
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /mpeglib/lib/yuv
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'mpeglib/lib/yuv')
-rw-r--r--mpeglib/lib/yuv/Makefile.am28
-rw-r--r--mpeglib/lib/yuv/yuvPlugin.cpp158
-rw-r--r--mpeglib/lib/yuv/yuvPlugin.h47
3 files changed, 233 insertions, 0 deletions
diff --git a/mpeglib/lib/yuv/Makefile.am b/mpeglib/lib/yuv/Makefile.am
new file mode 100644
index 00000000..b8d7155d
--- /dev/null
+++ b/mpeglib/lib/yuv/Makefile.am
@@ -0,0 +1,28 @@
+# libplayerplugin - Makefile.am
+
+INCLUDES = $(all_includes)
+
+noinst_LTLIBRARIES = libyuvPlugin.la
+
+
+noinst_HEADERS =
+
+kmpgincludedir = $(includedir)/$(THIS_LIB_NAME)/decoder
+
+kmpginclude_HEADERS = yuvPlugin.h
+
+libyuvPlugin_la_SOURCES = yuvPlugin.cpp
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mpeglib/lib/yuv/yuvPlugin.cpp b/mpeglib/lib/yuv/yuvPlugin.cpp
new file mode 100644
index 00000000..94697aa8
--- /dev/null
+++ b/mpeglib/lib/yuv/yuvPlugin.cpp
@@ -0,0 +1,158 @@
+/*
+ raw yuv stream player
+ Copyright (C) 2000 Martin Vogt
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation.
+
+ For more information look at the file COPYRIGHT in this package
+
+ */
+
+
+#include "yuvPlugin.h"
+
+#include <iostream>
+
+using namespace std;
+
+
+YUVPlugin::YUVPlugin() {
+ init();
+}
+
+
+YUVPlugin::~YUVPlugin() {
+}
+
+
+void YUVPlugin::init() {
+ lCalcLength=false;
+ nWidth=0;
+ nHeight=0;
+ imageType=PICTURE_YUVMODE_CR_CB;
+ picPerSec=1.0;
+}
+
+
+void YUVPlugin::decoder_loop() {
+
+
+
+ cout << "YUVPlugin::decoder_loop() 1"<<endl;
+ if (input == NULL) {
+ cout << "YUVPlugin::decoder_loop input is NULL"<<endl;
+ exit(0);
+ }
+ if (output == NULL) {
+ cout << "YUVPlugin::decoder_loop output is NULL"<<endl;
+ exit(0);
+ }
+
+
+ PictureArray* pictureArray;
+
+
+ int bytes=nWidth*nHeight;
+
+ if ( (imageType == PICTURE_YUVMODE_CR_CB) ||
+ (imageType == PICTURE_YUVMODE_CB_CR) ) {
+ bytes=bytes+bytes/2;
+ }
+ if ( (imageType == PICTURE_RGB) ||
+ (imageType == PICTURE_RGB_FLIPPED) ) {
+ bytes=bytes*4;
+ }
+
+
+
+
+ // decode loop
+ while(runCheck()) {
+ switch(streamState) {
+ case _STREAM_STATE_FIRST_INIT :
+ output->openWindow(nWidth,nHeight,(char*)"yuv Viewer");
+ pictureArray=output->lockPictureArray();
+ cout << "pictureArray->setImageType"<<endl;
+ pictureArray->setImageType(imageType);
+
+ setStreamState(_STREAM_STATE_INIT);
+ break;
+ case _STREAM_STATE_INIT :
+ setStreamState(_STREAM_STATE_PLAY);
+ break;
+ case _STREAM_STATE_PLAY : {
+ // we read from input raw yuv bytes
+ // and display them.
+ pictureArray=output->lockPictureArray();
+ // now we have the color info
+ YUVPicture* pic=pictureArray->getPast();
+ unsigned char* dest=pic->getImagePtr();
+ input->read((char*)dest,bytes);
+ pic->setPicturePerSecond(picPerSec);
+ // now inform subsystem about the frame to display
+ pictureArray->setYUVPictureCallback(pic);
+ // display it
+ output->unlockPictureArray(pictureArray);
+
+ pictureArray->setYUVPictureCallback(NULL);
+ break;
+ }
+ case _STREAM_STATE_WAIT_FOR_END:
+ // exit while loop
+ lDecoderLoop=false;
+ cout << "mpegplugin _STREAM_STATE_WAIT_FOR_END"<<endl;
+ break;
+ default:
+ cout << "unknown stream state:"<<streamState<<endl;
+ }
+ }
+
+ cout << "*********mpegPLugin exit"<<endl;
+
+ output->flushWindow();
+ // copy sequence back if needed
+
+ cout << "delete mpegVideoStream"<<endl;
+
+}
+
+
+
+
+
+// here we can config our decoder with special flags
+void YUVPlugin::config(const char* key,const char* value,void* user_data) {
+ if (strcmp(key,"-c")==0) {
+ lCalcLength=false;
+ }
+
+ if (strcmp(key,"height")==0) {
+ nHeight=atoi(value);
+ }
+ if (strcmp(key,"width")==0) {
+ nWidth=atoi(value);
+ }
+ if (strcmp(key,"imageType")==0) {
+ imageType=atoi(value);
+ cout << "imageType:"<<imageType<<endl;
+ }
+ if (strcmp(key,"picPerSec")==0) {
+ picPerSec=atoi(value);
+ }
+ DecoderPlugin::config(key,value,user_data);
+}
+
+
+
+int YUVPlugin::getSongLength() {
+ int back=0;
+ return back;
+}
+
+
+
+
+
+
diff --git a/mpeglib/lib/yuv/yuvPlugin.h b/mpeglib/lib/yuv/yuvPlugin.h
new file mode 100644
index 00000000..4a5dc72b
--- /dev/null
+++ b/mpeglib/lib/yuv/yuvPlugin.h
@@ -0,0 +1,47 @@
+/*
+ raw yuv stream player
+ Copyright (C) 2000 Martin Vogt
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation.
+
+ For more information look at the file COPYRIGHT in this package
+
+ */
+
+
+
+
+
+#ifndef __YUVPLUGIN_H
+#define __YUVPLUGIN_H
+
+#include "../decoder/decoderPlugin.h"
+#include <kdemacros.h>
+
+class KDE_EXPORT YUVPlugin : public DecoderPlugin {
+
+ int lCalcLength;
+ int nWidth;
+ int nHeight;
+ int imageType;
+ float picPerSec;
+
+ public:
+ YUVPlugin();
+ ~YUVPlugin();
+
+ void decoder_loop();
+ void config(const char* key,const char* value,void* user_data);
+
+
+ private:
+ void init();
+
+ int getSongLength();
+
+
+};
+
+#endif