91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

基于arm9的遠程視頻監控系統,使用Qt編寫客戶端和服務器端,客戶端可實現視頻保存功能。服務器端運行于移植有linux內核的MINI2440上,客戶端運行于PC上,服務器端將采集到的視頻數據發送到客戶端,客戶端實現對視頻的顯示和保存等功能。

資源截圖

代碼片段和文件信息

#include?“ffmpegthread.h“
#include?
#include?
#include?
#include?
#include?
#include?
#include?
extern?bool?stopSave;
extern?bool?ifNew;
extern?unsigned?char?r[320*240];
extern?unsigned?char?g[320*240];
extern?unsigned?char?b[320*240];


ffmpegthread::ffmpegthread(Qobject?*parent)?:
????QThread(parent)
{
//????sws_flags?=?SWS_BICUBIC;
????fillTimes?=?0;
????time(&t);
????local_time?=?localtime(&t);
????datetime?=?new?QDateTime;
}


/*使用默任格式的編解碼器來增加一個視頻流并初始化編解碼器*/
AVStream?*?ffmpegthread::add_video_stream(AVFormatContext?*oc?CodecID?codec_id)
{
????AVCodecContext?*c;
????AVStream????*st;

????/*增加一個新的流到一個媒體文件*/
????st?=?av_new_stream(oc0);

????/*初始化編解碼器*/
????c?=?st->codec;
????c->codec_id?=?codec_id;
????c->codec_type?=?AVMEDIA_TYPE_VIDEO;

????/*put?sample?parameters*/
????c->bit_rate?=?400000;???//400kbit/s
????c->width?=?320;
????c->height?=?240;
????/*設置針率?該針率為25其實timebase?=?1/framerate*/
????c->time_base?=?(AVRational){15};
????/*設置GOP大小?表示每10針會插入一個I針*/
????c->gop_size?=?10;
????/*設置像素格式*/
????c->pix_fmt?=?PIX_FMT_YUV420P;
????if(c->codec_id?==?CODEC_ID_MPEG2VIDEO)
????{
????????/*該值表示在兩個非B針之間所允許插入的B針的最大針數*/
????????c->max_b_frames?=?2;
????}
????if(c->codec_id?==?CODEC_ID_MPEG1VIDEO)
????{
????????c->mb_decision?=?2;
????}
????/*some?formats?want?stream?headers?to?be?seperate*/
????if(oc->oformat->flags?&?AVFMT_GLOBALHEADER)
????????c->flags?|=?CODEC_FLAG_GLOBAL_HEADER;
????return?st;
}


/*分配原始圖像*/
AVframe?*ffmpegthread::alloc_picture(enum?PixelFormat?pix_fmt?int?width?int?height)
{
????AVframe?*picture;
????uint8_t?*picture_buf;
????int?size?=?0;

????/*分配一個AVframe并設置默任值*/
????picture?=?avcodec_alloc_frame();
????if(!picture)
????????return?NULL;
????//by?lzc
????picture->format?=?pix_fmt;
????picture->width?=?width;
????picture->height?=?height;
????picture->linesize[0]?=?width;
????picture->linesize[1]?=?width/2;
????picture->linesize[2]?=?width/2;

????/*計算對于給定的圖片格式以及寬和高所需占用多少內存*/
????size?=?avpicture_get_size(pix_fmtwidthheight);
????picture_buf?=?(uint8_t?*)av_malloc(size);//分配所需內存
????if(!picture_buf)
????{
????????av_free(picture);
????????return?NULL;
????}

?????/*用?ptr?中的內容根據文件格式(YUV...)和分辨率填充?picture。這里由于是在初始
????化階段所以填充的可能全是零*/
????avpicture_fill((AVPicture?*)picturepicture_bufpix_fmtwidthheight);??????//這里輸入換存針
????return?picture;
}


/*打開視頻編解碼器并分配必要的編碼緩存?主要是對視頻編碼器(或解碼器)的初始化過程*/
void?ffmpegthread::open_video(AVFormatContext?*oc?AVStream?*st)
{
????AVCodec?*codec;
????AVCodecContext?*c;

????c?=?st->codec;

????codec?=?avcodec_find_encoder(c->codec_id);//編碼時找編碼器
????if(!codec)
????{
????????fprintf(stderr“codec?not?found\n“);
????}
????/*open?the?codec*/
????if(avcodec_open(ccodec)?????{
????????fprintf(stderr“could?not?open?codec\n“);
????????exit(1);
????}

????video_outbuf?=?NULL;
????if(!(oc->oformat->flags?&?AVFMT_RAWPICTURE))
????{
????????/*allocate?output?buffer*/
????????video_outbuf_size?=?200000;
????????video_outbuf?=?(uint8_t?*)

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-06-11?09:54??myclient\
?????文件???????11140??2013-06-01?13:02??myclient\ffmpegthread.cpp
?????文件????????2091??2013-06-01?13:02??myclient\ffmpegthread.h
?????文件?????????787??2013-06-07?18:17??myclient\login.cpp
?????文件?????????398??2013-06-07?18:04??myclient\login.h
?????文件????????2811??2013-06-07?18:16??myclient\login.ui
?????文件?????????715??2013-06-07?18:14??myclient\main.cpp
?????文件????????4427??2013-06-07?16:42??myclient\mainwindow.cpp
?????文件?????????836??2013-06-01?13:02??myclient\mainwindow.h
?????文件????????5376??2013-06-07?16:38??myclient\mainwindow.ui
?????文件?????????589??2013-06-07?17:01??myclient\myclient.pro
?????文件???????16608??2013-06-09?09:28??myclient\myclient.pro.user
?????文件?????????402??2013-06-03?09:56??myclient\timethread.cpp
?????文件?????????380??2013-06-01?10:19??myclient\timethread.h
?????目錄???????????0??2013-06-11?09:54??myqtvideo\
?????文件?????????662??2013-05-16?20:45??myqtvideo\image.cpp
?????文件?????????355??2013-05-16?16:30??myqtvideo\image.h
?????文件?????????475??2013-06-07?18:19??myqtvideo\main.cpp
?????文件????????2550??2013-06-01?17:42??myqtvideo\mainwindow.cpp
?????文件?????????804??2013-06-01?17:01??myqtvideo\mainwindow.h
?????文件?????????956??2013-06-01?17:42??myqtvideo\mainwindow.ui
?????文件???????10058??2013-05-31?23:29??myqtvideo\Makefile
?????文件?????????491??2013-05-16?17:33??myqtvideo\myqtvideo.pro
?????文件???????16611??2013-06-09?09:28??myqtvideo\myqtvideo.pro.user
?????文件????????6042??2013-05-16?17:19??myqtvideo\v4l2.cpp
?????文件?????????866??2013-05-16?16:55??myqtvideo\v4l2.h
?????文件???????57744??2013-10-26?12:55??圖片1.png
?????文件??????380185??2013-10-26?12:55??圖片2.png
?????文件?????1018278??2013-10-26?12:55??圖片3.png

評論

共有 條評論