Commit 62bd7af8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use a VLC object for meta reader

parent 5a218411
......@@ -184,7 +184,6 @@ typedef struct access_sys_t access_sys_t;
typedef struct stream_t stream_t;
typedef struct stream_sys_t stream_sys_t;
typedef struct demux_t demux_t;
typedef struct demux_meta_t demux_meta_t;
typedef struct demux_sys_t demux_sys_t;
typedef struct es_out_t es_out_t;
typedef struct es_out_id_t es_out_id_t;
......
......@@ -78,13 +78,15 @@ struct demux_t
/* demux_meta_t is returned by "meta reader" module to the demuxer */
struct demux_meta_t
typedef struct demux_meta_t
{
VLC_COMMON_MEMBERS
demux_t *p_demux; /** FIXME: use stream_t instead? */
vlc_meta_t *p_meta; /**< meta data */
int i_attachments; /**< number of attachments */
input_attachment_t **attachments; /**< array of attachments */
};
} demux_meta_t;
enum demux_query_e
{
......
......@@ -485,12 +485,12 @@ static void CheckHeader( demux_t *p_demux )
****************************************************************************/
static int ParseTags( vlc_object_t *p_this )
{
demux_t *p_demux = (demux_t *)p_this;
demux_meta_t *p_demux_meta = (demux_meta_t*)p_demux->p_private;
demux_meta_t *p_demux_meta = (demux_meta_t *)p_this;
demux_t *p_demux = (demux_t *)p_demux_meta->p_demux;
bool b_seekable;
int64_t i_init;
msg_Dbg( p_demux, "checking for ID3v1/2 and APEv1/2 tags" );
msg_Dbg( p_demux_meta, "checking for ID3v1/2 and APEv1/2 tags" );
stream_Control( p_demux->s, STREAM_CAN_FASTSEEK, &b_seekable );
if( !b_seekable )
return VLC_EGENERIC;
......
......@@ -224,7 +224,7 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t*
if( !strncmp( psz_mime, "PNG", 3 ) ||
!strncmp( psz_name, "\xC2\x89PNG", 5 ) )
{
msg_Warn( p_demux, "Invalid picture embedded by broken iTunes version" );
msg_Warn( p_demux_meta, "Invalid picture embedded by broken iTunes version" );
free( psz_description );
continue;
}
......@@ -233,7 +233,7 @@ static void ReadMetaFromId3v2( ID3v2::Tag* tag, demux_t* p_demux, demux_meta_t*
const char *p_data = picture.data();
const unsigned i_data = picture.size();
msg_Dbg( p_demux, "Found embedded art: %s (%s) is %u bytes",
msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %u bytes",
psz_name, psz_mime, i_data );
p_attachment = vlc_input_attachment_New( psz_name, psz_mime,
......@@ -282,7 +282,7 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_met
// We get only the first covert art
if( mime_list.size() > 1 || art_list.size() > 1 )
msg_Warn( p_demux, "Found %i embedded arts, so using only the first one",
msg_Warn( p_demux_meta, "Found %i embedded arts, so using only the first one",
art_list.size() );
else if( mime_list.size() == 0 || art_list.size() == 0 )
return;
......@@ -296,7 +296,7 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_met
uint8_t *p_data;
int i_data = vlc_b64_decode_binary( &p_data, art_list[0].toCString(true) );
msg_Dbg( p_demux, "Found embedded art: %s (%s) is %i bytes",
msg_Dbg( p_demux_meta, "Found embedded art: %s (%s) is %i bytes",
psz_name, psz_mime, i_data );
TAB_INIT( p_demux_meta->i_attachments, p_demux_meta->attachments );
......@@ -320,8 +320,8 @@ static void ReadMetaFromXiph( Ogg::XiphComment* tag, demux_t* p_demux, demux_met
*/
static int ReadMeta( vlc_object_t* p_this)
{
demux_t* p_demux = (demux_t*)p_this;
demux_meta_t* p_demux_meta = (demux_meta_t*)p_demux->p_private;
demux_meta_t* p_demux_meta = (demux_meta_t *)p_this;
demux_t* p_demux = p_demux_meta->p_demux;
vlc_meta_t* p_meta;
FileRef f;
......
......@@ -2749,11 +2749,14 @@ static void InputSourceMeta( input_thread_t *p_input,
if( !b_bool )
return;
demux_meta_t *p_demux_meta = p_demux->p_private = calloc( 1, sizeof(*p_demux_meta) );
demux_meta_t *p_demux_meta =
vlc_custom_create( p_demux, sizeof( *p_demux_meta ),
VLC_OBJECT_GENERIC, "demux meta" );
if( !p_demux_meta )
return;
p_demux_meta->p_demux = p_demux;
module_t *p_id3 = module_need( p_demux, "meta reader", NULL, false );
module_t *p_id3 = module_need( p_demux_meta, "meta reader", NULL, false );
if( p_id3 )
{
if( p_demux_meta->p_meta )
......@@ -2771,7 +2774,7 @@ static void InputSourceMeta( input_thread_t *p_input,
}
module_unneed( p_demux, p_id3 );
}
free( p_demux_meta );
vlc_object_release( p_demux_meta );
}
......
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