diff options
author | 2006-05-21 16:54:30 +0000 | |
---|---|---|
committer | 2006-05-21 16:54:30 +0000 | |
commit | 4c4e31f15350bab7a8d75f156371ecaa1be745c8 (patch) | |
tree | 9d4b17490dfa5a35240caacb023e9a39d6136d7e /media-plugins | |
parent | added to ~mips for testing (diff) | |
download | historical-4c4e31f15350bab7a8d75f156371ecaa1be745c8.tar.gz historical-4c4e31f15350bab7a8d75f156371ecaa1be745c8.tar.bz2 historical-4c4e31f15350bab7a8d75f156371ecaa1be745c8.zip |
added a shm-bugfix and a partial threading-cleanup-patch
Package-Manager: portage-2.1_rc1-r3
Diffstat (limited to 'media-plugins')
6 files changed, 745 insertions, 8 deletions
diff --git a/media-plugins/vdr-softdevice/ChangeLog b/media-plugins/vdr-softdevice/ChangeLog index 8a13fd29eab9..3e51de434088 100644 --- a/media-plugins/vdr-softdevice/ChangeLog +++ b/media-plugins/vdr-softdevice/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for media-plugins/vdr-softdevice # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-plugins/vdr-softdevice/ChangeLog,v 1.3 2006/05/19 13:53:24 zzam Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-plugins/vdr-softdevice/ChangeLog,v 1.4 2006/05/21 16:54:30 zzam Exp $ + +*vdr-softdevice-0.2.3.20060511-r3 (21 May 2006) + + 21 May 2006; Matthias Schwarzott <zzam@gentoo.org> + +files/vdr-softdevice-0.2.3-shm-key-init.diff, + +files/vdr-softdevice-0.2.3-threading.diff, + +vdr-softdevice-0.2.3.20060511-r3.ebuild: + added a shm-bugfix and a partial threading-cleanup-patch *vdr-softdevice-0.2.3.20060511-r2 (19 May 2006) diff --git a/media-plugins/vdr-softdevice/Manifest b/media-plugins/vdr-softdevice/Manifest index c2f24d1b36d8..51cfe2d36355 100644 --- a/media-plugins/vdr-softdevice/Manifest +++ b/media-plugins/vdr-softdevice/Manifest @@ -13,6 +13,14 @@ AUX vdr-softdevice-0.2.3-shm-contrast.diff 466 RMD160 09058ab3a04eb8d69c8bbfe936 MD5 3821a820f06a15e0f9570de3e8236ecd files/vdr-softdevice-0.2.3-shm-contrast.diff 466 RMD160 09058ab3a04eb8d69c8bbfe936c4f5bfc2c924f3 files/vdr-softdevice-0.2.3-shm-contrast.diff 466 SHA256 d52414ab2236e5c446c9db2d27087189d948ec178e04ecba0b2b1a13432c559a files/vdr-softdevice-0.2.3-shm-contrast.diff 466 +AUX vdr-softdevice-0.2.3-shm-key-init.diff 463 RMD160 7e6f0de8b191fc778953a26455b86608b231cd63 SHA1 d0c7e8d69c54acd038643d037e882e10e9182d1f SHA256 5dee8605967fafa4714b5f0f3d93892606c414655249c331df6027e6b3b5fc2c size 463 +MD5 1160a43a1604711610aa7adadf609da0 files/vdr-softdevice-0.2.3-shm-key-init.diff 463 +RMD160 7e6f0de8b191fc778953a26455b86608b231cd63 files/vdr-softdevice-0.2.3-shm-key-init.diff 463 +SHA256 5dee8605967fafa4714b5f0f3d93892606c414655249c331df6027e6b3b5fc2c files/vdr-softdevice-0.2.3-shm-key-init.diff 463 +AUX vdr-softdevice-0.2.3-threading.diff 15880 RMD160 ef9d0a81485a9dd07ceff0bc5d3ffa07d1697009 SHA1 77a98b23f9e8a98f4a71de7645f208bba41e3b67 SHA256 6b13b52822c2d99a1592fb82141dcc5e1b9be94c99dc37d88c6cec251a5cf1be size 15880 +MD5 6dc8a6d12ff94b70d07ed50594c10587 files/vdr-softdevice-0.2.3-threading.diff 15880 +RMD160 ef9d0a81485a9dd07ceff0bc5d3ffa07d1697009 files/vdr-softdevice-0.2.3-threading.diff 15880 +SHA256 6b13b52822c2d99a1592fb82141dcc5e1b9be94c99dc37d88c6cec251a5cf1be files/vdr-softdevice-0.2.3-threading.diff 15880 AUX vdr-softdevice-0.2.3-xv-settings.diff 3160 RMD160 787e9f8b371047ca14269ce70273fe03e17b0787 SHA1 8e887a659f19554434bd99ee87182b7329f69d6c SHA256 b9e4e1983969cd09c7219c4a3c00750c12a116bdb406418beb3e2e7df9e70ab7 size 3160 MD5 eaf618bbc005045f78b01b542d792878 files/vdr-softdevice-0.2.3-xv-settings.diff 3160 RMD160 787e9f8b371047ca14269ce70273fe03e17b0787 files/vdr-softdevice-0.2.3-xv-settings.diff 3160 @@ -34,6 +42,10 @@ EBUILD vdr-softdevice-0.2.3.20060511-r2.ebuild 2373 RMD160 fbf8bb95c6c3fa4c60c30 MD5 83f2c658ff226cf1021634631ccc6aef vdr-softdevice-0.2.3.20060511-r2.ebuild 2373 RMD160 fbf8bb95c6c3fa4c60c30e8969f5e4e2a8084d38 vdr-softdevice-0.2.3.20060511-r2.ebuild 2373 SHA256 ec2886cb526c242999430cda82ed22211557925bf46c9788e3d1b520fc1fcefd vdr-softdevice-0.2.3.20060511-r2.ebuild 2373 +EBUILD vdr-softdevice-0.2.3.20060511-r3.ebuild 2476 RMD160 107479aef66cb7df02553d7edd7373ace2e86d24 SHA1 975f804a13708d4a48dbc7efdd43b6c38f97e302 SHA256 ce012c4002f61e98187aee01280b7f1c7e92be41fa7c324d2f1bd3804ebed125 size 2476 +MD5 278c40f884539863137f4d280a9ad08e vdr-softdevice-0.2.3.20060511-r3.ebuild 2476 +RMD160 107479aef66cb7df02553d7edd7373ace2e86d24 vdr-softdevice-0.2.3.20060511-r3.ebuild 2476 +SHA256 ce012c4002f61e98187aee01280b7f1c7e92be41fa7c324d2f1bd3804ebed125 vdr-softdevice-0.2.3.20060511-r3.ebuild 2476 EBUILD vdr-softdevice-0.2.3.20060511.ebuild 2219 RMD160 dab0cfa472a0252408efd5e993e8da2e0f610778 SHA1 81414ab5af9b749895f3870cba26f20f4e1835f5 SHA256 4dba99bb2e88dcecc6ceb10c156028487b0c2072a37b3acc3b61f3c02275497c size 2219 MD5 d3c67c8e9e65356185cf00f4cc51d022 vdr-softdevice-0.2.3.20060511.ebuild 2219 RMD160 dab0cfa472a0252408efd5e993e8da2e0f610778 vdr-softdevice-0.2.3.20060511.ebuild 2219 @@ -42,10 +54,10 @@ EBUILD vdr-softdevice-0.2.3a.ebuild 1321 RMD160 686fb334913ed010a790f06d38772655 MD5 cf7919c2cd4eae6d4a59233ad97a790a vdr-softdevice-0.2.3a.ebuild 1321 RMD160 686fb334913ed010a790f06d38772655601d9a0e vdr-softdevice-0.2.3a.ebuild 1321 SHA256 41144f94417e747f4539d5bd04adcbb9f70e3f12088eaa5c5b62ea373de4a54a vdr-softdevice-0.2.3a.ebuild 1321 -MISC ChangeLog 1072 RMD160 f2f349d84bcb417c82631bed5642a40c912cfcd0 SHA1 e514ba6ee82e8b2b6bc20025a3edf99d1920e867 SHA256 b0cf70d0e73cbc48435148cc4e3b55f86a5b2fee6fc34986cb60cbe967f21661 size 1072 -MD5 1ac0845bea258ec658c049e051141258 ChangeLog 1072 -RMD160 f2f349d84bcb417c82631bed5642a40c912cfcd0 ChangeLog 1072 -SHA256 b0cf70d0e73cbc48435148cc4e3b55f86a5b2fee6fc34986cb60cbe967f21661 ChangeLog 1072 +MISC ChangeLog 1373 RMD160 6caffbc9c0dfc6efa9136820f7fcbd434e0131a1 SHA1 7c11f00db018476542f6d998803b70cf648b06e8 SHA256 36d0048c157aba202ccc7aaf272baab3551aac807e43f4b50ddd9540e53ee7fe size 1373 +MD5 db39b5da418bfdc19524ba188abba163 ChangeLog 1373 +RMD160 6caffbc9c0dfc6efa9136820f7fcbd434e0131a1 ChangeLog 1373 +SHA256 36d0048c157aba202ccc7aaf272baab3551aac807e43f4b50ddd9540e53ee7fe ChangeLog 1373 MISC metadata.xml 300 RMD160 c85719cef743cf573efe73f8f84564292085c91c SHA1 4c00933e1ed60039fae091034d83e28d0890e87c SHA256 29feafd8b7177b65f8bd92553ac96779d9a91e3b7b4eeecfb0924eb7b6979587 size 300 MD5 7c30ab7528b676a1a0c2737821599b29 metadata.xml 300 RMD160 c85719cef743cf573efe73f8f84564292085c91c metadata.xml 300 @@ -59,13 +71,16 @@ SHA256 5d9d302686e0c254357af9482fb419c4510e73882e820f3bfcf76387d49be011 files/di MD5 c7a0fabecfebf2988f2c1552b361c1ae files/digest-vdr-softdevice-0.2.3.20060511-r2 256 RMD160 498e786a7b8110e307aa41c04ed04d88aade4653 files/digest-vdr-softdevice-0.2.3.20060511-r2 256 SHA256 5d9d302686e0c254357af9482fb419c4510e73882e820f3bfcf76387d49be011 files/digest-vdr-softdevice-0.2.3.20060511-r2 256 +MD5 c7a0fabecfebf2988f2c1552b361c1ae files/digest-vdr-softdevice-0.2.3.20060511-r3 256 +RMD160 498e786a7b8110e307aa41c04ed04d88aade4653 files/digest-vdr-softdevice-0.2.3.20060511-r3 256 +SHA256 5d9d302686e0c254357af9482fb419c4510e73882e820f3bfcf76387d49be011 files/digest-vdr-softdevice-0.2.3.20060511-r3 256 MD5 c7a0fabecfebf2988f2c1552b361c1ae files/digest-vdr-softdevice-0.2.3a 256 RMD160 498e786a7b8110e307aa41c04ed04d88aade4653 files/digest-vdr-softdevice-0.2.3a 256 SHA256 5d9d302686e0c254357af9482fb419c4510e73882e820f3bfcf76387d49be011 files/digest-vdr-softdevice-0.2.3a 256 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) -iD8DBQFEbc3gZfSl1Kp5KmoRAkplAKDBD9UBeqh6zotF1fdA12RszoUr3gCgzMzN -TMBpB0bDi438SBs+Ddmis4M= -=cX0N +iD8DBQFEcJtVZfSl1Kp5KmoRAi8rAKDRoF14Dmdtsv3tyUXzGPsswO7IcgCgkCg5 +G6BiEOTY6qCoH4PtxyPf2uw= +=c3XR -----END PGP SIGNATURE----- diff --git a/media-plugins/vdr-softdevice/files/digest-vdr-softdevice-0.2.3.20060511-r3 b/media-plugins/vdr-softdevice/files/digest-vdr-softdevice-0.2.3.20060511-r3 new file mode 100644 index 000000000000..cb395c04db4b --- /dev/null +++ b/media-plugins/vdr-softdevice/files/digest-vdr-softdevice-0.2.3.20060511-r3 @@ -0,0 +1,3 @@ +MD5 dfae4ed2ab2bb17572de993461cf36f8 vdr-softdevice-0.2.3a.tgz 133780 +RMD160 d97d7a1bbe4a3b325041bbe0e7ef23740f8121b1 vdr-softdevice-0.2.3a.tgz 133780 +SHA256 bbf05254ce6f0559ce6aeed055272ba6fb207ba443a49926b91506e9de69ab92 vdr-softdevice-0.2.3a.tgz 133780 diff --git a/media-plugins/vdr-softdevice/files/vdr-softdevice-0.2.3-shm-key-init.diff b/media-plugins/vdr-softdevice/files/vdr-softdevice-0.2.3-shm-key-init.diff new file mode 100644 index 000000000000..321b199a6d20 --- /dev/null +++ b/media-plugins/vdr-softdevice/files/vdr-softdevice-0.2.3-shm-key-init.diff @@ -0,0 +1,12 @@ +diff -ru softdevice-0.2.3.cvs/video-shm.c softdevice-0.2.3.cvs-shm-key-init/video-shm.c +--- softdevice-0.2.3.cvs/video-shm.c 2006-05-14 21:56:07.000000000 +0200 ++++ softdevice-0.2.3.cvs-shm-key-init/video-shm.c 2006-05-21 17:43:07.000000000 +0200 +@@ -122,7 +122,7 @@ + //ctl->pict_shmid=-1; + curr_pict=NULL; + osd_surface=NULL; +- ctl->key=kNone; ++ ctl->key=NO_KEY; + remote = new cShmRemote("softdevice-xv",this); + }; + diff --git a/media-plugins/vdr-softdevice/files/vdr-softdevice-0.2.3-threading.diff b/media-plugins/vdr-softdevice/files/vdr-softdevice-0.2.3-threading.diff new file mode 100644 index 000000000000..9c7a48fef555 --- /dev/null +++ b/media-plugins/vdr-softdevice/files/vdr-softdevice-0.2.3-threading.diff @@ -0,0 +1,594 @@ +diff -ru softdevice-orig/mpeg2decoder.c softdevice/mpeg2decoder.c +--- softdevice-orig/mpeg2decoder.c 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/mpeg2decoder.c 2006-05-21 18:35:43.000000000 +0200 +@@ -146,14 +146,12 @@ + + // Context->debug |=0xF|FF_DEBUG_STARTCODE|FF_DEBUG_PTS; + // av_log_set_level(AV_LOG_DEBUG); +- active=true; + Start(); // starte thread + } + + cStreamDecoder::~cStreamDecoder() + { + CMDDEB("~cStreamDecoder: context %p\n",context ); +- active=false; + Cancel(3); + if (codec && context) + avcodec_close(context); +@@ -165,21 +163,20 @@ + void cStreamDecoder::Action() + { + CMDDEB("Neuer Thread gestartet: pid:%d type %d\n",getpid(),context->codec_type ); +- running=true; + freezeMode=false; + AVPacket *pkt; + +- while ( PacketQueue.Available() < 7 && active) { ++ while ( PacketQueue.Available() < 7 && Running()) { + BUFDEB("wait while loop packets %d StreamDecoder pid:%d type %d\n", + PacketQueue.Available(),getpid(),context->codec_type ); + usleep(10000); + }; + +- while(active) ++ while(Running()) + { + BUFDEB("while loop start StreamDecoder pid:%d type %d\n",getpid(),context->codec_type ); + +- while (freezeMode && active) ++ while (freezeMode && Running()) + usleep(50000); + + mutex.Lock(); +@@ -210,7 +207,6 @@ + #endif + + } +- running=false; + CMDDEB("thread finished pid: %d type %d \n",getpid(),context->codec_type ); + } + +@@ -230,7 +226,6 @@ + void cStreamDecoder::Stop(void) + { + CMDDEB("cStreamDecoder::Stop\n"); +- active=false; + if (syncTimer) + syncTimer->Signal(); + mutex.Lock(); +@@ -419,7 +414,7 @@ + break; + } + } +- while ( size > 0 && active ) { ++ while ( size > 0 && Running() ) { + BUFDEB("start decode audio. pkt size: %d \n",size); + len=avcodec_decode_audio(context, (short *)audiosamples, + &audio_size, data, size); +@@ -1113,7 +1108,6 @@ + + StreamBuffer=NULL; + +- running=false; + decoding=false; + IsSuspended=false; + Speed=1; +@@ -1147,7 +1141,7 @@ + start: + int count=0; + size=StreamBuffer->Available(); +- while ( size < buf_size && ThreadActive ++ while ( size < buf_size && Running() + && count < 1 ) { + BUFDEB("read_packet EnableGet.Sleep start\n"); + EnableGetSignal.Sleep(50000); +@@ -1160,7 +1154,7 @@ + }; + + // signal eof if thread should end... +- if (!ThreadActive && size == 0) ++ if (!Running() && size == 0) + return -1; + + size = buf_size; +@@ -1177,7 +1171,7 @@ + return size; + } else { + BUFDEB("read_packet u is NULL!!!\n"); +- if (ThreadActive) { ++ if (Running()) { + //try again... + usleep(10000); + goto start; +@@ -1214,16 +1208,14 @@ + void cMpeg2Decoder::Action() + { + CMDDEB("Neuer Thread gestartet: Mpeg2Decoder pid %d\n",getpid()); +- ThreadRunning=true; +- //ThreadActive=true; + AVPacket pkt; + int ret; + int PacketCount=0; + + int nStreams=0; + +- while(ThreadActive) { +- while (freezeMode && ThreadActive) ++ while(Running()) { ++ while (freezeMode && Running()) + usleep(50000); + + BUFDEB("av_read_frame start\n"); +@@ -1231,7 +1223,7 @@ + ret = av_read_packet(ic, &pkt); + if (ret < 0) { + BUFDEB("cMpeg2Decoder Stream Error!\n"); +- if (ThreadActive) ++ if (Running()) + usleep(10000); + continue; + } +@@ -1260,7 +1252,6 @@ + // if (PacketCount == 200) + // dump_format(ic, 0, "test", 0); + } +- running=false; + CMDDEB("Thread beendet : mpegDecoder pid %d\n",getpid()); + } + +@@ -1371,7 +1362,7 @@ + voutMutex.Lock(); + if ( packet_type == CODEC_TYPE_VIDEO && vout ) { + BUFDEB("QueuePacket video stream\n"); +- while ( vout->PutPacket(pkt) == -1 && ThreadActive ) { ++ while ( vout->PutPacket(pkt) == -1 && Running() ) { + // PutPacket sleeps is necessary + //printf("Video Buffer full\n"); + }; +@@ -1381,7 +1372,7 @@ + aoutMutex.Lock(); + if ( packet_type == CODEC_TYPE_AUDIO && aout ) { + BUFDEB("QueuePacket audio stream\n"); +- while ( aout->PutPacket(pkt) == -1 && ThreadActive ) { ++ while ( aout->PutPacket(pkt) == -1 && Running() ) { + // PutPacket sleeps is necessary + //printf("Audio Buffer full\n"); + }; +@@ -1398,7 +1389,7 @@ + void cMpeg2Decoder::Start(bool GetMutex) + { + CMDDEB("Mpeg2Decoder Start IsSuspended %d GetMutex %d\n",IsSuspended,GetMutex); +- if (running) ++ if (Running()) + return; + + if (IsSuspended) +@@ -1416,12 +1407,10 @@ + StreamBuffer->Clear(); + initStream(); + +- ThreadActive=true; + freezeMode=false; + AudioIdx=NO_STREAM; + VideoIdx=NO_STREAM; + cThread::Start(); +- running=true; + if (GetMutex) + mutex.Unlock(); + CMDDEB("mpeg2Decoder Start finished"); +@@ -1464,7 +1453,7 @@ + { + CMDDEB("Play\n"); + freezeMode=false; +- if (running) ++ if (Running()) + { + aoutMutex.Lock(); + if (aout) +@@ -1510,7 +1499,7 @@ + // sleep a short while before putting the + // audio and video stream decoders to sleep + usleep(20000); +- if (running) ++ if (Running()) + { + if (Stream & SOFTDEVICE_AUDIO_STREAM) { + aoutMutex.Lock(); +@@ -1538,10 +1527,8 @@ + // can't stop properly in freeze mode + // Freeze(); + freezeMode=false; +- if (running) ++ if (Running()) + { +- running=false; +- ThreadActive=false; + + StreamBuffer->Clear(); + EnableGetSignal.Signal(); +@@ -1649,7 +1636,7 @@ + } else if (AudioIdx==DONT_PLAY) + AudioIdx=NO_STREAM; + Play(); +- if (running) ++ if (Running()) + { + aoutMutex.Lock(); + if (aout) +@@ -1674,7 +1661,7 @@ + /* ---------------------------------------------------------------------------- + */ + int64_t cMpeg2Decoder::GetSTC(void) { +- if (running) { ++ if (Running()) { + return clock.GetPTS()*9; + /* + if (vout) +@@ -1719,15 +1706,15 @@ + { + BUFDEB("Decode %p, Length %d\n",Data,Length); + +- if (running && !IsSuspended && setupStore.shouldSuspend) ++ if (Running() && !IsSuspended && setupStore.shouldSuspend) + // still running and should suspend + Suspend(); + +- if (!running && IsSuspended && !setupStore.shouldSuspend) ++ if (!Running() && IsSuspended && !setupStore.shouldSuspend) + // not running and should resume + Resume(); + +- if (!running) { ++ if (!Running()) { + BUFDEB("not running..\n"); + return Length; + }; +diff -ru softdevice-orig/mpeg2decoder.h softdevice/mpeg2decoder.h +--- softdevice-orig/mpeg2decoder.h 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/mpeg2decoder.h 2006-05-21 18:33:48.000000000 +0200 +@@ -161,8 +161,6 @@ + AVCodecContext *context; + + cMutex mutex; +- volatile bool active; +- bool running; + + virtual void Action(void); + virtual int DecodePacket(AVPacket *pkt) = 0; +@@ -282,7 +280,6 @@ + cMutex aoutMutex; + cAudioOut *audioOut; + cVideoOut *videoOut; +- bool running; + bool IsSuspended; + bool decoding; + bool freezeMode; +@@ -295,7 +292,6 @@ + cSoftRingBufferLinear *StreamBuffer; + void initStream(); + virtual void Action(void); +- volatile bool ThreadActive, ThreadRunning; + cClock clock; + //demuxing + int AudioIdx; +diff -ru softdevice-orig/SoftOsd.c softdevice/SoftOsd.c +--- softdevice-orig/SoftOsd.c 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/SoftOsd.c 2006-05-21 18:14:26.000000000 +0200 +@@ -32,7 +32,7 @@ + */ + + cSoftOsd::cSoftOsd(cVideoOut *VideoOut, int X, int Y) +- : cOsd(X, Y),active(false),close(false) { ++ : cOsd(X, Y),close(false) { + OSDDEB("cSoftOsd constructor\n"); + OutputConvert=&cSoftOsd::ARGB_to_ARGB32; + pixelMask=NULL; +@@ -71,7 +71,6 @@ + cSoftOsd::~cSoftOsd() { + OSDDEB("cSoftOsd destructor\n"); + close=true; +- active=false; + Cancel(3); + if (videoOut) { + videoOut->CloseOSD(); +@@ -83,8 +82,7 @@ + /* -------------------------------------------------------------------------*/ + void cSoftOsd::Action() { + OSDDEB("OSD thread started\n"); +- active=true; +- while(active && videoOut && !close) { ++ while(Running() && videoOut && !close) { + int newOsdWidth; + int newOsdHeight; + int newXPan, newYPan; +@@ -249,7 +247,7 @@ + + // give priority to the other threads + pthread_yield(); +- if (!active && !close) ++ if (!Running() && !close) + Start(); + } + +diff -ru softdevice-orig/SoftOsd.h softdevice/SoftOsd.h +--- softdevice-orig/SoftOsd.h 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/SoftOsd.h 2006-05-21 18:13:55.000000000 +0200 +@@ -75,7 +75,6 @@ + void ConvertPalette(tColor *dest_palette, const tColor *orig_palette, + int maxColors); + +- bool active; + bool close; + int ScreenOsdWidth; + int ScreenOsdHeight; +diff -ru softdevice-orig/VdrReplacements.c softdevice/VdrReplacements.c +--- softdevice-orig/VdrReplacements.c 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/VdrReplacements.c 2006-05-21 18:08:15.000000000 +0200 +@@ -12,6 +12,9 @@ + #include "VdrReplacements.h" + #include <stdio.h> + #include <unistd.h> ++#include <signal.h> ++#include <errno.h> ++#include <sys/syscall.h> + + cMutex::cMutex() { + pthread_mutexattr_t attr; +@@ -34,14 +37,18 @@ + + //------------------------------------------------------------------------- + +-void StartThread(cThread *thread) { +- thread->active=true; +- thread->Action(); +- thread->active=false; ++void *cThread::StartThread(cThread *Thread) { ++ Thread->childThreadId = ThreadId(); ++ Thread->Action(); ++ Thread->running = false; ++ Thread->active = false; ++ return NULL; + }; + + cThread::cThread() { +- active=false; ++ active = running = false; ++ childTid = 0; ++ childThreadId = 0; + }; + + cThread::~cThread() { +@@ -49,32 +56,66 @@ + }; + + bool cThread::Start() { +- if (active) +- return false; +- +- active=true; +- if ( pthread_create(&childTid, NULL, (void *(*) (void*))&StartThread, +- (void *)this)!=0 ) { +- fprintf(stderr,"Error starting thread\n"); +- active=false; +- return false; +- }; +- +- pthread_detach(childTid); +- return true; +-}; +- +-void cThread::Cancel(int TimeOut) { +- int timeoutms=TimeOut*1000; +- while (active && TimeOut>0) { +- usleep(5000); +- timeoutms-=5000; +- }; +- +- if (active) { +- pthread_cancel(childTid); +- childTid=0; +- active=false; +- }; +-}; ++ if (!active) { ++ active = running = true; ++ if ( pthread_create(&childTid, NULL, (void *(*) (void*))&StartThread, (void *)this) == 0 ) { ++ pthread_detach(childTid); // auto-reap ++ pthread_setschedparam(childTid, SCHED_RR, 0); ++ } ++ else { ++ LOG_ERROR; ++ active = running = false; ++ return false; ++ } ++ } ++ return true; ++}; ++ ++void cThread::Cancel(int WaitSeconds) { ++ running = false; ++ if (active) { ++ if (WaitSeconds > 0) { ++ for (time_t t0 = time(NULL) + WaitSeconds; time(NULL) < t0; ) { ++ if (!Active()) ++ return; ++ usleep(10000); ++ } ++ } ++ pthread_cancel(childTid); ++ childTid = 0; ++ active = false; ++ } ++}; ++ ++bool cThread::Active(void) ++{ ++ if (active) { ++ // ++ // Single UNIX Spec v2 says: ++ // ++ // The pthread_kill() function is used to request ++ // that a signal be delivered to the specified thread. ++ // ++ // As in kill(), if sig is zero, error checking is ++ // performed but no signal is actually sent. ++ // ++ int err; ++ if ((err = pthread_kill(childTid, 0)) != 0) { ++ if (err != ESRCH) ++ LOG_ERROR; ++ childTid = 0; ++ active = running = false; ++ } ++ else ++ return true; ++ } ++ return false; ++} ++ ++_syscall0(pid_t, gettid) ++ ++tThreadId cThread::ThreadId(void) ++{ ++ return gettid(); ++} + +diff -ru softdevice-orig/VdrReplacements.h softdevice/VdrReplacements.h +--- softdevice-orig/VdrReplacements.h 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/VdrReplacements.h 2006-05-21 18:10:00.000000000 +0200 +@@ -15,6 +15,7 @@ + #include <pthread.h> + #include <stdio.h> + #include <stdint.h> ++#include <sys/types.h> + + #define VDRVERSNUM 10308 + +@@ -58,22 +59,32 @@ + + }; + ++typedef pid_t tThreadId; ++ + class cThread { +- friend void StartThread(cThread *); ++ private: ++ static void *StartThread(cThread *Thread); + private: +- bool active; ++ bool running; ++ bool active; ++ protected: ++ bool Running(void) { return running; } + pthread_t childTid; ++ tThreadId childThreadId; + public: + cThread(); + virtual ~cThread(); + + bool Start(); ++ bool Active(void); + void Cancel( int Timeout = 0 ); ++ static tThreadId ThreadId(void); + + virtual void Action() + {}; + }; + +- ++#define LOG_ERROR esyslog("ERROR (%s,%d): %m", __FILE__, __LINE__) ++ + + #endif +diff -ru softdevice-orig/video.c softdevice/video.c +--- softdevice-orig/video.c 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/video.c 2006-05-21 18:12:27.000000000 +0200 +@@ -58,13 +58,11 @@ + init_OsdBuffers(); + + //start osd thread +- active=true; + Start(); + } + + cVideoOut::~cVideoOut() + { +- active=false; + Cancel(3); + dsyslog("[VideoOut]: Good bye"); + } +@@ -96,7 +94,7 @@ + { + ClearOSD(); + #if VDRVERSNUM >= 10307 +- while(active) ++ while(Running()) + { + OsdRefreshCounter++; + usleep(20000); +diff -ru softdevice-orig/video-dfb.h softdevice/video-dfb.h +--- softdevice-orig/video-dfb.h 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/video-dfb.h 2006-05-21 18:15:23.000000000 +0200 +@@ -81,7 +81,6 @@ + */ + class cDFBRemote : public cRemote, private cThread { + private: +- bool active; + cDFBVideoOut *video_out; + + virtual void Action(void); +diff -ru softdevice-orig/video.h softdevice/video.h +--- softdevice-orig/video.h 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/video.h 2006-05-21 18:12:07.000000000 +0200 +@@ -144,7 +144,6 @@ + + cSetupStore *setupStore; + +- bool active; + uint16_t OsdRefreshCounter; + // should be setted to null everytime OSD is shown + // (software alpha blending mode). +diff -ru softdevice-orig/video-shm.c softdevice/video-shm.c +--- softdevice-orig/video-shm.c 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/video-shm.c 2006-05-21 18:17:45.000000000 +0200 +@@ -25,7 +25,7 @@ + }; + + void cShmRemote::Action(void) { +- while (active) { ++ while (Running()) { + SHMDEB("cShmRemote trying to get a lock\n"); + sem_wait_lock(vout->ctl->semid,KEY_MUT); + SHMDEB("cShmRemote got lock\n"); +diff -ru softdevice-orig/video-shm.h softdevice/video-shm.h +--- softdevice-orig/video-shm.h 2006-05-21 17:49:35.000000000 +0200 ++++ softdevice/video-shm.h 2006-05-21 18:17:27.000000000 +0200 +@@ -63,7 +63,6 @@ + */ + class cShmRemote : public cRemote, private cThread { + private: +- bool active; + cShmVideoOut *vout; + + virtual void Action(void); +@@ -71,7 +70,6 @@ + cShmRemote(const char *Name, cShmVideoOut *video_out) + : cRemote(Name) { + vout=video_out; +- active=true; + Start(); + }; + +@@ -79,10 +77,9 @@ + + void Stop() + { +- if (!vout || !active) ++ if (!vout || !Running()) + return; + +- active = false; + // signal new key to stop the thread from waiting + sem_sig_unlock(vout->ctl->semid,KEY_SIG); + diff --git a/media-plugins/vdr-softdevice/vdr-softdevice-0.2.3.20060511-r3.ebuild b/media-plugins/vdr-softdevice/vdr-softdevice-0.2.3.20060511-r3.ebuild new file mode 100644 index 000000000000..3c66411ddd0f --- /dev/null +++ b/media-plugins/vdr-softdevice/vdr-softdevice-0.2.3.20060511-r3.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-plugins/vdr-softdevice/vdr-softdevice-0.2.3.20060511-r3.ebuild,v 1.1 2006/05/21 16:54:30 zzam Exp $ + +inherit vdr-plugin versionator + +MY_PV="$(get_version_component_range 1-3)a" +MY_P=${PN}-${MY_PV} + +DESCRIPTION="VDR plugin: Software output-Device" +HOMEPAGE="http://softdevice.berlios.de/" +SRC_URI="mirror://gentoo/${MY_P}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~amd64" +IUSE="xv fbcon directfb mmx mmxext" + +RDEPEND=">=media-video/vdr-1.3.36 + >=media-video/ffmpeg-0.4.9_pre1 + directfb? ( + dev-libs/DirectFB + dev-libs/DFB++ + ) + media-libs/alsa-lib + xv? ( || ( ( x11-libs/libX11 + x11-libs/libXext + x11-libs/libXi + x11-libs/libXv + ) + virtual/x11 + ) )" + +DEPEND="${RDEPEND} + xv? ( || ( ( x11-proto/xproto + x11-proto/xextproto + ) + virtual/x11 + ) ) + fbcon? ( sys-kernel/linux-headers )" + + +S=${WORKDIR}/${VDRPLUGIN}-${MY_PV} +PATCHES="${FILESDIR}/${MY_P}-Makefile.diff ${FILESDIR}/${MY_P}-CVS-20060511.diff + ${FILESDIR}/vdr-softdevice-0.2.3-shm-contrast.diff + ${FILESDIR}/vdr-softdevice-0.2.3-shm-key-init.diff + ${FILESDIR}/vdr-softdevice-0.2.3-threading.diff" + +pkg_setup() { + vdr-plugin_pkg_setup + + if use !xv && use !fbcon && use !directfb; then + ewarn "You need to set at least one of these use-flags: xv fbcon directfb" + die "no output-method enabled" + fi + + COMPILE_SHM=0 + if has_version ">=media-video/vdr-1.3.0"; then + if use xv; then + COMPILE_SHM=1 + else + einfo "SHM does only support xv at the moment" + fi + else + einfo "SHM not supported on vdr-1.2" + fi + case ${COMPILE_SHM} in + 0) einfo "SHM support will not be compiled." ;; + 1) einfo "SHM support will be compiled." ;; + esac +} + +disable_in_makefile() { + local makefile_define="${1}" + sed -i Makefile -e "s-^${makefile_define}-#${makefile_define}-" +} + +src_unpack() { + vdr-plugin_src_unpack + + cd ${S} + disable_in_makefile VIDIX_SUPPORT + use xv || disable_in_makefile XV_SUPPORT + use directfb || disable_in_makefile DFB_SUPPORT + use fbcon || disable_in_makefile FB_SUPPORT + if [[ "${COMPILE_SHM}" = "1" ]]; then + sed -i Makefile -e 's:^#SHM_SUPPORT:SHM_SUPPORT:' + fi + + use mmxext || sed -i Makefile -e '/MMX2$/d' + use mmx || sed -i Makefile -e '/MMX$/d' +} + +src_install() { + vdr-plugin_src_install + + insinto "${VDR_PLUGIN_DIR}" + doins libsubvdr-*.so.* + + if [[ "${COMPILE_SHM}" = "1" ]]; then + exeinto "/usr/bin" + doexe ShmClient + fi +} + |