Changeset ab0e83875c76e2a7ac258d0314908fd9bfb28c68

Show
Ignore:
Timestamp:
08/10/07 20:32:14 (1 year ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1191868334 +0000
git-parent:

[c046c7392fe5e0c8fac0f605631aa4ef491f2a5a]

git-author:
Laurent Aimar <fenrir@videolan.org> 1191868334 +0000
Message:

Let the input handle meta data and attachments for mpeg audio.

Files:

Legend:

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

    rba433c8 rab0e838  
    2929#include <vlc/vlc.h> 
    3030#include <vlc_demux.h> 
    31 #include <vlc_meta.h> 
    3231#include <vlc_codec.h> 
    3332#include <vlc_input.h> 
     
    6059{ 
    6160    es_out_id_t *p_es; 
    62     vlc_meta_t  *meta; 
    6361 
    6462    vlc_bool_t  b_start; 
     
    7674    int i_xing_frame_samples; 
    7775    block_t *p_block_in, *p_block_out; 
    78  
    79     int                i_attachments; 
    80     input_attachment_t **attachments; 
    8176}; 
    8277 
     
    126121    uint32_t     header; 
    127122    const uint8_t     *p_peek; 
    128     module_t    *p_id3; 
    129123    block_t     *p_block_in, *p_block_out; 
    130124 
     
    159153    p_sys->p_es = 0; 
    160154    p_sys->b_start = VLC_TRUE; 
    161     p_sys->meta = 0; 
    162155 
    163156    /* Load the mpeg audio packetizer */ 
     
    256249    p_sys->p_block_out = p_block_out; 
    257250 
    258     /* Parse possible id3 header */ 
    259     if( !var_CreateGetBool( p_demux, "meta-preparsed" ) ) 
    260     { 
    261         p_demux->p_private = malloc( sizeof( demux_meta_t ) ); 
    262         if( !p_demux->p_private ) 
    263             return VLC_ENOMEM; 
    264         if( ( p_id3 = module_Need( p_demux, "meta reader", NULL, 0 ) ) ) 
    265         { 
    266             module_Unneed( p_demux, p_id3 ); 
    267             demux_meta_t *p_demux_meta = (demux_meta_t *)p_demux->p_private; 
    268             p_sys->meta = p_demux_meta->p_meta; 
    269             p_sys->i_attachments = p_demux_meta->i_attachments; 
    270             p_sys->attachments = p_demux_meta->attachments; 
    271         } 
    272         free( p_demux->p_private ); 
    273     } 
    274251    /* */ 
    275252    p_sys->p_packetizer->fmt_out.b_packetized = VLC_TRUE; 
    276     vlc_audio_replay_gain_MergeFromMeta( &p_sys->p_packetizer->fmt_out.audio_replay_gain, 
    277                                          p_sys->meta ); 
    278253    p_sys->p_es = es_out_Add( p_demux->out, 
    279254                              &p_sys->p_packetizer->fmt_out); 
     
    346321    demux_sys_t *p_sys = p_demux->p_sys; 
    347322 
    348     var_Destroy( p_demux, "meta-preparsed" ); 
    349  
    350323    DESTROY_PACKETIZER( p_sys->p_packetizer ); 
    351     if( p_sys->meta ) vlc_meta_Delete( p_sys->meta ); 
    352324    if( p_sys->p_block_out ) block_Release( p_sys->p_block_out ); 
    353  
    354     int i; 
    355     for( i = 0; i < p_sys->i_attachments; i++ ) 
    356         free( p_sys->attachments[i] ); 
    357     TAB_CLEAN( p_sys->i_attachments, p_sys->attachments); 
    358325 
    359326    free( p_sys ); 
     
    367334    demux_sys_t *p_sys  = p_demux->p_sys; 
    368335    int64_t *pi64; 
    369     vlc_meta_t *p_meta
     336    vlc_bool_t *pb_bool
    370337    int i_ret; 
    371338 
    372     input_attachment_t ***ppp_attach; 
    373     int *pi_int, i; 
    374  
    375339    switch( i_query ) 
    376340    { 
    377         case DEMUX_GET_META: 
    378             p_meta = (vlc_meta_t *)va_arg( args, vlc_meta_t* ); 
    379             vlc_meta_Merge( p_meta, p_sys->meta ); 
    380             return VLC_SUCCESS; 
    381  
    382         case DEMUX_GET_ATTACHMENTS: 
    383             ppp_attach = 
    384                 (input_attachment_t***)va_arg( args, input_attachment_t*** ); 
    385             pi_int = (int*)va_arg( args, int * ); 
    386  
    387             if( p_sys->i_attachments <= 0 ) 
    388                 return VLC_EGENERIC; 
    389  
    390             *pi_int = p_sys->i_attachments; 
    391             *ppp_attach = malloc( sizeof(input_attachment_t**) * p_sys->i_attachments ); 
    392             for( i = 0; i < p_sys->i_attachments; i++ ) 
    393                 (*ppp_attach)[i] = vlc_input_attachment_Duplicate( p_sys->attachments[i] ); 
     341        case DEMUX_HAS_UNSUPPORTED_META: 
     342            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* ); 
     343            *pb_bool = VLC_TRUE; 
    394344            return VLC_SUCCESS; 
    395345