Skip to content
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
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# vim:noexpandtab:sw=2 ts=2

.PHONY: env

all: test

env/bin/activate:
test -d env || python3 -m venv env
. env/bin/activate; \
pip3 install wheel; \
python3 setup.py bdist_wheel; \
pip3 install -r requirements.txt

env: env/bin/activate

test: env
. env/bin/activate; \
coverage3 run -m pytest -s -v

clean:
rm -rf env
find . -name "*pycache*" -exec rm -fr "{}" \;
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,52 @@ Container:
iso5
avc1

```
```

# Upgrade to Construct 2.10

The current master of pymp4 is based on construct v2.8.8. This is an old
version (years ago): it does not have a public doc page, several improvements
have been introduced and the general consensus seems to point to an upgrade.

Unfortunately several breaking changes have been introduced, making the
transition harder. Construct's doc does not help very much either.

This is a first attempt at building pymp4 based on construct v 2.10.60. There
have been no attempts to parse an actual mp4 file with it, this is just a first
pass to understand the implications of this migration.

The most important impacts seems to be:

- changed all String classes to PaddedString
- using new argument order for Const
- replaced custom "Prefixedincludedsize" class with the new "Prefixed" one,
supporting the case where length field accounts for its own length
- adjusted offsets/end field calculation based on the different way the
Prefixed class work
- getting rid of all "Embedded" structs (entirely deprecated and removed from
construct 2.10), in favour of "named", nested structs.

All tests are passing, but no effort has been made for the moment to make sure
all applied changes are covered.

The most impacting change is the removal of "Embedded". The change makes it
harder to use the "Box" structure and introduces an additional "box_body"
field that seems somehow unnecessary and artificial with respect to what
obtained by using "Embedded". This becomes quickly annoying especially when
trying to build or parse boxes with more than a few levels of nesting (have
a look at how the code in "test_moov_build" changes).

It is possible that "Box" and "ContainerBox" can be redesigned, improving
usability.

Defects / Next steps:

- some constructs use binary string, other handle standard python (unicode)
strings for essentially the same fields. An effort should be made if possible
to be allow a more coherent usage.
- add new tests to cover all applied changes

## Test

Just run ```make``` to build a virtual env and run tests.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
construct
pytest
coverage
56 changes: 28 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,35 @@
from setuptools import setup, find_packages
from sys import path as sys_path

deps = [
"construct==2.8.8"
]
deps = ["construct"]

srcdir = join(dirname(abspath(__file__)), "src/")
sys_path.insert(0, srcdir)

setup(name="pymp4",
version="1.2.0",
description="A Python parser for MP4 boxes",
url="https://github.com/beardypig/pymp4",
author="beardypig",
author_email="git@beardypig.com",
license="Apache 2.0",
packages=find_packages("src"),
package_dir={"": "src"},
entry_points={
"console_scripts": ["mp4dump=pymp4.cli:dump"]
},
install_requires=deps,
test_suite="tests",
classifiers=["Development Status :: 4 - Beta",
"Environment :: Console",
"Operating System :: POSIX",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Video",
"Topic :: Utilities"])
setup(
name="pymp4",
version="1.2.0",
description="A Python parser for MP4 boxes",
url="https://github.com/beardypig/pymp4",
author="beardypig",
author_email="git@beardypig.com",
license="Apache 2.0",
packages=find_packages("src"),
package_dir={"": "src"},
entry_points={"console_scripts": ["mp4dump=pymp4.cli:dump"]},
install_requires=deps,
test_suite="tests",
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Operating System :: POSIX",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Multimedia :: Sound/Audio",
"Topic :: Multimedia :: Video",
"Topic :: Utilities",
],
)
Empty file added src/conftest.py
Empty file.
Loading