Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* GStreamer Matroska muxer/demuxer
|
|
|
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2005-10-14 12:43:30 +00:00
|
|
|
* (c) 2005 Michal Benes <michal.benes@xeris.cz>
|
2008-08-02 17:47:32 +00:00
|
|
|
* (c) 2008 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2011-12-16 15:56:37 +00:00
|
|
|
* (c) 2011 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
*
|
|
|
|
* matroska-mux.c: matroska file/stream muxer
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
*/
|
|
|
|
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
/* TODO: - check everywhere that we don't write invalid values
|
|
|
|
* - make sure timestamps are correctly scaled everywhere
|
|
|
|
*/
|
|
|
|
|
2008-12-05 09:24:18 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-matroskamux
|
2018-10-22 09:39:24 +00:00
|
|
|
* @title: matroskamux
|
2008-12-05 09:24:18 +00:00
|
|
|
*
|
|
|
|
* matroskamux muxes different input streams into a Matroska file.
|
|
|
|
*
|
2018-10-22 09:39:24 +00:00
|
|
|
* ## Example launch line
|
2008-12-05 09:24:18 +00:00
|
|
|
* |[
|
2013-02-23 18:50:52 +00:00
|
|
|
* gst-launch-1.0 -v filesrc location=/path/to/mp3 ! mpegaudioparse ! matroskamux name=mux ! filesink location=test.mkv filesrc location=/path/to/theora.ogg ! oggdemux ! theoraparse ! mux.
|
2008-12-05 09:24:18 +00:00
|
|
|
* ]| This pipeline muxes an MP3 file and a Ogg Theora video into a Matroska file.
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v audiotestsrc num-buffers=100 ! audioconvert ! vorbisenc ! matroskamux ! filesink location=test.mka
|
2008-12-05 09:24:18 +00:00
|
|
|
* ]| This pipeline muxes a 440Hz sine wave encoded with the Vorbis codec into a Matroska file.
|
2018-10-22 09:39:24 +00:00
|
|
|
*
|
2008-12-05 09:24:18 +00:00
|
|
|
*/
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <math.h>
|
2011-02-16 15:09:20 +00:00
|
|
|
#include <stdio.h>
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2009-08-08 03:47:48 +00:00
|
|
|
#include <gst/riff/riff-media.h>
|
2009-12-13 12:45:22 +00:00
|
|
|
#include <gst/tag/tag.h>
|
2016-02-04 10:43:15 +00:00
|
|
|
#include <gst/pbutils/codec-utils.h>
|
2009-08-08 03:47:48 +00:00
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
#include "matroska-mux.h"
|
|
|
|
#include "matroska-ids.h"
|
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
#define GST_MATROSKA_MUX_CHAPLANG "und"
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (matroskamux_debug);
|
2004-07-18 15:58:04 +00:00
|
|
|
#define GST_CAT_DEFAULT matroskamux_debug
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2015-04-27 10:22:11 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_WRITING_APP,
|
|
|
|
PROP_DOCTYPE_VERSION,
|
|
|
|
PROP_MIN_INDEX_INTERVAL,
|
2016-04-08 11:05:57 +00:00
|
|
|
PROP_STREAMABLE,
|
2017-07-17 22:26:11 +00:00
|
|
|
PROP_TIMECODESCALE,
|
|
|
|
PROP_MIN_CLUSTER_DURATION,
|
2019-04-18 12:31:00 +00:00
|
|
|
PROP_MAX_CLUSTER_DURATION,
|
|
|
|
PROP_OFFSET_TO_ZERO,
|
2018-05-31 08:29:43 +00:00
|
|
|
PROP_CREATION_TIME,
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
};
|
|
|
|
|
2010-05-17 03:36:00 +00:00
|
|
|
#define DEFAULT_DOCTYPE_VERSION 2
|
2009-01-08 15:56:46 +00:00
|
|
|
#define DEFAULT_WRITING_APP "GStreamer Matroska muxer"
|
2009-05-27 11:51:44 +00:00
|
|
|
#define DEFAULT_MIN_INDEX_INTERVAL 0
|
2010-06-09 13:42:19 +00:00
|
|
|
#define DEFAULT_STREAMABLE FALSE
|
2016-04-08 11:05:57 +00:00
|
|
|
#define DEFAULT_TIMECODESCALE GST_MSECOND
|
2017-07-17 22:26:11 +00:00
|
|
|
#define DEFAULT_MIN_CLUSTER_DURATION 500 * GST_MSECOND
|
|
|
|
#define DEFAULT_MAX_CLUSTER_DURATION 65535 * GST_MSECOND
|
2019-04-18 12:31:00 +00:00
|
|
|
#define DEFAULT_OFFSET_TO_ZERO FALSE
|
2009-01-08 15:56:46 +00:00
|
|
|
|
2010-04-08 10:23:38 +00:00
|
|
|
/* WAVEFORMATEX is gst_riff_strf_auds + an extra guint16 extension size */
|
|
|
|
#define WAVEFORMATEX_SIZE (2 + sizeof (gst_riff_strf_auds))
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2012-04-28 18:57:51 +00:00
|
|
|
GST_STATIC_CAPS ("video/x-matroska; video/x-matroska-3d; audio/x-matroska")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
#define COMMON_VIDEO_CAPS \
|
2016-10-27 12:03:48 +00:00
|
|
|
"width = (int) [ 16, MAX ], " \
|
|
|
|
"height = (int) [ 16, MAX ] "
|
2008-01-08 20:03:30 +00:00
|
|
|
|
2011-02-16 15:09:20 +00:00
|
|
|
/* FIXME:
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
* * require codec data, etc as needed
|
|
|
|
*/
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate videosink_templ =
|
2011-11-04 10:58:22 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("video_%u",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_REQUEST,
|
|
|
|
GST_STATIC_CAPS ("video/mpeg, "
|
2004-03-15 19:32:27 +00:00
|
|
|
"mpegversion = (int) { 1, 2, 4 }, "
|
|
|
|
"systemstream = (boolean) false, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2011-04-24 23:45:07 +00:00
|
|
|
"video/x-h264, stream-format=avc, alignment=au, "
|
2005-10-14 12:43:30 +00:00
|
|
|
COMMON_VIDEO_CAPS "; "
|
2014-01-06 13:54:46 +00:00
|
|
|
"video/x-h265, stream-format=hvc1, alignment=au, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2004-03-15 19:32:27 +00:00
|
|
|
"video/x-divx, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2006-04-25 11:45:00 +00:00
|
|
|
"video/x-huffyuv, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
|
|
|
"video/x-dv, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
|
|
|
"video/x-h263, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2004-03-15 19:32:27 +00:00
|
|
|
"video/x-msmpeg, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2005-10-18 18:06:14 +00:00
|
|
|
"image/jpeg, "
|
2013-08-27 13:25:16 +00:00
|
|
|
COMMON_VIDEO_CAPS "; "
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
"video/x-theora; "
|
2006-11-15 00:12:19 +00:00
|
|
|
"video/x-dirac, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2008-08-25 14:15:43 +00:00
|
|
|
"video/x-pn-realvideo, "
|
|
|
|
"rmversion = (int) [1, 4], "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2010-04-27 13:26:13 +00:00
|
|
|
"video/x-vp8, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2015-11-03 10:42:52 +00:00
|
|
|
"video/x-vp9, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2011-11-26 09:01:07 +00:00
|
|
|
"video/x-raw, "
|
2014-02-07 13:00:15 +00:00
|
|
|
"format = (string) { YUY2, I420, YV12, UYVY, AYUV, GRAY8, BGR, RGB }, "
|
2009-08-06 23:15:17 +00:00
|
|
|
COMMON_VIDEO_CAPS "; "
|
2015-11-18 10:01:20 +00:00
|
|
|
"video/x-prores, "
|
|
|
|
COMMON_VIDEO_CAPS "; "
|
2018-07-25 21:08:53 +00:00
|
|
|
"video/x-wmv, " "wmvversion = (int) [ 1, 3 ], " COMMON_VIDEO_CAPS "; "
|
|
|
|
"video/x-av1, " COMMON_VIDEO_CAPS)
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2003-12-22 01:47:09 +00:00
|
|
|
|
|
|
|
#define COMMON_AUDIO_CAPS \
|
2008-08-02 17:52:16 +00:00
|
|
|
"channels = (int) [ 1, MAX ], " \
|
|
|
|
"rate = (int) [ 1, MAX ]"
|
configure.ac: Improve mpeg2enc detection. This is for distributions that do ship mjpegtools, but without mpeg2enc. Al...
Original commit message from CVS:
2003-12-21 Ronald Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
Improve mpeg2enc detection. This is for distributions that do
ship mjpegtools, but without mpeg2enc. Also does object check
for might there ever be ABI incompatibility.
* ext/mpeg2enc/gstmpeg2enc.cc:
Add Andrew as second maintainer (he's helping me), and also add
an error if no caps was set. This happens if I pull before capsnego
and that's something I should solve sometime else.
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_blockgroup):
Fix time parsing.
* gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_link),
(gst_matroska_mux_track_header):
Add caps to templates.
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_sink_factory):
Add mpegversion=1 to prevent confusion with MPEG/AAC.
* gst/mpegstream/gstmpegdemux.c:
Remove layer since it causes warnings about unfixed caps.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Fix obvious typo (we error out if caps were set, we should of
course error out if *no* caps were set).
* sys/oss/gstosselement.c: (gst_osselement_convert):
Fix format conversion, we confused bits/bytes.
* sys/oss/gstosselement.h:
Improve documentation for 'bps'.
* sys/v4l/TODO:
Remove stuff about plugins that need removing - this was done
ages ago.
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query):
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_init), (gst_v4lsrc_src_convert),
(gst_v4lsrc_src_query):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init),
(gst_v4l2src_src_convert), (gst_v4l2src_src_query):
Add get_query_types(), get_formats() and query() functions.
2003-12-21 18:44:34 +00:00
|
|
|
|
|
|
|
/* FIXME:
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
* * require codec data, etc as needed
|
configure.ac: Improve mpeg2enc detection. This is for distributions that do ship mjpegtools, but without mpeg2enc. Al...
Original commit message from CVS:
2003-12-21 Ronald Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
Improve mpeg2enc detection. This is for distributions that do
ship mjpegtools, but without mpeg2enc. Also does object check
for might there ever be ABI incompatibility.
* ext/mpeg2enc/gstmpeg2enc.cc:
Add Andrew as second maintainer (he's helping me), and also add
an error if no caps was set. This happens if I pull before capsnego
and that's something I should solve sometime else.
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_blockgroup):
Fix time parsing.
* gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_link),
(gst_matroska_mux_track_header):
Add caps to templates.
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_sink_factory):
Add mpegversion=1 to prevent confusion with MPEG/AAC.
* gst/mpegstream/gstmpegdemux.c:
Remove layer since it causes warnings about unfixed caps.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Fix obvious typo (we error out if caps were set, we should of
course error out if *no* caps were set).
* sys/oss/gstosselement.c: (gst_osselement_convert):
Fix format conversion, we confused bits/bytes.
* sys/oss/gstosselement.h:
Improve documentation for 'bps'.
* sys/v4l/TODO:
Remove stuff about plugins that need removing - this was done
ages ago.
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query):
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_init), (gst_v4lsrc_src_convert),
(gst_v4lsrc_src_query):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init),
(gst_v4l2src_src_convert), (gst_v4l2src_src_query):
Add get_query_types(), get_formats() and query() functions.
2003-12-21 18:44:34 +00:00
|
|
|
*/
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate audiosink_templ =
|
2011-11-04 10:58:22 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("audio_%u",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_REQUEST,
|
|
|
|
GST_STATIC_CAPS ("audio/mpeg, "
|
2004-03-15 19:32:27 +00:00
|
|
|
"mpegversion = (int) 1, "
|
|
|
|
"layer = (int) [ 1, 3 ], "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
|
|
|
"audio/mpeg, "
|
|
|
|
"mpegversion = (int) { 2, 4 }, "
|
2011-12-08 11:00:45 +00:00
|
|
|
"stream-format = (string) raw, "
|
2004-03-15 19:32:27 +00:00
|
|
|
COMMON_AUDIO_CAPS "; "
|
|
|
|
"audio/x-ac3, "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
2010-10-21 14:15:08 +00:00
|
|
|
"audio/x-eac3, "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
2010-10-21 14:14:44 +00:00
|
|
|
"audio/x-dts, "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
2005-10-14 12:43:30 +00:00
|
|
|
"audio/x-vorbis, "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
2008-08-09 13:48:22 +00:00
|
|
|
"audio/x-flac, "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
2014-03-30 00:35:07 +00:00
|
|
|
"audio/x-opus; "
|
2009-04-13 12:03:03 +00:00
|
|
|
"audio/x-speex, "
|
|
|
|
COMMON_AUDIO_CAPS "; "
|
2011-11-26 09:01:07 +00:00
|
|
|
"audio/x-raw, "
|
|
|
|
"format = (string) { U8, S16BE, S16LE, S24BE, S24LE, S32BE, S32LE, F32LE, F64LE }, "
|
2012-01-04 10:52:29 +00:00
|
|
|
"layout = (string) interleaved, "
|
2008-08-02 17:52:16 +00:00
|
|
|
COMMON_AUDIO_CAPS ";"
|
2004-09-15 19:43:37 +00:00
|
|
|
"audio/x-tta, "
|
2004-08-26 11:10:16 +00:00
|
|
|
"width = (int) { 8, 16, 24 }, "
|
2008-08-25 14:15:43 +00:00
|
|
|
"channels = (int) { 1, 2 }, " "rate = (int) [ 8000, 96000 ]; "
|
|
|
|
"audio/x-pn-realaudio, "
|
2009-08-08 03:47:48 +00:00
|
|
|
"raversion = (int) { 1, 2, 8 }, " COMMON_AUDIO_CAPS "; "
|
|
|
|
"audio/x-wma, " "wmaversion = (int) [ 1, 3 ], "
|
|
|
|
"block_align = (int) [ 0, 65535 ], bitrate = (int) [ 0, 524288 ], "
|
2011-04-05 12:28:54 +00:00
|
|
|
COMMON_AUDIO_CAPS ";"
|
|
|
|
"audio/x-alaw, "
|
|
|
|
"channels = (int) {1, 2}, " "rate = (int) [ 8000, 192000 ]; "
|
|
|
|
"audio/x-mulaw, "
|
2012-01-14 18:58:17 +00:00
|
|
|
"channels = (int) {1, 2}, " "rate = (int) [ 8000, 192000 ]; "
|
|
|
|
"audio/x-adpcm, "
|
|
|
|
"layout = (string)dvi, "
|
2013-12-23 23:43:39 +00:00
|
|
|
"block_align = (int)[64, 8192], "
|
2014-01-03 14:25:23 +00:00
|
|
|
"channels = (int) { 1, 2 }, " "rate = (int) [ 8000, 96000 ]; "
|
2015-03-28 17:15:36 +00:00
|
|
|
"audio/G722, "
|
|
|
|
"channels = (int)1," "rate = (int)16000; "
|
2014-01-03 14:25:23 +00:00
|
|
|
"audio/x-adpcm, "
|
|
|
|
"layout = (string)g726, " "channels = (int)1," "rate = (int)8000; ")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2003-12-22 01:47:09 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate subtitlesink_templ =
|
2012-10-18 20:20:39 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("subtitle_%u",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_REQUEST,
|
2011-12-16 15:56:37 +00:00
|
|
|
GST_STATIC_CAPS ("subtitle/x-kate; "
|
2012-09-02 01:50:50 +00:00
|
|
|
"text/x-raw, format=utf8; application/x-ssa; application/x-ass; "
|
2012-08-20 22:30:38 +00:00
|
|
|
"application/x-usf; subpicture/x-dvd; "
|
2011-12-16 15:56:37 +00:00
|
|
|
"application/x-subtitle-unknown")
|
|
|
|
);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2012-11-30 17:20:18 +00:00
|
|
|
static gpointer parent_class; /* NULL */
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/* Matroska muxer destructor */
|
2012-11-30 17:20:18 +00:00
|
|
|
static void gst_matroska_mux_class_init (GstMatroskaMuxClass * klass);
|
|
|
|
static void gst_matroska_mux_init (GstMatroskaMux * mux, gpointer g_class);
|
2005-10-14 12:43:30 +00:00
|
|
|
static void gst_matroska_mux_finalize (GObject * object);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
/* Pads collected callback */
|
2012-04-17 13:14:27 +00:00
|
|
|
static GstFlowReturn gst_matroska_mux_handle_buffer (GstCollectPads * pads,
|
|
|
|
GstCollectData * data, GstBuffer * buf, gpointer user_data);
|
|
|
|
static gboolean gst_matroska_mux_handle_sink_event (GstCollectPads * pads,
|
|
|
|
GstCollectData * data, GstEvent * event, gpointer user_data);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* pad functions */
|
2005-10-14 12:43:30 +00:00
|
|
|
static gboolean gst_matroska_mux_handle_src_event (GstPad * pad,
|
2011-11-26 09:01:07 +00:00
|
|
|
GstObject * parent, GstEvent * event);
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstPad *gst_matroska_mux_request_new_pad (GstElement * element,
|
2011-11-26 09:01:07 +00:00
|
|
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
static void gst_matroska_mux_release_pad (GstElement * element, GstPad * pad);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* gst internal change state handler */
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_matroska_mux_change_state (GstElement * element, GstStateChange transition);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* gobject bla bla */
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_matroska_mux_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_matroska_mux_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* reset muxer */
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_matroska_mux_reset (GstElement * element);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2004-09-01 12:10:21 +00:00
|
|
|
/* uid generation */
|
2014-01-30 08:43:50 +00:00
|
|
|
static guint64 gst_matroska_mux_create_uid (GstMatroskaMux * mux);
|
2004-09-01 12:10:21 +00:00
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
static gboolean theora_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context);
|
|
|
|
static gboolean vorbis_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context);
|
2009-04-13 12:03:03 +00:00
|
|
|
static gboolean speex_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context);
|
2009-02-15 18:49:44 +00:00
|
|
|
static gboolean kate_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context);
|
2008-08-09 13:48:22 +00:00
|
|
|
static gboolean flac_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context);
|
2011-06-02 00:04:27 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_simple_tag (const GstTagList * list, const gchar * tag,
|
|
|
|
gpointer data);
|
2016-02-19 22:44:42 +00:00
|
|
|
static gboolean gst_matroska_mux_tag_list_is_empty (const GstTagList * list);
|
2015-02-02 22:46:27 +00:00
|
|
|
static void gst_matroska_mux_write_streams_tags (GstMatroskaMux * mux);
|
|
|
|
static gboolean gst_matroska_mux_streams_have_tags (GstMatroskaMux * mux);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2012-11-30 17:20:18 +00:00
|
|
|
/* Cannot use boilerplate macros here because we need the full init function
|
|
|
|
* signature with the additional class argument, so we use the right template
|
|
|
|
* for the sink caps */
|
|
|
|
GType
|
|
|
|
gst_matroska_mux_get_type (void)
|
|
|
|
{
|
|
|
|
static GType object_type; /* 0 */
|
|
|
|
|
|
|
|
if (object_type == 0) {
|
|
|
|
static const GTypeInfo object_info = {
|
|
|
|
sizeof (GstMatroskaMuxClass),
|
|
|
|
NULL, /* base_init */
|
|
|
|
NULL, /* base_finalize */
|
|
|
|
(GClassInitFunc) gst_matroska_mux_class_init,
|
|
|
|
NULL, /* class_finalize */
|
|
|
|
NULL, /* class_data */
|
|
|
|
sizeof (GstMatroskaMux),
|
|
|
|
0, /* n_preallocs */
|
|
|
|
(GInstanceInitFunc) gst_matroska_mux_init
|
|
|
|
};
|
|
|
|
const GInterfaceInfo iface_info = { NULL };
|
|
|
|
|
|
|
|
object_type = g_type_register_static (GST_TYPE_ELEMENT,
|
|
|
|
"GstMatroskaMux", &object_info, (GTypeFlags) 0);
|
|
|
|
|
|
|
|
g_type_add_interface_static (object_type, GST_TYPE_TAG_SETTER, &iface_info);
|
|
|
|
g_type_add_interface_static (object_type, GST_TYPE_TOC_SETTER, &iface_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return object_type;
|
|
|
|
}
|
|
|
|
|
2010-05-20 17:57:14 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_class_init (GstMatroskaMuxClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2010-05-20 17:57:14 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
2016-03-04 01:30:12 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&videosink_templ);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&audiosink_templ);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&subtitlesink_templ);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &src_templ);
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Matroska muxer",
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
"Codec/Muxer",
|
|
|
|
"Muxes video/audio/subtitle streams into a matroska stream",
|
2015-07-16 16:19:03 +00:00
|
|
|
"GStreamer maintainers <gstreamer-devel@lists.freedesktop.org>");
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (matroskamux_debug, "matroskamux", 0,
|
|
|
|
"Matroska muxer");
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
gobject_class->finalize = gst_matroska_mux_finalize;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
gobject_class->get_property = gst_matroska_mux_get_property;
|
|
|
|
gobject_class->set_property = gst_matroska_mux_set_property;
|
|
|
|
|
2015-04-27 10:22:11 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_WRITING_APP,
|
2005-10-14 12:43:30 +00:00
|
|
|
g_param_spec_string ("writing-app", "Writing application.",
|
|
|
|
"The name the application that creates the matroska file.",
|
2010-10-13 14:21:23 +00:00
|
|
|
NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2015-04-27 10:22:11 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DOCTYPE_VERSION,
|
2010-05-09 10:35:10 +00:00
|
|
|
g_param_spec_int ("version", "DocType version",
|
2010-05-20 17:57:14 +00:00
|
|
|
"This parameter determines what Matroska features can be used.",
|
2010-10-13 14:21:23 +00:00
|
|
|
1, 2, DEFAULT_DOCTYPE_VERSION,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2015-04-27 10:22:11 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MIN_INDEX_INTERVAL,
|
2009-05-27 11:51:44 +00:00
|
|
|
g_param_spec_int64 ("min-index-interval", "Minimum time between index "
|
|
|
|
"entries", "An index entry is created every so many nanoseconds.",
|
2010-10-13 14:21:23 +00:00
|
|
|
0, G_MAXINT64, DEFAULT_MIN_INDEX_INTERVAL,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2015-04-27 10:22:11 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_STREAMABLE,
|
2010-06-09 13:42:19 +00:00
|
|
|
g_param_spec_boolean ("streamable", "Determines whether output should "
|
|
|
|
"be streamable", "If set to true, the output should be as if it is "
|
|
|
|
"to be streamed and hence no indexes written or duration written.",
|
2014-09-12 08:06:18 +00:00
|
|
|
DEFAULT_STREAMABLE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2016-04-08 11:05:57 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_TIMECODESCALE,
|
|
|
|
g_param_spec_int64 ("timecodescale", "Timecode Scale",
|
|
|
|
"TimecodeScale used to calculate the Raw Timecode of a Block", 1,
|
|
|
|
GST_SECOND, DEFAULT_TIMECODESCALE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2017-07-17 22:26:11 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MIN_CLUSTER_DURATION,
|
|
|
|
g_param_spec_int64 ("min-cluster-duration", "Minimum cluster duration",
|
2019-06-03 20:21:12 +00:00
|
|
|
"Desired cluster duration as nanoseconds. A new cluster will be "
|
2017-07-17 22:26:11 +00:00
|
|
|
"created irrespective of this property if a force key unit event "
|
|
|
|
"is received. 0 means create a new cluster for each video keyframe "
|
|
|
|
"or for each audio buffer in audio only streams.", 0,
|
|
|
|
G_MAXINT64, DEFAULT_MIN_CLUSTER_DURATION,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_CLUSTER_DURATION,
|
|
|
|
g_param_spec_int64 ("max-cluster-duration", "Maximum cluster duration",
|
|
|
|
"A new cluster will be created if its duration exceeds this value. "
|
|
|
|
"0 means no maximum duration.", 0,
|
|
|
|
G_MAXINT64, DEFAULT_MAX_CLUSTER_DURATION,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2019-04-18 12:31:00 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_OFFSET_TO_ZERO,
|
|
|
|
g_param_spec_boolean ("offset-to-zero", "Offset To Zero",
|
|
|
|
"Offsets all streams so that the " "earliest stream starts at 0.",
|
|
|
|
DEFAULT_OFFSET_TO_ZERO, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2018-05-31 08:29:43 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_CREATION_TIME,
|
|
|
|
g_param_spec_boxed ("creation-time", "Creation Time",
|
|
|
|
"Date and time of creation. This will be used for the DateUTC field."
|
|
|
|
" NULL means that the current time will be used.",
|
|
|
|
G_TYPE_DATE_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2006-11-16 15:36:48 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_mux_change_state);
|
|
|
|
gstelement_class->request_new_pad =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_mux_request_new_pad);
|
|
|
|
gstelement_class->release_pad =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_mux_release_pad);
|
2012-11-30 17:20:18 +00:00
|
|
|
|
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2015-07-07 14:59:20 +00:00
|
|
|
/*
|
2011-10-11 00:07:13 +00:00
|
|
|
* Start of pad option handler code
|
|
|
|
*/
|
|
|
|
#define DEFAULT_PAD_FRAME_DURATION TRUE
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_PAD_0,
|
|
|
|
PROP_PAD_FRAME_DURATION
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstPad parent;
|
|
|
|
gboolean frame_duration;
|
|
|
|
gboolean frame_duration_user;
|
|
|
|
} GstMatroskamuxPad;
|
|
|
|
|
2014-11-09 10:04:33 +00:00
|
|
|
typedef GstPadClass GstMatroskamuxPadClass;
|
2011-10-11 00:07:13 +00:00
|
|
|
|
2014-11-09 10:04:33 +00:00
|
|
|
GType gst_matroskamux_pad_get_type (void);
|
|
|
|
G_DEFINE_TYPE (GstMatroskamuxPad, gst_matroskamux_pad, GST_TYPE_PAD);
|
2011-10-11 00:07:13 +00:00
|
|
|
|
|
|
|
#define GST_TYPE_MATROSKAMUX_PAD (gst_matroskamux_pad_get_type())
|
|
|
|
#define GST_MATROSKAMUX_PAD(pad) (G_TYPE_CHECK_INSTANCE_CAST((pad),GST_TYPE_MATROSKAMUX_PAD,GstMatroskamuxPad))
|
|
|
|
#define GST_MATROSKAMUX_PAD_CAST(pad) ((GstMatroskamuxPad *) pad)
|
|
|
|
#define GST_IS_MATROSKAMUX_PAD(pad) (G_TYPE_CHECK_INSTANCE_TYPE((pad),GST_TYPE_MATROSKAMUX_PAD))
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroskamux_pad_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstMatroskamuxPad *pad = GST_MATROSKAMUX_PAD (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PAD_FRAME_DURATION:
|
|
|
|
g_value_set_boolean (value, pad->frame_duration);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroskamux_pad_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstMatroskamuxPad *pad = GST_MATROSKAMUX_PAD (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_PAD_FRAME_DURATION:
|
|
|
|
pad->frame_duration = g_value_get_boolean (value);
|
|
|
|
pad->frame_duration_user = TRUE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-11-09 10:04:33 +00:00
|
|
|
gst_matroskamux_pad_class_init (GstMatroskamuxPadClass * klass)
|
2011-10-11 00:07:13 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
|
|
|
|
|
|
gobject_class->set_property = gst_matroskamux_pad_set_property;
|
|
|
|
gobject_class->get_property = gst_matroskamux_pad_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class, PROP_PAD_FRAME_DURATION,
|
2011-12-01 13:22:42 +00:00
|
|
|
g_param_spec_boolean ("frame-duration", "Frame duration",
|
2011-10-11 00:07:13 +00:00
|
|
|
"Default frame duration", DEFAULT_PAD_FRAME_DURATION,
|
|
|
|
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroskamux_pad_init (GstMatroskamuxPad * pad)
|
|
|
|
{
|
|
|
|
pad->frame_duration = DEFAULT_PAD_FRAME_DURATION;
|
|
|
|
pad->frame_duration_user = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* End of pad option handler code
|
|
|
|
**/
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2012-11-30 17:20:18 +00:00
|
|
|
gst_matroska_mux_init (GstMatroskaMux * mux, gpointer g_class)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2010-05-20 17:57:14 +00:00
|
|
|
GstPadTemplate *templ;
|
|
|
|
|
|
|
|
templ =
|
2012-11-30 17:20:18 +00:00
|
|
|
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (g_class), "src");
|
2010-05-20 17:57:14 +00:00
|
|
|
mux->srcpad = gst_pad_new_from_template (templ, "src");
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
gst_pad_set_event_function (mux->srcpad, gst_matroska_mux_handle_src_event);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
|
2012-04-20 11:35:15 +00:00
|
|
|
gst_pad_use_fixed_caps (mux->srcpad);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2012-04-17 13:14:27 +00:00
|
|
|
mux->collect = gst_collect_pads_new ();
|
|
|
|
gst_collect_pads_set_clip_function (mux->collect,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_collect_pads_clip_running_time), mux);
|
|
|
|
gst_collect_pads_set_buffer_function (mux->collect,
|
2011-12-15 20:45:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_mux_handle_buffer), mux);
|
2012-04-17 13:14:27 +00:00
|
|
|
gst_collect_pads_set_event_function (mux->collect,
|
2011-12-15 20:45:17 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_mux_handle_sink_event), mux);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
mux->ebml_write = gst_ebml_write_new (mux->srcpad);
|
2010-05-20 18:01:58 +00:00
|
|
|
mux->doctype = GST_MATROSKA_DOCTYPE_MATROSKA;
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
/* property defaults */
|
2010-05-09 10:35:10 +00:00
|
|
|
mux->doctype_version = DEFAULT_DOCTYPE_VERSION;
|
2009-01-08 15:56:46 +00:00
|
|
|
mux->writing_app = g_strdup (DEFAULT_WRITING_APP);
|
2009-05-27 11:51:44 +00:00
|
|
|
mux->min_index_interval = DEFAULT_MIN_INDEX_INTERVAL;
|
2015-10-11 10:37:51 +00:00
|
|
|
mux->ebml_write->streamable = DEFAULT_STREAMABLE;
|
2016-04-08 11:05:57 +00:00
|
|
|
mux->time_scale = DEFAULT_TIMECODESCALE;
|
2017-07-17 22:26:11 +00:00
|
|
|
mux->min_cluster_duration = DEFAULT_MIN_CLUSTER_DURATION;
|
|
|
|
mux->max_cluster_duration = DEFAULT_MAX_CLUSTER_DURATION;
|
2009-01-08 15:56:46 +00:00
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
/* initialize internal variables */
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
mux->index = NULL;
|
2009-01-08 15:56:46 +00:00
|
|
|
mux->num_streams = 0;
|
|
|
|
mux->num_a_streams = 0;
|
|
|
|
mux->num_t_streams = 0;
|
|
|
|
mux->num_v_streams = 0;
|
2017-12-15 13:48:09 +00:00
|
|
|
mux->internal_toc = NULL;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
/* initialize remaining variables */
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_matroska_mux_reset (GST_ELEMENT (mux));
|
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_finalize:
|
|
|
|
* @object: #GstMatroskaMux that should be finalized.
|
|
|
|
*
|
|
|
|
* Finalize matroska muxer.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gst_matroska_mux_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstMatroskaMux *mux = GST_MATROSKA_MUX (object);
|
|
|
|
|
2011-03-15 10:03:53 +00:00
|
|
|
gst_event_replace (&mux->force_key_unit_event, NULL);
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
gst_object_unref (mux->collect);
|
|
|
|
gst_object_unref (mux->ebml_write);
|
2015-11-15 05:31:08 +00:00
|
|
|
g_free (mux->writing_app);
|
2018-05-31 08:29:43 +00:00
|
|
|
g_clear_pointer (&mux->creation_time, g_date_time_unref);
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2017-12-15 13:48:09 +00:00
|
|
|
if (mux->internal_toc) {
|
2017-12-01 17:17:06 +00:00
|
|
|
gst_toc_unref (mux->internal_toc);
|
2017-12-15 13:48:09 +00:00
|
|
|
mux->internal_toc = NULL;
|
2017-12-01 17:17:06 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_create_uid:
|
2014-01-30 08:43:50 +00:00
|
|
|
* @mux: #GstMatroskaMux to generate UID for.
|
2005-10-14 12:43:30 +00:00
|
|
|
*
|
2018-09-05 23:11:00 +00:00
|
|
|
* Generate new track UID.
|
2005-10-14 12:43:30 +00:00
|
|
|
*
|
|
|
|
* Returns: New track UID.
|
|
|
|
*/
|
2008-08-02 17:47:32 +00:00
|
|
|
static guint64
|
2014-01-30 08:43:50 +00:00
|
|
|
gst_matroska_mux_create_uid (GstMatroskaMux * mux)
|
2004-09-01 12:10:21 +00:00
|
|
|
{
|
2018-09-05 23:11:00 +00:00
|
|
|
return (((guint64) g_random_int ()) << 32) | g_random_int ();
|
2004-09-01 12:10:21 +00:00
|
|
|
}
|
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
/**
|
2009-01-08 15:56:46 +00:00
|
|
|
* gst_matroska_pad_reset:
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
* @collect_pad: the #GstMatroskaPad
|
|
|
|
*
|
2009-01-08 15:56:46 +00:00
|
|
|
* Reset and/or release resources of a matroska collect pad.
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
*/
|
|
|
|
static void
|
2009-01-08 15:56:46 +00:00
|
|
|
gst_matroska_pad_reset (GstMatroskaPad * collect_pad, gboolean full)
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
{
|
2009-01-08 15:56:46 +00:00
|
|
|
gchar *name = NULL;
|
|
|
|
GstMatroskaTrackType type = 0;
|
2008-11-05 14:42:35 +00:00
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
/* free track information */
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
if (collect_pad->track != NULL) {
|
2009-01-08 15:56:46 +00:00
|
|
|
/* retrieve for optional later use */
|
|
|
|
name = collect_pad->track->name;
|
|
|
|
type = collect_pad->track->type;
|
|
|
|
/* extra for video */
|
|
|
|
if (type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
|
|
|
|
GstMatroskaTrackVideoContext *ctx =
|
|
|
|
(GstMatroskaTrackVideoContext *) collect_pad->track;
|
|
|
|
|
|
|
|
if (ctx->dirac_unit) {
|
|
|
|
gst_buffer_unref (ctx->dirac_unit);
|
|
|
|
ctx->dirac_unit = NULL;
|
|
|
|
}
|
|
|
|
}
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
g_free (collect_pad->track->codec_id);
|
|
|
|
g_free (collect_pad->track->codec_name);
|
2009-01-08 15:56:46 +00:00
|
|
|
if (full)
|
|
|
|
g_free (collect_pad->track->name);
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
g_free (collect_pad->track->language);
|
|
|
|
g_free (collect_pad->track->codec_priv);
|
|
|
|
g_free (collect_pad->track);
|
|
|
|
collect_pad->track = NULL;
|
2015-02-02 22:46:27 +00:00
|
|
|
if (collect_pad->tags) {
|
|
|
|
gst_tag_list_unref (collect_pad->tags);
|
|
|
|
collect_pad->tags = NULL;
|
|
|
|
}
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
}
|
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
if (!full && type != 0) {
|
|
|
|
GstMatroskaTrackContext *context;
|
|
|
|
|
|
|
|
/* create a fresh context */
|
|
|
|
switch (type) {
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:
|
|
|
|
context = (GstMatroskaTrackContext *)
|
|
|
|
g_new0 (GstMatroskaTrackVideoContext, 1);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_AUDIO:
|
|
|
|
context = (GstMatroskaTrackContext *)
|
|
|
|
g_new0 (GstMatroskaTrackAudioContext, 1);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:
|
|
|
|
context = (GstMatroskaTrackContext *)
|
|
|
|
g_new0 (GstMatroskaTrackSubtitleContext, 1);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2011-04-16 15:51:32 +00:00
|
|
|
return;
|
2009-01-08 15:56:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
context->type = type;
|
|
|
|
context->name = name;
|
2016-02-22 12:25:51 +00:00
|
|
|
context->uid = gst_matroska_mux_create_uid (collect_pad->mux);
|
2009-01-08 15:56:46 +00:00
|
|
|
/* TODO: check default values for the context */
|
|
|
|
context->flags = GST_MATROSKA_TRACK_ENABLED | GST_MATROSKA_TRACK_DEFAULT;
|
|
|
|
collect_pad->track = context;
|
|
|
|
collect_pad->start_ts = GST_CLOCK_TIME_NONE;
|
|
|
|
collect_pad->end_ts = GST_CLOCK_TIME_NONE;
|
2015-02-02 22:46:27 +00:00
|
|
|
collect_pad->tags = gst_tag_list_new_empty ();
|
|
|
|
gst_tag_list_set_scope (collect_pad->tags, GST_TAG_SCOPE_STREAM);
|
2009-01-08 15:56:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_pad_free:
|
|
|
|
* @collect_pad: the #GstMatroskaPad
|
|
|
|
*
|
|
|
|
* Release resources of a matroska collect pad.
|
|
|
|
*/
|
|
|
|
static void
|
2011-12-02 01:58:30 +00:00
|
|
|
gst_matroska_pad_free (GstPad * collect_pad)
|
2009-01-08 15:56:46 +00:00
|
|
|
{
|
2011-12-02 01:58:30 +00:00
|
|
|
gst_matroska_pad_reset ((GstMatroskaPad *) collect_pad, TRUE);
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_reset:
|
2019-09-02 12:27:35 +00:00
|
|
|
* @element: #GstMatroskaMux that should be reset.
|
2005-10-14 12:43:30 +00:00
|
|
|
*
|
|
|
|
* Reset matroska muxer back to initial state.
|
|
|
|
*/
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_mux_reset (GstElement * element)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
|
|
|
GstMatroskaMux *mux = GST_MATROSKA_MUX (element);
|
2005-10-14 12:43:30 +00:00
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
/* reset EBML write */
|
|
|
|
gst_ebml_write_reset (mux->ebml_write);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* reset input */
|
|
|
|
mux->state = GST_MATROSKA_MUX_STATE_START;
|
|
|
|
|
|
|
|
/* clean up existing streams */
|
2009-01-08 15:56:46 +00:00
|
|
|
|
|
|
|
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
|
2005-10-14 12:43:30 +00:00
|
|
|
GstMatroskaPad *collect_pad;
|
|
|
|
|
|
|
|
collect_pad = (GstMatroskaPad *) walk->data;
|
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
/* reset collect pad to pristine state */
|
|
|
|
gst_matroska_pad_reset (collect_pad, FALSE);
|
2005-10-14 12:43:30 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* reset indexes */
|
|
|
|
mux->num_indexes = 0;
|
|
|
|
g_free (mux->index);
|
|
|
|
mux->index = NULL;
|
|
|
|
|
|
|
|
/* reset timers */
|
|
|
|
mux->duration = 0;
|
2004-09-01 12:10:21 +00:00
|
|
|
|
2004-09-09 15:40:06 +00:00
|
|
|
/* reset cluster */
|
|
|
|
mux->cluster = 0;
|
|
|
|
mux->cluster_time = 0;
|
|
|
|
mux->cluster_pos = 0;
|
2010-05-01 12:20:59 +00:00
|
|
|
mux->prev_cluster_size = 0;
|
2004-09-09 17:54:26 +00:00
|
|
|
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
/* reset tags */
|
2009-01-06 17:48:10 +00:00
|
|
|
gst_tag_setter_reset_tags (GST_TAG_SETTER (mux));
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
mux->tags_pos = 0;
|
|
|
|
|
|
|
|
/* reset chapters */
|
2012-06-25 19:11:53 +00:00
|
|
|
gst_toc_setter_reset (GST_TOC_SETTER (mux));
|
2017-12-15 13:48:09 +00:00
|
|
|
if (mux->internal_toc) {
|
|
|
|
gst_toc_unref (mux->internal_toc);
|
|
|
|
mux->internal_toc = NULL;
|
|
|
|
}
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
mux->chapters_pos = 0;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
/**
|
|
|
|
* gst_matroska_mux_handle_src_event:
|
|
|
|
* @pad: Pad which received the event.
|
|
|
|
* @event: Received event.
|
|
|
|
*
|
2011-02-16 15:09:20 +00:00
|
|
|
* handle events - copied from oggmux without understanding
|
2005-10-14 12:43:30 +00:00
|
|
|
*
|
2017-10-03 23:30:10 +00:00
|
|
|
* Returns: %TRUE on success.
|
2005-10-14 12:43:30 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_mux_handle_src_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event)
|
2005-10-14 12:43:30 +00:00
|
|
|
{
|
|
|
|
GstEventType type;
|
|
|
|
|
|
|
|
type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
/* disable seeking for now */
|
|
|
|
return FALSE;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
return gst_pad_event_default (pad, parent, event);
|
2005-10-14 12:43:30 +00:00
|
|
|
}
|
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroska_mux_free_codec_priv (GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
if (context->codec_priv != NULL) {
|
|
|
|
g_free (context->codec_priv);
|
|
|
|
context->codec_priv = NULL;
|
|
|
|
context->codec_priv_size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-16 15:56:37 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_build_vobsub_private (GstMatroskaTrackContext * context,
|
|
|
|
const guint * clut)
|
|
|
|
{
|
|
|
|
gchar *clutv[17];
|
|
|
|
gchar *sclut;
|
|
|
|
gint i;
|
|
|
|
guint32 col;
|
|
|
|
gdouble y, u, v;
|
|
|
|
guint8 r, g, b;
|
|
|
|
|
|
|
|
/* produce comma-separated list in hex format */
|
|
|
|
for (i = 0; i < 16; ++i) {
|
|
|
|
col = clut[i];
|
|
|
|
/* replicate vobsub's slightly off RGB conversion calculation */
|
|
|
|
y = (((col >> 16) & 0xff) - 16) * 255 / 219;
|
|
|
|
u = ((col >> 8) & 0xff) - 128;
|
|
|
|
v = (col & 0xff) - 128;
|
|
|
|
r = CLAMP (1.0 * y + 1.4022 * u, 0, 255);
|
|
|
|
g = CLAMP (1.0 * y - 0.3456 * u - 0.7145 * v, 0, 255);
|
|
|
|
b = CLAMP (1.0 * y + 1.7710 * v, 0, 255);
|
|
|
|
clutv[i] = g_strdup_printf ("%02x%02x%02x", r, g, b);
|
|
|
|
}
|
|
|
|
clutv[i] = NULL;
|
|
|
|
sclut = g_strjoinv (",", clutv);
|
|
|
|
|
|
|
|
/* build codec private; only palette for now */
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2011-12-16 15:56:37 +00:00
|
|
|
context->codec_priv = (guint8 *) g_strdup_printf ("palette: %s", sclut);
|
|
|
|
/* include terminating 0 */
|
|
|
|
context->codec_priv_size = strlen ((gchar *) context->codec_priv) + 1;
|
|
|
|
g_free (sclut);
|
|
|
|
for (i = 0; i < 16; ++i) {
|
|
|
|
g_free (clutv[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
/**
|
|
|
|
* gst_matroska_mux_handle_sink_event:
|
|
|
|
* @pad: Pad which received the event.
|
|
|
|
* @event: Received event.
|
|
|
|
*
|
|
|
|
* handle events - informational ones like tags
|
|
|
|
*
|
2017-10-03 23:30:10 +00:00
|
|
|
* Returns: %TRUE on success.
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
2012-04-17 13:14:27 +00:00
|
|
|
gst_matroska_mux_handle_sink_event (GstCollectPads * pads,
|
|
|
|
GstCollectData * data, GstEvent * event, gpointer user_data)
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
{
|
|
|
|
GstMatroskaPad *collect_pad;
|
2012-01-10 13:32:32 +00:00
|
|
|
GstMatroskaTrackContext *context;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
GstMatroskaMux *mux;
|
2011-12-15 15:30:17 +00:00
|
|
|
GstPad *pad;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
GstTagList *list;
|
2012-04-16 14:37:49 +00:00
|
|
|
gboolean ret = TRUE;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
2011-12-15 15:30:17 +00:00
|
|
|
mux = GST_MATROSKA_MUX (user_data);
|
|
|
|
collect_pad = (GstMatroskaPad *) data;
|
|
|
|
pad = data->pad;
|
2011-12-16 15:56:37 +00:00
|
|
|
context = collect_pad->track;
|
|
|
|
g_assert (context);
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
case GST_EVENT_CAPS:{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
collect_pad = (GstMatroskaPad *) gst_pad_get_element_private (pad);
|
|
|
|
gst_event_parse_caps (event, &caps);
|
|
|
|
|
2012-01-26 09:37:52 +00:00
|
|
|
ret = collect_pad->capsfunc (pad, caps);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
event = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2009-12-13 12:45:22 +00:00
|
|
|
case GST_EVENT_TAG:{
|
|
|
|
gchar *lang = NULL;
|
|
|
|
|
2009-01-06 17:48:10 +00:00
|
|
|
GST_DEBUG_OBJECT (mux, "received tag event");
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
gst_event_parse_tag (event, &list);
|
2009-01-06 17:48:10 +00:00
|
|
|
|
2009-12-13 12:45:22 +00:00
|
|
|
/* Matroska wants ISO 639-2B code, taglist most likely contains 639-1 */
|
|
|
|
if (gst_tag_list_get_string (list, GST_TAG_LANGUAGE_CODE, &lang)) {
|
|
|
|
const gchar *lang_code;
|
|
|
|
|
|
|
|
lang_code = gst_tag_get_language_code_iso_639_2B (lang);
|
|
|
|
if (lang_code) {
|
|
|
|
GST_INFO_OBJECT (pad, "Setting language to '%s'", lang_code);
|
2014-04-17 13:04:00 +00:00
|
|
|
g_free (context->language);
|
2009-12-13 12:45:22 +00:00
|
|
|
context->language = g_strdup (lang_code);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (pad, "Did not get language code for '%s'", lang);
|
|
|
|
}
|
|
|
|
g_free (lang);
|
|
|
|
}
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
2010-10-13 23:22:03 +00:00
|
|
|
/* FIXME: what about stream-specific tags? */
|
2015-02-02 22:46:27 +00:00
|
|
|
if (gst_tag_list_get_scope (list) == GST_TAG_SCOPE_GLOBAL) {
|
|
|
|
gst_tag_setter_merge_tags (GST_TAG_SETTER (mux), list,
|
|
|
|
gst_tag_setter_get_tag_merge_mode (GST_TAG_SETTER (mux)));
|
|
|
|
} else {
|
|
|
|
gst_tag_list_insert (collect_pad->tags, list, GST_TAG_MERGE_REPLACE);
|
|
|
|
}
|
2010-10-13 23:22:03 +00:00
|
|
|
|
|
|
|
gst_event_unref (event);
|
2011-03-14 14:46:50 +00:00
|
|
|
/* handled this, don't want collectpads to forward it downstream */
|
|
|
|
event = NULL;
|
2012-01-26 09:37:52 +00:00
|
|
|
ret = TRUE;
|
2008-08-09 14:02:27 +00:00
|
|
|
break;
|
2009-12-13 12:45:22 +00:00
|
|
|
}
|
2012-03-29 19:22:28 +00:00
|
|
|
case GST_EVENT_TOC:{
|
2012-06-25 19:11:53 +00:00
|
|
|
GstToc *toc, *old_toc;
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
if (mux->chapters_pos > 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (mux, "received toc event");
|
|
|
|
gst_event_parse_toc (event, &toc, NULL);
|
|
|
|
|
|
|
|
if (toc != NULL) {
|
2012-06-25 19:11:53 +00:00
|
|
|
old_toc = gst_toc_setter_get_toc (GST_TOC_SETTER (mux));
|
|
|
|
if (old_toc != NULL) {
|
|
|
|
if (old_toc != toc)
|
|
|
|
GST_INFO_OBJECT (pad, "Replacing TOC with a new one");
|
|
|
|
gst_toc_unref (old_toc);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_toc_setter_set_toc (GST_TOC_SETTER (mux), toc);
|
2012-06-24 21:51:16 +00:00
|
|
|
gst_toc_unref (toc);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_event_unref (event);
|
|
|
|
/* handled this, don't want collectpads to forward it downstream */
|
|
|
|
event = NULL;
|
|
|
|
break;
|
|
|
|
}
|
2014-03-22 16:01:27 +00:00
|
|
|
case GST_EVENT_CUSTOM_DOWNSTREAM:
|
|
|
|
case GST_EVENT_CUSTOM_DOWNSTREAM_STICKY:{
|
2011-03-15 10:03:53 +00:00
|
|
|
const GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_event_get_structure (event);
|
|
|
|
if (gst_structure_has_name (structure, "GstForceKeyUnit")) {
|
|
|
|
gst_event_replace (&mux->force_key_unit_event, NULL);
|
|
|
|
mux->force_key_unit_event = event;
|
|
|
|
event = NULL;
|
2011-12-16 15:56:37 +00:00
|
|
|
} else if (gst_structure_has_name (structure, "application/x-gst-dvd") &&
|
|
|
|
!strcmp ("dvd-spu-clut-change",
|
|
|
|
gst_structure_get_string (structure, "event"))) {
|
|
|
|
gchar name[16];
|
|
|
|
gint i, value;
|
|
|
|
guint clut[16];
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (pad, "New DVD colour table received");
|
|
|
|
if (context->type != GST_MATROSKA_TRACK_TYPE_SUBTITLE) {
|
|
|
|
GST_DEBUG_OBJECT (pad, "... discarding");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* first transform event data into table form */
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
g_snprintf (name, sizeof (name), "clut%02d", i);
|
|
|
|
if (!gst_structure_get_int (structure, name, &value)) {
|
|
|
|
GST_ERROR_OBJECT (mux, "dvd-spu-clut-change event did not "
|
|
|
|
"contain %s field", name);
|
2014-05-02 13:25:01 +00:00
|
|
|
goto break_hard;
|
2011-12-16 15:56:37 +00:00
|
|
|
}
|
|
|
|
clut[i] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* transform into private data for stream; text form */
|
|
|
|
gst_matroska_mux_build_vobsub_private (context, clut);
|
2011-03-15 10:03:53 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-26 09:37:52 +00:00
|
|
|
/* fall through */
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-05-02 13:25:01 +00:00
|
|
|
break_hard:
|
2012-04-16 14:37:49 +00:00
|
|
|
if (event != NULL)
|
2012-04-17 13:14:27 +00:00
|
|
|
return gst_collect_pads_event_default (pads, data, event, FALSE);
|
2012-04-16 14:37:49 +00:00
|
|
|
|
2012-01-26 09:37:52 +00:00
|
|
|
return ret;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
}
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_set_codec_id (GstMatroskaTrackContext * context,
|
|
|
|
const char *id)
|
|
|
|
{
|
|
|
|
g_assert (context && id);
|
2015-11-15 05:31:08 +00:00
|
|
|
g_free (context->codec_id);
|
2012-01-09 17:28:17 +00:00
|
|
|
context->codec_id = g_strdup (id);
|
|
|
|
}
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_video_pad_setcaps:
|
|
|
|
* @pad: Pad which got the caps.
|
|
|
|
* @caps: New caps.
|
|
|
|
*
|
|
|
|
* Setcaps function for video sink pad.
|
|
|
|
*
|
2017-10-03 23:30:10 +00:00
|
|
|
* Returns: %TRUE on success.
|
2005-10-14 12:43:30 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_mux_video_pad_setcaps (GstPad * pad, GstCaps * caps)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
|
|
|
GstMatroskaTrackContext *context = NULL;
|
|
|
|
GstMatroskaTrackVideoContext *videocontext;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
GstMatroskaMux *mux;
|
2005-10-14 12:43:30 +00:00
|
|
|
GstMatroskaPad *collect_pad;
|
2008-01-08 19:57:23 +00:00
|
|
|
GstStructure *structure;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
const gchar *mimetype;
|
2015-06-10 14:22:54 +00:00
|
|
|
const gchar *interlace_mode, *s;
|
2009-01-08 15:56:46 +00:00
|
|
|
const GValue *value = NULL;
|
2011-11-26 09:01:07 +00:00
|
|
|
GstBuffer *codec_buf = NULL;
|
2005-10-14 12:43:30 +00:00
|
|
|
gint width, height, pixel_width, pixel_height;
|
2008-01-08 19:57:23 +00:00
|
|
|
gint fps_d, fps_n;
|
2016-11-11 18:45:01 +00:00
|
|
|
guint multiview_flags;
|
2018-02-26 11:03:59 +00:00
|
|
|
GstCaps *old_caps;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
|
|
|
|
2018-02-26 11:03:59 +00:00
|
|
|
if ((old_caps = gst_pad_get_current_caps (pad))) {
|
|
|
|
if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER
|
|
|
|
&& !gst_caps_is_equal (caps, old_caps)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
2019-04-25 18:52:42 +00:00
|
|
|
("Caps changes are not supported by Matroska"));
|
2018-02-26 11:03:59 +00:00
|
|
|
gst_caps_unref (old_caps);
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
gst_caps_unref (old_caps);
|
|
|
|
}
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* find context */
|
2005-10-14 12:43:30 +00:00
|
|
|
collect_pad = (GstMatroskaPad *) gst_pad_get_element_private (pad);
|
|
|
|
g_assert (collect_pad);
|
|
|
|
context = collect_pad->track;
|
|
|
|
g_assert (context);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO);
|
|
|
|
videocontext = (GstMatroskaTrackVideoContext *) context;
|
|
|
|
|
|
|
|
/* gst -> matroska ID'ing */
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
mimetype = gst_structure_get_name (structure);
|
|
|
|
|
2012-09-03 11:46:03 +00:00
|
|
|
interlace_mode = gst_structure_get_string (structure, "interlace-mode");
|
2018-08-23 20:57:35 +00:00
|
|
|
if (interlace_mode != NULL) {
|
|
|
|
if (strcmp (interlace_mode, "progressive") == 0)
|
|
|
|
videocontext->interlace_mode = GST_MATROSKA_INTERLACE_MODE_PROGRESSIVE;
|
|
|
|
else
|
|
|
|
videocontext->interlace_mode = GST_MATROSKA_INTERLACE_MODE_INTERLACED;
|
|
|
|
} else {
|
|
|
|
videocontext->interlace_mode = GST_MATROSKA_INTERLACE_MODE_UNKNOWN;
|
|
|
|
}
|
2010-05-01 12:12:28 +00:00
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
if (!strcmp (mimetype, "video/x-theora")) {
|
|
|
|
/* we'll extract the details later from the theora identification header */
|
|
|
|
goto skip_details;
|
|
|
|
}
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
/* get general properties */
|
2010-01-11 16:50:04 +00:00
|
|
|
/* spec says it is mandatory */
|
|
|
|
if (!gst_structure_get_int (structure, "width", &width) ||
|
|
|
|
!gst_structure_get_int (structure, "height", &height))
|
|
|
|
goto refuse_caps;
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
videocontext->pixel_width = width;
|
|
|
|
videocontext->pixel_height = height;
|
2011-10-11 00:07:13 +00:00
|
|
|
|
|
|
|
if (GST_MATROSKAMUX_PAD_CAST (pad)->frame_duration
|
|
|
|
&& gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d)
|
2009-02-23 11:14:23 +00:00
|
|
|
&& fps_n > 0) {
|
2008-01-08 19:57:23 +00:00
|
|
|
context->default_duration =
|
|
|
|
gst_util_uint64_scale_int (GST_SECOND, fps_d, fps_n);
|
|
|
|
GST_LOG_OBJECT (pad, "default duration = %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (context->default_duration));
|
|
|
|
} else {
|
|
|
|
context->default_duration = 0;
|
|
|
|
}
|
2005-11-28 15:13:22 +00:00
|
|
|
if (gst_structure_get_fraction (structure, "pixel-aspect-ratio",
|
|
|
|
&pixel_width, &pixel_height)) {
|
2003-12-22 01:47:09 +00:00
|
|
|
if (pixel_width > pixel_height) {
|
|
|
|
videocontext->display_width = width * pixel_width / pixel_height;
|
|
|
|
videocontext->display_height = height;
|
|
|
|
} else if (pixel_width < pixel_height) {
|
|
|
|
videocontext->display_width = width;
|
|
|
|
videocontext->display_height = height * pixel_height / pixel_width;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
} else {
|
|
|
|
videocontext->display_width = 0;
|
|
|
|
videocontext->display_height = 0;
|
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
} else {
|
|
|
|
videocontext->display_width = 0;
|
|
|
|
videocontext->display_height = 0;
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2018-05-22 20:14:03 +00:00
|
|
|
if ((s = gst_structure_get_string (structure, "colorimetry"))) {
|
|
|
|
if (!gst_video_colorimetry_from_string (&videocontext->colorimetry, s)) {
|
|
|
|
GST_WARNING_OBJECT (pad, "Could not parse colorimetry %s", s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-19 04:34:49 +00:00
|
|
|
if ((s = gst_structure_get_string (structure, "mastering-display-info"))) {
|
|
|
|
if (!gst_video_mastering_display_info_from_string
|
|
|
|
(&videocontext->mastering_display_info, s)) {
|
|
|
|
GST_WARNING_OBJECT (pad, "Could not parse mastering-display-metadata %s",
|
|
|
|
s);
|
|
|
|
} else {
|
|
|
|
videocontext->mastering_display_info_present = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((s = gst_structure_get_string (structure, "content-light-level"))) {
|
|
|
|
if (!gst_video_content_light_level_from_string
|
|
|
|
(&videocontext->content_light_level, s))
|
|
|
|
GST_WARNING_OBJECT (pad, "Could not parse content-light-level %s", s);
|
|
|
|
}
|
|
|
|
|
2015-06-10 14:22:54 +00:00
|
|
|
/* Collect stereoscopic info, if any */
|
|
|
|
if ((s = gst_structure_get_string (structure, "multiview-mode")))
|
|
|
|
videocontext->multiview_mode =
|
|
|
|
gst_video_multiview_mode_from_caps_string (s);
|
2016-11-11 18:45:01 +00:00
|
|
|
gst_structure_get_flagset (structure, "multiview-flags", &multiview_flags,
|
|
|
|
NULL);
|
|
|
|
videocontext->multiview_flags = multiview_flags;
|
2015-06-10 14:22:54 +00:00
|
|
|
|
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
skip_details:
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
videocontext->asr_mode = GST_MATROSKA_ASPECT_RATIO_MODE_FREE;
|
|
|
|
videocontext->fourcc = 0;
|
|
|
|
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
/* TODO: - check if we handle all codecs by the spec, i.e. codec private
|
|
|
|
* data and other settings
|
|
|
|
* - add new formats
|
|
|
|
*/
|
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
/* extract codec_data, may turn out needed */
|
|
|
|
value = gst_structure_get_value (structure, "codec_data");
|
|
|
|
if (value)
|
2011-11-26 09:01:07 +00:00
|
|
|
codec_buf = (GstBuffer *) gst_value_get_buffer (value);
|
2009-01-08 15:56:46 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
/* find type */
|
2011-11-26 09:01:07 +00:00
|
|
|
if (!strcmp (mimetype, "video/x-raw")) {
|
|
|
|
const gchar *fstr;
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED);
|
2011-11-26 09:01:07 +00:00
|
|
|
fstr = gst_structure_get_string (structure, "format");
|
2014-05-05 13:32:06 +00:00
|
|
|
if (fstr) {
|
|
|
|
if (strlen (fstr) == 4)
|
|
|
|
videocontext->fourcc = GST_STR_FOURCC (fstr);
|
|
|
|
else if (!strcmp (fstr, "GRAY8"))
|
|
|
|
videocontext->fourcc = GST_MAKE_FOURCC ('Y', '8', '0', '0');
|
|
|
|
else if (!strcmp (fstr, "BGR"))
|
|
|
|
videocontext->fourcc = GST_MAKE_FOURCC ('B', 'G', 'R', 24);
|
|
|
|
else if (!strcmp (fstr, "RGB"))
|
|
|
|
videocontext->fourcc = GST_MAKE_FOURCC ('R', 'G', 'B', 24);
|
|
|
|
}
|
2012-09-03 01:51:24 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-huffyuv") /* MS/VfW compatibility cases */
|
|
|
|
||!strcmp (mimetype, "video/x-divx")
|
2006-04-25 11:45:00 +00:00
|
|
|
|| !strcmp (mimetype, "video/x-dv")
|
2009-01-08 15:56:46 +00:00
|
|
|
|| !strcmp (mimetype, "video/x-h263")
|
2009-08-06 23:15:17 +00:00
|
|
|
|| !strcmp (mimetype, "video/x-msmpeg")
|
2011-10-31 14:43:25 +00:00
|
|
|
|| !strcmp (mimetype, "video/x-wmv")
|
|
|
|
|| !strcmp (mimetype, "image/jpeg")) {
|
2010-04-08 09:56:09 +00:00
|
|
|
gst_riff_strf_vids *bih;
|
|
|
|
gint size = sizeof (gst_riff_strf_vids);
|
2009-01-08 15:56:46 +00:00
|
|
|
guint32 fourcc = 0;
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2012-09-03 01:51:24 +00:00
|
|
|
if (!strcmp (mimetype, "video/x-huffyuv"))
|
2009-01-08 15:56:46 +00:00
|
|
|
fourcc = GST_MAKE_FOURCC ('H', 'F', 'Y', 'U');
|
2006-04-25 11:45:00 +00:00
|
|
|
else if (!strcmp (mimetype, "video/x-dv"))
|
2009-01-08 15:56:46 +00:00
|
|
|
fourcc = GST_MAKE_FOURCC ('D', 'V', 'S', 'D');
|
2006-04-25 11:45:00 +00:00
|
|
|
else if (!strcmp (mimetype, "video/x-h263"))
|
2009-01-08 15:56:46 +00:00
|
|
|
fourcc = GST_MAKE_FOURCC ('H', '2', '6', '3');
|
2006-04-25 11:45:00 +00:00
|
|
|
else if (!strcmp (mimetype, "video/x-divx")) {
|
|
|
|
gint divxversion;
|
|
|
|
|
|
|
|
gst_structure_get_int (structure, "divxversion", &divxversion);
|
|
|
|
switch (divxversion) {
|
|
|
|
case 3:
|
2009-01-08 15:56:46 +00:00
|
|
|
fourcc = GST_MAKE_FOURCC ('D', 'I', 'V', '3');
|
2006-04-25 11:45:00 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2009-01-08 15:56:46 +00:00
|
|
|
fourcc = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
|
2006-04-25 11:45:00 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2009-01-08 15:56:46 +00:00
|
|
|
fourcc = GST_MAKE_FOURCC ('D', 'X', '5', '0');
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (!strcmp (mimetype, "video/x-msmpeg")) {
|
|
|
|
gint msmpegversion;
|
|
|
|
|
|
|
|
gst_structure_get_int (structure, "msmpegversion", &msmpegversion);
|
|
|
|
switch (msmpegversion) {
|
|
|
|
case 41:
|
|
|
|
fourcc = GST_MAKE_FOURCC ('M', 'P', 'G', '4');
|
|
|
|
break;
|
|
|
|
case 42:
|
|
|
|
fourcc = GST_MAKE_FOURCC ('M', 'P', '4', '2');
|
|
|
|
break;
|
|
|
|
case 43:
|
|
|
|
goto msmpeg43;
|
2006-04-25 11:45:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-08-06 23:15:17 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-wmv")) {
|
|
|
|
gint wmvversion;
|
2011-11-26 09:01:07 +00:00
|
|
|
const gchar *fstr;
|
|
|
|
|
|
|
|
fstr = gst_structure_get_string (structure, "format");
|
|
|
|
if (fstr && strlen (fstr) == 4) {
|
|
|
|
fourcc = GST_STR_FOURCC (fstr);
|
2009-08-06 23:15:17 +00:00
|
|
|
} else if (gst_structure_get_int (structure, "wmvversion", &wmvversion)) {
|
|
|
|
if (wmvversion == 2) {
|
|
|
|
fourcc = GST_MAKE_FOURCC ('W', 'M', 'V', '2');
|
|
|
|
} else if (wmvversion == 1) {
|
|
|
|
fourcc = GST_MAKE_FOURCC ('W', 'M', 'V', '1');
|
|
|
|
} else if (wmvversion == 3) {
|
|
|
|
fourcc = GST_MAKE_FOURCC ('W', 'M', 'V', '3');
|
|
|
|
}
|
|
|
|
}
|
2011-10-31 14:43:25 +00:00
|
|
|
} else if (!strcmp (mimetype, "image/jpeg")) {
|
|
|
|
fourcc = GST_MAKE_FOURCC ('M', 'J', 'P', 'G');
|
2003-12-22 01:47:09 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
if (!fourcc)
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2006-04-25 11:45:00 +00:00
|
|
|
|
2010-04-08 09:56:09 +00:00
|
|
|
bih = g_new0 (gst_riff_strf_vids, 1);
|
|
|
|
GST_WRITE_UINT32_LE (&bih->size, size);
|
|
|
|
GST_WRITE_UINT32_LE (&bih->width, videocontext->pixel_width);
|
|
|
|
GST_WRITE_UINT32_LE (&bih->height, videocontext->pixel_height);
|
|
|
|
GST_WRITE_UINT32_LE (&bih->compression, fourcc);
|
|
|
|
GST_WRITE_UINT16_LE (&bih->planes, (guint16) 1);
|
|
|
|
GST_WRITE_UINT16_LE (&bih->bit_cnt, (guint16) 24);
|
|
|
|
GST_WRITE_UINT32_LE (&bih->image_size, videocontext->pixel_width *
|
2009-01-08 15:56:46 +00:00
|
|
|
videocontext->pixel_height * 3);
|
|
|
|
|
|
|
|
/* process codec private/initialization data, if any */
|
|
|
|
if (codec_buf) {
|
2011-11-26 09:01:07 +00:00
|
|
|
size += gst_buffer_get_size (codec_buf);
|
2006-04-25 11:45:00 +00:00
|
|
|
bih = g_realloc (bih, size);
|
2010-04-08 09:56:09 +00:00
|
|
|
GST_WRITE_UINT32_LE (&bih->size, size);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (codec_buf, 0,
|
|
|
|
(guint8 *) bih + sizeof (gst_riff_strf_vids), -1);
|
2006-04-25 11:45:00 +00:00
|
|
|
}
|
2004-08-27 17:01:12 +00:00
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC);
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2004-08-27 17:01:12 +00:00
|
|
|
context->codec_priv = (gpointer) bih;
|
2006-04-25 11:45:00 +00:00
|
|
|
context->codec_priv_size = size;
|
2015-02-26 22:28:11 +00:00
|
|
|
context->dts_only = TRUE;
|
2005-10-14 12:43:30 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-h264")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC);
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2005-10-14 12:43:30 +00:00
|
|
|
/* Create avcC header */
|
2009-01-08 15:56:46 +00:00
|
|
|
if (codec_buf != NULL) {
|
2011-11-26 09:01:07 +00:00
|
|
|
context->codec_priv_size = gst_buffer_get_size (codec_buf);
|
2009-01-08 15:56:46 +00:00
|
|
|
context->codec_priv = g_malloc0 (context->codec_priv_size);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (codec_buf, 0, context->codec_priv, -1);
|
2005-10-14 12:43:30 +00:00
|
|
|
}
|
2014-01-06 13:54:46 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-h265")) {
|
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_MPEGH_HEVC);
|
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
/* Create hvcC header */
|
|
|
|
if (codec_buf != NULL) {
|
|
|
|
context->codec_priv_size = gst_buffer_get_size (codec_buf);
|
|
|
|
context->codec_priv = g_malloc0 (context->codec_priv_size);
|
|
|
|
gst_buffer_extract (codec_buf, 0, context->codec_priv, -1);
|
|
|
|
}
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-theora")) {
|
|
|
|
const GValue *streamheader;
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_THEORA);
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
|
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (!theora_streamheader_to_codecdata (streamheader, context)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
|
|
|
("theora stream headers missing or malformed"));
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
}
|
2008-02-29 06:18:55 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-dirac")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_DIRAC);
|
2010-04-27 13:26:13 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-vp8")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_VP8);
|
2013-06-21 11:11:32 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-vp9")) {
|
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_VP9);
|
2017-12-13 09:22:17 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-av1")) {
|
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_AV1);
|
2018-07-25 21:09:06 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
/* Create av1C header */
|
|
|
|
if (codec_buf != NULL)
|
|
|
|
gst_buffer_extract_dup (codec_buf, 0, gst_buffer_get_size (codec_buf),
|
|
|
|
&context->codec_priv, &context->codec_priv_size);
|
2003-12-22 01:47:09 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/mpeg")) {
|
|
|
|
gint mpegversion;
|
|
|
|
|
|
|
|
gst_structure_get_int (structure, "mpegversion", &mpegversion);
|
|
|
|
switch (mpegversion) {
|
|
|
|
case 1:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_MPEG1);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-12-22 01:47:09 +00:00
|
|
|
case 2:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_MPEG2);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-18 18:06:14 +00:00
|
|
|
case 4:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-18 18:06:14 +00:00
|
|
|
default:
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2003-12-22 01:47:09 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2009-01-08 15:56:46 +00:00
|
|
|
/* global headers may be in codec data */
|
|
|
|
if (codec_buf != NULL) {
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2011-11-26 09:01:07 +00:00
|
|
|
context->codec_priv_size = gst_buffer_get_size (codec_buf);
|
2009-01-08 15:56:46 +00:00
|
|
|
context->codec_priv = g_malloc0 (context->codec_priv_size);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (codec_buf, 0, context->codec_priv, -1);
|
2009-01-08 15:56:46 +00:00
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-msmpeg")) {
|
2009-01-08 15:56:46 +00:00
|
|
|
msmpeg43:
|
|
|
|
/* can only make it here if preceding case verified it was version 3 */
|
2016-07-07 15:14:43 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3);
|
2008-08-25 14:15:43 +00:00
|
|
|
} else if (!strcmp (mimetype, "video/x-pn-realvideo")) {
|
|
|
|
gint rmversion;
|
|
|
|
const GValue *mdpr_data;
|
|
|
|
|
|
|
|
gst_structure_get_int (structure, "rmversion", &rmversion);
|
|
|
|
switch (rmversion) {
|
|
|
|
case 1:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2008-08-25 14:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mdpr_data = gst_structure_get_value (structure, "mdpr_data");
|
|
|
|
if (mdpr_data != NULL) {
|
|
|
|
guint8 *priv_data = NULL;
|
|
|
|
guint priv_data_size = 0;
|
|
|
|
|
|
|
|
GstBuffer *codec_data_buf = g_value_peek_pointer (mdpr_data);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
priv_data_size = gst_buffer_get_size (codec_data_buf);
|
2008-08-25 14:15:43 +00:00
|
|
|
priv_data = g_malloc0 (priv_data_size);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (codec_data_buf, 0, priv_data, -1);
|
2008-08-25 14:15:43 +00:00
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2008-08-25 14:15:43 +00:00
|
|
|
context->codec_priv = priv_data;
|
|
|
|
context->codec_priv_size = priv_data_size;
|
|
|
|
}
|
2015-11-18 10:01:20 +00:00
|
|
|
} else if (strcmp (mimetype, "video/x-prores") == 0) {
|
|
|
|
const gchar *variant;
|
|
|
|
|
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
|
|
|
|
variant = gst_structure_get_string (structure, "format");
|
|
|
|
if (!variant || !g_strcmp0 (variant, "standard"))
|
|
|
|
context->codec_priv = g_strdup ("apcn");
|
|
|
|
else if (!g_strcmp0 (variant, "hq"))
|
|
|
|
context->codec_priv = g_strdup ("apch");
|
|
|
|
else if (!g_strcmp0 (variant, "lt"))
|
|
|
|
context->codec_priv = g_strdup ("apcs");
|
|
|
|
else if (!g_strcmp0 (variant, "proxy"))
|
|
|
|
context->codec_priv = g_strdup ("apco");
|
|
|
|
else if (!g_strcmp0 (variant, "4444"))
|
|
|
|
context->codec_priv = g_strdup ("ap4h");
|
|
|
|
else {
|
|
|
|
GST_WARNING_OBJECT (mux, "Unhandled prores format: %s", variant);
|
|
|
|
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->codec_priv_size = sizeof (guint32);
|
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_VIDEO_PRORES);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2010-01-11 16:50:04 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
refuse_caps:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (mux, "pad %s refused caps %" GST_PTR_FORMAT,
|
|
|
|
GST_PAD_NAME (pad), caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2009-02-15 18:49:44 +00:00
|
|
|
/* N > 0 to expect a particular number of headers, negative if the
|
|
|
|
number of headers is variable */
|
|
|
|
static gboolean
|
|
|
|
xiphN_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context, GstBuffer ** p_buf0, int N)
|
|
|
|
{
|
|
|
|
GstBuffer **buf = NULL;
|
|
|
|
GArray *bufarr;
|
|
|
|
guint8 *priv_data;
|
|
|
|
guint bufi, i, offset, priv_data_size;
|
|
|
|
|
|
|
|
if (streamheader == NULL)
|
|
|
|
goto no_stream_headers;
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (streamheader) != GST_TYPE_ARRAY)
|
|
|
|
goto wrong_type;
|
|
|
|
|
|
|
|
bufarr = g_value_peek_pointer (streamheader);
|
|
|
|
if (bufarr->len <= 0 || bufarr->len > 255) /* at least one header, and count stored in a byte */
|
|
|
|
goto wrong_count;
|
|
|
|
if (N > 0 && bufarr->len != N)
|
|
|
|
goto wrong_count;
|
|
|
|
|
|
|
|
context->xiph_headers_to_skip = bufarr->len;
|
|
|
|
|
|
|
|
buf = (GstBuffer **) g_malloc0 (sizeof (GstBuffer *) * bufarr->len);
|
|
|
|
for (i = 0; i < bufarr->len; i++) {
|
|
|
|
GValue *bufval = &g_array_index (bufarr, GValue, i);
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (bufval) != GST_TYPE_BUFFER) {
|
|
|
|
g_free (buf);
|
|
|
|
goto wrong_content_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
buf[i] = g_value_peek_pointer (bufval);
|
|
|
|
}
|
|
|
|
|
|
|
|
priv_data_size = 1;
|
|
|
|
if (bufarr->len > 0) {
|
|
|
|
for (i = 0; i < bufarr->len - 1; i++) {
|
2011-11-26 09:01:07 +00:00
|
|
|
priv_data_size += gst_buffer_get_size (buf[i]) / 0xff + 1;
|
2009-02-15 18:49:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < bufarr->len; ++i) {
|
2011-11-26 09:01:07 +00:00
|
|
|
priv_data_size += gst_buffer_get_size (buf[i]);
|
2009-02-15 18:49:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
priv_data = g_malloc0 (priv_data_size);
|
|
|
|
|
|
|
|
priv_data[0] = bufarr->len - 1;
|
|
|
|
offset = 1;
|
|
|
|
|
|
|
|
if (bufarr->len > 0) {
|
|
|
|
for (bufi = 0; bufi < bufarr->len - 1; bufi++) {
|
2011-11-26 09:01:07 +00:00
|
|
|
for (i = 0; i < gst_buffer_get_size (buf[bufi]) / 0xff; ++i) {
|
2009-02-15 18:49:44 +00:00
|
|
|
priv_data[offset++] = 0xff;
|
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
priv_data[offset++] = gst_buffer_get_size (buf[bufi]) % 0xff;
|
2009-02-15 18:49:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < bufarr->len; ++i) {
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (buf[i], 0, priv_data + offset, -1);
|
|
|
|
offset += gst_buffer_get_size (buf[i]);
|
2009-02-15 18:49:44 +00:00
|
|
|
}
|
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2009-02-15 18:49:44 +00:00
|
|
|
context->codec_priv = priv_data;
|
|
|
|
context->codec_priv_size = priv_data_size;
|
|
|
|
|
|
|
|
if (p_buf0)
|
|
|
|
*p_buf0 = gst_buffer_ref (buf[0]);
|
|
|
|
|
|
|
|
g_free (buf);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
no_stream_headers:
|
|
|
|
{
|
|
|
|
GST_WARNING ("required streamheaders missing in sink caps!");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_type:
|
|
|
|
{
|
|
|
|
GST_WARNING ("streamheaders are not a GST_TYPE_ARRAY, but a %s",
|
|
|
|
G_VALUE_TYPE_NAME (streamheader));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_count:
|
|
|
|
{
|
2010-01-11 14:14:06 +00:00
|
|
|
GST_WARNING ("got %u streamheaders, not %d as expected", bufarr->len, N);
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_content_type:
|
|
|
|
{
|
|
|
|
GST_WARNING ("streamheaders array does not contain GstBuffers");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
vorbis_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GstBuffer *buf0 = NULL;
|
|
|
|
|
2010-01-11 14:14:06 +00:00
|
|
|
if (!xiphN_streamheader_to_codecdata (streamheader, context, &buf0, 3))
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (buf0 == NULL || gst_buffer_get_size (buf0) < 1 + 6 + 4) {
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
GST_WARNING ("First vorbis header too small, ignoring");
|
|
|
|
} else {
|
2011-11-26 09:01:07 +00:00
|
|
|
if (gst_buffer_memcmp (buf0, 1, "vorbis", 6) == 0) {
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
GstMatroskaTrackAudioContext *audiocontext;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
guint8 *hdr;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf0, &map, GST_MAP_READ);
|
|
|
|
hdr = map.data + 1 + 6 + 4;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
audiocontext = (GstMatroskaTrackAudioContext *) context;
|
|
|
|
audiocontext->channels = GST_READ_UINT8 (hdr);
|
|
|
|
audiocontext->samplerate = GST_READ_UINT32_LE (hdr + 1);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf0, &map);
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buf0)
|
|
|
|
gst_buffer_unref (buf0);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
theora_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GstBuffer *buf0 = NULL;
|
|
|
|
|
2010-01-11 14:14:06 +00:00
|
|
|
if (!xiphN_streamheader_to_codecdata (streamheader, context, &buf0, 3))
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (buf0 == NULL || gst_buffer_get_size (buf0) < 1 + 6 + 26) {
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
GST_WARNING ("First theora header too small, ignoring");
|
2011-11-26 09:01:07 +00:00
|
|
|
} else if (gst_buffer_memcmp (buf0, 0, "\200theora\003\002", 9) != 0) {
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
GST_WARNING ("First header not a theora identification header, ignoring");
|
|
|
|
} else {
|
|
|
|
GstMatroskaTrackVideoContext *videocontext;
|
|
|
|
guint fps_num, fps_denom, par_num, par_denom;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
guint8 *hdr;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf0, &map, GST_MAP_READ);
|
|
|
|
hdr = map.data + 1 + 6 + 3 + 2 + 2;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
|
|
|
|
videocontext = (GstMatroskaTrackVideoContext *) context;
|
|
|
|
videocontext->pixel_width = GST_READ_UINT32_BE (hdr) >> 8;
|
|
|
|
videocontext->pixel_height = GST_READ_UINT32_BE (hdr + 3) >> 8;
|
|
|
|
hdr += 3 + 3 + 1 + 1;
|
|
|
|
fps_num = GST_READ_UINT32_BE (hdr);
|
|
|
|
fps_denom = GST_READ_UINT32_BE (hdr + 4);
|
|
|
|
context->default_duration = gst_util_uint64_scale_int (GST_SECOND,
|
|
|
|
fps_denom, fps_num);
|
|
|
|
hdr += 4 + 4;
|
|
|
|
par_num = GST_READ_UINT32_BE (hdr) >> 8;
|
|
|
|
par_denom = GST_READ_UINT32_BE (hdr + 3) >> 8;
|
2014-04-21 12:34:37 +00:00
|
|
|
if (par_num > 0 && par_denom > 0) {
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
if (par_num > par_denom) {
|
|
|
|
videocontext->display_width =
|
|
|
|
videocontext->pixel_width * par_num / par_denom;
|
|
|
|
videocontext->display_height = videocontext->pixel_height;
|
|
|
|
} else if (par_num < par_denom) {
|
|
|
|
videocontext->display_width = videocontext->pixel_width;
|
|
|
|
videocontext->display_height =
|
|
|
|
videocontext->pixel_height * par_denom / par_num;
|
|
|
|
} else {
|
|
|
|
videocontext->display_width = 0;
|
|
|
|
videocontext->display_height = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
videocontext->display_width = 0;
|
|
|
|
videocontext->display_height = 0;
|
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf0, &map);
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (buf0)
|
|
|
|
gst_buffer_unref (buf0);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2009-02-15 18:49:44 +00:00
|
|
|
static gboolean
|
|
|
|
kate_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GstBuffer *buf0 = NULL;
|
|
|
|
|
|
|
|
if (!xiphN_streamheader_to_codecdata (streamheader, context, &buf0, -1))
|
|
|
|
return FALSE;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (buf0 == NULL || gst_buffer_get_size (buf0) < 64) { /* Kate ID header is 64 bytes */
|
2009-02-15 18:49:44 +00:00
|
|
|
GST_WARNING ("First kate header too small, ignoring");
|
2011-11-26 09:01:07 +00:00
|
|
|
} else if (gst_buffer_memcmp (buf0, 0, "\200kate\0\0\0", 8) != 0) {
|
2009-02-15 18:49:44 +00:00
|
|
|
GST_WARNING ("First header not a kate identification header, ignoring");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buf0)
|
|
|
|
gst_buffer_unref (buf0);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2008-08-09 13:48:22 +00:00
|
|
|
static gboolean
|
|
|
|
flac_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GArray *bufarr;
|
|
|
|
gint i;
|
|
|
|
GValue *bufval;
|
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
if (streamheader == NULL || G_VALUE_TYPE (streamheader) != GST_TYPE_ARRAY) {
|
|
|
|
GST_WARNING ("No or invalid streamheader field in the caps");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bufarr = g_value_peek_pointer (streamheader);
|
|
|
|
if (bufarr->len < 2) {
|
|
|
|
GST_WARNING ("Too few headers in streamheader field");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-08-09 14:02:27 +00:00
|
|
|
context->xiph_headers_to_skip = bufarr->len + 1;
|
2008-08-09 13:48:22 +00:00
|
|
|
|
|
|
|
bufval = &g_array_index (bufarr, GValue, 0);
|
|
|
|
if (G_VALUE_TYPE (bufval) != GST_TYPE_BUFFER) {
|
|
|
|
GST_WARNING ("streamheaders array does not contain GstBuffers");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = g_value_peek_pointer (bufval);
|
|
|
|
|
|
|
|
/* Need at least OggFLAC mapping header, fLaC marker and STREAMINFO block */
|
2011-11-26 09:01:07 +00:00
|
|
|
if (gst_buffer_get_size (buffer) < 9 + 4 + 4 + 34
|
|
|
|
|| gst_buffer_memcmp (buffer, 1, "FLAC", 4) != 0
|
|
|
|
|| gst_buffer_memcmp (buffer, 9, "fLaC", 4) != 0) {
|
2008-08-09 13:48:22 +00:00
|
|
|
GST_WARNING ("Invalid streamheader for FLAC");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2011-11-26 09:01:07 +00:00
|
|
|
context->codec_priv_size = gst_buffer_get_size (buffer) - 9;
|
|
|
|
context->codec_priv = g_malloc (context->codec_priv_size);
|
|
|
|
gst_buffer_extract (buffer, 9, context->codec_priv, -1);
|
2008-08-09 13:48:22 +00:00
|
|
|
|
|
|
|
for (i = 1; i < bufarr->len; i++) {
|
2011-11-26 09:01:07 +00:00
|
|
|
guint old_size;
|
2008-08-09 13:48:22 +00:00
|
|
|
bufval = &g_array_index (bufarr, GValue, i);
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (bufval) != GST_TYPE_BUFFER) {
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2008-08-09 13:48:22 +00:00
|
|
|
GST_WARNING ("streamheaders array does not contain GstBuffers");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = g_value_peek_pointer (bufval);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
old_size = context->codec_priv_size;
|
|
|
|
context->codec_priv_size += gst_buffer_get_size (buffer);
|
|
|
|
|
|
|
|
context->codec_priv = g_realloc (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
gst_buffer_extract (buffer, 0,
|
|
|
|
(guint8 *) context->codec_priv + old_size, -1);
|
2008-08-09 13:48:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-04-13 12:03:03 +00:00
|
|
|
static gboolean
|
|
|
|
speex_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GArray *bufarr;
|
|
|
|
GValue *bufval;
|
|
|
|
GstBuffer *buffer;
|
2011-11-26 09:01:07 +00:00
|
|
|
guint old_size;
|
2009-04-13 12:03:03 +00:00
|
|
|
|
|
|
|
if (streamheader == NULL || G_VALUE_TYPE (streamheader) != GST_TYPE_ARRAY) {
|
|
|
|
GST_WARNING ("No or invalid streamheader field in the caps");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bufarr = g_value_peek_pointer (streamheader);
|
|
|
|
if (bufarr->len != 2) {
|
|
|
|
GST_WARNING ("Too few headers in streamheader field");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
context->xiph_headers_to_skip = bufarr->len + 1;
|
|
|
|
|
|
|
|
bufval = &g_array_index (bufarr, GValue, 0);
|
|
|
|
if (G_VALUE_TYPE (bufval) != GST_TYPE_BUFFER) {
|
|
|
|
GST_WARNING ("streamheaders array does not contain GstBuffers");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = g_value_peek_pointer (bufval);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (gst_buffer_get_size (buffer) < 80
|
|
|
|
|| gst_buffer_memcmp (buffer, 0, "Speex ", 8) != 0) {
|
2009-04-13 12:03:03 +00:00
|
|
|
GST_WARNING ("Invalid streamheader for Speex");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2011-11-26 09:01:07 +00:00
|
|
|
context->codec_priv_size = gst_buffer_get_size (buffer);
|
|
|
|
context->codec_priv = g_malloc (context->codec_priv_size);
|
|
|
|
gst_buffer_extract (buffer, 0, context->codec_priv, -1);
|
2009-04-13 12:03:03 +00:00
|
|
|
|
|
|
|
bufval = &g_array_index (bufarr, GValue, 1);
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (bufval) != GST_TYPE_BUFFER) {
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2009-04-13 12:03:03 +00:00
|
|
|
GST_WARNING ("streamheaders array does not contain GstBuffers");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer = g_value_peek_pointer (bufval);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
old_size = context->codec_priv_size;
|
|
|
|
context->codec_priv_size += gst_buffer_get_size (buffer);
|
|
|
|
context->codec_priv = g_realloc (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
gst_buffer_extract (buffer, 0, (guint8 *) context->codec_priv + old_size, -1);
|
2009-04-13 12:03:03 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-12-17 17:36:18 +00:00
|
|
|
static gboolean
|
|
|
|
opus_streamheader_to_codecdata (const GValue * streamheader,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GArray *bufarr;
|
|
|
|
GValue *bufval;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (streamheader) != GST_TYPE_ARRAY)
|
|
|
|
goto wrong_type;
|
|
|
|
|
|
|
|
bufarr = g_value_peek_pointer (streamheader);
|
2015-11-18 16:01:48 +00:00
|
|
|
if (bufarr->len != 1 && bufarr->len != 2) /* one header, and count stored in a byte */
|
2014-12-17 17:36:18 +00:00
|
|
|
goto wrong_count;
|
|
|
|
|
2015-11-03 09:49:54 +00:00
|
|
|
/* Opus headers are not in-band */
|
|
|
|
context->xiph_headers_to_skip = 0;
|
2014-12-17 17:36:18 +00:00
|
|
|
|
|
|
|
bufval = &g_array_index (bufarr, GValue, 0);
|
|
|
|
if (G_VALUE_TYPE (bufval) != GST_TYPE_BUFFER) {
|
|
|
|
goto wrong_content_type;
|
|
|
|
}
|
|
|
|
buf = g_value_peek_pointer (bufval);
|
|
|
|
|
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
|
|
|
|
context->codec_priv_size = gst_buffer_get_size (buf);
|
|
|
|
context->codec_priv = g_malloc0 (context->codec_priv_size);
|
|
|
|
gst_buffer_extract (buf, 0, context->codec_priv, -1);
|
|
|
|
|
2015-11-03 10:18:19 +00:00
|
|
|
context->codec_delay =
|
|
|
|
GST_READ_UINT16_LE ((guint8 *) context->codec_priv + 10);
|
|
|
|
context->codec_delay =
|
|
|
|
gst_util_uint64_scale_round (context->codec_delay, GST_SECOND, 48000);
|
|
|
|
context->seek_preroll = 80 * GST_MSECOND;
|
|
|
|
|
2014-12-17 17:36:18 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_type:
|
|
|
|
{
|
|
|
|
GST_WARNING ("streamheaders are not a GST_TYPE_ARRAY, but a %s",
|
|
|
|
G_VALUE_TYPE_NAME (streamheader));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_count:
|
|
|
|
{
|
|
|
|
GST_WARNING ("got %u streamheaders, not 1 or 2 as expected", bufarr->len);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_content_type:
|
|
|
|
{
|
|
|
|
GST_WARNING ("streamheaders array does not contain GstBuffers");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-04 10:43:15 +00:00
|
|
|
static gboolean
|
|
|
|
opus_make_codecdata (GstMatroskaTrackContext * context, GstCaps * caps)
|
|
|
|
{
|
|
|
|
guint32 rate;
|
|
|
|
guint8 channels;
|
|
|
|
guint8 channel_mapping_family;
|
|
|
|
guint8 stream_count, coupled_count, channel_mapping[256];
|
|
|
|
GstBuffer *buffer;
|
|
|
|
GstMapInfo map;
|
|
|
|
|
|
|
|
/* Opus headers are not in-band */
|
|
|
|
context->xiph_headers_to_skip = 0;
|
|
|
|
|
|
|
|
context->codec_delay = 0;
|
|
|
|
context->seek_preroll = 80 * GST_MSECOND;
|
|
|
|
|
|
|
|
if (!gst_codec_utils_opus_parse_caps (caps, &rate, &channels,
|
|
|
|
&channel_mapping_family, &stream_count, &coupled_count,
|
|
|
|
channel_mapping)) {
|
|
|
|
GST_WARNING ("Failed to parse caps for Opus");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
buffer =
|
|
|
|
gst_codec_utils_opus_create_header (rate, channels,
|
|
|
|
channel_mapping_family, stream_count, coupled_count, channel_mapping, 0,
|
|
|
|
0);
|
|
|
|
if (!buffer) {
|
|
|
|
GST_WARNING ("Failed to create Opus header from caps");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
|
|
|
context->codec_priv_size = map.size;
|
|
|
|
context->codec_priv = g_malloc (context->codec_priv_size);
|
|
|
|
memcpy (context->codec_priv, map.data, map.size);
|
|
|
|
gst_buffer_unmap (buffer, &map);
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
/**
|
|
|
|
* gst_matroska_mux_audio_pad_setcaps:
|
|
|
|
* @pad: Pad which got the caps.
|
|
|
|
* @caps: New caps.
|
|
|
|
*
|
|
|
|
* Setcaps function for audio sink pad.
|
|
|
|
*
|
2017-10-03 23:30:10 +00:00
|
|
|
* Returns: %TRUE on success.
|
2005-10-14 12:43:30 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
|
|
|
GstMatroskaTrackContext *context = NULL;
|
|
|
|
GstMatroskaTrackAudioContext *audiocontext;
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
GstMatroskaMux *mux;
|
2005-10-14 12:43:30 +00:00
|
|
|
GstMatroskaPad *collect_pad;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
const gchar *mimetype;
|
2005-10-20 19:14:27 +00:00
|
|
|
gint samplerate = 0, channels = 0;
|
2003-12-22 01:47:09 +00:00
|
|
|
GstStructure *structure;
|
2009-08-08 03:47:48 +00:00
|
|
|
const GValue *codec_data = NULL;
|
2011-11-26 09:01:07 +00:00
|
|
|
GstBuffer *buf = NULL;
|
2010-01-11 15:07:29 +00:00
|
|
|
const gchar *stream_format = NULL;
|
2018-02-26 11:03:59 +00:00
|
|
|
GstCaps *old_caps;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
|
|
|
|
2018-02-26 11:03:59 +00:00
|
|
|
if ((old_caps = gst_pad_get_current_caps (pad))) {
|
|
|
|
if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER
|
|
|
|
&& !gst_caps_is_equal (caps, old_caps)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
2019-04-25 18:52:42 +00:00
|
|
|
("Caps changes are not supported by Matroska"));
|
2018-02-26 11:03:59 +00:00
|
|
|
gst_caps_unref (old_caps);
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
gst_caps_unref (old_caps);
|
|
|
|
}
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* find context */
|
2005-10-14 12:43:30 +00:00
|
|
|
collect_pad = (GstMatroskaPad *) gst_pad_get_element_private (pad);
|
|
|
|
g_assert (collect_pad);
|
|
|
|
context = collect_pad->track;
|
|
|
|
g_assert (context);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_AUDIO);
|
|
|
|
audiocontext = (GstMatroskaTrackAudioContext *) context;
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
mimetype = gst_structure_get_name (structure);
|
|
|
|
|
|
|
|
/* general setup */
|
|
|
|
gst_structure_get_int (structure, "rate", &samplerate);
|
|
|
|
gst_structure_get_int (structure, "channels", &channels);
|
|
|
|
|
|
|
|
audiocontext->samplerate = samplerate;
|
|
|
|
audiocontext->channels = channels;
|
|
|
|
audiocontext->bitdepth = 0;
|
2004-09-01 12:10:21 +00:00
|
|
|
context->default_duration = 0;
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2009-08-08 03:47:48 +00:00
|
|
|
codec_data = gst_structure_get_value (structure, "codec_data");
|
|
|
|
if (codec_data)
|
|
|
|
buf = gst_value_get_buffer (codec_data);
|
|
|
|
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
/* TODO: - check if we handle all codecs by the spec, i.e. codec private
|
|
|
|
* data and other settings
|
|
|
|
* - add new formats
|
|
|
|
*/
|
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
if (!strcmp (mimetype, "audio/mpeg")) {
|
|
|
|
gint mpegversion = 0;
|
|
|
|
|
|
|
|
gst_structure_get_int (structure, "mpegversion", &mpegversion);
|
|
|
|
switch (mpegversion) {
|
2004-03-14 22:34:33 +00:00
|
|
|
case 1:{
|
2004-03-15 19:32:27 +00:00
|
|
|
gint layer;
|
2008-08-02 18:11:32 +00:00
|
|
|
gint version = 1;
|
|
|
|
gint spf;
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_structure_get_int (structure, "layer", &layer);
|
2008-08-02 18:11:32 +00:00
|
|
|
|
|
|
|
if (!gst_structure_get_int (structure, "mpegaudioversion", &version)) {
|
|
|
|
GST_WARNING_OBJECT (mux,
|
|
|
|
"Unable to determine MPEG audio version, assuming 1");
|
|
|
|
version = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (layer == 1)
|
|
|
|
spf = 384;
|
|
|
|
else if (layer == 2)
|
|
|
|
spf = 1152;
|
|
|
|
else if (version == 2)
|
|
|
|
spf = 576;
|
|
|
|
else
|
|
|
|
spf = 1152;
|
|
|
|
|
|
|
|
context->default_duration =
|
|
|
|
gst_util_uint64_scale (GST_SECOND, spf, audiocontext->samplerate);
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
switch (layer) {
|
|
|
|
case 1:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-18 18:06:14 +00:00
|
|
|
default:
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
case 2:
|
2010-01-11 15:07:29 +00:00
|
|
|
case 4:
|
|
|
|
stream_format = gst_structure_get_string (structure, "stream-format");
|
|
|
|
/* check this is raw aac */
|
|
|
|
if (stream_format) {
|
2010-01-11 16:26:32 +00:00
|
|
|
if (strcmp (stream_format, "raw") != 0) {
|
|
|
|
GST_WARNING_OBJECT (mux, "AAC stream-format must be 'raw', not %s",
|
2010-01-11 15:07:29 +00:00
|
|
|
stream_format);
|
|
|
|
}
|
2008-11-10 16:44:45 +00:00
|
|
|
} else {
|
2010-01-11 15:07:29 +00:00
|
|
|
GST_WARNING_OBJECT (mux, "AAC stream-format not specified, "
|
2010-01-11 16:26:32 +00:00
|
|
|
"assuming 'raw'");
|
2008-11-10 16:44:45 +00:00
|
|
|
}
|
2010-01-11 15:07:29 +00:00
|
|
|
|
2008-11-10 16:44:45 +00:00
|
|
|
if (buf) {
|
2016-07-07 15:14:43 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_AAC);
|
2016-01-26 17:50:38 +00:00
|
|
|
context->codec_priv_size = gst_buffer_get_size (buf);
|
|
|
|
context->codec_priv = g_malloc (context->codec_priv_size);
|
|
|
|
gst_buffer_extract (buf, 0, context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
2008-11-10 16:44:45 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (mux, "no AAC codec_data; not packetized");
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2008-11-10 16:44:45 +00:00
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-18 18:06:14 +00:00
|
|
|
default:
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-raw")) {
|
|
|
|
GstAudioInfo info;
|
2006-12-24 11:24:59 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_audio_info_init (&info);
|
|
|
|
if (!gst_audio_info_from_caps (&info, caps)) {
|
|
|
|
GST_DEBUG_OBJECT (mux,
|
|
|
|
"broken caps, rejected by gst_audio_info_from_caps");
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2006-12-24 11:24:59 +00:00
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
switch (GST_AUDIO_INFO_FORMAT (&info)) {
|
|
|
|
case GST_AUDIO_FORMAT_U8:
|
|
|
|
case GST_AUDIO_FORMAT_S16BE:
|
|
|
|
case GST_AUDIO_FORMAT_S16LE:
|
|
|
|
case GST_AUDIO_FORMAT_S24BE:
|
|
|
|
case GST_AUDIO_FORMAT_S24LE:
|
|
|
|
case GST_AUDIO_FORMAT_S32BE:
|
|
|
|
case GST_AUDIO_FORMAT_S32LE:
|
|
|
|
if (GST_AUDIO_INFO_WIDTH (&info) != GST_AUDIO_INFO_DEPTH (&info)) {
|
|
|
|
GST_DEBUG_OBJECT (mux, "width must be same as depth!");
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
if (GST_AUDIO_INFO_IS_BIG_ENDIAN (&info))
|
2012-01-10 13:32:32 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE);
|
2011-11-26 09:01:07 +00:00
|
|
|
else
|
2012-01-10 13:32:32 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE);
|
2011-11-26 09:01:07 +00:00
|
|
|
break;
|
|
|
|
case GST_AUDIO_FORMAT_F32LE:
|
|
|
|
case GST_AUDIO_FORMAT_F64LE:
|
2012-01-10 13:32:32 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT);
|
2011-11-26 09:01:07 +00:00
|
|
|
break;
|
2008-08-02 17:52:16 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
default:
|
|
|
|
GST_DEBUG_OBJECT (mux, "wrong format in raw audio caps");
|
|
|
|
goto refuse_caps;
|
2008-08-02 17:52:16 +00:00
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
audiocontext->bitdepth = GST_AUDIO_INFO_WIDTH (&info);
|
2003-12-22 01:47:09 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-vorbis")) {
|
2005-10-14 12:43:30 +00:00
|
|
|
const GValue *streamheader;
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_VORBIS);
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2005-10-14 12:43:30 +00:00
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (!vorbis_streamheader_to_codecdata (streamheader, context)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
|
|
|
("vorbis stream headers missing or malformed"));
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2005-10-14 12:43:30 +00:00
|
|
|
}
|
2008-08-09 13:48:22 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-flac")) {
|
|
|
|
const GValue *streamheader;
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_FLAC);
|
2012-01-10 17:50:27 +00:00
|
|
|
|
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2008-08-09 13:48:22 +00:00
|
|
|
|
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (!flac_streamheader_to_codecdata (streamheader, context)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
|
|
|
("flac stream headers missing or malformed"));
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2008-08-09 13:48:22 +00:00
|
|
|
}
|
2009-04-13 12:03:03 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-speex")) {
|
|
|
|
const GValue *streamheader;
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_SPEEX);
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2009-04-13 12:03:03 +00:00
|
|
|
|
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (!speex_streamheader_to_codecdata (streamheader, context)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
|
|
|
("speex stream headers missing or malformed"));
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2009-04-13 12:03:03 +00:00
|
|
|
}
|
2014-03-30 00:35:07 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-opus")) {
|
2014-12-17 17:36:18 +00:00
|
|
|
const GValue *streamheader;
|
|
|
|
|
2014-03-30 00:35:07 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_OPUS);
|
2014-12-17 17:36:18 +00:00
|
|
|
|
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (streamheader) {
|
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
if (!opus_streamheader_to_codecdata (streamheader, context)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
2016-02-04 10:43:15 +00:00
|
|
|
("opus stream headers missing or malformed"));
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* no streamheader, but we need to have one, so we make one up
|
|
|
|
based on caps */
|
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
if (!opus_make_codecdata (context, caps)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
2014-12-17 17:36:18 +00:00
|
|
|
("opus stream headers missing or malformed"));
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-ac3")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_AC3);
|
2010-10-21 14:15:08 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-eac3")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_EAC3);
|
2010-10-21 14:14:44 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-dts")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_DTS);
|
2004-09-15 19:43:37 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-tta")) {
|
2004-08-26 11:10:16 +00:00
|
|
|
gint width;
|
|
|
|
|
2004-09-01 12:10:21 +00:00
|
|
|
/* TTA frame duration */
|
|
|
|
context->default_duration = 1.04489795918367346939 * GST_SECOND;
|
|
|
|
|
2004-08-26 11:10:16 +00:00
|
|
|
gst_structure_get_int (structure, "width", &width);
|
|
|
|
audiocontext->bitdepth = width;
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_TTA);
|
2004-08-26 11:10:16 +00:00
|
|
|
|
2008-08-25 14:15:43 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-pn-realaudio")) {
|
|
|
|
gint raversion;
|
|
|
|
const GValue *mdpr_data;
|
|
|
|
|
|
|
|
gst_structure_get_int (structure, "raversion", &raversion);
|
|
|
|
switch (raversion) {
|
|
|
|
case 1:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_REAL_28_8);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
case 8:
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK);
|
2008-08-25 14:15:43 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2008-08-25 14:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mdpr_data = gst_structure_get_value (structure, "mdpr_data");
|
|
|
|
if (mdpr_data != NULL) {
|
|
|
|
guint8 *priv_data = NULL;
|
|
|
|
guint priv_data_size = 0;
|
|
|
|
|
|
|
|
GstBuffer *codec_data_buf = g_value_peek_pointer (mdpr_data);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
priv_data_size = gst_buffer_get_size (codec_data_buf);
|
2008-08-25 14:15:43 +00:00
|
|
|
priv_data = g_malloc0 (priv_data_size);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (codec_data_buf, 0, priv_data, -1);
|
2008-08-25 14:15:43 +00:00
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
|
|
|
|
2008-08-25 14:15:43 +00:00
|
|
|
context->codec_priv = priv_data;
|
|
|
|
context->codec_priv_size = priv_data_size;
|
|
|
|
}
|
|
|
|
|
2011-04-05 12:28:54 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-wma")
|
|
|
|
|| !strcmp (mimetype, "audio/x-alaw")
|
2012-01-14 18:58:17 +00:00
|
|
|
|| !strcmp (mimetype, "audio/x-mulaw")
|
2015-03-28 17:15:36 +00:00
|
|
|
|| !strcmp (mimetype, "audio/x-adpcm")
|
|
|
|
|| !strcmp (mimetype, "audio/G722")) {
|
2009-08-08 03:47:48 +00:00
|
|
|
guint8 *codec_priv;
|
|
|
|
guint codec_priv_size;
|
2011-04-05 12:28:54 +00:00
|
|
|
guint16 format = 0;
|
2014-06-29 17:57:57 +00:00
|
|
|
gint block_align = 0;
|
|
|
|
gint bitrate = 0;
|
2011-04-05 12:28:54 +00:00
|
|
|
|
|
|
|
if (samplerate == 0 || channels == 0) {
|
|
|
|
GST_WARNING_OBJECT (mux, "Missing channels/samplerate on caps");
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2009-08-08 03:47:48 +00:00
|
|
|
}
|
|
|
|
|
2011-04-05 12:28:54 +00:00
|
|
|
if (!strcmp (mimetype, "audio/x-wma")) {
|
|
|
|
gint wmaversion;
|
|
|
|
gint depth;
|
|
|
|
|
|
|
|
if (!gst_structure_get_int (structure, "wmaversion", &wmaversion)
|
|
|
|
|| !gst_structure_get_int (structure, "block_align", &block_align)
|
|
|
|
|| !gst_structure_get_int (structure, "bitrate", &bitrate)) {
|
|
|
|
GST_WARNING_OBJECT (mux, "Missing wmaversion/block_align/bitrate"
|
|
|
|
" on WMA caps");
|
2010-01-11 16:50:04 +00:00
|
|
|
goto refuse_caps;
|
2011-04-05 12:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (wmaversion) {
|
|
|
|
case 1:
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_WMAV1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_WMAV2;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_WMAV3;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (mux, "Unexpected WMA version: %d", wmaversion);
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
2009-08-08 03:47:48 +00:00
|
|
|
|
2011-04-05 12:28:54 +00:00
|
|
|
if (gst_structure_get_int (structure, "depth", &depth))
|
|
|
|
audiocontext->bitdepth = depth;
|
|
|
|
} else if (!strcmp (mimetype, "audio/x-alaw")
|
|
|
|
|| !strcmp (mimetype, "audio/x-mulaw")) {
|
|
|
|
audiocontext->bitdepth = 8;
|
|
|
|
if (!strcmp (mimetype, "audio/x-alaw"))
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_ALAW;
|
|
|
|
else
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_MULAW;
|
|
|
|
|
|
|
|
block_align = channels;
|
|
|
|
bitrate = block_align * samplerate;
|
2012-01-14 18:58:17 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/x-adpcm")) {
|
2014-01-03 14:25:23 +00:00
|
|
|
const char *layout;
|
2014-01-08 08:46:55 +00:00
|
|
|
|
2014-01-03 14:25:23 +00:00
|
|
|
layout = gst_structure_get_string (structure, "layout");
|
2014-01-08 08:46:55 +00:00
|
|
|
if (!layout) {
|
|
|
|
GST_WARNING_OBJECT (mux, "Missing layout on adpcm caps");
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
|
2012-01-14 18:58:17 +00:00
|
|
|
if (!gst_structure_get_int (structure, "block_align", &block_align)) {
|
|
|
|
GST_WARNING_OBJECT (mux, "Missing block_align on adpcm caps");
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
2014-01-08 08:46:55 +00:00
|
|
|
|
2014-01-03 14:25:23 +00:00
|
|
|
if (!strcmp (layout, "dvi")) {
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_DVI_ADPCM;
|
|
|
|
} else if (!strcmp (layout, "g726")) {
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_ITU_G726_ADPCM;
|
|
|
|
if (!gst_structure_get_int (structure, "bitrate", &bitrate)) {
|
|
|
|
GST_WARNING_OBJECT (mux, "Missing bitrate on adpcm g726 caps");
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (mux, "Unknown layout on adpcm caps");
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
2012-01-14 18:58:17 +00:00
|
|
|
|
2015-03-28 17:15:36 +00:00
|
|
|
} else if (!strcmp (mimetype, "audio/G722")) {
|
|
|
|
format = GST_RIFF_WAVE_FORMAT_ADPCM_G722;
|
2011-04-05 12:28:54 +00:00
|
|
|
}
|
|
|
|
g_assert (format != 0);
|
2009-08-08 03:47:48 +00:00
|
|
|
|
2010-04-08 10:23:38 +00:00
|
|
|
codec_priv_size = WAVEFORMATEX_SIZE;
|
2009-08-08 03:47:48 +00:00
|
|
|
if (buf)
|
2011-11-26 09:01:07 +00:00
|
|
|
codec_priv_size += gst_buffer_get_size (buf);
|
2009-08-08 03:47:48 +00:00
|
|
|
|
|
|
|
/* serialize waveformatex structure */
|
|
|
|
codec_priv = g_malloc0 (codec_priv_size);
|
|
|
|
GST_WRITE_UINT16_LE (codec_priv, format);
|
|
|
|
GST_WRITE_UINT16_LE (codec_priv + 2, channels);
|
|
|
|
GST_WRITE_UINT32_LE (codec_priv + 4, samplerate);
|
|
|
|
GST_WRITE_UINT32_LE (codec_priv + 8, bitrate / 8);
|
|
|
|
GST_WRITE_UINT16_LE (codec_priv + 12, block_align);
|
|
|
|
GST_WRITE_UINT16_LE (codec_priv + 14, 0);
|
|
|
|
if (buf)
|
2011-11-26 09:01:07 +00:00
|
|
|
GST_WRITE_UINT16_LE (codec_priv + 16, gst_buffer_get_size (buf));
|
2009-08-08 03:47:48 +00:00
|
|
|
else
|
|
|
|
GST_WRITE_UINT16_LE (codec_priv + 16, 0);
|
|
|
|
|
|
|
|
/* process codec private/initialization data, if any */
|
|
|
|
if (buf) {
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (buf, 0,
|
|
|
|
(guint8 *) codec_priv + WAVEFORMATEX_SIZE, -1);
|
2009-08-08 03:47:48 +00:00
|
|
|
}
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_AUDIO_ACM);
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2009-08-08 03:47:48 +00:00
|
|
|
context->codec_priv = (gpointer) codec_priv;
|
|
|
|
context->codec_priv_size = codec_priv_size;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2010-01-11 16:50:04 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
refuse_caps:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (mux, "pad %s refused caps %" GST_PTR_FORMAT,
|
|
|
|
GST_PAD_NAME (pad), caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2011-12-16 15:56:37 +00:00
|
|
|
/* we probably don't have the data at start,
|
|
|
|
* so have to reserve (a maximum) space to write this at the end.
|
|
|
|
* bit spacy, but some formats can hold quite some */
|
|
|
|
#define SUBTITLE_MAX_CODEC_PRIVATE 2048 /* must be > 128 */
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_subtitle_pad_setcaps:
|
|
|
|
* @pad: Pad which got the caps.
|
|
|
|
* @caps: New caps.
|
|
|
|
*
|
|
|
|
* Setcaps function for subtitle sink pad.
|
|
|
|
*
|
2017-10-03 23:30:10 +00:00
|
|
|
* Returns: %TRUE on success.
|
2005-10-14 12:43:30 +00:00
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_mux_subtitle_pad_setcaps (GstPad * pad, GstCaps * caps)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2009-02-15 18:49:44 +00:00
|
|
|
/* There is now (at least) one such alement (kateenc), and I'm going
|
|
|
|
to handle it here and claim it works when it can be piped back
|
|
|
|
through GStreamer and VLC */
|
|
|
|
|
|
|
|
GstMatroskaTrackContext *context = NULL;
|
|
|
|
GstMatroskaTrackSubtitleContext *scontext;
|
|
|
|
GstMatroskaMux *mux;
|
|
|
|
GstMatroskaPad *collect_pad;
|
|
|
|
const gchar *mimetype;
|
|
|
|
GstStructure *structure;
|
2011-12-16 15:56:37 +00:00
|
|
|
const GValue *value = NULL;
|
2012-01-10 13:32:32 +00:00
|
|
|
GstBuffer *buf = NULL;
|
2011-12-16 15:56:37 +00:00
|
|
|
gboolean ret = TRUE;
|
2018-02-26 11:03:59 +00:00
|
|
|
GstCaps *old_caps;
|
2009-02-15 18:49:44 +00:00
|
|
|
|
|
|
|
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
|
|
|
|
2018-02-26 11:03:59 +00:00
|
|
|
if ((old_caps = gst_pad_get_current_caps (pad))) {
|
|
|
|
if (mux->state >= GST_MATROSKA_MUX_STATE_HEADER
|
|
|
|
&& !gst_caps_is_equal (caps, old_caps)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
2019-04-25 18:52:42 +00:00
|
|
|
("Caps changes are not supported by Matroska"));
|
2018-02-26 11:03:59 +00:00
|
|
|
gst_caps_unref (old_caps);
|
|
|
|
goto refuse_caps;
|
|
|
|
}
|
|
|
|
gst_caps_unref (old_caps);
|
|
|
|
}
|
|
|
|
|
2009-02-15 18:49:44 +00:00
|
|
|
/* find context */
|
|
|
|
collect_pad = (GstMatroskaPad *) gst_pad_get_element_private (pad);
|
|
|
|
g_assert (collect_pad);
|
|
|
|
context = collect_pad->track;
|
|
|
|
g_assert (context);
|
|
|
|
g_assert (context->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE);
|
|
|
|
scontext = (GstMatroskaTrackSubtitleContext *) context;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
mimetype = gst_structure_get_name (structure);
|
|
|
|
|
|
|
|
/* general setup */
|
|
|
|
scontext->check_utf8 = 1;
|
|
|
|
scontext->invalid_utf8 = 0;
|
|
|
|
context->default_duration = 0;
|
|
|
|
|
|
|
|
if (!strcmp (mimetype, "subtitle/x-kate")) {
|
|
|
|
const GValue *streamheader;
|
|
|
|
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_SUBTITLE_KATE);
|
2009-02-15 18:49:44 +00:00
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2009-02-15 18:49:44 +00:00
|
|
|
|
|
|
|
streamheader = gst_structure_get_value (structure, "streamheader");
|
|
|
|
if (!kate_streamheader_to_codecdata (streamheader, context)) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
|
|
|
("kate stream headers missing or malformed"));
|
2011-12-16 15:56:37 +00:00
|
|
|
ret = FALSE;
|
|
|
|
goto exit;
|
2009-02-15 18:49:44 +00:00
|
|
|
}
|
2012-09-02 01:50:50 +00:00
|
|
|
} else if (!strcmp (mimetype, "text/x-raw")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8);
|
2011-12-16 15:56:37 +00:00
|
|
|
} else if (!strcmp (mimetype, "application/x-ssa")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_SUBTITLE_SSA);
|
2011-12-16 15:56:37 +00:00
|
|
|
} else if (!strcmp (mimetype, "application/x-ass")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_SUBTITLE_ASS);
|
2011-12-16 15:56:37 +00:00
|
|
|
} else if (!strcmp (mimetype, "application/x-usf")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context, GST_MATROSKA_CODEC_ID_SUBTITLE_USF);
|
2012-08-20 22:30:38 +00:00
|
|
|
} else if (!strcmp (mimetype, "subpicture/x-dvd")) {
|
2012-01-09 17:28:17 +00:00
|
|
|
gst_matroska_mux_set_codec_id (context,
|
|
|
|
GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB);
|
2011-12-16 15:56:37 +00:00
|
|
|
} else {
|
|
|
|
ret = FALSE;
|
|
|
|
goto exit;
|
2009-02-15 18:49:44 +00:00
|
|
|
}
|
|
|
|
|
2011-12-16 15:56:37 +00:00
|
|
|
/* maybe some private data, e.g. vobsub */
|
|
|
|
value = gst_structure_get_value (structure, "codec_data");
|
|
|
|
if (value)
|
|
|
|
buf = gst_value_get_buffer (value);
|
|
|
|
if (buf != NULL) {
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
guint8 *priv_data = NULL;
|
2011-12-16 15:56:37 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
|
|
|
|
if (map.size > SUBTITLE_MAX_CODEC_PRIVATE) {
|
2011-12-16 15:56:37 +00:00
|
|
|
GST_WARNING_OBJECT (mux, "pad %" GST_PTR_FORMAT " subtitle private data"
|
|
|
|
" exceeded maximum (%d); discarding", pad,
|
|
|
|
SUBTITLE_MAX_CODEC_PRIVATE);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-12-16 15:56:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-01-10 17:50:27 +00:00
|
|
|
gst_matroska_mux_free_codec_priv (context);
|
2011-12-16 15:56:37 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
priv_data = g_malloc0 (map.size);
|
|
|
|
memcpy (priv_data, map.data, map.size);
|
2011-12-16 15:56:37 +00:00
|
|
|
context->codec_priv = priv_data;
|
2012-01-23 16:25:37 +00:00
|
|
|
context->codec_priv_size = map.size;
|
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-12-16 15:56:37 +00:00
|
|
|
}
|
|
|
|
|
2012-01-13 23:12:05 +00:00
|
|
|
GST_DEBUG_OBJECT (pad, "codec_id %s, codec data size %" G_GSIZE_FORMAT,
|
2011-12-16 15:56:37 +00:00
|
|
|
GST_STR_NULL (context->codec_id), context->codec_priv_size);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
|
|
|
return ret;
|
2018-02-26 11:03:59 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
refuse_caps:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (mux, "pad %s refused caps %" GST_PTR_FORMAT,
|
|
|
|
GST_PAD_NAME (pad), caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_request_new_pad:
|
|
|
|
* @element: #GstMatroskaMux.
|
|
|
|
* @templ: #GstPadTemplate.
|
|
|
|
* @pad_name: New pad name.
|
|
|
|
*
|
|
|
|
* Request pad function for sink templates.
|
|
|
|
*
|
|
|
|
* Returns: New #GstPad.
|
|
|
|
*/
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
static GstPad *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_mux_request_new_pad (GstElement * element,
|
2011-11-26 09:01:07 +00:00
|
|
|
GstPadTemplate * templ, const gchar * req_name, const GstCaps * caps)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
|
|
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
|
|
|
|
GstMatroskaMux *mux = GST_MATROSKA_MUX (element);
|
2005-10-14 12:43:30 +00:00
|
|
|
GstMatroskaPad *collect_pad;
|
2011-10-11 00:07:13 +00:00
|
|
|
GstMatroskamuxPad *newpad;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gchar *name = NULL;
|
2011-02-16 15:09:20 +00:00
|
|
|
const gchar *pad_name = NULL;
|
2011-11-26 09:01:07 +00:00
|
|
|
GstMatroskaCapsFunc capsfunc = NULL;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
GstMatroskaTrackContext *context = NULL;
|
2011-02-16 15:09:20 +00:00
|
|
|
gint pad_id;
|
2011-12-16 15:56:37 +00:00
|
|
|
gboolean locked = TRUE;
|
2016-07-07 15:14:43 +00:00
|
|
|
const gchar *id = NULL;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2011-11-04 10:58:22 +00:00
|
|
|
if (templ == gst_element_class_get_pad_template (klass, "audio_%u")) {
|
2011-02-16 15:09:20 +00:00
|
|
|
/* don't mix named and unnamed pads, if the pad already exists we fail when
|
|
|
|
* trying to add it */
|
2011-11-04 10:58:22 +00:00
|
|
|
if (req_name != NULL && sscanf (req_name, "audio_%u", &pad_id) == 1) {
|
2011-02-16 15:09:20 +00:00
|
|
|
pad_name = req_name;
|
|
|
|
} else {
|
2011-11-04 10:58:22 +00:00
|
|
|
name = g_strdup_printf ("audio_%u", mux->num_a_streams++);
|
2011-02-16 15:09:20 +00:00
|
|
|
pad_name = name;
|
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
capsfunc = GST_DEBUG_FUNCPTR (gst_matroska_mux_audio_pad_setcaps);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
context = (GstMatroskaTrackContext *)
|
2004-03-15 19:32:27 +00:00
|
|
|
g_new0 (GstMatroskaTrackAudioContext, 1);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
context->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
|
|
|
|
context->name = g_strdup ("Audio");
|
2011-11-04 10:58:22 +00:00
|
|
|
} else if (templ == gst_element_class_get_pad_template (klass, "video_%u")) {
|
2011-02-16 15:09:20 +00:00
|
|
|
/* don't mix named and unnamed pads, if the pad already exists we fail when
|
|
|
|
* trying to add it */
|
2011-11-04 10:58:22 +00:00
|
|
|
if (req_name != NULL && sscanf (req_name, "video_%u", &pad_id) == 1) {
|
2011-02-16 15:09:20 +00:00
|
|
|
pad_name = req_name;
|
|
|
|
} else {
|
2011-11-04 10:58:22 +00:00
|
|
|
name = g_strdup_printf ("video_%u", mux->num_v_streams++);
|
2011-02-16 15:09:20 +00:00
|
|
|
pad_name = name;
|
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
capsfunc = GST_DEBUG_FUNCPTR (gst_matroska_mux_video_pad_setcaps);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
context = (GstMatroskaTrackContext *)
|
2004-03-15 19:32:27 +00:00
|
|
|
g_new0 (GstMatroskaTrackVideoContext, 1);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
context->type = GST_MATROSKA_TRACK_TYPE_VIDEO;
|
|
|
|
context->name = g_strdup ("Video");
|
2011-11-04 10:58:22 +00:00
|
|
|
} else if (templ == gst_element_class_get_pad_template (klass, "subtitle_%u")) {
|
2011-02-16 15:09:20 +00:00
|
|
|
/* don't mix named and unnamed pads, if the pad already exists we fail when
|
|
|
|
* trying to add it */
|
2011-11-04 10:58:22 +00:00
|
|
|
if (req_name != NULL && sscanf (req_name, "subtitle_%u", &pad_id) == 1) {
|
2011-02-16 15:09:20 +00:00
|
|
|
pad_name = req_name;
|
|
|
|
} else {
|
2011-11-04 10:58:22 +00:00
|
|
|
name = g_strdup_printf ("subtitle_%u", mux->num_t_streams++);
|
2011-02-16 15:09:20 +00:00
|
|
|
pad_name = name;
|
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
capsfunc = GST_DEBUG_FUNCPTR (gst_matroska_mux_subtitle_pad_setcaps);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
context = (GstMatroskaTrackContext *)
|
2004-03-15 19:32:27 +00:00
|
|
|
g_new0 (GstMatroskaTrackSubtitleContext, 1);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
context->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
|
|
|
|
context->name = g_strdup ("Subtitle");
|
2011-12-16 15:56:37 +00:00
|
|
|
/* setcaps may only provide proper one a lot later */
|
2016-07-07 15:14:43 +00:00
|
|
|
id = "S_SUB_UNKNOWN";
|
2011-12-16 15:56:37 +00:00
|
|
|
locked = FALSE;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
} else {
|
2005-10-14 12:43:30 +00:00
|
|
|
GST_WARNING_OBJECT (mux, "This is not our template!");
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-11 00:07:13 +00:00
|
|
|
newpad = g_object_new (GST_TYPE_MATROSKAMUX_PAD,
|
|
|
|
"name", pad_name, "direction", templ->direction, "template", templ, NULL);
|
|
|
|
|
|
|
|
gst_matroskamux_pad_init (newpad);
|
2005-10-14 12:43:30 +00:00
|
|
|
collect_pad = (GstMatroskaPad *)
|
2012-09-12 19:05:44 +00:00
|
|
|
gst_collect_pads_add_pad (mux->collect, GST_PAD (newpad),
|
2019-11-19 13:23:48 +00:00
|
|
|
sizeof (GstMatroskaPad),
|
2012-04-17 13:14:27 +00:00
|
|
|
(GstCollectDataDestroyNotify) gst_matroska_pad_free, locked);
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
|
2015-02-02 22:46:27 +00:00
|
|
|
collect_pad->mux = mux;
|
2005-10-14 12:43:30 +00:00
|
|
|
collect_pad->track = context;
|
2009-01-08 15:56:46 +00:00
|
|
|
gst_matroska_pad_reset (collect_pad, FALSE);
|
2016-07-07 15:14:43 +00:00
|
|
|
if (id)
|
|
|
|
gst_matroska_mux_set_codec_id (collect_pad->track, id);
|
2015-02-26 22:41:47 +00:00
|
|
|
collect_pad->track->dts_only = FALSE;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
collect_pad->capsfunc = capsfunc;
|
2011-10-11 00:07:13 +00:00
|
|
|
gst_pad_set_active (GST_PAD (newpad), TRUE);
|
|
|
|
if (!gst_element_add_pad (element, GST_PAD (newpad)))
|
2011-02-16 15:09:20 +00:00
|
|
|
goto pad_add_failed;
|
|
|
|
|
2015-01-23 14:16:25 +00:00
|
|
|
g_free (name);
|
|
|
|
|
2008-06-11 11:27:46 +00:00
|
|
|
mux->num_streams++;
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2011-02-16 15:09:20 +00:00
|
|
|
GST_DEBUG_OBJECT (newpad, "Added new request pad");
|
|
|
|
|
2011-10-11 00:07:13 +00:00
|
|
|
return GST_PAD (newpad);
|
2011-02-16 15:09:20 +00:00
|
|
|
|
|
|
|
/* ERROR cases */
|
|
|
|
pad_add_failed:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (mux, "Adding the new pad '%s' failed", pad_name);
|
2015-01-23 14:16:25 +00:00
|
|
|
g_free (name);
|
2011-02-16 15:09:20 +00:00
|
|
|
gst_object_unref (newpad);
|
|
|
|
return NULL;
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
/**
|
|
|
|
* gst_matroska_mux_release_pad:
|
|
|
|
* @element: #GstMatroskaMux.
|
|
|
|
* @pad: Pad to release.
|
|
|
|
*
|
|
|
|
* Release a previously requested pad.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gst_matroska_mux_release_pad (GstElement * element, GstPad * pad)
|
|
|
|
{
|
|
|
|
GstMatroskaMux *mux;
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
mux = GST_MATROSKA_MUX (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
|
2012-04-17 13:14:27 +00:00
|
|
|
GstCollectData *cdata = (GstCollectData *) walk->data;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
GstMatroskaPad *collect_pad = (GstMatroskaPad *) cdata;
|
|
|
|
|
|
|
|
if (cdata->pad == pad) {
|
2015-03-03 18:19:50 +00:00
|
|
|
/*
|
|
|
|
* observed duration, this will remain GST_CLOCK_TIME_NONE
|
2019-09-02 12:27:35 +00:00
|
|
|
* only if the pad is reset
|
2015-03-03 18:19:50 +00:00
|
|
|
*/
|
|
|
|
GstClockTime collected_duration = GST_CLOCK_TIME_NONE;
|
2008-01-08 19:57:23 +00:00
|
|
|
|
2008-03-03 22:01:56 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (collect_pad->start_ts) &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (collect_pad->end_ts)) {
|
2015-03-03 18:19:50 +00:00
|
|
|
collected_duration =
|
|
|
|
GST_CLOCK_DIFF (collect_pad->start_ts, collect_pad->end_ts);
|
2008-03-03 22:01:56 +00:00
|
|
|
}
|
|
|
|
|
2015-03-03 18:19:50 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (collected_duration)
|
|
|
|
&& mux->duration < collected_duration)
|
|
|
|
mux->duration = collected_duration;
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2008-10-27 08:45:11 +00:00
|
|
|
break;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-17 13:14:27 +00:00
|
|
|
gst_collect_pads_remove_pad (mux->collect, pad);
|
2008-10-27 08:45:11 +00:00
|
|
|
if (gst_element_remove_pad (element, pad))
|
|
|
|
mux->num_streams--;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
}
|
|
|
|
|
2019-02-19 04:34:49 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_mastering_metadata (GstMatroskaMux * mux,
|
|
|
|
GstMatroskaTrackVideoContext * videocontext)
|
|
|
|
{
|
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
|
|
|
guint64 master;
|
|
|
|
GstVideoMasteringDisplayInfo *minfo = &videocontext->mastering_display_info;
|
|
|
|
gdouble value;
|
2020-03-10 14:16:00 +00:00
|
|
|
const gdouble chroma_scale = 50000;
|
|
|
|
const gdouble luma_scale = 50000;
|
2019-02-19 04:34:49 +00:00
|
|
|
|
|
|
|
if (!videocontext->mastering_display_info_present)
|
|
|
|
return;
|
|
|
|
|
|
|
|
master =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_MASTERINGMETADATA);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->display_primaries[0].x / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_PRIMARYRCHROMATICITYX, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->display_primaries[0].y / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_PRIMARYRCHROMATICITYY, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->display_primaries[1].x / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_PRIMARYGCHROMATICITYX, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->display_primaries[1].y / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_PRIMARYGCHROMATICITYY, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->display_primaries[2].x / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_PRIMARYBCHROMATICITYX, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->display_primaries[2].y / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_PRIMARYBCHROMATICITYY, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->white_point.x / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_WHITEPOINTCHROMATICITYX, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->white_point.y / chroma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_WHITEPOINTCHROMATICITYY, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->max_display_mastering_luminance / luma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_LUMINANCEMAX, value);
|
|
|
|
|
2020-03-10 14:16:00 +00:00
|
|
|
value = (gdouble) minfo->min_display_mastering_luminance / luma_scale;
|
2019-02-19 04:34:49 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_LUMINANCEMIN, value);
|
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-05-22 20:14:03 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_colour (GstMatroskaMux * mux,
|
|
|
|
GstMatroskaTrackVideoContext * videocontext)
|
|
|
|
{
|
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
|
|
|
guint64 master;
|
|
|
|
guint matrix_id = 0;
|
|
|
|
guint range_id = 0;
|
|
|
|
guint transfer_id = 0;
|
|
|
|
guint primaries_id = 0;
|
|
|
|
|
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_VIDEOCOLOUR);
|
|
|
|
|
|
|
|
switch (videocontext->colorimetry.range) {
|
|
|
|
case GST_VIDEO_COLOR_RANGE_UNKNOWN:
|
|
|
|
range_id = 0;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_COLOR_RANGE_16_235:
|
|
|
|
range_id = 1;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_COLOR_RANGE_0_255:
|
|
|
|
range_id = 2;
|
|
|
|
}
|
|
|
|
|
2019-07-15 14:24:05 +00:00
|
|
|
matrix_id = gst_video_color_matrix_to_iso (videocontext->colorimetry.matrix);
|
|
|
|
transfer_id =
|
|
|
|
gst_video_color_transfer_to_iso (videocontext->colorimetry.transfer);
|
|
|
|
primaries_id =
|
|
|
|
gst_video_color_primaries_to_iso (videocontext->colorimetry.primaries);
|
2018-05-22 20:14:03 +00:00
|
|
|
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEORANGE, range_id);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOMATRIXCOEFFICIENTS,
|
|
|
|
matrix_id);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOTRANSFERCHARACTERISTICS,
|
|
|
|
transfer_id);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPRIMARIES, primaries_id);
|
2020-03-10 14:16:00 +00:00
|
|
|
if (videocontext->content_light_level.max_content_light_level &&
|
|
|
|
videocontext->content_light_level.max_frame_average_light_level) {
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_MAXCLL,
|
|
|
|
videocontext->content_light_level.max_content_light_level);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_MAXFALL,
|
|
|
|
videocontext->content_light_level.max_frame_average_light_level);
|
2019-02-19 04:34:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_matroska_mux_write_mastering_metadata (mux, videocontext);
|
2018-05-22 20:14:03 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
|
|
|
}
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_track_header:
|
|
|
|
* @mux: #GstMatroskaMux
|
|
|
|
* @context: Tack context.
|
|
|
|
*
|
|
|
|
* Write a track header.
|
|
|
|
*/
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_mux_track_header (GstMatroskaMux * mux,
|
|
|
|
GstMatroskaTrackContext * context)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2005-10-14 12:43:30 +00:00
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
guint64 master;
|
|
|
|
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
/* TODO: check if everything necessary is written and check default values */
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* track type goes before the type-specific stuff */
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKNUMBER, context->num);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKTYPE, context->type);
|
|
|
|
|
2016-02-22 12:25:51 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKUID, context->uid);
|
2004-09-01 12:10:21 +00:00
|
|
|
if (context->default_duration) {
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TRACKDEFAULTDURATION,
|
|
|
|
context->default_duration);
|
|
|
|
}
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
if (context->language) {
|
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_TRACKLANGUAGE,
|
|
|
|
context->language);
|
|
|
|
}
|
2004-09-01 12:10:21 +00:00
|
|
|
|
2011-12-16 15:56:37 +00:00
|
|
|
/* FIXME: until we have a nice way of getting the codecname
|
|
|
|
* out of the caps, I'm not going to enable this. Too much
|
|
|
|
* (useless, double, boring) work... */
|
|
|
|
/* TODO: Use value from tags if any */
|
|
|
|
/*gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_CODECNAME,
|
|
|
|
context->codec_name); */
|
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_TRACKNAME, context->name);
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* type-specific stuff */
|
|
|
|
switch (context->type) {
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
GstMatroskaTrackVideoContext *videocontext =
|
2004-03-15 19:32:27 +00:00
|
|
|
(GstMatroskaTrackVideoContext *) context;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKVIDEO);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELWIDTH,
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->pixel_width);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOPIXELHEIGHT,
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->pixel_height);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
if (videocontext->display_width && videocontext->display_height) {
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYWIDTH,
|
|
|
|
videocontext->display_width);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEODISPLAYHEIGHT,
|
|
|
|
videocontext->display_height);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
2018-08-23 20:57:35 +00:00
|
|
|
switch (videocontext->interlace_mode) {
|
|
|
|
case GST_MATROSKA_INTERLACE_MODE_INTERLACED:
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 1);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_INTERLACE_MODE_PROGRESSIVE:
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOFLAGINTERLACED, 2);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
if (videocontext->fourcc) {
|
2004-03-15 19:32:27 +00:00
|
|
|
guint32 fcc_le = GUINT32_TO_LE (videocontext->fourcc);
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_VIDEOCOLOURSPACE,
|
|
|
|
(gpointer) & fcc_le, 4);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
2018-05-22 20:14:03 +00:00
|
|
|
gst_matroska_mux_write_colour (mux, videocontext);
|
2015-06-10 14:22:54 +00:00
|
|
|
if (videocontext->multiview_mode != GST_VIDEO_MULTIVIEW_MODE_NONE) {
|
|
|
|
guint64 stereo_mode = 0;
|
|
|
|
|
|
|
|
switch (videocontext->multiview_mode) {
|
2015-09-21 14:46:01 +00:00
|
|
|
case GST_VIDEO_MULTIVIEW_MODE_MONO:
|
|
|
|
break;
|
2015-06-10 14:22:54 +00:00
|
|
|
case GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE:
|
|
|
|
if (videocontext->multiview_flags &
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST)
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_SBS_RL;
|
|
|
|
else
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_SBS_LR;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM:
|
|
|
|
if (videocontext->multiview_flags &
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST)
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_TB_RL;
|
|
|
|
else
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_TB_LR;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD:
|
|
|
|
if (videocontext->multiview_flags &
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST)
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_CHECKER_RL;
|
|
|
|
else
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_CHECKER_LR;
|
|
|
|
break;
|
|
|
|
case GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME:
|
|
|
|
if (videocontext->multiview_flags &
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST)
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_FBF_RL;
|
|
|
|
else
|
|
|
|
stereo_mode = GST_MATROSKA_STEREO_MODE_FBF_LR;
|
|
|
|
/* FIXME: In frame-by-frame mode, left/right frame buffers need to be
|
|
|
|
* laced within one block. See http://www.matroska.org/technical/specs/index.html#StereoMode */
|
|
|
|
GST_FIXME_OBJECT (mux,
|
|
|
|
"Frame-by-frame stereoscopic mode not fully implemented");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (mux,
|
|
|
|
"Multiview mode %d not supported in Matroska/WebM",
|
|
|
|
videocontext->multiview_mode);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stereo_mode != 0)
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_VIDEOSTEREOMODE,
|
|
|
|
stereo_mode);
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_AUDIO:{
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
GstMatroskaTrackAudioContext *audiocontext =
|
2004-03-15 19:32:27 +00:00
|
|
|
(GstMatroskaTrackAudioContext *) context;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKAUDIO);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
if (audiocontext->samplerate != 8000)
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_AUDIOSAMPLINGFREQ,
|
|
|
|
audiocontext->samplerate);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
if (audiocontext->channels != 1)
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOCHANNELS,
|
|
|
|
audiocontext->channels);
|
configure.ac: Improve mpeg2enc detection. This is for distributions that do ship mjpegtools, but without mpeg2enc. Al...
Original commit message from CVS:
2003-12-21 Ronald Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
Improve mpeg2enc detection. This is for distributions that do
ship mjpegtools, but without mpeg2enc. Also does object check
for might there ever be ABI incompatibility.
* ext/mpeg2enc/gstmpeg2enc.cc:
Add Andrew as second maintainer (he's helping me), and also add
an error if no caps was set. This happens if I pull before capsnego
and that's something I should solve sometime else.
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_blockgroup):
Fix time parsing.
* gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_link),
(gst_matroska_mux_track_header):
Add caps to templates.
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_sink_factory):
Add mpegversion=1 to prevent confusion with MPEG/AAC.
* gst/mpegstream/gstmpegdemux.c:
Remove layer since it causes warnings about unfixed caps.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Fix obvious typo (we error out if caps were set, we should of
course error out if *no* caps were set).
* sys/oss/gstosselement.c: (gst_osselement_convert):
Fix format conversion, we confused bits/bytes.
* sys/oss/gstosselement.h:
Improve documentation for 'bps'.
* sys/v4l/TODO:
Remove stuff about plugins that need removing - this was done
ages ago.
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query):
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_init), (gst_v4lsrc_src_convert),
(gst_v4lsrc_src_query):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init),
(gst_v4l2src_src_convert), (gst_v4l2src_src_query):
Add get_query_types(), get_formats() and query() functions.
2003-12-21 18:44:34 +00:00
|
|
|
if (audiocontext->bitdepth) {
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_AUDIOBITDEPTH,
|
|
|
|
audiocontext->bitdepth);
|
configure.ac: Improve mpeg2enc detection. This is for distributions that do ship mjpegtools, but without mpeg2enc. Al...
Original commit message from CVS:
2003-12-21 Ronald Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
Improve mpeg2enc detection. This is for distributions that do
ship mjpegtools, but without mpeg2enc. Also does object check
for might there ever be ABI incompatibility.
* ext/mpeg2enc/gstmpeg2enc.cc:
Add Andrew as second maintainer (he's helping me), and also add
an error if no caps was set. This happens if I pull before capsnego
and that's something I should solve sometime else.
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_parse_blockgroup):
Fix time parsing.
* gst/matroska/matroska-mux.c: (gst_matroska_mux_audio_pad_link),
(gst_matroska_mux_track_header):
Add caps to templates.
* gst/mpegaudioparse/gstmpegaudioparse.c: (mp3_sink_factory):
Add mpegversion=1 to prevent confusion with MPEG/AAC.
* gst/mpegstream/gstmpegdemux.c:
Remove layer since it causes warnings about unfixed caps.
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_get):
Fix obvious typo (we error out if caps were set, we should of
course error out if *no* caps were set).
* sys/oss/gstosselement.c: (gst_osselement_convert):
Fix format conversion, we confused bits/bytes.
* sys/oss/gstosselement.h:
Improve documentation for 'bps'.
* sys/v4l/TODO:
Remove stuff about plugins that need removing - this was done
ages ago.
* sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_init),
(gst_v4lmjpegsrc_src_convert), (gst_v4lmjpegsrc_src_query):
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_init), (gst_v4lsrc_src_convert),
(gst_v4lsrc_src_query):
* sys/v4l2/gstv4l2src.c: (gst_v4l2src_init),
(gst_v4l2src_src_convert), (gst_v4l2src_src_query):
Add get_query_types(), get_formats() and query() functions.
2003-12-21 18:44:34 +00:00
|
|
|
}
|
2015-11-03 10:18:19 +00:00
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-16 15:56:37 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:{
|
2014-01-10 08:52:16 +00:00
|
|
|
break;
|
2011-12-16 15:56:37 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
default:
|
|
|
|
/* doesn't need type-specific data */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_CODECID, context->codec_id);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
if (context->codec_priv)
|
|
|
|
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECPRIVATE,
|
2004-03-15 19:32:27 +00:00
|
|
|
context->codec_priv, context->codec_priv_size);
|
2015-11-03 10:18:19 +00:00
|
|
|
|
|
|
|
if (context->seek_preroll) {
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_SEEKPREROLL,
|
|
|
|
context->seek_preroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->codec_delay) {
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CODECDELAY,
|
|
|
|
context->codec_delay);
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_chapter_title (const gchar * title, GstEbmlWrite * ebml)
|
|
|
|
{
|
|
|
|
guint64 title_master;
|
|
|
|
|
|
|
|
title_master =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CHAPTERDISPLAY);
|
|
|
|
|
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_CHAPSTRING, title);
|
|
|
|
gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_CHAPLANGUAGE,
|
|
|
|
GST_MATROSKA_MUX_CHAPLANG);
|
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, title_master);
|
|
|
|
}
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
static GstTocEntry *
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_matroska_mux_write_chapter (GstMatroskaMux * mux, GstTocEntry * edition,
|
|
|
|
GstTocEntry * entry, GstEbmlWrite * ebml, guint64 * master_chapters,
|
|
|
|
guint64 * master_edition)
|
|
|
|
{
|
2017-12-01 17:17:06 +00:00
|
|
|
guint64 master_chapteratom;
|
2012-03-29 19:22:28 +00:00
|
|
|
GList *cur;
|
|
|
|
guint count, i;
|
|
|
|
gchar *title;
|
|
|
|
gint64 start, stop;
|
2017-12-01 17:17:06 +00:00
|
|
|
guint64 uid;
|
|
|
|
gchar s_uid[32];
|
|
|
|
GstTocEntry *internal_chapter, *internal_nested;
|
|
|
|
GstTagList *tags;
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
if (G_UNLIKELY (master_chapters != NULL && *master_chapters == 0))
|
|
|
|
*master_chapters =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CHAPTERS);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (master_edition != NULL && *master_edition == 0)) {
|
|
|
|
/* create uid for the parent */
|
|
|
|
*master_edition =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_EDITIONENTRY);
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_EDITIONUID,
|
|
|
|
g_ascii_strtoull (gst_toc_entry_get_uid (edition), NULL, 10));
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_EDITIONFLAGHIDDEN, 0);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_EDITIONFLAGDEFAULT, 0);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_EDITIONFLAGORDERED, 0);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:52:22 +00:00
|
|
|
gst_toc_entry_get_start_stop_times (entry, &start, &stop);
|
2017-12-01 17:17:06 +00:00
|
|
|
tags = gst_toc_entry_get_tags (entry);
|
|
|
|
if (tags != NULL) {
|
|
|
|
tags = gst_tag_list_copy (tags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* build internal chapter */
|
|
|
|
uid = gst_matroska_mux_create_uid (mux);
|
|
|
|
g_snprintf (s_uid, sizeof (s_uid), "%" G_GINT64_FORMAT, uid);
|
|
|
|
internal_chapter = gst_toc_entry_new (GST_TOC_ENTRY_TYPE_CHAPTER, s_uid);
|
2012-03-29 19:22:28 +00:00
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
/* Write the chapter entry */
|
2012-03-29 19:22:28 +00:00
|
|
|
master_chapteratom =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CHAPTERATOM);
|
2017-12-01 17:17:06 +00:00
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CHAPTERUID, uid);
|
2017-12-01 17:17:06 +00:00
|
|
|
/* Store the user provided UID in the ChapterStringUID */
|
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_CHAPTERSTRINGUID,
|
|
|
|
gst_toc_entry_get_uid (entry));
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CHAPTERTIMESTART, start);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CHAPTERTIMESTOP, stop);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CHAPTERFLAGHIDDEN, 0);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CHAPTERFLAGENABLED, 1);
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
/* write current ChapterDisplays before the nested chapters */
|
|
|
|
if (G_LIKELY (tags != NULL)) {
|
|
|
|
count = gst_tag_list_get_tag_size (tags, GST_TAG_TITLE);
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
for (i = 0; i < count; ++i) {
|
2017-12-01 17:17:06 +00:00
|
|
|
gst_tag_list_get_string_index (tags, GST_TAG_TITLE, i, &title);
|
|
|
|
/* FIXME: handle ChapterLanguage entries */
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_matroska_mux_write_chapter_title (title, ebml);
|
|
|
|
g_free (title);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove title tag */
|
|
|
|
if (G_LIKELY (count > 0))
|
2017-12-01 17:17:06 +00:00
|
|
|
gst_tag_list_remove_tag (tags, GST_TAG_TITLE);
|
|
|
|
|
|
|
|
gst_toc_entry_set_tags (internal_chapter, tags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Write nested chapters */
|
|
|
|
for (cur = gst_toc_entry_get_sub_entries (entry); cur != NULL;
|
|
|
|
cur = cur->next) {
|
|
|
|
internal_nested = gst_matroska_mux_write_chapter (mux, NULL, cur->data,
|
|
|
|
ebml, NULL, NULL);
|
|
|
|
|
|
|
|
gst_toc_entry_append_sub_entry (internal_chapter, internal_nested);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, master_chapteratom);
|
2017-12-01 17:17:06 +00:00
|
|
|
|
|
|
|
return internal_chapter;
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
static GstTocEntry *
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_matroska_mux_write_chapter_edition (GstMatroskaMux * mux,
|
2017-12-01 17:17:06 +00:00
|
|
|
GstTocEntry * edition, GList * chapters, GstEbmlWrite * ebml,
|
|
|
|
guint64 * master_chapters)
|
2012-03-29 19:22:28 +00:00
|
|
|
{
|
|
|
|
guint64 master_edition = 0;
|
2017-12-01 17:17:06 +00:00
|
|
|
gchar s_uid[32];
|
2012-03-29 19:22:28 +00:00
|
|
|
GList *cur;
|
2017-12-01 17:17:06 +00:00
|
|
|
GstTocEntry *internal_edition, *internal_chapter;
|
|
|
|
GstTagList *tags = NULL;
|
2012-03-29 19:22:28 +00:00
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
g_snprintf (s_uid, sizeof (s_uid), "%" G_GINT64_FORMAT,
|
|
|
|
gst_matroska_mux_create_uid (mux));
|
2012-03-29 19:22:28 +00:00
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
if (edition != NULL) {
|
|
|
|
/* Edition entry defined, get its tags */
|
|
|
|
tags = gst_toc_entry_get_tags (edition);
|
|
|
|
if (tags != NULL) {
|
|
|
|
tags = gst_tag_list_copy (tags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal_edition = gst_toc_entry_new (GST_TOC_ENTRY_TYPE_EDITION, s_uid);
|
|
|
|
if (tags != NULL) {
|
|
|
|
gst_toc_entry_set_tags (internal_edition, tags);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (cur = g_list_first (chapters); cur != NULL; cur = cur->next) {
|
|
|
|
internal_chapter = gst_matroska_mux_write_chapter (mux, internal_edition,
|
|
|
|
cur->data, ebml, master_chapters, &master_edition);
|
|
|
|
|
|
|
|
gst_toc_entry_append_sub_entry (internal_edition, internal_chapter);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (G_LIKELY (master_edition != 0))
|
|
|
|
gst_ebml_write_master_finish (ebml, master_edition);
|
2017-12-01 17:17:06 +00:00
|
|
|
|
|
|
|
return internal_edition;
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_start:
|
|
|
|
* @mux: #GstMatroskaMux
|
|
|
|
*
|
|
|
|
* Start a new matroska file (write headers etc...)
|
|
|
|
*/
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
static void
|
2017-07-18 07:41:40 +00:00
|
|
|
gst_matroska_mux_start (GstMatroskaMux * mux, GstMatroskaPad * first_pad,
|
|
|
|
GstBuffer * first_pad_buf)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2005-10-14 12:43:30 +00:00
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
2010-05-09 10:09:57 +00:00
|
|
|
const gchar *doctype;
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
guint32 seekhead_id[] = { GST_MATROSKA_ID_SEGMENTINFO,
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_MATROSKA_ID_TRACKS,
|
2012-03-29 19:22:28 +00:00
|
|
|
GST_MATROSKA_ID_CHAPTERS,
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_MATROSKA_ID_CUES,
|
|
|
|
GST_MATROSKA_ID_TAGS,
|
|
|
|
0
|
|
|
|
};
|
2012-04-28 18:57:51 +00:00
|
|
|
const gchar *media_type;
|
|
|
|
gboolean audio_only;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
guint64 master, child;
|
2005-10-14 12:43:30 +00:00
|
|
|
GSList *collected;
|
|
|
|
int i;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
guint tracknum = 1;
|
2019-04-18 12:31:00 +00:00
|
|
|
GstClockTime earliest_time = GST_CLOCK_TIME_NONE;
|
2008-03-03 22:01:56 +00:00
|
|
|
GstClockTime duration = 0;
|
2008-08-02 17:47:32 +00:00
|
|
|
guint32 segment_uid[4];
|
2018-05-31 08:29:43 +00:00
|
|
|
gint64 time;
|
2012-09-23 15:02:19 +00:00
|
|
|
gchar s_id[32];
|
2012-06-25 19:11:53 +00:00
|
|
|
GstToc *toc;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2012-02-25 15:40:39 +00:00
|
|
|
/* if not streaming, check if downstream is seekable */
|
2015-10-11 10:37:51 +00:00
|
|
|
if (!mux->ebml_write->streamable) {
|
2012-02-25 15:40:39 +00:00
|
|
|
gboolean seekable;
|
|
|
|
GstQuery *query;
|
|
|
|
|
|
|
|
query = gst_query_new_seeking (GST_FORMAT_BYTES);
|
|
|
|
if (gst_pad_peer_query (mux->srcpad, query)) {
|
|
|
|
gst_query_parse_seeking (query, NULL, &seekable, NULL, NULL);
|
|
|
|
GST_INFO_OBJECT (mux, "downstream is %sseekable", seekable ? "" : "not ");
|
|
|
|
} else {
|
2015-08-08 15:44:49 +00:00
|
|
|
/* assume seeking is not supported if query not handled downstream */
|
2012-02-25 15:40:39 +00:00
|
|
|
GST_WARNING_OBJECT (mux, "downstream did not handle seeking query");
|
2012-02-27 01:09:11 +00:00
|
|
|
seekable = FALSE;
|
|
|
|
}
|
|
|
|
if (!seekable) {
|
2015-10-11 10:37:51 +00:00
|
|
|
mux->ebml_write->streamable = TRUE;
|
2012-02-27 01:09:11 +00:00
|
|
|
g_object_notify (G_OBJECT (mux), "streamable");
|
|
|
|
GST_WARNING_OBJECT (mux, "downstream is not seekable, but "
|
|
|
|
"streamable=false. Will ignore that and create streamable output "
|
|
|
|
"instead");
|
2012-02-25 15:40:39 +00:00
|
|
|
}
|
2012-03-12 07:48:32 +00:00
|
|
|
gst_query_unref (query);
|
2012-02-25 15:40:39 +00:00
|
|
|
}
|
|
|
|
|
2012-09-23 15:02:19 +00:00
|
|
|
/* stream-start (FIXME: create id based on input ids) */
|
|
|
|
g_snprintf (s_id, sizeof (s_id), "matroskamux-%08x", g_random_int ());
|
|
|
|
gst_pad_push_event (mux->srcpad, gst_event_new_stream_start (s_id));
|
|
|
|
|
|
|
|
/* output caps */
|
2012-04-28 18:57:51 +00:00
|
|
|
audio_only = mux->num_v_streams == 0 && mux->num_a_streams > 0;
|
2013-10-06 16:17:00 +00:00
|
|
|
if (mux->is_webm) {
|
2012-04-28 18:57:51 +00:00
|
|
|
media_type = (audio_only) ? "audio/webm" : "video/webm";
|
2010-05-21 12:38:11 +00:00
|
|
|
} else {
|
2012-04-28 18:57:51 +00:00
|
|
|
media_type = (audio_only) ? "audio/x-matroska" : "video/x-matroska";
|
2010-05-21 12:25:24 +00:00
|
|
|
}
|
2012-04-28 18:57:51 +00:00
|
|
|
ebml->caps = gst_caps_new_empty_simple (media_type);
|
2012-04-20 11:35:15 +00:00
|
|
|
gst_pad_set_caps (mux->srcpad, ebml->caps);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* we start with a EBML header */
|
2010-05-20 17:57:14 +00:00
|
|
|
doctype = mux->doctype;
|
2010-05-09 10:09:57 +00:00
|
|
|
GST_INFO_OBJECT (ebml, "DocType: %s, Version: %d",
|
2010-05-09 10:35:10 +00:00
|
|
|
doctype, mux->doctype_version);
|
|
|
|
gst_ebml_write_header (ebml, doctype, mux->doctype_version);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2010-05-20 12:23:07 +00:00
|
|
|
/* the rest of the header is cached */
|
|
|
|
gst_ebml_write_set_cache (ebml, 0x1000);
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* start a segment */
|
2004-03-14 22:34:33 +00:00
|
|
|
mux->segment_pos =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEGMENT);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
mux->segment_master = ebml->pos;
|
|
|
|
|
2015-10-11 10:37:51 +00:00
|
|
|
if (!mux->ebml_write->streamable) {
|
2010-05-20 23:59:53 +00:00
|
|
|
/* seekhead (table of contents) - we set the positions later */
|
|
|
|
mux->seekhead_pos = ebml->pos;
|
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEEKHEAD);
|
|
|
|
for (i = 0; seekhead_id[i] != 0; i++) {
|
|
|
|
child = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEEKENTRY);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_SEEKID, seekhead_id[i]);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_SEEKPOSITION, -1);
|
|
|
|
gst_ebml_write_master_finish (ebml, child);
|
|
|
|
}
|
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2015-10-11 10:37:51 +00:00
|
|
|
if (mux->ebml_write->streamable) {
|
2011-06-02 00:04:27 +00:00
|
|
|
const GstTagList *tags;
|
2015-02-02 22:46:27 +00:00
|
|
|
gboolean has_main_tags;
|
2011-06-02 00:04:27 +00:00
|
|
|
|
|
|
|
/* tags */
|
|
|
|
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (mux));
|
2016-02-19 22:44:42 +00:00
|
|
|
has_main_tags = tags != NULL && !gst_matroska_mux_tag_list_is_empty (tags);
|
2011-06-02 00:04:27 +00:00
|
|
|
|
2015-02-02 22:46:27 +00:00
|
|
|
if (has_main_tags || gst_matroska_mux_streams_have_tags (mux)) {
|
2011-06-02 00:04:27 +00:00
|
|
|
guint64 master_tags, master_tag;
|
|
|
|
|
2011-12-16 16:20:51 +00:00
|
|
|
GST_DEBUG_OBJECT (mux, "Writing tags");
|
2011-06-02 00:04:27 +00:00
|
|
|
|
|
|
|
mux->tags_pos = ebml->pos;
|
|
|
|
master_tags = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAGS);
|
2015-02-02 22:46:27 +00:00
|
|
|
if (has_main_tags) {
|
|
|
|
master_tag = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAG);
|
|
|
|
gst_tag_list_foreach (tags, gst_matroska_mux_write_simple_tag, ebml);
|
|
|
|
gst_ebml_write_master_finish (ebml, master_tag);
|
|
|
|
}
|
|
|
|
gst_matroska_mux_write_streams_tags (mux);
|
2011-06-02 00:04:27 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, master_tags);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* segment info */
|
|
|
|
mux->info_pos = ebml->pos;
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_SEGMENTINFO);
|
2013-10-04 21:42:59 +00:00
|
|
|
|
|
|
|
/* WebM does not support SegmentUID field on SegmentInfo */
|
2013-10-06 16:17:00 +00:00
|
|
|
if (!mux->is_webm) {
|
2013-10-04 21:42:59 +00:00
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
segment_uid[i] = g_random_int ();
|
|
|
|
}
|
|
|
|
gst_ebml_write_binary (ebml, GST_MATROSKA_ID_SEGMENTUID,
|
|
|
|
(guint8 *) segment_uid, 16);
|
2004-09-01 12:10:21 +00:00
|
|
|
}
|
2013-10-04 21:42:59 +00:00
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TIMECODESCALE, mux->time_scale);
|
|
|
|
mux->duration_pos = ebml->pos;
|
2004-08-26 11:10:16 +00:00
|
|
|
/* get duration */
|
2015-10-11 10:37:51 +00:00
|
|
|
if (!mux->ebml_write->streamable) {
|
2010-05-21 12:14:04 +00:00
|
|
|
for (collected = mux->collect->data; collected;
|
|
|
|
collected = g_slist_next (collected)) {
|
|
|
|
GstMatroskaPad *collect_pad;
|
|
|
|
GstPad *thepad;
|
|
|
|
gint64 trackduration;
|
|
|
|
|
|
|
|
collect_pad = (GstMatroskaPad *) collected->data;
|
|
|
|
thepad = collect_pad->collect.pad;
|
|
|
|
|
|
|
|
/* Query the total length of the track. */
|
|
|
|
GST_DEBUG_OBJECT (thepad, "querying peer duration");
|
2011-11-26 09:01:07 +00:00
|
|
|
if (gst_pad_peer_query_duration (thepad, GST_FORMAT_TIME, &trackduration)) {
|
2010-05-21 12:14:04 +00:00
|
|
|
GST_DEBUG_OBJECT (thepad, "duration: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (trackduration));
|
|
|
|
if (trackduration != GST_CLOCK_TIME_NONE && trackduration > duration) {
|
|
|
|
duration = (GstClockTime) trackduration;
|
|
|
|
}
|
2004-08-26 11:10:16 +00:00
|
|
|
}
|
|
|
|
}
|
2010-05-21 12:14:04 +00:00
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_DURATION,
|
|
|
|
gst_guint64_to_gdouble (duration) /
|
|
|
|
gst_guint64_to_gdouble (mux->time_scale));
|
2004-08-26 11:10:16 +00:00
|
|
|
}
|
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_MUXINGAPP,
|
2014-11-02 19:02:35 +00:00
|
|
|
"GStreamer matroskamux version " PACKAGE_VERSION);
|
2005-10-14 12:43:30 +00:00
|
|
|
if (mux->writing_app && mux->writing_app[0]) {
|
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_WRITINGAPP, mux->writing_app);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
2018-05-31 08:29:43 +00:00
|
|
|
if (mux->creation_time != NULL) {
|
|
|
|
time = g_date_time_to_unix (mux->creation_time) * GST_SECOND;
|
|
|
|
time += g_date_time_get_microsecond (mux->creation_time) * GST_USECOND;
|
|
|
|
} else {
|
|
|
|
time = g_get_real_time () * GST_USECOND;
|
|
|
|
}
|
|
|
|
gst_ebml_write_date (ebml, GST_MATROSKA_ID_DATEUTC, time);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
|
|
|
|
|
|
|
/* tracks */
|
|
|
|
mux->tracks_pos = ebml->pos;
|
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKS);
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
for (collected = mux->collect->data; collected;
|
|
|
|
collected = g_slist_next (collected)) {
|
|
|
|
GstMatroskaPad *collect_pad;
|
2017-07-18 07:41:40 +00:00
|
|
|
GstBuffer *buf;
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
collect_pad = (GstMatroskaPad *) collected->data;
|
|
|
|
|
2016-07-07 15:24:59 +00:00
|
|
|
/* This will cause an error at a later time */
|
|
|
|
if (collect_pad->track->codec_id == NULL)
|
|
|
|
continue;
|
|
|
|
|
2019-04-18 12:31:00 +00:00
|
|
|
/* Find the smallest timestamp so we can offset all streams by this to
|
|
|
|
* start at 0 */
|
|
|
|
if (mux->offset_to_zero) {
|
|
|
|
GstClockTime ts;
|
|
|
|
|
|
|
|
if (collect_pad == first_pad)
|
|
|
|
buf = first_pad_buf ? gst_buffer_ref (first_pad_buf) : NULL;
|
|
|
|
else
|
|
|
|
buf = gst_collect_pads_peek (mux->collect, collected->data);
|
|
|
|
|
|
|
|
if (buf) {
|
|
|
|
ts = gst_matroska_track_get_buffer_timestamp (collect_pad->track, buf);
|
|
|
|
|
|
|
|
if (earliest_time == GST_CLOCK_TIME_NONE)
|
|
|
|
earliest_time = ts;
|
|
|
|
else if (ts != GST_CLOCK_TIME_NONE && ts < earliest_time)
|
|
|
|
earliest_time = ts;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (buf)
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
2017-07-18 07:41:40 +00:00
|
|
|
/* For audio tracks, use the first buffers duration as the default
|
|
|
|
* duration if we didn't get any better idea from the caps event already
|
|
|
|
*/
|
|
|
|
if (collect_pad->track->type == GST_MATROSKA_TRACK_TYPE_AUDIO &&
|
|
|
|
collect_pad->track->default_duration == 0) {
|
|
|
|
if (collect_pad == first_pad)
|
|
|
|
buf = first_pad_buf ? gst_buffer_ref (first_pad_buf) : NULL;
|
|
|
|
else
|
|
|
|
buf = gst_collect_pads_peek (mux->collect, collected->data);
|
|
|
|
|
|
|
|
if (buf && GST_BUFFER_DURATION_IS_VALID (buf))
|
|
|
|
collect_pad->track->default_duration =
|
|
|
|
GST_BUFFER_DURATION (buf) + collect_pad->track->codec_delay;
|
|
|
|
if (buf)
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
2016-07-07 15:24:59 +00:00
|
|
|
collect_pad->track->num = tracknum++;
|
|
|
|
child = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKENTRY);
|
|
|
|
gst_matroska_mux_track_header (mux, collect_pad->track);
|
|
|
|
gst_ebml_write_master_finish (ebml, child);
|
|
|
|
/* some remaining pad/track setup */
|
|
|
|
collect_pad->default_duration_scaled =
|
|
|
|
gst_util_uint64_scale (collect_pad->track->default_duration,
|
|
|
|
1, mux->time_scale);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
|
|
|
|
2019-04-18 12:31:00 +00:00
|
|
|
mux->earliest_time = earliest_time == GST_CLOCK_TIME_NONE ? 0 : earliest_time;
|
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
/* chapters */
|
2012-06-25 19:11:53 +00:00
|
|
|
toc = gst_toc_setter_get_toc (GST_TOC_SETTER (mux));
|
2015-10-11 10:37:51 +00:00
|
|
|
if (toc != NULL && !mux->ebml_write->streamable) {
|
2012-03-29 19:22:28 +00:00
|
|
|
guint64 master_chapters = 0;
|
2017-12-01 17:17:06 +00:00
|
|
|
GstTocEntry *internal_edition;
|
|
|
|
GList *cur, *chapters;
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Writing chapters");
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
/* There are two UIDs for Chapters:
|
|
|
|
* - The ChapterUID is a mandatory unsigned integer which internally
|
|
|
|
* refers to a given chapter. Except for the title & language which use
|
|
|
|
* dedicated fields, this UID can also be used to add tags to the Chapter.
|
|
|
|
* The tags come in a separate section of the container.
|
|
|
|
* - The ChapterStringUID is an optional UTF-8 string which also uniquely
|
|
|
|
* refers to a chapter but from an external perspective. It can act as a
|
|
|
|
* "WebVTT cue identifier" which "can be used to reference a specific cue,
|
|
|
|
* for example from script or CSS".
|
|
|
|
*
|
|
|
|
* The ChapterUID will be generated and checked for unicity, while the
|
|
|
|
* ChapterStringUID will receive the user defined UID.
|
|
|
|
*
|
|
|
|
* In order to be able to refer to chapters from the tags section,
|
|
|
|
* we must maintain an internal Toc tree with the generated ChapterUID
|
|
|
|
* (see gst_matroska_mux_write_toc_entry_tags) */
|
|
|
|
|
|
|
|
/* Check whether we have editions or chapters at the root level. */
|
|
|
|
cur = gst_toc_get_entries (toc);
|
|
|
|
if (cur != NULL) {
|
|
|
|
mux->chapters_pos = ebml->pos;
|
|
|
|
|
|
|
|
mux->internal_toc = gst_toc_new (GST_TOC_SCOPE_GLOBAL);
|
|
|
|
|
|
|
|
if (gst_toc_entry_get_entry_type (cur->data) ==
|
|
|
|
GST_TOC_ENTRY_TYPE_EDITION) {
|
|
|
|
/* Editions at the root level */
|
|
|
|
for (; cur != NULL; cur = cur->next) {
|
|
|
|
chapters = gst_toc_entry_get_sub_entries (cur->data);
|
|
|
|
internal_edition = gst_matroska_mux_write_chapter_edition (mux,
|
|
|
|
cur->data, chapters, ebml, &master_chapters);
|
|
|
|
gst_toc_append_entry (mux->internal_toc, internal_edition);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Chapters at the root level */
|
|
|
|
internal_edition = gst_matroska_mux_write_chapter_edition (mux,
|
|
|
|
NULL, cur, ebml, &master_chapters);
|
|
|
|
gst_toc_append_entry (mux->internal_toc, internal_edition);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
/* close master element if any edition was written */
|
|
|
|
if (G_LIKELY (master_chapters != 0))
|
|
|
|
gst_ebml_write_master_finish (ebml, master_chapters);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* lastly, flush the cache */
|
2010-10-20 09:05:49 +00:00
|
|
|
gst_ebml_write_flush_cache (ebml, FALSE, 0);
|
2012-06-25 19:11:53 +00:00
|
|
|
|
|
|
|
if (toc != NULL)
|
|
|
|
gst_toc_unref (toc);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2016-02-19 22:44:42 +00:00
|
|
|
/* TODO: more sensible tag mappings */
|
|
|
|
static const struct
|
|
|
|
{
|
|
|
|
const gchar *matroska_tagname;
|
|
|
|
const gchar *gstreamer_tagname;
|
|
|
|
}
|
|
|
|
gst_matroska_tag_conv[] = {
|
|
|
|
{
|
|
|
|
GST_MATROSKA_TAG_ID_TITLE, GST_TAG_TITLE}, {
|
|
|
|
GST_MATROSKA_TAG_ID_ARTIST, GST_TAG_ARTIST}, {
|
|
|
|
GST_MATROSKA_TAG_ID_ALBUM, GST_TAG_ALBUM}, {
|
|
|
|
GST_MATROSKA_TAG_ID_COMMENTS, GST_TAG_COMMENT}, {
|
|
|
|
GST_MATROSKA_TAG_ID_BITSPS, GST_TAG_BITRATE}, {
|
|
|
|
GST_MATROSKA_TAG_ID_BPS, GST_TAG_BITRATE}, {
|
|
|
|
GST_MATROSKA_TAG_ID_ENCODER, GST_TAG_ENCODER}, {
|
|
|
|
GST_MATROSKA_TAG_ID_DATE, GST_TAG_DATE}, {
|
|
|
|
GST_MATROSKA_TAG_ID_ISRC, GST_TAG_ISRC}, {
|
|
|
|
GST_MATROSKA_TAG_ID_COPYRIGHT, GST_TAG_COPYRIGHT}, {
|
|
|
|
GST_MATROSKA_TAG_ID_BPM, GST_TAG_BEATS_PER_MINUTE}, {
|
|
|
|
GST_MATROSKA_TAG_ID_TERMS_OF_USE, GST_TAG_LICENSE}, {
|
|
|
|
GST_MATROSKA_TAG_ID_COMPOSER, GST_TAG_COMPOSER}, {
|
|
|
|
GST_MATROSKA_TAG_ID_LEAD_PERFORMER, GST_TAG_PERFORMER}, {
|
|
|
|
GST_MATROSKA_TAG_ID_GENRE, GST_TAG_GENRE}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Every stagefright implementation on android up to and including 6.0.1 is using
|
|
|
|
libwebm with bug in matroska parsing, where it will choke on empty tag elements;
|
|
|
|
so before outputting tags and tag elements we better make sure that there are
|
|
|
|
actually tags we are going to write */
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_mux_tag_list_is_empty (const GstTagList * list)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < gst_tag_list_n_tags (list); i++) {
|
|
|
|
const gchar *tag = gst_tag_list_nth_tag_name (list, i);
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < G_N_ELEMENTS (gst_matroska_tag_conv); i++) {
|
|
|
|
const gchar *tagname_gst = gst_matroska_tag_conv[i].gstreamer_tagname;
|
|
|
|
if (strcmp (tagname_gst, tag) == 0) {
|
|
|
|
GValue src = { 0, };
|
|
|
|
gchar *dest;
|
|
|
|
|
|
|
|
if (!gst_tag_list_copy_value (&src, list, tag))
|
|
|
|
break;
|
|
|
|
dest = gst_value_serialize (&src);
|
|
|
|
|
|
|
|
g_value_unset (&src);
|
|
|
|
if (dest) {
|
|
|
|
g_free (dest);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_simple_tag (const GstTagList * list, const gchar * tag,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
GstEbmlWrite *ebml = (GstEbmlWrite *) data;
|
|
|
|
guint i;
|
|
|
|
guint64 simpletag_master;
|
|
|
|
|
2016-02-19 22:44:42 +00:00
|
|
|
for (i = 0; i < G_N_ELEMENTS (gst_matroska_tag_conv); i++) {
|
|
|
|
const gchar *tagname_gst = gst_matroska_tag_conv[i].gstreamer_tagname;
|
|
|
|
const gchar *tagname_mkv = gst_matroska_tag_conv[i].matroska_tagname;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
|
|
|
if (strcmp (tagname_gst, tag) == 0) {
|
|
|
|
GValue src = { 0, };
|
2008-06-13 19:14:41 +00:00
|
|
|
gchar *dest;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
|
|
|
if (!gst_tag_list_copy_value (&src, list, tag))
|
|
|
|
break;
|
2008-06-13 19:14:41 +00:00
|
|
|
if ((dest = gst_value_serialize (&src))) {
|
2008-06-11 11:18:23 +00:00
|
|
|
|
|
|
|
simpletag_master = gst_ebml_write_master_start (ebml,
|
|
|
|
GST_MATROSKA_ID_SIMPLETAG);
|
|
|
|
gst_ebml_write_ascii (ebml, GST_MATROSKA_ID_TAGNAME, tagname_mkv);
|
2008-06-13 19:14:41 +00:00
|
|
|
gst_ebml_write_utf8 (ebml, GST_MATROSKA_ID_TAGSTRING, dest);
|
2008-06-11 11:18:23 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, simpletag_master);
|
2009-03-31 14:16:04 +00:00
|
|
|
g_free (dest);
|
2008-06-11 11:18:23 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING ("Can't transform tag '%s' to string", tagname_mkv);
|
|
|
|
}
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
g_value_unset (&src);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-02 22:46:27 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_stream_tags (GstMatroskaMux * mux, GstMatroskaPad * mpad)
|
|
|
|
{
|
|
|
|
guint64 master_tag, master_targets;
|
|
|
|
GstEbmlWrite *ebml;
|
|
|
|
|
|
|
|
ebml = mux->ebml_write;
|
|
|
|
|
2016-02-19 22:44:42 +00:00
|
|
|
if (G_UNLIKELY (mpad->tags == NULL
|
|
|
|
|| gst_matroska_mux_tag_list_is_empty (mpad->tags)))
|
2015-02-02 22:46:27 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
master_tag = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAG);
|
|
|
|
master_targets = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TARGETS);
|
|
|
|
|
2016-02-22 12:25:51 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TARGETTRACKUID, mpad->track->uid);
|
2015-02-02 22:46:27 +00:00
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, master_targets);
|
|
|
|
gst_tag_list_foreach (mpad->tags, gst_matroska_mux_write_simple_tag, ebml);
|
|
|
|
gst_ebml_write_master_finish (ebml, master_tag);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_streams_tags (GstMatroskaMux * mux)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
|
|
|
|
GstMatroskaPad *collect_pad;
|
|
|
|
|
|
|
|
collect_pad = (GstMatroskaPad *) walk->data;
|
|
|
|
|
|
|
|
gst_matroska_mux_write_stream_tags (mux, collect_pad);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_mux_streams_have_tags (GstMatroskaMux * mux)
|
|
|
|
{
|
|
|
|
GSList *walk;
|
|
|
|
|
|
|
|
for (walk = mux->collect->data; walk; walk = g_slist_next (walk)) {
|
|
|
|
GstMatroskaPad *collect_pad;
|
|
|
|
|
|
|
|
collect_pad = (GstMatroskaPad *) walk->data;
|
2016-02-19 22:44:42 +00:00
|
|
|
if (!gst_matroska_mux_tag_list_is_empty (collect_pad->tags))
|
2015-02-02 22:46:27 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_write_toc_entry_tags (GstMatroskaMux * mux,
|
2017-12-01 17:17:06 +00:00
|
|
|
const GstTocEntry * entry, guint64 * master_tags, gboolean * has_tags)
|
2012-03-29 19:22:28 +00:00
|
|
|
{
|
|
|
|
guint64 master_tag, master_targets;
|
|
|
|
GstEbmlWrite *ebml;
|
|
|
|
GList *cur;
|
2017-12-01 17:17:06 +00:00
|
|
|
const GstTagList *tags;
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
ebml = mux->ebml_write;
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
tags = gst_toc_entry_get_tags (entry);
|
|
|
|
if (G_UNLIKELY (tags != NULL && !gst_matroska_mux_tag_list_is_empty (tags))) {
|
|
|
|
*has_tags = TRUE;
|
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
if (*master_tags == 0) {
|
|
|
|
mux->tags_pos = ebml->pos;
|
|
|
|
*master_tags = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
master_tag = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAG);
|
|
|
|
master_targets =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TARGETS);
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
if (gst_toc_entry_get_entry_type (entry) == GST_TOC_ENTRY_TYPE_EDITION)
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TARGETEDITIONUID,
|
2017-12-01 17:17:06 +00:00
|
|
|
g_ascii_strtoull (gst_toc_entry_get_uid (entry), NULL, 10));
|
2012-03-29 19:22:28 +00:00
|
|
|
else
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_TARGETCHAPTERUID,
|
2017-12-01 17:17:06 +00:00
|
|
|
g_ascii_strtoull (gst_toc_entry_get_uid (entry), NULL, 10));
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, master_targets);
|
2017-12-01 17:17:06 +00:00
|
|
|
gst_tag_list_foreach (tags, gst_matroska_mux_write_simple_tag, ebml);
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, master_tag);
|
|
|
|
}
|
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
for (cur = gst_toc_entry_get_sub_entries (entry); cur != NULL;
|
|
|
|
cur = cur->next) {
|
|
|
|
gst_matroska_mux_write_toc_entry_tags (mux, cur->data, master_tags,
|
|
|
|
has_tags);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
}
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_finish:
|
|
|
|
* @mux: #GstMatroskaMux
|
|
|
|
*
|
|
|
|
* Finish a new matroska file (write index etc...)
|
|
|
|
*/
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_mux_finish (GstMatroskaMux * mux)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2005-10-14 12:43:30 +00:00
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
guint64 pos;
|
2004-08-26 11:10:16 +00:00
|
|
|
guint64 duration = 0;
|
2005-10-14 12:43:30 +00:00
|
|
|
GSList *collected;
|
2017-12-01 17:17:06 +00:00
|
|
|
const GstTagList *tags, *toc_tags;
|
2017-12-15 13:48:09 +00:00
|
|
|
const GstToc *toc;
|
2017-12-01 17:17:06 +00:00
|
|
|
gboolean has_main_tags, toc_has_tags = FALSE;
|
|
|
|
GList *cur;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2004-09-09 15:40:06 +00:00
|
|
|
/* finish last cluster */
|
|
|
|
if (mux->cluster) {
|
|
|
|
gst_ebml_write_master_finish (ebml, mux->cluster);
|
|
|
|
}
|
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* cues */
|
2010-07-16 10:46:50 +00:00
|
|
|
if (mux->index != NULL) {
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
guint n;
|
|
|
|
guint64 master, pointentry_master, trackpos_master;
|
|
|
|
|
|
|
|
mux->cues_pos = ebml->pos;
|
|
|
|
gst_ebml_write_set_cache (ebml, 12 + 41 * mux->num_indexes);
|
|
|
|
master = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CUES);
|
|
|
|
|
|
|
|
for (n = 0; n < mux->num_indexes; n++) {
|
|
|
|
GstMatroskaIndex *idx = &mux->index[n];
|
|
|
|
|
|
|
|
pointentry_master = gst_ebml_write_master_start (ebml,
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_MATROSKA_ID_POINTENTRY);
|
2004-09-01 13:41:37 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUETIME,
|
2004-03-15 19:32:27 +00:00
|
|
|
idx->time / mux->time_scale);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
trackpos_master = gst_ebml_write_master_start (ebml,
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
GST_MATROSKA_ID_CUETRACKPOSITIONS);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUETRACK, idx->track);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CUECLUSTERPOSITION,
|
2004-03-15 19:32:27 +00:00
|
|
|
idx->pos - mux->segment_master);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, trackpos_master);
|
|
|
|
gst_ebml_write_master_finish (ebml, pointentry_master);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, master);
|
2010-10-20 09:05:49 +00:00
|
|
|
gst_ebml_write_flush_cache (ebml, FALSE, GST_CLOCK_TIME_NONE);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
/* tags */
|
2009-01-06 17:48:10 +00:00
|
|
|
tags = gst_tag_setter_get_tag_list (GST_TAG_SETTER (mux));
|
2016-02-19 22:44:42 +00:00
|
|
|
has_main_tags = tags != NULL && !gst_matroska_mux_tag_list_is_empty (tags);
|
2017-12-15 13:48:09 +00:00
|
|
|
toc = gst_toc_setter_get_toc (GST_TOC_SETTER (mux));
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
2017-12-15 13:48:09 +00:00
|
|
|
if (has_main_tags || gst_matroska_mux_streams_have_tags (mux) || toc != NULL) {
|
2012-03-29 19:22:28 +00:00
|
|
|
guint64 master_tags = 0, master_tag;
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
|
2011-12-16 16:20:51 +00:00
|
|
|
GST_DEBUG_OBJECT (mux, "Writing tags");
|
2008-08-25 14:15:43 +00:00
|
|
|
|
2015-02-02 22:46:27 +00:00
|
|
|
if (has_main_tags) {
|
2012-03-29 19:22:28 +00:00
|
|
|
/* TODO: maybe limit via the TARGETS id by looking at the source pad */
|
|
|
|
mux->tags_pos = ebml->pos;
|
|
|
|
master_tags = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAGS);
|
|
|
|
master_tag = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAG);
|
|
|
|
|
|
|
|
if (tags != NULL)
|
|
|
|
gst_tag_list_foreach (tags, gst_matroska_mux_write_simple_tag, ebml);
|
2017-12-01 17:17:06 +00:00
|
|
|
if (mux->internal_toc != NULL) {
|
|
|
|
toc_tags = gst_toc_get_tags (mux->internal_toc);
|
|
|
|
toc_has_tags = (toc_tags != NULL);
|
|
|
|
gst_tag_list_foreach (toc_tags, gst_matroska_mux_write_simple_tag,
|
2012-03-29 19:22:28 +00:00
|
|
|
ebml);
|
2017-12-01 17:17:06 +00:00
|
|
|
}
|
2012-03-29 19:22:28 +00:00
|
|
|
|
|
|
|
gst_ebml_write_master_finish (ebml, master_tag);
|
|
|
|
}
|
2017-12-01 17:17:06 +00:00
|
|
|
|
|
|
|
if (mux->internal_toc != NULL) {
|
|
|
|
for (cur = gst_toc_get_entries (mux->internal_toc); cur != NULL;
|
|
|
|
cur = cur->next) {
|
|
|
|
gst_matroska_mux_write_toc_entry_tags (mux, cur->data, &master_tags,
|
|
|
|
&toc_has_tags);
|
2012-03-29 19:22:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-02 22:46:27 +00:00
|
|
|
if (master_tags == 0 && gst_matroska_mux_streams_have_tags (mux)) {
|
|
|
|
mux->tags_pos = ebml->pos;
|
|
|
|
master_tags = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TAGS);
|
|
|
|
}
|
|
|
|
gst_matroska_mux_write_streams_tags (mux);
|
|
|
|
|
2012-03-29 19:22:28 +00:00
|
|
|
if (master_tags != 0)
|
|
|
|
gst_ebml_write_master_finish (ebml, master_tags);
|
gst/matroska/matroska-mux.*: Add basic tag writing support; implement releasing pads (#374658).
Original commit message from CVS:
Patch by: Mark Nauwelaerts <manauw at skynet be>
* gst/matroska/matroska-mux.c: (gst_matroska_mux_add_interfaces),
(gst_matroska_mux_class_init), (gst_matroska_pad_free),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(gst_matroska_mux_request_new_pad), (gst_matroska_mux_release_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish):
* gst/matroska/matroska-mux.h:
Add basic tag writing support; implement releasing pads (#374658).
2006-11-15 12:08:20 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* update seekhead. We know that:
|
2012-03-29 19:22:28 +00:00
|
|
|
* - a seekhead contains 5 entries.
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
* - order of entries is as above.
|
|
|
|
* - a seekhead has a 4-byte header + 8-byte length
|
|
|
|
* - each entry is 2-byte master, 2-byte ID pointer,
|
|
|
|
* 2-byte length pointer, all 8/1-byte length, 4-
|
|
|
|
* byte ID and 8-byte length pointer, where the
|
|
|
|
* length pointer starts at 20.
|
|
|
|
* - all entries are local to the segment (so pos - segment_master).
|
|
|
|
* - so each entry is at 12 + 20 + num * 28. */
|
2010-07-16 10:46:50 +00:00
|
|
|
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 32,
|
|
|
|
mux->info_pos - mux->segment_master);
|
|
|
|
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 60,
|
|
|
|
mux->tracks_pos - mux->segment_master);
|
2017-12-15 13:48:09 +00:00
|
|
|
if (toc != NULL && mux->chapters_pos > 0) {
|
2010-07-16 10:46:50 +00:00
|
|
|
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 88,
|
2012-03-29 19:22:28 +00:00
|
|
|
mux->chapters_pos - mux->segment_master);
|
2010-07-16 10:46:50 +00:00
|
|
|
} else {
|
|
|
|
/* void'ify */
|
|
|
|
guint64 my_pos = ebml->pos;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2010-07-16 10:46:50 +00:00
|
|
|
gst_ebml_write_seek (ebml, mux->seekhead_pos + 68);
|
|
|
|
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 26);
|
|
|
|
gst_ebml_write_seek (ebml, my_pos);
|
|
|
|
}
|
2012-03-29 19:22:28 +00:00
|
|
|
if (mux->index != NULL) {
|
2010-07-16 10:46:50 +00:00
|
|
|
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 116,
|
2012-03-29 19:22:28 +00:00
|
|
|
mux->cues_pos - mux->segment_master);
|
2010-07-16 10:46:50 +00:00
|
|
|
} else {
|
|
|
|
/* void'ify */
|
|
|
|
guint64 my_pos = ebml->pos;
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2010-07-16 10:46:50 +00:00
|
|
|
gst_ebml_write_seek (ebml, mux->seekhead_pos + 96);
|
|
|
|
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 26);
|
|
|
|
gst_ebml_write_seek (ebml, my_pos);
|
|
|
|
}
|
2005-10-14 12:43:30 +00:00
|
|
|
|
2017-12-01 17:17:06 +00:00
|
|
|
if (tags != NULL || toc_has_tags) {
|
2012-03-29 19:22:28 +00:00
|
|
|
gst_ebml_replace_uint (ebml, mux->seekhead_pos + 144,
|
|
|
|
mux->tags_pos - mux->segment_master);
|
|
|
|
} else {
|
|
|
|
/* void'ify */
|
|
|
|
guint64 my_pos = ebml->pos;
|
|
|
|
|
|
|
|
gst_ebml_write_seek (ebml, mux->seekhead_pos + 124);
|
|
|
|
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 26);
|
|
|
|
gst_ebml_write_seek (ebml, my_pos);
|
|
|
|
}
|
|
|
|
|
2017-12-15 13:48:09 +00:00
|
|
|
if (toc != NULL) {
|
|
|
|
gst_toc_unref (toc);
|
|
|
|
}
|
|
|
|
|
2011-12-16 15:56:37 +00:00
|
|
|
/* loop tracks:
|
|
|
|
* - first get the overall duration
|
|
|
|
* (a released track may have left a duration in here)
|
|
|
|
* - write some track header data for subtitles
|
|
|
|
*/
|
2010-07-16 10:46:50 +00:00
|
|
|
duration = mux->duration;
|
2011-12-16 15:56:37 +00:00
|
|
|
pos = ebml->pos;
|
2010-07-16 10:46:50 +00:00
|
|
|
for (collected = mux->collect->data; collected;
|
|
|
|
collected = g_slist_next (collected)) {
|
|
|
|
GstMatroskaPad *collect_pad;
|
2015-03-03 18:19:50 +00:00
|
|
|
/*
|
|
|
|
* observed duration, this will never remain GST_CLOCK_TIME_NONE
|
2019-09-02 12:27:35 +00:00
|
|
|
* since this means buffer without timestamps that is not possible
|
2015-03-03 18:19:50 +00:00
|
|
|
*/
|
|
|
|
GstClockTime collected_duration = GST_CLOCK_TIME_NONE;
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2010-07-16 10:46:50 +00:00
|
|
|
collect_pad = (GstMatroskaPad *) collected->data;
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
|
2010-07-16 10:46:50 +00:00
|
|
|
GST_DEBUG_OBJECT (mux,
|
|
|
|
"Pad %" GST_PTR_FORMAT " start ts %" GST_TIME_FORMAT
|
|
|
|
" end ts %" GST_TIME_FORMAT, collect_pad,
|
|
|
|
GST_TIME_ARGS (collect_pad->start_ts),
|
|
|
|
GST_TIME_ARGS (collect_pad->end_ts));
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (collect_pad->start_ts) &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (collect_pad->end_ts)) {
|
2015-03-03 18:19:50 +00:00
|
|
|
collected_duration =
|
2010-07-16 10:46:50 +00:00
|
|
|
GST_CLOCK_DIFF (collect_pad->start_ts, collect_pad->end_ts);
|
|
|
|
GST_DEBUG_OBJECT (collect_pad,
|
|
|
|
"final track duration: %" GST_TIME_FORMAT,
|
2015-03-03 18:19:50 +00:00
|
|
|
GST_TIME_ARGS (collected_duration));
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (collect_pad, "unable to get final track duration");
|
2010-05-20 23:59:53 +00:00
|
|
|
}
|
2015-03-03 18:19:50 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (collected_duration) &&
|
|
|
|
duration < collected_duration)
|
|
|
|
duration = collected_duration;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
2010-07-16 10:46:50 +00:00
|
|
|
}
|
2011-12-16 15:56:37 +00:00
|
|
|
|
|
|
|
/* seek back (optional, but do anyway) */
|
|
|
|
gst_ebml_write_seek (ebml, pos);
|
|
|
|
|
|
|
|
/* update duration */
|
2010-07-16 10:46:50 +00:00
|
|
|
if (duration != 0) {
|
|
|
|
GST_DEBUG_OBJECT (mux, "final total duration: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (duration));
|
|
|
|
pos = mux->ebml_write->pos;
|
|
|
|
gst_ebml_write_seek (ebml, mux->duration_pos);
|
|
|
|
gst_ebml_write_float (ebml, GST_MATROSKA_ID_DURATION,
|
|
|
|
gst_guint64_to_gdouble (duration) /
|
|
|
|
gst_guint64_to_gdouble (mux->time_scale));
|
|
|
|
gst_ebml_write_seek (ebml, pos);
|
|
|
|
} else {
|
|
|
|
/* void'ify */
|
|
|
|
guint64 my_pos = ebml->pos;
|
|
|
|
|
|
|
|
gst_ebml_write_seek (ebml, mux->duration_pos);
|
|
|
|
gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 8);
|
|
|
|
gst_ebml_write_seek (ebml, my_pos);
|
2010-05-20 23:59:53 +00:00
|
|
|
}
|
2010-05-21 13:35:34 +00:00
|
|
|
GST_DEBUG_OBJECT (mux, "finishing segment");
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* finish segment - this also writes element length */
|
|
|
|
gst_ebml_write_master_finish (ebml, mux->segment_pos);
|
|
|
|
}
|
|
|
|
|
2005-10-28 15:32:48 +00:00
|
|
|
/**
|
|
|
|
* gst_matroska_mux_buffer_header:
|
|
|
|
* @track: Track context.
|
|
|
|
* @relative_timestamp: relative timestamp of the buffer
|
|
|
|
* @flags: Buffer flags.
|
|
|
|
*
|
|
|
|
* Create a buffer containing buffer header.
|
2011-02-16 15:09:20 +00:00
|
|
|
*
|
2005-10-28 15:32:48 +00:00
|
|
|
* Returns: New buffer.
|
|
|
|
*/
|
2010-03-17 17:23:00 +00:00
|
|
|
static GstBuffer *
|
2005-10-28 15:32:48 +00:00
|
|
|
gst_matroska_mux_create_buffer_header (GstMatroskaTrackContext * track,
|
2006-04-25 11:09:24 +00:00
|
|
|
gint16 relative_timestamp, int flags)
|
2005-10-28 15:32:48 +00:00
|
|
|
{
|
|
|
|
GstBuffer *hdr;
|
2011-11-26 09:01:07 +00:00
|
|
|
guint8 *data = g_malloc (4);
|
2005-10-28 15:32:48 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
hdr = gst_buffer_new_wrapped (data, 4);
|
2005-10-28 15:32:48 +00:00
|
|
|
/* track num - FIXME: what if num >= 0x80 (unlikely)? */
|
2011-11-26 09:01:07 +00:00
|
|
|
data[0] = track->num | 0x80;
|
2005-10-28 15:32:48 +00:00
|
|
|
/* time relative to clustertime */
|
2011-11-26 09:01:07 +00:00
|
|
|
GST_WRITE_UINT16_BE (data + 1, relative_timestamp);
|
2005-10-28 15:32:48 +00:00
|
|
|
|
|
|
|
/* flags */
|
2011-11-26 09:01:07 +00:00
|
|
|
data[3] = flags;
|
2005-10-28 15:32:48 +00:00
|
|
|
|
|
|
|
return hdr;
|
|
|
|
}
|
|
|
|
|
2009-10-22 10:30:14 +00:00
|
|
|
#define DIRAC_PARSE_CODE_SEQUENCE_HEADER 0x00
|
|
|
|
#define DIRAC_PARSE_CODE_END_OF_SEQUENCE 0x10
|
|
|
|
#define DIRAC_PARSE_CODE_IS_PICTURE(x) ((x & 0x08) != 0)
|
2009-09-22 10:48:50 +00:00
|
|
|
|
2008-11-05 14:42:35 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_matroska_mux_handle_dirac_packet (GstMatroskaMux * mux,
|
|
|
|
GstMatroskaPad * collect_pad, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstMatroskaTrackVideoContext *ctx =
|
|
|
|
(GstMatroskaTrackVideoContext *) collect_pad->track;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
guint8 *data;
|
2011-11-26 09:01:07 +00:00
|
|
|
gsize size;
|
2008-11-05 14:42:35 +00:00
|
|
|
guint8 parse_code;
|
2008-11-11 12:18:23 +00:00
|
|
|
guint32 next_parse_offset;
|
2008-11-05 14:42:35 +00:00
|
|
|
GstBuffer *ret = NULL;
|
2009-10-22 10:30:14 +00:00
|
|
|
gboolean is_muxing_unit = FALSE;
|
2008-11-05 14:42:35 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
if (size < 13) {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2008-11-05 14:42:35 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-10-22 10:30:14 +00:00
|
|
|
/* Check if this buffer contains a picture or end-of-sequence packet */
|
2008-11-11 12:18:23 +00:00
|
|
|
while (size >= 13) {
|
2009-09-22 10:48:50 +00:00
|
|
|
if (GST_READ_UINT32_BE (data) != 0x42424344 /* 'BBCD' */ ) {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2008-11-11 12:18:23 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return ret;
|
|
|
|
}
|
2008-11-05 14:42:35 +00:00
|
|
|
|
2008-11-11 12:18:23 +00:00
|
|
|
parse_code = GST_READ_UINT8 (data + 4);
|
2009-10-22 10:30:14 +00:00
|
|
|
if (parse_code == DIRAC_PARSE_CODE_SEQUENCE_HEADER) {
|
2008-11-05 14:42:35 +00:00
|
|
|
if (ctx->dirac_unit) {
|
|
|
|
gst_buffer_unref (ctx->dirac_unit);
|
|
|
|
ctx->dirac_unit = NULL;
|
|
|
|
}
|
2009-10-22 10:30:14 +00:00
|
|
|
} else if (DIRAC_PARSE_CODE_IS_PICTURE (parse_code) ||
|
|
|
|
parse_code == DIRAC_PARSE_CODE_END_OF_SEQUENCE) {
|
|
|
|
is_muxing_unit = TRUE;
|
2008-11-05 14:42:35 +00:00
|
|
|
break;
|
2008-11-11 12:18:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
next_parse_offset = GST_READ_UINT32_BE (data + 5);
|
|
|
|
|
2011-10-11 20:10:27 +00:00
|
|
|
if (G_UNLIKELY (next_parse_offset == 0 || next_parse_offset > size))
|
2009-09-22 10:48:50 +00:00
|
|
|
break;
|
|
|
|
|
2008-11-11 12:18:23 +00:00
|
|
|
data += next_parse_offset;
|
|
|
|
size -= next_parse_offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ctx->dirac_unit)
|
2012-03-28 10:49:19 +00:00
|
|
|
ctx->dirac_unit = gst_buffer_append (ctx->dirac_unit, gst_buffer_ref (buf));
|
2008-11-11 12:18:23 +00:00
|
|
|
else
|
|
|
|
ctx->dirac_unit = gst_buffer_ref (buf);
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2009-10-22 10:30:14 +00:00
|
|
|
if (is_muxing_unit) {
|
2011-11-26 09:01:07 +00:00
|
|
|
ret = gst_buffer_make_writable (ctx->dirac_unit);
|
2008-11-11 12:18:23 +00:00
|
|
|
ctx->dirac_unit = NULL;
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_copy_into (ret, buf,
|
|
|
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS, 0, -1);
|
2008-11-11 12:18:23 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
} else {
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
ret = NULL;
|
2008-11-05 14:42:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-05-21 13:35:34 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_mux_stop_streamheader (GstMatroskaMux * mux)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *s;
|
|
|
|
GValue streamheader = { 0 };
|
|
|
|
GValue bufval = { 0 };
|
|
|
|
GstBuffer *streamheader_buffer;
|
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
|
|
|
|
|
|
|
streamheader_buffer = gst_ebml_stop_streamheader (ebml);
|
2012-04-28 18:57:51 +00:00
|
|
|
caps = gst_caps_copy (mux->ebml_write->caps);
|
2010-05-21 13:35:34 +00:00
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
g_value_init (&streamheader, GST_TYPE_ARRAY);
|
|
|
|
g_value_init (&bufval, GST_TYPE_BUFFER);
|
2012-01-30 16:16:51 +00:00
|
|
|
GST_BUFFER_FLAG_SET (streamheader_buffer, GST_BUFFER_FLAG_HEADER);
|
2010-05-21 13:35:34 +00:00
|
|
|
gst_value_set_buffer (&bufval, streamheader_buffer);
|
|
|
|
gst_value_array_append_value (&streamheader, &bufval);
|
|
|
|
g_value_unset (&bufval);
|
|
|
|
gst_structure_set_value (s, "streamheader", &streamheader);
|
|
|
|
g_value_unset (&streamheader);
|
2010-11-19 11:45:00 +00:00
|
|
|
gst_caps_replace (&ebml->caps, caps);
|
2010-06-25 17:40:06 +00:00
|
|
|
gst_buffer_unref (streamheader_buffer);
|
2012-04-20 11:35:15 +00:00
|
|
|
gst_pad_set_caps (mux->srcpad, caps);
|
2010-11-19 11:45:00 +00:00
|
|
|
gst_caps_unref (caps);
|
2010-05-21 13:35:34 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
/**
|
|
|
|
* gst_matroska_mux_write_data:
|
|
|
|
* @mux: #GstMatroskaMux
|
2006-01-23 10:44:03 +00:00
|
|
|
* @collect_pad: #GstMatroskaPad with the data
|
2005-10-14 12:43:30 +00:00
|
|
|
*
|
|
|
|
* Write collected data (called from gst_matroska_mux_collected).
|
|
|
|
*
|
|
|
|
* Returns: Result of the gst_pad_push issued to write the data.
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
2011-12-15 20:50:42 +00:00
|
|
|
gst_matroska_mux_write_data (GstMatroskaMux * mux, GstMatroskaPad * collect_pad,
|
|
|
|
GstBuffer * buf)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2005-10-14 12:43:30 +00:00
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
2011-12-15 20:50:42 +00:00
|
|
|
GstBuffer *hdr;
|
2009-04-18 16:11:00 +00:00
|
|
|
guint64 blockgroup;
|
2005-10-28 15:32:48 +00:00
|
|
|
gboolean write_duration;
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
guint64 cluster_time_scaled;
|
2006-04-25 11:09:24 +00:00
|
|
|
gint16 relative_timestamp;
|
|
|
|
gint64 relative_timestamp64;
|
2015-11-03 10:18:19 +00:00
|
|
|
guint64 block_duration, duration_diff = 0;
|
2006-05-03 18:41:47 +00:00
|
|
|
gboolean is_video_keyframe = FALSE;
|
2012-12-16 23:27:41 +00:00
|
|
|
gboolean is_video_invisible = FALSE;
|
2016-05-29 23:15:31 +00:00
|
|
|
gboolean is_audio_only = FALSE;
|
2017-07-17 22:26:11 +00:00
|
|
|
gboolean is_min_duration_reached = FALSE;
|
|
|
|
gboolean is_max_duration_exceeded = FALSE;
|
2011-10-11 00:07:13 +00:00
|
|
|
GstMatroskamuxPad *pad;
|
2012-12-16 23:27:41 +00:00
|
|
|
gint flags = 0;
|
2015-03-03 17:40:16 +00:00
|
|
|
GstClockTime buffer_timestamp;
|
2015-11-03 10:18:19 +00:00
|
|
|
GstAudioClippingMeta *cmeta = NULL;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
|
|
|
/* write data */
|
2011-10-11 00:07:13 +00:00
|
|
|
pad = GST_MATROSKAMUX_PAD_CAST (collect_pad->collect.pad);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
|
gst/matroska/: Add support for muxing/demuxing theora video (#342448; too bad none of the usual linux players can act...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_video_pad_setcaps),
(xiph3_streamheader_to_codecdata),
(vorbis_streamheader_to_codecdata),
(theora_streamheader_to_codecdata),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_write_data):
Add support for muxing/demuxing theora video (#342448; too bad
none of the usual linux players can actually play this). Playback
in GStreamer will require additional changes to theoradec in -base.
Refactor streamheaders <=> CodecPrivateData code a bit; some small
cleanups.
2006-05-23 13:44:11 +00:00
|
|
|
/* vorbis/theora headers are retrieved from caps and put in CodecPrivate */
|
|
|
|
if (collect_pad->track->xiph_headers_to_skip > 0) {
|
|
|
|
--collect_pad->track->xiph_headers_to_skip;
|
2015-05-08 10:44:01 +00:00
|
|
|
if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_HEADER)) {
|
|
|
|
GST_LOG_OBJECT (collect_pad->collect.pad, "dropping streamheader buffer");
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
2006-05-03 14:51:50 +00:00
|
|
|
}
|
|
|
|
|
2008-11-05 14:42:35 +00:00
|
|
|
/* for dirac we have to queue up everything up to a picture unit */
|
2016-07-07 15:23:07 +00:00
|
|
|
if (!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_DIRAC)) {
|
2008-11-05 14:42:35 +00:00
|
|
|
buf = gst_matroska_mux_handle_dirac_packet (mux, collect_pad, buf);
|
|
|
|
if (!buf)
|
|
|
|
return GST_FLOW_OK;
|
2016-07-07 15:23:07 +00:00
|
|
|
} else if (!strcmp (collect_pad->track->codec_id,
|
2016-05-15 10:24:03 +00:00
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_PRORES)) {
|
2015-11-18 10:01:20 +00:00
|
|
|
/* Remove the 'Frame container atom' header' */
|
|
|
|
buf = gst_buffer_make_writable (buf);
|
|
|
|
gst_buffer_resize (buf, 8, gst_buffer_get_size (buf) - 8);
|
2008-11-05 14:42:35 +00:00
|
|
|
}
|
|
|
|
|
2015-03-03 17:40:16 +00:00
|
|
|
buffer_timestamp =
|
|
|
|
gst_matroska_track_get_buffer_timestamp (collect_pad->track, buf);
|
2019-04-18 12:31:00 +00:00
|
|
|
if (buffer_timestamp >= mux->earliest_time) {
|
|
|
|
buffer_timestamp -= mux->earliest_time;
|
|
|
|
} else {
|
|
|
|
buffer_timestamp = 0;
|
|
|
|
}
|
2015-03-03 17:40:16 +00:00
|
|
|
|
2006-05-03 14:51:50 +00:00
|
|
|
/* hm, invalid timestamp (due to --to be fixed--- element upstream);
|
|
|
|
* this would wreak havoc with time stored in matroska file */
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
/* TODO: maybe calculate a timestamp by using the previous timestamp
|
|
|
|
* and default duration */
|
2015-03-03 17:40:16 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (buffer_timestamp)) {
|
2006-05-03 14:51:50 +00:00
|
|
|
GST_WARNING_OBJECT (collect_pad->collect.pad,
|
|
|
|
"Invalid buffer timestamp; dropping buffer");
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2015-11-03 10:18:19 +00:00
|
|
|
if (!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_AUDIO_OPUS)
|
|
|
|
&& collect_pad->track->codec_delay) {
|
|
|
|
/* All timestamps should include the codec delay */
|
|
|
|
if (buffer_timestamp > collect_pad->track->codec_delay) {
|
|
|
|
buffer_timestamp += collect_pad->track->codec_delay;
|
|
|
|
} else {
|
|
|
|
buffer_timestamp = 0;
|
|
|
|
duration_diff = collect_pad->track->codec_delay - buffer_timestamp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-01 12:35:39 +00:00
|
|
|
/* set the timestamp for outgoing buffers */
|
2015-03-03 17:40:16 +00:00
|
|
|
ebml->timestamp = buffer_timestamp;
|
2005-11-01 12:35:39 +00:00
|
|
|
|
2012-12-16 23:27:41 +00:00
|
|
|
if (collect_pad->track->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
|
|
|
|
if (!GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
|
|
|
GST_LOG_OBJECT (mux, "have video keyframe, ts=%" GST_TIME_FORMAT,
|
2015-03-03 17:40:16 +00:00
|
|
|
GST_TIME_ARGS (buffer_timestamp));
|
2012-12-16 23:27:41 +00:00
|
|
|
is_video_keyframe = TRUE;
|
|
|
|
} else if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_DECODE_ONLY) &&
|
2013-06-21 11:11:32 +00:00
|
|
|
(!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)
|
|
|
|
|| !strcmp (collect_pad->track->codec_id,
|
|
|
|
GST_MATROSKA_CODEC_ID_VIDEO_VP9))) {
|
2012-12-16 23:27:41 +00:00
|
|
|
GST_LOG_OBJECT (mux,
|
|
|
|
"have VP8 video invisible frame, " "ts=%" GST_TIME_FORMAT,
|
2015-03-03 17:40:16 +00:00
|
|
|
GST_TIME_ARGS (buffer_timestamp));
|
2012-12-16 23:27:41 +00:00
|
|
|
is_video_invisible = TRUE;
|
|
|
|
}
|
2006-05-03 18:41:47 +00:00
|
|
|
}
|
|
|
|
|
2016-05-29 23:15:31 +00:00
|
|
|
is_audio_only = (collect_pad->track->type == GST_MATROSKA_TRACK_TYPE_AUDIO) &&
|
|
|
|
(mux->num_streams == 1);
|
2017-07-17 22:26:11 +00:00
|
|
|
is_min_duration_reached = (mux->min_cluster_duration == 0
|
|
|
|
|| (buffer_timestamp > mux->cluster_time
|
|
|
|
&& (buffer_timestamp - mux->cluster_time) >=
|
|
|
|
mux->min_cluster_duration));
|
|
|
|
is_max_duration_exceeded = (mux->max_cluster_duration > 0
|
|
|
|
&& buffer_timestamp > mux->cluster_time
|
2018-02-28 17:19:10 +00:00
|
|
|
&& (buffer_timestamp - mux->cluster_time) >=
|
|
|
|
MIN (G_MAXINT16 * mux->time_scale, mux->max_cluster_duration));
|
2016-05-29 23:15:31 +00:00
|
|
|
|
2004-09-09 15:40:06 +00:00
|
|
|
if (mux->cluster) {
|
2011-03-15 10:03:53 +00:00
|
|
|
/* start a new cluster at every keyframe, at every GstForceKeyUnit event,
|
|
|
|
* or when we may be reaching the limit of the relative timestamp */
|
2017-07-17 22:26:11 +00:00
|
|
|
if (is_max_duration_exceeded || (is_video_keyframe
|
|
|
|
&& is_min_duration_reached) || mux->force_key_unit_event
|
|
|
|
|| (is_audio_only && is_min_duration_reached)) {
|
2015-10-11 10:37:51 +00:00
|
|
|
if (!mux->ebml_write->streamable)
|
2010-05-21 13:35:34 +00:00
|
|
|
gst_ebml_write_master_finish (ebml, mux->cluster);
|
2011-03-15 10:03:53 +00:00
|
|
|
|
|
|
|
/* Forward the GstForceKeyUnit event after finishing the cluster */
|
|
|
|
if (mux->force_key_unit_event) {
|
|
|
|
gst_pad_push_event (mux->srcpad, mux->force_key_unit_event);
|
|
|
|
mux->force_key_unit_event = NULL;
|
|
|
|
}
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
cluster_time_scaled =
|
|
|
|
gst_util_uint64_scale (buffer_timestamp, 1, mux->time_scale);
|
2011-03-15 10:03:53 +00:00
|
|
|
|
2010-05-01 12:20:59 +00:00
|
|
|
mux->prev_cluster_size = ebml->pos - mux->cluster_pos;
|
2004-09-09 15:40:06 +00:00
|
|
|
mux->cluster_pos = ebml->pos;
|
2010-05-20 12:33:41 +00:00
|
|
|
gst_ebml_write_set_cache (ebml, 0x20);
|
2004-09-09 15:40:06 +00:00
|
|
|
mux->cluster =
|
|
|
|
gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CLUSTER);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CLUSTERTIMECODE,
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
cluster_time_scaled);
|
2010-07-20 15:11:25 +00:00
|
|
|
GST_LOG_OBJECT (mux, "cluster timestamp %" G_GUINT64_FORMAT,
|
2015-03-03 17:40:16 +00:00
|
|
|
gst_util_uint64_scale (buffer_timestamp, 1, mux->time_scale));
|
2018-02-28 17:21:53 +00:00
|
|
|
gst_ebml_write_flush_cache (ebml, is_video_keyframe
|
|
|
|
|| is_audio_only, buffer_timestamp);
|
2010-05-01 12:20:59 +00:00
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_PREVSIZE,
|
|
|
|
mux->prev_cluster_size);
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
/* cluster_time needs to be identical in value to what's stored in the
|
|
|
|
* matroska so we need to have it with the same precision as what's
|
|
|
|
* possible with the set timecodescale rather than just using the
|
|
|
|
* buffer_timestamp.
|
|
|
|
* If this is not done the rounding of relative_timestamp will be
|
|
|
|
* incorrect and possibly making the timestamps get out of order if tw
|
|
|
|
* buffers arrive at the same millisecond (assuming default timecodescale
|
|
|
|
* of 1ms) */
|
|
|
|
mux->cluster_time =
|
|
|
|
gst_util_uint64_scale (cluster_time_scaled, mux->time_scale, 1);
|
2004-09-09 15:40:06 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* first cluster */
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
cluster_time_scaled =
|
|
|
|
gst_util_uint64_scale (buffer_timestamp, 1, mux->time_scale);
|
2004-09-09 15:40:06 +00:00
|
|
|
mux->cluster_pos = ebml->pos;
|
2010-05-20 12:33:41 +00:00
|
|
|
gst_ebml_write_set_cache (ebml, 0x20);
|
2004-09-09 15:40:06 +00:00
|
|
|
mux->cluster = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_CLUSTER);
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_CLUSTERTIMECODE,
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
cluster_time_scaled);
|
2015-03-03 17:40:16 +00:00
|
|
|
gst_ebml_write_flush_cache (ebml, TRUE, buffer_timestamp);
|
matroska-mux: Fix incorrect rounding of timestamps
Previously we saved the buffer_timestamp straight into
mux->cluster_time. Since the cluster time saved into the file does not
have as high precision as GstClockTime depending on the timecodescale
the rounding of relative_timestamp was invalid as mux->cluster_time
which it was calculated relative to was not equal to the cluster time
written to the matroska file.
Example of "mkvinfo -v" of how it looks before and after this change in
an scenario where previously timestamps got out of order because of this
issue.
Notice the timestamp of the SimpleBlock right before and right after the
Cluster now being in order. The consequence of this however is that the
cluster timestamp is not necessarily the same as the timestamp of the
first buffer in the cluster however (in case it's rounded up).
Before
| + SimpleBlock (track number 1, 1 frame(s), timecode 126.922s = 00:02:06.922)
| + Frame with size 432
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.933s = 00:02:06.933)
| + Frame with size 329
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.955s = 00:02:06.955)
| + Frame with size 333
|+ Cluster
| + Cluster timecode: 126.954s
| + Cluster previous size: 97344
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 126.954s = 00:02:06.954)
| + Frame with size 61239
| + SimpleBlock (track number 2, 1 frame(s), timecode 126.975s = 00:02:06.975)
| + Frame with size 338
After
| + SimpleBlock (track number 1, 1 frame(s), timecode 135.456s = 00:02:15.456)
| + Frame with size 2260
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.468s = 00:02:15.468)
| + Frame with size 332
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 335
|+ Cluster
| + Cluster timecode: 135.489s
| + Cluster previous size: 158758
| + SimpleBlock (key, track number 1, 1 frame(s), timecode 135.490s = 00:02:15.490)
| + Frame with size 88070
| + SimpleBlock (track number 2, 1 frame(s), timecode 135.511s = 00:02:15.511)
| + Frame with size 336
2020-02-21 08:34:30 +00:00
|
|
|
/* cluster_time needs to be identical in value to what's stored in the
|
|
|
|
* matroska so we need to have it with the same precision as what's
|
|
|
|
* possible with the set timecodescale rather than just using the
|
|
|
|
* buffer_timestamp.
|
|
|
|
* If this is not done the rounding of relative_timestamp will be
|
|
|
|
* incorrect and possibly making the timestamps get out of order if tw
|
|
|
|
* buffers arrive at the same millisecond (assuming default timecodescale
|
|
|
|
* of 1ms) */
|
|
|
|
mux->cluster_time =
|
|
|
|
gst_util_uint64_scale (cluster_time_scaled, mux->time_scale, 1);
|
2004-09-09 15:40:06 +00:00
|
|
|
}
|
|
|
|
|
2009-05-27 11:51:44 +00:00
|
|
|
/* We currently write index entries for all video tracks or for the audio
|
|
|
|
* track in a single-track audio file. This could be improved by keeping the
|
|
|
|
* index only for the *first* video track. */
|
2008-06-11 11:27:46 +00:00
|
|
|
|
2008-06-13 19:14:41 +00:00
|
|
|
/* TODO: index is useful for every track, should contain the number of
|
2009-05-27 11:51:44 +00:00
|
|
|
* the block in the cluster which contains the timestamp, should also work
|
|
|
|
* for files with multiple audio tracks.
|
2008-06-13 19:14:41 +00:00
|
|
|
*/
|
2016-05-29 23:15:31 +00:00
|
|
|
if (!mux->ebml_write->streamable && (is_video_keyframe || is_audio_only)) {
|
2009-05-27 11:51:44 +00:00
|
|
|
gint last_idx = -1;
|
|
|
|
|
|
|
|
if (mux->min_index_interval != 0) {
|
|
|
|
for (last_idx = mux->num_indexes - 1; last_idx >= 0; last_idx--) {
|
|
|
|
if (mux->index[last_idx].track == collect_pad->track->num)
|
|
|
|
break;
|
|
|
|
}
|
2004-09-01 13:41:37 +00:00
|
|
|
}
|
|
|
|
|
2009-05-27 11:51:44 +00:00
|
|
|
if (last_idx < 0 || mux->min_index_interval == 0 ||
|
2015-03-03 17:40:16 +00:00
|
|
|
(GST_CLOCK_DIFF (mux->index[last_idx].time, buffer_timestamp)
|
2009-05-27 11:51:44 +00:00
|
|
|
>= mux->min_index_interval)) {
|
|
|
|
GstMatroskaIndex *idx;
|
|
|
|
|
|
|
|
if (mux->num_indexes % 32 == 0) {
|
|
|
|
mux->index = g_renew (GstMatroskaIndex, mux->index,
|
|
|
|
mux->num_indexes + 32);
|
|
|
|
}
|
|
|
|
idx = &mux->index[mux->num_indexes++];
|
|
|
|
|
|
|
|
idx->pos = mux->cluster_pos;
|
2015-03-03 17:40:16 +00:00
|
|
|
idx->time = buffer_timestamp;
|
2009-05-27 11:51:44 +00:00
|
|
|
idx->track = collect_pad->track->num;
|
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2005-10-28 15:32:48 +00:00
|
|
|
/* Check if the duration differs from the default duration. */
|
|
|
|
write_duration = FALSE;
|
2011-09-06 13:05:37 +00:00
|
|
|
block_duration = 0;
|
2011-10-11 00:07:13 +00:00
|
|
|
if (pad->frame_duration && GST_BUFFER_DURATION_IS_VALID (buf)) {
|
2015-11-03 10:18:19 +00:00
|
|
|
block_duration = GST_BUFFER_DURATION (buf) + duration_diff;
|
|
|
|
block_duration = gst_util_uint64_scale (block_duration, 1, mux->time_scale);
|
2011-09-06 13:05:37 +00:00
|
|
|
|
|
|
|
/* small difference should be ok. */
|
|
|
|
if (block_duration > collect_pad->default_duration_scaled + 1 ||
|
|
|
|
block_duration < collect_pad->default_duration_scaled - 1) {
|
2005-10-28 15:32:48 +00:00
|
|
|
write_duration = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-17 03:27:44 +00:00
|
|
|
/* write the block, for doctype v2 use SimpleBlock if possible
|
2005-10-28 15:32:48 +00:00
|
|
|
* one slice (*breath*).
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
* FIXME: Need to do correct lacing! */
|
2015-03-03 17:40:16 +00:00
|
|
|
relative_timestamp64 = buffer_timestamp - mux->cluster_time;
|
2006-04-25 11:09:24 +00:00
|
|
|
if (relative_timestamp64 >= 0) {
|
|
|
|
/* round the timestamp */
|
2010-05-23 12:56:16 +00:00
|
|
|
relative_timestamp64 += gst_util_uint64_scale (mux->time_scale, 1, 2);
|
2013-11-23 11:15:40 +00:00
|
|
|
relative_timestamp = gst_util_uint64_scale (relative_timestamp64, 1,
|
|
|
|
mux->time_scale);
|
2006-04-25 11:09:24 +00:00
|
|
|
} else {
|
|
|
|
/* round the timestamp */
|
2010-05-23 12:56:16 +00:00
|
|
|
relative_timestamp64 -= gst_util_uint64_scale (mux->time_scale, 1, 2);
|
2013-11-23 11:15:40 +00:00
|
|
|
relative_timestamp =
|
|
|
|
-((gint16) gst_util_uint64_scale (-relative_timestamp64, 1,
|
|
|
|
mux->time_scale));
|
2006-04-25 11:09:24 +00:00
|
|
|
}
|
2012-12-16 23:27:41 +00:00
|
|
|
|
|
|
|
if (is_video_invisible)
|
|
|
|
flags |= 0x08;
|
|
|
|
|
2015-11-03 10:18:19 +00:00
|
|
|
if (!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_AUDIO_OPUS)) {
|
|
|
|
cmeta = gst_buffer_get_audio_clipping_meta (buf);
|
|
|
|
g_assert (!cmeta || cmeta->format == GST_FORMAT_DEFAULT);
|
|
|
|
|
|
|
|
/* Start clipping is done via header and CodecDelay */
|
|
|
|
if (cmeta && !cmeta->end)
|
|
|
|
cmeta = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mux->doctype_version > 1 && !write_duration && !cmeta) {
|
2012-12-16 23:27:41 +00:00
|
|
|
if (is_video_keyframe)
|
|
|
|
flags |= 0x80;
|
2005-10-28 15:32:48 +00:00
|
|
|
|
|
|
|
hdr =
|
2006-01-23 10:44:03 +00:00
|
|
|
gst_matroska_mux_create_buffer_header (collect_pad->track,
|
|
|
|
relative_timestamp, flags);
|
2010-05-20 12:33:41 +00:00
|
|
|
gst_ebml_write_set_cache (ebml, 0x40);
|
2005-10-28 15:32:48 +00:00
|
|
|
gst_ebml_write_buffer_header (ebml, GST_MATROSKA_ID_SIMPLEBLOCK,
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_get_size (buf) + gst_buffer_get_size (hdr));
|
2005-10-28 15:32:48 +00:00
|
|
|
gst_ebml_write_buffer (ebml, hdr);
|
2015-03-03 17:40:16 +00:00
|
|
|
gst_ebml_write_flush_cache (ebml, FALSE, buffer_timestamp);
|
2005-10-28 15:32:48 +00:00
|
|
|
gst_ebml_write_buffer (ebml, buf);
|
|
|
|
|
|
|
|
return gst_ebml_last_write_result (ebml);
|
|
|
|
} else {
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_ebml_write_set_cache (ebml, gst_buffer_get_size (buf) * 2);
|
2010-05-20 12:33:41 +00:00
|
|
|
/* write and call order slightly unnatural,
|
|
|
|
* but avoids seek and minizes pushing */
|
2005-10-28 15:32:48 +00:00
|
|
|
blockgroup = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_BLOCKGROUP);
|
|
|
|
hdr =
|
2006-01-23 10:44:03 +00:00
|
|
|
gst_matroska_mux_create_buffer_header (collect_pad->track,
|
2012-12-16 23:27:41 +00:00
|
|
|
relative_timestamp, flags);
|
2011-09-06 13:05:37 +00:00
|
|
|
if (write_duration)
|
|
|
|
gst_ebml_write_uint (ebml, GST_MATROSKA_ID_BLOCKDURATION, block_duration);
|
2015-11-03 10:18:19 +00:00
|
|
|
|
|
|
|
if (!strcmp (collect_pad->track->codec_id, GST_MATROSKA_CODEC_ID_AUDIO_OPUS)
|
|
|
|
&& cmeta) {
|
|
|
|
/* Start clipping is done via header and CodecDelay */
|
|
|
|
if (cmeta->end) {
|
|
|
|
guint64 end =
|
|
|
|
gst_util_uint64_scale_round (cmeta->end, GST_SECOND, 48000);
|
|
|
|
gst_ebml_write_sint (ebml, GST_MATROSKA_ID_DISCARDPADDING, end);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-20 12:33:41 +00:00
|
|
|
gst_ebml_write_buffer_header (ebml, GST_MATROSKA_ID_BLOCK,
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_get_size (buf) + gst_buffer_get_size (hdr));
|
2010-05-20 12:33:41 +00:00
|
|
|
gst_ebml_write_buffer (ebml, hdr);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_ebml_write_master_finish_full (ebml, blockgroup,
|
|
|
|
gst_buffer_get_size (buf));
|
2015-03-03 17:40:16 +00:00
|
|
|
gst_ebml_write_flush_cache (ebml, FALSE, buffer_timestamp);
|
2010-05-20 12:33:41 +00:00
|
|
|
gst_ebml_write_buffer (ebml, buf);
|
2010-10-20 09:05:49 +00:00
|
|
|
|
2005-10-28 15:32:48 +00:00
|
|
|
return gst_ebml_last_write_result (ebml);
|
2004-09-01 12:10:21 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
/**
|
2011-12-15 20:45:17 +00:00
|
|
|
* gst_matroska_mux_handle_buffer:
|
2012-04-17 13:14:27 +00:00
|
|
|
* @pads: #GstCollectPads
|
2005-10-14 12:43:30 +00:00
|
|
|
* @uuser_data: #GstMatroskaMux
|
|
|
|
*
|
|
|
|
* Collectpads callback.
|
|
|
|
*
|
|
|
|
* Returns: #GstFlowReturn
|
|
|
|
*/
|
|
|
|
static GstFlowReturn
|
2012-04-17 13:14:27 +00:00
|
|
|
gst_matroska_mux_handle_buffer (GstCollectPads * pads, GstCollectData * data,
|
2011-12-15 20:45:17 +00:00
|
|
|
GstBuffer * buf, gpointer user_data)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2015-03-03 17:40:16 +00:00
|
|
|
GstClockTime buffer_timestamp;
|
2005-10-14 12:43:30 +00:00
|
|
|
GstMatroskaMux *mux = GST_MATROSKA_MUX (user_data);
|
2010-05-21 13:35:34 +00:00
|
|
|
GstEbmlWrite *ebml = mux->ebml_write;
|
2017-07-18 07:41:40 +00:00
|
|
|
GstMatroskaPad *best = (GstMatroskaPad *) data;
|
2011-03-22 18:36:21 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2005-11-01 15:11:16 +00:00
|
|
|
GST_DEBUG_OBJECT (mux, "Collected pads");
|
2005-01-09 10:30:59 +00:00
|
|
|
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
/* start with a header */
|
|
|
|
if (mux->state == GST_MATROSKA_MUX_STATE_START) {
|
2005-10-14 12:43:30 +00:00
|
|
|
if (mux->collect->data == NULL) {
|
|
|
|
GST_ELEMENT_ERROR (mux, STREAM, MUX, (NULL),
|
|
|
|
("No input streams configured"));
|
|
|
|
return GST_FLOW_ERROR;
|
2004-08-26 11:10:16 +00:00
|
|
|
}
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
mux->state = GST_MATROSKA_MUX_STATE_HEADER;
|
2010-05-21 13:35:34 +00:00
|
|
|
gst_ebml_start_streamheader (ebml);
|
2017-07-18 07:41:40 +00:00
|
|
|
gst_matroska_mux_start (mux, best, buf);
|
2010-05-21 13:35:34 +00:00
|
|
|
gst_matroska_mux_stop_streamheader (mux);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
mux->state = GST_MATROSKA_MUX_STATE_DATA;
|
|
|
|
}
|
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
/* if there is no best pad, we have reached EOS */
|
|
|
|
if (best == NULL) {
|
2013-10-06 17:01:26 +00:00
|
|
|
GST_DEBUG_OBJECT (mux, "No best pad. Finishing...");
|
2015-10-11 10:37:51 +00:00
|
|
|
if (!mux->ebml_write->streamable) {
|
2011-12-15 20:50:42 +00:00
|
|
|
gst_matroska_mux_finish (mux);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (mux, "... but streamable, nothing to finish");
|
2006-01-23 10:44:03 +00:00
|
|
|
}
|
2011-12-15 20:50:42 +00:00
|
|
|
gst_pad_push_event (mux->srcpad, gst_event_new_eos ());
|
2012-01-10 13:32:32 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2011-12-15 20:50:42 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
2006-01-23 10:44:03 +00:00
|
|
|
|
2016-07-07 15:23:07 +00:00
|
|
|
if (best->track->codec_id == NULL) {
|
|
|
|
GST_ERROR_OBJECT (best->collect.pad, "No codec-id for pad");
|
|
|
|
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
/* if we have a best stream, should also have a buffer */
|
|
|
|
g_assert (buf);
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2015-03-03 17:40:16 +00:00
|
|
|
buffer_timestamp = gst_matroska_track_get_buffer_timestamp (best->track, buf);
|
2019-04-18 12:31:00 +00:00
|
|
|
if (buffer_timestamp >= mux->earliest_time) {
|
|
|
|
buffer_timestamp -= mux->earliest_time;
|
|
|
|
} else {
|
|
|
|
GST_ERROR_OBJECT (mux,
|
|
|
|
"PTS before first PTS (%" GST_TIME_FORMAT " < %" GST_TIME_FORMAT ")",
|
|
|
|
GST_TIME_ARGS (buffer_timestamp), GST_TIME_ARGS (mux->earliest_time));
|
|
|
|
buffer_timestamp = 0;
|
|
|
|
}
|
2015-03-03 17:40:16 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
GST_DEBUG_OBJECT (best->collect.pad, "best pad - buffer ts %"
|
|
|
|
GST_TIME_FORMAT " dur %" GST_TIME_FORMAT,
|
2015-03-03 17:40:16 +00:00
|
|
|
GST_TIME_ARGS (buffer_timestamp),
|
2011-12-15 20:50:42 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
/* make note of first and last encountered timestamps, so we can calculate
|
|
|
|
* the actual duration later when we send an updated header on eos */
|
2015-03-03 17:40:16 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (buffer_timestamp)) {
|
|
|
|
GstClockTime start_ts = buffer_timestamp;
|
2014-01-08 10:28:04 +00:00
|
|
|
GstClockTime end_ts = start_ts;
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (buf))
|
2014-01-08 10:28:04 +00:00
|
|
|
end_ts += GST_BUFFER_DURATION (buf);
|
2011-12-15 20:50:42 +00:00
|
|
|
else if (best->track->default_duration)
|
2014-01-08 10:28:04 +00:00
|
|
|
end_ts += best->track->default_duration;
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (best->end_ts) || end_ts > best->end_ts)
|
|
|
|
best->end_ts = end_ts;
|
2008-03-03 22:01:56 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
if (G_UNLIKELY (best->start_ts == GST_CLOCK_TIME_NONE ||
|
|
|
|
start_ts < best->start_ts))
|
|
|
|
best->start_ts = start_ts;
|
|
|
|
}
|
2008-01-08 19:57:23 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
/* write one buffer */
|
|
|
|
ret = gst_matroska_mux_write_data (mux, best, buf);
|
2006-01-23 10:44:03 +00:00
|
|
|
|
2011-12-15 20:50:42 +00:00
|
|
|
exit:
|
2006-01-23 10:44:03 +00:00
|
|
|
return ret;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_matroska_mux_change_state:
|
|
|
|
* @element: #GstMatroskaMux
|
|
|
|
* @transition: State change transition.
|
|
|
|
*
|
|
|
|
* Change the muxer state.
|
|
|
|
*
|
|
|
|
* Returns: #GstStateChangeReturn
|
|
|
|
*/
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_matroska_mux_change_state (GstElement * element, GstStateChange transition)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
2005-10-14 12:43:30 +00:00
|
|
|
GstStateChangeReturn ret;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
GstMatroskaMux *mux = GST_MATROSKA_MUX (element);
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
switch (transition) {
|
2005-10-14 12:43:30 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2012-04-17 13:14:27 +00:00
|
|
|
gst_collect_pads_start (mux->collect);
|
2005-10-14 12:43:30 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
2006-05-23 20:15:04 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2012-04-17 13:14:27 +00:00
|
|
|
gst_collect_pads_stop (mux->collect);
|
2006-05-23 20:15:04 +00:00
|
|
|
break;
|
2005-10-14 12:43:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
2005-09-02 15:44:50 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
gst_matroska_mux_reset (GST_ELEMENT (mux));
|
|
|
|
break;
|
2005-10-14 12:43:30 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-14 12:43:30 +00:00
|
|
|
return ret;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_mux_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
|
|
|
GstMatroskaMux *mux;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_MATROSKA_MUX (object));
|
|
|
|
mux = GST_MATROSKA_MUX (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_WRITING_APP:
|
2005-10-14 12:43:30 +00:00
|
|
|
if (!g_value_get_string (value)) {
|
|
|
|
GST_WARNING_OBJECT (mux, "writing-app property can not be NULL");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
g_free (mux->writing_app);
|
gst/matroska/ebml-write.c: Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
Original commit message from CVS:
* gst/matroska/ebml-write.c: (gst_ebml_write_float):
Use GDOUBLE_TO_BE() instead of (probably slower) custom code.
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_track_free), (gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_add_wvpk_header), (gst_matroska_decode_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop), (gst_matroska_demux_video_caps),
(gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_subtitle_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init),
(gst_matroska_mux_class_init), (gst_matroska_mux_init),
(gst_matroska_mux_create_uid), (gst_matroska_mux_reset),
(gst_matroska_mux_video_pad_setcaps),
(gst_matroska_mux_audio_pad_setcaps),
(gst_matroska_mux_subtitle_pad_setcaps),
(gst_matroska_mux_request_new_pad),
(gst_matroska_mux_track_header), (gst_matroska_mux_start),
(gst_matroska_mux_write_simple_tag), (gst_matroska_mux_finish),
(gst_matroska_mux_write_data), (gst_matroska_mux_collected),
(gst_matroska_mux_set_property):
Add many FIXMEs/TODOs all over the matroska muxer and demuxer
elements, do some checks for valid values in the demuxer, handle
tracktimecodescale in the demuxer, set correct default values for all
settings in the demuxer, review and add all missing matroska
IDs and some more raw YUV formats, and some trivial cleanup.
2008-06-10 10:44:53 +00:00
|
|
|
mux->writing_app = g_value_dup_string (value);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
break;
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_DOCTYPE_VERSION:
|
2010-05-09 10:35:10 +00:00
|
|
|
mux->doctype_version = g_value_get_int (value);
|
2005-10-28 15:32:48 +00:00
|
|
|
break;
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_MIN_INDEX_INTERVAL:
|
2009-05-27 11:51:44 +00:00
|
|
|
mux->min_index_interval = g_value_get_int64 (value);
|
|
|
|
break;
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_STREAMABLE:
|
2015-10-11 10:37:51 +00:00
|
|
|
mux->ebml_write->streamable = g_value_get_boolean (value);
|
2010-05-20 21:39:59 +00:00
|
|
|
break;
|
2016-04-08 11:05:57 +00:00
|
|
|
case PROP_TIMECODESCALE:
|
|
|
|
mux->time_scale = g_value_get_int64 (value);
|
|
|
|
break;
|
2017-07-17 22:26:11 +00:00
|
|
|
case PROP_MIN_CLUSTER_DURATION:
|
|
|
|
mux->min_cluster_duration = g_value_get_int64 (value);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_CLUSTER_DURATION:
|
|
|
|
mux->max_cluster_duration = g_value_get_int64 (value);
|
|
|
|
break;
|
2019-04-18 12:31:00 +00:00
|
|
|
case PROP_OFFSET_TO_ZERO:
|
|
|
|
mux->offset_to_zero = g_value_get_boolean (value);
|
|
|
|
break;
|
2018-05-31 08:29:43 +00:00
|
|
|
case PROP_CREATION_TIME:
|
|
|
|
g_clear_pointer (&mux->creation_time, g_date_time_unref);
|
|
|
|
mux->creation_time = g_value_dup_boxed (value);
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_mux_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
{
|
|
|
|
GstMatroskaMux *mux;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_MATROSKA_MUX (object));
|
|
|
|
mux = GST_MATROSKA_MUX (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_WRITING_APP:
|
2005-10-14 12:43:30 +00:00
|
|
|
g_value_set_string (value, mux->writing_app);
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
break;
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_DOCTYPE_VERSION:
|
2010-05-09 10:35:10 +00:00
|
|
|
g_value_set_int (value, mux->doctype_version);
|
2005-10-28 15:32:48 +00:00
|
|
|
break;
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_MIN_INDEX_INTERVAL:
|
2009-05-27 11:51:44 +00:00
|
|
|
g_value_set_int64 (value, mux->min_index_interval);
|
|
|
|
break;
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_STREAMABLE:
|
2015-10-11 10:37:51 +00:00
|
|
|
g_value_set_boolean (value, mux->ebml_write->streamable);
|
2010-05-20 21:39:59 +00:00
|
|
|
break;
|
2016-04-08 11:05:57 +00:00
|
|
|
case PROP_TIMECODESCALE:
|
|
|
|
g_value_set_int64 (value, mux->time_scale);
|
|
|
|
break;
|
2017-07-17 22:26:11 +00:00
|
|
|
case PROP_MIN_CLUSTER_DURATION:
|
|
|
|
g_value_set_int64 (value, mux->min_cluster_duration);
|
|
|
|
break;
|
|
|
|
case PROP_MAX_CLUSTER_DURATION:
|
|
|
|
g_value_set_int64 (value, mux->max_cluster_duration);
|
|
|
|
break;
|
2019-04-18 12:31:00 +00:00
|
|
|
case PROP_OFFSET_TO_ZERO:
|
|
|
|
g_value_set_boolean (value, mux->offset_to_zero);
|
|
|
|
break;
|
2018-05-31 08:29:43 +00:00
|
|
|
case PROP_CREATION_TIME:
|
|
|
|
g_value_set_boxed (value, mux->creation_time);
|
|
|
|
break;
|
Riff, EBML, fourcc etc. work. Not fully finished, but better than what we used to have and definately worth a first b...
Original commit message from CVS:
Riff, EBML, fourcc etc. work. Not fully finished, but better than
what we used to have and definately worth a first broad testing.
I've revived rifflib. Rifflib used to be a bytestream-for-riff, which
just dup'ed bytestream. I've rewritten rifflib to be a modern riff-
chunk parser that uses bytestream fully, plus adds some extra functions
so that riff file parsing becomes extremely easy. It also contains some
small usability functions for strh/strf and metadata parsing. Note that
it doesn't use the new tagging yet, that's a TODO.
Avidemux has been rewritten to use this. I think we all agreed that
avidemux was pretty much a big mess, which is because it used all
sort of bytestream magic all around the place. It was just ugly.
This is a lot nicer, very complete and safe. I think this is far more
robust than what the old avidemux could ever have been. Of course, it
might contain bugs, please let me know.
EBML writing has also been implemented. This is useful for matroska.
I'm intending to modify avidemux (with a riffwriter) similarly. Maybe
I'll change wavparse/-enc too to use rifflib.
Lastly, several plugins have been modified to use rifflib's fourcc
parsing instead of their own. this puts fourcc parsing in one central
place, which should make it a lot simpler to add new fourccs. We might
want to move this to its own lib instead of rifflib.
Enjoy!
2003-12-07 20:00:41 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|