Chinaunix首页 | 论坛 | 博客
  • 博客访问: 396937
  • 博文数量: 48
  • 博客积分: 1820
  • 博客等级: 上尉
  • 技术积分: 705
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-28 23:10
文章分类

全部博文(48)

文章存档

2012年(1)

2011年(12)

2010年(34)

2009年(1)

分类: 嵌入式

2010-07-24 00:00:45

#ifndef __DECODER_H_INCLUDE
#define __DECODER_H_INCLUDE

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */
#include "avcodec.h"
#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
#include "libavcodec/avcodec.h"

#ifdef __cplusplus
}
#endif  /* __cplusplus */
#include
#include
#include
#include
using namespace std;
#define DEF_FRAME_SIZE 10844*5 

typedef struct TFrameNode
{
AVPacket pkt;
void*  buff[DEF_FRAME_SIZE];
int  size;
}TFrameNode;

class CDecoder
{
public:

CDecoder();
~CDecoder();
void push_frame(void* img,int size);
AVPacket* pop_frame();

void try_show(AVFrame* picture,int width=320,int height=240);
char*  readall_file(const string& file,int & size);
private:
AVFrame * do_alloc_picture(int pix_fmt, int width, int height);
private:
char  filename [256];
vector  m_frame_que;
int   cur_process_pos;
int   cur_append_pos;
int   num_has_append;
TFrameNode m_convert_buff;
private:
//////////////////////// for thread safe 
pthread_cond_t m_pthread_cond;
pthread_mutex_t m_mutex;
};



#endif



阅读(1532) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~