📄 mp4.cpp
字号:
catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return 0;}extern "C" MP4Timestamp MP4GetTrackEditMediaStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditMediaStart( trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_TIMESTAMP;}extern "C" MP4Duration MP4GetTrackEditTotalDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditTotalDuration( trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION;}extern "C" bool MP4SetTrackEditMediaStart( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Timestamp startTime){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackEditMediaStart( trackId, editId, startTime); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" MP4Duration MP4GetTrackEditDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditDuration(trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_DURATION;}extern "C" bool MP4SetTrackEditDuration( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, MP4Duration duration){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackEditDuration(trackId, editId, duration); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" int8_t MP4GetTrackEditDwell( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetTrackEditDwell(trackId, editId); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return -1;}extern "C" bool MP4SetTrackEditDwell( MP4FileHandle hFile, MP4TrackId trackId, MP4EditId editId, bool dwell){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { ((MP4File*)hFile)->SetTrackEditDwell(trackId, editId, dwell); return true; } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4ReadSampleFromEditTime( /* input parameters */ MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, /* output parameters */ u_int8_t** ppBytes, u_int32_t* pNumBytes, MP4Timestamp* pStartTime, MP4Duration* pDuration, MP4Duration* pRenderingOffset, bool* pIsSyncSample){ MP4SampleId sampleId = MP4GetSampleIdFromEditTime( hFile, trackId, when, pStartTime, pDuration); return MP4ReadSample( hFile, trackId, sampleId, ppBytes, pNumBytes, NULL, NULL, pRenderingOffset, pIsSyncSample);}extern "C" MP4SampleId MP4GetSampleIdFromEditTime( MP4FileHandle hFile, MP4TrackId trackId, MP4Timestamp when, MP4Timestamp* pStartTime, MP4Duration* pDuration){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetSampleIdFromEditTime( trackId, when, pStartTime, pDuration); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return MP4_INVALID_SAMPLE_ID;}/* Utlities */extern "C" char* MP4BinaryToBase16( const u_int8_t* pData, u_int32_t dataSize){ if (pData || dataSize == 0) { try { return MP4ToBase16(pData, dataSize); } catch (MP4Error* e) { delete e; } } return NULL;}extern "C" char* MP4BinaryToBase64( const u_int8_t* pData, u_int32_t dataSize){ if (pData || dataSize == 0) { try { return MP4ToBase64(pData, dataSize); } catch (MP4Error* e) { delete e; } } return NULL;}/* iTunes meta data handling */extern "C" bool MP4GetMetadataByIndex(MP4FileHandle hFile, u_int32_t index, const char** ppName, u_int8_t** ppValue, u_int32_t* pValueSize){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataByIndex( index, ppName, ppValue, pValueSize); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4MetadataDelete(MP4FileHandle hFile){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->MetadataDelete(); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataName(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataName(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataName(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataName(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataWriter(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataWriter(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataWriter(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataWriter(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataAlbum(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataAlbum(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataAlbum(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataAlbum(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataArtist(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataArtist(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataArtist(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataArtist(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataTool(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataTool(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataTool(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataTool(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataComment(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataComment(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataComment(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataComment(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataYear(MP4FileHandle hFile, const char* value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataYear(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataYear(MP4FileHandle hFile, char** value){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataYear(value); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataTrack(MP4FileHandle hFile, u_int16_t track, u_int16_t totalTracks){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataTrack(track, totalTracks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataTrack(MP4FileHandle hFile, u_int16_t* track, u_int16_t* totalTracks){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataTrack(track, totalTracks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataDisk(MP4FileHandle hFile, u_int16_t disk, u_int16_t totalDisks){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataDisk(disk, totalDisks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataDisk(MP4FileHandle hFile, u_int16_t* disk, u_int16_t* totalDisks){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataDisk(disk, totalDisks); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataGenre(MP4FileHandle hFile, const char* genre){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataGenre(genre); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataGenre(MP4FileHandle hFile, char** genre){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataGenre(genre); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataTempo(MP4FileHandle hFile, u_int16_t tempo){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataTempo(tempo); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataTempo(MP4FileHandle hFile, u_int16_t* tempo){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataTempo(tempo); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataCompilation(MP4FileHandle hFile, u_int8_t cpl){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataCompilation(cpl); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataCompilation(MP4FileHandle hFile, u_int8_t* cpl){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataCompilation(cpl); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataCoverArt(MP4FileHandle hFile, u_int8_t *coverArt, u_int32_t size){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->SetMetadataCoverArt(coverArt, size); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4GetMetadataCoverArt(MP4FileHandle hFile, u_int8_t **coverArt, u_int32_t* size){ if (MP4_IS_VALID_FILE_HANDLE(hFile)) { try { return ((MP4File*)hFile)->GetMetadataCoverArt(coverArt, size); } catch (MP4Error* e) { PRINT_ERROR(e); delete e; } } return false;}extern "C" bool MP4SetMetadataFreeForm(MP4FileHandle hFile, char *name, u_int8_t*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -