Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linuxtv-softmpeg] Patch to enable pause and ffwd/rewind with VDR
- To: <linuxtv-softmpeg@linuxtv.org>
- Subject: [linuxtv-softmpeg] Patch to enable pause and ffwd/rewind with VDR
- From: <ac2crp@blueyonder.co.uk>
- Date: Wed, 21 Apr 2004 17:39:24 +0100
- Content-class: urn:content-classes:message
- Content-transfer-encoding: quoted-printable
- Content-type: text/plain;charset="Windows-1252"
- Sender: linuxtv-softmpeg-bounce@linuxtv.org
- Thread-index: AcQnvzQ7lmVx6fwTR7GIh8P3aOmxgw==
- Thread-topic: Patch to enable pause and ffwd/rewind with VDR
Hi,
Enclosed is a patch to enable pause and fast forward/rewind to work with libsoft mpeg and VDR.
Pause seems to work OK. I'm not quite sure if I'm handling forward/rewind properly - it winds perhaps rather too quickly. I'm not sure if I'm teeling it to resync correctly when wind stops - there are a few errors on the screen.
Colin
debian:~/DEVELOPMENT/libsoftmpeg_cle266/softmpeg# cvs diff -c softmpeg.c
Index: softmpeg.c
===================================================================
RCS file: /cvs/linuxtv/libsoftmpeg/softmpeg/softmpeg.c,v
retrieving revision 1.6
diff -c -r1.6 softmpeg.c
*** softmpeg.c 17 Mar 2004 15:17:32 -0000 1.6
--- softmpeg.c 21 Apr 2004 16:35:43 -0000
***************
*** 17,22 ****
--- 17,23 ----
#include <sys/ioctl.h>
#include "i18n.h"
+
//#include <dfb++/dfb++.h>
#include <directfb.h>
#include "softmpeg.h"
***************
*** 267,272 ****
--- 268,275 ----
virtual cOsdObject *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
+
+
};
// Global variables that control the overall behaviour:
***************
*** 292,297 ****
--- 295,307 ----
virtual int ProvidesCa(const cChannel*);
virtual cOsdBase *NewOsd(int x, int y);
+ private:
+ bool freezeModeEnabled;
+
+ cMutex playMutex;
+ cCondVar readyForPlayCondVar;
+
+
};
cSoftMPEG::cSoftMPEG()
***************
*** 305,310 ****
--- 315,322 ----
dfb_init(NULL, NULL);
+ freezeModeEnabled = false;
+
init.window_id = windowid;
init.layer_id = layerid;
init.width = 720;
***************
*** 380,386 ****
void cSoftMPEG::TrickSpeed(int Speed)
{
! fprintf(stderr, "[softmpeg] Trickspeed %d\n",Speed);
}
void cSoftMPEG::Clear(void)
--- 392,403 ----
void cSoftMPEG::TrickSpeed(int Speed)
{
! printf( "[softmpeg] Trickspeed %d\n",Speed);
!
! // Disable AV sync...
!
! softmpeg_decoder_set_av_sync(d,false);
!
}
void cSoftMPEG::Clear(void)
***************
*** 390,401 ****
void cSoftMPEG::Play(void)
{
! fprintf(stderr, "[softmpeg] Play\n");
}
void cSoftMPEG::Freeze(void)
{
! fprintf(stderr, "[softmpeg] Freeze\n");
}
void cSoftMPEG::Mute(void)
--- 407,434 ----
void cSoftMPEG::Play(void)
{
! printf( "[softmpeg] Play\n");
!
! softmpeg_decoder_set_mode(d,SOFTMPEG_PLAY,0.0);
!
!
! playMutex.Lock();
! freezeModeEnabled = false;
! playMutex.Unlock();
! readyForPlayCondVar.Broadcast();
!
}
void cSoftMPEG::Freeze(void)
{
! printf( "[softmpeg] Freeze\n");
!
! playMutex.Lock();
! freezeModeEnabled = true;
! playMutex.Unlock();
!
! softmpeg_decoder_set_mode(d,SOFTMPEG_PAUSE,0.0);
!
}
void cSoftMPEG::Mute(void)
***************
*** 418,423 ****
--- 451,464 ----
req.tv_nsec = 20*1000*1000;
nanosleep(&req, NULL);
*/
+
+ playMutex.Lock();
+
+ if (freezeModeEnabled)
+ readyForPlayCondVar.TimedWait(playMutex,TimeoutMs);
+
+ playMutex.Unlock();
+
return true;
}
***************
*** 430,435 ****
--- 471,486 ----
int cSoftMPEG::PlayVideo(const uchar * Data, int Length)
{
int delay = 0;
+ bool freezeMode;
+
+ playMutex.Lock();
+ freezeMode = freezeModeEnabled;
+ playMutex.Unlock();
+
+ if (freezeMode)
+ return 0;
+
+
// fprintf(stderr, "[softmpeg] PlayVideo: %d bytes\n",Length);
delay = softmpeg_decoder_process_pes_data(d,(unsigned char*)Data,Length);
if (0 != delay) {
--
Info: To unsubscribe send a mail to ecartis@linuxtv.org with
"unsubscribe linuxtv-softmpeg" as subject.
Home |
Main Index |
Thread Index