Fix still picture handling.

This commit is contained in:
Johns 2012-01-24 16:37:11 +01:00
parent 6ca4d3c44f
commit 037f582bad
3 changed files with 33 additions and 6 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Fix still picture handling.
Fix for dead-lock in VdpauExit. Fix for dead-lock in VdpauExit.
Workaround for dead-lock in VdpauExit. Workaround for dead-lock in VdpauExit.
VDPAU: Add very primitive software scaler for grab image. VDPAU: Add very primitive software scaler for grab image.

View File

@ -902,10 +902,12 @@ void Freeze(void)
void StillPicture(const uint8_t * data, int size) void StillPicture(const uint8_t * data, int size)
{ {
int i; int i;
static uint8_t seq_end_mpeg[] = { 0x00, 0x00, 0x01, 0xB7 };
static uint8_t seq_end_h264[] = { 0x00, 0x00, 0x00, 0x01, 0x10 };
// must be a PES start code // must be a PES start code
if (size < 9 || !data || data[0] || data[1] || data[2] != 0x01) { if (size < 9 || !data || data[0] || data[1] || data[2] != 0x01) {
Error(_("[softhddev] invalid PES video packet\n")); Error(_("[softhddev] invalid still video packet\n"));
return; return;
} }
if (VideoCodecID == CODEC_ID_NONE) { if (VideoCodecID == CODEC_ID_NONE) {
@ -913,13 +915,37 @@ void StillPicture(const uint8_t * data, int size)
Error(_("[softhddev] no codec known for still picture\n")); Error(_("[softhddev] no codec known for still picture\n"));
return; return;
} }
//Clear(); // flush video buffers
Clear(); // flush video buffers
// +1 future for deinterlace // +1 future for deinterlace
for (i = -1; i < (VideoCodecID == CODEC_ID_MPEG2VIDEO ? 3 : 17); ++i) { for (i = -1; i < (VideoCodecID == CODEC_ID_MPEG2VIDEO ? 3 : 17); ++i) {
PlayVideo(data, size); // reference frames //if ( 1 ) {
const uint8_t *split;
int n;
// split the I-frame into single pes packets
split = data;
n = size;
do {
int len;
len = (split[4] << 8) + split[5];
if (len > n) {
break;
}
PlayVideo(split, len + 6); // feed it
split += 6 + len;
n -= 6 + len;
} while (n > 6);
VideoNextPacket(VideoCodecID); // terminate last packet
if (VideoCodecID == CODEC_ID_H264) {
VideoEnqueue(AV_NOPTS_VALUE, seq_end_h264, sizeof(seq_end_h264));
} else {
VideoEnqueue(AV_NOPTS_VALUE, seq_end_mpeg, sizeof(seq_end_mpeg));
}
VideoNextPacket(VideoCodecID); // terminate last packet
} }
VideoNextPacket(VideoCodecID); // terminate last packet
} }
/** /**

View File

@ -795,8 +795,8 @@ void cSoftHdDevice::SetVolumeDevice(int volume)
*/ */
void cSoftHdDevice::StillPicture(const uchar * data, int length) void cSoftHdDevice::StillPicture(const uchar * data, int length)
{ {
dsyslog("[softhddev]%s: %s\n", __FUNCTION__, dsyslog("[softhddev]%s: %s %p %d\n", __FUNCTION__,
data[0] == 0x47 ? "ts" : "pes"); data[0] == 0x47 ? "ts" : "pes", data, length);
if (data[0] == 0x47) { // ts sync if (data[0] == 0x47) { // ts sync
cDevice::StillPicture(data, length); cDevice::StillPicture(data, length);