Commit Graph

84 Commits

Author SHA1 Message Date
Tom Finegan
01fdee435c mkvmuxer: Disallow AddTrack() after Tracks element is output.
BUG=https://code.google.com/p/webm/issues/detail?id=1083

Change-Id: I6a603337ba5fea1333f3f1c2595f9b87b148c427
2015-10-21 09:07:00 -07:00
Vignesh Venkatasubramanian
a58c32339e mkvmuxer: Add codec id constant for VP10.
This was added in the libvpx's snapshot here:
https://chromium-review.googlesource.com/#/c/293861

Change-Id: I58b9635c62535ecdb0dff14dc294466262590861
2015-09-10 12:10:01 -07:00
Francisco Facioni
b6de61a5c0 Adds support for simple tags
Change-Id: I285e4b73df0a7112bbde7ef13eddf8fdccf59178
2015-07-22 17:07:25 -03:00
James Zern
cec1f8521f mkvmuxer: remove unused timecode_scale variable
unused in WriteFramesAll() / WriteFramesLessThan() since:
d6d04ac mkvmuxer: use generic Cluster::AddFrame

Change-Id: I2089dc24b6a942f342b278b46271c6144cf8351e
2015-06-17 16:23:30 -07:00
Vignesh Venkatasubramanian
7affc5c3f8 clang-format re-run
Re-run clang-format to pick up some missed changes over the past
few CLs. Also update the .clang-format file to break after ternary
operator.

Change-Id: Ia4ba4e58362c2dbe36aeb33894f0411af33ef17d
2015-06-04 16:48:48 -07:00
Vignesh Venkatasubramanian
d6d04acdcc mkvmuxer: use generic Cluster::AddFrame
Replace specific Cluster::AddFrame* calls with a call to generic
Cluster::AddFrame().

Change-Id: If082490d2c29003b466034fc318f5e58791408a6
2015-06-04 16:33:36 -07:00
Vignesh Venkatasubramanian
c3550fdacf mkvmuxer: Write Block key frames correctly.
Per matroska Block Structure [1], for keyframes the flag should not be
set (unlike SimpleBlocks). For Blocks, keyframes is inferred by the
absence of ReferenceBlock element.

This CL fixes Issue #933 [2].

[1] http://www.matroska.org/technical/specs/index.html#block_structure
[2] https://code.google.com/p/webm/issues/detail?id=933

Change-Id: Ia3f811c3fe17fb4dededda2f6834cf7cf2d2e022
2015-06-01 11:04:12 -07:00
Vignesh Venkatasubramanian
5dd0e40dbd Merge "mkvmuxer: Set is_key to true for metadata blocks." 2015-06-01 17:51:40 +00:00
Vignesh Venkatasubramanian
8e96863b56 mkvmuxer: Set is_key to true for metadata blocks.
Per matroska semantics, all metadata blocks should be considered
key frames. Set it to true in AddMetadata functions.

Change-Id: Ibc26845dc6cc72ccbf90ae8d4dcc27c948e8a375
2015-06-01 10:49:19 -07:00
James Zern
f99f3b20fb mkvmuxerutil::EbmlDateElementSize: remove value param
this is unused as the size of dates is fixed:
Date - signed 8 octets integer in nanoseconds with 0 indicating the
precise beginning of the millennium (at 2001-01-01T00:00:00,000000000
UTC)

Change-Id: I7d44c92a6b746e92e4041238b110115b56e38a93
2015-05-23 10:33:12 -07:00
James Zern
ff572b5399 Frame::IsValid: fix track_number check
previously IsValidTrackNumber() expected a track_number > 0
this also fixes a warning:
'comparison of unsigned expression < 0 is always false'

Change-Id: I839863986ff776aae59e38ee7e4a1a710081303a
2015-05-23 10:32:56 -07:00
Vignesh Venkatasubramanian
b6311dc16f mkvmuxer: Refactor to remove a lot of duplicate code
Refactor muxer to remove a lot of duplicate code. This CL strives
to not change the API as much as possible. Although, there is one
minor public API change (constructor of the Cluster class). Other
than that, all the functions should work exactly the same way as
before.

Following up on this CL, we are going to make AddGenericFrame the
preferred way of adding frames to a segment and deprecate (and
eventually remove) all the other specific AddFrame* functions.

Change-Id: Ie410f1a64a981e1545ade53ce476bbe8b3610c4f
2015-05-20 10:24:26 -07:00
Vignesh Venkatasubramanian
16c8e78265 mkvmuxer: s/frame/data in all AddFrame* functions.
Rename variable "frame" to "data" in all the AddFrame* functions.
This is in prepararation for a follow-up CL.

Change-Id: Ifd0d96cfbeca85c12be23d854bc87e085436984d
2015-05-12 15:31:07 -07:00
Vignesh Venkatasubramanian
f06e152abd mkvmuxer: Fix MoveCuesBeforeClustersHelper recursive call.
The third parameter of the MoveCuesBeforeClustersHelper recursive function
should always be the size of the cues element without the master element's size
(i.e.) it should be the sum of size of all Cue Points. This way, the changes in
the Length of the master element itself will be computed correctly.

Change-Id: I05ff1606fb74168f80ffed81fd3c0de3f237c579
2015-02-02 18:34:18 -08:00
Vignesh Venkatasubramanian
e12fff0ebb mkvmuxer: Overload WriteEbmlHeader for backward compatibility
WriteEbmlHeader function was updated on
a321704b4c. It is a public function that
is exposed outside of the library. Overload it with an old signature
to maintain compatibility. The overloaded function writes the
doc_type_version as 2 by default (thereby retaining the old behavior).

Change-Id: If887a1bfa3e81e7e639c986a922aa5155faab2cf
2014-07-09 11:24:09 -07:00
James Zern
a321704b4c mkvmuxer: write correct DocTypeVersion
Change-Id: I9a463394dec5e69ae8a7b5a1378f19d390e441e4
2: default
4: if CodecDelay/SeekPreRoll/DiscardPadding are present
2014-06-24 16:17:29 -07:00
James Zern
574045edd4 mkvmuxer: fix DiscardPadding
DiscardPadding is a signed int.
this change fixes 2 things:
- allows negative values for discard padding
- fixes cases where an unsigned value would be written such that on read
  the sign would be flipped

Change-Id: I9418da7a22c09768e02d5b61da8d01c2bccb5dee
2014-06-18 12:50:25 -07:00
Sergey Ulanov
8be63972fd Include crop elements when calculating size of Video element
Change acf788 added Crop* elements support, but they were not
added when calculating size of Video element.

Change-Id: I64495cc35406a28b86b40d915dbc291f45aa1263
2014-06-06 00:40:50 -07:00
Vignesh Venkatasubramanian
1c36c24694 mkvmuxer: fix style guide violations
fix a few style guide violations in mkvmuxer.cpp

Change-Id: If800a5d6851f8ba4b904341fd054e1c2091e281e
2014-05-29 08:30:30 -07:00
Sergey Ulanov
acf788bedd Add support for CropLeft, CropRight, CropTop and CropBottom elements.
Change-Id: Ic5993a3e04b3eefccc3016fbe6b49d1e4a5fc05d
2014-05-21 19:46:36 -07:00
Vignesh Venkatasubramanian
418188b03e Merge "muxer: codec_id is a mandatory element" 2014-05-18 12:48:29 -07:00
Vignesh Venkatasubramanian
07688c92d7 mkvmuxer: Reject frames if invalid track number is passed.
Reject frames if an invalid track number is passed. Also change sample_muxer
to reject files which have Block elements with invalid track numbers.

Fixes Issue #659: https://code.google.com/p/webm/issues/detail?id=659

Change-Id: Ie6cf39a409b68bb4d2261f308409ee0c36d5dd8e
2014-05-18 12:45:49 -07:00
Vignesh Venkatasubramanian
2a63e473d8 muxer: codec_id is a mandatory element
codec_id element for a Track is mandatory and it does not have a default.
Rejecting the file if that happens.

Change-Id: I4fb0dfcd4c09eeabf22634db7fdf6ca818c93917
2014-05-16 11:42:05 -07:00
Vignesh Venkatasubramanian
7b2450131c clang-format re-run.
Re-running clang-format to take into account the recent change in it.
(https://gerrit.chromium.org/gerrit/#/c/69926/ )

Change-Id: Ie11afcaaf07a1967f65fd765f1a7c7112c85875a
2014-04-29 11:27:31 -07:00
Vignesh Venkatasubramanian
def325c010 muxer: Reject file if TrackType is never specified
According to matroska specification, TrackType is a mandatory element without a
default value [1]. But we have been producing invalid matroska files when
TrackType is never specified because we write 0 by default.

This patch will reject writing a track without specifying the TrackType value.
Specifically, this path will be triggered when Segment::AddTrack() is called
but there is no subsequent call to Track::set_type().

[1] http://www.matroska.org/technical/specs/index.html#TrackType

Fixes issue #769: https://code.google.com/p/webm/issues/detail?id=769

Change-Id: I4d75d169fd96c7e1fad278561f0e7a3e1135989c
2014-04-26 03:14:05 -07:00
Vignesh Venkatasubramanian
fb6b6e6444 clang-format on mkvmuxer.[ch]pp
Conformance of mkvmuxer.[ch]pp to Google C++ style guide.

Change-Id: I9bcd14710adbad4f32aa1a6be2ea7e40fb715e91
2014-04-11 11:41:01 -07:00
Sergey Ulanov
0fcec38045 Add support for DateUTC and DefaultDuration in MKV Muxer.
BUG=crbug.com/321825

Change-Id: I5ff8c5b9fd4e6be23ef2bc91a7a4ba021db6441f
2014-04-08 21:48:00 -07:00
Tom Finegan
23cdb09fd2 mkvmuxer: Silence MSVC warning that suggests making code non-portable.
Change-Id: I19bfa107bf01b1e10ac5a43040d409f4d620f4a7
2014-03-04 16:50:34 -08:00
Tom Finegan
cd6f7bff4b mkvmuxer: Add DiscardPadding support.
Also a bit of refactoring to remove some duplicate code.

Change-Id: Ia3d17461ae5f6275534e06c31f348bdfc4bba169
2014-01-22 23:26:26 -08:00
Tom Finegan
32e1556e68 mkvmuxer: Fix warnings.
Remove useless spam from build output.

Change-Id: Iae200d32cda1fc11cd471772725345d0979e97bc
2014-01-15 12:14:27 -08:00
Tom Finegan
5efd6e3c1d mkvmuxer: Add support for VP9 and Opus tracks.
Also make codec ID constants really constant.

Change-Id: I951d25e83ce507afb1ca475e2d5dbfe6402f3d61
2014-01-10 15:03:47 -08:00
Tom Finegan
a6c71c1407 mkvmuxer: Add support for writing CodecDelay and SeekPreRoll elements.
Change-Id: Iad8c671b76c4b97abad58946df7f3c0ebe6cb01b
2014-01-10 11:32:56 -08:00
Vignesh Venkatasubramanian
d2f7478148 Initializing last_block_duration_ to zero.
Adding a missing initialization.

Change-Id: Id4223765968745a46653139b2a9f1537102c3618
2013-10-30 11:13:38 -07:00
Vignesh Venkatasubramanian
ddfea3431f Fixing a bug in Chapter::Clear
Replacing a typo'd < with > in Chapter::Clear of mkvmuxer.

Change-Id: I8784d19dbca5a8a62c92ed14e2efa61d96c5375f
2013-10-25 09:12:11 -07:00
Vignesh Venkatasubramanian
4134f6e04e Adding AddLastFrame to Segment
Adding AddLastFrame function to the Segment muxer so that the duration
of the Segment can be accurately calculated given the last Block's duration.
We now provide an AddLastFrame function which will take duration of that block
as a parameter. When this function is used to add the last frame, the duration
of it is taken into account when computing the Segment's duration.

Change-Id: I3e1456299fefa1a4dd6d845c47292951d1ce3ad0
2013-10-25 08:28:23 -07:00
Vignesh Venkatasubramanian
8206558561 Handling chunking_ being set to true on repositioning cues.
CopyAndMoveCuesBeforeClusters should return false (fail gracefully)
if chunking_ is set to true.

Change-Id: Idf4d573e3f15b59c25ee0774a7875e5dfda9c02e
2013-06-27 11:30:17 -07:00
Vignesh Venkatasubramanian
d782edd68e Update Segment size if Cues size changes on repositioning
Files created with Segment::CopyAndMoveCuesBeforeClusters can't be parsed by
libwebm because the Segment size was not updated to account for the change
in Cue size. Fixing that.

Change-Id: I993f63e5c279f131cd39c54bee40163da00b8cbd
2013-06-24 11:55:53 -07:00
Vignesh Venkatasubramanian
4ac7b755f4 Repositing Cues before Clusters
A whole new approach to repositioning Cues before Clusters. This
patchset adds a new function CopyAndMoveCuesBeforeClusters to the
Segment class. This function should be called after
Segment::Finalize() to obtain a copy of the same output file with
Cues positioned before the Clusters.

Removing everything else that was added to accomplish the same in
the previous few commits.

Also, adding std:: qualifier to one of the variables in
sample_muxer_metadata which was missed accidentally in the previous
commit.

Change-Id: I2810d06a6251325add2f5e54d32d1da6e2fe143f
2013-06-14 13:01:48 -07:00
Vignesh Venkatasubramanian
54ca052b1c Changing IMkvReadableWriter to IMkvWriteEOFReader
Changing the IMkvReadableWriter interface to IMkvWriteEOFReader.
Also changing the default implementation.

Change-Id: Id37ffd7ef0af2ff7a392fb4fb0b1b134664ab20f
2013-06-11 15:11:18 -07:00
Vignesh Venkatasubramanian
9b42d039ad Support for placing Cues before Clusters
Adding support for placing Cues element before the Cluster element. We
recompute the new offsets using a recursive algorithm and update the Cues and
Seek Heads with the updates offsets.

Change-Id: I038f1a403b1defa853b9026bd3e48f4ad1006866
2013-06-03 10:27:27 -07:00
Vignesh Venkatasubramanian
5af56bb9ee Elements and functions to support BlockAdditional
Adding elements and functions to support muxing of BlockAdditional element.
This is required for supporting muxing of streams with Alpha Channel (where the
Alpha data goes into BlockAdditional). Detailed design doc of Alpha Channel can
be found here: http://goo.gl/wCP1y

Change-Id: Idac144d9588de16685734850585ab7115ddd08a4
2013-04-24 16:16:14 -07:00
Frank Galligan
64cee42b85 libwebm: Remove STL dependency from Android build.
Change-Id: Id2f378f2fa8350aae97394bd8b21918cff4d179a
2013-04-15 10:24:34 -07:00
Matthew Heaney
43178b4c9a libwebm: fixed rand() on windows
Change-Id: Ie17445072f10f91bdaabfba74a1be58764d78b94
2013-01-24 17:29:23 -08:00
Matthew Heaney
28222b4927 Add support for WebVTT cue identifier line
Modified the mkvmuxer to write the ChapterStringUID
sub-element of the Chapter Atom element.

Modified the mkvparser to read the ChapterStringUID
sub-element of the chapter atom.

Modified the vttdemux app to write the Cue Identifier
line of the WebVTT cue.

Change-Id: I06fe386f44897ada3fe10cbf89096df104dcf779
2012-11-13 12:44:06 -08:00
Frank Galligan
baefebcf1c libwebm: Fix BlockNumber on CuePoint
- libwebm was writing the BlockNumber of the next Block instead
  of the Block that was just written.

Change-Id: I344800fcea919a82d7f0a04a54cf510be3851ec6
2012-11-12 08:35:39 -08:00
Matthew Heaney
c99838a5fe Merge "mkvmuxer: add support for WebVTT chapters" 2012-10-31 18:03:59 -07:00
Matthew Heaney
2c5836837e mkvmuxer: add support for WebVTT chapters
Change-Id: I469ce3bd79a9b50b82e00ac8c63fc3d1db220887
2012-10-30 17:07:38 -07:00
Frank Galligan
50afbea946 muxer: Add support to force Cluster placement.
Change-Id: I7d4653561ca760885ba6926825ba6b80cdbea8ab
2012-10-29 09:24:41 -07:00
Matthew Heaney
7ef225de9f sample_muxer: added WebVTT support
Change-Id: If72d31ca4828adf39e4637003979a314e5dda98e
2012-09-28 10:38:19 -07:00
Matthew Heaney
711af0c505 mkvmuxer: add operations for muxing metadata
Change-Id: Ia17166ee9133b4841f7d206aa7d5ec81f800e994
2012-09-24 12:13:45 -07:00