danielgtaylor / qtfaststart

Quicktime atom positioning in Python for fast streaming
http://programmer-art.org/
466 stars 60 forks source link

Python 3 support and other improvements #8

Closed jaraco closed 11 years ago

jaraco commented 11 years ago

I'm interested in exploring the use of this package to re-write co64 chunks as stco chunks (if the file size can support it). In investigating the package, I found there were areas where I thought I could improve it.

I realize this is a pretty big pull request, but I took each commit carefully and deliberately, describing what it does, and many of the subsequent commits do depend on the earlier ones. I don't suggest reading the unified diff, but instead read the diffs for each changeset chronologically.

Here are some highlights:

  1. Added support for Python 3. The current implementation drops support for Python 2.5 and earlier, but support for Python 2.4+ can be restored if desired (by incorporating compatibility modules).
  2. Allow invocation of the script with 'python -m qtfaststart'. This allows an easily-accessible endpoint for Windows users or other environments where bin/qtfaststart isn't convenient.
  3. Created an Atom namedtuple to represent a fourcc atom (name, stream position, and size).
  4. Refactored parts of the code to utilize Atoms directly. Backward compatibility has been maintained (by the creation of private _*_ex functions. When backward compatibility of the package is no longer necessary, the private functions can replace the public ones.

I'll probably be continuing to contribute to this package, but I wanted to make this pull request to share my changes and get feedback sooner than later. I hope you find these changes appealing to the project.

danielgtaylor commented 11 years ago

Thanks a lot for this pull request. It took me a while to read through all the commits but everything looks pretty good to me. I'm going to merge this but it would be nice if you could also add a commit updating the README, specifically the history section.

I'd love to get some unit tests and a couple of tiny files into the repository to make sure changes like this in the future don't break things.