📄 decinit.h
字号:
/*************************************************************************
decinit.h
*************************************************************************/
#ifndef __DECINIT_H_
#define __DECINIT_H_
#ifdef _MIPS_LINUX_
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
typedef long LONG;
typedef unsigned short WORD;
typedef struct tagBITMAPINFOHEADER
{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
typedef struct _RECT
{
LONG left;
LONG top;
LONG right;
LONG bottom;
} RECT, *PRECT;
#else
#include <windows.h>
#include "types.h"
typedef long off_t;
#endif
#include <mae_interface.h>
#include <driverif.h>
#include "avcodec.h"
#include "bswap.h"
#include "avutil.h"
#define TRUE 1
#define FALSE 0
#define min(a, b) (((a) < (b)) ? (a) : (b))
extern inline void copy_32_aligned_words(signed char* src, signed char* dst);
extern inline void zero_128b_32a(signed char* src);
extern inline void zero_256b_32a(signed char* src);
#define COPY_128B_16A(_src_, _dst_) copy_32_aligned_words(_src_, _dst_)
#define ZERO_128B(_src_) zero_128b_32a(_src_)
#define ZERO_256B(_src_) zero_256b_32a(_src_)
typedef struct ibuf_s
{
unsigned char *pbuf;
unsigned int size;
unsigned int flags;
unsigned int dmoflags;
LONGLONG pts;
} ibuf_t;
typedef struct demux_packet_st
{
int len;
double pts;
off_t pos; // position in index (AVI) or file (MPG)
unsigned char* buffer;
int flags; // keyframe, etc
int refcount; //refcounter for the master packet, if 0, buffer can be free()d
struct demux_packet_st* master; //pointer to the master packet if this one is a cloned one
struct demux_packet_st* next;
} demux_packet_t;
typedef struct
{
int buffer_pos; // current buffer position
int buffer_size; // current buffer size
unsigned char* buffer; // current buffer, never free() it, always use free_demux_packet(buffer_ref);
double pts; // current buffer's pts
int pts_bytes; // number of bytes read after last pts stamp
int eof; // end of demuxed stream? (true if all buffer empty)
off_t pos; // position in the input stream (file)
off_t dpos; // position in the demuxed stream
int pack_no; // serial number of packet
int flags; // flags of current packet (keyframe etc)
//---------------
int packs; // number of packets in buffer
int bytes; // total bytes of packets in buffer
demux_packet_t *first; // read to current buffer from here
demux_packet_t *last; // append new packets from input stream to here
demux_packet_t *current;// needed for refcounting of the buffer
int id; // stream ID (for multiple audio/video streams)
struct demuxer_st *demuxer; // parent demuxer structure (stream handler)
// ---- asf -----
demux_packet_t *asf_packet; // read asf fragments here
int asf_seq;
// ---- mov -----
unsigned int ss_mul,ss_div;
// ---- stream header ----
void* sh;
} demux_stream_t;
typedef struct
{
int vid;
demux_stream_t *ds;
struct codecs_st *codec;
unsigned int format;
int inited;
float timer; // absolute time in video stream, since last start/seek
float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
// frame counters:
float num_frames; // number of frames played
int num_frames_decoded; // number of frames decoded
// timing (mostly for mpeg):
double pts; // predicted/interpolated PTS of the current frame
double i_pts; // PTS for the _next_ I/P frame
double buffered_pts[20];
int num_buffered_pts;
// output format: (set by demuxer)
float fps; // frames per second (set only if constant fps)
float frametime; // 1/fps
float aspect; // aspect ratio stored in the file (for prescaling)
int i_bps; // == bitrate (compressed bytes/sec)
int disp_w,disp_h; // display size (filled by fileformat parser)
// output driver/filters: (set by libmpcodecs core)
unsigned int outfmtidx;
void* video_out; // the video_out handle, used for this video stream
void* vfilter; // the video filter chain, used for this video stream
int vf_inited;
// win32-compatible codec parameters:
// AVIStreamHeader video;
BITMAPINFOHEADER* bih;
void* ImageDesc; // for quicktime codecs
// codec-specific:
void* context; // codec-specific stuff (usually HANDLE or struct pointer)
} sh_video_t;
sh_video_t sh_video;
typedef struct
{
AVCodecContext *avctx;
AVFrame *pic;
int last_aspect;
int do_slices;
int do_dr1;
int vo_inited;
int best_csp;
int b_age;
int ip_age[2];
int qp_stat[32];
int qp_sum;
int inv_qp_sum;
int ip_count;
int b_count;
} vd_ffmpeg_ctx;
typedef enum {NOT_DONE, PIECE_DONE, UPDATE_DONE} SptMBstatus;
extern int H264_Decoder_Init(ibuf_t * pInBuf, int * w, int * h);
extern int h264_decode(ibuf_t* pInBuf, unsigned int *bytes_read);
extern void H264_Decoder_CleanUp();
extern int h264_decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size);
#endif // __DECINIT_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -