2020-10-09 16:16:16 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2024-02-16 22:48:18 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2020-10-09 16:16:16 +00:00
|
|
|
#include "clutter/clutter-frame-private.h"
|
|
|
|
|
2022-10-13 15:32:09 +00:00
|
|
|
G_DEFINE_BOXED_TYPE (ClutterFrame, clutter_frame,
|
|
|
|
clutter_frame_ref,
|
|
|
|
clutter_frame_unref)
|
|
|
|
|
|
|
|
ClutterFrame *
|
|
|
|
clutter_frame_ref (ClutterFrame *frame)
|
|
|
|
{
|
|
|
|
g_ref_count_inc (&frame->ref_count);
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clutter_frame_unref (ClutterFrame *frame)
|
|
|
|
{
|
|
|
|
if (g_ref_count_dec (&frame->ref_count))
|
2022-10-14 16:24:46 +00:00
|
|
|
{
|
|
|
|
if (frame->release)
|
|
|
|
frame->release (frame);
|
|
|
|
g_free (frame);
|
|
|
|
}
|
2022-10-13 15:32:09 +00:00
|
|
|
}
|
|
|
|
|
2022-07-07 07:26:06 +00:00
|
|
|
gpointer
|
2022-10-14 16:24:46 +00:00
|
|
|
(clutter_frame_new) (size_t size,
|
|
|
|
ClutterFrameRelease release)
|
2022-10-13 15:32:09 +00:00
|
|
|
{
|
|
|
|
ClutterFrame *frame;
|
|
|
|
|
2022-07-07 07:26:06 +00:00
|
|
|
g_assert (size >= sizeof (ClutterFrame));
|
|
|
|
|
|
|
|
frame = g_malloc0 (size);
|
2022-10-13 15:32:09 +00:00
|
|
|
g_ref_count_init (&frame->ref_count);
|
2022-10-14 16:24:46 +00:00
|
|
|
frame->release = release;
|
2022-10-13 15:32:09 +00:00
|
|
|
|
|
|
|
return frame;
|
|
|
|
}
|
|
|
|
|
2022-07-06 21:59:46 +00:00
|
|
|
int64_t
|
|
|
|
clutter_frame_get_count (ClutterFrame *frame)
|
|
|
|
{
|
|
|
|
return frame->frame_count;
|
|
|
|
}
|
|
|
|
|
2022-07-07 07:12:04 +00:00
|
|
|
gboolean
|
|
|
|
clutter_frame_get_target_presentation_time (ClutterFrame *frame,
|
|
|
|
int64_t *target_presentation_time_us)
|
|
|
|
{
|
|
|
|
if (frame->has_target_presentation_time)
|
|
|
|
{
|
|
|
|
*target_presentation_time_us = frame->target_presentation_time_us;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-06 10:50:00 +00:00
|
|
|
gboolean
|
2023-09-24 13:18:42 +00:00
|
|
|
clutter_frame_get_frame_deadline (ClutterFrame *frame,
|
|
|
|
int64_t *frame_deadline_us)
|
2023-02-06 10:50:00 +00:00
|
|
|
{
|
2023-09-24 13:18:42 +00:00
|
|
|
if (frame->has_frame_deadline)
|
2023-02-06 10:50:00 +00:00
|
|
|
{
|
2023-09-24 13:18:42 +00:00
|
|
|
*frame_deadline_us = frame->frame_deadline_us;
|
2023-02-06 10:50:00 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-09 16:16:16 +00:00
|
|
|
ClutterFrameResult
|
|
|
|
clutter_frame_get_result (ClutterFrame *frame)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (frame->has_result, CLUTTER_FRAME_RESULT_IDLE);
|
|
|
|
|
|
|
|
return frame->result;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
clutter_frame_has_result (ClutterFrame *frame)
|
|
|
|
{
|
|
|
|
return frame->has_result;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
clutter_frame_set_result (ClutterFrame *frame,
|
|
|
|
ClutterFrameResult result)
|
|
|
|
{
|
|
|
|
g_warn_if_fail (!frame->has_result);
|
|
|
|
|
|
|
|
frame->result = result;
|
|
|
|
frame->has_result = TRUE;
|
|
|
|
}
|