From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- mpg123_artsplugin/dxhead.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 mpg123_artsplugin/dxhead.h (limited to 'mpg123_artsplugin/dxhead.h') diff --git a/mpg123_artsplugin/dxhead.h b/mpg123_artsplugin/dxhead.h new file mode 100644 index 00000000..16a6a0fc --- /dev/null +++ b/mpg123_artsplugin/dxhead.h @@ -0,0 +1,77 @@ +/*---- DXhead.h -------------------------------------------- + + +decoder MPEG Layer III + +handle Xing header + + +Copyright 1998 Xing Technology Corp. +-----------------------------------------------------------*/ +/* A Xing header may be present in the ancillary + * data field of the first frame of an mp3 bitstream + * The Xing header (optionally) contains + * frames total number of audio frames in the bitstream + * bytes total number of bytes in the bitstream + * toc table of contents + + * toc (table of contents) gives seek points + * for random access + * the ith entry determines the seek point for + * i-percent duration + * seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes + * e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes + */ + +#define FRAMES_FLAG 0x0001 +#define BYTES_FLAG 0x0002 +#define TOC_FLAG 0x0004 +#define VBR_SCALE_FLAG 0x0008 + +#define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG) + +/* structure to receive extracted header + * toc may be NULL + */ +typedef struct +{ + + int h_id; /* from MPEG header, 0=MPEG2, 1=MPEG1 */ + + int samprate; /* determined from MPEG header */ + + int flags; /* from Xing header data */ + + int frames; /* total bit stream frames from Xing header data */ + + int bytes; /* total bit stream bytes from Xing header data */ + + int vbr_scale; /* encoded vbr scale from Xing header data */ + + unsigned char *toc; /* pointer to unsigned char toc_buffer[100] */ + + /* may be NULL if toc not desired */ +} +XHEADDATA; + + + +int mpg123_get_xing_header(XHEADDATA * X, unsigned char *buf); + +/* return 0=fail, 1=success + * X structure to receive header data (output) + * buf bitstream input + */ + +int mpg123_seek_point(unsigned char TOC[100], int file_bytes, float percent); + +/* return seekpoint in bytes (may be at eof if percent=100.0) + * TOC = table of contents from Xing header + * file_bytes = number of bytes in mp3 file + * percent = play time percentage of total playtime. May be + * fractional (e.g. 87.245) + */ +int mpg123_stream_check_for_xing_header(struct frame *fr, XHEADDATA * xhead); + + + -- cgit v1.2.1