Changeset 22d851e1d2c4aaf47a2f6ebf0de01b3a8e1d4cdd
- Timestamp:
- 25/01/03 17:58:35
(6 years ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1043513915 +0000
- git-parent:
[25eea88d8bddd72976a76ce8ecf979a4033abf1d]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1043513915 +0000
- Message:
- all : fixed some memory leaks thanks valgrind.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2f9b054 |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: demux.c,v 1.4 2003/01/20 13:03:03 fenrir Exp $ |
|---|
| | 5 | * $Id: demux.c,v 1.5 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 8 | | * |
|---|
| | 8 | * |
|---|
| 9 | 9 | * This program is free software; you can redistribute it and/or modify |
|---|
| 10 | 10 | * it under the terms of the GNU General Public License as published by |
|---|
| 11 | 11 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 12 | 12 | * (at your option) any later version. |
|---|
| 13 | | * |
|---|
| | 13 | * |
|---|
| 14 | 14 | * This program is distributed in the hope that it will be useful, |
|---|
| 15 | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| … | … | |
| 36 | 36 | * Local prototypes |
|---|
| 37 | 37 | *****************************************************************************/ |
|---|
| 38 | | static int Activate ( vlc_object_t * ); |
|---|
| 39 | | static int Demux ( input_thread_t * ); |
|---|
| 40 | | |
|---|
| | 38 | static int Activate ( vlc_object_t * ); |
|---|
| | 39 | static int Demux ( input_thread_t * ); |
|---|
| | 40 | static void Deactivate ( vlc_object_t * ); |
|---|
| 41 | 41 | |
|---|
| 42 | 42 | /***************************************************************************** |
|---|
| … | … | |
| 51 | 51 | |
|---|
| 52 | 52 | /***************************************************************************** |
|---|
| 53 | | * Definitions of structures and functions used by this plugins |
|---|
| 54 | | *****************************************************************************/ |
|---|
| 55 | | |
|---|
| | 53 | * Definitions of structures and functions used by this plugins |
|---|
| | 54 | *****************************************************************************/ |
|---|
| | 55 | #define FREE( p ) if( p ) { free( p ); (p) = NULL; } |
|---|
| 56 | 56 | /* XXX set this to 0 to avoid problem with PS XXX */ |
|---|
| 57 | 57 | /* but with some file or web radio will failed to detect */ |
|---|
| … | … | |
| 85 | 85 | int i_no_raw_data_blocks_in_frame; |
|---|
| 86 | 86 | int i_crc_check; |
|---|
| 87 | | |
|---|
| | 87 | |
|---|
| 88 | 88 | } adts_header_t; |
|---|
| 89 | 89 | |
|---|
| … | … | |
| 91 | 91 | typedef struct adif_header_s |
|---|
| 92 | 92 | { |
|---|
| 93 | | int b_copyright_id_present; |
|---|
| 94 | | u8 i_copyright_id[10]; |
|---|
| 95 | | |
|---|
| 96 | | int b_original_copy; |
|---|
| 97 | | |
|---|
| 98 | | int i_home; |
|---|
| 99 | | int i_bitstream_type; |
|---|
| 100 | | int i_bitrate; |
|---|
| 101 | | int i_num_program_config_elements; |
|---|
| 102 | | int adif_buffer_fullness; |
|---|
| | 93 | int b_copyright_id_present; |
|---|
| | 94 | uint8_t i_copyright_id[10]; |
|---|
| | 95 | |
|---|
| | 96 | int b_original_copy; |
|---|
| | 97 | |
|---|
| | 98 | int i_home; |
|---|
| | 99 | int i_bitstream_type; |
|---|
| | 100 | int i_bitrate; |
|---|
| | 101 | int i_num_program_config_elements; |
|---|
| | 102 | int adif_buffer_fullness; |
|---|
| 103 | 103 | |
|---|
| 104 | 104 | // program_config_element |
|---|
| … | … | |
| 132 | 132 | **************************************************************************** |
|---|
| 133 | 133 | * |
|---|
| 134 | | ****************************************************************************/ |
|---|
| | 134 | ****************************************************************************/ |
|---|
| 135 | 135 | typedef struct bit_s |
|---|
| 136 | 136 | { |
|---|
| 137 | | u8 *p_buffer; |
|---|
| | 137 | uint8_t *p_buffer; |
|---|
| 138 | 138 | int i_buffer; |
|---|
| 139 | 139 | int i_mask; |
|---|
| … | … | |
| 141 | 141 | |
|---|
| 142 | 142 | static void bit_init( bit_t *p_bit, |
|---|
| 143 | | u8 *p_buffer, |
|---|
| | 143 | uint8_t *p_buffer, |
|---|
| 144 | 144 | int i_buffer ) |
|---|
| 145 | 145 | { |
|---|
| … | … | |
| 149 | 149 | } |
|---|
| 150 | 150 | |
|---|
| 151 | | static u32 bit_get( bit_t *p_bit ) |
|---|
| 152 | | { |
|---|
| 153 | | u32 i_bit; |
|---|
| | 151 | static uint32_t bit_get( bit_t *p_bit ) |
|---|
| | 152 | { |
|---|
| | 153 | uint32_t i_bit; |
|---|
| 154 | 154 | if( p_bit->i_buffer <= 0 ) |
|---|
| 155 | 155 | { |
|---|
| … | … | |
| 157 | 157 | } |
|---|
| 158 | 158 | i_bit = ( p_bit->p_buffer[0]&p_bit->i_mask ) ? 1 : 0; |
|---|
| 159 | | |
|---|
| | 159 | |
|---|
| 160 | 160 | p_bit->i_mask >>= 1; |
|---|
| 161 | 161 | if( !p_bit->i_mask ) |
|---|
| … | … | |
| 168 | 168 | } |
|---|
| 169 | 169 | |
|---|
| 170 | | static u32 bit_gets( bit_t *p_bit, int i_count ) |
|---|
| 171 | | { |
|---|
| 172 | | u32 i_bits; |
|---|
| | 170 | static uint32_t bit_gets( bit_t *p_bit, int i_count ) |
|---|
| | 171 | { |
|---|
| | 172 | uint32_t i_bits; |
|---|
| 173 | 173 | i_bits = 0; |
|---|
| 174 | 174 | for( ; i_count > 0; i_count-- ) |
|---|
| … | … | |
| 186 | 186 | * |
|---|
| 187 | 187 | * ReadPes : read data and make a PES |
|---|
| 188 | | * |
|---|
| | 188 | * |
|---|
| 189 | 189 | *****************************************************************************/ |
|---|
| 190 | 190 | static int SkipBytes( input_thread_t *p_input, int i_size ) |
|---|
| … | … | |
| 206 | 206 | } |
|---|
| 207 | 207 | |
|---|
| 208 | | static int ReadPES( input_thread_t *p_input, |
|---|
| 209 | | pes_packet_t **pp_pes, |
|---|
| | 208 | static int ReadPES( input_thread_t *p_input, |
|---|
| | 209 | pes_packet_t **pp_pes, |
|---|
| 210 | 210 | int i_size ) |
|---|
| 211 | 211 | { |
|---|
| … | … | |
| 213 | 213 | |
|---|
| 214 | 214 | *pp_pes = NULL; |
|---|
| 215 | | |
|---|
| | 215 | |
|---|
| 216 | 216 | if( !(p_pes = input_NewPES( p_input->p_method_data )) ) |
|---|
| 217 | 217 | { |
|---|
| … | … | |
| 225 | 225 | int i_read; |
|---|
| 226 | 226 | |
|---|
| 227 | | if( (i_read = input_SplitBuffer( p_input, |
|---|
| 228 | | &p_data, |
|---|
| | 227 | if( (i_read = input_SplitBuffer( p_input, |
|---|
| | 228 | &p_data, |
|---|
| 229 | 229 | __MIN( i_size, 1024 ) ) ) <= 0 ) |
|---|
| 230 | 230 | { |
|---|
| … | … | |
| 257 | 257 | adif_header_t *p_adif ) |
|---|
| 258 | 258 | { |
|---|
| 259 | | u8 *p_peek; |
|---|
| | 259 | uint8_t *p_peek; |
|---|
| 260 | 260 | int i_size; |
|---|
| 261 | 261 | |
|---|
| … | … | |
| 270 | 270 | return( 0 ); |
|---|
| 271 | 271 | } |
|---|
| 272 | | |
|---|
| | 272 | |
|---|
| 273 | 273 | /* we now that we have an adif header */ |
|---|
| 274 | | |
|---|
| | 274 | |
|---|
| 275 | 275 | // return( 1 ); |
|---|
| 276 | 276 | return( 0 ); /* need some work */ |
|---|
| … | … | |
| 286 | 286 | int *pi_skip ) |
|---|
| 287 | 287 | { |
|---|
| 288 | | u8 *p_peek; |
|---|
| | 288 | uint8_t *p_peek; |
|---|
| 289 | 289 | int i_size; |
|---|
| 290 | 290 | bit_t bit; |
|---|
| … | … | |
| 316 | 316 | bit_init( &bit, p_peek, i_size ); |
|---|
| 317 | 317 | bit_gets( &bit, 12 ); /* synchro bits */ |
|---|
| 318 | | |
|---|
| | 318 | |
|---|
| 319 | 319 | p_adts->i_id = bit_get( &bit ); |
|---|
| 320 | 320 | p_adts->i_layer = bit_gets( &bit, 2); |
|---|
| … | … | |
| 355 | 355 | p_aac->i_object_type = p_aac->adts_header.i_profile; |
|---|
| 356 | 356 | p_aac->i_samplerate = i_aac_samplerate[p_aac->i_samplerate_index]; |
|---|
| 357 | | p_aac->i_channels = p_aac->adts_header.i_channel_configuration; |
|---|
| | 357 | p_aac->i_channels = p_aac->adts_header.i_channel_configuration; |
|---|
| 358 | 358 | if( p_aac->i_channels > 6 ) |
|---|
| 359 | 359 | { |
|---|
| … | … | |
| 382 | 382 | static int CheckPS( input_thread_t *p_input ) |
|---|
| 383 | 383 | { |
|---|
| 384 | | u8 *p_peek; |
|---|
| | 384 | uint8_t *p_peek; |
|---|
| 385 | 385 | int i_size = input_Peek( p_input, &p_peek, 8196 ); |
|---|
| 386 | 386 | |
|---|
| … | … | |
| 407 | 407 | input_info_category_t * p_category; |
|---|
| 408 | 408 | module_t * p_id3; |
|---|
| 409 | | |
|---|
| | 409 | |
|---|
| 410 | 410 | int i_skip; |
|---|
| 411 | 411 | int b_forced; |
|---|
| … | … | |
| 423 | 423 | b_forced = ( ( *p_input->psz_demux )&& |
|---|
| 424 | 424 | ( !strncmp( p_input->psz_demux, "aac", 10 ) ) ) ? 1 : 0; |
|---|
| 425 | | |
|---|
| | 425 | |
|---|
| 426 | 426 | /* check if it can be a ps stream */ |
|---|
| 427 | 427 | if( !b_forced && CheckPS( p_input ) ) |
|---|
| … | … | |
| 430 | 430 | } |
|---|
| 431 | 431 | |
|---|
| 432 | | /* skip possible id3 header */ |
|---|
| | 432 | /* skip possible id3 header */ |
|---|
| 433 | 433 | p_id3 = module_Need( p_input, "id3", NULL ); |
|---|
| 434 | 434 | if ( p_id3 ) { |
|---|
| 435 | 435 | module_Unneed( p_input, p_id3 ); |
|---|
| 436 | 436 | } |
|---|
| 437 | | |
|---|
| | 437 | |
|---|
| 438 | 438 | /* allocate p_aac */ |
|---|
| 439 | 439 | if( !( p_aac = malloc( sizeof( demux_sys_t ) ) ) ) |
|---|
| … | … | |
| 443 | 443 | } |
|---|
| 444 | 444 | memset( p_aac, 0, sizeof( demux_sys_t ) ); |
|---|
| 445 | | |
|---|
| | 445 | |
|---|
| 446 | 446 | /* Now check for adif/adts header */ |
|---|
| 447 | 447 | i_skip = 0; |
|---|
| … | … | |
| 455 | 455 | } |
|---|
| 456 | 456 | else |
|---|
| 457 | | if( GetADTS( p_input, |
|---|
| 458 | | &p_aac->adts_header, |
|---|
| | 457 | if( GetADTS( p_input, |
|---|
| | 458 | &p_aac->adts_header, |
|---|
| 459 | 459 | b_forced ? 8000 : 0, |
|---|
| 460 | 460 | &i_skip ) ) |
|---|
| … | … | |
| 479 | 479 | msg_Err( p_input, "cannot init stream" ); |
|---|
| 480 | 480 | return( -1 ); |
|---|
| 481 | | } |
|---|
| | 481 | } |
|---|
| 482 | 482 | if( input_AddProgram( p_input, 0, 0) == NULL ) |
|---|
| 483 | 483 | { |
|---|
| … | … | |
| 488 | 488 | p_input->stream.pp_programs[0]->b_is_ok = 0; |
|---|
| 489 | 489 | p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; |
|---|
| 490 | | |
|---|
| 491 | | /* create our ES */ |
|---|
| 492 | | p_aac->p_es = input_AddES( p_input, |
|---|
| | 490 | |
|---|
| | 491 | /* create our ES */ |
|---|
| | 492 | p_aac->p_es = input_AddES( p_input, |
|---|
| 493 | 493 | p_input->stream.p_selected_program, |
|---|
| 494 | 494 | 1, /* id */ |
|---|
| … | … | |
| 500 | 500 | return( -1 ); |
|---|
| 501 | 501 | } |
|---|
| 502 | | |
|---|
| | 502 | |
|---|
| 503 | 503 | p_aac->p_es->i_stream_id = 1; |
|---|
| 504 | 504 | p_aac->p_es->i_fourcc = VLC_FOURCC( 'm', 'p', '4', 'a' ); |
|---|
| … | … | |
| 510 | 510 | |
|---|
| 511 | 511 | |
|---|
| 512 | | |
|---|
| | 512 | |
|---|
| 513 | 513 | vlc_mutex_lock( &p_input->stream.stream_lock ); |
|---|
| 514 | 514 | if( p_aac->b_adif_header ) |
|---|
| … | … | |
| 548 | 548 | vlc_mutex_lock( &p_input->stream.stream_lock ); |
|---|
| 549 | 549 | p_category = input_InfoCategory( p_input, "aac" ); |
|---|
| 550 | | |
|---|
| | 550 | |
|---|
| 551 | 551 | input_AddInfo( p_category, "input type", "MPEG-%d AAC", |
|---|
| 552 | 552 | p_aac->adts_header.i_id == 1 ? 2 : 4 ); |
|---|
| … | … | |
| 563 | 563 | |
|---|
| 564 | 564 | p_input->p_demux_data = p_aac; |
|---|
| 565 | | |
|---|
| | 565 | |
|---|
| 566 | 566 | |
|---|
| 567 | 567 | return( 0 ); |
|---|
| … | … | |
| 577 | 577 | int i_skip; |
|---|
| 578 | 578 | int i_found; |
|---|
| 579 | | |
|---|
| | 579 | |
|---|
| 580 | 580 | pes_packet_t *p_pes; |
|---|
| 581 | 581 | demux_sys_t *p_aac = p_input->p_demux_data; |
|---|
| … | … | |
| 590 | 590 | if( p_aac->b_adts_header ) |
|---|
| 591 | 591 | { |
|---|
| 592 | | i_found = GetADTS( p_input, |
|---|
| | 592 | i_found = GetADTS( p_input, |
|---|
| 593 | 593 | &p_aac->adts_header, |
|---|
| 594 | 594 | 8000, |
|---|
| … | … | |
| 600 | 600 | } |
|---|
| 601 | 601 | ExtractConfiguration( p_aac ); |
|---|
| 602 | | |
|---|
| | 602 | |
|---|
| 603 | 603 | /* skip garbage bytes */ |
|---|
| 604 | 604 | if( i_skip > 0 ) |
|---|
| … | … | |
| 615 | 615 | return( 0 ); |
|---|
| 616 | 616 | } |
|---|
| 617 | | |
|---|
| | 617 | |
|---|
| 618 | 618 | input_ClockManageRef( p_input, |
|---|
| 619 | 619 | p_input->stream.p_selected_program, |
|---|
| 620 | 620 | p_aac->i_pts ); |
|---|
| 621 | | |
|---|
| | 621 | |
|---|
| 622 | 622 | if( !ReadPES( p_input, &p_pes, p_aac->i_aac_frame_length ) ) |
|---|
| 623 | 623 | { |
|---|
| … | … | |
| 643 | 643 | |
|---|
| 644 | 644 | /* Update date information */ |
|---|
| 645 | | p_aac->i_pts += (mtime_t)90000 * |
|---|
| | 645 | p_aac->i_pts += (mtime_t)90000 * |
|---|
| 646 | 646 | (mtime_t)p_aac->i_framelength / |
|---|
| 647 | 647 | (mtime_t)p_aac->i_samplerate; |
|---|
| … | … | |
| 650 | 650 | } |
|---|
| 651 | 651 | |
|---|
| | 652 | static void Deactivate( vlc_object_t * p_this ) |
|---|
| | 653 | { |
|---|
| | 654 | input_thread_t *p_input = (input_thread_t*)p_this; |
|---|
| | 655 | // demux_sys_t *p_aac = p_input->p_demux_data; |
|---|
| | 656 | |
|---|
| | 657 | FREE( p_input->p_demux_data ); |
|---|
| | 658 | } |
|---|
| | 659 | |
|---|
| r27ebd5c |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: asf.c,v 1.17 2003/01/23 15:07:20 fenrir Exp $ |
|---|
| | 5 | * $Id: asf.c,v 1.18 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 859 | 859 | #undef p_stream |
|---|
| 860 | 860 | } |
|---|
| 861 | | |
|---|
| | 861 | FREE( p_input->p_demux_data ); |
|---|
| 862 | 862 | #undef FREE |
|---|
| 863 | 863 | } |
|---|
| r8a517cb |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: avi.c,v 1.30 2003/01/25 03:12:20 fenrir Exp $ |
|---|
| | 5 | * $Id: avi.c,v 1.31 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 53 | 53 | |
|---|
| 54 | 54 | #define AVIEnd(a) __AVIEnd(VLC_OBJECT(a)) |
|---|
| 55 | | |
|---|
| | 55 | #define FREE( p ) if( p ) { free( p ); (p) = NULL; } |
|---|
| 56 | 56 | /***************************************************************************** |
|---|
| 57 | 57 | * Module descriptor |
|---|
| … | … | |
| 794 | 794 | #endif |
|---|
| 795 | 795 | AVI_ChunkFreeRoot( p_input, &p_avi->ck_root ); |
|---|
| | 796 | |
|---|
| | 797 | FREE( p_input->p_demux_data ); |
|---|
| 796 | 798 | } |
|---|
| 797 | 799 | |
|---|
| r9a5b0b8 |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: libavi.c,v 1.14 2003/01/20 13:01:53 fenrir Exp $ |
|---|
| | 5 | * $Id: libavi.c,v 1.15 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 521 | 521 | { |
|---|
| 522 | 522 | case( AVIFOURCC_auds ): |
|---|
| | 523 | p_chk->strf.auds.i_cat = AUDIO_ES; |
|---|
| 523 | 524 | p_chk->strf.auds.p_wf = malloc( p_chk->common.i_chunk_size ); |
|---|
| 524 | 525 | AVI_READ2BYTES( p_chk->strf.auds.p_wf->wFormatTag ); |
|---|
| … | … | |
| 562 | 563 | case( AVIFOURCC_vids ): |
|---|
| 563 | 564 | p_strh->strh.i_samplesize = 0; // XXX for ffmpeg avi file |
|---|
| | 565 | p_chk->strf.vids.i_cat = VIDEO_ES; |
|---|
| 564 | 566 | p_chk->strf.vids.p_bih = malloc( p_chk->common.i_chunk_size ); |
|---|
| 565 | 567 | AVI_READ4BYTES( p_chk->strf.vids.p_bih->biSize ); |
|---|
| … | … | |
| 598 | 600 | default: |
|---|
| 599 | 601 | msg_Warn( p_input, "unknown stream type" ); |
|---|
| | 602 | p_chk->strf.common.i_cat = UNKNOWN_ES; |
|---|
| 600 | 603 | break; |
|---|
| 601 | 604 | } |
|---|
| … | … | |
| 605 | 608 | avi_chunk_t *p_chk ) |
|---|
| 606 | 609 | { |
|---|
| 607 | | |
|---|
| | 610 | avi_chunk_strf_t *p_strf = (avi_chunk_strf_t*)p_chk; |
|---|
| | 611 | switch( p_strf->common.i_cat ) |
|---|
| | 612 | { |
|---|
| | 613 | case AUDIO_ES: |
|---|
| | 614 | FREE( p_strf->auds.p_wf ); |
|---|
| | 615 | break; |
|---|
| | 616 | case VIDEO_ES: |
|---|
| | 617 | FREE( p_strf->vids.p_bih ); |
|---|
| | 618 | break; |
|---|
| | 619 | default: |
|---|
| | 620 | break; |
|---|
| | 621 | } |
|---|
| 608 | 622 | } |
|---|
| 609 | 623 | |
|---|
| rade615b |
r22d851e |
|
| 3 | 3 | ****************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: libavi.h,v 1.6 2002/12/06 16:34:06 sam Exp $ |
|---|
| | 5 | * $Id: libavi.h,v 1.7 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 238 | 238 | { |
|---|
| 239 | 239 | AVI_CHUNK_COMMON |
|---|
| | 240 | int i_cat; |
|---|
| 240 | 241 | WAVEFORMATEX *p_wf; |
|---|
| 241 | 242 | } avi_chunk_strf_auds_t; |
|---|
| … | … | |
| 244 | 245 | { |
|---|
| 245 | 246 | AVI_CHUNK_COMMON |
|---|
| | 247 | int i_cat; |
|---|
| 246 | 248 | BITMAPINFOHEADER *p_bih; |
|---|
| 247 | 249 | } avi_chunk_strf_vids_t; |
|---|
| … | … | |
| 251 | 253 | avi_chunk_strf_auds_t auds; |
|---|
| 252 | 254 | avi_chunk_strf_vids_t vids; |
|---|
| | 255 | struct |
|---|
| | 256 | { |
|---|
| | 257 | AVI_CHUNK_COMMON |
|---|
| | 258 | int i_cat; |
|---|
| | 259 | } common; |
|---|
| 253 | 260 | } avi_chunk_strf_t; |
|---|
| 254 | 261 | |
|---|
| rf22f4ef |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: demuxdump.c,v 1.2 2002/12/18 14:17:10 sam Exp $ |
|---|
| | 5 | * $Id: demuxdump.c,v 1.3 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| … | … | |
| 114 | 114 | p_demux->psz_name = psz_name; |
|---|
| 115 | 115 | } |
|---|
| 116 | | |
|---|
| | 116 | |
|---|
| 117 | 117 | p_demux->i_write = 0; |
|---|
| 118 | 118 | p_demux->p_demux_data_sav = p_input->p_demux_data; |
|---|
| … | … | |
| 125 | 125 | else |
|---|
| 126 | 126 | { |
|---|
| 127 | | |
|---|
| | 127 | |
|---|
| 128 | 128 | if( input_InitStream( p_input, 0 ) == -1 ) |
|---|
| 129 | 129 | { |
|---|
| … | … | |
| 134 | 134 | input_AddProgram( p_input, 0, 0 ); |
|---|
| 135 | 135 | p_input->stream.p_selected_program = p_input->stream.pp_programs[0]; |
|---|
| 136 | | |
|---|
| | 136 | |
|---|
| 137 | 137 | vlc_mutex_lock( &p_input->stream.stream_lock ); |
|---|
| 138 | 138 | p_input->stream.p_selected_area->i_tell = 0; |
|---|
| … | … | |
| 156 | 156 | input_thread_t *p_input = (input_thread_t *)p_this; |
|---|
| 157 | 157 | demux_sys_t *p_demux = (demux_sys_t*)p_input->p_demux_data; |
|---|
| 158 | | |
|---|
| 159 | | msg_Info( p_input, |
|---|
| 160 | | "closing %s ("I64Fd" Kbytes dumped)", |
|---|
| | 158 | |
|---|
| | 159 | msg_Info( p_input, |
|---|
| | 160 | "closing %s ("I64Fd" Kbytes dumped)", |
|---|
| 161 | 161 | p_demux->psz_name, |
|---|
| 162 | 162 | p_demux->i_write / 1024 ); |
|---|
| 163 | | |
|---|
| | 163 | |
|---|
| 164 | 164 | if( p_demux->p_file ) |
|---|
| 165 | 165 | { |
|---|
| … | … | |
| 169 | 169 | if( p_demux->psz_name ) |
|---|
| 170 | 170 | { |
|---|
| 171 | | free( p_demux->psz_name ); |
|---|
| | 171 | free( p_demux->psz_name ); |
|---|
| 172 | 172 | } |
|---|
| 173 | 173 | p_input->p_demux_data = p_demux->p_demux_data_sav; |
|---|
| r4f21763 |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: libmp4.c,v 1.12 2003/01/13 02:30:11 fenrir Exp $ |
|---|
| | 5 | * $Id: libmp4.c,v 1.13 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | | * |
|---|
| | 7 | * |
|---|
| 8 | 8 | * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | 9 | * it under the terms of the GNU General Public License as published by |
|---|
| 10 | 10 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | 11 | * (at your option) any later version. |
|---|
| 12 | | * |
|---|
| | 12 | * |
|---|
| 13 | 13 | * This program is distributed in the hope that it will be useful, |
|---|
| 14 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| … | … | |
| 36 | 36 | |
|---|
| 37 | 37 | /***************************************************************************** |
|---|
| 38 | | * Here are defined some macro to make life simpler but before using it |
|---|
| 39 | | * *look* at the code. |
|---|
| | 38 | * Here are defined some macro to make life simpler but before using it |
|---|
| | 39 | * *look* at the code. |
|---|
| 40 | 40 | * |
|---|
| 41 | 41 | * XXX: All macro are written in capital letters |
|---|
| … | … | |
| 45 | 45 | ( 8 + ( p_box->i_shortsize == 1 ? 8 : 0 ) \ |
|---|
| 46 | 46 | + ( p_box->i_type == FOURCC_uuid ? 16 : 0 ) ) |
|---|
| 47 | | |
|---|
| | 47 | |
|---|
| 48 | 48 | #define MP4_BOX_DESCEND( p_box ) \ |
|---|
| 49 | 49 | MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) ) |
|---|
| … | … | |
| 60 | 60 | #define MP4_GET4BYTES( dst ) \ |
|---|
| 61 | 61 | dst = GetDWBE( p_peek ); p_peek += 4; i_read -= 4 |
|---|
| 62 | | |
|---|
| | 62 | |
|---|
| 63 | 63 | #define MP4_GETFOURCC( dst ) \ |
|---|
| 64 | 64 | dst = VLC_FOURCC( p_peek[0], p_peek[1], p_peek[2], p_peek[3] ); \ |
|---|
| … | … | |
| 67 | 67 | #define MP4_GET8BYTES( dst ) \ |
|---|
| 68 | 68 | dst = GetQWBE( p_peek ); p_peek += 8; i_read -= 8 |
|---|
| 69 | | |
|---|
| | 69 | |
|---|
| 70 | 70 | #define MP4_GETVERSIONFLAGS( p_void ) \ |
|---|
| 71 | 71 | MP4_GET1BYTE( p_void->i_version ); \ |
|---|
| 72 | 72 | MP4_GET3BYTES( p_void->i_flags ) |
|---|
| 73 | | |
|---|
| | 73 | |
|---|
| 74 | 74 | #define MP4_GETSTRINGZ( p_str ) \ |
|---|
| 75 | 75 | if( ( i_read > 0 )&&(p_peek[0] ) ) \ |
|---|
| … | … | |
| 85 | 85 | p_str = NULL; \ |
|---|
| 86 | 86 | } |
|---|
| 87 | | |
|---|
| | 87 | |
|---|
| 88 | 88 | |
|---|
| 89 | 89 | #define MP4_READBOX_ENTER( MP4_Box_data_TYPE_t ) \ |
|---|
| … | … | |
| 106 | 106 | free( p_buff ); \ |
|---|
| 107 | 107 | return( 0 ); \ |
|---|
| 108 | | } |
|---|
| 109 | | |
|---|
| | 108 | } |
|---|
| | 109 | |
|---|
| 110 | 110 | #define MP4_READBOX_EXIT( i_code ) \ |
|---|
| 111 | 111 | free( p_buff ); \ |
|---|
| … | … | |
| 118 | 118 | #define FREE( p ) \ |
|---|
| 119 | 119 | if( p ) {free( p ); p = NULL; } |
|---|
| 120 | | |
|---|
| 121 | | |
|---|
| 122 | | |
|---|
| | 120 | |
|---|
| | 121 | |
|---|
| | 122 | |
|---|
| 123 | 123 | /* Some assumptions: |
|---|
| 124 | | * The input method HAVE to be seekable |
|---|
| 125 | | |
|---|
| | 124 | * The input method HAVE to be seekable |
|---|
| | 125 | |
|---|
| 126 | 126 | */ |
|---|
| 127 | 127 | |
|---|
| … | … | |
| 188 | 188 | i_min = ( i_date / 60 ) % 60; |
|---|
| 189 | 189 | i_sec = i_date % 60; |
|---|
| 190 | | /* FIXME do it correctly, date begin at 1 jan 1904 */ |
|---|
| | 190 | /* FIXME do it correctly, date begin at 1 jan 1904 */ |
|---|
| 191 | 191 | sprintf( psz, "%dd-%2.2dh:%2.2dm:%2.2ds", |
|---|
| 192 | 192 | i_day, i_hour, i_min, i_sec ); |
|---|
| … | … | |
| 199 | 199 | * |
|---|
| 200 | 200 | * MP4_TellAbsolute get file position |
|---|
| 201 | | * |
|---|
| | 201 | * |
|---|
| 202 | 202 | * MP4_SeekAbsolute seek in the file |
|---|
| 203 | 203 | * |
|---|
| … | … | |
| 208 | 208 | { |
|---|
| 209 | 209 | off_t i_pos; |
|---|
| 210 | | |
|---|
| | 210 | |
|---|
| 211 | 211 | vlc_mutex_lock( &p_input->stream.stream_lock ); |
|---|
| 212 | | |
|---|
| | 212 | |
|---|
| 213 | 213 | i_pos= p_input->stream.p_selected_area->i_tell; |
|---|
| 214 | 214 | // ( p_input->p_last_data - p_input->p_current_data ); |
|---|
| … | … | |
| 218 | 218 | return( i_pos ); |
|---|
| 219 | 219 | } |
|---|
| 220 | | |
|---|
| | 220 | |
|---|
| 221 | 221 | int MP4_SeekAbsolute( input_thread_t *p_input, |
|---|
| 222 | 222 | off_t i_pos) |
|---|
| … | … | |
| 228 | 228 | return( 0 ); |
|---|
| 229 | 229 | } |
|---|
| 230 | | |
|---|
| | 230 | |
|---|
| 231 | 231 | i_filepos = MP4_TellAbsolute( p_input ); |
|---|
| 232 | 232 | if( i_pos != i_filepos ) |
|---|
| … | … | |
| 245 | 245 | int i_read; |
|---|
| 246 | 246 | |
|---|
| 247 | | |
|---|
| | 247 | |
|---|
| 248 | 248 | if( !i_size ) |
|---|
| 249 | 249 | { |
|---|
| … | … | |
| 260 | 260 | memcpy( p_buff, p_data->p_payload_start, i_read ); |
|---|
| 261 | 261 | input_DeletePacket( p_input->p_method_data, p_data ); |
|---|
| 262 | | |
|---|
| | 262 | |
|---|
| 263 | 263 | p_buff += i_read; |
|---|
| 264 | 264 | i_size -= i_read; |
|---|
| 265 | | |
|---|
| | 265 | |
|---|
| 266 | 266 | } while( i_size ); |
|---|
| 267 | | |
|---|
| | 267 | |
|---|
| 268 | 268 | return( 1 ); |
|---|
| 269 | 269 | } |
|---|
| … | … | |
| 417 | 417 | |
|---|
| 418 | 418 | /***************************************************************************** |
|---|
| 419 | | * MP4_ReadBoxCommon : Load only common parameters for all boxes |
|---|
| | 419 | * MP4_ReadBoxCommon : Load only common parameters for all boxes |
|---|
| 420 | 420 | ***************************************************************************** |
|---|
| 421 | | * p_box need to be an already allocated MP4_Box_t, and all data |
|---|
| | 421 | * p_box need to be an already allocated MP4_Box_t, and all data |
|---|
| 422 | 422 | * will only be peek not read |
|---|
| 423 | 423 | * |
|---|
| … | … | |
| 428 | 428 | int i_read; |
|---|
| 429 | 429 | uint8_t *p_peek; |
|---|
| 430 | | |
|---|
| | 430 | |
|---|
| 431 | 431 | if( ( ( i_read = MP4_PeekStream( p_stream, &p_peek, 32 ) ) < 8 ) ) |
|---|
| 432 | 432 | { |
|---|
| … | … | |
| 440 | 440 | p_box->p_last = NULL; |
|---|
| 441 | 441 | p_box->p_next = NULL; |
|---|
| 442 | | |
|---|
| | 442 | |
|---|
| 443 | 443 | MP4_GET4BYTES( p_box->i_shortsize ); |
|---|
| 444 | 444 | MP4_GETFOURCC( p_box->i_type ); |
|---|
| … | … | |
| 456 | 456 | /* XXX size of 0 means that the box extends to end of file */ |
|---|
| 457 | 457 | } |
|---|
| 458 | | |
|---|
| | 458 | |
|---|
| 459 | 459 | if( p_box->i_type == FOURCC_uuid ) |
|---|
| 460 | 460 | { |
|---|
| … | … | |
| 514 | 514 | } |
|---|
| 515 | 515 | /***************************************************************************** |
|---|
| 516 | | * MP4_MP4_GotoBox : Go to this particular box |
|---|
| | 516 | * MP4_MP4_GotoBox : Go to this particular box |
|---|
| 517 | 517 | ***************************************************************************** |
|---|
| 518 | 518 | * RETURN : 0 if it fail, 1 otherwise |
|---|
| … | … | |
| 525 | 525 | |
|---|
| 526 | 526 | /***************************************************************************** |
|---|
| 527 | | * For all known box a loader is given, |
|---|
| | 527 | * For all known box a loader is given, |
|---|
| 528 | 528 | * XXX: all common struct have to be already read by MP4_ReadBoxCommon |
|---|
| 529 | 529 | * after called one of theses functions, file position is unknown |
|---|
| 530 | | * you need to call MP4_GotoBox to go where you want |
|---|
| | 530 | * you need to call MP4_GotoBox to go where you want |
|---|
| 531 | 531 | *****************************************************************************/ |
|---|
| 532 | 532 | int MP4_ReadBoxContainerRaw( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) |
|---|
| 533 | 533 | { |
|---|
| 534 | 534 | MP4_Box_t *p_box; |
|---|
| 535 | | |
|---|
| | 535 | |
|---|
| 536 | 536 | if( MP4_TellStream( p_stream ) + 8 > |
|---|
| 537 | 537 | (off_t)(p_container->i_pos + p_container->i_size) ) |
|---|
| … | … | |
| 540 | 540 | return( 0 ); |
|---|
| 541 | 541 | } |
|---|
| 542 | | |
|---|
| | 542 | |
|---|
| 543 | 543 | do |
|---|
| 544 | 544 | { |
|---|
| … | … | |
| 564 | 564 | break; |
|---|
| 565 | 565 | } |
|---|
| 566 | | |
|---|
| | 566 | |
|---|
| 567 | 567 | }while( MP4_NextBox( p_stream, p_box ) == 1 ); |
|---|
| 568 | | |
|---|
| | 568 | |
|---|
| 569 | 569 | return( 1 ); |
|---|
| 570 | 570 | } |
|---|
| … | … | |
| 573 | 573 | int MP4_ReadBoxContainer( MP4_Stream_t *p_stream, MP4_Box_t *p_container ) |
|---|
| 574 | 574 | { |
|---|
| 575 | | |
|---|
| | 575 | |
|---|
| 576 | 576 | if( p_container->i_size <= (size_t)MP4_BOX_HEADERSIZE(p_container ) + 8 ) |
|---|
| 577 | 577 | { |
|---|
| … | … | |
| 579 | 579 | return( 1 ); |
|---|
| 580 | 580 | } |
|---|
| 581 | | |
|---|
| | 581 | |
|---|
| 582 | 582 | /* enter box */ |
|---|
| 583 | 583 | MP4_BOX_DESCEND( p_container ); |
|---|
| … | … | |
| 595 | 595 | /* Nothing to do */ |
|---|
| 596 | 596 | #ifdef MP4_VERBOSE |
|---|
| 597 | | msg_Dbg( p_stream->p_input, "Skip box: \"%c%c%c%c\"", |
|---|
| | 597 | msg_Dbg( p_stream->p_input, "Skip box: \"%c%c%c%c\"", |
|---|
| 598 | 598 | (p_box->i_type)&0xff, |
|---|
| 599 | 599 | (p_box->i_type>>8)&0xff, |
|---|
| … | … | |
| 607 | 607 | { |
|---|
| 608 | 608 | MP4_READBOX_ENTER( MP4_Box_data_ftyp_t ); |
|---|
| 609 | | |
|---|
| | 609 | |
|---|
| 610 | 610 | MP4_GETFOURCC( p_box->data.p_ftyp->i_major_brand ); |
|---|
| 611 | 611 | MP4_GET4BYTES( p_box->data.p_ftyp->i_minor_version ); |
|---|
| 612 | | |
|---|
| | 612 | |
|---|
| 613 | 613 | if( ( p_box->data.p_ftyp->i_compatible_brands_count = i_read / 4 ) ) |
|---|
| 614 | 614 | { |
|---|
| 615 | 615 | unsigned int i; |
|---|
| 616 | | p_box->data.p_ftyp->i_compatible_brands = |
|---|
| | 616 | p_box->data.p_ftyp->i_compatible_brands = |
|---|
| 617 | 617 | calloc( p_box->data.p_ftyp->i_compatible_brands_count, sizeof(uint32_t)); |
|---|
| 618 | 618 | |
|---|
| … | … | |
| 1169 | 1169 | MP4_READBOX_EXIT( 1 ); |
|---|
| 1170 | 1170 | } |
|---|
| 1171 | | |
|---|
| | 1171 | |
|---|
| 1172 | 1172 | i_len = MP4_ReadLengthDescriptor( &p_peek, &i_read ); |
|---|
| 1173 | 1173 | es_descriptor.p_decConfigDescr->i_decoder_specific_info_len = i_len; |
|---|
| … | … | |
| 1184 | 1184 | { |
|---|
| 1185 | 1185 | FREE( p_box->data.p_esds->es_descriptor.psz_URL ); |
|---|
| | 1186 | if( p_box->data.p_esds->es_descriptor.p_decConfigDescr ) |
|---|
| | 1187 | { |
|---|
| | 1188 | FREE( p_box->data.p_esds->es_descriptor.p_decConfigDescr->p_decoder_specific_info ); |
|---|
| | 1189 | } |
|---|
| 1186 | 1190 | FREE( p_box->data.p_esds->es_descriptor.p_decConfigDescr ); |
|---|
| 1187 | 1191 | } |
|---|
| … | … | |
| 1189 | 1193 | int MP4_ReadBox_sample_soun( MP4_Stream_t *p_stream, MP4_Box_t *p_box ) |
|---|
| 1190 | 1194 | { |
|---|
| 1191 | | unsigned int i; |
|---|
| 1192 | | |
|---|
| | 1195 | unsigned int i; |
|---|
| | 1196 | |
|---|
| 1193 | 1197 | MP4_READBOX_ENTER( MP4_Box_data_sample_soun_t ); |
|---|
| 1194 | 1198 | |
|---|
| … | … | |
| 1199 | 1203 | |
|---|
| 1200 | 1204 | MP4_GET2BYTES( p_box->data.p_sample_soun->i_data_reference_index ); |
|---|
| 1201 | | |
|---|
| | 1205 | |
|---|
| 1202 | 1206 | for( i = 0; i < 2 ; i++ ) |
|---|
| 1203 | 1207 | { |
|---|
| 1204 | 1208 | MP4_GET4BYTES( p_box->data.p_sample_soun->i_reserved2[i] ); |
|---|
| 1205 | 1209 | } |
|---|
| 1206 | | |
|---|
| | 1210 | |
|---|
| 1207 | 1211 | MP4_GET2BYTES( p_box->data.p_sample_soun->i_channelcount ); |
|---|
| 1208 | 1212 | MP4_GET2BYTES( p_box->data.p_sample_soun->i_samplesize ); |
|---|
| … | … | |
| 1211 | 1215 | MP4_GET2BYTES( p_box->data.p_sample_soun->i_sampleratehi ); |
|---|
| 1212 | 1216 | MP4_GET2BYTES( p_box->data.p_sample_soun->i_sampleratelo ); |
|---|
| 1213 | | |
|---|
| | 1217 | |
|---|
| 1214 | 1218 | MP4_SeekStream( p_stream, p_box->i_pos + MP4_BOX_HEADERSIZE( p_box ) + 28 ); |
|---|
| 1215 | 1219 | MP4_ReadBoxContainerRaw( p_stream, p_box ); /* esds */ |
|---|
| 1216 | | |
|---|
| | 1220 | |
|---|
| 1217 | 1221 | #ifdef MP4_VERBOSE |
|---|
| 1218 | 1222 | msg_Dbg( p_stream->p_input, "Read Box: \"soun\" in stsd channel %d sample size %d sampl rate %f", |
|---|
| … | … | |
| 1232 | 1236 | |
|---|
| 1233 | 1237 | MP4_READBOX_ENTER( MP4_Box_data_sample_mp4a_t ); |
|---|
| 1234 | | |
|---|
| | 1238 | |
|---|
| 1235 | 1239 | for( i = 0; i < 6 ; i++ ) |
|---|
| 1236 | 1240 | { |
|---|
| … | … | |
| 1239 | 1243 | |
|---|
| 1240 | 1244 | MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_data_reference_index ); |
|---|
| 1241 | | |
|---|
| | 1245 | |
|---|
| 1242 | 1246 | for( i = 0; i < 2 ; i++ ) |
|---|
| 1243 | 1247 | { |
|---|
| 1244 | 1248 | MP4_GET4BYTES( p_box->data.p_sample_mp4a->i_reserved2[i] ); |
|---|
| 1245 | 1249 | } |
|---|
| 1246 | | |
|---|
| | 1250 | |
|---|
| 1247 | 1251 | MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_channelcount ); |
|---|
| 1248 | 1252 | MP4_GET2BYTES( p_box->data.p_sample_mp4a->i_samplesize ); |
|---|
| rfcfb04f |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: mp4.c,v 1.12 2003/01/08 10:46:30 fenrir Exp $ |
|---|
| | 5 | * $Id: mp4.c,v 1.13 2003/01/25 16:58:34 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 442 | 442 | } |
|---|
| 443 | 443 | } |
|---|
| | 444 | FREE( p_demux->track[i_track].chunk ); |
|---|
| 444 | 445 | |
|---|
| 445 | 446 | if( !p_demux->track[i_track].i_sample_size ) |
|---|
| … | … | |
| 449 | 450 | } |
|---|
| 450 | 451 | FREE( p_demux->track ); |
|---|
| | 452 | |
|---|
| | 453 | FREE( p_input->p_demux_data ); |
|---|
| 451 | 454 | #undef FREE |
|---|
| 452 | 455 | } |
|---|
| … | … | |
| 1058 | 1061 | /* now create a bitmapinfoheader_t for decoder and |
|---|
| 1059 | 1062 | add information found in p_esds */ |
|---|
| 1060 | | p_init = malloc( sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len ); |
|---|
| | 1063 | /* XXX XXX + 16 are for avoid segfault when ffmpeg access beyong the data */ |
|---|
| | 1064 | p_init = malloc( sizeof( BITMAPINFOHEADER ) + i_decoder_specific_info_len + 16 ); |
|---|
| 1061 | 1065 | p_bih = (BITMAPINFOHEADER*)p_init; |
|---|
| 1062 | 1066 | |
|---|
| … | … | |
| 1118 | 1122 | |
|---|
| 1119 | 1123 | case( AUDIO_ES ): |
|---|
| 1120 | | p_init = malloc( sizeof( WAVEFORMATEX ) + i_decoder_specific_info_len); |
|---|
| | 1124 | p_init = malloc( sizeof( WAVEFORMATEX ) + i_decoder_specific_info_len + 16 ); |
|---|
| 1121 | 1125 | p_wf = (WAVEFORMATEX*)p_init; |
|---|
| 1122 | 1126 | |
|---|
| r81b7c54 |
r22d851e |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: wav.c,v 1.9 2003/01/07 21:49:01 fenrir Exp $ |
|---|
| | 5 | * $Id: wav.c,v 1.10 2003/01/25 16:58:35 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 61 | 61 | |
|---|
| 62 | 62 | /* Some functions to manipulate memory */ |
|---|
| 63 | | static u16 GetWLE( u8 *p_buff ) |
|---|
| | 63 | static uint16_t GetWLE( uint8_t *p_buff ) |
|---|
| 64 | 64 | { |
|---|
| 65 | 65 | return( (p_buff[0]) + ( p_buff[1] <<8 ) ); |
|---|
| 66 | 66 | } |
|---|
| 67 | 67 | |
|---|
| 68 | | static u32 GetDWLE( u8 *p_buff ) |
|---|
| | 68 | static uint32_t GetDWLE( uint8_t *p_buff ) |
|---|
| 69 | 69 | { |
|---|
| 70 | 70 | return( p_buff[0] + ( p_buff[1] <<8 ) + |
|---|
| … | … | |
| 72 | 72 | } |
|---|
| 73 | 73 | |
|---|
| 74 | | static u32 CreateDWLE( int a, int b, int c, int d ) |
|---|
| | 74 | static uint32_t CreateDWLE( int a, int b, int c, int d ) |
|---|
| 75 | 75 | { |
|---|
| 76 | 76 | return( a + ( b << 8 ) + ( c << 16 ) + ( d << 24 ) ); |
|---|
| … | … | |
| 117 | 117 | |
|---|
| 118 | 118 | /* return 1 if success, 0 if fail */ |
|---|
| 119 | | static int ReadData( input_thread_t *p_input, u8 *p_buff, int i_size ) |
|---|
| | 119 | static int ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size ) |
|---|
| 120 | 120 | { |
|---|
| 121 | 121 | data_packet_t *p_data; |
|---|
| … | … | |
| 123 | 123 | int i_read; |
|---|
| 124 | 124 | |
|---|
| 125 | | |
|---|
| | 125 | |
|---|
| 126 | 126 | if( !i_size ) |
|---|
| 127 | 127 | { |
|---|
| … | … | |
| 138 | 138 | memcpy( p_buff, p_data->p_payload_start, i_read ); |
|---|
| 139 | 139 | input_DeletePacket( p_input->p_method_data, p_data ); |
|---|
| 140 | | |
|---|
| | 140 | |
|---|
| 141 | 141 | p_buff += i_read; |
|---|
| 142 | 142 | i_size -= i_read; |
|---|
| 143 | | |
|---|
| | 143 | |
|---|
| 144 | 144 | } while( i_size ); |
|---|
| 145 | | |
|---|
| | 145 | |
|---|
| 146 | 146 | return( 1 ); |
|---|
| 147 | 147 | } |
|---|
| … | … | |
| 155 | 155 | |
|---|
| 156 | 156 | *pp_pes = NULL; |
|---|
| 157 | | |
|---|
| | 157 | |
|---|
| 158 | 158 | if( !(p_pes = input_NewPES( p_input->p_method_data )) ) |
|---|
| 159 | 159 | { |
|---|
| … | … | |
| 193 | 193 | } |
|---|
| 194 | 194 | |
|---|
| 195 | | static int FindTag( input_thread_t *p_input, u32 i_tag ) |
|---|
| 196 | | { |
|---|
| 197 | | u32 i_id; |
|---|
| 198 | | u32 i_size; |
|---|
| 199 | | u8 *p_peek; |
|---|
| | 195 | static int FindTag( input_thread_t *p_input, uint32_t i_tag ) |
|---|
| | 196 | { |
|---|
| | 197 | uint32_t i_id; |
|---|
| | 198 | uint32_t i_size; |
|---|
| | 199 | uint8_t *p_peek; |
|---|
| 200 | 200 | |
|---|
| 201 | 201 | for( ;; ) |
|---|
| … | … | |
| 227 | 227 | demux_sys_t *p_demux ) |
|---|
| 228 | 228 | { |
|---|
| 229 | | u8 *p_peek; |
|---|
| 230 | | u32 i_size; |
|---|
| | 229 | uint8_t *p_peek; |
|---|
| | 230 | uint32_t i_size; |
|---|
| 231 | 231 | WAVEFORMATEX *p_wf; |
|---|
| 232 | | |
|---|
| | 232 | |
|---|
| 233 | 233 | |
|---|
| 234 | 234 | if( input_Peek( p_input, &p_peek , 8 ) < 8 ) |
|---|
| … | … | |
| 278 | 278 | /* read samples for 50ms of */ |
|---|
| 279 | 279 | i_samples = __MAX( p_wf->nSamplesPerSec / 20, 1 ); |
|---|
| 280 | | |
|---|
| 281 | | |
|---|
| | 280 | |
|---|
|