|
List Info
Thread: How can I render to a "invisible" gdk window
|
|
| How can I render to a
"invisible" gdk window |

|
2007-12-06 00:07:50 |
|
Hi All:
I know there is some
feature in dtdriver can do thumbnail, but I haven̵7;t tried it successfully.
I tried to create
thumbnail in another way. That is:
1> create a player and
rendering to a GDK window.
2> capture an image
from the GDK window as thumbnail.
Now it works to some
extent—if the gdk window is visible.
But when the GDK window is
not visible ( move it out of the screen or covered by another window), I can’t
get the image correctly.
It seems the engine stop
to render to the gdk window when it is invisible.
I want to create thumbnail
in the background, then how to force the engine keep rendering to the gdk
window even if it is invisible.
Attached file is my
implementation for creating thumbnail, thanks.
bool
tnplayer_get_thumbnail(TnPlayer*
tnplayer, gchar* uri, gchar* file)
{
int ret
= 0;
XID
xid;
PRINT_MARK;
int i =
0,j = 0, repeat_count = 0;
int
window_pos_x, window_pos_y, window_width, window_height, depth;
GdkWindow*
pWrapForeignWindow;
HxPlayer* thumb_nail_service = tnplayer->thumb_nail_service;
GdkColormap* gdk_colormap = NULL;
GdkPixbuf*
gdk_pixbuf = NULL;
GError*
error = NULL;
#define
TRY_TIMES 16
PRINTF("file:
%sn",file);
thumb_nail_service->bInitialized
= 0;
if(!(thumb_nail_service->window))
{
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
#if 1
gtk_window_move(GTK_WINDOW(window),
gdk_screen_width()-300,gdk_screen_height()-300);
#else
gtk_window_move(GTK_WINDOW(window),
gdk_screen_width()+300,gdk_screen_height()+300);
#endif
GtkWidget *Draw = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(window), Draw);
gtk_widget_show_all(window);
xid = gdk_x11_drawable_get_xid(Draw->window);
PRINT_MARK;
tnplayer->pWrapForeignWindow = Draw->window;
if(tnplayer->pWrapForeignWindow)
{
PRINT_MARK;
thumb_nail_service->window = g_new0(SHXClientWindow, 1);
thumb_nail_service->window->display = XOpenDisplay(NULL);
thumb_nail_service->window->window = (void*)xid;
thumb_nail_service->clntXID = xid;
thumb_nail_service->window->x = 0;
thumb_nail_service->window->y = 0;
int m_width, m_height;
int x, y, depth;
gdk_window_get_geometry(tnplayer->pWrapForeignWindow, &x, &y,
&m_width, &m_height, &depth);
thumb_nail_service->window->width = m_width;
thumb_nail_service->window->height = m_height;
thumb_nail_service->window->clipRect.left =
thumb_nail_service->window->x;
thumb_nail_service->window->clipRect.top =
thumb_nail_service->window->y;
thumb_nail_service->window->clipRect.right =
thumb_nail_service->window->width;
thumb_nail_service->window->clipRect.bottom
= thumb_nail_service->window->height;
}
else
{
thumb_nail_service->window = NULL;
return false;
}
PRINT_MARK;
if(!ClientPlayerCreate(&thumb_nail_service->token,
thumb_nail_service->window, thumb_nail_service, &HXCLIENT_CALLBACKS)) {
PRINT_MARK;
free(thumb_nail_service->window);
thumb_nail_service->window = NULL;
return false;
}
PRINT_MARK;
}
thumb_nail_service->bInitialized = 1;
PRINT_MARK;
ret =
ClientPlayerOpenURL(thumb_nail_service->token,uri, NULL);
ClientPlayerPlay(thumb_nail_service->token);
ClientPlayerMute(thumb_nail_service->token,true);
PRINT_MARK;
tnplayer_pump(thumb_nail_service);
guint
length = ClientPlayerGetLength(thumb_nail_service->token);
for(i=0;i<TRY_TIMES;i++)
{
if(length)
break;
tnplayer_pump(thumb_nail_service);
}
PRINTF("length: %dn",length);
guint
position = 0;
guint
pos_delta = 50;
if(length)
{
position = length/TRY_TIMES;
pos_delta = length/TRY_TIMES;
}
else
{
position = 0;
pos_delta = 50;
}
PRINT_MARK;
//
ClientPlayerPause(thumb_nail_service->token);
for(
repeat_count = 0; repeat_count < TRY_TIMES-1; repeat_count++)
{
PRINT_MARK;
tnplayer_pump(thumb_nail_service);
gdk_window_get_geometry(tnplayer->pWrapForeignWindow, &window_pos_x,
&window_pos_y, &window_width, &window_height, &depth);
gdk_colormap = gdk_drawable_get_colormap(GDK_DRAWABLE(tnplayer->pWrapForeignWindow));
if (gdk_colormap == NULL)
{
PRINTF("colormap NULLn");
return false;
}
gdk_pixbuf = gdk_pixbuf_get_from_drawable(NULL,
GDK_DRAWABLE(tnplayer->pWrapForeignWindow),
gdk_colormap, 0, 0, 0, 0, window_width, window_height);
if (gdk_pixbuf == NULL)
{
PRINTF("pixbuf NULLn");
return false;
}
if (pixbuf_is_valid(gdk_pixbuf, window_width, window_height))
{
PRINTF("####valid imagen");
break;
}
else if (repeat_count == 10)
{
PRINTF("****invalid imagen");
return false;
}
ret = ClientPlayerSetPosition(thumb_nail_service->token,position);
position += pos_delta;
PRINTF("position:%dn",position);
}
if
(gdk_pixbuf_save(gdk_pixbuf, file, "png", &error, NULL))
{
ClientPlayerStop(thumb_nail_service->token);
return true;
}
else
{
ClientPlayerStop(thumb_nail_service->token);
return false;
}
}
|
|
| RE: How can I render to a
"invisible" gdk window |

|
2007-12-06 03:57:25 |
|
Another question:
Could I get the video
output buffer from CHXClientSite or CHXClientSupplier?
From:
helix-client-dev-bounces helixcommunity.org
[mailto:helix-client-dev-bounces helixcommunity.org] On Behalf Of Zhao, Halley
Sent: 2007定12埖6晩 14:08
To:
helix-client-dev helixcommunity.org
Subject: [Helix-client-dev] How
can I render to a "invisible" gdk window
Hi All:
I know there is some
feature in dtdriver can do thumbnail, but I haven¨t tried it successfully.
I tried to create
thumbnail in another way. That is:
1> create a player and
rendering to a GDK window.
2> capture an image
from the GDK window as thumbnail.
Now it works to some
extent!if the gdk window is visible.
But when the GDK window is
not visible ( move it out of the screen or covered by another window), I can¨t
get the image correctly.
It seems the engine stop to
render to the gdk window when it is invisible.
I want to create thumbnail
in the background, then how to force the engine keep rendering to the gdk
window even if it is invisible.
Attached file is my
implementation for creating thumbnail, thanks.
bool
tnplayer_get_thumbnail(TnPlayer*
tnplayer, gchar* uri, gchar* file)
{
int ret
= 0;
XID
xid;
PRINT_MARK;
int i =
0,j = 0, repeat_count = 0;
int
window_pos_x, window_pos_y, window_width, window_height, depth;
GdkWindow*
pWrapForeignWindow;
HxPlayer* thumb_nail_service = tnplayer->thumb_nail_service;
GdkColormap* gdk_colormap = NULL;
GdkPixbuf* gdk_pixbuf = NULL;
GError*
error = NULL;
#define
TRY_TIMES 16
PRINTF("file:
%sn",file);
thumb_nail_service->bInitialized
= 0;
if(!(thumb_nail_service->window))
{
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
#if 1
gtk_window_move(GTK_WINDOW(window),
gdk_screen_width()-300,gdk_screen_height()-300);
#else
gtk_window_move(GTK_WINDOW(window),
gdk_screen_width()+300,gdk_screen_height()+300);
#endif
GtkWidget *Draw = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(window), Draw);
gtk_widget_show_all(window);
xid = gdk_x11_drawable_get_xid(Draw->window);
PRINT_MARK;
tnplayer->pWrapForeignWindow = Draw->window;
if(tnplayer->pWrapForeignWindow)
{
PRINT_MARK;
thumb_nail_service->window = g_new0(SHXClientWindow, 1);
thumb_nail_service->window->display = XOpenDisplay(NULL);
thumb_nail_service->window->window = (void*)xid;
thumb_nail_service->clntXID = xid;
thumb_nail_service->window->x = 0;
thumb_nail_service->window->y = 0;
int m_width, m_height;
int x, y, depth;
gdk_window_get_geometry(tnplayer->pWrapForeignWindow, &x, &y,
&m_width, &m_height, &depth);
thumb_nail_service->window->width = m_width;
thumb_nail_service->window->height = m_height;
thumb_nail_service->window->clipRect.left =
thumb_nail_service->window->x;
thumb_nail_service->window->clipRect.top =
thumb_nail_service->window->y;
thumb_nail_service->window->clipRect.right =
thumb_nail_service->window->width;
thumb_nail_service->window->clipRect.bottom
= thumb_nail_service->window->height;
}
else
{
thumb_nail_service->window = NULL;
return false;
}
PRINT_MARK;
if(!ClientPlayerCreate(&thumb_nail_service->token,
thumb_nail_service->window, thumb_nail_service, &HXCLIENT_CALLBACKS)) {
PRINT_MARK;
free(thumb_nail_service->window);
thumb_nail_service->window = NULL;
return false;
}
PRINT_MARK;
}
thumb_nail_service->bInitialized = 1;
PRINT_MARK;
ret =
ClientPlayerOpenURL(thumb_nail_service->token,uri, NULL);
ClientPlayerPlay(thumb_nail_service->token);
ClientPlayerMute(thumb_nail_service->token,true);
PRINT_MARK;
tnplayer_pump(thumb_nail_service);
guint
length = ClientPlayerGetLength(thumb_nail_service->token);
for(i=0;i<TRY_TIMES;i++)
{
if(length)
break;
tnplayer_pump(thumb_nail_service);
}
PRINTF("length: %dn",length);
guint
position = 0;
guint
pos_delta = 50;
if(length)
{
position = length/TRY_TIMES;
pos_delta = length/TRY_TIMES;
}
else
{
position = 0;
pos_delta = 50;
}
PRINT_MARK;
//
ClientPlayerPause(thumb_nail_service->token);
for(
repeat_count = 0; repeat_count < TRY_TIMES-1; repeat_count++)
{
PRINT_MARK;
tnplayer_pump(thumb_nail_service);
gdk_window_get_geometry(tnplayer->pWrapForeignWindow, &window_pos_x,
&window_pos_y, &window_width, &window_height, &depth);
gdk_colormap =
gdk_drawable_get_colormap(GDK_DRAWABLE(tnplayer->pWrapForeignWindow));
if (gdk_colormap == NULL)
{
PRINTF("colormap NULLn");
return false;
}
gdk_pixbuf = gdk_pixbuf_get_from_drawable(NULL,
GDK_DRAWABLE(tnplayer->pWrapForeignWindow),
gdk_colormap, 0, 0, 0, 0, window_width, window_height);
if (gdk_pixbuf == NULL)
{
PRINTF("pixbuf NULLn");
return false;
}
if (pixbuf_is_valid(gdk_pixbuf, window_width, window_height))
{
PRINTF("####valid imagen");
break;
}
else if (repeat_count == 10)
{
PRINTF("****invalid imagen");
return false;
}
ret = ClientPlayerSetPosition(thumb_nail_service->token,position);
position += pos_delta;
PRINTF("position:%dn",position);
}
if
(gdk_pixbuf_save(gdk_pixbuf, file, "png", &error, NULL))
{
ClientPlayerStop(thumb_nail_service->token);
return true;
}
else
{
ClientPlayerStop(thumb_nail_service->token);
return false;
}
}
|
| Re: How can I render to a
"invisible" gdk window |
  United States |
2007-12-06 12:29:31 |
Zhao, Halley wrote:
> Hi All:
>
> I know there is some feature in dtdriver can do
thumbnail, but I haven't
> tried it successfully.
>
> I tried to create thumbnail in another way. That is:
>
> 1> create a player and rendering to a GDK window.
>
> 2> capture an image from the GDK window as
thumbnail.
Have you given up on dtdrive? It does work, people are using
it. What
kind of problems did you run into?
> Now it works to some extent-if the gdk window is
visible.
>
> But when the GDK window is not visible ( move it out of
the screen or
> covered by another window), I can't get the image
correctly.
>
> It seems the engine stop to render to the gdk window
when it is
> invisible.
>
> I want to create thumbnail in the background, then how
to force the
> engine keep rendering to the gdk window even if it is
invisible.
>
> Attached file is my implementation for creating
thumbnail, thanks.
Well, if the window is hidden then its cliprect will be
empty and
nothing will be drawn. If you did get it to work, I think it
would
be fragile and might break under different window managers.
If you
have overlays on, then you will *never* get anything except
a color
square drawn to the GTK window. You can turn overlays off
and see
if it helps.
I would also look at:
STDMETHOD(CanCapture) (THIS_ REF(HXBOOL) bCanCapture);
STDMETHOD(Capture) (THIS_ IHXSiteCaptureResponse*
pCaptureResponse, IHXBuffer* pCaptureBuffer,
HXxSize* pOutputSize, INT32 nOutputCID);
on the site, it is used to capture a frame of video from the
site.
--greg.
>
>
>
> bool
>
> tnplayer_get_thumbnail(TnPlayer* tnplayer, gchar* uri,
gchar* file)
>
> {
>
> int ret = 0;
>
> XID xid;
>
> PRINT_MARK;
>
> int i = 0,j = 0, repeat_count = 0;
>
> int window_pos_x, window_pos_y, window_width,
window_height, depth;
>
> GdkWindow* pWrapForeignWindow;
>
> HxPlayer* thumb_nail_service =
tnplayer->thumb_nail_service;
>
> GdkColormap* gdk_colormap = NULL;
>
> GdkPixbuf* gdk_pixbuf = NULL;
>
> GError* error = NULL;
>
> #define TRY_TIMES 16
>
>
>
> PRINTF("file: %sn",file);
>
> thumb_nail_service->bInitialized = 0;
>
> if(!(thumb_nail_service->window))
>
> {
>
> GtkWidget *window =
gtk_window_new(GTK_WINDOW_POPUP);
>
> #if 1
>
> gtk_window_move(GTK_WINDOW(window),
> gdk_screen_width()-300,gdk_screen_height()-300);
>
> #else
>
> gtk_window_move(GTK_WINDOW(window),
> gdk_screen_width()+300,gdk_screen_height()+300);
>
> #endif
>
> GtkWidget *Draw = gtk_drawing_area_new();
>
> gtk_container_add(GTK_CONTAINER(window),
Draw);
>
> gtk_widget_show_all(window);
>
> xid =
gdk_x11_drawable_get_xid(Draw->window);
>
> PRINT_MARK;
>
> tnplayer->pWrapForeignWindow =
Draw->window;
>
> if(tnplayer->pWrapForeignWindow)
>
> {
>
> PRINT_MARK;
>
> thumb_nail_service->window =
g_new0(SHXClientWindow, 1);
>
> thumb_nail_service->window->display =
XOpenDisplay(NULL);
>
> thumb_nail_service->window->window =
(void*)xid;
>
> thumb_nail_service->clntXID = xid;
>
> thumb_nail_service->window->x = 0;
>
> thumb_nail_service->window->y = 0;
>
>
>
> int m_width, m_height;
>
> int x, y, depth;
>
>
gdk_window_get_geometry(tnplayer->pWrapForeignWindow,
&x,
> &y, &m_width, &m_height, &depth);
>
>
>
> thumb_nail_service->window->width =
m_width;
>
> thumb_nail_service->window->height =
m_height;
>
>
thumb_nail_service->window->clipRect.left =
> thumb_nail_service->window->x;
>
>
thumb_nail_service->window->clipRect.top =
> thumb_nail_service->window->y;
>
>
thumb_nail_service->window->clipRect.right =
> thumb_nail_service->window->width;
>
>
thumb_nail_service->window->clipRect.bottom =
> thumb_nail_service->window->height;
>
> }
>
> else
>
> {
>
> thumb_nail_service->window = NULL;
>
> return false;
>
> }
>
>
>
> PRINT_MARK;
>
>
>
>
if(!ClientPlayerCreate(&thumb_nail_service->token,
> thumb_nail_service->window, thumb_nail_service,
&HXCLIENT_CALLBACKS)) {
>
> PRINT_MARK;
>
> free(thumb_nail_service->window);
>
> thumb_nail_service->window = NULL;
>
> return false;
>
> }
>
>
>
> PRINT_MARK;
>
> }
>
>
>
> thumb_nail_service->bInitialized = 1;
>
> PRINT_MARK;
>
> ret =
ClientPlayerOpenURL(thumb_nail_service->token,uri,
NULL);
>
> ClientPlayerPlay(thumb_nail_service->token);
>
>
ClientPlayerMute(thumb_nail_service->token,true);
>
>
>
> PRINT_MARK;
>
> tnplayer_pump(thumb_nail_service);
>
>
>
> guint length =
ClientPlayerGetLength(thumb_nail_service->token);
>
>
>
> for(i=0;i<TRY_TIMES;i++)
>
> {
>
> if(length)
>
> break;
>
> tnplayer_pump(thumb_nail_service);
>
>
>
> }
>
>
>
> PRINTF("length: %dn",length);
>
> guint position = 0;
>
> guint pos_delta = 50;
>
> if(length)
>
> {
>
> position = length/TRY_TIMES;
>
> pos_delta = length/TRY_TIMES;
>
> }
>
> else
>
> {
>
> position = 0;
>
> pos_delta = 50;
>
> }
>
>
>
> PRINT_MARK;
>
> //
ClientPlayerPause(thumb_nail_service->token);
>
>
>
> for( repeat_count = 0; repeat_count <
TRY_TIMES-1; repeat_count++)
>
> {
>
> PRINT_MARK;
>
> tnplayer_pump(thumb_nail_service);
>
>
>
>
gdk_window_get_geometry(tnplayer->pWrapForeignWindow,
> &window_pos_x,
>
> &window_pos_y, &window_width,
&window_height, &depth);
>
>
>
> gdk_colormap =
>
gdk_drawable_get_colormap(GDK_DRAWABLE(tnplayer->pWrapFor
eignWindow));
>
> if (gdk_colormap == NULL)
>
> {
>
> PRINTF("colormap NULLn");
>
> return false;
>
> }
>
>
>
> gdk_pixbuf =
gdk_pixbuf_get_from_drawable(NULL,
> GDK_DRAWABLE(tnplayer->pWrapForeignWindow),
>
> gdk_colormap, 0, 0,
0, 0,
> window_width, window_height);
>
> if (gdk_pixbuf == NULL)
>
> {
>
> PRINTF("pixbuf NULLn");
>
> return false;
>
> }
>
>
>
> if (pixbuf_is_valid(gdk_pixbuf, window_width,
window_height))
>
> {
>
> PRINTF("####valid imagen");
>
> break;
>
> }
>
> else if (repeat_count == 10)
>
> {
>
> PRINTF("****invalid imagen");
>
> return false;
>
> }
>
>
>
> ret =
>
ClientPlayerSetPosition(thumb_nail_service->token,positio
n);
>
> position += pos_delta;
>
> PRINTF("position:%dn",position);
>
> }
>
>
>
> if (gdk_pixbuf_save(gdk_pixbuf, file,
"png", &error, NULL))
>
> {
>
>
ClientPlayerStop(thumb_nail_service->token);
>
> return true;
>
> }
>
> else
>
> {
>
>
ClientPlayerStop(thumb_nail_service->token);
>
> return false;
>
> }
>
> }
>
>
>
> ZHAO, Halley (Aihua)
>
> Email: halley.zhao intel.com <mailto:aihua.zhao intel.com>
>
> Tel: +86(21)61166476
>
> iNet: 8821-6476
>
> SSG/OTC/UMD
>
>
>
_______________________________________________
Helix-client-dev mailing list
Helix-client-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinf
o/helix-client-dev
|
|
| RE: How can I render to a
"invisible" gdk window |

|
2007-12-07 02:22:54 |
Great thanks.
Finally I make it done by
XCompositeRedirectSubwindows(m_dpy,win,CompositeRedirect
Manual);
Then even if the window is out of screen, it can still
be rendered.
>-----Original Message-----
>From: Greg Wright [mailto:gwright real.com]
>Sent: 2007定12埖7晩 2:30
>To: Zhao, Halley
>Cc: helix-client-dev helixcommunity.org
>Subject: Re: How can I render to a
"invisible" gdk window
>
>Zhao, Halley wrote:
>> Hi All:
>>
>> I know there is some feature in dtdriver can do
thumbnail, but I haven't
>> tried it successfully.
>>
>> I tried to create thumbnail in another way.
That is:
>>
>> 1> create a player and rendering to a GDK
window.
>>
>> 2> capture an image from the GDK window as
thumbnail.
>
>Have you given up on dtdrive? It does work, people
are using it. What
>kind of problems did you run into?
>
>
>> Now it works to some extent-if the gdk window
is visible.
>>
>> But when the GDK window is not visible ( move
it out of the screen or
>> covered by another window), I can't get the
image correctly.
>>
>> It seems the engine stop to render to the gdk
window when it is
>> invisible.
>>
>> I want to create thumbnail in the background,
then how to force the
>> engine keep rendering to the gdk window even if
it is invisible.
>>
>> Attached file is my implementation for creating
thumbnail, thanks.
>
>
>Well, if the window is hidden then its cliprect will
be empty and
>nothing will be drawn. If you did get it to work, I
think it would
>be fragile and might break under different window
managers. If you
>have overlays on, then you will *never* get anything
except a color
>square drawn to the GTK window. You can turn
overlays off and see
>if it helps.
>
>I would also look at:
>
> STDMETHOD(CanCapture) (THIS_ REF(HXBOOL)
bCanCapture);
> STDMETHOD(Capture) (THIS_
IHXSiteCaptureResponse*
>pCaptureResponse, IHXBuffer* pCaptureBuffer,
> HXxSize* pOutputSize, INT32 nOutputCID);
>
>on the site, it is used to capture a frame of video
from the site.
>
>
>--greg.
>>
>>
>>
>> bool
>>
>> tnplayer_get_thumbnail(TnPlayer* tnplayer,
gchar* uri, gchar* file)
>>
>> {
>>
>> int ret = 0;
>>
>> XID xid;
>>
>> PRINT_MARK;
>>
>> int i = 0,j = 0, repeat_count = 0;
>>
>> int window_pos_x, window_pos_y,
window_width, window_height, depth;
>>
>> GdkWindow* pWrapForeignWindow;
>>
>> HxPlayer* thumb_nail_service =
tnplayer->thumb_nail_service;
>>
>> GdkColormap* gdk_colormap = NULL;
>>
>> GdkPixbuf* gdk_pixbuf = NULL;
>>
>> GError* error = NULL;
>>
>> #define TRY_TIMES 16
>>
>>
>>
>> PRINTF("file: %sn",file);
>>
>> thumb_nail_service->bInitialized = 0;
>>
>> if(!(thumb_nail_service->window))
>>
>> {
>>
>> GtkWidget *window =
gtk_window_new(GTK_WINDOW_POPUP);
>>
>> #if 1
>>
>>
gtk_window_move(GTK_WINDOW(window),
>>
gdk_screen_width()-300,gdk_screen_height()-300);
>>
>> #else
>>
>>
gtk_window_move(GTK_WINDOW(window),
>>
gdk_screen_width()+300,gdk_screen_height()+300);
>>
>> #endif
>>
>> GtkWidget *Draw =
gtk_drawing_area_new();
>>
>>
gtk_container_add(GTK_CONTAINER(window), Draw);
>>
>> gtk_widget_show_all(window);
>>
>> xid =
gdk_x11_drawable_get_xid(Draw->window);
>>
>> PRINT_MARK;
>>
>> tnplayer->pWrapForeignWindow =
Draw->window;
>>
>> if(tnplayer->pWrapForeignWindow)
>>
>> {
>>
>> PRINT_MARK;
>>
>> thumb_nail_service->window =
g_new0(SHXClientWindow, 1);
>>
>>
thumb_nail_service->window->display =
XOpenDisplay(NULL);
>>
>>
thumb_nail_service->window->window = (void*)xid;
>>
>> thumb_nail_service->clntXID =
xid;
>>
>> thumb_nail_service->window->x
= 0;
>>
>> thumb_nail_service->window->y
= 0;
>>
>>
>>
>> int m_width, m_height;
>>
>> int x, y, depth;
>>
>>
gdk_window_get_geometry(tnplayer->pWrapForeignWindow,
&x,
>> &y, &m_width, &m_height,
&depth);
>>
>>
>>
>>
thumb_nail_service->window->width = m_width;
>>
>>
thumb_nail_service->window->height = m_height;
>>
>>
thumb_nail_service->window->clipRect.left =
>> thumb_nail_service->window->x;
>>
>>
thumb_nail_service->window->clipRect.top =
>> thumb_nail_service->window->y;
>>
>>
thumb_nail_service->window->clipRect.right =
>> thumb_nail_service->window->width;
>>
>>
thumb_nail_service->window->clipRect.bottom =
>> thumb_nail_service->window->height;
>>
>> }
>>
>> else
>>
>> {
>>
>> thumb_nail_service->window =
NULL;
>>
>> return false;
>>
>> }
>>
>>
>>
>> PRINT_MARK;
>>
>>
>>
>>
if(!ClientPlayerCreate(&thumb_nail_service->token,
>> thumb_nail_service->window,
thumb_nail_service, &HXCLIENT_CALLBACKS)) {
>>
>> PRINT_MARK;
>>
>>
free(thumb_nail_service->window);
>>
>> thumb_nail_service->window =
NULL;
>>
>> return false;
>>
>> }
>>
>>
>>
>> PRINT_MARK;
>>
>> }
>>
>>
>>
>> thumb_nail_service->bInitialized = 1;
>>
>> PRINT_MARK;
>>
>> ret =
ClientPlayerOpenURL(thumb_nail_service->token,uri,
NULL);
>>
>>
ClientPlayerPlay(thumb_nail_service->token);
>>
>>
ClientPlayerMute(thumb_nail_service->token,true);
>>
>>
>>
>> PRINT_MARK;
>>
>> tnplayer_pump(thumb_nail_service);
>>
>>
>>
>> guint length =
ClientPlayerGetLength(thumb_nail_service->token);
>>
>>
>>
>> for(i=0;i<TRY_TIMES;i++)
>>
>> {
>>
>> if(length)
>>
>> break;
>>
>> tnplayer_pump(thumb_nail_service);
>>
>>
>>
>> }
>>
>>
>>
>> PRINTF("length: %dn",length);
>>
>> guint position = 0;
>>
>> guint pos_delta = 50;
>>
>> if(length)
>>
>> {
>>
>> position = length/TRY_TIMES;
>>
>> pos_delta = length/TRY_TIMES;
>>
>> }
>>
>> else
>>
>> {
>>
>> position = 0;
>>
>> pos_delta = 50;
>>
>> }
>>
>>
>>
>> PRINT_MARK;
>>
>> //
ClientPlayerPause(thumb_nail_service->token);
>>
>>
>>
>> for( repeat_count = 0; repeat_count <
TRY_TIMES-1; repeat_count++)
>>
>> {
>>
>> PRINT_MARK;
>>
>> tnplayer_pump(thumb_nail_service);
>>
>>
>>
>>
gdk_window_get_geometry(tnplayer->pWrapForeignWindow,
>> &window_pos_x,
>>
>> &window_pos_y, &window_width,
&window_height, &depth);
>>
>>
>>
>> gdk_colormap =
>>
>gdk_drawable_get_colormap(GDK_DRAWABLE(tnplayer->
pWrapForeignWindow));
>>
>> if (gdk_colormap == NULL)
>>
>> {
>>
>> PRINTF("colormap
NULLn");
>>
>> return false;
>>
>> }
>>
>>
>>
>> gdk_pixbuf =
gdk_pixbuf_get_from_drawable(NULL,
>>
GDK_DRAWABLE(tnplayer->pWrapForeignWindow),
>>
>>
gdk_colormap, 0, 0, 0, 0,
>> window_width, window_height);
>>
>> if (gdk_pixbuf == NULL)
>>
>> {
>>
>> PRINTF("pixbuf NULLn");
>>
>> return false;
>>
>> }
>>
>>
>>
>> if (pixbuf_is_valid(gdk_pixbuf,
window_width, window_height))
>>
>> {
>>
>> PRINTF("####valid
imagen");
>>
>> break;
>>
>> }
>>
>> else if (repeat_count == 10)
>>
>> {
>>
>> PRINTF("****invalid
imagen");
>>
>> return false;
>>
>> }
>>
>>
>>
>> ret =
>>
ClientPlayerSetPosition(thumb_nail_service->token,positio
n);
>>
>> position += pos_delta;
>>
>>
PRINTF("position:%dn",position);
>>
>> }
>>
>>
>>
>> if (gdk_pixbuf_save(gdk_pixbuf, file,
"png", &error, NULL))
>>
>> {
>>
>>
ClientPlayerStop(thumb_nail_service->token);
>>
>> return true;
>>
>> }
>>
>> else
>>
>> {
>>
>>
ClientPlayerStop(thumb_nail_service->token);
>>
>> return false;
>>
>> }
>>
>> }
>>
>>
>>
>> ZHAO, Halley (Aihua)
>>
>> Email: halley.zhao intel.com
<mailto:aihua.zhao intel.com>
>>
>> Tel: +86(21)61166476
>>
>> iNet: 8821-6476
>>
>> SSG/OTC/UMD
>>
>>
>>
_______________________________________________
Helix-client-dev mailing list
Helix-client-dev helixcommunity.org
http://lists.helixcommunity.org/mailman/listinf
o/helix-client-dev
|
|
[1-4]
|
|