[vlc-commits] rar: merge access and stream_filter in a single module
Rémi Denis-Courmont
git at videolan.org
Sun Sep 15 19:37:23 CEST 2013
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 15 10:44:28 2013 +0300| [6975a29acb8a215a7cbaa0a3f1ed1098ceb8a03b] | committer: Rémi Denis-Courmont
rar: merge access and stream_filter in a single module
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6975a29acb8a215a7cbaa0a3f1ed1098ceb8a03b
---
modules/access/Modules.am | 8 ++++----
modules/access/rar/access.c | 26 ++------------------------
modules/access/rar/module.c | 39 +++++++++++++++++++++++++++++++++++++++
modules/access/rar/rar.h | 4 ++++
modules/access/rar/stream.c | 28 +++-------------------------
5 files changed, 52 insertions(+), 53 deletions(-)
diff --git a/modules/access/Modules.am b/modules/access/Modules.am
index be404c0..4e82ca6 100644
--- a/modules/access/Modules.am
+++ b/modules/access/Modules.am
@@ -72,8 +72,9 @@ SOURCES_access_attachment = attachment.c
SOURCES_access_vdr = vdr.c
SOURCES_libbluray = bluray.c
-SOURCES_access_rar = rar/rar.c rar/rar.h rar/access.c
-SOURCES_stream_filter_rar = rar/rar.c rar/rar.h rar/stream.c
+librar_plugin_la_SOURCES = rar/rar.c rar/rar.h \
+ rar/access.c rar/stream.c rar/module.c
+librar_plugin_la_CPPFLAGS = $(AM_CPPFLAGS)
if HAVE_DECKLINK
libdecklink_plugin_la_SOURCES = decklink.cpp
@@ -119,10 +120,9 @@ libvlc_LTLIBRARIES += \
libaccess_ftp_plugin.la \
libaccess_imem_plugin.la \
libaccess_attachment_plugin.la \
+ librar_plugin.la \
libsdp_plugin.la \
libtimecode_plugin.la \
- libaccess_rar_plugin.la \
- libstream_filter_rar_plugin.la \
libaccess_vdr_plugin.la \
$(NULL)
diff --git a/modules/access/rar/access.c b/modules/access/rar/access.c
index dcd9735..49faeab 100644
--- a/modules/access/rar/access.c
+++ b/modules/access/rar/access.c
@@ -21,9 +21,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -39,24 +36,6 @@
#include "rar.h"
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
-
-vlc_module_begin()
- set_category(CAT_INPUT)
- set_subcategory(SUBCAT_INPUT_STREAM_FILTER)
- set_description(N_("Uncompressed RAR"))
- set_capability("access", 0)
- set_callbacks(Open, Close)
- add_shortcut("rar")
-vlc_module_end()
-
-/*****************************************************************************
- * Local definitions/prototypes
- *****************************************************************************/
struct access_sys_t {
stream_t *s;
rar_file_t *file;
@@ -160,7 +139,7 @@ static int Control(access_t *access, int query, va_list args)
}
}
-static int Open(vlc_object_t *object)
+int RarAccessOpen(vlc_object_t *object)
{
access_t *access = (access_t*)object;
@@ -219,7 +198,7 @@ error:
return VLC_EGENERIC;
}
-static void Close(vlc_object_t *object)
+void RarAccessClose(vlc_object_t *object)
{
access_t *access = (access_t*)object;
access_sys_t *sys = access->p_sys;
@@ -229,4 +208,3 @@ static void Close(vlc_object_t *object)
RarFileDelete(sys->file);
free(sys);
}
-
diff --git a/modules/access/rar/module.c b/modules/access/rar/module.c
new file mode 100644
index 0000000..7ec9ca6
--- /dev/null
+++ b/modules/access/rar/module.c
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * stream.c: uncompressed RAR stream filter
+ *****************************************************************************
+ * Copyright (C) 2008-2010 Laurent Aimar
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+
+#include "rar.h"
+
+vlc_module_begin()
+ set_category(CAT_INPUT)
+ set_subcategory(SUBCAT_INPUT_STREAM_FILTER)
+ set_description(N_("Uncompressed RAR"))
+ set_capability("access", 0)
+ set_callbacks(RarAccessOpen, RarAccessClose)
+ add_submodule()
+ set_capability("stream_filter", 1)
+ set_callbacks(RarStreamOpen, RarStreamClose)
+vlc_module_end()
diff --git a/modules/access/rar/rar.h b/modules/access/rar/rar.h
index 4dea459..232009c 100644
--- a/modules/access/rar/rar.h
+++ b/modules/access/rar/rar.h
@@ -42,3 +42,7 @@ int RarProbe(stream_t *);
void RarFileDelete(rar_file_t *);
int RarParse(stream_t *, int *, rar_file_t ***);
+int RarAccessOpen(vlc_object_t *);
+void RarAccessClose(vlc_object_t *);
+int RarStreamOpen(vlc_object_t *);
+void RarStreamClose(vlc_object_t *);
diff --git a/modules/access/rar/stream.c b/modules/access/rar/stream.c
index ab09d1a..cd81764 100644
--- a/modules/access/rar/stream.c
+++ b/modules/access/rar/stream.c
@@ -21,9 +21,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -38,24 +35,6 @@
#include "rar.h"
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-static int Open (vlc_object_t *);
-static void Close(vlc_object_t *);
-
-vlc_module_begin()
- set_category(CAT_INPUT)
- set_subcategory(SUBCAT_INPUT_STREAM_FILTER)
- set_description(N_("Uncompressed RAR"))
- set_capability("stream_filter", 1)
- set_callbacks(Open, Close)
- add_shortcut("rar")
-vlc_module_end()
-
-/****************************************************************************
- * Local definitions/prototypes
- ****************************************************************************/
struct stream_sys_t {
stream_t *payload;
};
@@ -83,7 +62,7 @@ static int Control(stream_t *s, int query, va_list args)
}
}
-static int Open(vlc_object_t *object)
+int RarStreamOpen(vlc_object_t *object)
{
stream_t *s = (stream_t*)object;
@@ -152,7 +131,7 @@ static int Open(vlc_object_t *object)
char *tmp;
if (asprintf(&tmp, "%s.m3u", s->psz_path) < 0) {
- Close(object);
+ RarStreamClose(object);
return VLC_ENOMEM;
}
free(s->psz_path);
@@ -161,7 +140,7 @@ static int Open(vlc_object_t *object)
return VLC_SUCCESS;
}
-static void Close(vlc_object_t *object)
+void RarStreamClose(vlc_object_t *object)
{
stream_t *s = (stream_t*)object;
stream_sys_t *sys = s->p_sys;
@@ -169,4 +148,3 @@ static void Close(vlc_object_t *object)
stream_Delete(sys->payload);
free(sys);
}
-
More information about the vlc-commits
mailing list