Commit Graph

329 Commits

Author SHA1 Message Date
Tom Finegan
177df33d25 Move the muxer sample source file and project.
They now reside in the same place as the parser sample.

Change-Id: Idb4471ea81a3d91eeeaf1b36053187203de9a21f
2012-05-30 14:18:08 -04:00
Tom Finegan
4fff53441d Remove visual studio 2005 projects and solution.
Change-Id: I1d4d8cffeb8997eee415246753ea3c29c1af45ec
2012-05-30 11:36:31 -04:00
Tom Finegan
ca13a5bae0 Rename sample_muxer.vcproj to sample_muxer_2008.vcproj.
Also update the solution file path to the project.

Change-Id: I7e83b99893bcde5429e6de03772c61369b29d332
2012-05-29 10:55:00 -04:00
Tom Finegan
cb69e608b4 Enable auto CRLF for visual studio project and solution files.
Change-Id: I23ca85442173eec7a144c001080ca8a3b41609f3
2012-05-29 10:45:59 -04:00
Tom Finegan
f6b0408aba Use LF as EoL in visual studio solutions and projects.
Makes files easier to read in gitweb, and prevents conflict with
upcoming .gitattributes change.

Change-Id: I185e496d8df8efb4987bfb848a582f7d0da81fb8
2012-05-29 10:43:40 -04:00
matthewjheaney
9a561ab4dd libwebm: handle negative time for a block
Change-Id: Iafa0254fb1554621b42635cb99d40b2c0177468f
2012-05-11 11:53:23 -04:00
Frank Galligan
0568dd63a6 Memory Leak Fix in Muxer.
- Track language_ and name_ member variables were not properly
  deleted.
- http://code.google.com/p/webm/issues/detail?id=416

Change-Id: Id0da669c347270cd355ad0b5e1e45ebf6415e367
2012-04-17 15:28:28 -04:00
Frank Galligan
56488f73ef Merge "sample_muxer: Fixed bug with outputting audio cues." 2012-03-16 08:06:54 -07:00
Frank Galligan
f270ddaeb8 sample_muxer: Fixed bug with outputting audio cues.
- For muxed content with default settings the cues was getting
  output on the audio track when it should be on the video track
  by default.
- Added check to command line parameter parsing to make sure
  there are enough parameters.
- If Cues are set to output on one type of track the other type
  is now disabled.

Change-Id: I96ef1978dc3f442f34364f6dee6cfb01571c7289
2012-03-16 09:26:28 -04:00
matthewjheaney
041a5c5811 Parse headers outside of constructor
In several cases, the parser would parse a header
(say, a track header, or the segment info header)
in the constructor for the type.  The parser had
assumed (incorrectly) that the file was well-formed,
but this turned out to be an incorrect assumption.

The parse errors triggered some assertion failures,
but this is not acceptable in a production system.

The parser solved that problem by separating the
construction of the header object from the parsing
of the file.  There is now a separate parse method
to be called after construction of the object,
which returns a status whether the parse was
successful.

This change fixes the bugs from the following
tracker issues:

http://code.google.com/p/webm/issues/detail?id=399
http://code.google.com/p/webm/issues/detail?id=400

Change-Id: Idb09154ae7008429d8613ce3b3e8294f5a12de86
2012-03-13 14:40:17 -04:00
matthewjheaney
6fa7c7611c Block parsing is now robust
Previously, parsing of a Block element was done inside its
constructor.  Parsing errors were handled via assertion checks,
but this only works in practice if there are no actual errors
in the file.

We did come across a file, however, that used EMBL-style lacing,
but the lacing was done incorrectly and so the parse asserted.
This isn't acceptable for a production system, and more a graceful
handling of parse errors was needed.

The code was restructured such that the Block object's ctor does
only trivial initialization of member variables.  A separate Parse
method was added, that is called after the object is constructed.
If the parse succeeds all is well, otherwise the object is destroyed
and the error is reported to the caller.

This commit fixes bug tracker issue #398, described here:

http://code.google.com/p/webm/issues/detail?id=398

Change-Id: Ib95ca95d0eec08cf670b308c461e42ed8345e890
2012-02-28 14:03:21 -05:00
matthewjheaney
71d296e44c Merge "mkvparser: overflow in biased count of laced frames" 2012-02-23 18:07:34 -08:00
matthewjheaney
72052ed8b1 mkvparser: overflow in biased count of laced frames
Change-Id: I946b233d559186fc8a24d0769607075333598191
2012-02-23 13:33:46 -05:00
Frank Galligan
a88d62b682 Fix muxer output with no Cues.
- Fixed a bug with the muxer where it would generate a entry in
  the SeekHead for a Cues element with OutputCues set to false.
- Fixed a bug with the muxer where it would generate an empty
  Cues element with OutputCues set to false.
- Issue:http://code.google.com/p/webm/issues/detail?id=383

Change-Id: I99cc404a7e8ad61759dbb57ab769625dd724240c
2012-02-16 16:34:59 -05:00
Frank Galligan
28d54555a7 Fix for audio and video track size calculation.
- There was a bug where the calculation for the audio and video
track size where the code would calculate the size of the track
elements minus the size of the audio or video elements. If the
coded size of the track elements was one byte smaller than with
the audio or video elements then the muxer would return an
error.
- Fixed another issue that the track's virtual Size function was
calling the Track's PayloadSize function where it should have
been calling the virtual PayloadSize function.

Change-Id: Ie6d66d6d720334180a11e06926a3bd8c7788a1f1
2012-01-25 13:23:40 -05:00
Frank Galligan
359b3654ad Merge "Fix bug with calculating master element sizes." 2012-01-25 10:01:39 -08:00
Frank Galligan
000944c4e4 Fix bug with calculating master element sizes.
There was a potential bug with calculating the size of a master
element. The size was being calculated with a straight unsigned
integer when it should have been calculated with a coded
integer.

Change-Id: I68422ecdb7818af51ded2953a8914fcdc8858f7a
2012-01-25 10:28:26 -05:00
Tom Finegan
8da8206fa0 mkvmuxer: Use WriteID for all element IDs.
Fixes reliability issue with IMkvWriter::ElementStartNotify: the
cluster and segment IDs were being written with SerializeInt instead
of WriteID.

Also:
- Remove completed TODO.
- Fix method declaration order in MkvWriter.

Change-Id: Ie37e141169af6e0ca7d931cc39f001722e7b9078
2012-01-23 16:42:03 -05:00
Tom Finegan
7a9a72f984 mkvmuxer: Disallow non-monotonically increasing timestamps.
Segment::AddFrame will now return false (fail) when a non-monotonically
increasing timestamp value is passed to the method.

Change-Id: Icfac093e6bddf18e3ef252df79e35c33dbe1e134
2012-01-20 15:59:38 -05:00
Tom Finegan
d2327e2b65 sample_muxer: Cosmetics.
- Fix return values; use EXIT_FAILURE and EXIT_SUCCESS
  instead of -1 and 0.
- Use C++ versions of C library includes.

Change-Id: Ib3a36e799d6a91b7fea0f328480e977ef21ca260
2012-01-19 20:21:36 -05:00
Tom Finegan
1e37a264f1 mkvmuxer: Add element start notification.
Just before the first byte of an element identifier is written
the muxer calls IMkvWriter::ElementStartNotify to report the
position of the element in the WebM stream.

Change-Id: Iac40090587bd9496b05f41203aace00902f5606e
2012-01-19 20:21:35 -05:00
Tom Finegan
01d5924817 mkvmuxer: Cosmetics.
- Use c++ versions of C library includes.
- Make Segment::~Segment non-virtual.

Change-Id: I868c1f3769b5a87362efe99383cca880586b57f3
2012-01-19 20:21:35 -05:00
Tom Finegan
a20f4255c7 mkvmuxer: Return errors instead of using assert.
NDEBUG is defined in our release build, which allowed for misuse of
the library by users that would result in dereferencing NULL
MkvWriter pointers in various places throughout the muxer code.

Change-Id: I6ab51453ef26786ca988310c051bb49db16ecbc5
2012-01-19 20:21:30 -05:00
Tom Finegan
69df730519 mkvmuxer: Add Init method to Cluster and Segment.
Remove asserts on the MkvWriter pointer in each constructor,
and assign the pointer in each Init method. Update Segment::Init
usage site in sample_muxer.

Change-Id: Id940f76b50dc15603742e76afc04cdffe0ec4990
2012-01-19 20:21:25 -05:00
Tom Finegan
f7aa8ab33d Merge "Add output of elements to separate files." 2012-01-18 13:54:56 -08:00
Frank Galligan
73ad7bd83c Add output of elements to separate files.
Support outputting header, clusters, and cues to separate files.

Change-Id: Ia89bf59ddbddc094c3daf944123fd01630ae9193
2012-01-18 16:02:43 -05:00
matthewjheaney
4c682199b0 mkvparser: cache SeekEntry start and size
Change-Id: I54a0ac4035f7174f51ae2145dedb1c3ed5ad7ec8
2011-12-08 16:07:15 -05:00
matthewjheaney
9303667611 parse void elements in seek head
Change-Id: Ifc8841909f6aa877108abebb5b5623c2344d0e35
2011-11-17 19:08:48 -05:00
Frank Galligan
4affedd0a7 Add support for encryption elements.
Added support for the ContentEncoding element to be added to a
Track element for muxing. Currently only one ContentEncoding may
be added. The ContentEncoding must be encryption of the whole
frame with AES.
Added support for parsing the ConentEncoding elements. Currently
the parser does not parse any ContentCompression elements.

Change-Id: Ie199116a1bcc18a0c2b5eea3dba6622887c108c8
2011-11-04 14:09:56 -04:00
Frank Galligan
23808a7ba4 Switch AddFrame parameter to const.
Change-Id: I4ae4ac3a57f91eb19a7bb1b1d1c63fe64128efe2
2011-10-27 13:21:04 -04:00
Frank Galligan
32227e70c1 Fix for writing audio to first cluster.
If the muxer had audio frames that were earlier in time than the
first video frame then the first cluster would not be initialized
in time to write out the first audio frames.

Change-Id: I6a2ca25a25c326a4215c307bdae666db9107e9b5
2011-09-13 11:41:15 -04:00
Frank Galligan
2d3461b4b3 Add support for setting track numbers.
When adding tracks to the muxer the application can set the
track number.

Change-Id: Id4dbbfec5cd541b1354c03361a40a3d2d7f921b9
2011-08-15 15:29:20 -04:00
Frank Galligan
a09f15f00e Better support for audio only webm files.
Changed max_cluster_duration to 30 seconds so default command line
will not crash on audio only WebM files. Added support to the sample
muxer to output cues on the audio track. Created a muxer helper
function to clean up the code a little.

Change-Id: I2871836b64cef7defd10aa51a209b4abd9046832
2011-08-14 10:49:50 -04:00
Tom Finegan
6d99850e7c Build muxer and parser into a single library.
Makefile:
- Add a new target that makes a single libwebm.a instead of building
separate muxer and parser libraries.
- Update sample targets accordingly.

Visual Studio:
- Use a single project for muxing and parsing, and build a single library
name libwebm.lib.
- Update code generation settings (DLL -> static runtimes).
- Use C7 debug information format (instead of PDB)
- Disable minimal rebuild (C7 use causes warning otherwise).

Change-Id: Ie221d4ee02c93f98f2521757c08b75ecbf75f54f
2011-08-11 17:19:45 -04:00
matthewjheaney
1ae4335c1c libwebm: liberalize handling of reference blocks
Change-Id: I3df0235e005c57507eb974ad3754b4c800a99825
2011-08-09 16:03:50 -04:00
Frank Galligan
52f0a92192 Added const to some pointers.
Updated some long assignment statements to indent 4 per the
coding guide. Added explicit calls to Close on the reader and
writer objects.

Change-Id: I149326c3a07543d7eb9323c702cf13852c5bc3c2
2011-07-18 14:28:12 -04:00
Frank Galligan
6ebe4a39df Merge "Add support for muxing to libwebm." 2011-07-18 08:09:34 -07:00
Frank Galligan
a3dd40877d Add support for muxing to libwebm.
Squashed commit of the following:

9f73b86 Updated code to Google C++ style guide.
8580901 Added support for linux.
fd0b59c Fixed segment size issue.
d51d5ef Added more Track and Video options.
0fc73fd Fixed issue where cue point was being written out on wrong
        track.
fcfdd07 Updated sample_muxer to read in a webm and output a webm file.
        Added some options to sample_muxer. Fixed writing out unknown
        size.
285c558 Added support for muxer guideline "Audio that matches video key
        frame should be in the same cluster." Added support for
        block_number in cue points. Added support for setting max
        cluster size.
f956dec Add support for setting the max duration for all clusters.
92ca53e Add support for Cues element.
d6b4cba Added typedefs for unsigned long long, long long, and unsigned
        char. Reformated some code.
1b1f8b2 Added support for SeekHead element. Added WriteVoidElement
        function.
8faa187 Add support for CodecPrivate. Add support for updating
        SegmentInfo duration. Add support for updating Segment size.
        Added new sample that swicthes the tracks.
1dd3555 Refactored some code. Check to see if track is a video track if
        starting a new cluster on a key-frame.
1bc8374 Refacotrs code so Cluster is in charge of wirting out its own
        data.
836cd74 Added basic cluster and simple_block support for writing frames.
cc48cc2 Add simple support for Audio tracks.
4efd614 Added support for using the encoded ID value for the elements.
fb8b5a6 Initial commit of libwebm muxer.

Removed switch_sample project. Fixed initialization order warnings on
Linux. Reformatted code to follow Google C++ style guide. Fixed Makefile.
Removed tester.cpp.

Change-Id: I4857042f804edb834be52787a7d5ccdd578b7275
2011-07-15 17:30:27 -04:00
James Zern
1623fb983b mkvparser: silence initializer list warnings
Ensure initializer lists match declaration order, from gcc -Wreorder.

Change-Id: I9ba245ab9c28d89978cdfe3865edcb54da2e949c
2011-07-14 10:30:47 -07:00
Frank Galligan
18ac83d501 Add default mkvreader object to mkvparser namespace. Add mkvreader
object to linux and mac libmkvparser.a.

Change-Id: Ibb94e8dee9a3a897bcda925916c5713cb45d35fe
2011-06-06 13:08:08 -04:00
Joel Dice
5942099a85 fix warnings when building with gcc -Wall -Wextra
This commit addresses three types of warnings:

 * constructor initialization order inconsistencies
 * statements with no effect
 * possible use of uninitialized fields

Change-Id: I572ccdc6813d8cfeff3e9e06d7acf6a8ab5ac7b1
2011-05-09 16:34:40 -04:00
matthewjheaney
9ecedef185 libwebm: include <cstddef>
Change-Id: Ieba2507dd82b34558ffef4febb6f80225009cc30
2011-05-03 15:48:13 -04:00
matthewjheaney
6f68021678 libwebm: re-implemented Block::EOS()
Change-Id: I91c6746d3e06e2f74dc899dbeec5c5270e150d08
2011-04-07 19:36:15 -07:00
matthewjheaney
3395c36a8e libwebm: added UnserializeInt function
Change-Id: I2298e547cd38d3aea04c0c993a67e5e291b8fea8
2011-04-05 20:55:26 -07:00
matthewjheaney
ffe5a8e548 libwebm: added GetLacing selector function for Block
Change-Id: I77bff875919f7a57a8c838beb05bc9a992cadacd
2011-04-05 20:55:25 -07:00
matthewjheaney
a9c65fbbc0 libwebm: added BlockEntry::GetKind op
Change-Id: I7d7daac0d3b8be1b8839f96503250170f675e34d
2011-04-05 20:55:24 -07:00
matthewjheaney
31a9d5470e libwebm: don't alloc block object in block group
Change-Id: I55ff9451591da86b89ed58c22eb9778317b89364
2011-04-05 20:55:23 -07:00
matthewjheaney
2b84a12da8 libwebm: removed old Cluster::Load
Change-Id: I02448e6c9d5850368282353dba40a549753c26bc
2011-04-05 20:55:22 -07:00
matthewjheaney
bd833a82e4 libwebm: removed old LoadBlockEntries
Change-Id: I340f444f719fa9c5d9da986f1527522d8a5f9812
2011-04-05 20:55:21 -07:00
matthewjheaney
7b07758854 libwebm: refactor BlockEntry class
Change-Id: I68d799d5b928de0ff7be293731ab73750c7cbb86
2011-04-05 20:55:20 -07:00