Changeset ab0e83875c76e2a7ac258d0314908fd9bfb28c68
- 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
| rba433c8 |
rab0e838 |
|
| 29 | 29 | #include <vlc/vlc.h> |
|---|
| 30 | 30 | #include <vlc_demux.h> |
|---|
| 31 | | #include <vlc_meta.h> |
|---|
| 32 | 31 | #include <vlc_codec.h> |
|---|
| 33 | 32 | #include <vlc_input.h> |
|---|
| … | … | |
| 60 | 59 | { |
|---|
| 61 | 60 | es_out_id_t *p_es; |
|---|
| 62 | | vlc_meta_t *meta; |
|---|
| 63 | 61 | |
|---|
| 64 | 62 | vlc_bool_t b_start; |
|---|
| … | … | |
| 76 | 74 | int i_xing_frame_samples; |
|---|
| 77 | 75 | block_t *p_block_in, *p_block_out; |
|---|
| 78 | | |
|---|
| 79 | | int i_attachments; |
|---|
| 80 | | input_attachment_t **attachments; |
|---|
| 81 | 76 | }; |
|---|
| 82 | 77 | |
|---|
| … | … | |
| 126 | 121 | uint32_t header; |
|---|
| 127 | 122 | const uint8_t *p_peek; |
|---|
| 128 | | module_t *p_id3; |
|---|
| 129 | 123 | block_t *p_block_in, *p_block_out; |
|---|
| 130 | 124 | |
|---|
| … | … | |
| 159 | 153 | p_sys->p_es = 0; |
|---|
| 160 | 154 | p_sys->b_start = VLC_TRUE; |
|---|
| 161 | | p_sys->meta = 0; |
|---|
| 162 | 155 | |
|---|
| 163 | 156 | /* Load the mpeg audio packetizer */ |
|---|
| … | … | |
| 256 | 249 | p_sys->p_block_out = p_block_out; |
|---|
| 257 | 250 | |
|---|
| 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 | | } |
|---|
| 274 | 251 | /* */ |
|---|
| 275 | 252 | 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 ); |
|---|
| 278 | 253 | p_sys->p_es = es_out_Add( p_demux->out, |
|---|
| 279 | 254 | &p_sys->p_packetizer->fmt_out); |
|---|
| … | … | |
| 346 | 321 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 347 | 322 | |
|---|
| 348 | | var_Destroy( p_demux, "meta-preparsed" ); |
|---|
| 349 | | |
|---|
| 350 | 323 | DESTROY_PACKETIZER( p_sys->p_packetizer ); |
|---|
| 351 | | if( p_sys->meta ) vlc_meta_Delete( p_sys->meta ); |
|---|
| 352 | 324 | 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); |
|---|
| 358 | 325 | |
|---|
| 359 | 326 | free( p_sys ); |
|---|
| … | … | |
| 367 | 334 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 368 | 335 | int64_t *pi64; |
|---|
| 369 | | vlc_meta_t *p_meta; |
|---|
| | 336 | vlc_bool_t *pb_bool; |
|---|
| 370 | 337 | int i_ret; |
|---|
| 371 | 338 | |
|---|
| 372 | | input_attachment_t ***ppp_attach; |
|---|
| 373 | | int *pi_int, i; |
|---|
| 374 | | |
|---|
| 375 | 339 | switch( i_query ) |
|---|
| 376 | 340 | { |
|---|
| 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; |
|---|
| 394 | 344 | return VLC_SUCCESS; |
|---|
| 395 | 345 | |
|---|