xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Typedefs | Functions
demux_mpeg.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include "group_video.h"
#include <xine/xine_internal.h>
#include <xine/demux.h>
#include <xine/xineutils.h>
#include "bswap.h"

Data Structures

struct  demux_mpeg_s
 

Macros

#define LOG_MODULE   "demux_mpeg"
 
#define LOG_VERBOSE
 
#define NUM_PREVIEW_BUFFERS   150
 
#define SCRATCH_SIZE   256
 
#define WRAP_THRESHOLD   120000
 
#define PTS_AUDIO   0
 
#define PTS_VIDEO   1
 
#define QT_ATOM   BE_FOURCC
 
#define FREE_ATOM   QT_ATOM('f', 'r', 'e', 'e')
 
#define JUNK_ATOM   QT_ATOM('j', 'u', 'n', 'k')
 
#define MDAT_ATOM   QT_ATOM('m', 'd', 'a', 't')
 
#define MOOV_ATOM   QT_ATOM('m', 'o', 'o', 'v')
 
#define PNOT_ATOM   QT_ATOM('p', 'n', 'o', 't')
 
#define SKIP_ATOM   QT_ATOM('s', 'k', 'i', 'p')
 
#define WIDE_ATOM   QT_ATOM('w', 'i', 'd', 'e')
 
#define ATOM_PREAMBLE_SIZE   8
 
#define FOURCC_TAG   BE_FOURCC
 
#define RIFF_TAG   FOURCC_TAG('R', 'I', 'F', 'F')
 
#define WAVE_TAG   FOURCC_TAG('W', 'A', 'V', 'E')
 
#define AVI_TAG   FOURCC_TAG('A', 'V', 'I', ' ')
 
#define FOURXM_TAG   FOURCC_TAG('4', 'X', 'M', 'V')
 
#define RIFF_CHECK_KILOBYTES   1024
 
#define MPEG_MARKER   FOURCC_TAG( 0x00, 0x00, 0x01, 0xBA )
 
#define abs(x)   ( ((x)<0) ? -(x) : (x) )
 

Typedefs

typedef struct demux_mpeg_s demux_mpeg_t
 

Functions

static void find_mdat_atom (input_plugin_t *input, off_t *mdat_offset, int64_t *mdat_size)
 
static void reset_track_map (fifo_buffer_t *fifo)
 
static uint32_t read_bytes (demux_mpeg_t *this, uint32_t n)
 
static void check_newpts (demux_mpeg_t *this, int64_t pts, int video)
 
static int mpeg1_read_pts (demux_mpeg_t *this, int64_t *pts, uint32_t leadbyte)
 
static int mpeg2_read_pts (demux_mpeg_t *this, int64_t *pts)
 
static int64_t mpeg_get_pts (const uint8_t *p)
 
static void parse_mpeg2_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
 
static void parse_mpeg1_packet (demux_mpeg_t *this, int stream_id, int64_t scr)
 
static uint32_t parse_pack (demux_mpeg_t *this)
 
static uint32_t parse_pack_preview (demux_mpeg_t *this, int *num_buffers)
 
static void demux_mpeg_resync (demux_mpeg_t *this, uint32_t buf)
 
static int demux_mpeg_send_chunk (demux_plugin_t *this_gen)
 
static int demux_mpeg_get_status (demux_plugin_t *this_gen)
 
static void demux_mpeg_send_headers (demux_plugin_t *this_gen)
 
static int demux_mpeg_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
 
static int demux_mpeg_get_stream_length (demux_plugin_t *this_gen)
 
static uint32_t demux_mpeg_get_capabilities (demux_plugin_t *this_gen)
 
static int demux_mpeg_get_optional_data (demux_plugin_t *this_gen, void *data, int data_type)
 
static demux_plugin_topen_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input)
 
void * demux_mpeg_init_class (xine_t *xine, const void *data)
 

Macro Definition Documentation

◆ abs

#define abs ( x)    ( ((x)<0) ? -(x) : (x) )

Referenced by check_newpts().

◆ ATOM_PREAMBLE_SIZE

#define ATOM_PREAMBLE_SIZE   8

Referenced by find_mdat_atom().

◆ AVI_TAG

#define AVI_TAG   FOURCC_TAG('A', 'V', 'I', ' ')

Referenced by open_plugin().

◆ FOURCC_TAG

#define FOURCC_TAG   BE_FOURCC

◆ FOURXM_TAG

#define FOURXM_TAG   FOURCC_TAG('4', 'X', 'M', 'V')

Referenced by open_plugin().

◆ FREE_ATOM

#define FREE_ATOM   QT_ATOM('f', 'r', 'e', 'e')

Referenced by find_mdat_atom().

◆ JUNK_ATOM

#define JUNK_ATOM   QT_ATOM('j', 'u', 'n', 'k')

Referenced by find_mdat_atom().

◆ LOG_MODULE

#define LOG_MODULE   "demux_mpeg"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MDAT_ATOM

#define MDAT_ATOM   QT_ATOM('m', 'd', 'a', 't')

Referenced by find_mdat_atom().

◆ MOOV_ATOM

#define MOOV_ATOM   QT_ATOM('m', 'o', 'o', 'v')

Referenced by find_mdat_atom().

◆ MPEG_MARKER

#define MPEG_MARKER   FOURCC_TAG( 0x00, 0x00, 0x01, 0xBA )

Referenced by open_plugin().

◆ NUM_PREVIEW_BUFFERS

#define NUM_PREVIEW_BUFFERS   150

Referenced by demux_mpeg_send_headers().

◆ PNOT_ATOM

#define PNOT_ATOM   QT_ATOM('p', 'n', 'o', 't')

Referenced by find_mdat_atom().

◆ PTS_AUDIO

#define PTS_AUDIO   0

◆ PTS_VIDEO

#define PTS_VIDEO   1

◆ QT_ATOM

#define QT_ATOM   BE_FOURCC

◆ RIFF_CHECK_KILOBYTES

#define RIFF_CHECK_KILOBYTES   1024

Referenced by open_plugin().

◆ RIFF_TAG

#define RIFF_TAG   FOURCC_TAG('R', 'I', 'F', 'F')

Referenced by open_plugin().

◆ SCRATCH_SIZE

#define SCRATCH_SIZE   256

Referenced by open_plugin().

◆ SKIP_ATOM

#define SKIP_ATOM   QT_ATOM('s', 'k', 'i', 'p')

Referenced by find_mdat_atom().

◆ WAVE_TAG

#define WAVE_TAG   FOURCC_TAG('W', 'A', 'V', 'E')

Referenced by open_plugin().

◆ WIDE_ATOM

#define WIDE_ATOM   QT_ATOM('w', 'i', 'd', 'e')

Referenced by find_mdat_atom().

◆ WRAP_THRESHOLD

#define WRAP_THRESHOLD   120000

Referenced by check_newpts().

Typedef Documentation

◆ demux_mpeg_t

typedef struct demux_mpeg_s demux_mpeg_t

Function Documentation

◆ check_newpts()

static void check_newpts ( demux_mpeg_t * this,
int64_t pts,
int video )
static

◆ demux_mpeg_get_capabilities()

static uint32_t demux_mpeg_get_capabilities ( demux_plugin_t * this_gen)
static

References DEMUX_CAP_AUDIOLANG, and DEMUX_CAP_SPULANG.

Referenced by open_plugin().

◆ demux_mpeg_get_optional_data()

static int demux_mpeg_get_optional_data ( demux_plugin_t * this_gen,
void * data,
int data_type )
static

◆ demux_mpeg_get_status()

static int demux_mpeg_get_status ( demux_plugin_t * this_gen)
static

Referenced by open_plugin().

◆ demux_mpeg_get_stream_length()

static int demux_mpeg_get_stream_length ( demux_plugin_t * this_gen)
static

References input().

Referenced by open_plugin().

◆ demux_mpeg_init_class()

void * demux_mpeg_init_class ( xine_t * xine,
const void * data )

◆ demux_mpeg_resync()

static void demux_mpeg_resync ( demux_mpeg_t * this,
uint32_t buf )
static

◆ demux_mpeg_seek()

static int demux_mpeg_seek ( demux_plugin_t * this_gen,
off_t start_pos,
int start_time,
int playing )
static

◆ demux_mpeg_send_chunk()

static int demux_mpeg_send_chunk ( demux_plugin_t * this_gen)
static

References demux_mpeg_resync(), and parse_pack().

Referenced by open_plugin().

◆ demux_mpeg_send_headers()

static void demux_mpeg_send_headers ( demux_plugin_t * this_gen)
static

◆ find_mdat_atom()

static void find_mdat_atom ( input_plugin_t * input,
off_t * mdat_offset,
int64_t * mdat_size )
static

◆ mpeg1_read_pts()

static int mpeg1_read_pts ( demux_mpeg_t * this,
int64_t * pts,
uint32_t leadbyte )
static

References DEMUX_FINISHED, input(), and v.

Referenced by parse_mpeg1_packet().

◆ mpeg2_read_pts()

static int mpeg2_read_pts ( demux_mpeg_t * this,
int64_t * pts )
static

References DEMUX_FINISHED, input(), and v.

Referenced by parse_mpeg1_packet().

◆ mpeg_get_pts()

static int64_t mpeg_get_pts ( const uint8_t * p)
static

References _X_BE_32, and v.

Referenced by parse_mpeg2_packet().

◆ open_plugin()

static demux_plugin_t * open_plugin ( demux_class_t * class_gen,
xine_stream_t * stream,
input_plugin_t * input )
static

◆ parse_mpeg1_packet()

static void parse_mpeg1_packet ( demux_mpeg_t * this,
int stream_id,
int64_t scr )
static

◆ parse_mpeg2_packet()

static void parse_mpeg2_packet ( demux_mpeg_t * this,
int stream_id,
int64_t scr )
static

◆ parse_pack()

static uint32_t parse_pack ( demux_mpeg_t * this)
static

◆ parse_pack_preview()

static uint32_t parse_pack_preview ( demux_mpeg_t * this,
int * num_buffers )
static

◆ read_bytes()

static uint32_t read_bytes ( demux_mpeg_t * this,
uint32_t n )
static

◆ reset_track_map()

static void reset_track_map ( fifo_buffer_t * fifo)
static