Changeset feb3362820c541cfe7b31d0dc37fb4b5c4b504cb

Show
Ignore:
Timestamp:
01/04/05 15:28:54 (4 years ago)
Author:
Sigmund Augdal Helberg <sigmunau@videolan.org>
git-committer:
Sigmund Augdal Helberg <sigmunau@videolan.org> 1112362134 +0000
git-parent:

[ce596a3b97ea08176761f870c36cdee0dc7c5dd4]

git-author:
Sigmund Augdal Helberg <sigmunau@videolan.org> 1112362134 +0000
Message:

demux/flac.c: support flac files with id3 tag. closes #2015

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/flac.c

    r91f2877 rfeb3362  
    5757    /* Packetizer */ 
    5858    decoder_t *p_packetizer; 
     59    vlc_meta_t *p_meta; 
    5960}; 
    6061 
     
    6869{ 
    6970    demux_t     *p_demux = (demux_t*)p_this; 
     71    module_t    *p_id3; 
    7072    demux_sys_t *p_sys; 
    7173    int          i_peek; 
    7274    byte_t      *p_peek; 
    7375    es_format_t  fmt; 
    74  
     76    vlc_meta_t  *p_meta = NULL; 
     77 
     78    /* Skip/parse possible id3 header */ 
     79    if( ( p_id3 = module_Need( p_demux, "id3", NULL, 0 ) ) ) 
     80    { 
     81        p_meta = (vlc_meta_t *)p_demux->p_private; 
     82        p_demux->p_private = NULL; 
     83        module_Unneed( p_demux, p_id3 ); 
     84    } 
     85     
    7586    /* Have a peep at the show. */ 
    76     if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC; 
     87    if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) 
     88    { 
     89        if( p_meta ) vlc_meta_Delete( p_meta ); 
     90        return VLC_EGENERIC; 
     91    } 
    7792 
    7893    if( p_peek[0]!='f' || p_peek[1]!='L' || p_peek[2]!='a' || p_peek[3]!='C' ) 
     
    8095        if( strncmp( p_demux->psz_demux, "flac", 4 ) ) 
    8196        { 
     97            if( p_meta ) vlc_meta_Delete( p_meta ); 
    8298            return VLC_EGENERIC; 
    8399        } 
     
    92108    es_format_Init( &fmt, AUDIO_ES, VLC_FOURCC( 'f', 'l', 'a', 'c' ) ); 
    93109    p_sys->b_start = VLC_TRUE; 
     110    p_sys->p_meta = p_meta; 
    94111 
    95112    /* We need to read and store the STREAMINFO metadata */ 
     
    98115    { 
    99116        msg_Err( p_demux, "this isn't a STREAMINFO metadata block" ); 
     117        if( p_meta ) vlc_meta_Delete( p_meta ); 
    100118        return VLC_EGENERIC; 
    101119    } 
     
    104122    { 
    105123        msg_Err( p_demux, "invalid size for a STREAMINFO metadata block" ); 
     124        if( p_meta ) vlc_meta_Delete( p_meta ); 
    106125        return VLC_EGENERIC; 
    107126    } 
     
    141160        vlc_object_destroy( p_sys->p_packetizer ); 
    142161        msg_Err( p_demux, "cannot find flac packetizer" ); 
     162        if( p_meta ) vlc_meta_Delete( p_meta ); 
    143163        return VLC_EGENERIC; 
    144164    } 
     
    165185    /* Delete the decoder */ 
    166186    vlc_object_destroy( p_sys->p_packetizer ); 
    167  
     187    if( p_sys->p_meta ) vlc_meta_Delete( p_sys->p_meta ); 
    168188    free( p_sys ); 
    169189} 
     
    222242    if( i_query == DEMUX_SET_TIME ) 
    223243        return VLC_EGENERIC; 
     244    else if( i_query == DEMUX_GET_META ) 
     245    {         
     246        vlc_meta_t **pp_meta = (vlc_meta_t **)va_arg( args, vlc_meta_t** ); 
     247        if( p_demux->p_sys->p_meta ) *pp_meta = vlc_meta_Duplicate( p_demux->p_sys->p_meta ); 
     248        else *pp_meta = NULL; 
     249        return VLC_SUCCESS; 
     250    } 
    224251    else 
    225252        return demux2_vaControlHelper( p_demux->s,