Main Page Data Structures File List Data Fields Globals Related Pages

# mpeg.cpp File Reference

`#include <stdio.h>`
`#include <string.h>`
`#include <assert.h>`
`#include "mpeg.h"`

Go to the source code of this file.

## Functions
bool | MPEG_CheckHeader (unsigned long header)
| Do a quick validity check on a MPEG Header.
bool | MPEG_FindHeader (char *buffer, unsigned buflen, int numHeads)
| Search for valid headers inside a buffer.
bool | MPEG_ParseHeader (unsigned long header, FrameInfo *info)
| Decode a MPEG Header into a more friendy format.
char * | MPEG_HeaderToString (unsigned long header)

## Function Documentation

bool MPEG_CheckHeader | ( | unsigned long | header | ) |

  | Do a quick validity check on a MPEG Header. Note: a check for bitrate==0 was added, because we can't calculate the framelength for free form streams. Parameters:
  header | pointer to header to check
Returns: true if it could be a valid header, or false if not. Definition at line 33 of file mpeg.cpp. Referenced by MPEG_ParseHeader().

bool MPEG_FindHeader | ( | char * | buffer,
|  | unsigned | buflen,
|  | int | numHeads
| ) |

| Search for valid headers inside a buffer. (Presumably by using REP_SCASB, and a call to CheckHeader(). After a possible header (0xff) has been found, the frame length should be calculated, and the numHead following frames should be checked as well. If we've found e.g. 3 valid headers in a row, we can be reasonably sure that we're sync'd. \TODO implement this function! Definition at line 61 of file mpeg.cpp.

char* MPEG_HeaderToString | ( | unsigned long | header | ) |

| Definition at line 136 of file mpeg.cpp. References FrameInfo::bitrate, FrameInfo::crc, FrameInfo::frequency, FrameInfo::id, FrameInfo::layer, FrameInfo::mode, and MPEG_ParseHeader().

bool MPEG_ParseHeader | ( | unsigned long | header,
|  | FrameInfo * | info
| ) |

  | Decode a MPEG Header into a more friendy format. Parameters:
  header | header to parse.
  info | pointer to MpegInfo structure to fill out.
Returns: true if successful, or false if the header was invalid Definition at line 76 of file mpeg.cpp. References FrameInfo::bitrate, FrameInfo::copyright, FrameInfo::crc, FrameInfo::emphasis, FrameInfo::extension, FrameInfo::frequency, FrameInfo::id, FrameInfo::layer, FrameInfo::length, FrameInfo::mode, MPEG_CheckHeader(), FrameInfo::original, FrameInfo::pad, and FrameInfo::priv. Referenced by MPEG_HeaderToString().