[vlc-devel] commit: Completed a bit meta data support in VLC (close #3280). ( Laurent Aimar )
git version control
git at videolan.org
Mon Feb 8 23:34:28 CET 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Feb 8 23:32:48 2010 +0100| [ab5ae32ceb68c5728bbe239455f53d2e0dd67e8e] | committer: Laurent Aimar
Completed a bit meta data support in VLC (close #3280).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ab5ae32ceb68c5728bbe239455f53d2e0dd67e8e
---
modules/demux/avi/avi.c | 62 +++++++++++++++++++++++++++++++++++++++-------
1 files changed, 52 insertions(+), 10 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 782fbe4..fc1d24e 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -201,6 +201,8 @@ static void AVI_ExtractSubtitle( demux_t *, int i_stream, avi_chunk_list_t *, av
static mtime_t AVI_MovieGetLength( demux_t * );
+static void AVI_MetaLoad( demux_t *, avi_chunk_list_t *p_riff, avi_chunk_avih_t *p_avih );
+
/*****************************************************************************
* Stream management
*****************************************************************************/
@@ -344,16 +346,8 @@ static int Open( vlc_object_t * p_this )
p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
- if( ( p_sys->meta = vlc_meta_New() ) )
- {
- char buffer[200];
- snprintf( buffer, sizeof(buffer), "%s%s%s%s",
- p_avih->i_flags&AVIF_HASINDEX?" HAS_INDEX":"",
- p_avih->i_flags&AVIF_MUSTUSEINDEX?" MUST_USE_INDEX":"",
- p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
- p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
- vlc_meta_SetSetting( p_sys->meta, buffer );
- }
+
+ AVI_MetaLoad( p_demux, p_riff, p_avih );
/* now read info on each stream and create ES */
for( i = 0 ; i < i_track; i++ )
@@ -2496,6 +2490,54 @@ print_stat:
}
}
+/* */
+static void AVI_MetaLoad( demux_t *p_demux,
+ avi_chunk_list_t *p_riff, avi_chunk_avih_t *p_avih )
+{
+ demux_sys_t *p_sys = p_demux->p_sys;
+
+ vlc_meta_t *p_meta = p_sys->meta = vlc_meta_New();
+ if( !p_meta )
+ return;
+
+ char buffer[200];
+ snprintf( buffer, sizeof(buffer), "%s%s%s%s",
+ p_avih->i_flags&AVIF_HASINDEX ? " HAS_INDEX" : "",
+ p_avih->i_flags&AVIF_MUSTUSEINDEX ? " MUST_USE_INDEX" : "",
+ p_avih->i_flags&AVIF_ISINTERLEAVED ? " IS_INTERLEAVED" : "",
+ p_avih->i_flags&AVIF_TRUSTCKTYPE ? " TRUST_CKTYPE" : "" );
+ vlc_meta_SetSetting( p_meta, buffer );
+
+ avi_chunk_list_t *p_info = AVI_ChunkFind( p_riff, AVIFOURCC_INFO, 0 );
+ if( !p_info )
+ return;
+
+ static const struct {
+ vlc_fourcc_t i_id;
+ int i_type;
+ } p_dsc[] = {
+ { AVIFOURCC_IART, vlc_meta_Artist },
+ { AVIFOURCC_ICMT, vlc_meta_Description },
+ { AVIFOURCC_ICOP, vlc_meta_Copyright },
+ { AVIFOURCC_IGNR, vlc_meta_Genre },
+ { AVIFOURCC_INAM, vlc_meta_Title },
+ { 0, -1 }
+ };
+ for( int i = 0; p_dsc[i].i_id != 0; i++ )
+ {
+ avi_chunk_STRING_t *p_strz = AVI_ChunkFind( p_info, p_dsc[i].i_id, 0 );
+ if( !p_strz )
+ continue;
+ char *psz_value = FromLatin1( p_strz->p_str );
+ if( !psz_value )
+ continue;
+
+ if( *psz_value )
+ vlc_meta_Set( p_meta, p_dsc[i].i_type, psz_value );
+ free( psz_value );
+ }
+}
+
/*****************************************************************************
* Subtitles
*****************************************************************************/
More information about the vlc-devel
mailing list