~ubuntu-branches/ubuntu/maverick/vlc/maverick

« back to all changes in this revision

Viewing changes to modules/packetizer/mpeg4audio.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-09-17 21:56:14 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20080917215614-tj0vx8xzd57e52t8
Tags: 0.9.2-1ubuntu1
* New Upstream Release, exception granted by
    - dktrkranz, norsetto, Hobbsee (via irc). LP: #270404

Changes done in ubuntu:

* add libxul-dev to build-depends
* make sure that vlc is build against libxul in configure. This doesn't
  change anything in the package, but makes it more robust if building
  in an 'unclean' chroot or when modifying the package.
* debian/control: make Vcs-* fields point to the motumedia branch
* add libx264-dev and libass-dev to build-depends
  LP: #210354, #199870
* actually enable libass support by passing --enable-libass to configure
* enable libdca: add libdca-dev to build depends and --enable-libdca
* install the x264 plugin.

Changes already in the pkg-multimedia branch in debian:

* don't install usr/share/vlc/mozilla in debian/mozilla-plugin-vlc.install  
* new upstream .desktop file now registers flash video mimetype LP: #261567
* add Xb-Npp-Applications to mozilla-plugin-vlc
* remove duplicate entries in debian/vlc-nox.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * mpeg4audio.c: parse and packetize an MPEG 4 audio stream
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2001, 2002, 2006 the VideoLAN team
5
 
 * $Id: ab5d5956d4738080904edb28e2d08eaf394da1be $
 
5
 * $Id$
6
6
 *
7
7
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8
8
 *          Gildas Bazin <gbazin@netcourrier.com>
25
25
/*****************************************************************************
26
26
 * Preamble
27
27
 *****************************************************************************/
28
 
#include <stdlib.h>                                      /* malloc(), free() */
29
 
#include <string.h>                                              /* strdup() */
30
 
#include <assert.h>
31
 
 
32
 
#include <vlc/vlc.h>
33
 
#include <vlc/aout.h>
34
 
#include <vlc/decoder.h>
35
 
#include <vlc/input.h>
36
 
#include <vlc/sout.h>
 
28
 
 
29
#ifdef HAVE_CONFIG_H
 
30
# include "config.h"
 
31
#endif
 
32
 
 
33
#include <vlc_common.h>
 
34
#include <vlc_plugin.h>
 
35
#include <vlc_aout.h>
 
36
#include <vlc_codec.h>
37
37
#include <vlc_block.h>
 
38
#include <vlc_sout.h>
 
39
#include <vlc_codecs.h>
 
40
#include <vlc_input.h>
38
41
#include <vlc_bits.h>
39
 
#include "codecs.h"
40
42
 
41
43
#include "vlc_block_helper.h"
42
44
 
 
45
#include <assert.h>
 
46
 
43
47
/* AAC Config in ES:
44
48
 *
45
49
 * AudioObjectType          5 bits
134
138
    int i_input_rate;
135
139
 
136
140
    /* LOAS */
137
 
    vlc_bool_t b_latm_cfg;
 
141
    bool b_latm_cfg;
138
142
    latm_mux_t latm;
139
143
};
140
144
 
178
182
vlc_module_begin();
179
183
    set_category( CAT_SOUT );
180
184
    set_subcategory( SUBCAT_SOUT_PACKETIZER );
181
 
    set_description( _("MPEG4 audio packetizer") );
 
185
    set_description( N_("MPEG4 audio packetizer") );
182
186
    set_capability( "packetizer", 50 );
183
187
    set_callbacks( OpenPacketizer, ClosePacketizer );
184
188
vlc_module_end();
199
203
    /* Allocate the memory needed to store the decoder's structure */
200
204
    if( ( p_dec->p_sys = p_sys =
201
205
          (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
202
 
    {
203
 
        msg_Err( p_dec, "out of memory" );
204
 
        return VLC_EGENERIC;
205
 
    }
 
206
        return VLC_ENOMEM;
206
207
 
207
208
    /* Misc init */
208
209
    p_sys->i_state = STATE_NOSYNC;
209
210
    aout_DateSet( &p_sys->end_date, 0 );
210
 
    p_sys->bytestream = block_BytestreamInit( p_dec );
 
211
    p_sys->bytestream = block_BytestreamInit();
211
212
    p_sys->i_input_rate = INPUT_RATE_DEFAULT;
212
 
    p_sys->b_latm_cfg = VLC_FALSE;
 
213
    p_sys->b_latm_cfg = false;
213
214
 
214
215
    /* Set output properties */
215
216
    p_dec->fmt_out.i_cat = AUDIO_ES;
324
325
/****************************************************************************
325
326
 * ADTS helpers
326
327
 ****************************************************************************/
327
 
static int ADTSSyncInfo( decoder_t * p_dec, const byte_t * p_buf,
 
328
static int ADTSSyncInfo( decoder_t * p_dec, const uint8_t * p_buf,
328
329
                         unsigned int * pi_channels,
329
330
                         unsigned int * pi_sample_rate,
330
331
                         unsigned int * pi_frame_length,
331
332
                         unsigned int * pi_header_size )
332
333
{
333
334
    int i_profile, i_sample_rate_idx, i_frame_size;
334
 
    vlc_bool_t b_crc;
 
335
    bool b_crc;
335
336
 
336
337
    /* Fixed header between frames */
337
338
    //int i_id = ( (p_buf[1] >> 3) & 0x01) ? 2 : 4; /* MPEG-2 or 4 */
703
704
        for( i_layer = 0; i_layer < m->pi_layers[i_program]; i_layer++ )
704
705
        {
705
706
            latm_stream_t *st = &m->stream[m->i_streams];
706
 
            vlc_bool_t b_previous_cfg;
 
707
            bool b_previous_cfg;
707
708
 
708
709
            m->pi_stream[i_program][i_layer] = m->i_streams;
709
710
            st->i_program = i_program;
710
711
            st->i_layer = i_layer;
711
712
 
712
 
            b_previous_cfg = VLC_FALSE;
 
713
            b_previous_cfg = false;
713
714
            if( i_program != 0 || i_layer != 0 )
714
715
                b_previous_cfg = bs_read1( s );
715
716
 
819
820
                memcpy( p_dec->fmt_out.p_extra, st->extra, st->i_extra );
820
821
            }
821
822
 
822
 
            p_sys->b_latm_cfg = VLC_TRUE;
 
823
            p_sys->b_latm_cfg = true;
823
824
        }
824
825
    }
825
826
    /* Wait for the configuration */
826
827
    if( !p_sys->b_latm_cfg )
827
828
        return 0;
828
829
 
829
 
    /* FIXME do we need to split the subframe into independant packet ? */
 
830
    /* FIXME do we need to split the subframe into independent packet ? */
830
831
    if( p_sys->latm.i_sub_frames > 1 )
831
832
        msg_Err( p_dec, "latm sub frames not yet supported, please send a sample" );
832
833
 
1139
1140
            p_out_buffer = block_New( p_dec, p_sys->i_frame_size );
1140
1141
            if( !p_out_buffer )
1141
1142
            {
1142
 
                //p_dec->b_error = VLC_TRUE;
 
1143
                //p_dec->b_error = true;
1143
1144
                return NULL;
1144
1145
            }
1145
1146
            p_buf = p_out_buffer->p_buffer;