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

« back to all changes in this revision

Viewing changes to modules/demux/mod.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
 * mod.c: MOD file demuxer (using libmodplug)
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2004 the VideoLAN team
5
 
 * $Id: 316388cc6a0337fe48e7e55742ca4d762756628d $
 
5
 * $Id$
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
#include <libmodplug/modplug.h>
33
37
 
44
48
static int  Open    ( vlc_object_t * );
45
49
static void Close  ( vlc_object_t * );
46
50
 
47
 
/// \bug [String] missing .
48
 
#define NOISE_LONGTEXT N_("Enable noise reduction algorithm")
 
51
#define NOISE_LONGTEXT N_("Enable noise reduction algorithm.")
49
52
#define REVERB_LONGTEXT N_("Enable reverberation" )
50
53
#define REVERB_LEVEL_LONGTEXT N_( "Reverberation level (from 0 " \
51
54
                "to 100, default value is 0)." )
54
57
#define MEGABASS_LONGTEXT N_( "Enable megabass mode" )
55
58
#define MEGABASS_LEVEL_LONGTEXT N_("Megabass mode level (from 0 to 100, " \
56
59
                "default value is 0)." )
57
 
/// \bug [String] Missing space after dot
58
 
#define MEGABASS_RANGE_LONGTEXT N_("Megabass mode cutoff frequency, in Hz." \
 
60
#define MEGABASS_RANGE_LONGTEXT N_("Megabass mode cutoff frequency, in Hz. " \
59
61
                "This is the maximum frequency for which the megabass " \
60
 
                "effect applies. Valid values are from 10 to 100 Hz" )
 
62
                "effect applies. Valid values are from 10 to 100 Hz." )
61
63
#define SURROUND_LEVEL_LONGTEXT N_( "Surround effect level (from 0 to 100, " \
62
64
                "default value is 0)." )
63
65
#define SURROUND_DELAY_LONGTEXT N_("Surround delay, in ms. Usual values are " \
64
 
                "from 5 to 40 ms" )
 
66
                "from 5 to 40 ms." )
65
67
 
66
68
vlc_module_begin();
67
69
    set_shortname( "MOD");
68
 
    set_description( _("MOD demuxer (libmodplug)" ) );
69
 
    set_capability( "demux2", 10 );
 
70
    set_description( N_("MOD demuxer (libmodplug)" ) );
 
71
    set_capability( "demux", 10 );
70
72
    set_category( CAT_INPUT );
71
73
    set_subcategory( SUBCAT_INPUT_DEMUX );
72
74
 
73
 
    add_bool( "mod-noisereduction", VLC_TRUE, NULL, N_("Noise reduction"),
74
 
              NOISE_LONGTEXT, VLC_FALSE );
 
75
    add_bool( "mod-noisereduction", true, NULL, N_("Noise reduction"),
 
76
              NOISE_LONGTEXT, false );
75
77
 
76
 
    add_bool( "mod-reverb", VLC_FALSE, NULL, N_("Reverb"),
77
 
              REVERB_LONGTEXT, VLC_FALSE );
 
78
    add_bool( "mod-reverb", false, NULL, N_("Reverb"),
 
79
              REVERB_LONGTEXT, false );
78
80
    add_integer_with_range( "mod-reverb-level", 0, 0, 100, NULL,
79
 
             N_("Reverberation level"), REVERB_LEVEL_LONGTEXT, VLC_TRUE );
 
81
             N_("Reverberation level"), REVERB_LEVEL_LONGTEXT, true );
80
82
    add_integer_with_range( "mod-reverb-delay", 40, 0, 1000, NULL,
81
 
             N_("Reverberation delay"), REVERB_DELAY_LONGTEXT, VLC_TRUE );
 
83
             N_("Reverberation delay"), REVERB_DELAY_LONGTEXT, true );
82
84
 
83
 
    add_bool( "mod-megabass", VLC_FALSE, NULL, N_("Mega bass"),
84
 
                    MEGABASS_LONGTEXT, VLC_FALSE );
 
85
    add_bool( "mod-megabass", false, NULL, N_("Mega bass"),
 
86
                    MEGABASS_LONGTEXT, false );
85
87
    add_integer_with_range( "mod-megabass-level", 0, 0, 100, NULL,
86
 
              N_("Mega bass level"), MEGABASS_LEVEL_LONGTEXT, VLC_TRUE );
 
88
              N_("Mega bass level"), MEGABASS_LEVEL_LONGTEXT, true );
87
89
    add_integer_with_range( "mod-megabass-range", 10, 10, 100, NULL,
88
 
              N_("Mega bass cutoff"), MEGABASS_RANGE_LONGTEXT, VLC_TRUE );
 
90
              N_("Mega bass cutoff"), MEGABASS_RANGE_LONGTEXT, true );
89
91
 
90
 
    add_bool( "mod-surround", VLC_FALSE, NULL, N_("Surround"), N_("Surround"),
91
 
               VLC_FALSE );
 
92
    add_bool( "mod-surround", false, NULL, N_("Surround"), N_("Surround"),
 
93
               false );
92
94
    add_integer_with_range( "mod-surround-level", 0, 0, 100, NULL,
93
 
              N_("Surround level"), SURROUND_LEVEL_LONGTEXT, VLC_TRUE );
 
95
              N_("Surround level"), SURROUND_LEVEL_LONGTEXT, true );
94
96
    add_integer_with_range( "mod-surround-delay", 5, 0, 1000, NULL,
95
 
              N_("Surround delay (ms)"), SURROUND_DELAY_LONGTEXT, VLC_TRUE );
 
97
              N_("Surround delay (ms)"), SURROUND_DELAY_LONGTEXT, true );
96
98
 
97
99
    set_callbacks( Open, Close );
98
100
    add_shortcut( "mod" );
132
134
{
133
135
    demux_t     *p_demux = (demux_t*)p_this;
134
136
    demux_sys_t *p_sys;
135
 
    char        *ext;
136
 
    int         i;
137
137
    ModPlug_Settings settings;
138
138
    vlc_value_t val;
139
139
 
140
140
    /* We accept file based on extension match */
141
 
    if( strcasecmp( p_demux->psz_demux, "mod" ) )
 
141
    if( !p_demux->b_force )
142
142
    {
 
143
        char *ext;
 
144
        int i;
143
145
        if( ( ext = strrchr( p_demux->psz_path, '.' ) ) == NULL ||
144
146
            stream_Size( p_demux->s ) == 0 ) return VLC_EGENERIC;
145
147
 
231
233
    p_sys->i_time  = 1;
232
234
    p_sys->i_length = ModPlug_GetLength( p_sys->f ) * (int64_t)1000;
233
235
 
234
 
    msg_Dbg( p_demux, "MOD loaded name=%s lenght="I64Fd"ms",
 
236
    msg_Dbg( p_demux, "MOD loaded name=%s lenght=%"PRId64"ms",
235
237
             ModPlug_GetName( p_sys->f ),
236
238
             p_sys->i_length );
237
239
 
271
273
    block_t     *p_frame;
272
274
    int         i_bk = ( p_sys->fmt.audio.i_bitspersample / 8 ) *
273
275
                       p_sys->fmt.audio.i_channels;
 
276
    int         i_read;
274
277
 
275
278
    p_frame = block_New( p_demux, p_sys->fmt.audio.i_rate / 10 * i_bk );
276
279
 
277
 
    p_frame->i_buffer = ModPlug_Read( p_sys->f, p_frame->p_buffer, p_frame->i_buffer );
278
 
    if( p_frame->i_buffer <= 0 )
 
280
    i_read = ModPlug_Read( p_sys->f, p_frame->p_buffer, p_frame->i_buffer );
 
281
    if( i_read <= 0 )
279
282
    {
280
283
        /* EOF */
281
284
        block_Release( p_frame );
282
285
        return 0;
283
286
    }
 
287
    p_frame->i_buffer = i_read;
284
288
 
285
289
    /* Set PCR */
286
290
    es_out_Control( p_demux->out, ES_OUT_SET_PCR, (int64_t)p_sys->i_time );