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

« back to all changes in this revision

Viewing changes to modules/access/dvb/access.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:
27
27
/*****************************************************************************
28
28
 * Preamble
29
29
 *****************************************************************************/
30
 
#include <vlc/vlc.h>
31
 
#include <vlc/input.h>
 
30
#ifdef HAVE_CONFIG_H
 
31
# include "config.h"
 
32
#endif
 
33
 
 
34
#include <vlc_common.h>
 
35
#include <vlc_plugin.h>
 
36
#include <vlc_access.h>
 
37
#include <vlc_interface.h>
32
38
 
33
39
#ifdef HAVE_UNISTD_H
34
40
#   include <unistd.h>
179
185
#define CRL_LONGTEXT N_( "HTTP interface Certificates Revocation List file" )
180
186
 
181
187
vlc_module_begin();
182
 
    set_shortname( _("DVB") );
183
 
    set_description( _("DVB input with v4l2 support") );
 
188
    set_shortname( N_("DVB") );
 
189
    set_description( N_("DVB input with v4l2 support") );
184
190
    set_category( CAT_INPUT );
185
191
    set_subcategory( SUBCAT_INPUT_ACCESS );
186
192
 
187
193
    add_integer( "dvb-caching", DEFAULT_PTS_DELAY / 1000, NULL, CACHING_TEXT,
188
 
                 CACHING_LONGTEXT, VLC_TRUE );
 
194
                 CACHING_LONGTEXT, true );
189
195
    add_integer( "dvb-adapter", 0, NULL, ADAPTER_TEXT, ADAPTER_LONGTEXT,
190
 
                 VLC_FALSE );
 
196
                 false );
191
197
    add_integer( "dvb-device", 0, NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
192
 
                 VLC_TRUE );
 
198
                 true );
193
199
    add_integer( "dvb-frequency", 11954000, NULL, FREQ_TEXT, FREQ_LONGTEXT,
194
 
                 VLC_FALSE );
 
200
                 false );
195
201
    add_integer( "dvb-inversion", 2, NULL, INVERSION_TEXT, INVERSION_LONGTEXT,
196
 
                 VLC_TRUE );
197
 
    add_bool( "dvb-probe", 1, NULL, PROBE_TEXT, PROBE_LONGTEXT, VLC_TRUE );
 
202
                 true );
 
203
    add_bool( "dvb-probe", 1, NULL, PROBE_TEXT, PROBE_LONGTEXT, true );
198
204
    add_bool( "dvb-budget-mode", 0, NULL, BUDGET_TEXT, BUDGET_LONGTEXT,
199
 
              VLC_TRUE );
 
205
              true );
200
206
    /* DVB-S (satellite) */
201
207
    add_integer( "dvb-satno", 0, NULL, SATNO_TEXT, SATNO_LONGTEXT,
202
 
                 VLC_TRUE );
 
208
                 true );
203
209
    add_integer( "dvb-voltage", 13, NULL, VOLTAGE_TEXT, VOLTAGE_LONGTEXT,
204
 
                 VLC_TRUE );
 
210
                 true );
205
211
    add_bool( "dvb-high-voltage", 0, NULL, HIGH_VOLTAGE_TEXT,
206
 
              HIGH_VOLTAGE_LONGTEXT, VLC_TRUE );
 
212
              HIGH_VOLTAGE_LONGTEXT, true );
207
213
    add_integer( "dvb-tone", -1, NULL, TONE_TEXT, TONE_LONGTEXT,
208
 
                 VLC_TRUE );
209
 
    add_integer( "dvb-fec", 9, NULL, FEC_TEXT, FEC_LONGTEXT, VLC_TRUE );
 
214
                 true );
 
215
    add_integer( "dvb-fec", 9, NULL, FEC_TEXT, FEC_LONGTEXT, true );
210
216
    add_integer( "dvb-srate", 27500000, NULL, SRATE_TEXT, SRATE_LONGTEXT,
211
 
                 VLC_FALSE );
 
217
                 false );
212
218
    add_integer( "dvb-lnb-lof1", 0, NULL, LNB_LOF1_TEXT,
213
 
                 LNB_LOF1_LONGTEXT, VLC_TRUE );
 
219
                 LNB_LOF1_LONGTEXT, true );
214
220
    add_integer( "dvb-lnb-lof2", 0, NULL, LNB_LOF2_TEXT,
215
 
                 LNB_LOF2_LONGTEXT, VLC_TRUE );
 
221
                 LNB_LOF2_LONGTEXT, true );
216
222
    add_integer( "dvb-lnb-slof", 0, NULL, LNB_SLOF_TEXT,
217
 
                 LNB_SLOF_LONGTEXT, VLC_TRUE );
 
223
                 LNB_SLOF_LONGTEXT, true );
218
224
    /* DVB-C (cable) */
219
225
    add_integer( "dvb-modulation", 0, NULL, MODULATION_TEXT,
220
 
                 MODULATION_LONGTEXT, VLC_TRUE );
 
226
                 MODULATION_LONGTEXT, true );
221
227
    /* DVB-T (terrestrial) */
222
228
    add_integer( "dvb-code-rate-hp", 9, NULL, CODE_RATE_HP_TEXT,
223
 
                 CODE_RATE_HP_LONGTEXT, VLC_TRUE );
 
229
                 CODE_RATE_HP_LONGTEXT, true );
224
230
    add_integer( "dvb-code-rate-lp", 9, NULL, CODE_RATE_LP_TEXT,
225
 
                 CODE_RATE_LP_LONGTEXT, VLC_TRUE );
 
231
                 CODE_RATE_LP_LONGTEXT, true );
226
232
    add_integer( "dvb-bandwidth", 0, NULL, BANDWIDTH_TEXT, BANDWIDTH_LONGTEXT,
227
 
                 VLC_TRUE );
228
 
    add_integer( "dvb-guard", 0, NULL, GUARD_TEXT, GUARD_LONGTEXT, VLC_TRUE );
 
233
                 true );
 
234
    add_integer( "dvb-guard", 0, NULL, GUARD_TEXT, GUARD_LONGTEXT, true );
229
235
    add_integer( "dvb-transmission", 0, NULL, TRANSMISSION_TEXT,
230
 
                 TRANSMISSION_LONGTEXT, VLC_TRUE );
 
236
                 TRANSMISSION_LONGTEXT, true );
231
237
    add_integer( "dvb-hierarchy", 0, NULL, HIERARCHY_TEXT, HIERARCHY_LONGTEXT,
232
 
                 VLC_TRUE );
 
238
                 true );
233
239
#ifdef ENABLE_HTTPD
234
240
    /* MMI HTTP interface */
235
241
    set_section( N_("HTTP server" ), 0 );
236
242
    add_string( "dvb-http-host", NULL, NULL, HOST_TEXT, HOST_LONGTEXT,
237
 
                VLC_TRUE );
 
243
                true );
238
244
    add_string( "dvb-http-user", NULL, NULL, USER_TEXT, USER_LONGTEXT,
239
 
                VLC_TRUE );
 
245
                true );
240
246
    add_string( "dvb-http-password", NULL, NULL, PASSWORD_TEXT,
241
 
                PASSWORD_LONGTEXT, VLC_TRUE );
 
247
                PASSWORD_LONGTEXT, true );
242
248
    add_string( "dvb-http-acl", NULL, NULL, ACL_TEXT, ACL_LONGTEXT,
243
 
                VLC_TRUE );
 
249
                true );
244
250
    add_string( "dvb-http-intf-cert", NULL, NULL, CERT_TEXT, CERT_LONGTEXT,
245
 
                VLC_TRUE );
 
251
                true );
246
252
    add_string( "dvb-http-intf-key",  NULL, NULL, KEY_TEXT,  KEY_LONGTEXT,
247
 
                VLC_TRUE );
 
253
                true );
248
254
    add_string( "dvb-http-intf-ca",   NULL, NULL, CA_TEXT,   CA_LONGTEXT,
249
 
                VLC_TRUE );
 
255
                true );
250
256
    add_string( "dvb-http-intf-crl",  NULL, NULL, CRL_TEXT,  CRL_LONGTEXT,
251
 
                VLC_TRUE );
 
257
                true );
252
258
#endif
253
259
 
254
 
    set_capability( "access2", 0 );
255
 
    add_shortcut( "dvb" );
256
 
    add_shortcut( "dvb-s" );
 
260
    set_capability( "access", 0 );
 
261
    add_shortcut( "dvb" );      /* Generic name */
 
262
 
 
263
    add_shortcut( "dvb-s" );    /* Satellite */
257
264
    add_shortcut( "qpsk" );
258
 
    add_shortcut( "dvb-c" );
 
265
    add_shortcut( "satellite" );
 
266
 
 
267
    add_shortcut( "dvb-c" );    /* Cable */
259
268
    add_shortcut( "cable" );
260
 
    add_shortcut( "dvb-t" );
 
269
 
 
270
    add_shortcut( "dvb-t" );    /* Terrestrial */
261
271
    add_shortcut( "terrestrial" );
262
 
    add_shortcut( "satellite" );    /* compatibility with the interface. */
 
272
 
 
273
    add_shortcut( "atsc" );     /* Atsc */
 
274
    add_shortcut( "usdigital" );
 
275
 
263
276
    set_callbacks( Open, Close );
264
277
vlc_module_end();
265
278
 
302
315
    p_access->info.i_update = 0;
303
316
    p_access->info.i_size = 0;
304
317
    p_access->info.i_pos = 0;
305
 
    p_access->info.b_eof = VLC_FALSE;
 
318
    p_access->info.b_eof = false;
306
319
    p_access->info.i_title = 0;
307
320
    p_access->info.i_seekpoint = 0;
308
321
 
309
322
    p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );
 
323
    if( !p_sys )
 
324
        return VLC_ENOMEM;
 
325
 
310
326
    memset( p_sys, 0, sizeof( access_sys_t ) );
311
327
 
312
328
    /* Create all variables */
320
336
    }
321
337
 
322
338
    /* Getting frontend info */
323
 
    if( E_(FrontendOpen)( p_access) )
 
339
    if( FrontendOpen( p_access) )
324
340
    {
325
341
        free( p_sys );
326
342
        return VLC_EGENERIC;
328
344
 
329
345
    /* Setting frontend parameters for tuning the hardware */
330
346
    msg_Dbg( p_access, "trying to tune the frontend...");
331
 
    if( E_(FrontendSet)( p_access ) < 0 )
 
347
    if( FrontendSet( p_access ) < 0 )
332
348
    {
333
 
        E_(FrontendClose)( p_access );
 
349
        FrontendClose( p_access );
334
350
        free( p_sys );
335
351
        return VLC_EGENERIC;
336
352
    }
337
353
 
338
354
    /* Opening DVR device */
339
 
    if( E_(DVROpen)( p_access ) < 0 )
 
355
    if( DVROpen( p_access ) < 0 )
340
356
    {
341
 
        E_(FrontendClose)( p_access );
 
357
        FrontendClose( p_access );
342
358
        free( p_sys );
343
359
        return VLC_EGENERIC;
344
360
    }
355
371
        FilterSet( p_access, 0x0, OTHER_TYPE );
356
372
    }
357
373
 
358
 
    E_(CAMOpen)( p_access );
 
374
    CAMOpen( p_access );
359
375
 
360
376
    if( p_sys->b_budget_mode )
361
377
        p_sys->i_read_once = DVB_READ_ONCE;
363
379
        p_sys->i_read_once = DVB_READ_ONCE_START;
364
380
 
365
381
#ifdef ENABLE_HTTPD
366
 
    E_(HTTPOpen)( p_access );
 
382
    HTTPOpen( p_access );
367
383
#endif
368
384
 
369
385
    return VLC_SUCCESS;
379
395
 
380
396
    FilterUnset( p_access, p_sys->b_budget_mode ? 1 : MAX_DEMUX );
381
397
 
382
 
    E_(DVRClose)( p_access );
383
 
    E_(FrontendClose)( p_access );
384
 
    E_(CAMClose)( p_access );
 
398
    DVRClose( p_access );
 
399
    FrontendClose( p_access );
 
400
    CAMClose( p_access );
385
401
 
386
402
#ifdef ENABLE_HTTPD
387
 
    E_(HTTPClose)( p_access );
 
403
    HTTPClose( p_access );
388
404
#endif
389
405
 
390
406
    free( p_sys );
414
430
        /* Find if some data is available */
415
431
        i_ret = poll( ufds, 2, 500 );
416
432
 
417
 
        if ( p_access->b_die )
 
433
        if ( !vlc_object_alive (p_access) )
418
434
            return NULL;
419
435
 
420
436
        if ( i_ret < 0 )
422
438
            if( errno == EINTR )
423
439
                continue;
424
440
 
425
 
            msg_Err( p_access, "poll error: %s", strerror(errno) );
 
441
            msg_Err( p_access, "poll error: %m" );
426
442
            return NULL;
427
443
        }
428
444
 
429
445
        if ( p_sys->i_ca_handle && mdate() > p_sys->i_ca_next_event )
430
446
        {
431
 
            E_(CAMPoll)( p_access );
 
447
            CAMPoll( p_access );
432
448
            p_sys->i_ca_next_event = mdate() + p_sys->i_ca_timeout;
433
449
        }
434
450
 
435
451
        if ( ufds[1].revents )
436
452
        {
437
 
            E_(FrontendPoll)( p_access );
 
453
            FrontendPoll( p_access );
438
454
        }
439
455
 
440
456
#ifdef ENABLE_HTTPD
444
460
            if ( p_sys->b_request_frontend_info )
445
461
            {
446
462
                msg_Warn( p_access, "frontend timeout for HTTP interface" );
447
 
                p_sys->b_request_frontend_info = VLC_FALSE;
 
463
                p_sys->b_request_frontend_info = false;
448
464
                p_sys->psz_frontend_info = strdup( "Timeout getting info\n" );
449
465
            }
450
466
            if ( p_sys->b_request_mmi_info )
451
467
            {
452
468
                msg_Warn( p_access, "MMI timeout for HTTP interface" );
453
 
                p_sys->b_request_mmi_info = VLC_FALSE;
 
469
                p_sys->b_request_mmi_info = false;
454
470
                p_sys->psz_mmi_info = strdup( "Timeout getting info\n" );
455
471
            }
456
472
            vlc_cond_signal( &p_sys->httpd_cond );
459
475
 
460
476
        if ( p_sys->b_request_frontend_info )
461
477
        {
462
 
            E_(FrontendStatus)( p_access );
 
478
            FrontendStatus( p_access );
463
479
        }
464
480
 
465
481
        if ( p_sys->b_request_mmi_info )
466
482
        {
467
 
            E_(CAMStatus)( p_access );
 
483
            CAMStatus( p_access );
468
484
        }
469
485
#endif
470
486
 
471
487
        if ( p_sys->i_frontend_timeout && mdate() > p_sys->i_frontend_timeout )
472
488
        {
473
489
            msg_Warn( p_access, "no lock, tuning again" );
474
 
            E_(FrontendSet)( p_access );
 
490
            FrontendSet( p_access );
475
491
        }
476
492
 
477
493
        if ( ufds[0].revents )
478
494
        {
479
495
            p_block = block_New( p_access,
480
496
                                 p_sys->i_read_once * TS_PACKET_SIZE );
481
 
            if( ( p_block->i_buffer = read( p_sys->i_handle, p_block->p_buffer,
 
497
            if( ( i_ret = read( p_sys->i_handle, p_block->p_buffer,
482
498
                                p_sys->i_read_once * TS_PACKET_SIZE ) ) <= 0 )
483
499
            {
484
 
                msg_Warn( p_access, "read failed (%s)", strerror(errno) );
 
500
                msg_Warn( p_access, "read failed (%m)" );
485
501
                block_Release( p_block );
486
502
                continue;
487
503
            }
 
504
            p_block->i_buffer = i_ret;
488
505
            break;
489
506
        }
490
507
    }
501
518
static int Control( access_t *p_access, int i_query, va_list args )
502
519
{
503
520
    access_sys_t *p_sys = p_access->p_sys;
504
 
    vlc_bool_t   *pb_bool, b_bool;
 
521
    bool   *pb_bool, b_bool;
505
522
    int          *pi_int, i_int;
506
523
    int64_t      *pi_64;
507
524
 
512
529
        case ACCESS_CAN_FASTSEEK:
513
530
        case ACCESS_CAN_PAUSE:
514
531
        case ACCESS_CAN_CONTROL_PACE:
515
 
            pb_bool = (vlc_bool_t*)va_arg( args, vlc_bool_t* );
516
 
            *pb_bool = VLC_FALSE;
 
532
            pb_bool = (bool*)va_arg( args, bool* );
 
533
            *pb_bool = false;
517
534
            break;
518
535
        /* */
519
536
        case ACCESS_GET_MTU:
531
548
        case ACCESS_GET_TITLE_INFO:
532
549
        case ACCESS_SET_TITLE:
533
550
        case ACCESS_SET_SEEKPOINT:
 
551
        case ACCESS_GET_CONTENT_TYPE:
534
552
            return VLC_EGENERIC;
535
553
 
536
554
        case ACCESS_SET_PRIVATE_ID_STATE:
537
555
            i_int  = (int)va_arg( args, int );               /* Private data (pid for now)*/
538
 
            b_bool = (vlc_bool_t)va_arg( args, vlc_bool_t ); /* b_selected */
 
556
            b_bool = (bool)va_arg( args, int ); /* b_selected */
539
557
            if( !p_sys->b_budget_mode )
540
558
            {
541
559
                /* FIXME we may want to give the real type (me ?, I don't ;) */
552
570
 
553
571
            p_pmt = (dvbpsi_pmt_t *)va_arg( args, dvbpsi_pmt_t * );
554
572
 
555
 
            E_(CAMSet)( p_access, p_pmt );
 
573
            CAMSet( p_access, p_pmt );
556
574
            break;
557
575
        }
558
576
 
588
606
        return;
589
607
    }
590
608
 
591
 
    if( E_(DMXSetFilter)( p_access, i_pid,
 
609
    if( DMXSetFilter( p_access, i_pid,
592
610
                           &p_sys->p_demux_handles[i].i_handle, i_type ) )
593
611
    {
594
612
        msg_Err( p_access, "DMXSetFilter failed" );
610
628
    {
611
629
        if( p_sys->p_demux_handles[i].i_type )
612
630
        {
613
 
            E_(DMXUnsetFilter)( p_access, p_sys->p_demux_handles[i].i_handle );
 
631
            DMXUnsetFilter( p_access, p_sys->p_demux_handles[i].i_handle );
614
632
            p_sys->p_demux_handles[i].i_type = 0;
615
633
        }
616
634
    }
626
644
        if( p_sys->p_demux_handles[i].i_type &&
627
645
            p_sys->p_demux_handles[i].i_pid == i_pid )
628
646
        {
629
 
            E_(DMXUnsetFilter)( p_access, p_sys->p_demux_handles[i].i_handle );
 
647
            DMXUnsetFilter( p_access, p_sys->p_demux_handles[i].i_handle );
630
648
            p_sys->p_demux_handles[i].i_type = 0;
631
649
        }
632
650
    }
712
730
    {
713
731
        msg_Err( p_access, "the DVB input old syntax is deprecated, use vlc "
714
732
                          "-p dvb to see an explanation of the new syntax" );
 
733
        intf_UserFatal( p_access, true, _("Input syntax is deprecated"),
 
734
            _("The given syntax is deprecated. Run \"vlc -p dvb\" to see an " \
 
735
                "explanation of the new syntax.") );
715
736
        free( psz_dup );
716
737
        return VLC_EGENERIC;
717
738
    }
756
777
            else
757
778
            {
758
779
                msg_Err( p_access, "illegal polarization %c", *psz_parser );
 
780
                intf_UserFatal( p_access, false, _("Illegal Polarization"),
 
781
                                _("The provided polarization \"%c\" is not valid."),
 
782
                                *psz_parser );
759
783
                free( psz_dup );
760
784
                return VLC_EGENERIC;
761
785
            }