locked
Setting PKEY_Media_DateEncoded for M4A files does not appear to work RRS feed

  • Question

  • Hello,

    I am creating an M4A audio file and attempting to set the metadata such as title, artist, date created etc etc. I am able to set and read back all metadata correctly except PKEY_Media_DateEncoded. I have used the following code path to set this value:

    SYSTEMTIME sysTime;
    FILETIME fileTime;
    GetSystemTime(&sysTime);
    SystemTimeToFileTime(&sysTime, &fileTime);
    PROPVARIANT varDate = {VT_EMPTY};
    PROPVARIANT testVarDate = {VT_EMPTY};
    
    // I am testing the value of hr in each case
    hr = InitPropVariantFromFileTime(&fileTime, &varDate);
    
    // shelMetadata is an IPropertyStore
    hr = shellMetadata->SetValue(PKEY_Media_DateEncoded, varDate);
    
    // Checking if the value has been set correctly. This returns the expected value.
    hr = shellMetadata->GetValue(PKEY_Media_DateEncoded, &testVarDate);
    if(SUCCEEDED(hr) && varDate.vt != VT_EMPTY)
    {
        WCHAR date[128];
        PropVariantToString(varDate, date, 128);
    }
    

    I read the date using the following code:

    PROPVARIANT varDate = {VT_EMPTY};
    
    // hr returns as S_OK but varDate is returned as VT_EMPTY which according to the doc means that the tag was not found.
    hr = shellMetadata->GetValue(PKEY_Media_DateEncoded, &varDate);
    

    Also, the MFMediaPropDump output also shows this tag missing.

    Is this a known issue?

    Regards,

    Dinesh

    Monday, December 12, 2011 10:39 PM

All replies

  • What happens when you try to edit the 'media created' time using explorer (right click the file, go to properties, details tab)? This value corresponds to the property key PKEY_Media_DateEncoded. I added this value to several .m4a files I have and did not have any problems. Is it only this one piece of content that has the problem?
    Friday, January 6, 2012 8:01 PM