mirror of
https://code.videolan.org/videolan/vlc
synced 2024-10-03 01:31:53 +02:00
lib: remove media_library
Is it used ? It is the last one using input_thread_t. I don't really understand this code though.
This commit is contained in:
parent
589e95a4e2
commit
f912a67d45
@ -1,96 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* libvlc_media_library.h: libvlc external API
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1998-2009 VLC authors and VideoLAN
|
||||
*
|
||||
* Authors: Clément Stenac <zorglub@videolan.org>
|
||||
* Jean-Paul Saman <jpsaman@videolan.org>
|
||||
* Pierre d'Herbemont <pdherbemont@videolan.org>
|
||||
*
|
||||
* 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.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef VLC_LIBVLC_MEDIA_LIBRARY_H
|
||||
#define VLC_LIBVLC_MEDIA_LIBRARY_H 1
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
/** \defgroup libvlc_media_library LibVLC media library
|
||||
* \ingroup libvlc
|
||||
* @{
|
||||
* \file
|
||||
* LibVLC media library external API
|
||||
*/
|
||||
|
||||
typedef struct libvlc_media_library_t libvlc_media_library_t;
|
||||
|
||||
/**
|
||||
* Create an new Media Library object
|
||||
*
|
||||
* \param p_instance the libvlc instance
|
||||
* \return a new object or NULL on error
|
||||
* (it must be released by libvlc_media_library_release())
|
||||
*/
|
||||
LIBVLC_API libvlc_media_library_t *
|
||||
libvlc_media_library_new( libvlc_instance_t * p_instance );
|
||||
|
||||
/**
|
||||
* Release media library object. This functions decrements the
|
||||
* reference count of the media library object. If it reaches 0,
|
||||
* then the object will be released.
|
||||
*
|
||||
* \param p_mlib media library object
|
||||
*/
|
||||
LIBVLC_API void
|
||||
libvlc_media_library_release( libvlc_media_library_t * p_mlib );
|
||||
|
||||
/**
|
||||
* Retain a reference to a media library object. This function will
|
||||
* increment the reference counting for this object. Use
|
||||
* libvlc_media_library_release() to decrement the reference count.
|
||||
*
|
||||
* \param p_mlib media library object
|
||||
*/
|
||||
LIBVLC_API void
|
||||
libvlc_media_library_retain( libvlc_media_library_t * p_mlib );
|
||||
|
||||
/**
|
||||
* Load media library.
|
||||
*
|
||||
* \param p_mlib media library object
|
||||
* \return 0 on success, -1 on error
|
||||
*/
|
||||
LIBVLC_API int
|
||||
libvlc_media_library_load( libvlc_media_library_t * p_mlib );
|
||||
|
||||
/**
|
||||
* Get media library subitems.
|
||||
*
|
||||
* \param p_mlib media library object
|
||||
* \return media list subitems
|
||||
*/
|
||||
LIBVLC_API libvlc_media_list_t *
|
||||
libvlc_media_library_media_list( libvlc_media_library_t * p_mlib );
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif /* VLC_LIBVLC_MEDIA_LIBRARY_H */
|
@ -43,7 +43,6 @@ extern "C" {
|
||||
#include <vlc/libvlc_media_player.h>
|
||||
#include <vlc/libvlc_media_list.h>
|
||||
#include <vlc/libvlc_media_list_player.h>
|
||||
#include <vlc/libvlc_media_library.h>
|
||||
#include <vlc/libvlc_media_discoverer.h>
|
||||
#include <vlc/libvlc_events.h>
|
||||
#include <vlc/libvlc_dialog.h>
|
||||
|
@ -14,7 +14,6 @@ pkginclude_HEADERS = \
|
||||
../include/vlc/libvlc_events.h \
|
||||
../include/vlc/libvlc_media.h \
|
||||
../include/vlc/libvlc_media_discoverer.h \
|
||||
../include/vlc/libvlc_media_library.h \
|
||||
../include/vlc/libvlc_media_list.h \
|
||||
../include/vlc/libvlc_media_list_player.h \
|
||||
../include/vlc/libvlc_media_player.h \
|
||||
@ -51,7 +50,6 @@ libvlc_la_SOURCES = \
|
||||
media_list.c \
|
||||
media_list_path.h \
|
||||
media_list_player.c \
|
||||
media_library.c \
|
||||
media_discoverer.c \
|
||||
picture.c
|
||||
EXTRA_DIST = libvlc.pc.in libvlc.sym ../include/vlc/libvlc_version.h.in
|
||||
|
@ -84,11 +84,6 @@ libvlc_media_get_parsed_status
|
||||
libvlc_media_thumbnail_request_by_time
|
||||
libvlc_media_thumbnail_request_by_pos
|
||||
libvlc_media_thumbnail_cancel
|
||||
libvlc_media_library_load
|
||||
libvlc_media_library_media_list
|
||||
libvlc_media_library_new
|
||||
libvlc_media_library_release
|
||||
libvlc_media_library_retain
|
||||
libvlc_media_list_add_media
|
||||
libvlc_media_list_count
|
||||
libvlc_media_list_event_manager
|
||||
|
@ -1,141 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* media_library.c: libvlc tags tree functions
|
||||
* Create a tree of the 'tags' of a media_list's medias.
|
||||
*****************************************************************************
|
||||
* Copyright (C) 2007 VLC authors and VideoLAN
|
||||
*
|
||||
* Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
|
||||
*
|
||||
* 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/vlc.h>
|
||||
|
||||
#include <vlc_common.h>
|
||||
|
||||
#include "libvlc_internal.h"
|
||||
#include "media_list_internal.h"
|
||||
|
||||
struct libvlc_media_library_t
|
||||
{
|
||||
libvlc_event_manager_t event_manager;
|
||||
libvlc_instance_t * p_libvlc_instance;
|
||||
int i_refcount;
|
||||
libvlc_media_list_t * p_mlist;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Private functions
|
||||
*/
|
||||
|
||||
/*
|
||||
* Public libvlc functions
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
* new (Public)
|
||||
**************************************************************************/
|
||||
libvlc_media_library_t *
|
||||
libvlc_media_library_new( libvlc_instance_t * p_inst )
|
||||
{
|
||||
libvlc_media_library_t * p_mlib;
|
||||
|
||||
p_mlib = malloc(sizeof(libvlc_media_library_t));
|
||||
|
||||
if( !p_mlib )
|
||||
{
|
||||
libvlc_printerr( "Not enough memory" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p_mlib->p_libvlc_instance = p_inst;
|
||||
p_mlib->i_refcount = 1;
|
||||
p_mlib->p_mlist = NULL;
|
||||
|
||||
libvlc_event_manager_init( &p_mlib->event_manager, p_mlib );
|
||||
libvlc_retain( p_inst );
|
||||
return p_mlib;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* release (Public)
|
||||
**************************************************************************/
|
||||
void libvlc_media_library_release( libvlc_media_library_t * p_mlib )
|
||||
{
|
||||
p_mlib->i_refcount--;
|
||||
|
||||
if( p_mlib->i_refcount > 0 )
|
||||
return;
|
||||
|
||||
libvlc_event_manager_destroy( &p_mlib->event_manager );
|
||||
libvlc_release( p_mlib->p_libvlc_instance );
|
||||
free( p_mlib );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* retain (Public)
|
||||
**************************************************************************/
|
||||
void libvlc_media_library_retain( libvlc_media_library_t * p_mlib )
|
||||
{
|
||||
p_mlib->i_refcount++;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* load (Public)
|
||||
*
|
||||
* It doesn't yet load the playlists
|
||||
**************************************************************************/
|
||||
int libvlc_media_library_load( libvlc_media_library_t * p_mlib )
|
||||
{
|
||||
char *psz_datadir = config_GetUserDir( VLC_USERDATA_DIR );
|
||||
char * psz_uri;
|
||||
|
||||
if( psz_datadir == NULL
|
||||
|| asprintf( &psz_uri, "file/directory://%s" DIR_SEP "ml.xsp",
|
||||
psz_datadir ) == -1 )
|
||||
psz_uri = NULL;
|
||||
free( psz_datadir );
|
||||
|
||||
if( psz_uri == NULL )
|
||||
{
|
||||
libvlc_printerr( "Not enough memory" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( p_mlib->p_mlist )
|
||||
libvlc_media_list_release( p_mlib->p_mlist );
|
||||
|
||||
p_mlib->p_mlist = libvlc_media_list_new( p_mlib->p_libvlc_instance );
|
||||
|
||||
int ret = libvlc_media_list_add_file_content( p_mlib->p_mlist, psz_uri );
|
||||
free( psz_uri );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* media_list (Public)
|
||||
**************************************************************************/
|
||||
libvlc_media_list_t *
|
||||
libvlc_media_library_media_list( libvlc_media_library_t * p_mlib )
|
||||
{
|
||||
if( p_mlib->p_mlist )
|
||||
libvlc_media_list_retain( p_mlib->p_mlist );
|
||||
return p_mlib->p_mlist;
|
||||
}
|
@ -222,45 +222,6 @@ void libvlc_media_list_retain( libvlc_media_list_t * p_mlist )
|
||||
vlc_mutex_unlock( &p_mlist->refcount_lock );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* add_file_content (Public)
|
||||
**************************************************************************/
|
||||
int
|
||||
libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
|
||||
const char * psz_uri )
|
||||
{
|
||||
input_item_t * p_input_item;
|
||||
libvlc_media_t * p_md;
|
||||
|
||||
p_input_item = input_item_New( psz_uri, _("Media Library") );
|
||||
|
||||
if( !p_input_item )
|
||||
{
|
||||
libvlc_printerr( "Not enough memory" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
p_md = libvlc_media_new_from_input_item( p_mlist->p_libvlc_instance,
|
||||
p_input_item );
|
||||
if( !p_md )
|
||||
{
|
||||
input_item_Release( p_input_item );
|
||||
return -1;
|
||||
}
|
||||
|
||||
if( libvlc_media_list_add_media( p_mlist, p_md ) )
|
||||
{
|
||||
#warning Missing error handling!
|
||||
/* printerr and leaks */
|
||||
return -1;
|
||||
}
|
||||
|
||||
input_Read( p_mlist->p_libvlc_instance->p_libvlc_int, p_input_item,
|
||||
NULL, NULL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* set_media (Public)
|
||||
**************************************************************************/
|
||||
|
@ -65,7 +65,4 @@ int libvlc_media_list_internal_remove_index(
|
||||
void libvlc_media_list_internal_end_reached(
|
||||
libvlc_media_list_t * p_mlist );
|
||||
|
||||
int libvlc_media_list_add_file_content( libvlc_media_list_t *p_ml,
|
||||
const char *psz_uri );
|
||||
|
||||
#endif
|
||||
|
@ -142,7 +142,6 @@ lib/libvlc_internal.h
|
||||
lib/log.c
|
||||
lib/media.c
|
||||
lib/media_discoverer.c
|
||||
lib/media_library.c
|
||||
lib/media_list.c
|
||||
lib/media_list_path.h
|
||||
lib/media_list_player.c
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <vlc/libvlc_events.h>
|
||||
#include <vlc/libvlc_media.h>
|
||||
#include <vlc/libvlc_media_discoverer.h>
|
||||
#include <vlc/libvlc_media_library.h>
|
||||
#include <vlc/libvlc_media_list.h>
|
||||
#include <vlc/libvlc_media_list_player.h>
|
||||
#include <vlc/libvlc_media_player.h>
|
||||
|
Loading…
Reference in New Issue
Block a user