2016-07-05 36 views
0

我試圖從m4p文件中提取元數據時,遇到了使用表單Apple Quicktime Control的問題。C# - 使用QTLibrary控件獲取m4p元數據問題

我有持有單個文件的文件路徑字符串數組,然後我通過他們循環如下:

foreach (string file in files) 
{ 
    axQTControl1.URL = file; 

    // Create new movie object 
    QTOLibrary.QTMovie mov = new QTOLibrary.QTMovie(); 
    mov = axQTControl1.Movie; 

    string title = mov.get_Annotation((int)QTAnnotationEnum.qtAnnotationFullName); 
} 

不過,我碰到的問題,真正的方法我可以調用從我的QTMovie對象包括get_Dimensionsget_Rectangle

根據this tutorial, however,我應該能夠使用get_Annotation來拉取元數據。

我很難找到關於此的任何文檔,該教程是關於我得到的唯一幫助。如果任何人有任何想法或鏈接,讓我走在正確的方向,這將不勝感激。

回答

0

我找到了解決方案。這適用於m4a和m4p文件,也可能適用於其他文件,但我沒有測試過m4b等。

using QTOLibrary; 

foreach (string file in files) 
{ 
    axQTControl1.URL = file; 

    // Create new movie object 
    QTOLibrary.QTMovie mov = new QTOLibrary.QTMovie(); 
    mov = axQTControl1.Movie; 

    string title = mov.Annotation[(int)QTAnnotationsEnum.qtAnnotationFullName]; 
    string artist = mov.Annotation[(int)QTAnnotationsEnum.qtAnnotationArtist]; 
    string album = mov.Annotation[(int)QTAnnotationsEnum.qtAnnotationAlbum]; 
    songs.Add(new Song(title, album, artist, file)); 
    WriteLine("Evaluated " + title); 
} 

// Make sure the previous file is not in use 
// This will prevent an IOException when the file is in use and cannot be moved 
axQTControl1.URL = "";