Commit 597f1989 authored by Aymeric Moizard's avatar Aymeric Moizard
Browse files

allow replacement for yuv_buf_copy

parent 489b3b07
...@@ -145,7 +145,7 @@ void ms_ffmpeg_check_init(void); ...@@ -145,7 +145,7 @@ void ms_ffmpeg_check_init(void);
int yuv_buf_init_from_mblk(MSPicture *buf, mblk_t *m); int yuv_buf_init_from_mblk(MSPicture *buf, mblk_t *m);
void yuv_buf_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, int w, int h); void yuv_buf_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, int w, int h);
mblk_t * yuv_buf_alloc(MSPicture *buf, int w, int h); mblk_t * yuv_buf_alloc(MSPicture *buf, int w, int h);
void yuv_buf_copy(uint8_t *src_planes[], const int src_strides[], void ms_yuv_buf_copy(uint8_t *src_planes[], const int src_strides[],
uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi); uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi);
void ms_yuv_buf_mirror(YuvBuf *buf); void ms_yuv_buf_mirror(YuvBuf *buf);
void rgb24_revert(uint8_t *buf, int w, int h, int linesize); void rgb24_revert(uint8_t *buf, int w, int h, int linesize);
...@@ -189,12 +189,15 @@ typedef void (*sws_freeContextFunc)(struct ms_SwsContext *swsContext); ...@@ -189,12 +189,15 @@ typedef void (*sws_freeContextFunc)(struct ms_SwsContext *swsContext);
typedef int (*sws_scaleFunc)(struct ms_SwsContext *context, uint8_t* srcSlice[], int srcStride[], typedef int (*sws_scaleFunc)(struct ms_SwsContext *context, uint8_t* srcSlice[], int srcStride[],
int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]); int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]);
typedef void (*yuv_buf_mirrorFunc)(MSPicture *buf); typedef void (*yuv_buf_mirrorFunc)(MSPicture *buf);
typedef void (*yuv_buf_copyFunc)(uint8_t *src_planes[], const int src_strides[],
uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi);
struct ms_swscaleDesc { struct ms_swscaleDesc {
sws_getContextFunc sws_getContext; sws_getContextFunc sws_getContext;
sws_freeContextFunc sws_freeContext; sws_freeContextFunc sws_freeContext;
sws_scaleFunc sws_scale; sws_scaleFunc sws_scale;
yuv_buf_mirrorFunc yuv_buf_mirror; yuv_buf_mirrorFunc yuv_buf_mirror;
yuv_buf_copyFunc yuv_buf_copy;
}; };
void ms_video_set_video_func(struct ms_swscaleDesc *_ms_swscale_desc); void ms_video_set_video_func(struct ms_swscaleDesc *_ms_swscale_desc);
......
...@@ -138,7 +138,7 @@ static void plane_copy(const uint8_t *src_plane, int src_stride, ...@@ -138,7 +138,7 @@ static void plane_copy(const uint8_t *src_plane, int src_stride,
} }
} }
void yuv_buf_copy(uint8_t *src_planes[], const int src_strides[], static void yuv_buf_copy(uint8_t *src_planes[], const int src_strides[],
uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi){ uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi){
plane_copy(src_planes[0],src_strides[0],dst_planes[0],dst_strides[0],roi); plane_copy(src_planes[0],src_strides[0],dst_planes[0],dst_strides[0],roi);
roi.width=roi.width/2; roi.width=roi.width/2;
...@@ -294,6 +294,16 @@ void ms_yuv_buf_mirror(YuvBuf *buf) ...@@ -294,6 +294,16 @@ void ms_yuv_buf_mirror(YuvBuf *buf)
return ms_swscale_desc.yuv_buf_mirror(buf); return ms_swscale_desc.yuv_buf_mirror(buf);
} }
void ms_yuv_buf_copy(uint8_t *src_planes[], const int src_strides[],
uint8_t *dst_planes[], const int dst_strides[3], MSVideoSize roi)
{
if (ms_swscale_desc.yuv_buf_copy==NULL)
{
ms_swscale_desc.yuv_buf_copy=(yuv_buf_copyFunc)yuv_buf_copy;
}
return ms_swscale_desc.yuv_buf_copy(src_planes, src_strides, dst_planes, dst_strides, roi);
}
void ms_video_set_video_func(struct ms_swscaleDesc *_ms_swscale_desc) void ms_video_set_video_func(struct ms_swscaleDesc *_ms_swscale_desc)
{ {
ms_swscale_desc.sws_getContext=_ms_swscale_desc->sws_getContext; ms_swscale_desc.sws_getContext=_ms_swscale_desc->sws_getContext;
......
...@@ -1155,7 +1155,7 @@ static void video_out_process(MSFilter *f){ ...@@ -1155,7 +1155,7 @@ static void video_out_process(MSFilter *f){
corner.planes[2]+=(obj->local_rect.x/2)+((obj->local_rect.y/2)*corner.strides[2]); corner.planes[2]+=(obj->local_rect.x/2)+((obj->local_rect.y/2)*corner.strides[2]);
corner.planes[3]=0; corner.planes[3]=0;
ms_display_lock(obj->display); ms_display_lock(obj->display);
yuv_buf_copy(obj->local_pic.planes,obj->local_pic.strides, ms_yuv_buf_copy(obj->local_pic.planes,obj->local_pic.strides,
corner.planes,corner.strides,roi); corner.planes,corner.strides,roi);
ms_display_unlock(obj->display); ms_display_unlock(obj->display);
} }
......
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