2016-07-05 31 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 = "";