mirror of https://github.com/neutrinolabs/xrdp
Modify xrdp encoder for new fifo interface
This commit is contained in:
parent
d5684e0633
commit
3d87d40d0a
|
@ -46,6 +46,26 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
|
||||||
static int
|
static int
|
||||||
process_enc_h264(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
|
process_enc_h264(struct xrdp_encoder *self, XRDP_ENC_DATA *enc);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* Item destructor for self->fifo_to_proc */
|
||||||
|
static void
|
||||||
|
xrdp_enc_data_destructor(void *item, void *closure)
|
||||||
|
{
|
||||||
|
XRDP_ENC_DATA *enc = (XRDP_ENC_DATA *)item;
|
||||||
|
g_free(enc->drects);
|
||||||
|
g_free(enc->crects);
|
||||||
|
g_free(enc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Item destructor for self->fifo_processed */
|
||||||
|
static void
|
||||||
|
xrdp_enc_data_done_destructor(void *item, void *closure)
|
||||||
|
{
|
||||||
|
XRDP_ENC_DATA_DONE *enc_done = (XRDP_ENC_DATA_DONE *)item;
|
||||||
|
g_free(enc_done->comp_pad_data);
|
||||||
|
g_free(enc_done);
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
struct xrdp_encoder *
|
struct xrdp_encoder *
|
||||||
xrdp_encoder_create(struct xrdp_mm *mm)
|
xrdp_encoder_create(struct xrdp_mm *mm)
|
||||||
|
@ -114,8 +134,8 @@ xrdp_encoder_create(struct xrdp_mm *mm)
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "init_xrdp_encoder: initializing encoder codec_id %d", self->codec_id);
|
LOG_DEVEL(LOG_LEVEL_INFO, "init_xrdp_encoder: initializing encoder codec_id %d", self->codec_id);
|
||||||
|
|
||||||
/* setup required FIFOs */
|
/* setup required FIFOs */
|
||||||
self->fifo_to_proc = fifo_create();
|
self->fifo_to_proc = fifo_create(xrdp_enc_data_destructor);
|
||||||
self->fifo_processed = fifo_create();
|
self->fifo_processed = fifo_create(xrdp_enc_data_done_destructor);
|
||||||
self->mutex = tc_mutex_create();
|
self->mutex = tc_mutex_create();
|
||||||
|
|
||||||
pid = g_getpid();
|
pid = g_getpid();
|
||||||
|
@ -141,10 +161,6 @@ xrdp_encoder_create(struct xrdp_mm *mm)
|
||||||
void
|
void
|
||||||
xrdp_encoder_delete(struct xrdp_encoder *self)
|
xrdp_encoder_delete(struct xrdp_encoder *self)
|
||||||
{
|
{
|
||||||
XRDP_ENC_DATA *enc;
|
|
||||||
XRDP_ENC_DATA_DONE *enc_done;
|
|
||||||
FIFO *fifo;
|
|
||||||
|
|
||||||
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_delete:");
|
LOG_DEVEL(LOG_LEVEL_INFO, "xrdp_encoder_delete:");
|
||||||
if (self == 0)
|
if (self == 0)
|
||||||
{
|
{
|
||||||
|
@ -175,40 +191,9 @@ xrdp_encoder_delete(struct xrdp_encoder *self)
|
||||||
g_delete_wait_obj(self->xrdp_encoder_event_processed);
|
g_delete_wait_obj(self->xrdp_encoder_event_processed);
|
||||||
g_delete_wait_obj(self->xrdp_encoder_term);
|
g_delete_wait_obj(self->xrdp_encoder_term);
|
||||||
|
|
||||||
/* cleanup fifo_to_proc */
|
/* cleanup fifos */
|
||||||
fifo = self->fifo_to_proc;
|
fifo_delete(self->fifo_to_proc, NULL);
|
||||||
if (fifo)
|
fifo_delete(self->fifo_processed, NULL);
|
||||||
{
|
|
||||||
while (!fifo_is_empty(fifo))
|
|
||||||
{
|
|
||||||
enc = (XRDP_ENC_DATA *) fifo_remove_item(fifo);
|
|
||||||
if (enc == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
g_free(enc->drects);
|
|
||||||
g_free(enc->crects);
|
|
||||||
g_free(enc);
|
|
||||||
}
|
|
||||||
fifo_delete(fifo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* cleanup fifo_processed */
|
|
||||||
fifo = self->fifo_processed;
|
|
||||||
if (fifo)
|
|
||||||
{
|
|
||||||
while (!fifo_is_empty(fifo))
|
|
||||||
{
|
|
||||||
enc_done = (XRDP_ENC_DATA_DONE *) fifo_remove_item(fifo);
|
|
||||||
if (enc_done == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
g_free(enc_done->comp_pad_data);
|
|
||||||
g_free(enc_done);
|
|
||||||
}
|
|
||||||
fifo_delete(fifo);
|
|
||||||
}
|
|
||||||
tc_mutex_delete(self->mutex);
|
tc_mutex_delete(self->mutex);
|
||||||
g_free(self);
|
g_free(self);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +214,7 @@ process_enc_jpg(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
|
||||||
int count;
|
int count;
|
||||||
char *out_data;
|
char *out_data;
|
||||||
XRDP_ENC_DATA_DONE *enc_done;
|
XRDP_ENC_DATA_DONE *enc_done;
|
||||||
FIFO *fifo_processed;
|
struct fifo *fifo_processed;
|
||||||
tbus mutex;
|
tbus mutex;
|
||||||
tbus event_processed;
|
tbus event_processed;
|
||||||
|
|
||||||
|
@ -322,7 +307,7 @@ process_enc_rfx(struct xrdp_encoder *self, XRDP_ENC_DATA *enc)
|
||||||
int finished;
|
int finished;
|
||||||
char *out_data;
|
char *out_data;
|
||||||
XRDP_ENC_DATA_DONE *enc_done;
|
XRDP_ENC_DATA_DONE *enc_done;
|
||||||
FIFO *fifo_processed;
|
struct fifo *fifo_processed;
|
||||||
tbus mutex;
|
tbus mutex;
|
||||||
tbus event_processed;
|
tbus event_processed;
|
||||||
struct rfx_tile *tiles;
|
struct rfx_tile *tiles;
|
||||||
|
@ -455,7 +440,7 @@ THREAD_RV THREAD_CC
|
||||||
proc_enc_msg(void *arg)
|
proc_enc_msg(void *arg)
|
||||||
{
|
{
|
||||||
XRDP_ENC_DATA *enc;
|
XRDP_ENC_DATA *enc;
|
||||||
FIFO *fifo_to_proc;
|
struct fifo *fifo_to_proc;
|
||||||
tbus mutex;
|
tbus mutex;
|
||||||
tbus event_to_proc;
|
tbus event_to_proc;
|
||||||
tbus term_obj;
|
tbus term_obj;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#define _XRDP_ENCODER_H
|
#define _XRDP_ENCODER_H
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "fifo.h"
|
struct fifo;
|
||||||
|
|
||||||
struct xrdp_enc_data;
|
struct xrdp_enc_data;
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ struct xrdp_encoder
|
||||||
tbus xrdp_encoder_event_to_proc;
|
tbus xrdp_encoder_event_to_proc;
|
||||||
tbus xrdp_encoder_event_processed;
|
tbus xrdp_encoder_event_processed;
|
||||||
tbus xrdp_encoder_term;
|
tbus xrdp_encoder_term;
|
||||||
FIFO *fifo_to_proc;
|
struct fifo *fifo_to_proc;
|
||||||
FIFO *fifo_processed;
|
struct fifo *fifo_processed;
|
||||||
tbus mutex;
|
tbus mutex;
|
||||||
int (*process_enc)(struct xrdp_encoder *self, struct xrdp_enc_data *enc);
|
int (*process_enc)(struct xrdp_encoder *self, struct xrdp_enc_data *enc);
|
||||||
void *codec_handle;
|
void *codec_handle;
|
||||||
|
|
Loading…
Reference in New Issue