⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msvideo.c

📁 linphone 网络电话 linphone 网络电话 linphone 网络电话
💻 C
字号:
/*mediastreamer2 library - modular sound and video processing and streamingCopyright (C) 2006  Simon MORLAT (simon.morlat@linphone.org)This program is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public Licenseas published by the Free Software Foundation; either version 2of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.*/#include "mediastreamer2/msvideo.h"static void yuv_buf_init(YuvBuf *buf, int w, int h, uint8_t *ptr){	int ysize,usize;	ysize=w*h;	usize=ysize/4;	buf->w=w;	buf->h=h;	buf->planes[0]=ptr;	buf->planes[1]=buf->planes[0]+ysize;	buf->planes[2]=buf->planes[1]+usize;	buf->strides[0]=w;	buf->strides[1]=w/2;	buf->strides[2]=buf->strides[1];}int yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){	int size=m->b_wptr-m->b_rptr;	int w,h;	if (size==(MS_VIDEO_SIZE_QCIF_W*MS_VIDEO_SIZE_QCIF_H*3)/2){		w=MS_VIDEO_SIZE_QCIF_W;		h=MS_VIDEO_SIZE_QCIF_H;	}else if (size==(MS_VIDEO_SIZE_CIF_W*MS_VIDEO_SIZE_CIF_H*3)/2){		w=MS_VIDEO_SIZE_CIF_W;		h=MS_VIDEO_SIZE_CIF_H;	}else if (size==(MS_VIDEO_SIZE_QVGA_W*MS_VIDEO_SIZE_QVGA_H*3)/2){		w=MS_VIDEO_SIZE_QVGA_W;		h=MS_VIDEO_SIZE_QVGA_H;	}else {		ms_error("Unsupported image size.");		return -1;	}	yuv_buf_init(buf,w,h,m->b_rptr);	return 0;}void yuv_buf_init_from_mblk_with_size(YuvBuf *buf, mblk_t *m, int w, int h){	yuv_buf_init(buf,w,h,m->b_rptr);}mblk_t * yuv_buf_alloc(YuvBuf *buf, int w, int h){	int size=(w*h*3)/2;	mblk_t *msg=allocb(size,0);	yuv_buf_init(buf,w,h,msg->b_wptr);	msg->b_wptr+=size;	return msg;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -