generic/clutterfb: implement PIG

This commit is contained in:
Stefan Seyfried
2017-02-19 17:52:12 +01:00
parent 0226277758
commit 9348cef2a6
3 changed files with 23 additions and 2 deletions

View File

@@ -261,6 +261,8 @@ void GLFramebuffer::run()
clutter_timeline_set_repeat_count(tl, -1); clutter_timeline_set_repeat_count(tl, -1);
clutter_timeline_start(tl); clutter_timeline_start(tl);
clutter_main(); clutter_main();
g_object_unref(tl);
free(argv);
lt_info("GLFB: GL thread stopping\n"); lt_info("GLFB: GL thread stopping\n");
} }
@@ -273,7 +275,7 @@ void GLFramebuffer::run()
{ {
guint key = clutter_event_get_key_symbol (event); guint key = clutter_event_get_key_symbol (event);
int keystate = user_data ? 1 : 0; int keystate = user_data ? 1 : 0;
lt_info_c("GLFB::%s: 0x%x, %d\n", __func__, key, keystate); lt_debug_c("GLFB::%s: 0x%x, %d\n", __func__, key, keystate);
struct input_event ev; struct input_event ev;
if (key == 'f' && keystate) if (key == 'f' && keystate)
@@ -303,6 +305,11 @@ void GLFbPC::render()
clutter_main_quit(); clutter_main_quit();
mReInitLock.lock(); mReInitLock.lock();
if (vdec && vdec->pig_changed)
{
mReInit = true;
vdec->pig_changed = false;
}
if (mReInit) if (mReInit)
{ {
int xoff = 0; int xoff = 0;
@@ -327,7 +334,6 @@ void GLFbPC::render()
__func__, *mX, *mY, xoff, yoff, mFullscreen); __func__, *mX, *mY, xoff, yoff, mFullscreen);
} }
mReInitLock.unlock(); mReInitLock.unlock();
bltDisplayBuffer(); /* decoded video stream */ bltDisplayBuffer(); /* decoded video stream */
if (mState.blit) { if (mState.blit) {
/* only blit manually after fb->blit(), this helps to find missed blit() calls */ /* only blit manually after fb->blit(), this helps to find missed blit() calls */
@@ -391,6 +397,18 @@ void GLFbPC::render()
} }
break; break;
} }
if (vdec &&
vdec->pig_x >= 0 && vdec->pig_y >= 0 &&
vdec->pig_w > 0 && vdec->pig_h > 0) {
int ox = mState.width - vdec->pig_w;
int oy = mState.height - vdec->pig_h;
float ppx = vdec->pig_x / (float) ox;
float ppy = vdec->pig_y / (float) oy;
zoom = zoom * (float)vdec->pig_w / mState.width;
clutter_actor_set_pivot_point(vid_actor, ppx, ppy);
} else {
clutter_actor_set_pivot_point(vid_actor, 0.5, 0.5);
}
lt_debug("zoom: %f xscale: %f xzoom: %f\n", zoom, xscale,xzoom); lt_debug("zoom: %f xscale: %f xzoom: %f\n", zoom, xscale,xzoom);
clutter_actor_set_scale(vid_actor, xscale*zoom*xzoom, zoom); clutter_actor_set_scale(vid_actor, xscale*zoom*xzoom, zoom);
} }

View File

@@ -97,6 +97,7 @@ VDec::VDec()
buf_in = 0; buf_in = 0;
buf_out = 0; buf_out = 0;
pig_x = pig_y = pig_w = pig_h = 0; pig_x = pig_y = pig_w = pig_h = 0;
pig_changed = false;
display_aspect = DISPLAY_AR_16_9; display_aspect = DISPLAY_AR_16_9;
display_crop = DISPLAY_AR_MODE_LETTERBOX; display_crop = DISPLAY_AR_MODE_LETTERBOX;
v_format = VIDEO_FORMAT_MPEG2; v_format = VIDEO_FORMAT_MPEG2;
@@ -407,6 +408,7 @@ void VDec::Pig(int x, int y, int w, int h)
pig_y = y; pig_y = y;
pig_w = w; pig_w = w;
pig_h = h; pig_h = h;
pig_changed = true;
} }
void cVideo::getPictureInfo(int &width, int &height, int &rate) void cVideo::getPictureInfo(int &width, int &height, int &rate)

View File

@@ -101,6 +101,7 @@ class VDec : public OpenThreads::Thread
int pig_y; int pig_y;
int pig_w; int pig_w;
int pig_h; int pig_h;
bool pig_changed;
OpenThreads::Mutex still_m; OpenThreads::Mutex still_m;
bool stillpicture; bool stillpicture;
}; };