summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2011-01-21 14:43:17 +0000
committerphintuka <phintuka>2011-01-21 14:43:17 +0000
commitb20599cb1602fdd10d769f8d047e70469ec14293 (patch)
tree011bbc404d3a017225c7a6cb3d14b68b71b38f9c
parentafda0d4e8f830ec110c68dc9ee58341b82352af3 (diff)
downloadxineliboutput-b20599cb1602fdd10d769f8d047e70469ec14293.tar.gz
xineliboutput-b20599cb1602fdd10d769f8d047e70469ec14293.tar.bz2
Moved frontend_svr.c:osd_recompress_net() --> rle.c:rle_recompress_net()
-rw-r--r--frontend_svr.c22
-rw-r--r--tools/rle.c33
-rw-r--r--tools/rle.h4
3 files changed, 38 insertions, 21 deletions
diff --git a/frontend_svr.c b/frontend_svr.c
index 665a8b30..8121eca5 100644
--- a/frontend_svr.c
+++ b/frontend_svr.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: frontend_svr.c,v 1.98 2011-01-21 14:22:37 phintuka Exp $
+ * $Id: frontend_svr.c,v 1.99 2011-01-21 14:43:17 phintuka Exp $
*
*/
@@ -42,6 +42,7 @@
#include "tools/http.h"
#include "tools/vdrdiscovery.h"
#include "tools/sdp.h"
+#include "tools/rle.h"
#include "frontend_svr.h"
#include "device.h"
@@ -238,23 +239,6 @@ void cXinelibServer::CloseConnection(int cli)
}
}
-static int recompress_osd_net(uint8_t *raw, xine_rle_elem_t *data, int elems)
-{
- uint8_t *raw0 = raw;
- for(int i=0; i<elems; i++) {
- uint16_t len = data[i].len;
- uint16_t color = data[i].color;
- if(len >= 0x80) {
- *(raw++) = (len>>8) | 0x80;
- *(raw++) = (len & 0xff);
- } else {
- *(raw++) = (len & 0x7f);
- }
- *(raw++) = color;
- }
- return (raw-raw0);
-}
-
static int write_osd_command(cxSocket& s, osd_command_t *cmd)
{
cxPoller p(s, true);
@@ -320,7 +304,7 @@ void cXinelibServer::OsdCmd(void *cmd_gen)
memcpy(&cmdnet, cmd, sizeof(osd_command_t));
if (cmd->data) {
cmdnet.raw_data = (uint8_t *)malloc(cmd->datalen);
- cmdnet.datalen = recompress_osd_net(cmdnet.raw_data, cmd->data, cmd->num_rle);
+ cmdnet.datalen = rle_recompress_net(cmdnet.raw_data, cmd->data, cmd->num_rle);
}
// -> network byte order
hton_osdcmd(cmdnet);
diff --git a/tools/rle.c b/tools/rle.c
index 51a4bc2b..71013f55 100644
--- a/tools/rle.c
+++ b/tools/rle.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: rle.c,v 1.6 2011-01-21 14:38:55 phintuka Exp $
+ * $Id: rle.c,v 1.7 2011-01-21 14:43:17 phintuka Exp $
*
*/
@@ -64,6 +64,37 @@ uint rle_compress(xine_rle_elem_t **rle_data, const uint8_t *data, uint w, uint
return num_rle;
}
+uint rle_compress_net(uint8_t **rle_data, uint *elems, const uint8_t *data, uint w, uint h)
+{
+ *elems = rle_compress((xine_rle_elem_t**)rle_data, data, w, h);
+ return rle_recompress_net(*rle_data, *(xine_rle_elem_t **)rle_data, *elems);
+}
+
+/*
+ * rle_recompress_net()
+ *
+ * recompress RLE-compressed OSD using variable sized RLE codewords
+*/
+uint rle_recompress_net(uint8_t *raw, xine_rle_elem_t *data, uint elems)
+{
+ uint8_t *raw0 = raw;
+ uint i;
+
+ for (i = 0; i < elems; i++) {
+ uint16_t len = data[i].len;
+ uint16_t color = data[i].color;
+ if (len >= 0x80) {
+ *(raw++) = (len>>8) | 0x80;
+ *(raw++) = (len & 0xff);
+ } else {
+ *(raw++) = (len & 0x7f);
+ }
+ *(raw++) = color;
+ }
+
+ return (raw - raw0);
+}
+
/*
* rle_scale_nearest()
*
diff --git a/tools/rle.h b/tools/rle.h
index 41a579d2..8ad82ad3 100644
--- a/tools/rle.h
+++ b/tools/rle.h
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: rle.h,v 1.4 2011-01-21 14:38:55 phintuka Exp $
+ * $Id: rle.h,v 1.5 2011-01-21 14:43:17 phintuka Exp $
*
*/
@@ -26,6 +26,8 @@ struct xine_clut_s;
uint rle_compress(struct xine_rle_elem_s **rle_data, const uint8_t *data, uint w, uint h);
+uint rle_compress_net(uint8_t **rle_data, uint *elems, const uint8_t *data, uint w, uint h);
+uint rle_recompress_net(uint8_t *raw, xine_rle_elem_t *data, uint elems);
void rle_uncompress_lut8(const struct xine_rle_elem_s *rle_data,
uint8_t *data, uint w, uint h);