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

« back to all changes in this revision

Viewing changes to modules/demux/nsv.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:
1
1
/*****************************************************************************
2
2
 * nsv.c: NullSoft Video demuxer.
3
3
 *****************************************************************************
4
 
 * Copyright (C) 2004 the VideoLAN team
5
 
 * $Id: c2544b41f93f50efded241c53a8e30f8c9e6ce69 $
 
4
 * Copyright (C) 2004-2007 the VideoLAN team
 
5
 * $Id: 19f112019e9148e4d1d0f583fd8f7425ee3b1a16 $
6
6
 *
7
7
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8
8
 *
24
24
/*****************************************************************************
25
25
 * Preamble
26
26
 *****************************************************************************/
27
 
#include <stdlib.h>                                      /* malloc(), free() */
28
 
 
29
 
#include <vlc/vlc.h>
30
 
#include <vlc/input.h>
 
27
 
 
28
#ifdef HAVE_CONFIG_H
 
29
# include "config.h"
 
30
#endif
 
31
 
 
32
#include <vlc_common.h>
 
33
#include <vlc_plugin.h>
 
34
#include <vlc_demux.h>
31
35
 
32
36
/* TODO:
33
37
 *  - implement NSVf parsing (to get meta data)
42
46
static void Close  ( vlc_object_t * );
43
47
 
44
48
vlc_module_begin();
45
 
    set_description( _("NullSoft demuxer" ) );
46
 
    set_capability( "demux2", 10 );
 
49
    set_description( N_("NullSoft demuxer" ) );
 
50
    set_capability( "demux", 10 );
47
51
    set_category( CAT_INPUT );
48
52
    set_subcategory( SUBCAT_INPUT_DEMUX );
49
53
    set_callbacks( Open, Close );
86
90
    demux_t     *p_demux = (demux_t*)p_this;
87
91
    demux_sys_t *p_sys;
88
92
 
89
 
    uint8_t     *p_peek;
 
93
    const uint8_t *p_peek;
90
94
 
91
95
    if( stream_Peek( p_demux->s, &p_peek, 8 ) < 8 )
92
96
        return VLC_EGENERIC;
93
97
 
94
 
    if( strncmp( (char *)p_peek, "NSVf", 4 )
95
 
            && strncmp( (char *)p_peek, "NSVs", 4 ))
 
98
    if( memcmp( p_peek, "NSVf", 4 ) && memcmp( p_peek, "NSVs", 4 ) )
96
99
    {
97
100
       /* In case we had force this demuxer we try to resynch */
98
 
        if( strcmp( p_demux->psz_demux, "nsv" ) || ReSynch( p_demux ) )
99
 
        {
 
101
        if( !p_demux->b_force || ReSynch( p_demux ) )
100
102
            return VLC_EGENERIC;
101
 
        }
102
103
    }
103
104
 
104
105
    /* Fill p_demux field */
142
143
    demux_sys_t *p_sys = p_demux->p_sys;
143
144
 
144
145
    uint8_t     header[5];
145
 
    uint8_t     *p_peek;
 
146
    const uint8_t *p_peek;
146
147
 
147
148
    int         i_size;
148
149
    block_t     *p_frame;
155
156
            return 0;
156
157
        }
157
158
 
158
 
        if( !strncmp( (char *)p_peek, "NSVf", 4 ) )
 
159
        if( !memcmp( p_peek, "NSVf", 4 ) )
159
160
        {
160
161
            if( ReadNSVf( p_demux ) )
161
162
            {
162
163
                return -1;
163
164
            }
164
165
        }
165
 
        else if( !strncmp( (char *)p_peek, "NSVs", 4 ) )
 
166
        else if( !memcmp( p_peek, "NSVs", 4 ) )
166
167
        {
167
168
            if( ReadNSVs( p_demux ) )
168
169
            {
182
183
        }
183
184
        else
184
185
        {
185
 
            msg_Err( p_demux, "invalid signature 0x%x (%4.4s)", *(uint32_t*)p_peek, (char*)p_peek );
 
186
            msg_Err( p_demux, "invalid signature 0x%x (%4.4s)", GetDWLE( p_peek ), (const char*)p_peek );
186
187
            if( ReSynch( p_demux ) )
187
188
            {
188
189
                return -1;
382
383
 *****************************************************************************/
383
384
static int ReSynch( demux_t *p_demux )
384
385
{
385
 
    uint8_t  *p_peek;
 
386
    const uint8_t *p_peek;
386
387
    int      i_skip;
387
388
    int      i_peek;
388
389
 
389
 
    while( !p_demux->b_die )
 
390
    while( vlc_object_alive (p_demux) )
390
391
    {
391
392
        if( ( i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ) ) < 8 )
392
393
        {
396
397
 
397
398
        while( i_skip < i_peek - 4 )
398
399
        {
399
 
            if( !strncmp( (char *)p_peek, "NSVf", 4 )
400
 
                    || !strncmp( (char *)p_peek, "NSVs", 4 ) )
 
400
            if( !memcmp( p_peek, "NSVf", 4 )
 
401
             || !memcmp( p_peek, "NSVs", 4 ) )
401
402
            {
402
403
                if( i_skip > 0 )
403
404
                {
420
421
static int ReadNSVf( demux_t *p_demux )
421
422
{
422
423
    /* demux_sys_t *p_sys = p_demux->p_sys; */
423
 
    uint8_t     *p;
 
424
    const uint8_t     *p;
424
425
    int         i_size;
425
426
 
426
427
    msg_Dbg( p_demux, "new NSVf chunk" );
459
460
        case VLC_FOURCC( 'V', 'P', '6', '0' ):
460
461
        case VLC_FOURCC( 'V', 'P', '6', '1' ):
461
462
        case VLC_FOURCC( 'V', 'P', '6', '2' ):
 
463
        case VLC_FOURCC( 'H', '2', '6', '4' ):
462
464
        case VLC_FOURCC( 'N', 'O', 'N', 'E' ):
463
465
            break;
464
466
        default: