summaryrefslogtreecommitdiff
path: root/multimedia/mp4v2/patches/patch-src_mp4.cpp
blob: 7f0f6497ce20517749024b18fd0cedab70e298ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
$NetBSD: patch-src_mp4.cpp,v 1.1 2020/12/20 13:07:58 nia Exp $

Fix building C applications.

Reverts the following commit:
https://github.com/TechSmith/mp4v2/commit/263719465a1c1fbe6d240b8d154da71003ce3230
https://github.com/TechSmith/mp4v2/issues/47

--- src/mp4.cpp.orig	2020-12-07 23:16:32.000000000 +0000
+++ src/mp4.cpp
@@ -87,7 +87,7 @@ const char* MP4GetFilename( MP4FileHandl
 
 ///////////////////////////////////////////////////////////////////////////////
 
-MP4FileHandle MP4Read( const char* fileName, ShouldParseAtomCallback cb/*=nullptr*/ )
+MP4FileHandle MP4Read( const char* fileName )
 {
     if (!fileName)
         return MP4_INVALID_FILE_HANDLE;
@@ -100,9 +100,6 @@ MP4FileHandle MP4Read( const char* fileN
     {
         ASSERT(pFile);
 
-        if ( cb != nullptr )
-           pFile->SetShouldParseAtomCallback( cb );
-
         pFile->Read( fileName, NULL );
         return (MP4FileHandle)pFile;
     }
@@ -149,6 +146,30 @@ MP4FileHandle MP4ReadProvider( const cha
 
 ///////////////////////////////////////////////////////////////////////////////
 
+void MP4SetShouldParseAtomCallback( MP4FileHandle hFile, ShouldParseAtomCallback cb )
+{
+   if (!MP4_IS_VALID_FILE_HANDLE(hFile))
+      return;
+   try
+   {
+      ASSERT(hFile);
+      MP4File& file = *static_cast<MP4File*>(hFile);
+      file.SetShouldParseAtomCallback( cb );
+   }
+   catch( Exception* x ) {
+      mp4v2::impl::log.errorf(*x);
+      delete x;
+   }
+   catch( ... ) {
+      mp4v2::impl::log.errorf("%s: unknown exception accessing MP4File "
+                               "filename", __FUNCTION__ );
+   }
+
+//   g_parseCallback = cb;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
     MP4FileHandle MP4Create (const char* fileName,
                              uint32_t  flags)
     {