Add a sub to the client/server test and fix an exposed bug.
authorCarl Hetherington <cth@carlh.net>
Mon, 15 Oct 2012 22:31:49 +0000 (23:31 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 15 Oct 2012 22:31:49 +0000 (23:31 +0100)
src/lib/server.cc
test/test.cc

index 2d19d06be79e9783941569c48b462f50eff73a9a..d40325db0055b7350c8bb04e8df5ca2f25a9200f 100644 (file)
@@ -127,7 +127,7 @@ Server::process (shared_ptr<Socket> socket)
 
        shared_ptr<Subtitle> sub;
        if (subtitle_position.x != -1) {
-               shared_ptr<Image> subtitle_image (new AlignedImage (pixel_format, subtitle_size));
+               shared_ptr<Image> subtitle_image (new AlignedImage (PIX_FMT_RGBA, subtitle_size));
                subtitle_image->read_from_socket (socket);
                sub.reset (new Subtitle (subtitle_position, subtitle_image));
        }
index a7023b8411d47b7fbbf6643ac40f4ed22cd6fbb3..730aa8d3e2a21dca5e0cf691a5f3f352f2787a92 100644 (file)
@@ -282,7 +282,6 @@ do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription* descriptio
 BOOST_AUTO_TEST_CASE (client_server_test)
 {
        shared_ptr<Image> image (new CompactImage (PIX_FMT_RGB24, Size (1998, 1080)));
-
        uint8_t* p = image->data()[0];
        
        for (int y = 0; y < 1080; ++y) {
@@ -293,16 +292,29 @@ BOOST_AUTO_TEST_CASE (client_server_test)
                }
        }
 
+       shared_ptr<Image> sub_image (new CompactImage (PIX_FMT_RGBA, Size (100, 200)));
+       p = sub_image->data()[0];
+       for (int y = 0; y < 200; ++y) {
+               for (int x = 0; x < 100; ++x) {
+                       *p++ = y % 256;
+                       *p++ = x % 256;
+                       *p++ = (x + y) % 256;
+                       *p++ = 1;
+               }
+       }
+
+       shared_ptr<Subtitle> subtitle (new Subtitle (Position (50, 60), sub_image));
+
        FileLog log ("build/test/client_server_test.log");
 
        shared_ptr<DCPVideoFrame> frame (
                new DCPVideoFrame (
                        image,
-                       shared_ptr<Subtitle> (),
+                       subtitle,
                        Size (1998, 1080),
                        0,
                        0,
-                       0,
+                       1,
                        Scaler::from_id ("bicubic"),
                        0,
                        24,