Commit cf0bb5cf authored by zorglub's avatar zorglub

Taglib based parser, use it for Vorbis parsing

Features to add to it:
* Parse more meta than artist/title :)
* Fetch duration for Vorbis files
* Fetch album art in ID3v2 (APIC frames)
* Write back tags to file

Unfortunately, it only works for files, so it can't replace libid3tag
parent ac3afe50
......@@ -1572,7 +1572,6 @@ AS_IF([test "${enable_audioscrobbler}" != "no"], [
dnl
dnl Musicbrainz plugin
dnl
AC_ARG_ENABLE(musicbrainz,
[ --enable-musicbrainz MusicBrainz support (default disabled) ])
AS_IF([test "${enable_musicbrainz}" = "yes"],[
......@@ -1583,6 +1582,17 @@ AC_ARG_ENABLE(musicbrainz,
[AC_MSG_WARN(MusicBrainz library not found)])
])
dnl
dnl Taglibplugin
dnl
AC_ARG_ENABLE(taglib,
[ --enable-taglib Taglib support (default disabled) ])
AS_IF([test "x${enable_taglib}" = "xyes"],[
VLC_ADD_PLUGINS([taglib])
VLC_ADD_LDFLAGS([taglib], [-ltag])
VLC_ADD_CXXFLAGS([taglib], [-I/usr/include/taglib])
])
dnl
dnl Input plugins
dnl
......
......@@ -201,6 +201,20 @@ static int Open( vlc_object_t * p_this )
/* Begnning of stream, tell the demux to look for elementary streams. */
p_sys->i_eos = 0;
if( ((input_thread_t* )(p_demux->p_parent ))->b_preparsing == VLC_TRUE )
{
module_t *p_meta = module_Need( p_demux, "meta reader", NULL, 0 );
if( p_meta )
{
vlc_meta_Merge( ((input_thread_t* )(p_demux->p_parent ))->
input.p_item->p_meta,
(vlc_meta_t*)(p_demux->p_private ) );
module_Unneed( p_demux, p_meta );
}
return VLC_SUCCESS;
}
/* Initialize the Ogg physical bitstream parser */
ogg_sync_init( &p_sys->oy );
......
......@@ -136,6 +136,10 @@ static void ParseID3Tag( demux_t *p_demux, uint8_t *p_data, int i_size )
{
vlc_meta_SetEncodedBy( p_meta, psz_temp );
}
else if( ID_IS ( "APIC" ) )
{
fprintf( stderr, "** Has APIC **\n" );
}
else if( p_frame->description )
{ /* Unhandled meta*/
msg_Warn( p_demux, "Fixme: unhandled ID3 metatag, %s", p_frame->description );
......
......@@ -12,3 +12,4 @@ SOURCES_gnutls = gnutls.c
SOURCES_svg = svg.c
SOURCES_profile_parser = profile_parser.c
SOURCES_audioscrobbler = audioscrobbler.c
SOURCES_taglib = taglib.cpp
/*****************************************************************************
* taglib.cpp: Taglib tag parser/writer
*****************************************************************************
* Copyright (C) 2003-2006 the VideoLAN team
* $Id: rtsp.c 16204 2006-08-03 16:58:10Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 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 General Public License for more details.
*
* You should have received a copy of the GNU 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.
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/input.h>
#include <vlc_meta.h>
#include <fileref.h>
#include <tag.h>
static int ReadMeta ( vlc_object_t * );
vlc_module_begin();
set_capability( "meta reader", 1000 );
set_callbacks( ReadMeta, NULL );
vlc_module_end();
static int ReadMeta( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
fprintf( stderr, "Demuxing with %s\n", p_demux->psz_access );
if( !strncmp( p_demux->psz_access, "file", 4 ) )
{
if( !p_demux->p_private )
p_demux->p_private = (void*)vlc_meta_New();
TagLib::FileRef f( p_demux->psz_path );
if( !f.isNull() && f.tag() )
{
TagLib::Tag *tag = f.tag();
vlc_meta_t *p_meta = (vlc_meta_t *)(p_demux->p_private );
vlc_meta_SetTitle( p_meta, tag->title().toCString( true ) );
vlc_meta_SetArtist( p_meta, tag->artist().toCString( true ) );
return VLC_SUCCESS;
}
}
return VLC_EGENERIC;
}
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