[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-cvslog
Subject:    [xine-cvs] =?utf-8?q?HG=3A_xine-lib-1=2E2=3A_Simplify_input_class?= =?utf-8?q?es?=
From:       Petri_Hintukainen via Xine-cvslog <xine-cvslog () lists ! sourceforge ! net
Date:       2017-09-27 8:05:31
Message-ID: d708241905bb296350b9.1506109779 () hg ! debian ! org
[Download RAW message or body]

# HG changeset patch
# User Petri Hintukainen <phintuka@users.sourceforge.net>
# Date 1506109779 -10800
# Node ID d708241905bb296350b94190f585727ee27396e4
# Branch  default
# Parent  67c5c3906b4eee04f0029c59f31a7b6c7b5322ea
Simplify input classes

diff --git a/src/input/input_pnm.c b/src/input/input_pnm.c
--- a/src/input/input_pnm.c
+++ b/src/input/input_pnm.c
@@ -58,13 +58,6 @@
 #define BUFSIZE 4096
 
 typedef struct {
-
-  input_class_t     input_class;
-
-  xine_t           *xine;
-} pnm_input_class_t;
-
-typedef struct {
   input_plugin_t   input_plugin;
 
   xine_stream_t   *stream;
@@ -280,19 +273,17 @@
 
 void *input_pnm_init_class (xine_t *xine, void *data) {
 
-  pnm_input_class_t  *this;
+  input_class_t  *this;
 
-  this = calloc(1, sizeof (pnm_input_class_t));
+  this = calloc(1, sizeof (input_class_t));
 
-  this->xine   = xine;
-
-  this->input_class.get_instance       = pnm_class_get_instance;
-  this->input_class.identifier         = "pnm";
-  this->input_class.description        = N_("pnm streaming input plugin");
-  this->input_class.get_dir            = NULL;
-  this->input_class.get_autoplay_list  = NULL;
-  this->input_class.dispose            = default_input_class_dispose;
-  this->input_class.eject_media        = NULL;
+  this->get_instance       = pnm_class_get_instance;
+  this->identifier         = "pnm";
+  this->description        = N_("pnm streaming input plugin");
+  this->get_dir            = NULL;
+  this->get_autoplay_list  = NULL;
+  this->dispose            = default_input_class_dispose;
+  this->eject_media        = NULL;
 
   return this;
 }
 --git a/src/input/input_pvr.c b/src/input/input_pvr.c
--- a/src/input/input_pvr.c
+++ b/src/input/input_pvr.c
@@ -169,10 +169,7 @@
 
   input_class_t     input_class;
 
-  xine_t           *xine;
-  config_values_t  *config;
-
-  char             *devname;
+  const char       *devname;
 
 } pvr_input_class_t;
 
@@ -1557,10 +1554,7 @@
 
   this = calloc(1, sizeof (pvr_input_class_t));
 
-  this->xine   = xine;
-  this->config = xine->config;
-
-  this->devname = this->config->register_filename(this->config,
+  this->devname = xine->config->register_filename(xine->config,
 				    "media.wintv_pvr.device",
 				    PVR_DEVICE, XINE_CONFIG_STRING_IS_DEVICE_NAME,
 				    _("device used for WinTV-PVR 250/350 (pvr plugin)"),
 --git a/src/input/input_rtp.c b/src/input/input_rtp.c
--- a/src/input/input_rtp.c
+++ b/src/input/input_rtp.c
@@ -159,16 +159,6 @@
   pthread_cond_t    reader_cond;
 } rtp_input_plugin_t;
 
-typedef struct {
-
-  input_class_t     input_class;
-
-  xine_t           *xine;
-  config_values_t  *config;
-
-} rtp_input_class_t;
-
-
 /* ***************************************************************** */
 /*                        Private functions                          */
 /* ***************************************************************** */
@@ -792,20 +782,17 @@
  */
 static void *init_class (xine_t *xine, void *data) {
 
-  rtp_input_class_t  *this;
+  input_class_t  *this;
 
+  this         = calloc(1, sizeof(input_class_t));
 
-  this         = calloc(1, sizeof(rtp_input_class_t));
-  this->config = xine->config;
-  this->xine   = xine;
-
-  this->input_class.get_instance      = rtp_class_get_instance;
-  this->input_class.description       = N_("RTP and UDP input plugin as shipped with \
                xine");
-  this->input_class.identifier        = "RTP/UDP";
-  this->input_class.get_dir           = NULL;
-  this->input_class.get_autoplay_list = NULL;
-  this->input_class.dispose           = default_input_class_dispose;
-  this->input_class.eject_media       = NULL;
+  this->get_instance      = rtp_class_get_instance;
+  this->description       = N_("RTP and UDP input plugin as shipped with xine");
+  this->identifier        = "RTP/UDP";
+  this->get_dir           = NULL;
+  this->get_autoplay_list = NULL;
+  this->dispose           = default_input_class_dispose;
+  this->eject_media       = NULL;
 
   return this;
 }
 --git a/src/input/input_rtsp.c b/src/input/input_rtsp.c
--- a/src/input/input_rtsp.c
+++ b/src/input/input_rtsp.c
@@ -58,13 +58,6 @@
 #define BUFSIZE 1025
 
 typedef struct {
-
-  input_class_t     input_class;
-
-  xine_t           *xine;
-} rtsp_input_class_t;
-
-typedef struct {
   input_plugin_t   input_plugin;
 
   rtsp_session_t  *rtsp;
@@ -299,19 +292,17 @@
  */
 void *input_rtsp_init_class (xine_t *xine, void *data) {
 
-  rtsp_input_class_t  *this;
+  input_class_t  *this;
 
-  this = calloc(1, sizeof (rtsp_input_class_t));
+  this = calloc(1, sizeof (input_class_t));
 
-  this->xine   = xine;
-
-  this->input_class.get_instance       = rtsp_class_get_instance;
-  this->input_class.identifier         = "rtsp";
-  this->input_class.description        = N_("rtsp streaming input plugin");
-  this->input_class.get_dir            = NULL;
-  this->input_class.get_autoplay_list  = NULL;
-  this->input_class.dispose            = default_input_class_dispose;
-  this->input_class.eject_media        = NULL;
+  this->get_instance       = rtsp_class_get_instance;
+  this->identifier         = "rtsp";
+  this->description        = N_("rtsp streaming input plugin");
+  this->get_dir            = NULL;
+  this->get_autoplay_list  = NULL;
+  this->dispose            = default_input_class_dispose;
+  this->eject_media        = NULL;
 
   return this;
 }
 --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c
--- a/src/input/input_stdin_fifo.c
+++ b/src/input/input_stdin_fifo.c
@@ -70,13 +70,6 @@
   char             seek_buf[BUFSIZE];
 } stdin_input_plugin_t;
 
-typedef struct {
-
-  input_class_t     input_class;
-
-  xine_t           *xine;
-} stdin_input_class_t;
-
 static off_t stdin_plugin_get_current_pos (input_plugin_t *this_gen);
 
 
@@ -370,7 +363,6 @@
 static input_plugin_t *stdin_class_get_instance (input_class_t *class_gen,
 						 xine_stream_t *stream, const char *data) {
 
-  stdin_input_class_t  *class = (stdin_input_class_t *) class_gen;
   stdin_input_plugin_t *this;
   int                   fh;
 
@@ -407,7 +399,7 @@
   this->stream          = stream;
   this->mrl             = strdup (data);
   this->fh              = fh;
-  this->xine            = class->xine;
+  this->xine            = stream->xine;
   this->curpos          = 0;
   this->num_reads       = 0;
   this->num_waits       = 0;
@@ -435,19 +427,17 @@
  */
 static void *stdin_plugin_init_class (xine_t *xine, void *data) {
 
-  stdin_input_class_t  *this;
+  input_class_t  *this;
 
-  this = calloc(1, sizeof (stdin_input_class_t));
+  this = calloc(1, sizeof (input_class_t));
 
-  this->xine   = xine;
-
-  this->input_class.get_instance       = stdin_class_get_instance;
-  this->input_class.identifier         = "stdin_fifo";
-  this->input_class.description        = N_("stdin streaming input plugin");
-  this->input_class.get_dir            = NULL;
-  this->input_class.get_autoplay_list  = NULL;
-  this->input_class.dispose            = default_input_class_dispose;
-  this->input_class.eject_media        = NULL;
+  this->get_instance       = stdin_class_get_instance;
+  this->identifier         = "stdin_fifo";
+  this->description        = N_("stdin streaming input plugin");
+  this->get_dir            = NULL;
+  this->get_autoplay_list  = NULL;
+  this->dispose            = default_input_class_dispose;
+  this->eject_media        = NULL;
 
   return this;
 }
 --git a/src/input/input_v4l.c b/src/input/input_v4l.c
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -127,11 +127,6 @@
 typedef struct pvrscr_s pvrscr_t;
 
 typedef struct {
-  input_class_t            input_class;
-  xine_t                  *xine;
-} v4l_input_class_t;
-
-typedef struct {
   input_plugin_t           input_plugin;
 
   xine_stream_t           *stream;
@@ -1897,20 +1892,18 @@
  */
 static void *init_video_class (xine_t *xine, void *data)
 {
-  v4l_input_class_t  *this;
+  input_class_t      *this;
   config_values_t    *config = xine->config;
 
-  this = calloc(1, sizeof (v4l_input_class_t));
+  this = calloc(1, sizeof (input_class_t));
 
-  this->xine                           = xine;
-
-  this->input_class.get_instance       = v4l_class_get_video_instance;
-  this->input_class.identifier         = "v4l";
-  this->input_class.description        = N_("v4l tv input plugin");
-  this->input_class.get_dir            = NULL;
-  this->input_class.get_autoplay_list  = NULL;
-  this->input_class.dispose            = default_input_class_dispose;
-  this->input_class.eject_media        = NULL;
+  this->get_instance       = v4l_class_get_video_instance;
+  this->identifier         = "v4l";
+  this->description        = N_("v4l tv input plugin");
+  this->get_dir            = NULL;
+  this->get_autoplay_list  = NULL;
+  this->dispose            = default_input_class_dispose;
+  this->eject_media        = NULL;
 
   config->register_filename (config, "media.video4linux.video_device",
 			   VIDEO_DEV, XINE_CONFIG_STRING_IS_DEVICE_NAME,
 --git a/src/input/input_v4l2.c b/src/input/input_v4l2.c
--- a/src/input/input_v4l2.c
+++ b/src/input/input_v4l2.c
@@ -387,10 +387,6 @@
     return -1;
 }
 
-typedef struct {
-    input_class_t input_class;
-} v4l2_input_class_t;
-
 static input_plugin_t *v4l2_class_get_instance(input_class_t *gen_cls, xine_stream_t \
*stream, const char *mrl) {  v4l2_input_plugin_t *this;
     if (strncasecmp (mrl, "v4l2:/", 6))
@@ -434,16 +430,19 @@
 }
 
 static void *v4l2_init_class(xine_t *xine, void *data) {
-    v4l2_input_class_t *this;
-    this = calloc(1, sizeof(v4l2_input_class_t));
-    this->input_class.get_instance = v4l2_class_get_instance;
-    this->input_class.description = N_("v4l2 input plugin");
-    this->input_class.identifier = "v4l2";
-    this->input_class.get_dir = NULL;
-    this->input_class.get_autoplay_list = NULL;
-    this->input_class.dispose = default_input_class_dispose;
-    this->input_class.eject_media = NULL;
-    return &this->input_class;
+    input_class_t *this;
+
+    this = calloc(1, sizeof(input_class_t));
+
+    this->get_instance      = v4l2_class_get_instance;
+    this->description       = N_("v4l2 input plugin");
+    this->identifier        = "v4l2";
+    this->get_dir           = NULL;
+    this->get_autoplay_list = NULL;
+    this->dispose           = default_input_class_dispose;
+    this->eject_media       = NULL;
+
+    return this;
 }
 
 const input_info_t input_info_v4l2 = {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic