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

« back to all changes in this revision

Viewing changes to modules/misc/testsuite/test4.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
 * test4.c : Miscellaneous stress tests module for vlc
3
3
 *****************************************************************************
4
4
 * Copyright (C) 2002 the VideoLAN team
5
 
 * $Id: 1e8de5ac490d7c161e11532f4e5e6db572a01a30 $
 
5
 * $Id: 170992ee72ce20537844ba0301ee5762156a7c54 $
6
6
 *
7
7
 * Authors: Samuel Hocevar <sam@zoy.org>
8
8
 *
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
16
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
24
/*****************************************************************************
25
25
 * Preamble
26
26
 *****************************************************************************/
27
 
#include <vlc/vlc.h>
28
 
 
29
 
#include <stdlib.h>
 
27
#ifdef HAVE_CONFIG_H
 
28
# include "config.h"
 
29
#endif
 
30
 
 
31
#include <vlc_common.h>
 
32
#include <vlc_plugin.h>
 
33
 
30
34
#include <signal.h>
31
35
 
32
36
/*****************************************************************************
60
64
 * Module descriptor.
61
65
 *****************************************************************************/
62
66
vlc_module_begin();
63
 
    set_description( _("Miscellaneous stress tests") );
 
67
    set_description( N_("Miscellaneous stress tests") );
64
68
    var_Create( p_module->p_libvlc, "foo-test",
65
69
                VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
66
70
    var_AddCallback( p_module->p_libvlc, "foo-test", Foo, NULL );
95
99
    var_Change( p_this, "honk", VLC_VAR_SETDEFAULT, &val, NULL );
96
100
 
97
101
    var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
 
102
    free( val.psz_string );
98
103
 
99
104
    val.psz_string = "foo";
100
105
    var_Set( p_this, "honk", val );
101
106
 
102
107
    var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
 
108
    free( val.psz_string );
103
109
 
104
110
    val.psz_string = "blork";
105
111
    var_Set( p_this, "honk", val );
106
112
 
107
113
    var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
 
114
    free( val.psz_string );
108
115
 
109
116
    val.psz_string = "baz";
110
117
    var_Change( p_this, "honk", VLC_VAR_DELCHOICE, &val, NULL );
164
171
 
165
172
    for( i = 0; i < 10; i++ )
166
173
    {
167
 
        pp_objects[i] = vlc_object_create( p_this, VLC_OBJECT_GENERIC );
 
174
        pp_objects[i] = vlc_object_create( p_this, sizeof( vlc_object_t ) );
168
175
        vlc_object_attach( pp_objects[i], p_this );
169
 
        vlc_thread_create( pp_objects[i], "foo", MyThread, 0, VLC_TRUE );
 
176
        vlc_thread_create( pp_objects[i], "foo", MyThread, 0, true );
170
177
    }
171
178
 
172
179
    msleep( 3000000 );
175
182
 
176
183
    for( i = 0; i < 10; i++ )
177
184
    {
178
 
        pp_objects[i]->b_die = VLC_TRUE;
 
185
        vlc_object_kill( pp_objects[i] );
179
186
        vlc_thread_join( pp_objects[i] );
180
187
        vlc_object_detach( pp_objects[i] );
181
 
        vlc_object_destroy( pp_objects[i] );
 
188
        vlc_object_release( pp_objects[i] );
182
189
    }
183
190
 
184
191
    /* Clean our mess */
216
223
    sprintf( psz_newvar, "blork-%i", i_var );
217
224
    var_Set( p_this, psz_newvar, newval );
218
225
 
219
 
    return VLC_SUCCESS;   
 
226
    return VLC_SUCCESS;
220
227
}
221
228
 
222
229
/*****************************************************************************
232
239
 
233
240
    val.i_int = 42;
234
241
 
235
 
    while( !p_this->b_die )
 
242
    while( vlc_object_alive (p_this) )
236
243
    {
237
244
        int i = (int) (100.0 * rand() / (RAND_MAX));
238
245
 
296
303
    start = mdate();
297
304
    for( i = 0; i < MAXOBJ * i_level; i++ )
298
305
    {
299
 
        pp_objects[i] = vlc_object_create( p_this, VLC_OBJECT_GENERIC );
 
306
        pp_objects[i] = vlc_object_create( p_this, sizeof( vlc_object_t ) );
300
307
    }
301
308
 
302
309
    printf( " - randomly looking up %i objects\n", MAXLOOK * i_level );
303
310
    for( i = MAXLOOK * i_level; i--; )
304
311
    {
305
312
        int id = (int) (MAXOBJ * i_level * 1.0 * rand() / (RAND_MAX));
306
 
        vlc_object_get( p_this, pp_objects[id]->i_object_id );
 
313
        vlc_object_get( pp_objects[id]->i_object_id );
307
314
        vlc_object_release( p_this );
308
315
    }
309
316
 
310
317
    printf( " - destroying the objects (LIFO)\n" );
311
318
    for( i = MAXOBJ * i_level; i--; )
312
319
    {
313
 
        vlc_object_destroy( pp_objects[i] );
 
320
        vlc_object_release( pp_objects[i] );
314
321
    }
315
322
 
316
323
    printf( "done (%fs).\n", (mdate() - start) / 1000000.0 );
381
388
            MAXTH * i_level, MAXOBJ/MAXTH );
382
389
    for( i = 0; i < MAXTH * i_level; i++ )
383
390
    {
384
 
        pp_objects[i] = vlc_object_create( p_this, VLC_OBJECT_GENERIC );
385
 
        vlc_thread_create( pp_objects[i], "foo", Dummy, 0, VLC_TRUE );
 
391
        pp_objects[i] = vlc_object_create( p_this, sizeof( vlc_object_t ) );
 
392
        vlc_thread_create( pp_objects[i], "foo", Dummy, 0, true );
386
393
    }
387
394
 
388
395
    printf( " - killing the threads (LIFO)\n" );
389
396
    for( i = MAXTH * i_level; i--; )
390
397
    {
391
 
        pp_objects[i]->b_die = VLC_TRUE;
 
398
        pp_objects[i]->b_die = true;
392
399
        vlc_thread_join( pp_objects[i] );
393
 
        vlc_object_destroy( pp_objects[i] );
 
400
        vlc_object_release( pp_objects[i] );
394
401
    }
395
402
 
396
403
    printf( "done (%fs).\n", (mdate() - start) / 1000000.0 );
413
420
 
414
421
    for( i = 0; i < MAXOBJ/MAXTH; i++ )
415
422
    {
416
 
        pp_objects[i] = vlc_object_create( p_this, VLC_OBJECT_GENERIC );
 
423
        pp_objects[i] = vlc_object_create( p_this, sizeof( vlc_object_t ) );
417
424
    }
418
425
 
419
426
    vlc_thread_ready( p_this );
420
427
 
421
 
    while( !p_this->b_die )
 
428
    while( vlc_object_alive (p_this) )
422
429
    {
423
430
        msleep( 10000 );
424
431
    }
425
432
 
426
433
    for( i = MAXOBJ/MAXTH; i--; )
427
434
    {
428
 
        vlc_object_destroy( pp_objects[i] );
 
435
        vlc_object_release( pp_objects[i] );
429
436
    }
430
437
 
431
438
    return NULL;