vcd.c 19.3 KB
Newer Older
1 2 3
/*****************************************************************************
 * vcd.c : VCD input module for vlc
 *****************************************************************************
Gildas Bazin's avatar
 
Gildas Bazin committed
4 5
 * Copyright (C) 2000-2004 VideoLAN
 * $Id: vcd.c,v 1.25 2004/01/25 17:31:22 gbazin Exp $
6 7 8 9 10 11 12
 *
 * Author: Johan Bilien <jobi@via.ecp.fr>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
13
 *
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include <stdio.h>
#include <stdlib.h>

#include <vlc/vlc.h>
#include <vlc/input.h>

33 34
#include "../../demux/mpeg/system.h"

35 36 37 38 39 40
#ifdef HAVE_UNISTD_H
#   include <unistd.h>
#endif

#include <string.h>

Gildas Bazin's avatar
 
Gildas Bazin committed
41
#include "cdrom.h"
42 43 44 45 46

/* how many blocks VCDRead will read in each loop */
#define VCD_BLOCKS_ONCE 20
#define VCD_DATA_ONCE   (VCD_BLOCKS_ONCE * VCD_DATA_SIZE)

Gildas Bazin's avatar
 
Gildas Bazin committed
47 48 49 50 51 52
/*****************************************************************************
 * thread_vcd_data_t: VCD information
 *****************************************************************************/
typedef struct thread_vcd_data_s
{
    vcddev_t    *vcddev;                            /* vcd device descriptor */
53
    int         i_nb_tracks;                        /* Nb of tracks (titles) */
Gildas Bazin's avatar
 
Gildas Bazin committed
54 55 56
    int         i_track;                                    /* Current track */
    int         i_sector;                                  /* Current Sector */
    int *       p_sectors;                                  /* Track sectors */
57 58 59
    int         i_entries_nb;                      /* Number of entry points */
    int *       p_entries;                                   /* Entry points */
    vlc_bool_t  b_valid_ep;                       /* Valid entry points flag */
Gildas Bazin's avatar
 
Gildas Bazin committed
60 61 62 63
    vlc_bool_t  b_end_of_track;           /* If the end of track was reached */

} thread_vcd_data_t;

64 65 66 67 68 69 70 71 72
/*****************************************************************************
 * Local prototypes
 *****************************************************************************/
static int  VCDOpen         ( vlc_object_t * );
static void VCDClose        ( vlc_object_t * );
static int  VCDRead         ( input_thread_t *, byte_t *, size_t );
static void VCDSeek         ( input_thread_t *, off_t );
static int  VCDSetArea      ( input_thread_t *, input_area_t * );
static int  VCDSetProgram   ( input_thread_t *, pgrm_descriptor_t * );
73
static int  VCDEntryPoints  ( input_thread_t * );
74 75 76 77 78

/*****************************************************************************
 * Module descriptior
 *****************************************************************************/
vlc_module_begin();
Gildas Bazin's avatar
 
Gildas Bazin committed
79
    set_description( _("VCD input") );
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
    set_capability( "access", 80 );
    set_callbacks( VCDOpen, VCDClose );
    add_shortcut( "svcd" );
vlc_module_end();

/*
 * Data reading functions
 */

/*****************************************************************************
 * VCDOpen: open vcd
 *****************************************************************************/
static int VCDOpen( vlc_object_t *p_this )
{
    input_thread_t *        p_input = (input_thread_t *)p_this;
    char *                  psz_orig;
    char *                  psz_parser;
    char *                  psz_source;
    char *                  psz_next;
    thread_vcd_data_t *     p_vcd;
    int                     i;
    input_area_t *          p_area;
    int                     i_title = 1;
    int                     i_chapter = 1;
Gildas Bazin's avatar
 
Gildas Bazin committed
104
    vcddev_t                *vcddev;
105 106 107

    /* parse the options passed in command line : */
    psz_orig = psz_parser = psz_source = strdup( p_input->psz_name );
108

109 110 111 112
    if( !psz_orig )
    {
        return( -1 );
    }
113

114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
    while( *psz_parser && *psz_parser != '@' )
    {
        psz_parser++;
    }

    if( *psz_parser == '@' )
    {
        /* Found options */
        *psz_parser = '\0';
        ++psz_parser;

        i_title = (int)strtol( psz_parser, &psz_next, 10 );
        if( *psz_next )
        {
            psz_parser = psz_next + 1;
            i_chapter = (int)strtol( psz_parser, &psz_next, 10 );
        }

Gildas Bazin's avatar
 
Gildas Bazin committed
132 133
        i_title = i_title > 0 ? i_title : 1;
        i_chapter = i_chapter > 0 ? i_chapter : 1;
134 135 136 137 138 139 140 141 142 143
    }

    if( !*psz_source )
    {
        if( !p_input->psz_access )
        {
            free( psz_orig );
            return -1;
        }
        psz_source = config_GetPsz( p_input, "vcd" );
Gildas Bazin's avatar
 
Gildas Bazin committed
144
        if( !psz_source ) return -1;
145 146
    }

Gildas Bazin's avatar
 
Gildas Bazin committed
147 148 149 150 151 152 153
    /* Open VCD */
    if( !(vcddev = ioctl_Open( p_this, psz_source )) )
    {
        msg_Warn( p_input, "could not open %s", psz_source );
        free( psz_source );
        return -1;
    }
154

Gildas Bazin's avatar
 
Gildas Bazin committed
155
    p_vcd = malloc( sizeof(thread_vcd_data_t) );
156 157 158
    if( p_vcd == NULL )
    {
        msg_Err( p_input, "out of memory" );
Gildas Bazin's avatar
 
Gildas Bazin committed
159
        free( psz_source );
160 161
        return -1;
    }
Gildas Bazin's avatar
 
Gildas Bazin committed
162
    free( psz_source );
163

Gildas Bazin's avatar
 
Gildas Bazin committed
164
    p_vcd->vcddev = vcddev;
165
    p_input->p_access_data = (void *)p_vcd;
166

167
    p_input->i_mtu = VCD_DATA_ONCE;
168

169 170 171 172 173 174 175 176
    vlc_mutex_lock( &p_input->stream.stream_lock );
    p_input->stream.b_pace_control = 1;
    p_input->stream.b_seekable = 1;
    p_input->stream.p_selected_area->i_size = 0;
    p_input->stream.p_selected_area->i_tell = 0;
    vlc_mutex_unlock( &p_input->stream.stream_lock );

    /* We read the Table Of Content information */
177
    p_vcd->i_nb_tracks = ioctl_GetTracksMap( VLC_OBJECT(p_input),
Gildas Bazin's avatar
 
Gildas Bazin committed
178
                                           p_vcd->vcddev, &p_vcd->p_sectors );
179
    if( p_vcd->i_nb_tracks < 0 )
180
        msg_Err( p_input, "unable to count tracks" );
181
    else if( p_vcd->i_nb_tracks <= 1 )
182
        msg_Err( p_input, "no movie tracks found" );
183
    if( p_vcd->i_nb_tracks <= 1)
184
    {
Gildas Bazin's avatar
 
Gildas Bazin committed
185
        ioctl_Close( p_this, p_vcd->vcddev );
186 187 188 189
        free( p_vcd );
        return -1;
    }

190 191 192 193 194 195 196 197 198 199
    /* Allocate the entry points table */
    p_vcd->p_entries = malloc( p_vcd->i_nb_tracks * sizeof( int ) );

    if( p_vcd->p_entries == NULL )
    {
        msg_Err( p_input, "not enough memory" );
        ioctl_Close( p_this, p_vcd->vcddev );
        free( p_vcd );
    }

200 201 202 203 204 205 206 207 208
    /* Set stream and area data */
    vlc_mutex_lock( &p_input->stream.stream_lock );

    /* Initialize ES structures */
    input_InitStream( p_input, sizeof( stream_ps_data_t ) );

    /* disc input method */
    p_input->stream.i_method = INPUT_METHOD_VCD;

209 210
    p_input->stream.i_area_nb = 1;

211
#define area p_input->stream.pp_areas
Gildas Bazin's avatar
 
Gildas Bazin committed
212
    for( i = 1 ; i < p_vcd->i_nb_tracks; i++ )
213 214
    {
        /* Titles are Program Chains */
Gildas Bazin's avatar
 
Gildas Bazin committed
215
        input_AddArea( p_input, i, 1 );
216 217 218 219 220 221

        /* Absolute start offset and size */
        area[i]->i_start = (off_t)p_vcd->p_sectors[i] * (off_t)VCD_DATA_SIZE;
        area[i]->i_size = (off_t)(p_vcd->p_sectors[i+1] - p_vcd->p_sectors[i])
                           * (off_t)VCD_DATA_SIZE;

Gildas Bazin's avatar
 
Gildas Bazin committed
222
        /* Default Chapter */
223 224
        area[i]->i_part = 1;

225 226 227
        /* i_plugin_data is used to store which entry point is the first
         * of the track (area) */
        area[i]->i_plugin_data = 0;
228 229 230
    }
#undef area

Gildas Bazin's avatar
 
Gildas Bazin committed
231
    p_area = p_input->stream.pp_areas[__MIN(i_title,p_vcd->i_nb_tracks -1)];
232

233 234 235
    p_vcd->b_valid_ep = 1;
    if( VCDEntryPoints( p_input ) < 0 )
    {
236
        msg_Warn( p_input, "could not read entry points, will not use them" );
237 238 239
        p_vcd->b_valid_ep = 0;
    }

240 241 242 243
    VCDSetArea( p_input, p_area );

    vlc_mutex_unlock( &p_input->stream.stream_lock );

244 245 246 247
    if( !p_input->psz_demux || !*p_input->psz_demux )
    {
        p_input->psz_demux = "ps";
    }
248

Gildas Bazin's avatar
 
Gildas Bazin committed
249 250 251 252 253
    p_input->pf_read = VCDRead;
    p_input->pf_seek = VCDSeek;
    p_input->pf_set_area = VCDSetArea;
    p_input->pf_set_program = VCDSetProgram;

254 255 256 257 258 259 260 261 262 263 264
    return 0;
}

/*****************************************************************************
 * VCDClose: closes vcd
 *****************************************************************************/
static void VCDClose( vlc_object_t *p_this )
{
    input_thread_t *   p_input = (input_thread_t *)p_this;
    thread_vcd_data_t *p_vcd = (thread_vcd_data_t *)p_input->p_access_data;

Gildas Bazin's avatar
 
Gildas Bazin committed
265
    ioctl_Close( p_this, p_vcd->vcddev );
266 267 268 269 270 271 272 273 274
    free( p_vcd );
}

/*****************************************************************************
 * VCDRead: reads from the VCD into PES packets.
 *****************************************************************************
 * Returns -1 in case of error, 0 in case of EOF, otherwise the number of
 * bytes.
 *****************************************************************************/
275
static int VCDRead( input_thread_t * p_input, byte_t * p_buffer,
276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
                     size_t i_len )
{
    thread_vcd_data_t *     p_vcd;
    int                     i_blocks;
    int                     i_index;
    int                     i_read;
    byte_t                  p_last_sector[ VCD_DATA_SIZE ];

    p_vcd = (thread_vcd_data_t *)p_input->p_access_data;

    i_read = 0;

    /* Compute the number of blocks we have to read */

    i_blocks = i_len / VCD_DATA_SIZE;

292
    for ( i_index = 0 ; i_index < i_blocks ; i_index++ )
293
    {
Gildas Bazin's avatar
 
Gildas Bazin committed
294 295 296
        if ( ioctl_ReadSectors( VLC_OBJECT(p_input), p_vcd->vcddev,
             p_vcd->i_sector, p_buffer + i_index * VCD_DATA_SIZE, 1,
             VCD_TYPE ) < 0 )
297 298 299 300 301 302 303 304 305
        {
            msg_Err( p_input, "could not read sector %d", p_vcd->i_sector );
            return -1;
        }

        p_vcd->i_sector ++;
        if ( p_vcd->i_sector == p_vcd->p_sectors[p_vcd->i_track + 1] )
        {
            input_area_t *p_area;
306 307

            if ( p_vcd->i_track >= p_vcd->i_nb_tracks - 1 )
308
                return 0; /* EOF */
309 310

            vlc_mutex_lock( &p_input->stream.stream_lock );
311 312
            p_area = p_input->stream.pp_areas[
                    p_input->stream.p_selected_area->i_id + 1 ];
313

314
            msg_Dbg( p_input, "new title" );
315

316 317
            p_area->i_part = 1;
            VCDSetArea( p_input, p_area );
318
            vlc_mutex_unlock( &p_input->stream.stream_lock );
319
        }
320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336

        /* Update chapter */
        else if( p_vcd->b_valid_ep &&
                /* FIXME kludge so that read does not update chapter
                 * when a manual chapter change was requested and not
                 * yet accomplished */
                !p_input->stream.p_new_area )
        {
            int i_entry;

            vlc_mutex_lock( &p_input->stream.stream_lock );
            i_entry = p_input->stream.p_selected_area->i_plugin_data
                /* 1st entry point of the track (area)*/
                        + p_input->stream.p_selected_area->i_part - 1;
            if( i_entry + 1 < p_vcd->i_entries_nb &&
                    p_vcd->i_sector >= p_vcd->p_entries[i_entry + 1] )
            {
Gildas Bazin's avatar
 
Gildas Bazin committed
337 338
                vlc_value_t val;

339 340
                msg_Dbg( p_input, "new chapter" );
                p_input->stream.p_selected_area->i_part ++;
Gildas Bazin's avatar
 
Gildas Bazin committed
341 342 343 344 345

                /* Update the navigation variables without triggering
                 * a callback */
                val.i_int = p_input->stream.p_selected_area->i_part;
                var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
346 347 348 349
            }
            vlc_mutex_unlock( &p_input->stream.stream_lock );
        }

350 351
        i_read += VCD_DATA_SIZE;
    }
352

353
    if ( i_len % VCD_DATA_SIZE ) /* this should not happen */
354
    {
Gildas Bazin's avatar
 
Gildas Bazin committed
355 356
        if ( ioctl_ReadSectors( VLC_OBJECT(p_input), p_vcd->vcddev,
             p_vcd->i_sector, p_last_sector, 1, VCD_TYPE ) < 0 )
357 358 359 360
        {
            msg_Err( p_input, "could not read sector %d", p_vcd->i_sector );
            return -1;
        }
361

362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
        p_input->p_vlc->pf_memcpy( p_buffer + i_blocks * VCD_DATA_SIZE,
                                   p_last_sector, i_len % VCD_DATA_SIZE );
        i_read += i_len % VCD_DATA_SIZE;
    }

    return i_read;
}

/*****************************************************************************
 * VCDSetProgram: Does nothing since a VCD is mono_program
 *****************************************************************************/
static int VCDSetProgram( input_thread_t * p_input,
                          pgrm_descriptor_t * p_program)
{
    return 0;
}

/*****************************************************************************
 * VCDSetArea: initialize input data for title x, chapter y.
 * It should be called for each user navigation request.
 ****************************************************************************/
static int VCDSetArea( input_thread_t * p_input, input_area_t * p_area )
{
    thread_vcd_data_t *     p_vcd;
Gildas Bazin's avatar
 
Gildas Bazin committed
386
    vlc_value_t val;
387 388 389 390 391 392 393 394

    p_vcd = (thread_vcd_data_t*)p_input->p_access_data;

    /* we can't use the interface slider until initilization is complete */
    p_input->stream.b_seekable = 0;

    if( p_area != p_input->stream.p_selected_area )
    {
Gildas Bazin's avatar
 
Gildas Bazin committed
395 396
        unsigned int i;

397 398 399 400 401 402 403 404 405 406 407
        /* Reset the Chapter position of the current title */
        p_input->stream.p_selected_area->i_part = 1;
        p_input->stream.p_selected_area->i_tell = 0;

        /* Change the default area */
        p_input->stream.p_selected_area = p_area;

        /* Change the current track */
        /* The first track is not a valid one  */
        p_vcd->i_track = p_area->i_id;
        p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track];
Gildas Bazin's avatar
 
Gildas Bazin committed
408 409 410

        /* Update the navigation variables without triggering a callback */
        val.i_int = p_area->i_id;
Gildas Bazin's avatar
 
Gildas Bazin committed
411 412
        var_Change( p_input, "title", VLC_VAR_SETVALUE, &val, NULL );
        var_Change( p_input, "chapter", VLC_VAR_CLEARCHOICES, NULL, NULL );
Gildas Bazin's avatar
 
Gildas Bazin committed
413 414 415
        for( i = 1; i <= p_area->i_part_nb; i++ )
        {
            val.i_int = i;
Gildas Bazin's avatar
 
Gildas Bazin committed
416
            var_Change( p_input, "chapter", VLC_VAR_ADDCHOICE, &val, NULL );
Gildas Bazin's avatar
 
Gildas Bazin committed
417
        }
418 419
    }

420 421 422 423 424 425 426 427 428 429 430 431 432 433
    if( p_vcd->b_valid_ep )
    {
        int i_entry = p_area->i_plugin_data /* 1st entry point of
                                               the track (area)*/
                            + p_area->i_part - 1;
        p_vcd->i_sector = p_vcd->p_entries[i_entry];
    }
    else
        p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track];

    p_input->stream.p_selected_area->i_tell =
        (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE
         - p_input->stream.p_selected_area->i_start;

434 435 436 437
    /* warn interface that something has changed */
    p_input->stream.b_seekable = 1;
    p_input->stream.b_changed = 1;

Gildas Bazin's avatar
 
Gildas Bazin committed
438 439
    /* Update the navigation variables without triggering a callback */
    val.i_int = p_area->i_part;
Gildas Bazin's avatar
 
Gildas Bazin committed
440
    var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
Gildas Bazin's avatar
 
Gildas Bazin committed
441

442 443 444 445 446 447 448 449
    return 0;
}

/****************************************************************************
 * VCDSeek
 ****************************************************************************/
static void VCDSeek( input_thread_t * p_input, off_t i_off )
{
450 451
    thread_vcd_data_t * p_vcd;
    unsigned int i_index;
452 453 454 455 456 457

    p_vcd = (thread_vcd_data_t *) p_input->p_access_data;

    p_vcd->i_sector = p_vcd->p_sectors[p_vcd->i_track]
                       + i_off / (off_t)VCD_DATA_SIZE;

458 459 460 461 462
    vlc_mutex_lock( &p_input->stream.stream_lock );
#define p_area p_input->stream.p_selected_area
    /* Find chapter */
    if( p_vcd->b_valid_ep )
    {
Gildas Bazin's avatar
 
Gildas Bazin committed
463
        for( i_index = 2 ; i_index <= p_area->i_part_nb; i_index ++ )
464 465
        {
            if( p_vcd->i_sector < p_vcd->p_entries[p_area->i_plugin_data
Gildas Bazin's avatar
 
Gildas Bazin committed
466
                + i_index - 1] )
467
            {
Gildas Bazin's avatar
 
Gildas Bazin committed
468 469 470 471 472 473 474 475
                vlc_value_t val;

                p_area->i_part = i_index - 1;

                /* Update the navigation variables without triggering
                 * a callback */
                val.i_int = p_area->i_part;
                var_Change( p_input, "chapter", VLC_VAR_SETVALUE, &val, NULL );
476 477 478 479 480 481 482
                break;
            }
        }
    }
#undef p_area

    p_input->stream.p_selected_area->i_tell =
483 484
        (off_t)p_vcd->i_sector * (off_t)VCD_DATA_SIZE
         - p_input->stream.p_selected_area->i_start;
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
    vlc_mutex_unlock( &p_input->stream.stream_lock );
}

/*****************************************************************************
 * VCDEntryPoints: Reads the information about the entry points on the disc.
 *****************************************************************************/
static int VCDEntryPoints( input_thread_t * p_input )
{
    thread_vcd_data_t *               p_vcd;
    byte_t *                          p_sector;
    entries_sect_t                    entries;
    uint16_t                          i_nb;
    int                               i, i_entry_index = 0;
    int                               i_previous_track = -1;

    p_vcd = (thread_vcd_data_t *) p_input->p_access_data;

    p_sector = malloc( VCD_DATA_SIZE * sizeof( byte_t ) );
    if( p_sector == NULL )
    {
        msg_Err( p_input, "not enough memory for entry points treatment" );
        return -1;
    }

Gildas Bazin's avatar
 
Gildas Bazin committed
509 510
    if( ioctl_ReadSectors( VLC_OBJECT(p_input), p_vcd->vcddev,
        VCD_ENTRIES_SECTOR, p_sector, 1, VCD_TYPE ) < 0 )
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
    {
        msg_Err( p_input, "could not read entry points sector" );
        free( p_sector );
        return( -1 );
    }

    memcpy( &entries, p_sector, CD_SECTOR_SIZE );
    free( p_sector );

    if( (i_nb = U16_AT( &entries.i_entries_nb )) > 500 )
    {
        msg_Err( p_input, "invalid entry points number" );
        return( -1 );
    }

    p_vcd->p_entries = malloc( sizeof( int ) * i_nb );
    if( p_vcd->p_entries == NULL )
    {
        msg_Err( p_input, "not enough memory for entry points treatment" );
        return -1;
    }

    if( strncmp( entries.psz_id, "ENTRYVCD", sizeof( entries.psz_id ) )
     && strncmp( entries.psz_id, "ENTRYSVD", sizeof( entries.psz_id ) ))
    {
        msg_Err( p_input, "unrecognized entry points format" );
        free( p_vcd->p_entries );
        return -1;
    }

    p_vcd->i_entries_nb = 0;

543
#define i_track BCD_TO_BIN(entries.entry[i].i_track)
Gildas Bazin's avatar
 
Gildas Bazin committed
544 545 546 547 548 549 550 551 552
    /* Reset the i_part_nb for each track */
    for( i = 0 ; i < i_nb ; i++ )
    {
        if( i_track <= p_input->stream.i_area_nb )
        {
            p_input->stream.pp_areas[i_track-1]->i_part_nb = 0;
        }
    }

553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
    for( i = 0 ; i < i_nb ; i++ )
    {
        if( i_track <= p_input->stream.i_area_nb )
        {
            p_vcd->p_entries[i_entry_index] =
                (MSF_TO_LBA2( BCD_TO_BIN( entries.entry[i].msf.minute ),
                              BCD_TO_BIN( entries.entry[i].msf.second ),
                              BCD_TO_BIN( entries.entry[i].msf.frame  ) ));
            p_input->stream.pp_areas[i_track-1]->i_part_nb ++;
            /* if this entry belongs to a new track */
            if( i_track != i_previous_track )
            {
                /* i_plugin_data is used to store the first entry of the area*/
                p_input->stream.pp_areas[i_track-1]->i_plugin_data =
                                                            i_entry_index;
                i_previous_track = i_track;
            }
Gildas Bazin's avatar
 
Gildas Bazin committed
570 571 572
            msg_Dbg( p_input, "entry point %i begins at LBA: %i",
                     i_entry_index, p_vcd->p_entries[i_entry_index] );

573 574 575 576 577 578 579 580
            i_entry_index ++;
            p_vcd->i_entries_nb ++;
        }
        else
            msg_Warn( p_input, "wrong track number found in entry points" );
    }
#undef i_track
    return 0;
581
}