~ubuntu-branches/ubuntu/trusty/dvd95/trusty

« back to all changes in this revision

Viewing changes to src/vaporize.c

  • Committer: Bazaar Package Importer
  • Author(s): William Grant
  • Date: 2007-11-10 08:33:32 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071110083332-pry0uz9nx4u1s1xz
Tags: 1.3p0-0ubuntu1
* New upstream release.
* debian/control:
  - Move homepage to Homepage field.
  - Comply with DebianMaintainerField.
  - Build-Depend on libmpeg-2-4-dev.
* debian/rules: Check if Makefile exists before cleaning, rather than
  ignoring all errors.
* Fix up .desktop:
  - debian/rules: Use dpatch.
  - debian/control: Build-Depend on dpatch.
  - debian/patches/01_fix_desktop_file.dpatch: Convince dvd95.desktop to
    comply with .desktop file standards.
* Add debian/watch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
193
193
pthread_mutex_t mutr  = PTHREAD_MUTEX_INITIALIZER;
194
194
pthread_mutex_t mutw  = PTHREAD_MUTEX_INITIALIZER;
195
195
 
196
 
/*@$#[vaporize.c] static proto. AutoProtoSigV1.1. date: 106/11/09 22:17:47 */
 
196
/*@$#[vaporize.c] static proto. AutoProtoSigV1.1. date: 107/06/20 22:33:08 */
197
197
#include "proto.h"
198
198
#ifdef __cplusplus
199
199
extern "C" {
208
208
static void write_injections PROTO((char *filename));
209
209
static void usage PROTO((void));
210
210
static void fatal PROTO((char *fmt, ...));
 
211
static void warning PROTO((char *fmt, ...));
211
212
#ifdef __cplusplus
212
213
}
213
214
#endif
597
598
 
598
599
  if (pack_start_code != 0x000001ba) {
599
600
        if( pack_start_code == 0 && IgnoreErrors ) {
600
 
                fprintf(stderr, "Bad pack start code at %llu: %08lx\n", rtell (ptr), pack_start_code);
 
601
                static int _Warn = 0;
 
602
                if( _Warn < 1000 ) { /* Avoid too many trace */
 
603
                        fprintf(stderr, "Bad pack start code at %llu: %08lx\n", rtell (ptr), pack_start_code);
 
604
                        _Warn++;
 
605
                }
601
606
                return( -1 ); /* Skip it */
602
607
        }
603
608
        fatal ("Bad pack start code at %llu: %08lx", rtell (ptr), pack_start_code);
662
667
      sequence_headers++;
663
668
    }
664
669
  }
665
 
 
666
 
  pad_packet_length = 0;
667
 
 
668
 
  if (14 + vid_packet_length < SECT_SIZE - 6)
669
 
  {
670
 
    // video packet does not fill whole sector
671
 
    // check for padding packet
672
 
    ptr += vid_packet_length;
673
 
 
674
 
    pad_packet_start_code  = (UInt32) (ptr [0]) << 24;
675
 
    pad_packet_start_code |= (UInt32) (ptr [1]) << 16;
676
 
    pad_packet_start_code |= (UInt32) (ptr [2]) <<  8;
677
 
    pad_packet_start_code |= (UInt32) (ptr [3]);
678
 
 
679
 
    if (pad_packet_start_code != 0x000001be)
680
 
      fatal ("Bad padding packet start code at %llu: %08lx",
681
 
             rtell (ptr + vid_packet_length), pad_packet_start_code);
682
 
 
683
 
    pad_packet_length  = ptr [4] << 8;
684
 
    pad_packet_length |= ptr [5];
685
 
    pad_packet_length += 6;
686
 
  }
687
 
 
688
 
  // length of video packet plus padding packet must always match sector size
689
 
  if (14 + vid_packet_length + pad_packet_length != SECT_SIZE)
690
 
    fatal ("Bad video packet length at %llu: vpl=%d ppl=%d",
691
 
           rtell (ptr), vid_packet_length, pad_packet_length );
692
 
 
 
670
/*  These errors seems to arrives with some old DVDs but the result is good !
 
671
        So we just emit a warning instead of an error
 
672
*/
 
673
        pad_packet_length = 0;
 
674
 
 
675
        if (14 + vid_packet_length < SECT_SIZE - 6) {
 
676
// video packet does not fill whole sector
 
677
// check for padding packet
 
678
                ptr += vid_packet_length;
 
679
 
 
680
                pad_packet_start_code  = (UInt32) (ptr [0]) << 24;
 
681
        pad_packet_start_code |= (UInt32) (ptr [1]) << 16;
 
682
        pad_packet_start_code |= (UInt32) (ptr [2]) <<  8;
 
683
        pad_packet_start_code |= (UInt32) (ptr [3]);
 
684
 
 
685
        pad_packet_length  = ptr [4] << 8;
 
686
        pad_packet_length |= ptr [5];
 
687
        pad_packet_length += 6;
 
688
 
 
689
        if (pad_packet_start_code != 0x000001be)
 
690
                warning("Bad padding packet start code at %llu: %08x vid_packet_length: %d pad_packet_length: %d",
 
691
                        rtell(ptr + vid_packet_length),
 
692
                        pad_packet_start_code,
 
693
                        vid_packet_length,
 
694
                        pad_packet_length );
 
695
 
 
696
        }
 
697
 
 
698
// length of video packet plus padding packet must always match sector size
 
699
        if( 14 + vid_packet_length + pad_packet_length != SECT_SIZE)
 
700
                warning("Bad video packet length at %llu: vpl=%d ppl=%d",
 
701
                        rtell(ptr), vid_packet_length, pad_packet_length );
693
702
  return rc;
694
703
}
695
704
 
925
934
                 rtell (ptr), data_length);
926
935
 
927
936
        break;
928
 
 
929
937
      default:
930
938
        fatal ("Encountered stream ID %02x at %llu, "
931
939
               "probably bad MPEG2 program stream", id, rtell (ptr));
1467
1475
}
1468
1476
 
1469
1477
 
 
1478
static void
 
1479
warning (char *fmt, ...)
 
1480
{
 
1481
        va_list ap;
 
1482
        char buffer[1024];
 
1483
 
 
1484
        fprintf (stderr, "%s: Warning: ", progname);
 
1485
 
 
1486
        va_start (ap, fmt);
 
1487
        vsnprintf( buffer, sizeof(buffer), fmt, ap);
 
1488
        fprintf(stderr,"%s\n", buffer );
 
1489
        va_end (ap);
 
1490
}
 
1491
 
 
1492