Changeset 1114

Show
Ignore:
Timestamp:
07/26/09 00:01:19 (12 months ago)
Author:
astrange
Message:

Merge fixes from trunk to release branch.

This leaves the old resources in place, just in case.

Location:
branches/perian-1.1
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • branches/perian-1.1

  • branches/perian-1.1/Perian.xcodeproj/project.pbxproj

    r1101 r1114  
    15201520                        isa = PBXProject; 
    15211521                        buildConfigurationList = 11D4ED470A3CE59A0066D45F /* Build configuration list for PBXProject "Perian" */; 
    1522                         compatibilityVersion = "Xcode 2.4"; 
     1522                        compatibilityVersion = "Xcode 3.1"; 
    15231523                        hasScannedForEncodings = 1; 
    15241524                        knownRegions = ( 
  • branches/perian-1.1/Release/Changes.txt

    r1101 r1114  
    77Fixes: 
    88- Fixed "Load External Subtitles" checkbox [r998] 
    9 - Fixed crash/freeze when loading broken VobSub subtitles [r1000, 1034] 
     9- Fixed crash/freeze when loading broken VobSub subtitles [r1000, r1034] 
    1010- Fixed import of uncompressed audio in FLV [r1007] 
    11 - Fixed import of some audio tracks; should improve iApps [r1042,r1088] 
     11- Fixed import of some audio tracks; should improve iApps [r1042, r1088] 
    1212- Fixed CRAM codec AVI in browsers [r1010] 
    1313- Worked around bug in iChat codec loading [r1008] 
     
    2727- Fixed rendering of multi-layer subtitles [r1016] 
    2828- Fixed SRT files using ',' for decimals [r1019] 
    29 - Ignored SSA shapes and \blur instead of misparsing them [r1027, 1036] 
     29- Ignored SSA shapes and \blur instead of misparsing them [r1027, r1036] 
    3030- Disabled vertical font support again to fix files wrongly using it for Latin text [r1027] 
    3131- Fixed subtitles in MKV wrongly displaying at the end of a video [r1036] 
    32 - Fixed text position with \move [r1063] 
     32- Better handling of \move and \org [r1063, r1103] 
     33Notes: 
     34- Compilation under 10.4 is no longer supported. 
     35- AC3Codec has been deprecated and will be replaced by an LGPL decoder in a future release. 
    3336 
    34371.1.3 
  • branches/perian-1.1/Subtitles/SubATSUIRenderer.m

    r1101 r1114  
    10961096                const unichar *ubuffer = STUnicodeForString(div->text, &ubufferData); 
    10971097                 
    1098                 if (div->layer != lastLayer) { 
     1098                if (div->layer != lastLayer || div->shouldResetPens) { 
    10991099                        resetPens = YES; 
    11001100                        lastLayer = div->layer; 
  • branches/perian-1.1/Subtitles/SubImport.mm

    r1087 r1114  
    3131 
    3232extern "C" { 
    33         int ExtractVobSubPacket(UInt8 *dest, const UInt8 *framedSrc, int srcSize, int *usedSrcBytes); 
     33        int ExtractVobSubPacket(UInt8 *dest, const UInt8 *framedSrc, int srcSize, int *usedSrcBytes, int index); 
    3434} 
    3535 
     
    812812static OSErr loadTrackIntoMovie(VobSubTrack *track, VobSubInfo info, uint8_t onlyForced, Track *theTrack, uint8_t *hasForcedSubtitles) 
    813813{ 
     814        int sampleCount = [track->samples count]; 
     815        if(sampleCount == 0) 
     816                return noErr; 
     817         
    814818        ImageDescriptionHandle imgDesc; 
    815819        Media trackMedia = createVobSubMedia(info.theMovie, info.movieBox, &imgDesc, info.dataRef, info.dataRefType, track); 
     
    820824        } 
    821825         
    822         int sampleCount = [track->samples count]; 
    823826        int totalSamples = 0; 
    824827        SampleReference64Ptr samples = (SampleReference64Ptr)calloc(sampleCount*2, sizeof(SampleReference64Record)); 
     
    843846                NSData *subData = [info.subFileData subdataWithRange:NSMakeRange(offset, size)]; 
    844847                uint8_t *extracted = (uint8_t *)malloc(size); 
    845                 int extractedSize = ExtractVobSubPacket(extracted, (const UInt8 *)[subData bytes], size, &size); 
     848                //The index here likely should really be track->index, but I'm not sure we can really trust it. 
     849                int extractedSize = ExtractVobSubPacket(extracted, (const UInt8 *)[subData bytes], size, &size, -1); 
    846850                 
    847851                uint16_t startTimestamp, endTimestamp; 
     
    10301034                while((track = [trackEnum nextObject]) != nil) 
    10311035                { 
    1032                         Track theTrack; 
     1036                        Track theTrack = NULL; 
    10331037                        VobSubInfo info = {theMovie, dataRefType, dataRef, imageWidth, imageHeight, movieBox, subFileData}; 
    10341038                        uint8_t hasForced = 0; 
    10351039                        err = loadTrackIntoMovie(track, info, 0, &theTrack, &hasForced); 
    1036                         if(hasForced) 
     1040                        if(theTrack && hasForced) 
    10371041                        { 
    10381042                                Track forcedTrack; 
     
    10461050                        if (*firstSubTrack == NULL) 
    10471051                                *firstSubTrack = theTrack; 
    1048                         else 
     1052                        else if(theTrack) 
    10491053                                SetTrackAlternate(*firstSubTrack, theTrack); 
    10501054                } 
  • branches/perian-1.1/Subtitles/SubParsing.h

    r1081 r1114  
    3939        float posX, posY; 
    4040        UInt8 alignH, alignV, wrapStyle, render_complexity; 
    41         BOOL positioned; 
     41        BOOL positioned, shouldResetPens; 
    4242         
    4343        unsigned layer; 
  • branches/perian-1.1/Subtitles/SubParsing.m.rl

    r1081 r1114  
    359359                                        } 
    360360                                } 
     361                                 
     362                                action origin { 
     363                                        div->shouldResetPens = YES; 
     364                                } 
    361365 
    362366                                intnum = ("-"? [0-9]+) >paramset %setintnum; 
     
    405409                                                        |"move" move %position 
    406410                                                        |"t" parens 
    407                                                         |"org" parens 
     411                                                        |"org" parens %origin 
    408412                                                        |("fad" "e"? parens) 
    409413                                                        |"clip" parens 
  • branches/perian-1.1/VobSubCodec.c

    r1087 r1114  
    8383 
    8484// dest must be at least as large as src 
    85 int ExtractVobSubPacket(UInt8 *dest, UInt8 *framedSrc, int srcSize, int *usedSrcBytes); 
     85int ExtractVobSubPacket(UInt8 *dest, UInt8 *framedSrc, int srcSize, int *usedSrcBytes, int index); 
    8686static ComponentResult ReadPacketControls(UInt8 *packet, UInt32 palette[16], PacketControlData *controlDataOut); 
    8787extern void initLib(); 
     
    331331        } else if (data[0] + data[1] == 0) { 
    332332                // remove the MPEG framing 
    333                 myDrp->bufferSize = ExtractVobSubPacket(glob->codecData, data, myDrp->bufferSize, NULL); 
     333                myDrp->bufferSize = ExtractVobSubPacket(glob->codecData, data, myDrp->bufferSize, NULL, -1); 
    334334        } else { 
    335335                memcpy(glob->codecData, drp->codecData, myDrp->bufferSize); 
     
    442442} 
    443443 
    444 int ExtractVobSubPacket(UInt8 *dest, UInt8 *framedSrc, int srcSize, int *usedSrcBytes) { 
     444int ExtractVobSubPacket(UInt8 *dest, UInt8 *framedSrc, int srcSize, int *usedSrcBytes, int index) { 
    445445        int copiedBytes = 0; 
    446446        UInt8 *currentPacket = framedSrc; 
     
    483483                                 
    484484                                int header_data_length = currentPacket[8]; 
    485                                  
    486                                 memcpy(&dest[copiedBytes],  
    487                                            // header's 9 bytes + extension, we don't want 1st byte of packet 
    488                                            &currentPacket[9 + header_data_length + 1],  
    489                                            // we don't want the 1-byte stream ID, or the header 
    490                                            packet_length - 1 - (header_data_length + 3)); 
    491                                  
    492                                 if(packetSize == INT_MAX) 
     485                                int packetIndex = currentPacket[header_data_length + 9] & 0x1f; 
     486                                if(index == -1) 
     487                                        index = packetIndex; 
     488                                if(index == packetIndex) 
    493489                                { 
    494                                         packetSize = dest[0] << 8 | dest[1]; 
     490                                        int blockSize = packet_length - 1 - (header_data_length + 3); 
     491                                        memcpy(&dest[copiedBytes],  
     492                                                   // header's 9 bytes + extension, we don't want 1st byte of packet 
     493                                                   &currentPacket[9 + header_data_length + 1],  
     494                                                   // we don't want the 1-byte stream ID, or the header 
     495                                                   blockSize); 
     496                                        copiedBytes += blockSize; 
     497 
     498                                        if(packetSize == INT_MAX) 
     499                                        { 
     500                                                packetSize = dest[0] << 8 | dest[1]; 
     501                                        } 
    495502                                } 
    496                                 copiedBytes += packet_length - 1 - (header_data_length + 3); 
    497503                                currentPacket += packet_length + 6; 
    498504                                break;