Commit 6975a29a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

rar: merge access and stream_filter in a single module

parent c71e5789
......@@ -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)
......
......@@ -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);
}
/*****************************************************************************
* 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()
......@@ -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 *);
......@@ -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);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment