summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-05-13 18:33:24 +0200
committerJohns <johns98@gmx.net>2012-05-13 18:33:24 +0200
commit752ee356fa599ba9ede80385ab08ac7c75b127eb (patch)
treecfe83ff7932559614b3b669bffe98bd736726712
parent43e70b6a3fea0112900507ddcbea43e34423ddd0 (diff)
downloadvdr-plugin-softhddevice-752ee356fa599ba9ede80385ab08ac7c75b127eb.tar.gz
vdr-plugin-softhddevice-752ee356fa599ba9ede80385ab08ac7c75b127eb.tar.bz2
Poll input buffers, if display buffers are full.
-rw-r--r--softhddev.c31
-rw-r--r--video.c10
-rw-r--r--video.h4
3 files changed, 38 insertions, 7 deletions
diff --git a/softhddev.c b/softhddev.c
index b8752b4..d5426f9 100644
--- a/softhddev.c
+++ b/softhddev.c
@@ -397,7 +397,7 @@ static inline int FastAdtsCheck(const uint8_t * p)
/// o B*1 MPEG Version: 0 for MPEG-4, 1 for MPEG-2
/// o C*2 layer: always 0
/// o ..
-/// o F*4 sampling frequency index (15 is invalid)
+/// o F*4 sampling frequency index (15 is invalid)
/// o ..
/// o M*13 frame length
///
@@ -655,6 +655,12 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size,
//pesdx->State = PES_MPEG_DECODE;
break;
}
+ if (AudioCodecID != CODEC_ID_NONE) {
+ // shouldn't happen after we have a vaild codec
+ // detected
+ Debug(4, "pesdemux: skip @%d %02x\n", pesdx->Skip,
+ q[0]);
+ }
// try next byte
++pesdx->Skip;
++q;
@@ -1093,6 +1099,7 @@ int PlayAudio(const uint8_t * data, int size, uint8_t id)
// 4 bytes 0xFFExxxxx Mpeg audio
// 3 bytes 0x56Exxx AAC LATM audio
// 5 bytes 0x0B77xxxxxx AC3 audio
+ // 7/9 bytes 0xFFFxxxxxxxxxxx ADTS audio
// PCM audio can't be found
r = 0;
codec_id = CODEC_ID_NONE; // keep compiler happy
@@ -1428,13 +1435,33 @@ void FixPacketForFFMpeg(VideoDecoder * MyVideoDecoder, AVPacket * avpkt)
}
/**
+** Poll PES packet ringbuffer.
+**
+** Called if video frame buffers are full.
+*/
+int VideoPollInput(void)
+{
+ if (VideoClearBuffers) {
+ atomic_set(&VideoPacketsFilled, 0);
+ VideoPacketRead = VideoPacketWrite;
+ if (MyVideoDecoder) {
+ CodecVideoFlushBuffers(MyVideoDecoder);
+ VideoResetStart(MyHwDecoder);
+ }
+ VideoClearBuffers = 0;
+ return 1;
+ }
+ return 0;
+}
+
+/**
** Decode from PES packet ringbuffer.
**
** @retval 0 packet decoded
** @retval 1 stream paused
** @retval -1 empty stream
*/
-int VideoDecode(void)
+int VideoDecodeInput(void)
{
int filled;
AVPacket *avpkt;
diff --git a/video.c b/video.c
index f7666c7..8be3aa8 100644
--- a/video.c
+++ b/video.c
@@ -4677,8 +4677,10 @@ static void VaapiDisplayHandlerThread(void)
// FIXME: hot polling
pthread_mutex_lock(&VideoLockMutex);
// fetch+decode or reopen
- err = VideoDecode();
+ err = VideoDecodeInput();
pthread_mutex_unlock(&VideoLockMutex);
+ } else {
+ err = VideoPollInput();
}
if (err) {
// FIXME: sleep on wakeup
@@ -8085,8 +8087,10 @@ static void VdpauDisplayHandlerThread(void)
// FIXME: hot polling
pthread_mutex_lock(&VideoLockMutex);
// fetch+decode or reopen
- err = VideoDecode();
+ err = VideoDecodeInput();
pthread_mutex_unlock(&VideoLockMutex);
+ } else {
+ err = VideoPollInput();
}
if (err) {
// FIXME: sleep on wakeup
@@ -10296,7 +10300,7 @@ void FeedKeyPress( __attribute__ ((unused))
{
}
-int VideoDecode(void)
+int VideoDecodeInput(void)
{
return -1;
}
diff --git a/video.h b/video.h
index 1793e29..f027c9f 100644
--- a/video.h
+++ b/video.h
@@ -177,8 +177,8 @@ extern void VideoOsdExit(void); ///< Cleanup osd.
extern void VideoInit(const char *); ///< Setup video module.
extern void VideoExit(void); ///< Cleanup and exit video module.
-extern void VideoFlushInput(void); ///< Flush video input buffers.
-extern int VideoDecode(void); ///< Decode video input buffers.
+extern int VideoPollInput(void); ///< Poll video input buffers.
+extern int VideoDecodeInput(void); ///< Decode video input buffers.
extern int VideoGetBuffers(void); ///< Get number of input buffers.
/// @}