diff options
author | phintuka <phintuka> | 2008-01-24 08:33:59 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2008-01-24 08:33:59 +0000 |
commit | a184409d84302054f22bcefc24987f2e2508d015 (patch) | |
tree | 2a319282dba39c3f7bc2d29fe28be913f8962183 | |
parent | 65edbdfefa28662eb1940db96aec3154192b7d86 (diff) | |
download | xineliboutput-a184409d84302054f22bcefc24987f2e2508d015.tar.gz xineliboutput-a184409d84302054f22bcefc24987f2e2508d015.tar.bz2 |
H.264 detection
-rw-r--r-- | tools/pes.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/pes.h b/tools/pes.h index a638a58b..4cb3abef 100644 --- a/tools/pes.h +++ b/tools/pes.h @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: pes.h,v 1.4 2006-10-27 23:02:02 phintuka Exp $ + * $Id: pes.h,v 1.5 2008-01-24 08:33:59 phintuka Exp $ * */ @@ -251,6 +251,20 @@ static inline int GetVideoSize(const uchar *buf, int length, int *width, int *he return 0; } +static inline bool IsFrameH264(const uchar *Data, int Count) +{ + if (Count < 9 || Count < 9 + Data[8]) + return false; + if ( (Data[6] & 0xC0) != 0x80) /* MPEG 2 */ + return false; + + Data += 9 + Data[8]; + + if (!Data[0] && !Data[1] && Data[2] == 0x01 && Data[3] == 0x09) + return true; + return false; +} + // from vdr/remux.c: static inline int ScanVideoPacket(const uchar *Data, int Count, /*int Offset,*/ uchar &PictureType) |