1 /* 2 * mpeghdr.h: 3 * MPEG audio header stuff. 4 * 5 * Copyright (c) 2002 Chris Lightfoot. 6 * Email: chris@ex-parrot.com; WWW: http://www.ex-parrot.com/~chris/ 7 * 8 * $Id: mpeghdr.h,v 1.4 2003/05/20 16:49:08 chris Exp $ 9 * 10 */ 11 12 #ifndef __MPEGHDR_H_ /* include guard */ 13 #define __MPEGHDR_H_ 14 15 #ifdef HAVE_CONFIG_H 16 #include <config.h> 17 #endif 18 #include "compat/compat.h" 19 20 #include <stdio.h> 21 22 /* struct mpeg_audio_hdr: 23 * Structure representing the four-byte header of an MPEG audio frame. */ 24 struct mpeg_audio_hdr { 25 enum { m_vers_unknown = 0, m_vers_1, m_vers_2, m_vers_2_5 } version; 26 enum { m_layer_unknown = 0, m_layer_1, m_layer_2, m_layer_3 } layer; 27 28 int has_crc; 29 uint16_t crc; 30 31 int bitrate; 32 int samplerate; 33 34 int padded; 35 36 int priv; 37 38 enum { m_chan_stereo = 0, m_chan_joint, m_chan_dual, m_chan_mono} channels; 39 40 uint8_t mode_extn; 41 42 int copyr, original; 43 44 uint8_t emph; 45 }; 46 47 /* mpeghdr.c */ 48 int mpeg_hdr_parse(const uint8_t *data, struct mpeg_audio_hdr *h); 49 int mpeg_hdr_nextframe_offset(const struct mpeg_audio_hdr *h); 50 void mpeg_hdr_print(FILE *fp, const struct mpeg_audio_hdr *h); 51 52 #endif /* __MPEGHDR_H_ */ 53