~ubuntu-branches/ubuntu/karmic/avidemux/karmic-proposed

« back to all changes in this revision

Viewing changes to avidemux/ADM_inputs/ADM_mpegdemuxer/dmx_demuxerTS.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2009-02-17 23:41:46 UTC
  • mfrom: (1.1.12 upstream)
  • Revision ID: james.westby@ubuntu.com-20090217234146-eakx254awuch4wgw
Tags: 1:2.4.4-0.0ubuntu1
* Merge from debian multimedia, Ubuntu remaining changes:
  - debian/control:
    + Build-Depends on newer libx264-dev.
    + Don't Build-Depends on ccache and libamrnb-dev.
    + Build-Depends on libpulse-dev.
    + Fixed small typo in avidemux description.
  - Don't use ccache.
  - Drop patch to fix build with newer x264, it has been merged by upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
#include <math.h>
36
36
 
37
37
#include "default.h"
38
 
#include <ADM_assert.h>
 
38
#include "ADM_assert.h"
39
39
 
40
40
//#define TS_VERBOSE 1
41
41
 
406
406
                        }
407
407
                        return 1;
408
408
                }
409
 
                // Udate info on that track
410
 
                updateTracker(pid,left);
411
 
                parser->forward(left);
 
409
 
 
410
                                parser->forward(left);
 
411
 
 
412
                // Update info on that track
 
413
                                if (TS_PacketSize == 192 && left > 4)
 
414
                                        left -= 4; // Remove timestamp of m2ts packet
 
415
 
 
416
                                updateTracker(pid,left);
 
417
                
412
418
                goto _againBranch;
413
419
        }
414
420
        // Payload present, read header
496
502
                }
497
503
                return 1;
498
504
        }
 
505
 
 
506
                parser->forward(left);
 
507
 
499
508
        // update info
 
509
                if (TS_PacketSize == 192 && left > 4)
 
510
                        left -= 4; // Remove timestamp of m2ts packet
 
511
 
500
512
        updateTracker(pid,left);
501
 
        parser->forward(left);
 
513
 
502
514
        goto _againBranch;
503
515
}
504
516
//***********************************
552
564
        pid=parser->read16i();
553
565
        if((pid>>8) & TS_UNIT_START) payloadunit=1;
554
566
        pid&=0x1fff; // remove flags
 
567
 
 
568
#ifdef TS_VERBOSE
555
569
        if(discarded)
556
570
                printf("Ts: Discontinuity of %lu at %"LLX" pid:%lx\n",discarded,abs,pid);
 
571
#endif
 
572
 
557
573
        // Start of packet..
558
574
        left=TS_PacketSize-3;
559
575
        if(_probeSize)
778
794
*/
779
795
uint8_t         dmx_demuxerTS::syncH264( uint8_t *stream,uint64_t *abs,uint64_t *r,uint64_t *pts,uint64_t *dts)
780
796
{
781
 
uint32_t val,hnt;
 
797
uint32_t hnt;
782
798
retry:
783
799
         *r=0;
784
800
 
785
 
                val=0;
786
 
                hnt=0;
787
 
 
788
 
                // preload
789
 
                hnt=(read8i()<<24) + (read8i()<<16) +(read8i()<<8)+(read8i());
790
 
                if(_lastErr)
791
 
                {
792
 
                        _lastErr=0;
793
 
                        printf("\n io error , aborting sync\n");
794
 
                        return 0;       
795
 
                }
796
 
 
797
 
                while((hnt!=1))
798
 
                {
799
 
 
800
 
                        hnt<<=8;
801
 
                        val=read8i();
802
 
                        hnt+=val;
 
801
                 hnt = (read8i() << 16) | (read8i() << 8) | read8i();
 
802
 
 
803
                while (hnt >> 8 != 1)
 
804
                {
 
805
                                        hnt = (hnt << 8) | read8i();
803
806
 
804
807
                        if(_lastErr)
805
808
                        {
807
810
                            printf("\n io error , aborting sync\n");
808
811
                            return 0;
809
812
                         }
810
 
 
811
813
                }
812
814
 
813
 
                *stream=read8i();
 
815
                                *stream = hnt;
 
816
 
814
817
                // Case 1 : assume we are still in the same packet
815
818
                if(_pesBufferIndex>=5)
816
819
                {
827
830
                                 { // previous Packet which len is very shoty
828
831
                                   // Ignore
829
832
                                   _pesBufferIndex=0;
830
 
                                   printf("Ignoring too short packet");
 
833
                                   printf("Ignoring too short packet\n");
831
834
                                   goto retry;
832
835
                                 }
833
836
                                 left=_oldPesLen-left;