MythTV  master
Macros | Functions
replex.c File Reference
#include <stdlib.h>
#include <getopt.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include "replex.h"
#include "pes.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "mythlogging.h"
Include dependency graph for replex.c:

Go to the source code of this file.

Macros

#define O_LARGEFILE   0
 
#define S_IRGRP   0
 
#define S_IWGRP   0
 
#define S_IROTH   0
 
#define S_IWOTH   0
 
#define LIMIT   3
 
#define IN_SIZE   (1000*TS_SIZE)
 
#define MAXVPID   16
 
#define MAXAPID   32
 
#define MAXAC3PID   16
 
#define MAX_TRIES   5
 
#define AVI_S   1024
 

Functions

static int replex_all_set (struct replex *rx)
 
static int replex_check_id (struct replex *rx, uint16_t id)
 
static int avcodec_encode_audio (AVCodecContext *avctx, uint8_t *buf, int buf_size, const short *samples)
 
static int encode_mp2_audio (audio_frame_t *aframe, uint8_t *buffer, int bufsize)
 
static void analyze_audio (pes_in_t *p, struct replex *rx, int len, int num, int type)
 
static void analyze_video (pes_in_t *p, struct replex *rx, int len)
 
static void es_out (pes_in_t *p)
 
static void pes_es_out (pes_in_t *p)
 
static void avi_es_out (pes_in_t *p)
 
static int replex_tsp (struct replex *rx, uint8_t *tsp)
 
static ssize_t save_read (struct replex *rx, void *buf, size_t count)
 
static int guess_fill (struct replex *rx)
 
static void find_pids_file (struct replex *rx)
 
static void find_all_pids_file (struct replex *rx)
 
static void find_pids_stdin (struct replex *rx, uint8_t *buf, int len)
 
static void pes_id_out (pes_in_t *p)
 
static void find_pes_ids (struct replex *rx)
 
static void replex_finish (struct replex *rx)
 
static int replex_fill_buffers (struct replex *rx, uint8_t *mbuf)
 
static int fill_buffers (void *r, int finish)
 
void init_index (index_unit *iu)
 
static int check_stream_type (struct replex *rx, uint8_t *buf, int len)
 
static void init_replex (struct replex *rx)
 
static void fix_audio (struct replex *rx, multiplex_t *mx)
 
static int get_next_video_unit (struct replex *rx, index_unit *viu)
 
static int get_next_audio_unit (struct replex *rx, index_unit *aiu, int i)
 
static int get_next_ac3_unit (struct replex *rx, index_unit *aiu, int i)
 
static void do_analyze (struct replex *rx)
 
static void do_scan (struct replex *rx)
 
static void do_demux (struct replex *rx)
 
static void do_replex (struct replex *rx)
 
static void usage (char *progname)
 
int main (int argc, char **argv)
 
void LogPrintLine (uint64_t mask, LogLevel_t level, const char *file, int line, const char *function, int fromQString, const char *format,...)
 Format and send a log message into the queue. More...
 

Macro Definition Documentation

◆ O_LARGEFILE

#define O_LARGEFILE   0

Definition at line 46 of file replex.c.

◆ S_IRGRP

#define S_IRGRP   0

Definition at line 53 of file replex.c.

◆ S_IWGRP

#define S_IWGRP   0

Definition at line 54 of file replex.c.

◆ S_IROTH

#define S_IROTH   0

Definition at line 55 of file replex.c.

◆ S_IWOTH

#define S_IWOTH   0

Definition at line 56 of file replex.c.

◆ LIMIT

#define LIMIT   3

◆ IN_SIZE

#define IN_SIZE   (1000*TS_SIZE)

Definition at line 1281 of file replex.c.

◆ MAXVPID

#define MAXVPID   16

Definition at line 1334 of file replex.c.

◆ MAXAPID

#define MAXAPID   32

Definition at line 1335 of file replex.c.

◆ MAXAC3PID

#define MAXAC3PID   16

Definition at line 1336 of file replex.c.

◆ MAX_TRIES

#define MAX_TRIES   5

◆ AVI_S

#define AVI_S   1024

Function Documentation

◆ replex_all_set()

static int replex_all_set ( struct replex rx)
static

Definition at line 1837 of file replex.c.

Referenced by do_replex(), and replex_finish().

◆ replex_check_id()

static int replex_check_id ( struct replex rx,
uint16_t  id 
)
static

Definition at line 67 of file replex.c.

Referenced by replex_tsp().

◆ avcodec_encode_audio()

static int avcodec_encode_audio ( AVCodecContext *  avctx,
uint8_t *  buf,
int  buf_size,
const short *  samples 
)
static

Definition at line 85 of file replex.c.

Referenced by encode_mp2_audio().

◆ encode_mp2_audio()

static int encode_mp2_audio ( audio_frame_t aframe,
uint8_t *  buffer,
int  bufsize 
)
static

Definition at line 172 of file replex.c.

Referenced by analyze_audio().

◆ analyze_audio()

static void analyze_audio ( pes_in_t p,
struct replex rx,
int  len,
int  num,
int  type 
)
static

Definition at line 231 of file replex.c.

Referenced by avi_es_out(), es_out(), and pes_es_out().

◆ analyze_video()

static void analyze_video ( pes_in_t p,
struct replex rx,
int  len 
)
static

Definition at line 506 of file replex.c.

Referenced by avi_es_out(), es_out(), and pes_es_out().

◆ es_out()

static void es_out ( pes_in_t p)
static

Definition at line 905 of file replex.c.

Referenced by replex_tsp().

◆ pes_es_out()

static void pes_es_out ( pes_in_t p)
static

Definition at line 974 of file replex.c.

Referenced by replex_fill_buffers().

◆ avi_es_out()

static void avi_es_out ( pes_in_t p)
static

Definition at line 1086 of file replex.c.

Referenced by replex_fill_buffers().

◆ replex_tsp()

static int replex_tsp ( struct replex rx,
uint8_t *  tsp 
)
static

Definition at line 1155 of file replex.c.

Referenced by replex_fill_buffers().

◆ save_read()

static ssize_t save_read ( struct replex rx,
void *  buf,
size_t  count 
)
static

◆ guess_fill()

static int guess_fill ( struct replex rx)
static

Definition at line 1238 of file replex.c.

Referenced by replex_fill_buffers().

◆ find_pids_file()

static void find_pids_file ( struct replex rx)
static

Definition at line 1282 of file replex.c.

Referenced by init_replex().

◆ find_all_pids_file()

static void find_all_pids_file ( struct replex rx)
static

Definition at line 1337 of file replex.c.

Referenced by do_scan().

◆ find_pids_stdin()

static void find_pids_stdin ( struct replex rx,
uint8_t *  buf,
int  len 
)
static

Definition at line 1427 of file replex.c.

Referenced by replex_fill_buffers().

◆ pes_id_out()

static void pes_id_out ( pes_in_t p)
static

Definition at line 1490 of file replex.c.

Referenced by find_pes_ids().

◆ find_pes_ids()

static void find_pes_ids ( struct replex rx)
static

Definition at line 1554 of file replex.c.

Referenced by do_scan().

◆ replex_finish()

static void replex_finish ( struct replex rx)
static

Definition at line 1661 of file replex.c.

Referenced by replex_fill_buffers().

◆ replex_fill_buffers()

static int replex_fill_buffers ( struct replex rx,
uint8_t *  mbuf 
)
static

Definition at line 1677 of file replex.c.

Referenced by do_analyze(), do_demux(), do_replex(), fill_buffers(), fix_audio(), and init_replex().

◆ fill_buffers()

static int fill_buffers ( void *  r,
int  finish 
)
static

Definition at line 1821 of file replex.c.

Referenced by do_replex(), and init_multiplex().

◆ init_index()

void init_index ( index_unit iu)

Definition at line 1831 of file replex.c.

Referenced by analyze_audio(), analyze_video(), find_pids_stdin(), and init_replex().

◆ check_stream_type()

static int check_stream_type ( struct replex rx,
uint8_t *  buf,
int  len 
)
static

Definition at line 1855 of file replex.c.

Referenced by do_scan(), and init_replex().

◆ init_replex()

static void init_replex ( struct replex rx)
static

Definition at line 1904 of file replex.c.

Referenced by main().

◆ fix_audio()

static void fix_audio ( struct replex rx,
multiplex_t mx 
)
static

Definition at line 2054 of file replex.c.

Referenced by do_replex().

◆ get_next_video_unit()

static int get_next_video_unit ( struct replex rx,
index_unit viu 
)
static

Definition at line 2114 of file replex.c.

Referenced by do_analyze(), and do_demux().

◆ get_next_audio_unit()

static int get_next_audio_unit ( struct replex rx,
index_unit aiu,
int  i 
)
static

Definition at line 2124 of file replex.c.

Referenced by do_analyze(), and do_demux().

◆ get_next_ac3_unit()

static int get_next_ac3_unit ( struct replex rx,
index_unit aiu,
int  i 
)
static

Definition at line 2134 of file replex.c.

Referenced by do_analyze(), and do_demux().

◆ do_analyze()

static void do_analyze ( struct replex rx)
static

Definition at line 2146 of file replex.c.

Referenced by main().

◆ do_scan()

static void do_scan ( struct replex rx)
static

Definition at line 2259 of file replex.c.

Referenced by main(), and ScanWizard::Scan().

◆ do_demux()

static void do_demux ( struct replex rx)
static

Definition at line 2289 of file replex.c.

Referenced by main().

◆ do_replex()

static void do_replex ( struct replex rx)
static

Definition at line 2326 of file replex.c.

Referenced by main().

◆ usage()

static void usage ( char *  progname)
static

Definition at line 2385 of file replex.c.

Referenced by main().

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 2408 of file replex.c.

◆ LogPrintLine()

void LogPrintLine ( uint64_t  mask,
LogLevel_t  level,
const char *  file,
int  line,
const char *  function,
int  fromQString,
const char *  format,
  ... 
)

Format and send a log message into the queue.

This is called from the LOG() macro. The intention is minimal blocking of the caller.

Parameters
maskVerbosity mask of the message (VB_*)
levelLog level of this message (LOG_* - matching syslog levels)
fileFilename of source code logging the message
lineLine number within the source of log message source
functionFunction name of the log message source
fromQStringtrue if this message originated from QString
formatprintf format string (when not from QString), log message (when from QString)
...printf arguments (when not from QString)

Definition at line 2663 of file replex.c.