Commit 02f32e60 authored by jehan's avatar jehan

Merge branch 'master' of git.linphone.org:mediastreamer2

parents 7e0c696c 82220afa
......@@ -192,7 +192,8 @@ MSPixFmt ffmpeg_pix_fmt_to_ms(int fmt);
MSPixFmt ms_fourcc_to_pix_fmt(uint32_t fourcc);
void ms_ffmpeg_check_init(void);
int ms_yuv_buf_init_from_mblk(MSPicture *buf, mblk_t *m);
void ms_yuv_buf_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, int w, int h);
int ms_yuv_buf_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, int w, int h);
int ms_picture_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, MSPixFmt fmt, int w, int h);
mblk_t * ms_yuv_buf_alloc(MSPicture *buf, int w, int h);
void ms_yuv_buf_copy(uint8_t *src_planes[], const int src_strides[],
uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi);
......
......@@ -731,7 +731,7 @@ static int find_best_format(ComPtr<IAMStreamConfig> streamConfig, int count, MSV
MSVideoSize cur;
cur.width=infoHeader->bmiHeader.biWidth;
cur.height=infoHeader->bmiHeader.biHeight;
if (ms_video_size_greater_than(cur,*requested_size)){
if (ms_video_size_greater_than(*requested_size,cur)){
if (ms_video_size_greater_than(best_found,cur)){
best_found=cur;
best_index=i;
......
......@@ -138,8 +138,29 @@ int ms_yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){
return 0;
}
void ms_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);
int ms_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);
return 0;
}
int ms_picture_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, MSPixFmt fmt, int w, int h){
switch(fmt){
case MS_YUV420P:
return ms_yuv_buf_init_from_mblk_with_size(buf,m,w,h);
break;
case MS_YUY2:
memset(buf,0,sizeof(*buf));
buf->w=w;
buf->h=h;
buf->planes[0]=m->b_rptr;
buf->strides[0]=w*2;
break;
default:
ms_fatal("FIXME: unsupported format %i",fmt);
return -1;
}
return 0;
}
mblk_t * ms_yuv_buf_alloc(YuvBuf *buf, int w, int h){
......
......@@ -81,7 +81,7 @@ static void pixconv_process(MSFilter *f){
om=im;
}else{
MSPicture inbuf;
if (ms_yuv_buf_init_from_mblk(&inbuf,im)==0){
if (ms_picture_init_from_mblk_with_size(&inbuf,im,s->in_fmt,s->size.width,s->size.height)==0){
om=pixconv_alloc_mblk(s);
if (s->scaler==NULL){
s->scaler=ms_scaler_create_context(inbuf.w, inbuf.h,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment