📄 mp4meta.cpp
字号:
/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is MPEG4IP. * * The Initial Developer of the Original Code is Cisco Systems Inc. * Portions created by Cisco Systems Inc. are * Copyright (C) Cisco Systems Inc. 2001. All Rights Reserved. * * Contributor(s): * M. Bakker mbakker at nero.com * * Apple iTunes Metadata handling *//** The iTunes tagging seems to support any tag field name but there are some predefined fields, also known from the QuickTime format predefined fields (the ones I know of until now): - ﹏am : Name of the song/movie (string) - 〢RT : Name of the artist/performer (string) - ﹚rt : Name of the writer (string) - ゛lb : Name of the album (string) - ヾay : Year (4 bytes, e.g. "2003") (string) - ﹖oo : Tool(s) used to create the file (string) - ヽmt : Comment (string) - ゞen : Custom genre (string) - trkn : Tracknumber (8 byte string) 16 bit: empty 16 bit: tracknumber 16 bit: total tracks on album 16 bit: empty - disk : Disknumber (8 byte string) 16 bit: empty 16 bit: disknumber 16 bit: total number of disks 16 bit: empty - gnre : Genre (16 bit genre) (ID3v1 index + 1) - cpil : Part of a compilation (1 byte, 1 or 0) - tmpo : Tempo in BPM (16 bit) - covr : Cover art (xx bytes binary data) - ---- : Free form metadata, can have any name and any data**/#include "mp4common.h"bool MP4File::GetMetadataByIndex(u_int32_t index, const char** ppName, u_int8_t** ppValue, u_int32_t* pValueSize){ char s[256]; sprintf(s, "moov.udta.meta.ilst.*[%u].data.metadata", index); GetBytesProperty(s, ppValue, pValueSize); sprintf(s, "moov.udta.meta.ilst.*[%u]", index); MP4Atom* pParent = m_pRootAtom->FindAtom(s); *ppName = pParent->GetType(); /* check for free form tagfield */ if (memcmp(*ppName, "----", 4) == 0) { u_int8_t* pV; u_int32_t VSize = 0; char *pN; sprintf(s, "moov.udta.meta.ilst.*[%u].name.metadata", index); GetBytesProperty(s, &pV, &VSize); pN = (char*)malloc((VSize+1)*sizeof(char)); memset(pN, 0, (VSize+1)*sizeof(char)); memcpy(pN, pV, VSize*sizeof(char)); *ppName = pN; } return true;}bool MP4File::CreateMetadataAtom(const char* name){ char s[256]; char t[256]; sprintf(t, "udta.meta.ilst.%s.data", name); sprintf(s, "moov.udta.meta.ilst.%s.data", name); AddDescendantAtoms("moov", t); MP4Atom *pMetaAtom = m_pRootAtom->FindAtom(s); if (!pMetaAtom) return false; /* some fields need special flags set */ if (name[0] == '
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -