基于嵌入式Linux的视频采集系统17-----源程序----decoder.h

本文来自:
http://blog.chinaunix.net/uid-23093301-id-86406.html

#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 <iostream>
#include <string>
#include <vector>
#include<pthread.h>
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<TFrameNode>  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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值