From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- mpeglib/lib/decoder/mpegPlugin.cpp | 160 +++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 mpeglib/lib/decoder/mpegPlugin.cpp (limited to 'mpeglib/lib/decoder/mpegPlugin.cpp') diff --git a/mpeglib/lib/decoder/mpegPlugin.cpp b/mpeglib/lib/decoder/mpegPlugin.cpp new file mode 100644 index 00000000..e230adb5 --- /dev/null +++ b/mpeglib/lib/decoder/mpegPlugin.cpp @@ -0,0 +1,160 @@ +/* + mpeg player plugin + Copyright (C) 1999 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 "mpegPlugin.h" + +#include "../mpegplay/mpegVideoStream.h" +#include "../mpegplay/proto.h" +#include "../mpegplay/mpegVideoHeader.h" + +using namespace std; + + +MpegPlugin::MpegPlugin() { + init(); +} + + +MpegPlugin::~MpegPlugin() { +} + + +void MpegPlugin::init() { + lCalcLength=false; + mpegVideoHeader=NULL; + mpegVideoStream=NULL; +} + + +void MpegPlugin::decoder_loop() { + + + VideoDecoder* video=NULL; + if (input == NULL) { + cout << "MpegPlugin::decoder_loop input is NULL"<firstInitialize(mpegVideoHeader)==false) { + + } else { + pluginInfo->setLength(getSongLength()); + + // now create pictureArray from the sequence + int width=mpegVideoHeader->getMB_Width()*16; + int height=mpegVideoHeader->getMB_Height()*16; + + output->openWindow(width,height,(char*)"kmpg"); + video=new VideoDecoder(mpegVideoStream,mpegVideoHeader); + setStreamState(_STREAM_STATE_INIT); + } + break; + case _STREAM_STATE_INIT : + // cout << "mpeg _STREAM_STATE_INI"<nextGOP()==false) { + continue; + } + video->resyncToI_Frame(); + } + if (skipMode==_SYNC_TO_PIC) { + if (mpegVideoStream->nextPIC()==false) { + continue; + } + } + skipMode=_SYNC_TO_NONE; + setStreamState(_STREAM_STATE_PLAY); + break; + case _STREAM_STATE_PLAY : + pictureArray=output->lockPictureArray(); + skipMode=video->mpegVidRsrc(pictureArray); + + if (skipMode != _SYNC_TO_NONE) { + setStreamState(_STREAM_STATE_INIT); + } + pic=pictureArray->getYUVPictureCallback(); + if (pic == NULL) { + // nothin to display + break; + } + + output->unlockPictureArray(pictureArray); + pictureArray->setYUVPictureCallback(NULL); + break; + case _STREAM_STATE_WAIT_FOR_END: + // exit while loop + lDecoderLoop=false; + break; + default: + cout << "unknown stream state:"<flushWindow(); + // copy sequence back if needed + if (video != NULL) { + delete video; + } + delete mpegVideoStream; + delete mpegVideoHeader; + mpegVideoStream=NULL; + mpegVideoHeader=NULL; +} + + + + + +// here we can config our decoder with special flags +void MpegPlugin::config(const char* key,const char* value,void* user_data) { + if (strcmp(key,"-c")==0) { + lCalcLength=false; + } + + if (strcmp(key,"decode")==0) { + if (strcmp(value,"true")==0) { + lDecode=true; + } else { + lDecode=false; + } + } + DecoderPlugin::config(key,value,user_data); +} + + + +int MpegPlugin::getSongLength() { + int back=0; + return back; +} + + + + + + -- cgit v1.2.1