Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor changes to support Mac OSX (tested on 10.10) #35

Merged
merged 2 commits into from
Jan 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ Build untrunc

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-0.8.7 -L./libav-0.8.7/libavformat -lavformat -L./libav-0.8.7/libavcodec -lavcodec -L./libav-0.8.7/libavutil -lavutil -lpthread -lz

### Mac OSX

Follow the above steps for "Installing on other operating system", but use the following g++ command:

g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I./libav-0.8.7 -L./libav-0.8.7/libavformat -lavformat -L./libav-0.8.7/libavcodec -lavcodec -L./libav-0.8.7/libavutil -lavutil -lpthread -lz -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration -lbz2 -DOSX

## Arch package

Jose1711 kindly provides an arch package here: https://aur.archlinux.org/packages/untrunc-git/
Expand Down
5 changes: 4 additions & 1 deletion atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
#include <iostream>

#include <assert.h>
#ifdef OSX
#include "osx_endian.h"
#else
#include <endian.h>

#endif
using namespace std;


Expand Down
4 changes: 4 additions & 0 deletions file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

#include "file.h"
#include <string>
#ifdef OSX
#include "osx_endian.h"
#else
#include <endian.h>
#endif

using namespace std;

Expand Down
33 changes: 33 additions & 0 deletions osx_endian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1

/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */

#ifndef __APPLE__
#warning "This header file (endian.h) is MacOS X specific.\n"
#endif /* __APPLE__ */


#include <libkern/OSByteOrder.h>

#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)

#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)

#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)


#endif /* __FINK_ENDIANDEV_PKG_ENDIAN_H__ */
4 changes: 4 additions & 0 deletions track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@
#include <vector>
#include <string.h>
#include <assert.h>
#ifdef OSX
#include "osx_endian.h"
#else
#include <endian.h>
#endif

#define __STDC_LIMIT_MACROS 1
#define __STDC_CONSTANT_MACROS 1
Expand Down