[FFmpeg-devel] [PATCH 0/3] lavf: generalize md5enc to hashenc and clone the muxers

Moritz Barsnick barsnick at gmx.net
Wed Mar 2 15:17:58 CET 2016


As suggested in the thread regarding the proposed streammd5 muxer:
http://ffmpeg.org/pipermail/ffmpeg-devel/2016-February/189694.html
this patchset converts the md5/framemd5 muxers into hash/hashenc muxers with
aliased muxers retaining the original names and default algorithms.

I am aware that there are also the crc muxer (which the md5 muxer was
derived from) and the md5 protocol, but I'm not sure how they should relate
to this. The crc muxer can also be merged by creating a new cloned muxer
which defaults to adler32, but its output currently differs a bit.

I went with an approach in several steps.  I do like atomic renames without
code changes.  Perhaps some, if not all, of these steps can be squashed.
Feel free to do so or to comment accordingly.

Steps:
1. Rename the source files (keeping muxers' names).
   -> No functional or source changes.
2. Rename the source's variables to make them more generic, where applicable.
   -> Code which is still specific to MD5 retains that string, and the muxer
      names do as well of course.
   -> No functional changes at all.
3. Clone the muxers, with separate options arrays defaulting to MD5 ("legacy")
   and SHA-512 ("new", "generic"), and with separate classes using them. The
   "legacy" muxers behave exactly as before, and take the same options as
   before. The "new" new muxers with generic names share the code, but default
   to the SHA-512 hash.
   I'm not sure about the version bump and the Changelog entry, because no
   actual feature was added.

Caveat: lavu/hash, which provides the hashing functions, doesn't expose the
supported algorithms, but even if it did, I wouldn't know how to map that into
the options array at compile time. I copied the currently known algorithm
strings from libavutil/hash.c to the texi documentation.

Moritz Barsnick (3):
  lavf: rename md5enc source to hashenc
  lavf/hashenc: rename variables where appropriate
  lavf/hashenc: clone md5 and framemd5 muxers into hash and framehash
    muxers

 Changelog                |   1 +
 doc/muxers.texi          | 129 ++++++++++++++++++++------
 libavformat/Makefile     |   6 +-
 libavformat/allformats.c |   2 +
 libavformat/hashenc.c    | 231 +++++++++++++++++++++++++++++++++++++++++++++++
 libavformat/md5enc.c     | 171 -----------------------------------
 libavformat/version.h    |   2 +-
 7 files changed, 339 insertions(+), 203 deletions(-)
 create mode 100644 libavformat/hashenc.c
 delete mode 100644 libavformat/md5enc.c

-- 
2.5.0



More information about the ffmpeg-devel mailing list