2011-10-10 0:22:22
2011-10-10 0:22:22
4. 上面調用了avcodec_init函數:
void avcodec_init(void)
{
static int initialized = 0;
if (initialized != 0)
return;
initialized = 1;
dsputil_static_init ();
}
av_cold void dsputil_static_init(void)
{
int i;
for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i;
for(i=0;i<MAX_NEG_CROP;i++) {
ff_cropTbl[i] = 0;
ff_cropTbl[i + MAX_NEG_CROP + 256] = 255;
}
for(i=0;i<512;i++) {
ff_squareTbl[i] = (i - 256) * (i - 256);
}
for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
}
REGISTER_MUXDEMUX (H264, h264);
// 註冊文件協議
REGISTER_PROTOCOL (FILE, file);
註冊mux和demux
#define REGISTER_MUXER(X,x) { \
extern AVOutputFormat x##_muxer; \
if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }
#define REGISTER_DEMUXER(X,x) { \
extern AVInputFormat x##_demuxer; \
if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
#define REGISTER_MUXDEMUX(X,x) REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
#define REGISTER_PROTOCOL(X,x) { \
extern URLProtocol x##_protocol; \
if(CONFIG_##X##_PROTOCOL) av_register_protocol(&x##_protocol); }
URL協議結構:
typedef struct URLProtocol {
const char *name;
int (*url_open)(URLContext *h, const char *url, int flags);
int (*url_read)(URLContext *h, unsigned char *buf, int size);
int (*url_write)(URLContext *h, unsigned char *buf, int size);
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
int (*url_close)(URLContext *h);
struct URLProtocol *next;
int (*url_read_pause)(URLContext *h, int pause);
int64_t (*url_read_seek)(URLContext *h, int stream_index,
int64_t timestamp, int flags);
int (*url_get_file_handle)(URLContext *h);
} URLProtocol;
4. 上面調用了avcodec_init函數:
void avcodec_init(void)
{
static int initialized = 0;
if (initialized != 0)
return;
initialized = 1;
dsputil_static_init ();
}
av_cold void dsputil_static_init(void)
{
int i;
for(i=0;i<256;i++) ff_cropTbl[i + MAX_NEG_CROP] = i;
for(i=0;i<MAX_NEG_CROP;i++) {
ff_cropTbl[i] = 0;
ff_cropTbl[i + MAX_NEG_CROP + 256] = 255;
}
for(i=0;i<512;i++) {
ff_squareTbl[i] = (i - 256) * (i - 256);
}
for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
}
REGISTER_MUXDEMUX (H264, h264);
// 註冊文件協議
REGISTER_PROTOCOL (FILE, file);
註冊mux和demux
#define REGISTER_MUXER(X,x) { \
extern AVOutputFormat x##_muxer; \
if(CONFIG_##X##_MUXER) av_register_output_format(&x##_muxer); }
#define REGISTER_DEMUXER(X,x) { \
extern AVInputFormat x##_demuxer; \
if(CONFIG_##X##_DEMUXER) av_register_input_format(&x##_demuxer); }
#define REGISTER_MUXDEMUX(X,x) REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
#define REGISTER_PROTOCOL(X,x) { \
extern URLProtocol x##_protocol; \
if(CONFIG_##X##_PROTOCOL) av_register_protocol(&x##_protocol); }
URL協議結構:
typedef struct URLProtocol {
const char *name;
int (*url_open)(URLContext *h, const char *url, int flags);
int (*url_read)(URLContext *h, unsigned char *buf, int size);
int (*url_write)(URLContext *h, unsigned char *buf, int size);
int64_t (*url_seek)(URLContext *h, int64_t pos, int whence);
int (*url_close)(URLContext *h);
struct URLProtocol *next;
int (*url_read_pause)(URLContext *h, int pause);
int64_t (*url_read_seek)(URLContext *h, int stream_index,
int64_t timestamp, int flags);
int (*url_get_file_handle)(URLContext *h);
} URLProtocol;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.