mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed cFrameDetector::Analyze() to handle video streams where the frame type is not detectable from the first TS packet of a frame
This commit is contained in:
parent
cb0b4768ad
commit
95c9d3cf51
4
HISTORY
4
HISTORY
@ -6157,7 +6157,7 @@ Video Disk Recorder Revision History
|
|||||||
Reinhard Nissl).
|
Reinhard Nissl).
|
||||||
- Implemented full handling of subtitling descriptors (thanks to Mikko Tuumanen).
|
- Implemented full handling of subtitling descriptors (thanks to Mikko Tuumanen).
|
||||||
|
|
||||||
2009-10-25: Version 1.7.10
|
2009-11-01: Version 1.7.10
|
||||||
|
|
||||||
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
- Updated the Italian OSD texts (thanks to Diego Pierotto).
|
||||||
- Fixed wrong bracketing in cChannel::SubtitlingType() etc.
|
- Fixed wrong bracketing in cChannel::SubtitlingType() etc.
|
||||||
@ -6172,3 +6172,5 @@ Video Disk Recorder Revision History
|
|||||||
compatible).
|
compatible).
|
||||||
- Fixed saving terminal settings when running in background (thanks to Manuel
|
- Fixed saving terminal settings when running in background (thanks to Manuel
|
||||||
Reimer).
|
Reimer).
|
||||||
|
- Fixed cFrameDetector::Analyze() to handle video streams where the frame type
|
||||||
|
is not detectable from the first TS packet of a frame.
|
||||||
|
20
remux.c
20
remux.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: remux.c 2.26 2009/08/16 15:13:42 kls Exp $
|
* $Id: remux.c 2.27 2009/11/01 12:25:17 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "remux.h"
|
#include "remux.h"
|
||||||
@ -769,8 +769,12 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
|
|||||||
}
|
}
|
||||||
if (TsHasPayload(Data) && !TsIsScrambled(Data) && TsPid(Data) == pid) {
|
if (TsHasPayload(Data) && !TsIsScrambled(Data) && TsPid(Data) == pid) {
|
||||||
if (TsPayloadStart(Data)) {
|
if (TsPayloadStart(Data)) {
|
||||||
|
if (synced && Processed)
|
||||||
|
return Processed;
|
||||||
|
if (Length < 2 * TS_SIZE)
|
||||||
|
return 0; // need more data, in case the frame type is stored in the second TS packet
|
||||||
if (!frameDuration) {
|
if (!frameDuration) {
|
||||||
// frame duration unknown, so collect a sequenece of PTS values:
|
// frame duration unknown, so collect a sequence of PTS values:
|
||||||
if (numPtsValues < MaxPtsValues && numIFrames < 2) { // collect a sequence containing at least two I-frames
|
if (numPtsValues < MaxPtsValues && numIFrames < 2) { // collect a sequence containing at least two I-frames
|
||||||
const uchar *Pes = Data + TsPayloadOffset(Data);
|
const uchar *Pes = Data + TsPayloadOffset(Data);
|
||||||
if (PesHasPts(Pes)) {
|
if (PesHasPts(Pes)) {
|
||||||
@ -836,8 +840,6 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
|
|||||||
case 0x01: // MPEG 1 video
|
case 0x01: // MPEG 1 video
|
||||||
case 0x02: // MPEG 2 video
|
case 0x02: // MPEG 2 video
|
||||||
if (scanner == 0x00000100) { // Picture Start Code
|
if (scanner == 0x00000100) { // Picture Start Code
|
||||||
if (synced && Processed)
|
|
||||||
return Processed;
|
|
||||||
newFrame = true;
|
newFrame = true;
|
||||||
independentFrame = ((Data[i + 2] >> 3) & 0x07) == 1; // I-Frame
|
independentFrame = ((Data[i + 2] >> 3) & 0x07) == 1; // I-Frame
|
||||||
if (synced) {
|
if (synced) {
|
||||||
@ -851,12 +853,12 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
|
|||||||
dbgframes("%d ", (Data[i + 2] >> 3) & 0x07);
|
dbgframes("%d ", (Data[i + 2] >> 3) & 0x07);
|
||||||
}
|
}
|
||||||
scanner = 0;
|
scanner = 0;
|
||||||
|
if (synced && Processed)
|
||||||
|
return Processed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x1B: // MPEG 4 video
|
case 0x1B: // MPEG 4 video
|
||||||
if (scanner == 0x00000109) { // Access Unit Delimiter
|
if (scanner == 0x00000109) { // Access Unit Delimiter
|
||||||
if (synced && Processed)
|
|
||||||
return Processed;
|
|
||||||
newFrame = true;
|
newFrame = true;
|
||||||
independentFrame = Data[i + 1] == 0x10;
|
independentFrame = Data[i + 1] == 0x10;
|
||||||
if (synced) {
|
if (synced) {
|
||||||
@ -876,13 +878,13 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
|
|||||||
numIFrames++;
|
numIFrames++;
|
||||||
dbgframes("%02X ", Data[i + 1]);
|
dbgframes("%02X ", Data[i + 1]);
|
||||||
}
|
}
|
||||||
|
if (synced && Processed)
|
||||||
|
return Processed;
|
||||||
scanner = 0;
|
scanner = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x04: // MPEG audio
|
case 0x04: // MPEG audio
|
||||||
case 0x06: // AC3 audio
|
case 0x06: // AC3 audio
|
||||||
if (synced && Processed)
|
|
||||||
return Processed;
|
|
||||||
newFrame = true;
|
newFrame = true;
|
||||||
independentFrame = true;
|
independentFrame = true;
|
||||||
if (!synced) {
|
if (!synced) {
|
||||||
@ -891,6 +893,8 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
|
|||||||
numIFrames++;
|
numIFrames++;
|
||||||
}
|
}
|
||||||
scanning = false;
|
scanning = false;
|
||||||
|
if (synced && Processed)
|
||||||
|
return Processed;
|
||||||
break;
|
break;
|
||||||
default: esyslog("ERROR: unknown stream type %d (PID %d) in frame detector", type, pid);
|
default: esyslog("ERROR: unknown stream type %d (PID %d) in frame detector", type, pid);
|
||||||
pid = 0; // let's just ignore any further data
|
pid = 0; // let's just ignore any further data
|
||||||
|
Loading…
Reference in New Issue
Block a user