|
@@ -84,7 +84,7 @@ struct videoplayer_t
|
|
|
|
|
|
LPVOID black_frame_data;
|
|
|
LPVOID res_frame_data;
|
|
|
- struct SwsContext *sws_context;
|
|
|
+ struct SwsContext *render_sws_context;
|
|
|
|
|
|
DWORD dwPlayTimer;
|
|
|
HDRAWDIB hdib;
|
|
@@ -120,7 +120,7 @@ int IsHideRemoteWin = 0;
|
|
|
int IsHideLocalWin = 0;
|
|
|
|
|
|
|
|
|
-static void Dbg(const char *fmt, ...)
|
|
|
+static void player_dbg(const char *fmt, ...)
|
|
|
{
|
|
|
int n;
|
|
|
va_list arg;
|
|
@@ -159,16 +159,6 @@ static int init_thunk(struct winthunk_t *thunk, DWORD_PTR proc, videoplayer_t *p
|
|
|
|
|
|
static void display_frame_entry(videoplayer_t *player, video_frame *frame);
|
|
|
|
|
|
-static BOOL is_parent_window_of(HWND x, HWND y)
|
|
|
-{
|
|
|
- HWND t = GetParent(y);
|
|
|
- while (t) {
|
|
|
- if (t == x)
|
|
|
- return TRUE;
|
|
|
- t = GetParent(t);
|
|
|
- }
|
|
|
- return FALSE;
|
|
|
-}
|
|
|
|
|
|
static void check_on_top(videoplayer_t *player)
|
|
|
{
|
|
@@ -285,15 +275,16 @@ static void display_frame_entry(videoplayer_t *player, video_frame *frame)
|
|
|
bmpheader.biCompression = BI_RGB;
|
|
|
bmpheader.biHeight = player->cy;
|
|
|
bmpheader.biWidth = player->cx;
|
|
|
- if (player->sws_context) {
|
|
|
+ if (player->render_sws_context) {
|
|
|
unsigned char *src_data[4] = {frame->data[0], NULL, NULL, NULL};
|
|
|
int src_linesize[4] = {player->width*3, 0, 0, 0};
|
|
|
unsigned char *dst_data[4] = {player->res_frame_data, NULL, NULL, NULL};
|
|
|
int dst_linesize[4] = {player->cx*3, 0, 0, 0};
|
|
|
- sws_scale(player->sws_context, src_data, src_linesize,
|
|
|
+ sws_scale(player->render_sws_context, src_data, src_linesize,
|
|
|
0, player->height, dst_data, dst_linesize);
|
|
|
DrawDibDraw(player->hdib, hdc, 0, 0, -1, -1, &bmpheader, player->res_frame_data, 0, 0, player->cx, player->cy, DDF_SAME_DRAW|DDF_SAME_HDC);
|
|
|
- } else {
|
|
|
+ }
|
|
|
+ else {
|
|
|
DrawDibDraw(player->hdib, hdc, 0, 0, -1, -1, &bmpheader, frame->data[0], 0, 0, player->cx, player->cy, DDF_SAME_DRAW|DDF_SAME_HDC);
|
|
|
}
|
|
|
}
|
|
@@ -386,7 +377,7 @@ static void OnMsgTimer_PushMode(videoplayer_t *player, HWND hWnd, UINT msg, WPAR
|
|
|
} else {
|
|
|
//Dbg("display frame");
|
|
|
display_frame_entry(player, entry->raw_frame);
|
|
|
- displayed = TRUE;
|
|
|
+ displayed = true;
|
|
|
free_frame_entry(player, &player->current_frame);
|
|
|
player->current_frame.raw_frame = entry->raw_frame;
|
|
|
player->current_frame.free_frame = entry->free_frame;
|
|
@@ -397,7 +388,7 @@ static void OnMsgTimer_PushMode(videoplayer_t *player, HWND hWnd, UINT msg, WPAR
|
|
|
}
|
|
|
}
|
|
|
if (!displayed) {
|
|
|
- player->q_caching = TRUE;
|
|
|
+ player->q_caching = 1;
|
|
|
Dbg("recaching");
|
|
|
}
|
|
|
}
|
|
@@ -441,8 +432,8 @@ static void OnMsgInit(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM wParam,
|
|
|
memset(player->black_frame_data, 0, player->cx*player->cy*3);
|
|
|
|
|
|
if (player->cx != player->width || player->cy != player->height) {
|
|
|
- player->res_frame_data = malloc(player->cx*player->cy*3);
|
|
|
- player->sws_context = sws_getCachedContext(
|
|
|
+ player->res_frame_data = malloc(player->cx *player->cy*3);
|
|
|
+ player->render_sws_context = sws_getCachedContext(
|
|
|
NULL,
|
|
|
player->width,
|
|
|
player->height,
|
|
@@ -512,11 +503,11 @@ static void OnMsgClear(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM wParam
|
|
|
}
|
|
|
assert(player->q_head == player->q_tail);
|
|
|
|
|
|
- if (player->sws_context) {
|
|
|
+ if (player->render_sws_context) {
|
|
|
free(player->res_frame_data);
|
|
|
player->res_frame_data = NULL;
|
|
|
- sws_freeContext(player->sws_context);
|
|
|
- player->sws_context = NULL;
|
|
|
+ sws_freeContext(player->render_sws_context);
|
|
|
+ player->render_sws_context = NULL;
|
|
|
}
|
|
|
|
|
|
if (player->double_size_sws_context) {
|
|
@@ -601,7 +592,7 @@ static LRESULT VideoWndProc(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM w
|
|
|
if (((nWindowState==1 && player->cx != 960)&&(bMove==0))&&(player->flags & VIDEOPLAYER_FLAG_PULL)&&(player->flags & VIDEOPLAYER_FLAG_DOUBLESIZE)&&(IsHideLocalWin==0))
|
|
|
{
|
|
|
GetWindowRect(hWnd, &g_Rect);
|
|
|
- MoveWindow(hWnd, g_Rect.left, g_Rect.top, player->cx<<1, player->cy<<1, TRUE);
|
|
|
+ MoveWindow(hWnd, g_Rect.left, g_Rect.top, player->cx<<1, player->cy<<1, true);
|
|
|
player->esizemode = eDoubleSize;
|
|
|
if (player->flags & VIDEOPLAYER_FLAG_DOUBLESIZE)
|
|
|
{
|
|
@@ -638,7 +629,7 @@ static LRESULT VideoWndProc(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM w
|
|
|
}
|
|
|
else if ((nWindowState==0)&&bMove&&(player->flags & VIDEOPLAYER_FLAG_PULL)&&(player->flags & VIDEOPLAYER_FLAG_DOUBLESIZE || player->flags & VIDEOPLAYER_FLAG_ZOOMOUTSIZE)&&(IsHideLocalWin==0))
|
|
|
{
|
|
|
- MoveWindow(hWnd, g_Rect.left, g_Rect.top, player->cx, player->cy, TRUE);
|
|
|
+ MoveWindow(hWnd, g_Rect.left, g_Rect.top, player->cx, player->cy, true);
|
|
|
player->esizemode = eNormalSize;
|
|
|
bMove = 0;
|
|
|
if (player->flags & VIDEOPLAYER_FLAG_DOUBLESIZE||player->flags & VIDEOPLAYER_FLAG_ZOOMOUTSIZE)
|
|
@@ -678,7 +669,7 @@ static LRESULT VideoWndProc(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM w
|
|
|
{
|
|
|
//Dbg("zoom out size video echo.");
|
|
|
GetWindowRect(hWnd, &g_Rect);
|
|
|
- MoveWindow(hWnd, g_Rect.left, g_Rect.top, SMALL_RECORD_VIDEO_WIDTH, SMALL_RECORD_VIDEO_HEIGHT, TRUE);
|
|
|
+ MoveWindow(hWnd, g_Rect.left, g_Rect.top, SMALL_RECORD_VIDEO_WIDTH, SMALL_RECORD_VIDEO_HEIGHT, true);
|
|
|
player->esizemode = eZoomOutSize;
|
|
|
if (player->flags&VIDEOPLAYER_FLAG_ZOOMOUTSIZE)
|
|
|
{
|
|
@@ -738,11 +729,11 @@ static LRESULT VideoWndProc(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM w
|
|
|
GetWindowRect(hWnd, &rc);
|
|
|
if (eDoubleSize == player->esizemode)
|
|
|
{
|
|
|
- MoveWindow(hWnd, rc.left, rc.top, player->cx<<1, player->cy<<1, TRUE);
|
|
|
+ MoveWindow(hWnd, rc.left, rc.top, player->cx<<1, player->cy<<1, true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MoveWindow(hWnd, rc.left, rc.top, player->cx, player->cy, TRUE);
|
|
|
+ MoveWindow(hWnd, rc.left, rc.top, player->cx, player->cy, true);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -763,11 +754,11 @@ static LRESULT VideoWndProc(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM w
|
|
|
GetWindowRect(hWnd, &rc);
|
|
|
if (eDoubleSize == player->esizemode)
|
|
|
{
|
|
|
- MoveWindow(hWnd, rc.left, rc.top, player->cx<<1, player->cy<<1, TRUE);
|
|
|
+ MoveWindow(hWnd, rc.left, rc.top, player->cx<<1, player->cy<<1, true);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MoveWindow(hWnd, rc.left, rc.top, player->cx, player->cy, TRUE);
|
|
|
+ MoveWindow(hWnd, rc.left, rc.top, player->cx, player->cy, true);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -791,9 +782,9 @@ static LRESULT VideoWndProc(videoplayer_t *player, HWND hWnd, UINT msg, WPARAM w
|
|
|
RECT rc;
|
|
|
GetWindowRect(hWnd, &rc);
|
|
|
if (eDoubleSize == player->esizemode) {
|
|
|
- MoveWindow(hWnd, rc.left, rc.top, player->cx<<1, player->cy<<1, TRUE);
|
|
|
+ MoveWindow(hWnd, rc.left, rc.top, player->cx<<1, player->cy<<1, true);
|
|
|
} else {
|
|
|
- MoveWindow(hWnd, rc.left, rc.top, player->cx, player->cy, TRUE);
|
|
|
+ MoveWindow(hWnd, rc.left, rc.top, player->cx, player->cy, true);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
@@ -909,7 +900,7 @@ int videoplayer_create(HWND hWndVideo,
|
|
|
player->min_cache_size = FRAME_MIN_CACHE_MSEC * fps_num / 1000 * fps_den;
|
|
|
player->max_cache_size = FRAME_MAX_CACHE_MSEC * fps_num / 1000 * fps_den;
|
|
|
player->res_frame_data = player->black_frame_data = NULL;
|
|
|
- player->sws_context = NULL;
|
|
|
+ player->render_sws_context = NULL;
|
|
|
player->esizemode = eNormalSize;
|
|
|
player->double_size_sws_context = NULL;
|
|
|
player->double_size_data = NULL;
|