[PATCH spice-server 11/15] Rename Stream to VideoStream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To prevent confusion between Stream (a video stream) and RedStream (a
generic data stream between client and server), change the name to
VideoStream to be more explicit about what it is.

Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>
---
 server/Makefile.am                  |  4 ++--
 server/dcc-private.h                |  2 +-
 server/dcc-send.c                   |  4 ++--
 server/dcc.c                        |  6 +++---
 server/dcc.h                        |  4 ++--
 server/display-channel-private.h    |  8 ++++----
 server/display-channel.c            | 14 ++++++-------
 server/display-channel.h            |  4 ++--
 server/red-worker.c                 |  1 -
 server/stream-channel.c             |  2 +-
 server/{stream.c => video-stream.c} | 40 ++++++++++++++++++-------------------
 server/{stream.h => video-stream.h} | 20 +++++++++----------
 12 files changed, 54 insertions(+), 55 deletions(-)
 rename server/{stream.c => video-stream.c} (94%)
 rename server/{stream.h => video-stream.h} (94%)

diff --git a/server/Makefile.am b/server/Makefile.am
index 20f0f1925..3adb1e6f3 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -164,8 +164,6 @@ libserver_la_SOURCES =				\
 	stat-file.c				\
 	stat-file.h				\
 	stat.h					\
-	stream.c				\
-	stream.h				\
 	stream-channel.c			\
 	stream-channel.h			\
 	stream-device.c				\
@@ -175,6 +173,8 @@ libserver_la_SOURCES =				\
 	utils.c					\
 	utils.h					\
 	video-encoder.h				\
+	video-stream.c			\
+	video-stream.h			\
 	zlib-encoder.c				\
 	zlib-encoder.h				\
 	$(NULL)
diff --git a/server/dcc-private.h b/server/dcc-private.h
index c4662202d..76e194fe3 100644
--- a/server/dcc-private.h
+++ b/server/dcc-private.h
@@ -22,7 +22,7 @@
 #include "cache-item.h"
 #include "dcc.h"
 #include "image-encoders.h"
-#include "stream.h"
+#include "video-stream.h"
 #include "red-channel-client.h"
 
 typedef struct DisplayChannelClientPrivate DisplayChannelClientPrivate;
diff --git a/server/dcc-send.c b/server/dcc-send.c
index 84c109680..86de5aff3 100644
--- a/server/dcc-send.c
+++ b/server/dcc-send.c
@@ -1686,7 +1686,7 @@ static bool red_marshall_stream_data(RedChannelClient *rcc,
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
     DisplayChannel *display = DCC_TO_DC(dcc);
-    Stream *stream = drawable->stream;
+    VideoStream *stream = drawable->stream;
     SpiceCopy *copy;
     uint32_t frame_mm_time;
     int is_sized;
@@ -2153,7 +2153,7 @@ static void marshall_stream_start(RedChannelClient *rcc,
                                   SpiceMarshaller *base_marshaller, StreamAgent *agent)
 {
     DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
-    Stream *stream = agent->stream;
+    VideoStream *stream = agent->stream;
 
     spice_assert(stream);
     if (!agent->video_encoder) {
diff --git a/server/dcc.c b/server/dcc.c
index 226665ee2..ce6a9bcdc 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -554,7 +554,7 @@ static void dcc_create_all_streams(DisplayChannelClient *dcc)
     RingItem *item = ring;
 
     while ((item = ring_next(ring, item))) {
-        Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
+        VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
         dcc_create_stream(dcc, stream);
     }
 }
@@ -1546,7 +1546,7 @@ RedPipeItem *stream_destroy_item_new(StreamAgent *agent)
     return stream_create_destroy_item_new(agent, RED_PIPE_ITEM_TYPE_STREAM_DESTROY);
 }
 
-static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, Stream *stream)
+static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, VideoStream *stream)
 {
     char *env_bit_rate_str;
     uint64_t bit_rate = 0;
@@ -1692,7 +1692,7 @@ static VideoEncoder* dcc_create_video_encoder(DisplayChannelClient *dcc,
     return NULL;
 }
 
-void dcc_create_stream(DisplayChannelClient *dcc, Stream *stream)
+void dcc_create_stream(DisplayChannelClient *dcc, VideoStream *stream)
 {
     StreamAgent *agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(DCC_TO_DC(dcc), stream));
 
diff --git a/server/dcc.h b/server/dcc.h
index 8e1da936e..68b816ec4 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -78,7 +78,7 @@ GType display_channel_client_get_type(void) G_GNUC_CONST;
 #define MAX_PIPE_SIZE 50
 
 typedef struct DisplayChannel DisplayChannel;
-typedef struct Stream Stream;
+typedef struct VideoStream VideoStream;
 typedef struct StreamAgent StreamAgent;
 
 typedef struct WaitForChannels {
@@ -149,7 +149,7 @@ void                       dcc_destroy_surface                       (DisplayCha
 void                       dcc_stream_agent_clip                     (DisplayChannelClient* dcc,
                                                                       StreamAgent *agent);
 void                       dcc_create_stream                         (DisplayChannelClient *dcc,
-                                                                      Stream *stream);
+                                                                      VideoStream *stream);
 void                       dcc_create_surface                        (DisplayChannelClient *dcc,
                                                                       int surface_id);
 void                       dcc_push_surface_image                    (DisplayChannelClient *dcc,
diff --git a/server/display-channel-private.h b/server/display-channel-private.h
index 82a3e8c69..a490a863a 100644
--- a/server/display-channel-private.h
+++ b/server/display-channel-private.h
@@ -98,8 +98,8 @@ struct DisplayChannelPrivate
     int stream_video;
     GArray *video_codecs;
     uint32_t stream_count;
-    Stream streams_buf[NUM_STREAMS];
-    Stream *free_streams;
+    VideoStream streams_buf[NUM_STREAMS];
+    VideoStream *free_streams;
     Ring streams;
     ItemTrace items_trace[NUM_TRACE_ITEMS];
     uint32_t next_item_trace;
@@ -170,8 +170,8 @@ void display_channel_current_flush(DisplayChannel *display,
                                    int surface_id);
 uint32_t display_channel_generate_uid(DisplayChannel *display);
 
-int display_channel_get_stream_id(DisplayChannel *display, Stream *stream);
-Stream *display_channel_get_nth_stream(DisplayChannel *display, gint i);
+int display_channel_get_stream_id(DisplayChannel *display, VideoStream *stream);
+VideoStream *display_channel_get_nth_stream(DisplayChannel *display, gint i);
 
 typedef struct RedSurfaceDestroyItem {
     RedPipeItem pipe_item;
diff --git a/server/display-channel.c b/server/display-channel.c
index 7fa55f6ab..cc8884793 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -91,7 +91,7 @@ display_channel_finalize(GObject *object)
     if (ENABLE_EXTRA_CHECKS) {
         unsigned int count;
         _Drawable *drawable;
-        Stream *stream;
+        VideoStream *stream;
 
         count = 0;
         for (drawable = self->priv->free_drawables; drawable; drawable = drawable->u.next) {
@@ -206,9 +206,9 @@ int display_channel_get_streams_timeout(DisplayChannel *display)
 
     red_time_t now = spice_get_monotonic_time_ns();
     while ((item = ring_next(ring, item))) {
-        Stream *stream;
+        VideoStream *stream;
 
-        stream = SPICE_CONTAINEROF(item, Stream, link);
+        stream = SPICE_CONTAINEROF(item, VideoStream, link);
         red_time_t delta = (stream->last_time + RED_STREAM_TIMEOUT) - now;
 
         if (delta < 1000 * 1000) {
@@ -269,7 +269,7 @@ static void stop_streams(DisplayChannel *display)
     RingItem *item = ring_get_head(ring);
 
     while (item) {
-        Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
+        VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
         item = ring_next(ring, item);
         if (!stream->current) {
             stream_stop(display, stream);
@@ -340,7 +340,7 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
     item = ring_get_head(ring);
 
     while (item) {
-        Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
+        VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
 
         item = ring_next(ring, item);
 
@@ -2405,12 +2405,12 @@ void display_channel_gl_draw_done(DisplayChannel *display)
     set_gl_draw_async_count(display, display->priv->gl_draw_async_count - 1);
 }
 
-int display_channel_get_stream_id(DisplayChannel *display, Stream *stream)
+int display_channel_get_stream_id(DisplayChannel *display, VideoStream *stream)
 {
     return (int)(stream - display->priv->streams_buf);
 }
 
-Stream *display_channel_get_nth_stream(DisplayChannel *display, gint i)
+VideoStream *display_channel_get_nth_stream(DisplayChannel *display, gint i)
 {
     return &display->priv->streams_buf[i];
 }
diff --git a/server/display-channel.h b/server/display-channel.h
index 5e3d9eb7f..4f7def216 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -40,7 +40,7 @@
 #include "spice-bitmap-utils.h"
 #include "utils.h"
 #include "tree.h"
-#include "stream.h"
+#include "video-stream.h"
 #include "dcc.h"
 #include "image-encoders.h"
 #include "common-graphics-channel.h"
@@ -96,7 +96,7 @@ struct Drawable {
     int frames_count;
     int gradual_frames_count;
     int last_gradual_frame;
-    Stream *stream;
+    VideoStream *stream;
     int streamable;
     BitmapGradualType copy_bitmap_graduality;
     DependItem depend_items[3];
diff --git a/server/red-worker.c b/server/red-worker.c
index fa57235d9..8eaacd526 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -40,7 +40,6 @@
 #include <common/ring.h>
 
 #include "display-channel.h"
-#include "stream.h"
 
 #include "spice.h"
 #include "red-worker.h"
diff --git a/server/stream-channel.c b/server/stream-channel.c
index c7ca02062..bfacc3754 100644
--- a/server/stream-channel.c
+++ b/server/stream-channel.c
@@ -27,7 +27,7 @@
 #include "reds.h"
 #include "common-graphics-channel.h"
 #include "display-limits.h"
-#include "stream.h" // TODO remove, put common stuff
+#include "video-stream.h" // TODO remove, put common stuff
 
 #define TYPE_STREAM_CHANNEL_CLIENT stream_channel_client_get_type()
 
diff --git a/server/stream.c b/server/video-stream.c
similarity index 94%
rename from server/stream.c
rename to server/video-stream.c
index 0e5da6468..b8c0bd307 100644
--- a/server/stream.c
+++ b/server/video-stream.c
@@ -18,7 +18,7 @@
 #include <config.h>
 #endif
 
-#include "stream.h"
+#include "video-stream.h"
 #include "display-channel-private.h"
 #include "main-channel-client.h"
 #include "red-client.h"
@@ -28,7 +28,7 @@
     RING_FOREACH(item, &(display)->priv->streams)
 
 
-void stream_stop(DisplayChannel *display, Stream *stream)
+void stream_stop(DisplayChannel *display, VideoStream *stream)
 {
     DisplayChannelClient *dcc;
     int stream_id = display_channel_get_stream_id(display, stream);
@@ -45,13 +45,13 @@ void stream_stop(DisplayChannel *display, Stream *stream)
     stream_unref(stream);
 }
 
-static void stream_recycle(DisplayChannel *display, Stream *stream)
+static void stream_recycle(DisplayChannel *display, VideoStream *stream)
 {
     stream->next = display->priv->free_streams;
     display->priv->free_streams = stream;
 }
 
-static void stream_free(Stream *stream)
+static void stream_free(VideoStream *stream)
 {
     DisplayChannel *display = stream->display;
     stream_recycle(display, stream);
@@ -65,13 +65,13 @@ void display_channel_init_streams(DisplayChannel *display)
     ring_init(&display->priv->streams);
     display->priv->free_streams = NULL;
     for (i = 0; i < NUM_STREAMS; i++) {
-        Stream *stream = display_channel_get_nth_stream(display, i);
+        VideoStream *stream = display_channel_get_nth_stream(display, i);
         ring_item_init(&stream->link);
         stream_recycle(display, stream);
     }
 }
 
-void stream_unref(Stream *stream)
+void stream_unref(VideoStream *stream)
 {
     if (--stream->refs != 0)
         return;
@@ -123,7 +123,7 @@ static bool is_next_stream_frame(DisplayChannel *display,
                                  const int other_src_height,
                                  const SpiceRect *other_dest,
                                  const red_time_t other_time,
-                                 const Stream *stream,
+                                 const VideoStream *stream,
                                  int container_candidate_allowed)
 {
     RedDrawable *red_drawable;
@@ -177,7 +177,7 @@ static bool is_next_stream_frame(DisplayChannel *display,
     return TRUE;
 }
 
-static void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *stream)
+static void attach_stream(DisplayChannel *display, Drawable *drawable, VideoStream *stream)
 {
     DisplayChannelClient *dcc;
 
@@ -203,7 +203,7 @@ static void attach_stream(DisplayChannel *display, Drawable *drawable, Stream *s
     }
 }
 
-void stream_detach_drawable(Stream *stream)
+void stream_detach_drawable(VideoStream *stream)
 {
     spice_assert(stream->current && stream->current->stream);
     spice_assert(stream->current->stream == stream);
@@ -212,7 +212,7 @@ void stream_detach_drawable(Stream *stream)
 }
 
 static void before_reattach_stream(DisplayChannel *display,
-                                   Stream *stream, Drawable *new_frame)
+                                   VideoStream *stream, Drawable *new_frame)
 {
     DisplayChannelClient *dcc;
     int index;
@@ -247,9 +247,9 @@ static void before_reattach_stream(DisplayChannel *display,
     }
 }
 
-static Stream *display_channel_stream_try_new(DisplayChannel *display)
+static VideoStream *display_channel_stream_try_new(DisplayChannel *display)
 {
-    Stream *stream;
+    VideoStream *stream;
     if (!display->priv->free_streams) {
         return NULL;
     }
@@ -262,7 +262,7 @@ static Stream *display_channel_stream_try_new(DisplayChannel *display)
 static void display_channel_create_stream(DisplayChannel *display, Drawable *drawable)
 {
     DisplayChannelClient *dcc;
-    Stream *stream;
+    VideoStream *stream;
     SpiceRect* src_rect;
 
     spice_assert(!drawable->stream);
@@ -354,7 +354,7 @@ void stream_trace_update(DisplayChannel *display, Drawable *drawable)
     }
 
     FOREACH_STREAMS(display, item) {
-        Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
+        VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
         bool is_next_frame = is_next_stream_frame(display,
                                                   drawable,
                                                   stream->width,
@@ -400,7 +400,7 @@ void stream_maintenance(DisplayChannel *display,
     }
 
     if (prev->stream) {
-        Stream *stream = prev->stream;
+        VideoStream *stream = prev->stream;
 
         is_next_frame = is_next_stream_frame(display, candidate,
                                              stream->width, stream->height,
@@ -460,7 +460,7 @@ static void red_upgrade_item_free(RedPipeItem *base)
  * stream_detach_drawable should be called. See comment (1).
  */
 static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
-                                         Stream *stream,
+                                         VideoStream *stream,
                                          Drawable *update_area_limit)
 {
     DisplayChannel *display = DCC_TO_DC(dcc);
@@ -523,7 +523,7 @@ clear_vis_region:
     region_clear(&agent->vis_region);
 }
 
-static void detach_stream_gracefully(DisplayChannel *display, Stream *stream,
+static void detach_stream_gracefully(DisplayChannel *display, VideoStream *stream,
                                      Drawable *update_area_limit)
 {
     DisplayChannelClient *dcc;
@@ -554,7 +554,7 @@ void stream_detach_behind(DisplayChannel *display, QRegion *region, Drawable *dr
     bool is_connected = red_channel_is_connected(RED_CHANNEL(display));
 
     while (item) {
-        Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
+        VideoStream *stream = SPICE_CONTAINEROF(item, VideoStream, link);
         int detach = 0;
         item = ring_next(ring, item);
 
@@ -584,7 +584,7 @@ void stream_detach_and_stop(DisplayChannel *display)
 
     spice_debug("trace");
     while ((stream_item = ring_get_head(&display->priv->streams))) {
-        Stream *stream = SPICE_CONTAINEROF(stream_item, Stream, link);
+        VideoStream *stream = SPICE_CONTAINEROF(stream_item, VideoStream, link);
 
         detach_stream_gracefully(display, stream, NULL);
         stream_stop(display, stream);
@@ -599,7 +599,7 @@ void stream_timeout(DisplayChannel *display)
     red_time_t now = spice_get_monotonic_time_ns();
     item = ring_get_head(ring);
     while (item) {
-        Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
+        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);
diff --git a/server/stream.h b/server/video-stream.h
similarity index 94%
rename from server/stream.h
rename to server/video-stream.h
index b721593d5..ae68fe363 100644
--- a/server/stream.h
+++ b/server/video-stream.h
@@ -16,8 +16,8 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
-#ifndef STREAM_H_
-#define STREAM_H_
+#ifndef VIDEO_STREAM_H_
+#define VIDEO_STREAM_H_
 
 #include <glib.h>
 #include <common/region.h>
@@ -43,7 +43,7 @@
 #define RED_STREAM_DEFAULT_LOW_START_BIT_RATE (2.5 * 1024 * 1024) // 2.5Mbps
 #define MAX_FPS 30
 
-typedef struct Stream Stream;
+typedef struct VideoStream VideoStream;
 
 typedef struct RedStreamActivateReportItem {
     RedPipeItem pipe_item;
@@ -73,7 +73,7 @@ typedef struct StreamAgent {
                            vis_region will contain c2 and also the part of c1/c2 that still
                            displays fragments of the video */
 
-    Stream *stream;
+    VideoStream *stream;
     VideoEncoder *video_encoder;
     DisplayChannelClient *dcc;
 
@@ -97,7 +97,7 @@ typedef struct ItemTrace {
     SpiceRect dest_area;
 } ItemTrace;
 
-struct Stream {
+struct VideoStream {
     uint8_t refs;
     Drawable *current;
     red_time_t last_time;
@@ -105,7 +105,7 @@ struct Stream {
     int height;
     SpiceRect dest_area;
     int top_down;
-    Stream *next;
+    VideoStream *next;
     RingItem link;
 
     uint32_t num_input_frames;
@@ -116,8 +116,8 @@ struct Stream {
 
 void                  display_channel_init_streams                  (DisplayChannel *display);
 void                  stream_stop                                   (DisplayChannel *display,
-                                                                     Stream *stream);
-void                  stream_unref                                  (Stream *stream);
+                                                                     VideoStream *stream);
+void                  stream_unref                                  (VideoStream *stream);
 void                  stream_trace_update                           (DisplayChannel *display,
                                                                      Drawable *drawable);
 void                  stream_maintenance                            (DisplayChannel *display,
@@ -134,6 +134,6 @@ void                  stream_detach_behind                          (DisplayChan
 void                  stream_agent_unref                            (StreamAgent *agent);
 void                  stream_agent_stop                             (StreamAgent *agent);
 
-void stream_detach_drawable(Stream *stream);
+void stream_detach_drawable(VideoStream *stream);
 
-#endif /* STREAM_H_ */
+#endif /* VIDEO_STREAM_H_ */
-- 
2.13.6

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]