diff options
author | cvs2svn <admin@example.com> | 2009-10-21 00:02:02 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2009-10-21 00:02:02 +0000 |
commit | 97a97ca3358eb48de3eb7a222e487e800566569f (patch) | |
tree | 97c920d0225a1c9773a3bce2207f261d7d230123 /tools/mpeg.c | |
parent | a61961358c5a2ec92340b3f8e056bab55438f103 (diff) | |
download | xineliboutput-CVS.tar.gz xineliboutput-CVS.tar.bz2 |
This commit was manufactured by cvs2svn to create branch 'CVS'.CVS
Diffstat (limited to 'tools/mpeg.c')
-rw-r--r-- | tools/mpeg.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/tools/mpeg.c b/tools/mpeg.c deleted file mode 100644 index b827e096..00000000 --- a/tools/mpeg.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * mpeg.c: - * - * See the main source file 'xineliboutput.c' for copyright information and - * how to reach the author. - * - * $Id: mpeg.c,v 1.3 2009-02-16 16:03:18 phintuka Exp $ - * - */ - -#include <inttypes.h> -#include <string.h> - -#include "mpeg.h" - - -const char * const picture_type_str[] = { - "(none)", - "I-Frame", - "B-Frame", - "P-Frame" -}; - -int mpeg2_get_picture_type(const uint8_t *buf, int len) -{ - int i; - for (i = 0; i < len-5; i++) { - if (buf[i] == 0 && buf[i + 1] == 0 && buf[i + 2] == 1) { - switch (buf[i + 3]) { - case SC_PICTURE: - return (buf[i + 5] >> 3) & 0x07; - } - } - } - return NO_PICTURE; -} - -int mpeg2_get_video_size(const uint8_t *buf, int len, video_size_t *size) -{ - int i; - for (i = 0; i < len-6; i++) { - if (buf[i] == 0 && buf[i + 1] == 0 && buf[i + 2] == 1) { - if (buf[i + 3] == SC_SEQUENCE) { - static const mpeg_rational_t mpeg2_aspect[16] = { - {0,1}, {1,1}, {4,3}, {16,9}, {221,100}, - {0,1}, {0,1}, {0,1}, { 0,1}, { 0,1}, - {0,1}, {0,1}, {0,1}, { 0,1}, { 0,1}, - {0,1}, - }; - - int d = (buf[i+4] << 16) | (buf[i+5] << 8) | buf[i+6]; - int a = buf[i+7] >> 4; - - size->width = (d >> 12); - size->height = (d & 0xfff); - - memcpy(&size->pixel_aspect, &mpeg2_aspect[a], sizeof(mpeg_rational_t)); - size->pixel_aspect.num *= size->height; - size->pixel_aspect.den *= size->width; - - return 1; - } - } - } - return 0; -} - |