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

Add a few fixes to allow building on OS X #77

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.o
untrunc
/libav-0.8.7/
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,26 @@ 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

## Installing on OSX


Download the source code from GitHub at https://github.com/ponchio/untrunc and unzip the source code.

Download [libav, 0.8.7 version](http://libav.org/releases/libav-0.8.7.tar.xz) from [libav download page](http://libav.org/download.html) and unzip into the untrunc source code library. Then:

cd untrunc-master

Build the library

cd libav-0.8.7
./configure
make
cd ../

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 -lbz2 -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration

## Arch package

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

#include <assert.h>
#include <endian.h>
#include "endian.h"

using namespace std;


Atom::~Atom() {
for(unsigned int i = 0; i < children.size(); i++)
delete children[i];
Expand Down
22 changes: 22 additions & 0 deletions endian.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

#ifdef __APPLE__
#include <machine/endian.h>
#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)
#else
#include <endian.h>
#endif
2 changes: 1 addition & 1 deletion file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "file.h"
#include <string>
#include <endian.h>
#include "endian.h"

using namespace std;

Expand Down
2 changes: 1 addition & 1 deletion track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <vector>
#include <string.h>
#include <assert.h>
#include <endian.h>
#include "endian.h"

#define __STDC_LIMIT_MACROS 1
#define __STDC_CONSTANT_MACROS 1
Expand Down