[Spice-devel] [PATCH spice-server 12/15] Rename VideoStream methods
Jonathon Jongsma
jjongsma at redhat.com
Fri Oct 20 21:13:17 UTC 2017
Use video_stream_ prefix instead of plain stream_ prefix since the type
was renamed.
Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
---
server/display-channel.c | 22 ++++-----
server/red-worker.c | 4 +-
server/video-stream.c | 116 ++++++++++++++++++++++++-----------------------
server/video-stream.h | 20 ++++----
4 files changed, 82 insertions(+), 80 deletions(-)
diff --git a/server/display-channel.c b/server/display-channel.c
index cc8884793..360c887f8 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -272,7 +272,7 @@ static void stop_streams(DisplayChannel *display)
VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
item = ring_next(ring, item);
if (!stream->current) {
- stream_stop(display, stream);
+ video_stream_stop(display, stream);
} else {
spice_debug("attached stream");
}
@@ -423,7 +423,7 @@ static void current_add_drawable(DisplayChannel *display,
static void current_remove_drawable(DisplayChannel *display, Drawable *item)
{
/* todo: move all to unref? */
- stream_trace_add_drawable(display, item);
+ video_stream_trace_add_drawable(display, item);
draw_item_remove_shadow(&item->tree_item);
ring_remove(&item->tree_item.base.siblings_link);
ring_remove(&item->list_link);
@@ -548,7 +548,7 @@ static bool current_add_equal(DisplayChannel *display, DrawItem *item, TreeItem
* end of the queue */
int add_after = !!other_drawable->stream &&
is_drawable_independent_from_surfaces(drawable);
- stream_maintenance(display, drawable, other_drawable);
+ video_stream_maintenance(display, drawable, other_drawable);
current_add_drawable(display, drawable, &other->siblings_link);
other_drawable->refs++;
current_remove_drawable(display, other_drawable);
@@ -707,7 +707,7 @@ static void __exclude_region(DisplayChannel *display, Ring *ring, TreeItem *item
/* TODO: document the purpose of this code */
if (frame_candidate) {
Drawable *drawable = SPICE_CONTAINEROF(draw, Drawable, tree_item);
- stream_maintenance(display, frame_candidate, drawable);
+ video_stream_maintenance(display, frame_candidate, drawable);
}
/* Remove the intersection from the DrawItem's region */
region_exclude(&draw->base.rgn, &and_rgn);
@@ -878,7 +878,7 @@ static bool current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawabl
// only primary surface streams are supported
if (is_primary_surface(display, item->surface_id)) {
- stream_detach_behind(display, &shadow->base.rgn, NULL);
+ video_stream_detach_behind(display, &shadow->base.rgn, NULL);
}
/* Prepend the shadow to the beginning of the current ring */
@@ -899,7 +899,7 @@ static bool current_add_with_shadow(DisplayChannel *display, Ring *ring, Drawabl
streams_update_visible_region(display, item);
} else {
if (is_primary_surface(display, item->surface_id)) {
- stream_detach_behind(display, &item->tree_item.base.rgn, item);
+ video_stream_detach_behind(display, &item->tree_item.base.rgn, item);
}
}
stat_add(&display->priv->add_stat, start_time);
@@ -1078,7 +1078,7 @@ static bool current_add(DisplayChannel *display, Ring *ring, Drawable *drawable)
* the tree. Add the new item's region to that */
region_or(&exclude_rgn, &item->base.rgn);
exclude_region(display, ring, exclude_base, &exclude_rgn, NULL, drawable);
- stream_trace_update(display, drawable);
+ video_stream_trace_update(display, drawable);
streams_update_visible_region(display, drawable);
/*
* Performing the insertion after exclude_region for
@@ -1095,7 +1095,7 @@ static bool current_add(DisplayChannel *display, Ring *ring, Drawable *drawable)
*/
current_add_drawable(display, drawable, ring);
if (is_primary_surface(display, drawable->surface_id)) {
- stream_detach_behind(display, &drawable->tree_item.base.rgn, drawable);
+ video_stream_detach_behind(display, &drawable->tree_item.base.rgn, drawable);
}
}
region_destroy(&exclude_rgn);
@@ -1279,7 +1279,7 @@ static bool handle_surface_deps(DisplayChannel *display, Drawable *drawable)
QRegion depend_region;
region_init(&depend_region);
region_add(&depend_region, &drawable->red_drawable->surfaces_rects[x]);
- stream_detach_behind(display, &depend_region, NULL);
+ video_stream_detach_behind(display, &depend_region, NULL);
}
}
}
@@ -1690,7 +1690,7 @@ void drawable_unref(Drawable *drawable)
spice_warn_if_fail(drawable->pipes == NULL);
if (drawable->stream) {
- stream_detach_drawable(drawable->stream);
+ video_stream_detach_drawable(drawable->stream);
}
region_destroy(&drawable->tree_item.base.rgn);
@@ -2298,7 +2298,7 @@ display_channel_constructed(GObject *object)
"non_cache", TRUE);
image_cache_init(&self->priv->image_cache);
self->priv->stream_video = SPICE_STREAM_VIDEO_OFF;
- display_channel_init_streams(self);
+ display_channel_init_video_streams(self);
red_channel_set_cap(channel, SPICE_DISPLAY_CAP_MONITORS_CONFIG);
red_channel_set_cap(channel, SPICE_DISPLAY_CAP_PREF_COMPRESSION);
diff --git a/server/red-worker.c b/server/red-worker.c
index 8eaacd526..203e72e23 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -297,7 +297,7 @@ static void red_migrate_display(DisplayChannel *display, RedChannelClient *rcc)
* Notice that detach_and_stop_streams won't lead to any dev ram changes, since
* handle_dev_stop already took care of releasing all the dev ram resources.
*/
- stream_detach_and_stop(display);
+ video_stream_detach_and_stop(display);
if (red_channel_client_is_connected(rcc)) {
red_channel_client_default_migrate(rcc);
}
@@ -1259,7 +1259,7 @@ static gboolean worker_source_dispatch(GSource *source, GSourceFunc callback,
display_channel_free_glz_drawables_to_free(display);
/* TODO: could use its own source */
- stream_timeout(display);
+ video_stream_timeout(display);
worker->event_timeout = INF_EVENT_WAIT;
worker->was_blocked = FALSE;
diff --git a/server/video-stream.c b/server/video-stream.c
index b8c0bd307..fae51550e 100644
--- a/server/video-stream.c
+++ b/server/video-stream.c
@@ -28,7 +28,7 @@
RING_FOREACH(item, &(display)->priv->streams)
-void stream_stop(DisplayChannel *display, VideoStream *stream)
+void video_stream_stop(DisplayChannel *display, VideoStream *stream)
{
DisplayChannelClient *dcc;
int stream_id = display_channel_get_stream_id(display, stream);
@@ -42,23 +42,23 @@ void stream_stop(DisplayChannel *display, VideoStream *stream)
}
display->priv->streams_size_total -= stream->width * stream->height;
ring_remove(&stream->link);
- stream_unref(stream);
+ video_stream_unref(stream);
}
-static void stream_recycle(DisplayChannel *display, VideoStream *stream)
+static void video_stream_recycle(DisplayChannel *display, VideoStream *stream)
{
stream->next = display->priv->free_streams;
display->priv->free_streams = stream;
}
-static void stream_free(VideoStream *stream)
+static void video_stream_free(VideoStream *stream)
{
DisplayChannel *display = stream->display;
- stream_recycle(display, stream);
+ video_stream_recycle(display, stream);
display->priv->stream_count--;
}
-void display_channel_init_streams(DisplayChannel *display)
+void display_channel_init_video_streams(DisplayChannel *display)
{
int i;
@@ -67,23 +67,23 @@ void display_channel_init_streams(DisplayChannel *display)
for (i = 0; i < NUM_STREAMS; i++) {
VideoStream *stream = display_channel_get_nth_stream(display, i);
ring_item_init(&stream->link);
- stream_recycle(display, stream);
+ video_stream_recycle(display, stream);
}
}
-void stream_unref(VideoStream *stream)
+void video_stream_unref(VideoStream *stream)
{
if (--stream->refs != 0)
return;
spice_warn_if_fail(!ring_item_is_linked(&stream->link));
- stream_free(stream);
+ video_stream_free(stream);
}
void stream_agent_unref(StreamAgent *agent)
{
- stream_unref(agent->stream);
+ video_stream_unref(agent->stream);
}
static int is_stream_start(Drawable *drawable)
@@ -203,7 +203,7 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, VideoStre
}
}
-void stream_detach_drawable(VideoStream *stream)
+void video_stream_detach_drawable(VideoStream *stream)
{
spice_assert(stream->current && stream->current->stream);
spice_assert(stream->current->stream == stream);
@@ -247,7 +247,7 @@ static void before_reattach_stream(DisplayChannel *display,
}
}
-static VideoStream *display_channel_stream_try_new(DisplayChannel *display)
+static VideoStream *display_channel_video_stream_try_new(DisplayChannel *display)
{
VideoStream *stream;
if (!display->priv->free_streams) {
@@ -259,7 +259,7 @@ static VideoStream *display_channel_stream_try_new(DisplayChannel *display)
return stream;
}
-static void display_channel_create_stream(DisplayChannel *display, Drawable *drawable)
+static void display_channel_create_video_stream(DisplayChannel *display, Drawable *drawable)
{
DisplayChannelClient *dcc;
VideoStream *stream;
@@ -267,7 +267,7 @@ static void display_channel_create_stream(DisplayChannel *display, Drawable *dra
spice_assert(!drawable->stream);
- if (!(stream = display_channel_stream_try_new(display))) {
+ if (!(stream = display_channel_video_stream_try_new(display))) {
return;
}
@@ -309,12 +309,12 @@ static void display_channel_create_stream(DisplayChannel *display, Drawable *dra
}
// returns whether a stream was created
-static bool stream_add_frame(DisplayChannel *display,
- Drawable *frame_drawable,
- red_time_t first_frame_time,
- int frames_count,
- int gradual_frames_count,
- int last_gradual_frame)
+static bool video_stream_add_frame(DisplayChannel *display,
+ Drawable *frame_drawable,
+ red_time_t first_frame_time,
+ int frames_count,
+ int gradual_frames_count,
+ int last_gradual_frame)
{
update_copy_graduality(display, frame_drawable);
frame_drawable->first_frame_time = first_frame_time;
@@ -336,14 +336,14 @@ static bool stream_add_frame(DisplayChannel *display,
}
if (is_stream_start(frame_drawable)) {
- display_channel_create_stream(display, frame_drawable);
+ display_channel_create_video_stream(display, frame_drawable);
return TRUE;
}
return FALSE;
}
/* TODO: document the difference between the 2 functions below */
-void stream_trace_update(DisplayChannel *display, Drawable *drawable)
+void video_stream_trace_update(DisplayChannel *display, Drawable *drawable)
{
ItemTrace *trace;
ItemTrace *trace_end;
@@ -367,7 +367,7 @@ void stream_trace_update(DisplayChannel *display, Drawable *drawable)
if (stream->current) {
stream->current->streamable = FALSE; //prevent item trace
before_reattach_stream(display, stream, drawable);
- stream_detach_drawable(stream);
+ video_stream_detach_drawable(stream);
}
attach_stream(display, drawable, stream);
return;
@@ -379,19 +379,19 @@ void stream_trace_update(DisplayChannel *display, Drawable *drawable)
for (; trace < trace_end; trace++) {
if (is_next_stream_frame(display, drawable, trace->width, trace->height,
&trace->dest_area, trace->time, NULL, FALSE)) {
- if (stream_add_frame(display, drawable,
- trace->first_frame_time,
- trace->frames_count,
- trace->gradual_frames_count,
- trace->last_gradual_frame)) {
+ if (video_stream_add_frame(display, drawable,
+ trace->first_frame_time,
+ trace->frames_count,
+ trace->gradual_frames_count,
+ trace->last_gradual_frame)) {
return;
}
}
}
}
-void stream_maintenance(DisplayChannel *display,
- Drawable *candidate, Drawable *prev)
+void video_stream_maintenance(DisplayChannel *display,
+ Drawable *candidate, Drawable *prev)
{
bool is_next_frame;
@@ -408,7 +408,7 @@ void stream_maintenance(DisplayChannel *display,
stream, TRUE);
if (is_next_frame) {
before_reattach_stream(display, stream, candidate);
- stream_detach_drawable(stream);
+ video_stream_detach_drawable(stream);
prev->streamable = FALSE; //prevent item trace
attach_stream(display, candidate, stream);
}
@@ -422,11 +422,11 @@ void stream_maintenance(DisplayChannel *display,
prev->stream,
FALSE);
if (is_next_frame) {
- stream_add_frame(display, candidate,
- prev->first_frame_time,
- prev->frames_count,
- prev->gradual_frames_count,
- prev->last_gradual_frame);
+ video_stream_add_frame(display, candidate,
+ prev->first_frame_time,
+ prev->frames_count,
+ prev->gradual_frames_count,
+ prev->last_gradual_frame);
}
}
}
@@ -456,12 +456,12 @@ static void red_upgrade_item_free(RedPipeItem *base)
}
/*
- * after dcc_detach_stream_gracefully is called for all the display channel clients,
- * stream_detach_drawable should be called. See comment (1).
+ * after dcc_detach_video_stream_gracefully is called for all the display channel clients,
+ * video_stream_detach_drawable should be called. See comment (1).
*/
-static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
- VideoStream *stream,
- Drawable *update_area_limit)
+static void dcc_detach_video_stream_gracefully(DisplayChannelClient *dcc,
+ VideoStream *stream,
+ Drawable *update_area_limit)
{
DisplayChannel *display = DCC_TO_DC(dcc);
int stream_id = display_channel_get_stream_id(display, stream);
@@ -523,16 +523,17 @@ clear_vis_region:
region_clear(&agent->vis_region);
}
-static void detach_stream_gracefully(DisplayChannel *display, VideoStream *stream,
- Drawable *update_area_limit)
+static void detach_video_stream_gracefully(DisplayChannel *display,
+ VideoStream *stream,
+ Drawable *update_area_limit)
{
DisplayChannelClient *dcc;
FOREACH_DCC(display, dcc) {
- dcc_detach_stream_gracefully(dcc, stream, update_area_limit);
+ dcc_detach_video_stream_gracefully(dcc, stream, update_area_limit);
}
if (stream->current) {
- stream_detach_drawable(stream);
+ video_stream_detach_drawable(stream);
}
}
@@ -544,9 +545,10 @@ static void detach_stream_gracefully(DisplayChannel *display, VideoStream *strea
* of the "current tree", the drawable parameter should be set with
* this drawable, otherwise, it should be NULL. Then, if detaching the stream
* involves sending an upgrade image to the client, this drawable won't be rendered
- * (see dcc_detach_stream_gracefully).
+ * (see dcc_detach_video_stream_gracefully).
*/
-void stream_detach_behind(DisplayChannel *display, QRegion *region, Drawable *drawable)
+void video_stream_detach_behind(DisplayChannel *display, QRegion *region,
+ Drawable *drawable)
{
Ring *ring = &display->priv->streams;
RingItem *item = ring_get_head(ring);
@@ -562,23 +564,23 @@ void stream_detach_behind(DisplayChannel *display, QRegion *region, Drawable *dr
StreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(display, stream));
if (region_intersects(&agent->vis_region, region)) {
- dcc_detach_stream_gracefully(dcc, stream, drawable);
+ dcc_detach_video_stream_gracefully(dcc, stream, drawable);
detach = 1;
spice_debug("stream %d", display_channel_get_stream_id(display, stream));
}
}
if (detach && stream->current) {
- stream_detach_drawable(stream);
+ video_stream_detach_drawable(stream);
} else if (!is_connected) {
if (stream->current &&
region_intersects(&stream->current->tree_item.base.rgn, region)) {
- stream_detach_drawable(stream);
+ video_stream_detach_drawable(stream);
}
}
}
}
-void stream_detach_and_stop(DisplayChannel *display)
+void video_stream_detach_and_stop(DisplayChannel *display)
{
RingItem *stream_item;
@@ -586,12 +588,12 @@ void stream_detach_and_stop(DisplayChannel *display)
while ((stream_item = ring_get_head(&display->priv->streams))) {
VideoStream *stream = SPICE_CONTAINEROF(stream_item, VideoStream, link);
- detach_stream_gracefully(display, stream, NULL);
- stream_stop(display, stream);
+ detach_video_stream_gracefully(display, stream, NULL);
+ video_stream_stop(display, stream);
}
}
-void stream_timeout(DisplayChannel *display)
+void video_stream_timeout(DisplayChannel *display)
{
Ring *ring = &display->priv->streams;
RingItem *item;
@@ -602,13 +604,13 @@ void stream_timeout(DisplayChannel *display)
VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
item = ring_next(ring, item);
if (now >= (stream->last_time + RED_STREAM_TIMEOUT)) {
- detach_stream_gracefully(display, stream, NULL);
- stream_stop(display, stream);
+ detach_video_stream_gracefully(display, stream, NULL);
+ video_stream_stop(display, stream);
}
}
}
-void stream_trace_add_drawable(DisplayChannel *display, Drawable *item)
+void video_stream_trace_add_drawable(DisplayChannel *display, Drawable *item)
{
ItemTrace *trace;
diff --git a/server/video-stream.h b/server/video-stream.h
index ae68fe363..40c3a4f7c 100644
--- a/server/video-stream.h
+++ b/server/video-stream.h
@@ -114,26 +114,26 @@ struct VideoStream {
DisplayChannel *display;
};
-void display_channel_init_streams (DisplayChannel *display);
-void stream_stop (DisplayChannel *display,
+void display_channel_init_video_streams (DisplayChannel *display);
+void video_stream_stop (DisplayChannel *display,
VideoStream *stream);
-void stream_unref (VideoStream *stream);
-void stream_trace_update (DisplayChannel *display,
+void video_stream_unref (VideoStream *stream);
+void video_stream_trace_update (DisplayChannel *display,
Drawable *drawable);
-void stream_maintenance (DisplayChannel *display,
+void video_stream_maintenance (DisplayChannel *display,
Drawable *candidate,
Drawable *prev);
-void stream_timeout (DisplayChannel *display);
-void stream_detach_and_stop (DisplayChannel *display);
-void stream_trace_add_drawable (DisplayChannel *display,
+void video_stream_timeout (DisplayChannel *display);
+void video_stream_detach_and_stop (DisplayChannel *display);
+void video_stream_trace_add_drawable (DisplayChannel *display,
Drawable *item);
-void stream_detach_behind (DisplayChannel *display,
+void video_stream_detach_behind (DisplayChannel *display,
QRegion *region,
Drawable *drawable);
void stream_agent_unref (StreamAgent *agent);
void stream_agent_stop (StreamAgent *agent);
-void stream_detach_drawable(VideoStream *stream);
+void video_stream_detach_drawable(VideoStream *stream);
#endif /* VIDEO_STREAM_H_ */
--
2.13.6
More information about the Spice-devel
mailing list