| 1 | /* BoCA - BonkEnc Component Architecture |
| 2 | * Copyright (C) 2007-2026 Robert Kausch <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation, either version 2 of |
| 7 | * the License, or (at your option) any later version. |
| 8 | * |
| 9 | * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR |
| 10 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 11 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ |
| 12 | |
| 13 | #include <boca.h> |
| 14 | #include "dllinterface.h" |
| 15 | |
| 16 | using namespace BoCA; |
| 17 | |
| 18 | MP4MODIFY ex_MP4Modify = NIL; |
| 19 | MP4CLOSE ex_MP4Close = NIL; |
| 20 | MP4OPTIMIZE ex_MP4Optimize = NIL; |
| 21 | |
| 22 | MP4FINDTRACKID ex_MP4FindTrackId = NIL; |
| 23 | MP4SETTRACKINTEGERPROPERTY ex_MP4SetTrackIntegerProperty = NIL; |
| 24 | |
| 25 | DynamicLoader *mp4v2dll = NIL; |
| 26 | |
| 27 | Bool LoadMP4v2DLL() |
| 28 | { |
| 29 | mp4v2dll = BoCA::Utilities::LoadCodecDLL("mp4v2"); |
| 30 | |
| 31 | if (mp4v2dll == NIL) return False; |
| 32 | |
| 33 | ex_MP4Modify = (MP4MODIFY) mp4v2dll->GetFunctionAddress("MP4Modify"); |
| 34 | ex_MP4Close = (MP4CLOSE) mp4v2dll->GetFunctionAddress("MP4Close"); |
| 35 | ex_MP4Optimize = (MP4OPTIMIZE) mp4v2dll->GetFunctionAddress("MP4Optimize"); |
| 36 | |
| 37 | ex_MP4FindTrackId = (MP4FINDTRACKID) mp4v2dll->GetFunctionAddress("MP4FindTrackId"); |
| 38 | ex_MP4SetTrackIntegerProperty = (MP4SETTRACKINTEGERPROPERTY) mp4v2dll->GetFunctionAddress("MP4SetTrackIntegerProperty"); |
| 39 | |
| 40 | if (ex_MP4Modify == NIL || |
| 41 | ex_MP4Close == NIL || |
| 42 | ex_MP4Optimize == NIL || |
| 43 | |
| 44 | ex_MP4FindTrackId == NIL || |
| 45 | ex_MP4SetTrackIntegerProperty == NIL) { FreeMP4v2DLL(); return False; } |
| 46 | |
| 47 | return True; |
| 48 | } |
| 49 | |
| 50 | Void FreeMP4v2DLL() |
| 51 | { |
| 52 | BoCA::Utilities::FreeCodecDLL(mp4v2dll); |
| 53 | |
| 54 | mp4v2dll = NIL; |
| 55 | } |