Changeset 141
- Timestamp:
- 10/01/06 23:41:16 (2 years ago)
- Files:
-
- trunk/MatroskaCodecIDs.cpp (modified) (1 diff)
- trunk/MatroskaCodecIDs.h (modified) (3 diffs)
- trunk/MkvImportPrivate.cpp (modified) (2 diffs)
- trunk/MkvMovieSetup.cpp (modified) (3 diffs)
- trunk/Perian.xcodeproj/project.pbxproj (modified) (7 diffs)
- trunk/VobSubCodec.c (added)
- trunk/VobSubCodec.h (added)
- trunk/VobSubCodec.r (added)
- trunk/VobSubCodecDispatch.h (added)
- trunk/exportedSymbols (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/MatroskaCodecIDs.cpp
r119 r141 204 204 } 205 205 206 // VobSub stores the .idx file in the codec private, pass it as an .IDX extension 207 ComponentResult DescExt_VobSub(KaxTrackEntry *tr_entry, SampleDescriptionHandle desc, DescExtDirection dir) 208 { 209 if (!tr_entry || !desc) return paramErr; 210 ImageDescriptionHandle imgDesc = (ImageDescriptionHandle) desc; 211 212 if (dir == kToSampleDescription) { 213 KaxCodecPrivate *codecPrivate = FindChild<KaxCodecPrivate>(*tr_entry); 214 if (codecPrivate == NULL) 215 return invalidAtomErr; 216 217 Handle imgDescExt = NewHandle(codecPrivate->GetSize()); 218 memcpy(*imgDescExt, codecPrivate->GetBuffer(), codecPrivate->GetSize()); 219 220 AddImageDescriptionExtension(imgDesc, imgDescExt, '.IDX'); 221 222 DisposeHandle((Handle) imgDescExt); 223 } 224 return noErr; 225 } 226 206 227 ComponentResult ASBDExt_AC3(KaxTrackEntry *tr_entry, AudioStreamBasicDescription *asbd) 207 228 { trunk/MatroskaCodecIDs.h
r119 r141 158 158 #if 0 159 159 { kBMPCodecType, "S_IMAGE/BMP" }, 160 { kSubFormatUTF8, "S_TEXT/UTF8" },161 160 { kSubFormatSSA, "S_TEXT/SSA" }, 162 161 { kSubFormatASS, "S_TEXT/ASS" }, 163 162 { kSubFormatUSF, "S_TEXT/USF" }, 164 { kSubFormatVobSub, "S_TEXT/VOBSUB" },165 163 #endif 164 { kSubFormatUTF8, "S_TEXT/UTF8" }, 165 { kSubFormatVobSub, "S_VOBSUB" }, 166 166 }; 167 167 … … 204 204 ComponentResult DescExt_XiphVorbis(KaxTrackEntry *tr_entry, SampleDescriptionHandle desc, DescExtDirection dir); 205 205 ComponentResult DescExt_XiphFLAC(KaxTrackEntry *tr_entry, SampleDescriptionHandle desc, DescExtDirection dir); 206 ComponentResult DescExt_VobSub(KaxTrackEntry *tr_entry, SampleDescriptionHandle desc, DescExtDirection dir); 206 207 207 208 struct CodecDescExtFunc { … … 213 214 { kH264CodecType, DescExt_H264 }, 214 215 { kAudioFormatXiphVorbis, DescExt_XiphVorbis }, 215 { kAudioFormatXiphFLAC, DescExt_XiphFLAC } 216 { kAudioFormatXiphFLAC, DescExt_XiphFLAC }, 217 { kSubFormatVobSub, DescExt_VobSub } 216 218 }; 217 219 trunk/MkvImportPrivate.cpp
r138 r141 523 523 MkvTrackPtr mkvTrack = &priv->segments[i].tracks[j]; 524 524 525 if (mkvTrack->theTrack ) {525 if (mkvTrack->theTrack && mkvTrack->trackType != track_subtitle) { 526 526 if (mkvTrack->trackType == track_video) { 527 527 err = AddSampleTableToMedia(mkvTrack->theMedia, … … 624 624 } 625 625 626 // subtitle tracks usually have gaps, so we need to add it to the track regardless 627 if (mkvTrack->trackType == track_subtitle) 628 addToTrack = true; 629 626 630 if (addToTrack) { 627 631 if (mkvTrack->trackType == track_video) { trunk/MkvMovieSetup.cpp
r119 r141 47 47 #include <matroska/KaxTrackAudio.h> 48 48 #include <matroska/KaxTrackVideo.h> 49 #include <matroska/KaxContentEncoding.h> 49 50 50 51 using namespace std; … … 530 531 { 531 532 ComponentResult err = noErr; 532 533 Fixed trackWidth, trackHeight; 534 Fixed horizontalOffset, verticalOffset; 535 Rect movieBox; 536 MediaHandler mh; 537 ImageDescriptionHandle imgDesc = (ImageDescriptionHandle) NewHandleClear(sizeof(ImageDescription)); 538 539 // we assume that a video track has already been created, so we can set the subtitle track 540 // to have the same dimensions as it. Note that this doesn't work so well with multiple 541 // video tracks with different dimensions; but QuickTime doesn't expect that; how should we handle them? 542 GetMovieBox(theMovie, &movieBox); 543 trackWidth = IntToFixed(movieBox.right - movieBox.left); 544 trackHeight = IntToFixed(movieBox.bottom - movieBox.top); 545 546 (*imgDesc)->idSize = sizeof(ImageDescription); 547 (*imgDesc)->cType = GetFourCC(tr_entry); 548 (*imgDesc)->frameCount = 1; 549 (*imgDesc)->depth = 32; 550 (*imgDesc)->clutID = -1; 551 552 if ((*imgDesc)->cType == kSubFormatVobSub) { 553 int width, height; 554 555 // bitmap width & height is in the codec private in text format 556 KaxCodecPrivate *idxFile = FindChild<KaxCodecPrivate>(*tr_entry); 557 string idxFileStr((char *)idxFile->GetBuffer(), idxFile->GetSize()); 558 string::size_type loc = idxFileStr.find("size:", 0); 559 if (loc == string::npos) { 560 // we can't continue without bitmap width/height 561 err = invalidTrack; 562 goto bail; 563 } 564 sscanf(&idxFileStr.c_str()[loc], "size: %dx%d", &width, &height); 565 (*imgDesc)->width = width; 566 (*imgDesc)->height = height; 567 568 } else if ((*imgDesc)->cType == kSubFormatUTF8) { 569 (*imgDesc)->width = FixedToInt(trackWidth); 570 (*imgDesc)->height = FixedToInt(trackWidth); 571 572 } else { 573 err = invalidTrack; 574 goto bail; 575 } 576 577 mkvTrack->theTrack = NewMovieTrack(theMovie, trackWidth, trackHeight, kNoVolume); 578 if (mkvTrack->theTrack == NULL) { 579 err = GetMoviesError(); 580 goto bail; 581 } 582 583 mkvTrack->theMedia = NewTrackMedia(mkvTrack->theTrack, VideoMediaType, 584 GetMovieTimeScale(theMovie), dataRef, dataRefType); 585 if (mkvTrack->theMedia == NULL) { 586 err = GetMoviesError(); 587 goto bail; 588 } 589 590 // this sets up anything else needed in the description for the specific codec. 591 FinishSampleDescription(tr_entry, (SampleDescriptionHandle) imgDesc); 592 593 // finally, say that we're transparent 594 mh = GetMediaHandler(mkvTrack->theMedia); 595 MediaSetGraphicsMode(mh, graphicsModePreWhiteAlpha, NULL); 596 597 // and save our sample description 598 mkvTrack->sampleHdl = (SampleDescriptionHandle) imgDesc; 599 600 bail: 601 if (err) DisposeHandle((Handle) imgDesc); 533 602 return err; 534 603 } … … 539 608 if (tr_codec == NULL) 540 609 return 0; 610 611 // how should we handle compressed tracks? 612 KaxContentEncodings *contentEncs = FindChild<KaxContentEncodings>(*tr_entry); 613 if (contentEncs) { 614 return 'COMP'; 615 } 541 616 542 617 string codecString(*tr_codec); trunk/Perian.xcodeproj/project.pbxproj
r140 r141 52 52 11C85FE60A64314500DF3D73 /* FFusionCodec.r in Rez */ = {isa = PBXBuildFile; fileRef = F560DF0203D622D001ABA332 /* FFusionCodec.r */; }; 53 53 11C85FE70A64315500DF3D73 /* Perian-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 11A709DA0A3CFCB6002058D4 /* Perian-Info.plist */; }; 54 6123D6260AD0A3FF003EDE52 /* VobSubCodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 6123D6220AD0A3FE003EDE52 /* VobSubCodec.c */; }; 55 6123D6270AD0A3FF003EDE52 /* VobSubCodec.r in Rez */ = {isa = PBXBuildFile; fileRef = 6123D6240AD0A3FE003EDE52 /* VobSubCodec.r */; }; 54 56 61CB11200ACDF3A2007994BD /* Debug.h in Headers */ = {isa = PBXBuildFile; fileRef = 61CB11070ACDF3A2007994BD /* Debug.h */; }; 55 57 61CB11210ACDF3A2007994BD /* EbmlBinary.h in Headers */ = {isa = PBXBuildFile; fileRef = 61CB11080ACDF3A2007994BD /* EbmlBinary.h */; }; … … 229 231 11D4EFA20A3CE8C10066D45F /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = build/Universal/libavutil.a; sourceTree = "<group>"; }; 230 232 11D4EFA30A3CE8C10066D45F /* libpostproc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libpostproc.a; path = build/Universal/libpostproc.a; sourceTree = "<group>"; }; 233 6123D6220AD0A3FE003EDE52 /* VobSubCodec.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = VobSubCodec.c; sourceTree = "<group>"; }; 234 6123D6230AD0A3FE003EDE52 /* VobSubCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VobSubCodec.h; sourceTree = "<group>"; }; 235 6123D6240AD0A3FE003EDE52 /* VobSubCodec.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = VobSubCodec.r; sourceTree = "<group>"; }; 236 6123D6250AD0A3FF003EDE52 /* VobSubCodecDispatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = VobSubCodecDispatch.h; sourceTree = "<group>"; }; 231 237 61CB10FF0ACDF350007994BD /* libebml.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libebml.a; sourceTree = BUILT_PRODUCTS_DIR; }; 232 238 61CB11070ACDF3A2007994BD /* Debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Debug.h; path = libebml/ebml/Debug.h; sourceTree = "<group>"; }; … … 425 431 isa = PBXGroup; 426 432 children = ( 433 6123D6240AD0A3FE003EDE52 /* VobSubCodec.r */, 427 434 61D691590AC8E382000EFC7D /* MatroskaImport.r */, 428 435 61D691540AC8E382000EFC7D /* MatroskaExport.r */, … … 441 448 children = ( 442 449 61D691460AC8E333000EFC7D /* Matroska */, 450 6123D61D0AD0A052003EDE52 /* Subtitles */, 443 451 11C85ED30A641E6400DF3D73 /* ff_dataref.c */, 444 452 8F483BBC0A642B3D002CCA73 /* ff_MovieImportDispatch.h */, … … 465 473 ); 466 474 name = Products; 475 sourceTree = "<group>"; 476 }; 477 6123D61D0AD0A052003EDE52 /* Subtitles */ = { 478 isa = PBXGroup; 479 children = ( 480 6123D6220AD0A3FE003EDE52 /* VobSubCodec.c */, 481 6123D6230AD0A3FE003EDE52 /* VobSubCodec.h */, 482 6123D6250AD0A3FF003EDE52 /* VobSubCodecDispatch.h */, 483 ); 484 name = Subtitles; 467 485 sourceTree = "<group>"; 468 486 }; … … 799 817 11C85FE60A64314500DF3D73 /* FFusionCodec.r in Rez */, 800 818 61CB12260ACE1074007994BD /* MatroskaImport.r in Rez */, 819 6123D6270AD0A3FF003EDE52 /* VobSubCodec.r in Rez */, 801 820 ); 802 821 runOnlyForDeploymentPostprocessing = 0; … … 848 867 61CB120C0ACE0F8A007994BD /* DataHandlerCallback.cpp in Sources */, 849 868 61CB120D0ACE0F8D007994BD /* MatroskaCodecIDs.cpp in Sources */, 869 6123D6260AD0A3FF003EDE52 /* VobSubCodec.c in Sources */, 850 870 ); 851 871 runOnlyForDeploymentPostprocessing = 0; trunk/exportedSymbols
r23 r141 1 1 _FFusionCodecComponentDispatch 2 2 _FFAvi_MovieImportComponentDispatch 3 _MatroskaImportComponentDispatch 4 _VobSubCodecComponentDispatch
