Commit 23f86077 authored by Simon Morlat's avatar Simon Morlat

support for portrait modes

parent ffacf567
......@@ -71,6 +71,8 @@ void ms_queue_flush(MSQueue *q);
void ms_queue_destroy(MSQueue *q);
#define mblk_set_timestamp_info(m,ts) (m)->reserved1=(ts);
#define mblk_get_timestamp_info(m) ((m)->reserved1)
#define mblk_set_marker_info(m,bit) (m)->reserved2=((m)->reserved2|bit)
......@@ -81,6 +83,11 @@ void ms_queue_destroy(MSQueue *q);
#define mblk_get_payload_type(m) (((m)->reserved2>>3)&0x7F)
#define mblk_set_precious_flag(m,bit) (m)->reserved2=(m)->reserved2|((bit & 0x1)<<10) /*use to prevent mirroring*/
#define mblk_get_precious_flag(m) (((m)->reserved2)>>10 & 0x1)
#define mblk_set_video_orientation(m,o) do{\
if (o==MS_VIDEO_LANDSCAPE) (m)->reserved2=(m)->reserved2 & ~(1<<11); \
else (m)->reserved2|=(1<<11); \
}
#define mblk_get_video_orientation(m) (((m)->reserved2 & (1<<11)) ? MS_VIDEO_PORTRAIT : MS_VIDEO_LANDSCAPE)
struct _MSBufferizer{
queue_t q;
......
......@@ -157,6 +157,11 @@ typedef struct MSRect{
#define MS_VIDEO_SIZE_1024_H 768
#define MS_VIDEO_SIZE_1024 MS_VIDEO_SIZE_XGA
typedef enum MSVideoOrientation{
MS_VIDEO_LANDSCAPE = 0,
MS_VIDEO_PORTRAIT =1
}MSVideoOrientation;
typedef enum{
MS_YUV420P,
MS_YUYV,
......
......@@ -299,7 +299,7 @@ static int set_high_prio(void){
if((result=pthread_setschedparam(pthread_self(),policy, &param))) {
ms_warning("Set sched param failed with error code(%i)\n",result);
} else {
ms_message("MS ticker priority set to max");
ms_message("MS ticker priority set to max (%i)",param.sched_priority);
}
#endif
return precision;
......
......@@ -129,6 +129,11 @@ int ms_yuv_buf_init_from_mblk(YuvBuf *buf, mblk_t *m){
ms_error("Unsupported image size: size=%i (bug somewhere !)",size);
return -1;
}
if (mblk_get_video_orientation(m)==MS_VIDEO_PORTRAIT){
int tmp=h;
h=w;
w=tmp;
}
yuv_buf_init(buf,w,h,m->b_rptr);
return 0;
}
......@@ -142,6 +147,10 @@ mblk_t * ms_yuv_buf_alloc(YuvBuf *buf, int w, int h){
const int padding=16;
mblk_t *msg=allocb(size+padding,0);
yuv_buf_init(buf,w,h,msg->b_wptr);
if (h>w)
mblk_set_video_orientation(msg,MS_VIDEO_PORTRAIT);
else
mblk_set_video_orientation(msg,MS_VIDEO_LANDSCAPE);
msg->b_wptr+=size;
return msg;
}
......
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