xine-lib 1.2.11
Data Structures | Macros | Enumerations | Functions
demux_flv.c File Reference
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "group_video.h"
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/compat.h>
#include <xine/demux.h>
#include "bswap.h"

Data Structures

struct  flv_index_entry_t
 
struct  demux_flv_t
 

Macros

#define LOG_MODULE   "demux_flv"
 
#define LOG_VERBOSE
 
#define TEMPBUFSIZE   4096
 
#define gettimestamp(p, o)   (((((((uint32_t)p[o+3]<<8)|p[o])<<8)|p[o+1])<<8)|p[o+2])
 
#define FLV_FLAG_HAS_VIDEO   0x01
 
#define FLV_FLAG_HAS_AUDIO   0x04
 
#define FLV_TAG_TYPE_AUDIO   0x08
 
#define FLV_TAG_TYPE_VIDEO   0x09
 
#define FLV_TAG_TYPE_NOTIFY   0x12
 
#define IS_PCM(id)   ((((1<<AF_PCM_BE)|(1<<AF_ADPCM)|(1<<AF_PCM_LE)|(1<<AF_ALAW)|(1<<AF_MULAW))>>(id))&1)
 
#define abs(x)   ( ((x)<0) ? -(x) : (x) )
 
#define WRAP_THRESHOLD   220000
 
#define PTS_AUDIO   0
 
#define PTS_VIDEO   1
 
#define BE_F64(buf)
 
#define MAX_AMF_LEVELS   10
 
#define SPC   (space + 2 * (MAX_AMF_LEVELS - level))
 
#define NEEDBYTES(n)   if ((unsigned long int)(end - p) < n) return 0
 
#define GETBYTES(n)
 

Enumerations

enum  af_t {
  AF_PCM_BE , AF_ADPCM , AF_MP3 , AF_PCM_LE ,
  AF_NELLY16 , AF_NELLY8 , AF_NELLY , AF_ALAW ,
  AF_MULAW , AF_reserved9 , AF_AAC , AF_SPEEX ,
  AF_reserved12 , AF_reserved13 , AF_MP38 , AF_DS
}
 
enum  vf_t {
  VF_reserved0 , VF_JPEG , VF_FLV1 , VF_SCREEN ,
  VF_VP6 , VF_VP6A , VF_SCREEN2 , VF_H264 ,
  VF_H263 , VF_MP4 , VF_reserved10 , VF_reserved11 ,
  VF_HEVC
}
 
enum  amf_type_t {
  AMF0_NUMBER = 0x00 , AMF0_BOOLEAN = 0x01 , AMF0_STRING = 0x02 , AMF0_OBJECT = 0x03 ,
  AMF0_MOVIECLIP = 0x04 , AMF0_NULL_VALUE = 0x05 , AMF0_UNDEFINED = 0x06 , AMF0_REFERENCE = 0x07 ,
  AMF0_ECMA_ARRAY = 0x08 , AMF0_OBJECT_END = 0x09 , AMF0_STRICT_ARRAY = 0x0a , AMF0_DATE = 0x0b ,
  AMF0_LONG_STRING = 0x0c , AMF0_UNSUPPORTED = 0x0d , AMF0_RECORD_SET = 0x0e , AMF0_XML_OBJECT = 0x0f ,
  AMF0_TYPED_OBJECT = 0x10 , AMF0_AMF3 = 0x11
}
 

Functions

static void check_newpts (demux_flv_t *this, int64_t pts, int video)
 
static unsigned int key_num (const char *key)
 
static int parse_amf (demux_flv_t *this, unsigned char *buf, int size)
 
static int read_flv_packet (demux_flv_t *this, int preview)
 
static void seek_flv_file (demux_flv_t *this, off_t seek_pos, int seek_pts)
 
static int demux_flv_send_chunk (demux_plugin_t *this_gen)
 
static void demux_flv_send_headers (demux_plugin_t *this_gen)
 
static int demux_flv_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
 
static void demux_flv_dispose (demux_plugin_t *this_gen)
 
static int demux_flv_get_status (demux_plugin_t *this_gen)
 
static int demux_flv_get_stream_length (demux_plugin_t *this_gen)
 
static uint32_t demux_flv_get_capabilities (demux_plugin_t *this_gen)
 
static int demux_flv_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_flv_init_class (xine_t *xine, const void *data)
 

Macro Definition Documentation

◆ abs

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

◆ BE_F64

#define BE_F64 (   buf)
Value:
({\
union { uint64_t q; double d; } _tmp;\
_tmp.q = _X_BE_64(buf);\
_tmp.d;\
})\
#define _X_BE_64(x)
Definition: bswap.h:49

◆ FLV_FLAG_HAS_AUDIO

#define FLV_FLAG_HAS_AUDIO   0x04

◆ FLV_FLAG_HAS_VIDEO

#define FLV_FLAG_HAS_VIDEO   0x01

◆ FLV_TAG_TYPE_AUDIO

#define FLV_TAG_TYPE_AUDIO   0x08

◆ FLV_TAG_TYPE_NOTIFY

#define FLV_TAG_TYPE_NOTIFY   0x12

◆ FLV_TAG_TYPE_VIDEO

#define FLV_TAG_TYPE_VIDEO   0x09

◆ GETBYTES

#define GETBYTES (   n)
Value:
if (remaining_bytes < n) \
continue; \
if (this->input->read (this->input, (char *)buffer + 16, n) != n) \
goto fail; \
remaining_bytes -= n;
static int input(void)
Definition: goomsl_lex.c:1495

◆ gettimestamp

#define gettimestamp (   p,
 
)    (((((((uint32_t)p[o+3]<<8)|p[o])<<8)|p[o+1])<<8)|p[o+2])

◆ IS_PCM

#define IS_PCM (   id)    ((((1<<AF_PCM_BE)|(1<<AF_ADPCM)|(1<<AF_PCM_LE)|(1<<AF_ALAW)|(1<<AF_MULAW))>>(id))&1)

◆ LOG_MODULE

#define LOG_MODULE   "demux_flv"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MAX_AMF_LEVELS

#define MAX_AMF_LEVELS   10

◆ NEEDBYTES

#define NEEDBYTES (   n)    if ((unsigned long int)(end - p) < n) return 0

◆ PTS_AUDIO

#define PTS_AUDIO   0

◆ PTS_VIDEO

#define PTS_VIDEO   1

◆ SPC

#define SPC   (space + 2 * (MAX_AMF_LEVELS - level))

◆ TEMPBUFSIZE

#define TEMPBUFSIZE   4096

◆ WRAP_THRESHOLD

#define WRAP_THRESHOLD   220000

Enumeration Type Documentation

◆ af_t

enum af_t
Enumerator
AF_PCM_BE 
AF_ADPCM 
AF_MP3 
AF_PCM_LE 
AF_NELLY16 
AF_NELLY8 
AF_NELLY 
AF_ALAW 
AF_MULAW 
AF_reserved9 
AF_AAC 
AF_SPEEX 
AF_reserved12 
AF_reserved13 
AF_MP38 
AF_DS 

◆ amf_type_t

enum amf_type_t
Enumerator
AMF0_NUMBER 
AMF0_BOOLEAN 
AMF0_STRING 
AMF0_OBJECT 
AMF0_MOVIECLIP 
AMF0_NULL_VALUE 
AMF0_UNDEFINED 
AMF0_REFERENCE 
AMF0_ECMA_ARRAY 
AMF0_OBJECT_END 
AMF0_STRICT_ARRAY 
AMF0_DATE 
AMF0_LONG_STRING 
AMF0_UNSUPPORTED 
AMF0_RECORD_SET 
AMF0_XML_OBJECT 
AMF0_TYPED_OBJECT 
AMF0_AMF3 

◆ vf_t

enum vf_t
Enumerator
VF_reserved0 
VF_JPEG 
VF_FLV1 
VF_SCREEN 
VF_VP6 
VF_VP6A 
VF_SCREEN2 
VF_H264 
VF_H263 
VF_MP4 
VF_reserved10 
VF_reserved11 
VF_HEVC 

Function Documentation

◆ check_newpts()

static void check_newpts ( demux_flv_t this,
int64_t  pts,
int  video 
)
static

◆ demux_flv_dispose()

static void demux_flv_dispose ( demux_plugin_t this_gen)
static

Referenced by open_plugin().

◆ demux_flv_get_capabilities()

static uint32_t demux_flv_get_capabilities ( demux_plugin_t this_gen)
static

References DEMUX_CAP_AUDIOLANG, and DEMUX_CAP_VIDEO_TIME.

Referenced by open_plugin().

◆ demux_flv_get_optional_data()

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

◆ demux_flv_get_status()

static int demux_flv_get_status ( demux_plugin_t this_gen)
static

Referenced by open_plugin().

◆ demux_flv_get_stream_length()

static int demux_flv_get_stream_length ( demux_plugin_t this_gen)
static

Referenced by open_plugin().

◆ demux_flv_init_class()

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

◆ demux_flv_seek()

static int demux_flv_seek ( demux_plugin_t this_gen,
off_t  start_pos,
int  start_time,
int  playing 
)
static

◆ demux_flv_send_chunk()

static int demux_flv_send_chunk ( demux_plugin_t this_gen)
static

References read_flv_packet().

Referenced by open_plugin().

◆ demux_flv_send_headers()

static void demux_flv_send_headers ( demux_plugin_t this_gen)
static

◆ key_num()

static unsigned int key_num ( const char *  key)
static

References key.

Referenced by parse_amf().

◆ open_plugin()

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

◆ parse_amf()

static int parse_amf ( demux_flv_t this,
unsigned char *  buf,
int  size 
)
static

◆ read_flv_packet()

static int read_flv_packet ( demux_flv_t this,
int  preview 
)
static

References _X_BE_32, _x_keyframes_add(), AF_AAC, AF_ADPCM, AF_ALAW, AF_MP3, AF_MP38, AF_MULAW, AF_NELLY, AF_NELLY16, AF_NELLY8, AF_PCM_BE, AF_PCM_LE, AF_SPEEX, xine_bmiheader::biHeight, xine_bmiheader::biSize, xine_bmiheader::biWidth, BUF_AUDIO_AAC, BUF_AUDIO_ALAW, BUF_AUDIO_FLVADPCM, BUF_AUDIO_LPCM_BE, BUF_AUDIO_LPCM_LE, BUF_AUDIO_MPEG, BUF_AUDIO_MULAW, BUF_AUDIO_SPEEX, BUF_AUDIO_UNKNOWN, BUF_FLAG_FRAME_END, BUF_FLAG_FRAME_START, BUF_FLAG_FRAMERATE, BUF_FLAG_HEADER, BUF_FLAG_KEYFRAME, BUF_FLAG_SPECIAL, BUF_FLAG_STDHEADER, BUF_SPECIAL_DECODER_CONFIG, buf_type, BUF_VIDEO_FLV1, BUF_VIDEO_H263, BUF_VIDEO_H264, BUF_VIDEO_HEVC, BUF_VIDEO_JPEG, BUF_VIDEO_MPEG4, BUF_VIDEO_UNKNOWN, BUF_VIDEO_VP6F, fifo_buffer_s::buffer_pool_alloc, fifo_buffer_s::buffer_pool_size_alloc, check_newpts(), buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, DEMUX_FINISHED, DEMUX_OK, buf_element_s::extra_info, FLV_TAG_TYPE_AUDIO, FLV_TAG_TYPE_NOTIFY, FLV_TAG_TYPE_VIDEO, buf_element_s::free_buffer, GETBYTES, gettimestamp, height, input(), extra_info_s::input_normpos, extra_info_s::input_time, IS_PCM, lprintf, buf_element_s::max_size, buf_element_s::mem, xine_keyframes_entry_t::msecs, xine_keyframes_entry_t::normpos, NULL, parse_amf(), buf_element_s::pts, fifo_buffer_s::put, buf_element_s::size, buf_element_s::type, VF_FLV1, VF_H263, VF_H264, VF_HEVC, VF_JPEG, VF_MP4, VF_VP6, VF_VP6A, width, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_flv_send_chunk(), and demux_flv_send_headers().

◆ seek_flv_file()

static void seek_flv_file ( demux_flv_t this,
off_t  seek_pos,
int  seek_pts 
)
static