Changeset 708

Show
Ignore:
Timestamp:
09/28/07 20:17:09 (1 year ago)
Author:
astrange
Message:

Support for the MythTV NUV format.
Patch by John Sutherland (garionphx at gmail dot com)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/FFusionCodec.c

    r707 r708  
    451451    int index; 
    452452    CodecCapabilities *capabilities = p->capabilities; 
    453     Byte* myptr; 
    454453        long count = 0; 
    455454        Handle imgDescExt; 
     
    597596                                codecID = CODEC_ID_SNOW; 
    598597                                break; 
     598 
     599            case 'RJPG': 
     600            case 'NUV1': 
     601                codecID = CODEC_ID_NUV; 
     602                break; 
     603 
    599604                                 
    600605            default: 
     
    621626        // We also pass the FourCC since it allows the H263 hybrid decoder 
    622627        // to make the difference between the various flavours of DivX 
    623          
    624         myptr = (unsigned char *)&(glob->componentType); 
    625         glob->avContext->codec_tag = (myptr[3] << 24) + (myptr[2] << 16) + (myptr[1] << 8) + myptr[0]; 
     628        glob->avContext->codec_tag = Endian32_Swap(glob->componentType); 
    626629         
    627630                // avc1 requires the avcC extension 
     
    14531456                                err = GetComponentResource((Component)glob->self, codecInfoResourceType, kSnowCodecInfoResID, (Handle *)&tempCodecInfo); 
    14541457                                break; 
     1458 
     1459            case 'RJPG': 
     1460                err = GetComponentResource((Component)glob->self, codecInfoResourceType, kNuvCodecInfoResID, (Handle *)&tempCodecInfo); 
     1461                break; 
     1462 
    14551463                                 
    14561464            default:    // should never happen but we have to handle the case 
  • trunk/FFusionCodec.h

    r681 r708  
    5050#define kFRAPSCodecInfoResID            273 
    5151#define kSnowCodecInfoResID                     274 
     52#define kNuvCodecInfoResID                      275 
    5253 
    5354#define kFFusionCodecManufacturer       'Peri' 
  • trunk/FFusionCodec.r

    r681 r708  
    6363#define kFRAPSName              "Fraps" 
    6464#define kSnowName               "Snow" 
     65#define kNuvName                "NuppelVideo" 
    6566 
    6667// Codec names Resource ID 
     
    8586#define kFRAPSNameResID         273 
    8687#define kSnowNameResID          274 
     88#define kNuvNameResID           275 
    8789 
    8890// Codec infos Resource ID 
     
    107109#define kFRAPSInfoResID         302 
    108110#define kSnowInfoResID          303 
     111#define kNuvInfoResID           304 
    109112 
    110113// These flags specify information about the capabilities of the component 
     
    593596        0                                       // Private Data 
    594597}; 
     598 
     599//--------------------------------------------------------------------------- 
     600// Nuv Description Resources 
     601//--------------------------------------------------------------------------- 
     602 
     603resource 'cdci' (kNuvCodecInfoResID) { 
     604        kNuvName,                               // Type 
     605        1,                                      // Version 
     606        1,                                      // Revision level 
     607        kFFusionCodecManufacturer,                      // Manufacturer 
     608        kFFusionDecompressionFlags,             // Decompression Flags 
     609        0,                                      // Compression Flags 
     610        kFFusionFormatFlags,                    // Format Flags 
     611        128,                                    // Compression Accuracy 
     612        128,                                    // Decomression Accuracy 
     613        200,                                    // Compression Speed 
     614        200,                                    // Decompression Speed 
     615        128,                                    // Compression Level 
     616        0,                                      // Reserved 
     617        1,                                      // Minimum Height 
     618        1,                                      // Minimum Width 
     619        0,                                      // Decompression Pipeline Latency 
     620        0,                                      // Compression Pipeline Latency 
     621        0                                       // Private Data 
     622}; 
     623 
    595624 
    596625//--------------------------------------------------------------------------- 
     
    30033032 
    30043033//--------------------------------------------------------------------------- 
     3034// New Nuv Components 
     3035//--------------------------------------------------------------------------- 
     3036resource 'thng' (334) { 
     3037        decompressorComponentType,              // Type 
     3038        'RJPG',                                 // SubType 
     3039        kFFusionCodecManufacturer,                      // Manufacturer 
     3040        0,                                      // - use componentHasMultiplePlatforms 
     3041        0, 
     3042        0, 
     3043        0, 
     3044        'STR ',                                 // Name Type 
     3045        kNuvNameResID,                        // Name ID 
     3046        'STR ',                                 // Info Type 
     3047        kNuvInfoResID,                        // Info ID 
     3048        0,                                      // Icon Type 
     3049        0,                                      // Icon ID 
     3050        kFFusionCodecVersion,                   // Version 
     3051        componentHasMultiplePlatforms +         // Registration Flags  
     3052        componentDoAutoVersion,                 // Registration Flags 
     3053        0,                                      // Resource ID of Icon Family 
     3054{ 
     3055        kFFusionDecompressionFlags,  
     3056        'dlle',                         // Entry point found by symbol name 'dlle' resource 
     3057        256,                            // ID of 'dlle' resource 
     3058        platformPowerPCNativeEntryPoint, 
     3059        kFFusionDecompressionFlags, 
     3060        'dlle', 
     3061        256, 
     3062        platformIA32NativeEntryPoint, 
     3063}; 
     3064}; 
     3065 
     3066//--------------------------------------------------------------------------- 
     3067// Old Nuv Components 
     3068//--------------------------------------------------------------------------- 
     3069resource 'thng' (335) { 
     3070        decompressorComponentType,              // Type 
     3071        'NUV1',                                 // SubType 
     3072        kFFusionCodecManufacturer,                      // Manufacturer 
     3073        0,                                      // - use componentHasMultiplePlatforms 
     3074        0, 
     3075        0, 
     3076        0, 
     3077        'STR ',                                 // Name Type 
     3078        kNuvNameResID,                        // Name ID 
     3079        'STR ',                                 // Info Type 
     3080        kNuvInfoResID,                        // Info ID 
     3081        0,                                      // Icon Type 
     3082        0,                                      // Icon ID 
     3083        kFFusionCodecVersion,                   // Version 
     3084        componentHasMultiplePlatforms +         // Registration Flags  
     3085        componentDoAutoVersion,                 // Registration Flags 
     3086        0,                                      // Resource ID of Icon Family 
     3087{ 
     3088        kFFusionDecompressionFlags,  
     3089        'dlle',                         // Entry point found by symbol name 'dlle' resource 
     3090        256,                            // ID of 'dlle' resource 
     3091        platformPowerPCNativeEntryPoint, 
     3092        kFFusionDecompressionFlags, 
     3093        'dlle', 
     3094        256, 
     3095        platformIA32NativeEntryPoint, 
     3096}; 
     3097}; 
     3098 
     3099 
     3100//--------------------------------------------------------------------------- 
    30053101// Component Name Resources 
    30063102//--------------------------------------------------------------------------- 
     
    30823178}; 
    30833179 
     3180resource 'STR ' (kNuvNameResID) { 
     3181        "NuppelVideo (Perian)" 
     3182}; 
     3183 
    30843184//--------------------------------------------------------------------------- 
    30853185// Component Name Resources 
     
    31623262}; 
    31633263 
     3264resource 'STR ' (kNuvInfoResID) { 
     3265        "Decompresses video stored in NuppelVideo format." 
     3266}; 
     3267 
    31643268//--------------------------------------------------------------------------- 
    31653269// Code Entry Point for Mach-O 
  • trunk/PerianAviImporter.r

    r584 r708  
    322322}; 
    323323 
     324 
     325 
     326 
     327/* Component Manager Things -  
     328        Nuv */ 
     329resource 'thng' (kNuvthngResID) { 
     330        'eat ',                                 // Type 
     331        'NUV ',                                 // SubType 
     332        'Myth',                                 // Manufacturer 
     333        0, 
     334        0, 
     335        0, 
     336        0, 
     337        'STR ',                                         // Name Type 
     338        kNuvthngResID,                                          // Name ID 
     339        0,                                                      // Info Type 
     340        0,                                                      // Info ID 
     341        0,                                                      // Icon Type 
     342        0,                                                      // Icon ID 
     343        kFFAviComponentVersion,         // Version 
     344        componentHasMultiplePlatforms + 
     345        componentDoAutoVersion,         // Registratin Flags 
     346        0,                                                      // Resource ID of Icon Family 
     347{ 
     348        kFFAvi_MovieImportFlags | movieImportSubTypeIsFileExtension, 
     349        'dlle',                                 // Code Resource type 
     350        512, 
     351        platformIA32NativeEntryPoint,           // IA32 
     352        kFFAvi_MovieImportFlags | movieImportSubTypeIsFileExtension, 
     353        'dlle', 
     354        512, 
     355        platformPowerPCNativeEntryPoint,        // PowerPC 
     356}, 
     357'thnr', kNuvthngResID 
     358}; 
     359 
     360resource 'thnr' (kNuvthngResID) { 
     361{ 
     362        'mime', 1, 0, 
     363        'mime', kNuvthngResID, 0, 
     364} 
     365}; 
     366 
     367resource 'mime' (kNuvthngResID) { 
     368{ 
     369        kMimeInfoMimeTypeTag,           1, "audio/x-nuv"; 
     370        kMimeInfoFileExtensionTag,      1, "nuv"; 
     371        kMimeInfoDescriptionTag,        1, "NuppelVideo"; 
     372}; 
     373}; 
     374 
     375resource 'STR ' (kNuvthngResID) { 
     376        "NuppelVideo" 
     377}; 
     378 
     379 
     380 
     381 
    324382resource 'dlle' (512) { 
    325383        "FFAvi_MovieImportComponentDispatch" 
  • trunk/ff_MovieImport.c

    r706 r708  
    8888                REGISTER_DEMUXER(flv); 
    8989                REGISTER_DEMUXER(tta); 
     90                REGISTER_DEMUXER(nuv); 
    9091                register_parsers(); 
    9192                 
     
    108109                REGISTER_DECODER(fraps); 
    109110                REGISTER_DECODER(snow); 
     111                REGISTER_DECODER(nuv); 
    110112                 
    111113                REGISTER_DECODER(wmav1); 
     
    205207                        err = GetComponentResource((Component)storage->ci, 'mime', kTTAthngResID, (Handle*)mimeInfo); 
    206208                        break; 
     209                case 'NUV ': 
     210                        err = GetComponentResource((Component)storage->ci, 'mime', kNuvthngResID, (Handle*)mimeInfo); 
     211                        break; 
    207212                default: 
    208213                        err = GetComponentResource((Component)storage->ci, 'mime', kAVIthngResID, (Handle*)mimeInfo); 
  • trunk/ff_MovieImportVersion.h

    r584 r708  
    3131#define kFLVthngResID 515 
    3232#define kTTAthngResID 517 
     33#define kNuvthngResID 518 
    3334 
    3435#endif 
  • trunk/ff_private.c

    r702 r708  
    542542                if(st->codec->codec_type == CODEC_TYPE_VIDEO) { 
    543543                        track = NewMovieTrack(theMovie, st->codec->width << 16, st->codec->height << 16, kNoVolume); 
     544 
     545            // XXX Support for 'old' NUV files, that didn't put the codec_tag in the file.  
     546            if( st->codec->codec_id == CODEC_ID_NUV && st->codec->codec_tag == 0 ) { 
     547                st->codec->codec_tag = MKTAG( 'N', 'U', 'V', '1' ); 
     548            } 
     549                         
    544550                        initialize_video_map(&map[j], track, dataRef, dataRefType, storage->firstFrames + j); 
    545551                } else if (st->codec->codec_type == CODEC_TYPE_AUDIO) { 
     
    857863         
    858864        while((readResult = av_read_frame(formatContext, &packet)) == 0) {               
     865                bool trustPacketDuration = true; 
    859866                ncstream = &storage->stream_map[packet.stream_index]; 
    860867                stream = ncstream->str; 
     
    864871                if((packet.flags & PKT_FLAG_KEY) == 0) 
    865872                        flags |= mediaSampleNotSync; 
     873                 
     874                if(IS_NUV(storage->componentType) && codecContext->codec_id == CODEC_ID_MP3) trustPacketDuration = false; 
    866875                 
    867876                memset(&sampleRec, 0, sizeof(sampleRec)); 
     
    890899                } 
    891900                 
    892                 if(packet.duration == 0) { 
     901 
     902        // If this is a nuv file, then we want to set the duration to zero. 
     903        // This is because the nuv container doesn't have the framesize info  
     904        // for audio.  
     905 
     906                if(packet.duration == 0 || !trustPacketDuration) { 
    893907                        //no duration, we'll have to wait for the next packet to calculate it 
    894908                        // keep the duration of the last sample, so we can use it if it's the last frame 
  • trunk/ff_private.h

    r686 r708  
    119119 
    120120#define IS_AVI(x) (x == 'AVI ' || x == 'VfW ' || x == 'VFW ') 
     121#define IS_NUV(x) (x == 'NUV ') 
    121122 
    122123#endif