* vorbis.c: vorbis decoder/encoder/packetizer module making use of libvorbis.
*****************************************************************************
* Copyright (C) 2001-2003 VideoLAN
- * $Id: vorbis.c,v 1.27 2003/12/15 21:54:55 gbazin Exp $
+ * $Id: vorbis.c,v 1.32 2004/02/22 15:57:41 fenrir Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
* 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
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/decoder.h>
+#include <vlc/input.h>
+#include "vlc_playlist.h"
#include <ogg/ogg.h>
if( vorbis_synthesis_headerin( &p_sys->vi, &p_sys->vc,
&oggpacket ) < 0 )
{
- msg_Err( p_dec, "This bitstream does not contain Vorbis "
- "audio data");
+ msg_Err( p_dec, "this bitstream does not contain Vorbis "
+ "audio data.");
block_Release( *pp_block );
return NULL;
}
return NULL;
}
p_sys->i_headers++;
-
+
ParseVorbisComments( p_dec );
return ProcessPacket( p_dec, &oggpacket, pp_block );
return NULL;
}
p_sys->i_headers++;
-
+
if( !p_sys->b_packetizer )
{
/* Initialize the Vorbis packet->PCM decoder */
{
input_thread_t *p_input = (input_thread_t *)p_dec->p_parent;
input_info_category_t *p_cat =
- input_InfoCategory( p_input, _("Vorbis Comment") );
+ input_InfoCategory( p_input, _("Vorbis comment") );
+ playlist_t *p_playlist = vlc_object_find( p_dec, VLC_OBJECT_PLAYLIST,
+ FIND_ANYWHERE );
+ playlist_item_t *p_item;
int i = 0;
char *psz_name, *psz_value, *psz_comment;
while ( i < p_dec->p_sys->vc.comments )
psz_comment = strdup( p_dec->p_sys->vc.user_comments[i] );
if( !psz_comment )
{
- msg_Warn( p_dec, "Out of memory" );
+ msg_Warn( p_dec, "out of memory" );
break;
}
psz_name = psz_comment;
*psz_value = '\0';
psz_value++;
input_AddInfo( p_cat, psz_name, psz_value );
+ vlc_mutex_lock( &p_playlist->object_lock );
+ p_item = playlist_ItemGetByPos( p_playlist, -1 );
+ vlc_mutex_unlock( &p_playlist->object_lock );
+ if( !p_item)
+ {
+ msg_Err(p_dec, "unable to find item" );
+ return;
+ }
+ vlc_mutex_lock( &p_item->lock );
+ playlist_ItemAddInfo( p_item, _("Vorbis comment") ,
+ psz_name, psz_value );
+ vlc_mutex_unlock( &p_item->lock );
}
free( psz_comment );
i++;
}
+ if( p_playlist ) vlc_object_release( p_playlist );
}
/*****************************************************************************
* Interleave: helper function to interleave channels
*****************************************************************************/
+static void Interleave(
#ifdef MODULE_NAME_IS_tremor
-static void Interleave( int32_t *p_out, const int32_t **pp_in,
+ int32_t *p_out, const int32_t **pp_in,
#else
-static void Interleave( float *p_out, const float **pp_in,
+ float *p_out, const float **pp_in,
#endif
int i_nb_channels, int i_samples )
{
vorbis_info_init( &p_sys->vi );
if( vorbis_encode_setup_managed( &p_sys->vi,
- p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate,
+ p_enc->fmt_in.audio.i_channels, p_enc->fmt_in.audio.i_rate,
-1, p_enc->fmt_out.i_bitrate, -1 ) ||
vorbis_encode_ctl( &p_sys->vi, OV_ECTL_RATEMANAGE_AVG, NULL ) ||
- vorbis_encode_setup_init( &p_sys->vi ) ){}
+ vorbis_encode_setup_init( &p_sys->vi ) )
+ {
+ ;
+ }
/* add a comment */
vorbis_comment_init( &p_sys->vc);