DVD Source for C++

// include the LEAD Multimedia TOOLKIT header 
#include "ltmm.h" 
 
void SetDVDSettings() 
{ 
   // Create the converter object 
   IltmmConvert* pConvert; 
   IUnknown* punk; 
   IltmmDVDSource* pDVDSource; 
   HRESULT hr = CoCreateInstance(CLSID_ltmmConvert, NULL, CLSCTX_INPROC_SERVER, IID_IltmmConvert, (void**) &pConvert); 
   if(FAILED(hr)) 
   { 
      AfxMessageBox(_T("Can't instantiate convert library")); 
      return; 
   } 
 
   // Force the DVD source to be used 
   pConvert->put_UseDVDSource(VARIANT_TRUE); 
 
   // Set the source DVD image 
   BSTR bstr = ::SysAllocString(MAKE_MEDIA_PATH("video_ts.ifo")); 
   pConvert->put_SourceFile(bstr); 
   SysFreeString(bstr); 
 
   bstr = ::SysAllocString(MAKE_MEDIA_PATH("DVDImage.avi")); 
   pConvert->put_TargetFile(bstr); 
   SysFreeString(bstr); 
 
   // Get the DVD source interface 
   pConvert->GetSubObject(ltmmConvert_Object_SourceFilter, &punk); 
   if(punk) 
   {    
      punk->QueryInterface(IID_IltmmDVDSource, (void**)&pDVDSource); 
 
      if(pDVDSource) 
      { 
         IltmmDVDTitle *pTitle; 
         long lCount; 
         long lVal; 
         VARIANT_BOOL vbVal; 
         double dVal; 
         BSTR strPlayList; 
 
         // Select the main title for the disk 
         pDVDSource->get_Selected(&lVal); 
         if (lVal != ltmmDVDSource_Main_Selected) 
            pDVDSource->put_Selected(ltmmDVDSource_Main_Selected); 
 
         // Get the disc duration 
         pDVDSource->get_TotalDuration(&dVal); 
         // Do something with the value 
 
         // Get the selected title duration 
         pDVDSource->get_SelectedDuration(&dVal); 
         // Do something with the value 
 
         // Get the play list settings 
         pDVDSource->get_PlayList(&strPlayList); 
         // You can save this to a file and restore the settings later 
 
         // Restore the playlist settings 
         pDVDSource->put_PlayList(strPlayList); 
 
         // Free the string 
         SysFreeString(strPlayList); 
 
         // Get the title count in the disc 
         pDVDSource->get_TitleCount(&lCount); 
         for (int i = 0; i < lCount; i++) 
         { 
            // Get the title interface 
            pDVDSource->GetTitle(i, &pTitle); 
            if (pTitle) 
            { 
               // Get the X aspect 
               pTitle->get_AspectX(&lVal); 
               // Do something with the value 
 
               // Get the Y aspect 
               pTitle->get_AspectY(&lVal); 
               // Do something with the value 
 
               // Determine whether the title is in film mode or camera mode 
               pTitle->get_IsFilmMode(&vbVal); 
               // Do something with the value 
 
               // Determine whether there is user data in line 21, field 1 
               pTitle->get_Line21Field1InGOP(&vbVal); 
               // Do something with the value 
 
               // Determine whether there is user data in line 21, field 2 
               pTitle->get_Line21Field2InGOP(&vbVal); 
               // Do something with the value 
 
 
               // Get the compression  
               pTitle->get_Compression(&lVal); 
               // Do something with the value 
 
               // Get the X source resolution 
               pTitle->get_SourceResolutionX(&lVal); 
               // Do something with the value 
 
               // Get the Y source resolution 
               pTitle->get_SourceResolutionY(&lVal); 
               // Do something with the value 
 
               // Get the Frame Height 
               pTitle->get_FrameHeight(&lVal); 
               // Do something with the value 
               // Get the Frame Rate 
 
               pTitle->get_FrameRate(&lVal); 
               // Do something with the value 
 
               // Determine whether the source is letter boxed 
               pTitle->get_IsSourceLetterboxed(&vbVal); 
               // Do something with the value 
 
               // Determine whether the picture can be shown as letterbox  
               pTitle->get_LetterboxPermitted(&vbVal); 
               // Do something with the value 
 
               // Determine whether the picture can be shown as pan-scan 
               pTitle->get_PanscanPermitted(&vbVal); 
               // Do something with the value 
 
               // Get the title duration 
               pTitle->get_TotalDuration(&dVal); 
               // Do something with the value 
 
               // Select all title chapters 
               pTitle->get_Selected(&lVal); 
               if (lVal != ltmmDVDSource_Selected) 
                  pTitle->put_Selected(ltmmDVDSource_Selected); 
 
               // Get the selected chapter's duration 
               pTitle->get_SelectedDuration(&dVal); 
               // Do something with the value 
 
               // Get the audio stream count for the title 
               pTitle->get_AudioStreamCount(&lVal); 
               if (lVal > 0) 
               { 
                  // Select the first audio stream 
                  pTitle->get_SelectedAudioStream(&lVal); 
                  if (lVal == -1) 
                   pTitle->put_SelectedAudioStream(0); 
                  // Get the first audio stream 
                  IltmmDVDAudioStream* pAudioStream; 
                  pTitle->GetAudioStream(0, &pAudioStream); 
                  if (pAudioStream) 
                  { 
                     // Select the audio stream 
                     pAudioStream->get_Selected(&vbVal); 
                     if (vbVal == VARIANT_FALSE) 
                        pAudioStream->put_Selected(VARIANT_TRUE); 
 
                     // Get the application mode 
                     pAudioStream->get_AppMode(&lVal); 
                     // Do something with the value 
 
                     // Get the application mode data 
                     pAudioStream->get_AppModeData(&lVal); 
                     // Do something with the value 
 
                     // Get the audio format 
                     pAudioStream->get_AudioFormat(&lVal); 
                     // Do something with the value 
 
                     // Get the number of channels 
                     pAudioStream->get_Channels(&lVal); 
                     // Do something with the value 
 
                     // Get the frequency 
                     pAudioStream->get_Frequency(&lVal); 
                     // Do something with the value 
 
                     // Get the language 
                     pAudioStream->get_Language(&lVal); 
                     // Do something with the value 
 
                     // Get the language extension 
                     pAudioStream->get_LanguageExtension(&lVal); 
                     // Do something with the value 
 
                     // Get the quantization 
                     pAudioStream->get_Quantization(&lVal); 
                     // Do something with the value 
 
                     // Free the pointer 
                     pAudioStream->Release(); 
                  } 
               } 
 
               // Get the subpicture stream count 
               pTitle->get_SubpictureStreamCount(&lVal); 
               if (lVal > 0) 
               { 
                  // Select the first subpicture stream 
                  pTitle->get_SelectedSubpictureStream(&lVal); 
                  if (lVal == -1) 
                     pTitle->put_SelectedSubpictureStream(0); 
 
                  // Get the first subpicture stream 
                  IltmmDVDSubpictureStream* pSubpictureStream; 
                  pTitle->GetSubpictureStream(0, &pSubpictureStream); 
 
                  if (pSubpictureStream) 
                  { 
                     // Select the subpicture stream 
                     pSubpictureStream->get_Selected(&vbVal); 
                     if (vbVal == VARIANT_FALSE) 
                        pSubpictureStream->put_Selected(VARIANT_TRUE); 
 
                     // Get the coding mode 
                     pSubpictureStream->get_CodingMode(&lVal); 
                     // Do something with the value 
 
                     // Get the langauge 
                     pSubpictureStream->get_Language(&lVal); 
                     // Do something with the value 
 
                     // Get the language extension 
                     pSubpictureStream->get_LanguageExtension(&lVal); 
                     // Do something with the value 
 
                     // Get the type 
                     pSubpictureStream->get_Type(&lVal); 
                     // Do something with the value 
 
                     // Free the pointer 
                     pSubpictureStream->Release(); 
                  } 
               } 
               // Get the chapter count 
               pTitle->get_ChapterCount(&lVal); 
               if (lVal > 0) 
               { 
                  // Get the first chapter 
                  IltmmDVDChapter* pChapter; 
                  pTitle->GetChapter(0, &pChapter); 
 
                  // Get the chapter duration 
                  pChapter->get_Duration(&dVal); 
 
                  // Determine whether the chapter is selected 
                  pChapter->get_Selected(&vbVal); 
                  if (vbVal == VARIANT_FALSE) 
                     pChapter->put_Selected(VARIANT_TRUE); 
 
                  // Free the pointer 
                  pChapter->Release(); 
               } 
               pTitle->Release(); 
            } 
         } 
         pDVDSource->Release(); 
      } 
      punk->Release(); 
   } 
   pConvert->Release(); 
} 
Help Version 20.0.2019.9.19
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help