2003-11-21 21:34:27 +00:00
|
|
|
/* GStreamer Matroska muxer/demuxer
|
|
|
|
* (c) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
2006-04-10 15:43:54 +00:00
|
|
|
* (c) 2006 Tim-Philipp Müller <tim centricular net>
|
2008-06-16 10:59:39 +00:00
|
|
|
* (c) 2008 Sebastian Dröge <slomo@circular-chaos.org>
|
2011-05-23 15:48:57 +00:00
|
|
|
* (c) 2011 Debarshi Ray <rishi@gnu.org>
|
2003-11-21 21:34:27 +00:00
|
|
|
*
|
|
|
|
* matroska-demux.c: matroska file/stream demuxer
|
|
|
|
*
|
|
|
|
* 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.
|
2003-11-21 21:34:27 +00:00
|
|
|
*/
|
|
|
|
|
2008-08-08 16:20:26 +00:00
|
|
|
/* TODO: check CRC32 if present
|
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: there can be a segment after the first segment. Handle like
|
|
|
|
* chained oggs. Fixes #334082
|
|
|
|
* TODO: Test samples: http://www.matroska.org/samples/matrix/index.html
|
|
|
|
* http://samples.mplayerhq.hu/Matroska/
|
|
|
|
* TODO: check if demuxing is done correct for all codecs according to spec
|
|
|
|
* TODO: seeking with incomplete or without CUE
|
|
|
|
*/
|
|
|
|
|
2008-12-05 09:24:18 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-matroskademux
|
|
|
|
*
|
|
|
|
* matroskademux demuxes a Matroska file into the different contained streams.
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch line</title>
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v filesrc location=/path/to/mkv ! matroskademux ! vorbisdec ! audioconvert ! audioresample ! autoaudiosink
|
2008-12-05 09:24:18 +00:00
|
|
|
* ]| This pipeline demuxes a Matroska file and outputs the contained Vorbis audio.
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
2010-04-01 13:18:43 +00:00
|
|
|
#include <glib/gprintf.h>
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2018-08-08 11:37:54 +00:00
|
|
|
#include <gst/base/base.h>
|
|
|
|
|
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
|
|
|
/* For AVI compatibility mode
|
|
|
|
and for fourcc stuff */
|
2006-04-20 09:11:22 +00:00
|
|
|
#include <gst/riff/riff-read.h>
|
2003-12-07 23:05:58 +00:00
|
|
|
#include <gst/riff/riff-ids.h>
|
|
|
|
#include <gst/riff/riff-media.h>
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2008-06-16 10:59:39 +00:00
|
|
|
#include <gst/tag/tag.h>
|
2010-04-30 15:30:31 +00:00
|
|
|
#include <gst/pbutils/pbutils.h>
|
2013-11-14 19:11:38 +00:00
|
|
|
#include <gst/video/video.h>
|
2010-04-30 15:30:31 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
#include "matroska-demux.h"
|
|
|
|
#include "matroska-ids.h"
|
|
|
|
|
2006-06-22 16:27:03 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (matroskademux_debug);
|
2004-07-18 15:58:04 +00:00
|
|
|
#define GST_CAT_DEFAULT matroskademux_debug
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
#define DEBUG_ELEMENT_START(demux, ebml, element) \
|
|
|
|
GST_DEBUG_OBJECT (demux, "Parsing " element " element at offset %" \
|
2010-05-18 12:44:15 +00:00
|
|
|
G_GUINT64_FORMAT, gst_ebml_read_get_pos (ebml))
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
#define DEBUG_ELEMENT_STOP(demux, ebml, element, ret) \
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Parsing " element " element " \
|
|
|
|
" finished with '%s'", gst_flow_get_name (ret))
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
enum
|
|
|
|
{
|
2015-04-27 10:22:11 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_METADATA,
|
|
|
|
PROP_STREAMINFO,
|
2018-08-15 11:14:24 +00:00
|
|
|
PROP_MAX_GAP_TIME,
|
|
|
|
PROP_MAX_BACKTRACK_DISTANCE
|
2003-11-21 21:34:27 +00:00
|
|
|
};
|
|
|
|
|
2018-08-15 11:14:24 +00:00
|
|
|
#define DEFAULT_MAX_GAP_TIME (2 * GST_SECOND)
|
|
|
|
#define DEFAULT_MAX_BACKTRACK_DISTANCE 30
|
|
|
|
#define INVALID_DATA_THRESHOLD (2 * 1024 * 1024)
|
2011-09-14 12:46:00 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2012-04-28 18:57:51 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-matroska; video/x-matroska; "
|
|
|
|
"video/x-matroska-3d; audio/webm; video/webm")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
2003-11-21 21:34:27 +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: fill in caps! */
|
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
static GstStaticPadTemplate audio_src_templ =
|
2011-11-04 12:12:37 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("audio_%u",
|
2006-04-10 15:43:54 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS ("ANY")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate video_src_templ =
|
2011-11-04 12:12:37 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("video_%u",
|
2006-04-10 15:43:54 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
|
|
|
GST_STATIC_CAPS ("ANY")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate subtitle_src_templ =
|
2011-11-04 12:12:37 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("subtitle_%u",
|
2006-04-10 15:43:54 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_SOMETIMES,
|
2012-09-02 01:50:50 +00:00
|
|
|
GST_STATIC_CAPS ("text/x-raw, format=pango-markup; application/x-ssa; "
|
2012-08-20 22:30:38 +00:00
|
|
|
"application/x-ass;application/x-usf; subpicture/x-dvd; "
|
2009-08-09 07:43:29 +00:00
|
|
|
"subpicture/x-pgs; subtitle/x-kate; " "application/x-subtitle-unknown")
|
2006-04-10 15:43:54 +00:00
|
|
|
);
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
static GstFlowReturn gst_matroska_demux_parse_id (GstMatroskaDemux * demux,
|
|
|
|
guint32 id, guint64 length, guint needed);
|
2008-06-13 19:07:03 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* element functions */
|
2005-10-18 18:12:31 +00:00
|
|
|
static void gst_matroska_demux_loop (GstPad * pad);
|
|
|
|
|
|
|
|
static gboolean gst_matroska_demux_element_send_event (GstElement * element,
|
2004-03-14 22:34:33 +00:00
|
|
|
GstEvent * event);
|
2008-07-02 09:51:16 +00:00
|
|
|
static gboolean gst_matroska_demux_element_query (GstElement * element,
|
|
|
|
GstQuery * query);
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* pad functions */
|
2011-11-26 09:01:07 +00:00
|
|
|
static gboolean gst_matroska_demux_sink_activate (GstPad * sinkpad,
|
|
|
|
GstObject * parent);
|
|
|
|
static gboolean gst_matroska_demux_sink_activate_mode (GstPad * sinkpad,
|
|
|
|
GstObject * parent, GstPadMode mode, gboolean active);
|
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
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
static gboolean gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
|
2008-08-02 18:35:21 +00:00
|
|
|
GstPad * pad, GstEvent * event);
|
2004-03-14 22:34:33 +00:00
|
|
|
static gboolean gst_matroska_demux_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 gboolean gst_matroska_demux_handle_src_query (GstPad * pad,
|
2011-11-26 09:01:07 +00:00
|
|
|
GstObject * parent, GstQuery * query);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2009-12-16 11:43:27 +00:00
|
|
|
static gboolean gst_matroska_demux_handle_sink_event (GstPad * pad,
|
2011-11-26 09:01:07 +00:00
|
|
|
GstObject * parent, GstEvent * event);
|
2018-05-17 11:58:25 +00:00
|
|
|
static gboolean gst_matroska_demux_handle_sink_query (GstPad * pad,
|
|
|
|
GstObject * parent, GstQuery * query);
|
2009-12-16 11:43:27 +00:00
|
|
|
static GstFlowReturn gst_matroska_demux_chain (GstPad * pad,
|
2011-11-26 09:01:07 +00:00
|
|
|
GstObject * object, GstBuffer * buffer);
|
2009-12-16 11:43:27 +00:00
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_matroska_demux_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2011-12-30 17:41:46 +00:00
|
|
|
#if 0
|
2009-05-14 12:46:14 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_set_index (GstElement * element, GstIndex * index);
|
|
|
|
static GstIndex *gst_matroska_demux_get_index (GstElement * element);
|
2011-12-30 17:41:46 +00:00
|
|
|
#endif
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
/* caps functions */
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps *gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext
|
2010-06-30 23:22:07 +00:00
|
|
|
* videocontext, const gchar * codec_id, guint8 * data, guint size,
|
|
|
|
gchar ** codec_name, guint32 * riff_fourcc);
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps *gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext
|
2010-06-30 23:22:07 +00:00
|
|
|
* audiocontext, const gchar * codec_id, guint8 * data, guint size,
|
|
|
|
gchar ** codec_name, guint16 * riff_audio_fmt);
|
2004-03-14 22:34:33 +00:00
|
|
|
static GstCaps
|
|
|
|
* gst_matroska_demux_subtitle_caps (GstMatroskaTrackSubtitleContext *
|
|
|
|
subtitlecontext, const gchar * codec_id, gpointer data, guint size);
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
static const gchar *gst_matroska_track_encryption_algorithm_name (gint val);
|
|
|
|
static const gchar *gst_matroska_track_encryption_cipher_mode_name (gint val);
|
|
|
|
static const gchar *gst_matroska_track_encoding_scope_name (gint val);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
/* stream methods */
|
2004-03-14 22:34:33 +00:00
|
|
|
static void gst_matroska_demux_reset (GstElement * element);
|
2010-04-14 09:53:46 +00:00
|
|
|
static gboolean perform_seek_to_offset (GstMatroskaDemux * demux,
|
2016-05-04 12:50:32 +00:00
|
|
|
gdouble rate, guint64 offset, guint32 seqnum, GstSeekFlags flags);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-09-14 12:46:00 +00:00
|
|
|
/* gobject functions */
|
|
|
|
static void gst_matroska_demux_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_matroska_demux_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2010-03-17 17:23:00 +00:00
|
|
|
GType gst_matroska_demux_get_type (void);
|
2011-11-26 09:01:07 +00:00
|
|
|
#define parent_class gst_matroska_demux_parent_class
|
|
|
|
G_DEFINE_TYPE (GstMatroskaDemux, gst_matroska_demux, GST_TYPE_ELEMENT);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
gst/matroska/matroska-demux.*: Allow an infinite number of stream inside Matroska containers and use a GPtrArray for ...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_finalize),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
Allow an infinite number of stream inside Matroska containers and use
a GPtrArray for storing them instead of allowing "only" 127 streams.
2008-08-02 18:06:20 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (object);
|
|
|
|
|
2014-01-20 20:31:14 +00:00
|
|
|
gst_matroska_read_common_finalize (&demux->common);
|
2014-05-26 16:21:25 +00:00
|
|
|
gst_flow_combiner_free (demux->flowcombiner);
|
gst/matroska/matroska-demux.*: Allow an infinite number of stream inside Matroska containers and use a GPtrArray for ...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_finalize),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
Allow an infinite number of stream inside Matroska containers and use
a GPtrArray for storing them instead of allowing "only" 127 streams.
2008-08-02 18:06:20 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_demux_class_init (GstMatroskaDemuxClass * klass)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
gst/matroska/matroska-demux.*: Allow an infinite number of stream inside Matroska containers and use a GPtrArray for ...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_finalize),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
Allow an infinite number of stream inside Matroska containers and use
a GPtrArray for storing them instead of allowing "only" 127 streams.
2008-08-02 18:06:20 +00:00
|
|
|
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
|
|
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
2003-11-21 21:34:27 +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
|
|
|
GST_DEBUG_CATEGORY_INIT (matroskademux_debug, "matroskademux", 0,
|
|
|
|
"Matroska demuxer");
|
2004-07-18 15:58:04 +00:00
|
|
|
|
gst/matroska/matroska-demux.*: Allow an infinite number of stream inside Matroska containers and use a GPtrArray for ...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_finalize),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
Allow an infinite number of stream inside Matroska containers and use
a GPtrArray for storing them instead of allowing "only" 127 streams.
2008-08-02 18:06:20 +00:00
|
|
|
gobject_class->finalize = gst_matroska_demux_finalize;
|
|
|
|
|
2011-09-14 12:46:00 +00:00
|
|
|
gobject_class->get_property = gst_matroska_demux_get_property;
|
|
|
|
gobject_class->set_property = gst_matroska_demux_set_property;
|
|
|
|
|
2015-04-27 10:22:11 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_GAP_TIME,
|
2011-09-14 12:46:00 +00:00
|
|
|
g_param_spec_uint64 ("max-gap-time", "Maximum gap time",
|
2011-11-26 09:01:07 +00:00
|
|
|
"The demuxer sends out segment events for skipping "
|
2011-09-14 12:46:00 +00:00
|
|
|
"gaps longer than this (0 = disabled).", 0, G_MAXUINT64,
|
|
|
|
DEFAULT_MAX_GAP_TIME, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2018-08-15 11:14:24 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MAX_BACKTRACK_DISTANCE,
|
|
|
|
g_param_spec_uint ("max-backtrack-distance",
|
|
|
|
"Maximum backtrack distance",
|
|
|
|
"Maximum backtrack distance in seconds when seeking without "
|
|
|
|
"and index in pull mode and search for a keyframe "
|
|
|
|
"(0 = disable backtracking).",
|
|
|
|
0, G_MAXUINT, DEFAULT_MAX_BACKTRACK_DISTANCE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_change_state);
|
|
|
|
gstelement_class->send_event =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_element_send_event);
|
2008-07-02 09:51:16 +00:00
|
|
|
gstelement_class->query =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_element_query);
|
2011-12-30 17:41:46 +00:00
|
|
|
#if 0
|
2009-05-14 12:46:14 +00:00
|
|
|
gstelement_class->set_index =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_set_index);
|
|
|
|
gstelement_class->get_index =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_get_index);
|
2011-12-30 17:41:46 +00:00
|
|
|
#endif
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2016-03-04 01:30:12 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&video_src_templ);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&audio_src_templ);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class,
|
|
|
|
&subtitle_src_templ);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &sink_templ);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Matroska demuxer",
|
2011-11-26 09:01:07 +00:00
|
|
|
"Codec/Demuxer",
|
|
|
|
"Demuxes Matroska/WebM streams into video/audio/subtitles",
|
2015-07-16 16:19:03 +00:00
|
|
|
"GStreamer maintainers <gstreamer-devel@lists.freedesktop.org>");
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_demux_init (GstMatroskaDemux * demux)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.sinkpad = gst_pad_new_from_static_template (&sink_templ,
|
|
|
|
"sink");
|
|
|
|
gst_pad_set_activate_function (demux->common.sinkpad,
|
2005-10-18 18:12:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_sink_activate));
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_pad_set_activatemode_function (demux->common.sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_sink_activate_mode));
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_pad_set_chain_function (demux->common.sinkpad,
|
2009-12-16 11:43:27 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_chain));
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_pad_set_event_function (demux->common.sinkpad,
|
2009-12-16 11:43:27 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_handle_sink_event));
|
2018-05-17 11:58:25 +00:00
|
|
|
gst_pad_set_query_function (demux->common.sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_handle_sink_query));
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (demux), demux->common.sinkpad);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2014-01-20 20:31:14 +00:00
|
|
|
/* init defaults for common read context */
|
|
|
|
gst_matroska_read_common_init (&demux->common);
|
2009-12-16 11:43:27 +00:00
|
|
|
|
2011-09-14 12:46:00 +00:00
|
|
|
/* property defaults */
|
|
|
|
demux->max_gap_time = DEFAULT_MAX_GAP_TIME;
|
2018-08-15 11:14:24 +00:00
|
|
|
demux->max_backtrack_distance = DEFAULT_MAX_BACKTRACK_DISTANCE;
|
2011-09-14 12:46:00 +00:00
|
|
|
|
2011-11-28 17:25:52 +00:00
|
|
|
GST_OBJECT_FLAG_SET (demux, GST_ELEMENT_FLAG_INDEXABLE);
|
|
|
|
|
2014-09-25 13:01:14 +00:00
|
|
|
demux->flowcombiner = gst_flow_combiner_new ();
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* finish off */
|
|
|
|
gst_matroska_demux_reset (GST_ELEMENT (demux));
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_demux_reset (GstElement * element)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Resetting state");
|
|
|
|
|
2014-01-20 20:31:14 +00:00
|
|
|
gst_matroska_read_common_reset (GST_ELEMENT (demux), &demux->common);
|
gst/matroska/matroska-demux.*: Allow an infinite number of stream inside Matroska containers and use a GPtrArray for ...
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_finalize),
(gst_matroska_demux_class_init), (gst_matroska_demux_init),
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
Allow an infinite number of stream inside Matroska containers and use
a GPtrArray for storing them instead of allowing "only" 127 streams.
2008-08-02 18:06:20 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
demux->num_a_streams = 0;
|
|
|
|
demux->num_t_streams = 0;
|
|
|
|
demux->num_v_streams = 0;
|
2018-08-15 10:25:21 +00:00
|
|
|
demux->have_nonintraonly_v_streams = FALSE;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2013-07-22 13:22:55 +00:00
|
|
|
demux->have_group_id = FALSE;
|
|
|
|
demux->group_id = G_MAXUINT;
|
|
|
|
|
2014-01-20 20:31:14 +00:00
|
|
|
demux->clock = NULL;
|
|
|
|
demux->tracks_parsed = FALSE;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-02-10 10:56:33 +00:00
|
|
|
if (demux->clusters) {
|
|
|
|
g_array_free (demux->clusters, TRUE);
|
|
|
|
demux->clusters = NULL;
|
|
|
|
}
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
g_list_foreach (demux->seek_parsed,
|
2014-01-20 20:31:14 +00:00
|
|
|
(GFunc) gst_matroska_read_common_free_parsed_el, NULL);
|
2010-05-18 12:44:15 +00:00
|
|
|
g_list_free (demux->seek_parsed);
|
|
|
|
demux->seek_parsed = NULL;
|
|
|
|
|
2009-12-09 19:42:44 +00:00
|
|
|
demux->last_stop_end = GST_CLOCK_TIME_NONE;
|
2009-12-16 11:48:02 +00:00
|
|
|
demux->seek_block = 0;
|
2011-09-21 17:45:42 +00:00
|
|
|
demux->stream_start_time = GST_CLOCK_TIME_NONE;
|
2012-07-20 09:07:58 +00:00
|
|
|
demux->to_time = GST_CLOCK_TIME_NONE;
|
2009-12-16 11:43:27 +00:00
|
|
|
demux->cluster_time = GST_CLOCK_TIME_NONE;
|
|
|
|
demux->cluster_offset = 0;
|
2017-01-18 10:27:38 +00:00
|
|
|
demux->cluster_prevsize = 0;
|
|
|
|
demux->seen_cluster_prevsize = FALSE;
|
2010-07-26 13:51:49 +00:00
|
|
|
demux->next_cluster_offset = 0;
|
2017-06-10 13:14:41 +00:00
|
|
|
demux->stream_last_time = GST_CLOCK_TIME_NONE;
|
|
|
|
demux->last_cluster_offset = 0;
|
2010-04-14 09:53:46 +00:00
|
|
|
demux->index_offset = 0;
|
|
|
|
demux->seekable = FALSE;
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->need_segment = FALSE;
|
2013-07-25 04:39:58 +00:00
|
|
|
demux->segment_seqnum = 0;
|
2012-07-24 19:11:18 +00:00
|
|
|
demux->requested_seek_time = GST_CLOCK_TIME_NONE;
|
|
|
|
demux->seek_offset = -1;
|
2010-04-14 09:53:46 +00:00
|
|
|
demux->building_index = FALSE;
|
|
|
|
if (demux->seek_event) {
|
|
|
|
gst_event_unref (demux->seek_event);
|
|
|
|
demux->seek_event = NULL;
|
|
|
|
}
|
2009-12-16 11:43:27 +00:00
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
demux->seek_index = NULL;
|
|
|
|
demux->seek_entry = 0;
|
|
|
|
|
2008-08-08 16:20:26 +00:00
|
|
|
if (demux->new_segment) {
|
|
|
|
gst_event_unref (demux->new_segment);
|
|
|
|
demux->new_segment = NULL;
|
|
|
|
}
|
2012-03-29 19:12:13 +00:00
|
|
|
|
2011-12-21 16:43:10 +00:00
|
|
|
demux->invalid_duration = FALSE;
|
2014-09-25 13:01:14 +00:00
|
|
|
|
2014-12-19 09:57:29 +00:00
|
|
|
demux->cached_length = G_MAXUINT64;
|
|
|
|
|
2018-11-14 07:57:55 +00:00
|
|
|
if (demux->deferred_seek_event)
|
|
|
|
gst_event_unref (demux->deferred_seek_event);
|
|
|
|
demux->deferred_seek_event = NULL;
|
|
|
|
demux->deferred_seek_pad = NULL;
|
|
|
|
|
2014-09-25 13:01:14 +00:00
|
|
|
gst_flow_combiner_clear (demux->flowcombiner);
|
2010-05-18 12:44:15 +00:00
|
|
|
}
|
|
|
|
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_matroska_decode_buffer (GstMatroskaTrackContext * context, GstBuffer * buf)
|
|
|
|
{
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
gpointer data;
|
|
|
|
gsize size;
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
GstBuffer *out_buf = buf;
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_IS_BUFFER (buf), NULL);
|
|
|
|
|
2009-06-23 10:42:33 +00:00
|
|
|
GST_DEBUG ("decoding buffer %p", buf);
|
|
|
|
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
gst_buffer_map (out_buf, &map, GST_MAP_READ);
|
2012-01-23 16:25:37 +00:00
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
g_return_val_if_fail (size > 0, buf);
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
|
|
|
|
if (gst_matroska_decode_data (context->encodings, &data, &size,
|
|
|
|
GST_MATROSKA_TRACK_ENCODING_SCOPE_FRAME, FALSE)) {
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
if (data != map.data) {
|
2018-10-03 15:34:49 +00:00
|
|
|
gst_buffer_unmap (out_buf, &map);
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
gst_buffer_unref (out_buf);
|
|
|
|
out_buf = gst_buffer_new_wrapped (data, size);
|
2018-10-03 15:34:49 +00:00
|
|
|
} else {
|
|
|
|
gst_buffer_unmap (out_buf, &map);
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
}
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
} else {
|
2009-06-23 10:42:33 +00:00
|
|
|
GST_DEBUG ("decode data failed");
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
gst_buffer_unmap (out_buf, &map);
|
|
|
|
gst_buffer_unref (out_buf);
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
/* Encrypted stream */
|
|
|
|
if (context->protection_info) {
|
|
|
|
|
|
|
|
GstStructure *info_protect = gst_structure_copy (context->protection_info);
|
|
|
|
gboolean encrypted = FALSE;
|
|
|
|
|
|
|
|
gst_buffer_map (out_buf, &map, GST_MAP_READ);
|
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
|
|
|
|
|
|
|
if (gst_matroska_parse_protection_meta (&data, &size, info_protect,
|
|
|
|
&encrypted)) {
|
|
|
|
if (data != map.data) {
|
2018-10-03 15:34:49 +00:00
|
|
|
GstBuffer *tmp_buf;
|
|
|
|
|
|
|
|
gst_buffer_unmap (out_buf, &map);
|
|
|
|
tmp_buf = out_buf;
|
|
|
|
out_buf = gst_buffer_copy_region (tmp_buf, GST_BUFFER_COPY_ALL,
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
gst_buffer_get_size (tmp_buf) - size, size);
|
|
|
|
gst_buffer_unref (tmp_buf);
|
|
|
|
if (encrypted)
|
|
|
|
gst_buffer_add_protection_meta (out_buf, info_protect);
|
|
|
|
else
|
|
|
|
gst_structure_free (info_protect);
|
|
|
|
} else {
|
2018-10-03 15:34:49 +00:00
|
|
|
gst_buffer_unmap (out_buf, &map);
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
gst_structure_free (info_protect);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("Adding protection metadata failed");
|
|
|
|
gst_buffer_unmap (out_buf, &map);
|
|
|
|
gst_buffer_unref (out_buf);
|
|
|
|
gst_structure_free (info_protect);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return out_buf;
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_add_stream_headers_to_caps (GstMatroskaDemux * demux,
|
|
|
|
GstBufferList * list, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstStructure *s;
|
|
|
|
GValue arr_val = G_VALUE_INIT;
|
|
|
|
GValue buf_val = G_VALUE_INIT;
|
|
|
|
gint i, num;
|
|
|
|
|
|
|
|
g_assert (gst_caps_is_writable (caps));
|
|
|
|
|
|
|
|
g_value_init (&arr_val, GST_TYPE_ARRAY);
|
|
|
|
g_value_init (&buf_val, GST_TYPE_BUFFER);
|
|
|
|
|
|
|
|
num = gst_buffer_list_length (list);
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
g_value_set_boxed (&buf_val, gst_buffer_list_get (list, i));
|
|
|
|
gst_value_array_append_value (&arr_val, &buf_val);
|
|
|
|
}
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
gst_structure_take_value (s, "streamheader", &arr_val);
|
|
|
|
g_value_unset (&buf_val);
|
|
|
|
}
|
|
|
|
|
2017-11-07 09:03:53 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_parse_colour (GstMatroskaDemux * demux, GstEbmlRead * ebml,
|
|
|
|
GstMatroskaTrackVideoContext * video_context)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
|
|
|
GstVideoColorimetry colorimetry;
|
|
|
|
guint32 id;
|
|
|
|
guint64 num;
|
|
|
|
|
|
|
|
colorimetry.range = GST_VIDEO_COLOR_RANGE_UNKNOWN;
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN;
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_UNKNOWN;
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_UNKNOWN;
|
|
|
|
|
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "TrackVideoColour");
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
case GST_MATROSKA_ID_VIDEOMATRIXCOEFFICIENTS:{
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
case 0:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_RGB;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT709;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_UNKNOWN;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_FCC;
|
|
|
|
break;
|
|
|
|
/* FIXME: "5: BT470BG" is undefined in GstVideoColorMatrix
|
|
|
|
* but it's functionally same as "6: BT601" */
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT601;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_SMPTE240M;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
colorimetry.matrix = GST_VIDEO_COLOR_MATRIX_BT2020;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_FIXME_OBJECT (demux, "Unsupported color matrix coefficients %"
|
|
|
|
G_GUINT64_FORMAT, num);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case GST_MATROSKA_ID_VIDEORANGE:{
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
case 0:
|
|
|
|
colorimetry.range = GST_VIDEO_COLOR_RANGE_UNKNOWN;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
colorimetry.range = GST_VIDEO_COLOR_RANGE_16_235;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_FIXME_OBJECT (demux, "Unsupported color range %"
|
|
|
|
G_GUINT64_FORMAT, num);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case GST_MATROSKA_ID_VIDEOTRANSFERCHARACTERISTICS:{
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
/* FIXME: "6: BT601" and "14: BT2020_10" are undefined in
|
|
|
|
* GstVideoTransferFunction, but functionally same as "1: BT709" */
|
|
|
|
case 1:
|
|
|
|
case 6:
|
|
|
|
case 14:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_UNKNOWN;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA22;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA28;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_SMPTE240M;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_GAMMA10;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_LOG100;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_LOG316;
|
|
|
|
break;
|
|
|
|
case 13:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_SRGB;
|
|
|
|
break;
|
|
|
|
case 15:
|
|
|
|
colorimetry.transfer = GST_VIDEO_TRANSFER_BT2020_12;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_FIXME_OBJECT (demux,
|
|
|
|
"Unsupported color transfer characteristics %"
|
|
|
|
G_GUINT64_FORMAT, num);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case GST_MATROSKA_ID_VIDEOPRIMARIES:{
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
goto beach;
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
case 1:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT709;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_UNKNOWN;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT470M;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT470BG;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE170M;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_SMPTE240M;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_FILM;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
colorimetry.primaries = GST_VIDEO_COLOR_PRIMARIES_BT2020;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_FIXME_OBJECT (demux, "Unsupported color primaries %"
|
|
|
|
G_GUINT64_FORMAT, num);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
GST_FIXME_OBJECT (demux, "Unsupported subelement 0x%x in Colour", id);
|
|
|
|
ret = gst_ebml_read_skip (ebml);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy (&video_context->colorimetry, &colorimetry,
|
|
|
|
sizeof (GstVideoColorimetry));
|
|
|
|
|
|
|
|
beach:
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "TrackVideoColour", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2018-09-21 14:23:57 +00:00
|
|
|
gst_matroska_demux_parse_stream (GstMatroskaDemux * demux, GstEbmlRead * ebml,
|
|
|
|
GstMatroskaTrackContext ** dest_context)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
|
|
|
GstMatroskaTrackContext *context;
|
|
|
|
GstCaps *caps = NULL;
|
2015-07-30 00:54:35 +00:00
|
|
|
GstTagList *cached_taglist;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret;
|
2010-06-30 23:22:07 +00:00
|
|
|
guint32 id, riff_fourcc = 0;
|
|
|
|
guint16 riff_audio_fmt = 0;
|
2005-10-18 18:12:31 +00:00
|
|
|
gchar *codec = NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "TrackEntry");
|
|
|
|
|
|
|
|
/* start with the master */
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "TrackEntry", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* allocate generic... if we know the type, we'll g_renew()
|
|
|
|
* with the precise type */
|
|
|
|
context = g_new0 (GstMatroskaTrackContext, 1);
|
2009-05-14 12:46:14 +00:00
|
|
|
context->index_writer_id = -1;
|
2004-03-15 19:32:27 +00:00
|
|
|
context->type = 0; /* no type yet */
|
2004-08-25 14:41:12 +00:00
|
|
|
context->default_duration = 0;
|
2010-01-28 17:49:57 +00:00
|
|
|
context->pos = 0;
|
2006-04-20 13:23:40 +00:00
|
|
|
context->set_discont = TRUE;
|
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
|
|
|
context->timecodescale = 1.0;
|
|
|
|
context->flags =
|
|
|
|
GST_MATROSKA_TRACK_ENABLED | GST_MATROSKA_TRACK_DEFAULT |
|
|
|
|
GST_MATROSKA_TRACK_LACING;
|
2012-07-20 13:18:21 +00:00
|
|
|
context->from_time = GST_CLOCK_TIME_NONE;
|
|
|
|
context->from_offset = -1;
|
2010-05-28 14:37:32 +00:00
|
|
|
context->to_offset = G_MAXINT64;
|
2011-09-27 14:59:24 +00:00
|
|
|
context->alignment = 1;
|
2015-02-26 22:41:47 +00:00
|
|
|
context->dts_only = FALSE;
|
2015-03-11 20:25:40 +00:00
|
|
|
context->intra_only = FALSE;
|
2015-03-27 21:58:31 +00:00
|
|
|
context->tags = gst_tag_list_new_empty ();
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
g_queue_init (&context->protection_event_queue);
|
|
|
|
context->protection_info = NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2018-09-21 14:23:57 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Parsing a TrackEntry (%d tracks parsed so far)",
|
|
|
|
demux->common.num_streams);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
/* try reading the trackentry headers */
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
switch (id) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* track number (unique stream ID) */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKNUMBER:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +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
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_ERROR_OBJECT (demux, "Invalid TrackNumber 0");
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
break;
|
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/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackNumber: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
context->num = num;
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
/* track UID (unique identifier) */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKUID:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +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
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_ERROR_OBJECT (demux, "Invalid TrackUID 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
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackUID: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
context->uid = num;
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* track type (video, audio, combined, subtitle, etc.) */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKTYPE:{
|
2006-04-25 16:38:50 +00:00
|
|
|
guint64 track_type;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &track_type)) != GST_FLOW_OK) {
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-04-25 16:38:50 +00:00
|
|
|
|
|
|
|
if (context->type != 0 && context->type != track_type) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"More than one tracktype defined in a TrackEntry - skipping");
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
} else if (track_type < 1 || track_type > 254) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackType %" G_GUINT64_FORMAT,
|
|
|
|
track_type);
|
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
|
|
|
break;
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackType: %" G_GUINT64_FORMAT, track_type);
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* ok, so we're actually going to reallocate this thing */
|
2006-04-25 16:38:50 +00:00
|
|
|
switch (track_type) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:
|
2006-04-25 16:38:50 +00:00
|
|
|
gst_matroska_track_init_video_context (&context);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_AUDIO:
|
2006-04-25 16:38:50 +00:00
|
|
|
gst_matroska_track_init_audio_context (&context);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:
|
2006-04-25 16:38:50 +00:00
|
|
|
gst_matroska_track_init_subtitle_context (&context);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
case GST_MATROSKA_TRACK_TYPE_COMPLEX:
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_LOGO:
|
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
|
|
|
case GST_MATROSKA_TRACK_TYPE_BUTTONS:
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_CONTROL:
|
|
|
|
default:
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Unknown or unsupported TrackType %" G_GUINT64_FORMAT,
|
|
|
|
track_type);
|
2004-03-15 19:32:27 +00:00
|
|
|
context->type = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* tracktype specific stuff for video */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKVIDEO:{
|
2004-03-15 19:32:27 +00:00
|
|
|
GstMatroskaTrackVideoContext *videocontext;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "TrackVideo");
|
|
|
|
|
2006-04-25 16:38:50 +00:00
|
|
|
if (!gst_matroska_track_init_video_context (&context)) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"TrackVideo element in non-video track - ignoring track");
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
} else if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
videocontext = (GstMatroskaTrackVideoContext *) context;
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK &&
|
|
|
|
gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
switch (id) {
|
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
|
|
|
/* Should be one level up but some broken muxers write it here. */
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackDefaultDuration 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackDefaultDuration: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
context->default_duration = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* video framerate */
|
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
|
|
|
/* NOTE: This one is here only for backward compatibility.
|
|
|
|
* Use _TRACKDEFAULDURATION one level up. */
|
2004-03-15 19:32:27 +00:00
|
|
|
case GST_MATROSKA_ID_VIDEOFRAMERATE:{
|
|
|
|
gdouble num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_float (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num <= 0.0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackVideoFPS %lf", num);
|
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
|
|
|
break;
|
2008-03-03 22:01:56 +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
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackVideoFrameRate: %lf", num);
|
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
|
|
|
if (context->default_duration == 0)
|
|
|
|
context->default_duration =
|
|
|
|
gst_gdouble_to_guint64 ((gdouble) GST_SECOND * (1.0 / num));
|
|
|
|
videocontext->default_fps = num;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* width of the size to display the video at */
|
|
|
|
case GST_MATROSKA_ID_VIDEODISPLAYWIDTH:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackVideoDisplayWidth 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackVideoDisplayWidth: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->display_width = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* height of the size to display the video at */
|
|
|
|
case GST_MATROSKA_ID_VIDEODISPLAYHEIGHT:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackVideoDisplayHeight 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackVideoDisplayHeight: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->display_height = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* width of the video in the file */
|
|
|
|
case GST_MATROSKA_ID_VIDEOPIXELWIDTH:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackVideoPixelWidth 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackVideoPixelWidth: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->pixel_width = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* height of the video in the file */
|
|
|
|
case GST_MATROSKA_ID_VIDEOPIXELHEIGHT:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackVideoPixelHeight 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackVideoPixelHeight: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->pixel_height = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* whether the video is interlaced */
|
|
|
|
case GST_MATROSKA_ID_VIDEOFLAGINTERLACED:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2018-08-23 20:57:35 +00:00
|
|
|
if (num == 1)
|
|
|
|
videocontext->interlace_mode =
|
|
|
|
GST_MATROSKA_INTERLACE_MODE_INTERLACED;
|
|
|
|
else if (num == 2)
|
|
|
|
videocontext->interlace_mode =
|
|
|
|
GST_MATROSKA_INTERLACE_MODE_PROGRESSIVE;
|
2004-03-15 19:32:27 +00:00
|
|
|
else
|
2018-08-23 20:57:35 +00:00
|
|
|
videocontext->interlace_mode =
|
|
|
|
GST_MATROSKA_INTERLACE_MODE_UNKNOWN;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "video track interlacing mode: %d",
|
|
|
|
videocontext->interlace_mode);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* aspect ratio behaviour */
|
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
|
|
|
case GST_MATROSKA_ID_VIDEOASPECTRATIOTYPE:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (num != GST_MATROSKA_ASPECT_RATIO_MODE_FREE &&
|
|
|
|
num != GST_MATROSKA_ASPECT_RATIO_MODE_KEEP &&
|
|
|
|
num != GST_MATROSKA_ASPECT_RATIO_MODE_FIXED) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Unknown TrackVideoAspectRatioType 0x%x", (guint) num);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackVideoAspectRatioType: %" G_GUINT64_FORMAT, num);
|
2004-03-15 19:32:27 +00:00
|
|
|
videocontext->asr_mode = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* colourspace (only matters for raw video) fourcc */
|
|
|
|
case GST_MATROSKA_ID_VIDEOCOLOURSPACE:{
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint64 datalen;
|
|
|
|
|
|
|
|
if ((ret =
|
|
|
|
gst_ebml_read_binary (ebml, &id, &data,
|
|
|
|
&datalen)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if (datalen != 4) {
|
2009-03-31 08:57:36 +00:00
|
|
|
g_free (data);
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Invalid TrackVideoColourSpace length %" G_GUINT64_FORMAT,
|
|
|
|
datalen);
|
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
|
|
|
break;
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
memcpy (&videocontext->fourcc, data, 4);
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"TrackVideoColourSpace: %" GST_FOURCC_FORMAT,
|
|
|
|
GST_FOURCC_ARGS (videocontext->fourcc));
|
2009-03-31 08:57:36 +00:00
|
|
|
g_free (data);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-11-07 09:03:53 +00:00
|
|
|
|
|
|
|
/* color info */
|
|
|
|
case GST_MATROSKA_ID_VIDEOCOLOUR:{
|
|
|
|
ret = gst_matroska_demux_parse_colour (demux, ebml, videocontext);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-06-10 14:22:54 +00:00
|
|
|
case GST_MATROSKA_ID_VIDEOSTEREOMODE:
|
|
|
|
{
|
|
|
|
guint64 num;
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "StereoMode: %" G_GUINT64_FORMAT, num);
|
|
|
|
|
|
|
|
switch (num) {
|
|
|
|
case GST_MATROSKA_STEREO_MODE_SBS_RL:
|
|
|
|
videocontext->multiview_flags =
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST;
|
|
|
|
/* fall through */
|
|
|
|
case GST_MATROSKA_STEREO_MODE_SBS_LR:
|
|
|
|
videocontext->multiview_mode =
|
|
|
|
GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE;
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_STEREO_MODE_TB_RL:
|
|
|
|
videocontext->multiview_flags =
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST;
|
|
|
|
/* fall through */
|
|
|
|
case GST_MATROSKA_STEREO_MODE_TB_LR:
|
|
|
|
videocontext->multiview_mode =
|
|
|
|
GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM;
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_STEREO_MODE_CHECKER_RL:
|
|
|
|
videocontext->multiview_flags =
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST;
|
|
|
|
/* fall through */
|
|
|
|
case GST_MATROSKA_STEREO_MODE_CHECKER_LR:
|
|
|
|
videocontext->multiview_mode =
|
|
|
|
GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD;
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_STEREO_MODE_FBF_RL:
|
|
|
|
videocontext->multiview_flags =
|
|
|
|
GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST;
|
|
|
|
/* fall through */
|
|
|
|
case GST_MATROSKA_STEREO_MODE_FBF_LR:
|
|
|
|
videocontext->multiview_mode =
|
|
|
|
GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME;
|
|
|
|
/* FIXME: In frame-by-frame mode, left/right frame buffers are
|
|
|
|
* laced within one block, and we'll need to apply FIRST_IN_BUNDLE
|
|
|
|
* accordingly. See http://www.matroska.org/technical/specs/index.html#StereoMode */
|
|
|
|
GST_FIXME_OBJECT (demux,
|
|
|
|
"Frame-by-frame stereoscopic mode not fully implemented");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Unknown TrackVideo subelement 0x%x - ignoring", id);
|
|
|
|
/* fall through */
|
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
|
|
|
case GST_MATROSKA_ID_VIDEODISPLAYUNIT:
|
|
|
|
case GST_MATROSKA_ID_VIDEOPIXELCROPBOTTOM:
|
|
|
|
case GST_MATROSKA_ID_VIDEOPIXELCROPTOP:
|
|
|
|
case GST_MATROSKA_ID_VIDEOPIXELCROPLEFT:
|
|
|
|
case GST_MATROSKA_ID_VIDEOPIXELCROPRIGHT:
|
|
|
|
case GST_MATROSKA_ID_VIDEOGAMMAVALUE:
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = gst_ebml_read_skip (ebml);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "TrackVideo", ret);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* tracktype specific stuff for audio */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKAUDIO:{
|
2004-03-15 19:32:27 +00:00
|
|
|
GstMatroskaTrackAudioContext *audiocontext;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "TrackAudio");
|
|
|
|
|
2006-04-25 16:38:50 +00:00
|
|
|
if (!gst_matroska_track_init_audio_context (&context)) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"TrackAudio element in non-audio track - ignoring track");
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
audiocontext = (GstMatroskaTrackAudioContext *) context;
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK &&
|
|
|
|
gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
/* samplerate */
|
|
|
|
case GST_MATROSKA_ID_AUDIOSAMPLINGFREQ:{
|
|
|
|
gdouble num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_float (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +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
|
|
|
|
|
|
|
if (num <= 0.0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Invalid TrackAudioSamplingFrequency %lf", num);
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackAudioSamplingFrequency: %lf", num);
|
2004-03-15 19:32:27 +00:00
|
|
|
audiocontext->samplerate = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bitdepth */
|
|
|
|
case GST_MATROSKA_ID_AUDIOBITDEPTH:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackAudioBitDepth 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackAudioBitDepth: %" G_GUINT64_FORMAT,
|
|
|
|
num);
|
2004-03-15 19:32:27 +00:00
|
|
|
audiocontext->bitdepth = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* channels */
|
|
|
|
case GST_MATROSKA_ID_AUDIOCHANNELS:{
|
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackAudioChannels 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackAudioChannels: %" G_GUINT64_FORMAT,
|
|
|
|
num);
|
2004-03-15 19:32:27 +00:00
|
|
|
audiocontext->channels = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Unknown TrackAudio subelement 0x%x - ignoring", id);
|
|
|
|
/* fall through */
|
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
|
|
|
case GST_MATROSKA_ID_AUDIOCHANNELPOSITIONS:
|
|
|
|
case GST_MATROSKA_ID_AUDIOOUTPUTSAMPLINGFREQ:
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = gst_ebml_read_skip (ebml);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "TrackAudio", ret);
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* codec identifier */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_CODECID:{
|
2004-03-15 19:32:27 +00:00
|
|
|
gchar *text;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_ascii (ebml, &id, &text)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "CodecID: %s", GST_STR_NULL (text));
|
2004-03-15 19:32:27 +00:00
|
|
|
context->codec_id = text;
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* codec private data */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_CODECPRIVATE:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint8 *data;
|
|
|
|
guint64 size;
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
if ((ret =
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
gst_ebml_read_binary (ebml, &id, &data, &size)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
context->codec_priv = data;
|
|
|
|
context->codec_priv_size = size;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "CodecPrivate of size %" G_GUINT64_FORMAT,
|
|
|
|
size);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* name of the codec */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_CODECNAME:{
|
2004-03-15 19:32:27 +00:00
|
|
|
gchar *text;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_utf8 (ebml, &id, &text)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "CodecName: %s", GST_STR_NULL (text));
|
2004-03-15 19:32:27 +00:00
|
|
|
context->codec_name = text;
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2015-11-03 10:40:15 +00:00
|
|
|
/* codec delay */
|
|
|
|
case GST_MATROSKA_ID_CODECDELAY:{
|
|
|
|
guint64 num;
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
context->codec_delay = num;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "CodecDelay: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (num));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* codec delay */
|
|
|
|
case GST_MATROSKA_ID_SEEKPREROLL:{
|
|
|
|
guint64 num;
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
context->seek_preroll = num;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "SeekPreroll: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (num));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* name of this track */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKNAME:{
|
2004-03-15 19:32:27 +00:00
|
|
|
gchar *text;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_utf8 (ebml, &id, &text)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
context->name = text;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackName: %s", GST_STR_NULL (text));
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* language (matters for audio/subtitles, mostly) */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKLANGUAGE:{
|
2004-03-15 19:32:27 +00:00
|
|
|
gchar *text;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_utf8 (ebml, &id, &text)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2006-06-14 11:28:41 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
context->language = text;
|
2006-06-14 11:28:41 +00:00
|
|
|
|
|
|
|
/* fre-ca => fre */
|
|
|
|
if (strlen (context->language) >= 4 && context->language[3] == '-')
|
|
|
|
context->language[3] = '\0';
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "TrackLanguage: %s",
|
|
|
|
GST_STR_NULL (context->language));
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* whether this is actually used */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKFLAGENABLED:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (num)
|
|
|
|
context->flags |= GST_MATROSKA_TRACK_ENABLED;
|
|
|
|
else
|
|
|
|
context->flags &= ~GST_MATROSKA_TRACK_ENABLED;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "TrackEnabled: %d",
|
|
|
|
(context->flags & GST_MATROSKA_TRACK_ENABLED) ? 1 : 0);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* whether it's the default for this track type */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKFLAGDEFAULT:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (num)
|
|
|
|
context->flags |= GST_MATROSKA_TRACK_DEFAULT;
|
|
|
|
else
|
|
|
|
context->flags &= ~GST_MATROSKA_TRACK_DEFAULT;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "TrackDefault: %d",
|
2013-03-31 16:54:16 +00:00
|
|
|
(context->flags & GST_MATROSKA_TRACK_DEFAULT) ? 1 : 0);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +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
|
|
|
/* whether the track must be used during playback */
|
|
|
|
case GST_MATROSKA_ID_TRACKFLAGFORCED:{
|
|
|
|
guint64 num;
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (num)
|
|
|
|
context->flags |= GST_MATROSKA_TRACK_FORCED;
|
|
|
|
else
|
|
|
|
context->flags &= ~GST_MATROSKA_TRACK_FORCED;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "TrackForced: %d",
|
2013-03-31 16:54:16 +00:00
|
|
|
(context->flags & GST_MATROSKA_TRACK_FORCED) ? 1 : 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* lacing (like MPEG, where blocks don't end/start on frame
|
|
|
|
* boundaries) */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKFLAGLACING:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
if (num)
|
|
|
|
context->flags |= GST_MATROSKA_TRACK_LACING;
|
|
|
|
else
|
|
|
|
context->flags &= ~GST_MATROSKA_TRACK_LACING;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "TrackLacing: %d",
|
2013-03-31 16:54:16 +00:00
|
|
|
(context->flags & GST_MATROSKA_TRACK_LACING) ? 1 : 0);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* default length (in time) of one data block in this track */
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKDEFAULTDURATION:{
|
2004-03-15 19:32:27 +00:00
|
|
|
guint64 num;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &num)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +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
|
|
|
|
|
|
|
if (num == 0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackDefaultDuration 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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackDefaultDuration: %" G_GUINT64_FORMAT,
|
|
|
|
num);
|
2004-03-15 19:32:27 +00:00
|
|
|
context->default_duration = num;
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2006-09-04 16:21:17 +00:00
|
|
|
case GST_MATROSKA_ID_CONTENTENCODINGS:{
|
2011-05-26 18:05:52 +00:00
|
|
|
ret = gst_matroska_read_common_read_track_encodings (&demux->common,
|
|
|
|
ebml, context);
|
2006-09-04 16:21:17 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
case GST_MATROSKA_ID_TRACKTIMECODESCALE:{
|
|
|
|
gdouble num;
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_float (ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (num <= 0.0) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Invalid TrackTimeCodeScale %lf", num);
|
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
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "TrackTimeCodeScale: %lf", num);
|
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
|
|
|
context->timecodescale = num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
default:
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING ("Unknown TrackEntry subelement 0x%x - ignoring", id);
|
2004-03-15 19:32:27 +00:00
|
|
|
/* pass-through */
|
2003-11-21 21:34:27 +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
|
|
|
/* we ignore these because they're nothing useful (i.e. crap)
|
|
|
|
* or simply not implemented yet. */
|
2003-11-21 21:34:27 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKMINCACHE:
|
|
|
|
case GST_MATROSKA_ID_TRACKMAXCACHE:
|
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
|
|
|
case GST_MATROSKA_ID_MAXBLOCKADDITIONID:
|
|
|
|
case GST_MATROSKA_ID_TRACKATTACHMENTLINK:
|
|
|
|
case GST_MATROSKA_ID_TRACKOVERLAY:
|
|
|
|
case GST_MATROSKA_ID_TRACKTRANSLATE:
|
|
|
|
case GST_MATROSKA_ID_TRACKOFFSET:
|
|
|
|
case GST_MATROSKA_ID_CODECSETTINGS:
|
|
|
|
case GST_MATROSKA_ID_CODECINFOURL:
|
|
|
|
case GST_MATROSKA_ID_CODECDOWNLOADURL:
|
|
|
|
case GST_MATROSKA_ID_CODECDECODEALL:
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = gst_ebml_read_skip (ebml);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "TrackEntry", ret);
|
|
|
|
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
/* Decode codec private data if necessary */
|
|
|
|
if (context->encodings && context->encodings->len > 0 && context->codec_priv
|
|
|
|
&& context->codec_priv_size > 0) {
|
|
|
|
if (!gst_matroska_decode_data (context->encodings,
|
2009-06-23 12:32:43 +00:00
|
|
|
&context->codec_priv, &context->codec_priv_size,
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
GST_MATROSKA_TRACK_ENCODING_SCOPE_CODEC_DATA, TRUE)) {
|
|
|
|
GST_WARNING_OBJECT (demux, "Decoding codec private data failed");
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
if (context->type == 0 || context->codec_id == NULL || (ret != GST_FLOW_OK
|
2012-01-03 14:26:21 +00:00
|
|
|
&& ret != GST_FLOW_EOS)) {
|
|
|
|
if (ret == GST_FLOW_OK || ret == GST_FLOW_EOS)
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (ebml, "Unknown stream/codec in track entry header");
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2015-06-22 04:05:29 +00:00
|
|
|
gst_matroska_track_free (context);
|
2018-09-21 14:23:57 +00:00
|
|
|
context = NULL;
|
|
|
|
*dest_context = NULL;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2015-07-30 00:54:35 +00:00
|
|
|
/* check for a cached track taglist */
|
|
|
|
cached_taglist =
|
|
|
|
(GstTagList *) g_hash_table_lookup (demux->common.cached_track_taglists,
|
|
|
|
GUINT_TO_POINTER (context->uid));
|
|
|
|
if (cached_taglist)
|
|
|
|
gst_tag_list_insert (context->tags, cached_taglist, GST_TAG_MERGE_APPEND);
|
|
|
|
|
2018-09-21 14:23:57 +00:00
|
|
|
/* compute caps */
|
2003-11-21 21:34:27 +00:00
|
|
|
switch (context->type) {
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:{
|
2003-11-21 21:34:27 +00:00
|
|
|
GstMatroskaTrackVideoContext *videocontext =
|
2004-03-15 19:32:27 +00:00
|
|
|
(GstMatroskaTrackVideoContext *) context;
|
gst/matroska/: Fix indention everywhere. A broken indent version has added newlines after every single declaration so...
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_class_init),
(gst_ebml_read_change_state), (gst_ebml_read_element_level_up),
(gst_ebml_read_peek_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_get_length), (gst_ebml_read_skip),
(gst_ebml_read_buffer), (gst_ebml_read_bytes),
(gst_ebml_read_uint), (gst_ebml_read_sint), (_ext2dbl),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_date),
(gst_ebml_read_master), (gst_ebml_read_binary),
(gst_ebml_read_header):
* gst/matroska/ebml-write.c: (gst_ebml_write_element_id),
(gst_ebml_write_element_size), (gst_ebml_write_uint),
(gst_ebml_write_sint), (gst_ebml_write_ascii),
(gst_ebml_write_master_start), (gst_ebml_write_master_finish),
(gst_ebml_replace_uint):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream), (gst_matroskademux_do_index_seek),
(gst_matroska_demux_send_event),
(gst_matroska_demux_element_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_handle_src_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters), (gst_matroska_ebmlnum_uint),
(gst_matroska_ebmlnum_sint), (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_push_dvd_clut_change_event),
(gst_matroska_demux_add_mpeg_seq_header),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_change_state):
* gst/matroska/matroska-ids.c:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_class_init),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(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_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_mux_best_pad), (gst_matroska_mux_write_data),
(gst_matroska_mux_collected), (gst_matroska_mux_change_state):
Fix indention everywhere. A broken indent version has added newlines
after every single declaration some time ago.
2008-08-02 18:01:36 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
caps = gst_matroska_demux_video_caps (videocontext,
|
2011-11-26 09:01:07 +00:00
|
|
|
context->codec_id, context->codec_priv,
|
2010-06-30 23:22:07 +00:00
|
|
|
context->codec_priv_size, &codec, &riff_fourcc);
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
if (codec) {
|
2015-03-27 21:58:31 +00:00
|
|
|
gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_VIDEO_CODEC, codec, NULL);
|
|
|
|
context->tags_changed = TRUE;
|
2005-10-18 18:12:31 +00:00
|
|
|
g_free (codec);
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_AUDIO:{
|
2003-11-21 21:34:27 +00:00
|
|
|
GstMatroskaTrackAudioContext *audiocontext =
|
2004-03-15 19:32:27 +00:00
|
|
|
(GstMatroskaTrackAudioContext *) context;
|
gst/matroska/: Fix indention everywhere. A broken indent version has added newlines after every single declaration so...
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_class_init),
(gst_ebml_read_change_state), (gst_ebml_read_element_level_up),
(gst_ebml_read_peek_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_get_length), (gst_ebml_read_skip),
(gst_ebml_read_buffer), (gst_ebml_read_bytes),
(gst_ebml_read_uint), (gst_ebml_read_sint), (_ext2dbl),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_date),
(gst_ebml_read_master), (gst_ebml_read_binary),
(gst_ebml_read_header):
* gst/matroska/ebml-write.c: (gst_ebml_write_element_id),
(gst_ebml_write_element_size), (gst_ebml_write_uint),
(gst_ebml_write_sint), (gst_ebml_write_ascii),
(gst_ebml_write_master_start), (gst_ebml_write_master_finish),
(gst_ebml_replace_uint):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream), (gst_matroskademux_do_index_seek),
(gst_matroska_demux_send_event),
(gst_matroska_demux_element_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_handle_src_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters), (gst_matroska_ebmlnum_uint),
(gst_matroska_ebmlnum_sint), (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_push_dvd_clut_change_event),
(gst_matroska_demux_add_mpeg_seq_header),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_change_state):
* gst/matroska/matroska-ids.c:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_class_init),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(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_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_mux_best_pad), (gst_matroska_mux_write_data),
(gst_matroska_mux_collected), (gst_matroska_mux_change_state):
Fix indention everywhere. A broken indent version has added newlines
after every single declaration some time ago.
2008-08-02 18:01:36 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
caps = gst_matroska_demux_audio_caps (audiocontext,
|
2010-06-30 23:22:07 +00:00
|
|
|
context->codec_id, context->codec_priv, context->codec_priv_size,
|
|
|
|
&codec, &riff_audio_fmt);
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
if (codec) {
|
2015-03-27 21:58:31 +00:00
|
|
|
gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_AUDIO_CODEC, codec, NULL);
|
|
|
|
context->tags_changed = TRUE;
|
2005-10-18 18:12:31 +00:00
|
|
|
g_free (codec);
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:{
|
2003-11-21 21:34:27 +00:00
|
|
|
GstMatroskaTrackSubtitleContext *subtitlecontext =
|
2004-03-15 19:32:27 +00:00
|
|
|
(GstMatroskaTrackSubtitleContext *) context;
|
gst/matroska/: Fix indention everywhere. A broken indent version has added newlines after every single declaration so...
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_class_init),
(gst_ebml_read_change_state), (gst_ebml_read_element_level_up),
(gst_ebml_read_peek_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_get_length), (gst_ebml_read_skip),
(gst_ebml_read_buffer), (gst_ebml_read_bytes),
(gst_ebml_read_uint), (gst_ebml_read_sint), (_ext2dbl),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_date),
(gst_ebml_read_master), (gst_ebml_read_binary),
(gst_ebml_read_header):
* gst/matroska/ebml-write.c: (gst_ebml_write_element_id),
(gst_ebml_write_element_size), (gst_ebml_write_uint),
(gst_ebml_write_sint), (gst_ebml_write_ascii),
(gst_ebml_write_master_start), (gst_ebml_write_master_finish),
(gst_ebml_replace_uint):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream), (gst_matroskademux_do_index_seek),
(gst_matroska_demux_send_event),
(gst_matroska_demux_element_send_event),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_handle_src_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters), (gst_matroska_ebmlnum_uint),
(gst_matroska_ebmlnum_sint), (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_push_dvd_clut_change_event),
(gst_matroska_demux_add_mpeg_seq_header),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_change_state):
* gst/matroska/matroska-ids.c:
* gst/matroska/matroska-mux.c: (gst_matroska_mux_class_init),
(gst_matroska_mux_reset), (gst_matroska_mux_handle_sink_event),
(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_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_mux_best_pad), (gst_matroska_mux_write_data),
(gst_matroska_mux_collected), (gst_matroska_mux_change_state):
Fix indention everywhere. A broken indent version has added newlines
after every single declaration some time ago.
2008-08-02 18:01:36 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
caps = gst_matroska_demux_subtitle_caps (subtitlecontext,
|
2004-03-15 19:32:27 +00:00
|
|
|
context->codec_id, context->codec_priv, context->codec_priv_size);
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
case GST_MATROSKA_TRACK_TYPE_COMPLEX:
|
2003-11-21 21:34:27 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_LOGO:
|
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
|
|
|
case GST_MATROSKA_TRACK_TYPE_BUTTONS:
|
2003-11-21 21:34:27 +00:00
|
|
|
case GST_MATROSKA_TRACK_TYPE_CONTROL:
|
|
|
|
default:
|
|
|
|
/* we should already have quit by now */
|
2005-10-18 18:12:31 +00:00
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
|
2006-06-14 11:28:41 +00:00
|
|
|
if ((context->language == NULL || *context->language == '\0') &&
|
|
|
|
(context->type == GST_MATROSKA_TRACK_TYPE_AUDIO ||
|
|
|
|
context->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)) {
|
|
|
|
GST_LOG ("stream %d: language=eng (assuming default)", context->index);
|
|
|
|
context->language = g_strdup ("eng");
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
if (context->language) {
|
2009-12-13 12:45:22 +00:00
|
|
|
const gchar *lang;
|
|
|
|
|
|
|
|
/* Matroska contains ISO 639-2B codes, we want ISO 639-1 */
|
|
|
|
lang = gst_tag_get_language_code (context->language);
|
2015-03-27 21:58:31 +00:00
|
|
|
gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
|
2009-12-13 12:45:22 +00:00
|
|
|
GST_TAG_LANGUAGE_CODE, (lang) ? lang : context->language, NULL);
|
2018-06-13 16:39:57 +00:00
|
|
|
|
|
|
|
if (context->name) {
|
|
|
|
gst_tag_list_add (context->tags, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_TITLE, context->name, NULL);
|
|
|
|
}
|
2015-03-27 21:58:31 +00:00
|
|
|
context->tags_changed = TRUE;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2006-04-20 13:23:40 +00:00
|
|
|
if (caps == NULL) {
|
|
|
|
GST_WARNING_OBJECT (demux, "could not determine caps for stream with "
|
|
|
|
"codec_id='%s'", context->codec_id);
|
|
|
|
switch (context->type) {
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("video/x-unknown");
|
2006-04-20 13:23:40 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_AUDIO:
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-unknown");
|
2006-04-20 13:23:40 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("application/x-subtitle-unknown");
|
2006-04-20 13:23:40 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_COMPLEX:
|
|
|
|
default:
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("application/x-matroska-unknown");
|
2006-04-20 13:23:40 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-11-15 11:19:13 +00:00
|
|
|
gst_caps_set_simple (caps, "codec-id", G_TYPE_STRING, context->codec_id,
|
|
|
|
NULL);
|
2010-06-30 23:22:07 +00:00
|
|
|
|
|
|
|
/* add any unrecognised riff fourcc / audio format, but after codec-id */
|
|
|
|
if (context->type == GST_MATROSKA_TRACK_TYPE_AUDIO && riff_audio_fmt != 0)
|
|
|
|
gst_caps_set_simple (caps, "format", G_TYPE_INT, riff_audio_fmt, NULL);
|
2011-11-26 09:01:07 +00:00
|
|
|
else if (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO && riff_fourcc != 0) {
|
|
|
|
gchar *fstr = g_strdup_printf ("%" GST_FOURCC_FORMAT,
|
|
|
|
GST_FOURCC_ARGS (riff_fourcc));
|
|
|
|
gst_caps_set_simple (caps, "fourcc", G_TYPE_STRING, fstr, NULL);
|
|
|
|
g_free (fstr);
|
|
|
|
}
|
2012-09-27 23:43:38 +00:00
|
|
|
} else if (context->stream_headers != NULL) {
|
|
|
|
gst_matroska_demux_add_stream_headers_to_caps (demux,
|
|
|
|
context->stream_headers, caps);
|
2006-04-20 13:23:40 +00:00
|
|
|
}
|
|
|
|
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
if (context->encodings) {
|
|
|
|
GstMatroskaTrackEncoding *enc;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
for (i = 0; i < context->encodings->len; i++) {
|
|
|
|
enc = &g_array_index (context->encodings, GstMatroskaTrackEncoding, i);
|
|
|
|
if (enc->type == GST_MATROSKA_ENCODING_ENCRYPTION /* encryption */ ) {
|
|
|
|
GstStructure *s = gst_caps_get_structure (caps, 0);
|
|
|
|
if (!gst_structure_has_name (s, "application/x-webm-enc")) {
|
|
|
|
gst_structure_set (s, "original-media-type", G_TYPE_STRING,
|
|
|
|
gst_structure_get_name (s), NULL);
|
|
|
|
gst_structure_set (s, "encryption-algorithm", G_TYPE_STRING,
|
|
|
|
gst_matroska_track_encryption_algorithm_name (enc->enc_algo),
|
|
|
|
NULL);
|
|
|
|
gst_structure_set (s, "encoding-scope", G_TYPE_STRING,
|
|
|
|
gst_matroska_track_encoding_scope_name (enc->scope), NULL);
|
|
|
|
gst_structure_set (s, "cipher-mode", G_TYPE_STRING,
|
|
|
|
gst_matroska_track_encryption_cipher_mode_name
|
|
|
|
(enc->enc_cipher_mode), NULL);
|
|
|
|
gst_structure_set_name (s, "application/x-webm-enc");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-21 14:23:57 +00:00
|
|
|
context->caps = caps;
|
|
|
|
|
|
|
|
/* tadaah! */
|
|
|
|
*dest_context = context;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroska_demux_add_stream (GstMatroskaDemux * demux,
|
|
|
|
GstMatroskaTrackContext * context)
|
|
|
|
{
|
|
|
|
GstElementClass *klass = GST_ELEMENT_GET_CLASS (demux);
|
|
|
|
gchar *padname = NULL;
|
|
|
|
GstPadTemplate *templ = NULL;
|
|
|
|
GstStreamFlags stream_flags;
|
|
|
|
|
|
|
|
GstEvent *stream_start;
|
|
|
|
|
|
|
|
gchar *stream_id;
|
|
|
|
|
|
|
|
g_ptr_array_add (demux->common.src, context);
|
|
|
|
context->index = demux->common.num_streams++;
|
|
|
|
g_assert (demux->common.src->len == demux->common.num_streams);
|
|
|
|
g_ptr_array_index (demux->common.src, demux->common.num_streams - 1) =
|
|
|
|
context;
|
|
|
|
|
|
|
|
/* now create the GStreamer connectivity */
|
|
|
|
switch (context->type) {
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_VIDEO:
|
|
|
|
padname = g_strdup_printf ("video_%u", demux->num_v_streams++);
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "video_%u");
|
|
|
|
|
|
|
|
if (!context->intra_only)
|
|
|
|
demux->have_nonintraonly_v_streams = TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_AUDIO:
|
|
|
|
padname = g_strdup_printf ("audio_%u", demux->num_a_streams++);
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "audio_%u");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GST_MATROSKA_TRACK_TYPE_SUBTITLE:
|
|
|
|
padname = g_strdup_printf ("subtitle_%u", demux->num_t_streams++);
|
|
|
|
templ = gst_element_class_get_pad_template (klass, "subtitle_%u");
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* we should already have quit by now */
|
|
|
|
g_assert_not_reached ();
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* the pad in here */
|
2004-03-14 22:34:33 +00:00
|
|
|
context->pad = gst_pad_new_from_template (templ, padname);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
gst_pad_set_event_function (context->pad,
|
2005-10-18 18:12:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_handle_src_event));
|
2003-11-21 21:34:27 +00:00
|
|
|
gst_pad_set_query_function (context->pad,
|
2005-10-18 18:12:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_matroska_demux_handle_src_query));
|
|
|
|
|
2006-04-20 13:23:40 +00:00
|
|
|
GST_INFO_OBJECT (demux, "Adding pad '%s' with caps %" GST_PTR_FORMAT,
|
2018-09-21 14:23:57 +00:00
|
|
|
padname, context->caps);
|
2006-04-20 13:23:40 +00:00
|
|
|
|
2008-07-02 09:51:16 +00:00
|
|
|
gst_pad_set_element_private (context->pad, context);
|
|
|
|
|
2006-04-20 13:23:40 +00:00
|
|
|
gst_pad_use_fixed_caps (context->pad);
|
|
|
|
gst_pad_set_active (context->pad, TRUE);
|
2012-08-04 10:47:44 +00:00
|
|
|
|
|
|
|
stream_id =
|
|
|
|
gst_pad_create_stream_id_printf (context->pad, GST_ELEMENT_CAST (demux),
|
2016-02-22 12:53:21 +00:00
|
|
|
"%03" G_GUINT64_FORMAT ":%03" G_GUINT64_FORMAT,
|
|
|
|
context->num, context->uid);
|
2013-07-22 13:22:55 +00:00
|
|
|
stream_start =
|
|
|
|
gst_pad_get_sticky_event (demux->common.sinkpad, GST_EVENT_STREAM_START,
|
|
|
|
0);
|
|
|
|
if (stream_start) {
|
|
|
|
if (gst_event_parse_group_id (stream_start, &demux->group_id))
|
|
|
|
demux->have_group_id = TRUE;
|
|
|
|
else
|
|
|
|
demux->have_group_id = FALSE;
|
|
|
|
gst_event_unref (stream_start);
|
|
|
|
} else if (!demux->have_group_id) {
|
|
|
|
demux->have_group_id = TRUE;
|
|
|
|
demux->group_id = gst_util_group_id_next ();
|
|
|
|
}
|
|
|
|
|
2013-01-09 09:39:33 +00:00
|
|
|
stream_start = gst_event_new_stream_start (stream_id);
|
2012-08-04 10:47:44 +00:00
|
|
|
g_free (stream_id);
|
2013-07-22 13:22:55 +00:00
|
|
|
if (demux->have_group_id)
|
|
|
|
gst_event_set_group_id (stream_start, demux->group_id);
|
2013-01-09 09:39:33 +00:00
|
|
|
stream_flags = GST_STREAM_FLAG_NONE;
|
|
|
|
if (context->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
|
|
|
|
stream_flags |= GST_STREAM_FLAG_SPARSE;
|
|
|
|
if (context->flags & GST_MATROSKA_TRACK_DEFAULT)
|
|
|
|
stream_flags |= GST_STREAM_FLAG_SELECT;
|
2018-05-13 23:29:24 +00:00
|
|
|
else if (!(context->flags & GST_MATROSKA_TRACK_ENABLED))
|
|
|
|
stream_flags |= GST_STREAM_FLAG_UNSELECT;
|
|
|
|
|
2013-01-09 09:39:33 +00:00
|
|
|
gst_event_set_stream_flags (stream_start, stream_flags);
|
|
|
|
gst_pad_push_event (context->pad, stream_start);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_pad_set_caps (context->pad, context->caps);
|
2012-08-04 10:47:44 +00:00
|
|
|
|
2015-04-28 13:42:49 +00:00
|
|
|
|
|
|
|
if (demux->common.global_tags) {
|
|
|
|
GstEvent *tag_event;
|
|
|
|
|
|
|
|
gst_tag_list_add (demux->common.global_tags, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_CONTAINER_FORMAT, "Matroska", NULL);
|
|
|
|
GST_DEBUG_OBJECT (context->pad, "Sending global_tags %p: %" GST_PTR_FORMAT,
|
|
|
|
demux->common.global_tags, demux->common.global_tags);
|
|
|
|
|
|
|
|
tag_event =
|
|
|
|
gst_event_new_tag (gst_tag_list_copy (demux->common.global_tags));
|
|
|
|
|
|
|
|
gst_pad_push_event (context->pad, tag_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (G_UNLIKELY (context->tags_changed)) {
|
|
|
|
GST_DEBUG_OBJECT (context->pad, "Sending tags %p: %"
|
|
|
|
GST_PTR_FORMAT, context->tags, context->tags);
|
|
|
|
gst_pad_push_event (context->pad,
|
|
|
|
gst_event_new_tag (gst_tag_list_copy (context->tags)));
|
|
|
|
context->tags_changed = FALSE;
|
|
|
|
}
|
|
|
|
|
2006-04-20 13:23:40 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (demux), context->pad);
|
2014-05-26 16:21:25 +00:00
|
|
|
gst_flow_combiner_add_pad (demux->flowcombiner, context->pad);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
g_free (padname);
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2008-07-02 09:51:16 +00:00
|
|
|
gst_matroska_demux_query (GstMatroskaDemux * demux, GstPad * pad,
|
|
|
|
GstQuery * query)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2005-10-18 18:12:31 +00:00
|
|
|
gboolean res = FALSE;
|
2008-07-02 09:51:16 +00:00
|
|
|
GstMatroskaTrackContext *context = NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2008-07-02 09:51:16 +00:00
|
|
|
if (pad) {
|
|
|
|
context = gst_pad_get_element_private (pad);
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2003-11-21 21:34:27 +00:00
|
|
|
case GST_QUERY_POSITION:
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
2005-10-19 15:57:04 +00:00
|
|
|
gst_query_parse_position (query, &format, NULL);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2012-06-25 11:31:16 +00:00
|
|
|
res = TRUE;
|
2008-07-02 09:51:16 +00:00
|
|
|
if (format == GST_FORMAT_TIME) {
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
if (context)
|
2011-09-21 17:45:42 +00:00
|
|
|
gst_query_set_position (query, GST_FORMAT_TIME,
|
2011-12-13 17:15:18 +00:00
|
|
|
MAX (context->pos, demux->stream_start_time) -
|
|
|
|
demux->stream_start_time);
|
2008-07-02 09:51:16 +00:00
|
|
|
else
|
|
|
|
gst_query_set_position (query, GST_FORMAT_TIME,
|
2012-01-10 13:32:32 +00:00
|
|
|
MAX (demux->common.segment.position, demux->stream_start_time) -
|
2011-12-13 17:15:18 +00:00
|
|
|
demux->stream_start_time);
|
2008-07-02 09:51:16 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
} else if (format == GST_FORMAT_DEFAULT && context
|
|
|
|
&& context->default_duration) {
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
gst_query_set_position (query, GST_FORMAT_DEFAULT,
|
|
|
|
context->pos / context->default_duration);
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"only position query in TIME and DEFAULT format is supported");
|
2012-06-25 11:31:16 +00:00
|
|
|
res = FALSE;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2005-10-19 15:57:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_QUERY_DURATION:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
|
2005-10-20 19:14:27 +00:00
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2012-06-25 11:31:16 +00:00
|
|
|
res = TRUE;
|
2008-07-02 09:51:16 +00:00
|
|
|
if (format == GST_FORMAT_TIME) {
|
|
|
|
GST_OBJECT_LOCK (demux);
|
2010-03-18 14:29:00 +00:00
|
|
|
gst_query_set_duration (query, GST_FORMAT_TIME,
|
2011-06-05 17:15:55 +00:00
|
|
|
demux->common.segment.duration);
|
2008-07-02 09:51:16 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
} else if (format == GST_FORMAT_DEFAULT && context
|
|
|
|
&& context->default_duration) {
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
gst_query_set_duration (query, GST_FORMAT_DEFAULT,
|
2011-06-05 17:15:55 +00:00
|
|
|
demux->common.segment.duration / context->default_duration);
|
2008-07-02 09:51:16 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"only duration query in TIME and DEFAULT format is supported");
|
2012-06-25 11:31:16 +00:00
|
|
|
res = FALSE;
|
2005-10-19 15:57:04 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
case GST_QUERY_SEEKING:
|
|
|
|
{
|
2009-07-20 14:52:19 +00:00
|
|
|
GstFormat fmt;
|
|
|
|
|
|
|
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2010-04-14 09:53:46 +00:00
|
|
|
if (fmt == GST_FORMAT_TIME) {
|
|
|
|
gboolean seekable;
|
2009-07-20 14:52:19 +00:00
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
if (demux->streaming) {
|
|
|
|
/* assuming we'll be able to get an index ... */
|
|
|
|
seekable = demux->seekable;
|
|
|
|
} else {
|
2011-01-18 13:48:04 +00:00
|
|
|
seekable = TRUE;
|
2010-04-14 09:53:46 +00:00
|
|
|
}
|
2009-07-20 14:52:19 +00:00
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
gst_query_set_seeking (query, GST_FORMAT_TIME, seekable,
|
2011-06-05 17:15:55 +00:00
|
|
|
0, demux->common.segment.duration);
|
2010-04-14 09:53:46 +00:00
|
|
|
res = TRUE;
|
|
|
|
}
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2009-07-20 14:52:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-07-29 08:53:54 +00:00
|
|
|
case GST_QUERY_SEGMENT:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
gint64 start, stop;
|
|
|
|
|
|
|
|
format = demux->common.segment.format;
|
|
|
|
|
|
|
|
start =
|
|
|
|
gst_segment_to_stream_time (&demux->common.segment, format,
|
|
|
|
demux->common.segment.start);
|
|
|
|
if ((stop = demux->common.segment.stop) == -1)
|
|
|
|
stop = demux->common.segment.duration;
|
|
|
|
else
|
|
|
|
stop =
|
|
|
|
gst_segment_to_stream_time (&demux->common.segment, format, stop);
|
|
|
|
|
|
|
|
gst_query_set_segment (query, demux->common.segment.rate, format, start,
|
|
|
|
stop);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
default:
|
2012-08-04 10:54:32 +00:00
|
|
|
if (pad)
|
|
|
|
res = gst_pad_query_default (pad, (GstObject *) demux, query);
|
|
|
|
else
|
|
|
|
res =
|
|
|
|
GST_ELEMENT_CLASS (parent_class)->query (GST_ELEMENT_CAST (demux),
|
|
|
|
query);
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2008-07-02 09:51:16 +00:00
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_element_query (GstElement * element, GstQuery * query)
|
|
|
|
{
|
|
|
|
return gst_matroska_demux_query (GST_MATROSKA_DEMUX (element), NULL, query);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_demux_handle_src_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query)
|
2008-07-02 09:51:16 +00:00
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (parent);
|
2008-07-02 09:51:16 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
return gst_matroska_demux_query (demux, pad, query);
|
2008-07-02 09:51:16 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-01-11 18:02:34 +00:00
|
|
|
/* returns FALSE if there are no pads to deliver event to,
|
|
|
|
* otherwise TRUE (whatever the outcome of event sending),
|
|
|
|
* takes ownership of the passed event! */
|
2003-11-21 21:34:27 +00:00
|
|
|
static gboolean
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2010-01-11 18:02:34 +00:00
|
|
|
gboolean ret = FALSE;
|
2005-10-18 18:12:31 +00:00
|
|
|
gint i;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2008-03-03 22:01:56 +00:00
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Sending event of type %s to all source pads",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
g_assert (demux->common.src->len == demux->common.num_streams);
|
|
|
|
for (i = 0; i < demux->common.src->len; i++) {
|
2005-10-18 18:12:31 +00:00
|
|
|
GstMatroskaTrackContext *stream;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
stream = g_ptr_array_index (demux->common.src, i);
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_event_ref (event);
|
|
|
|
gst_pad_push_event (stream->pad, event);
|
2010-01-11 18:02:34 +00:00
|
|
|
ret = TRUE;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2009-09-23 15:19:34 +00:00
|
|
|
|
2015-03-14 15:39:09 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroska_demux_send_tags (GstMatroskaDemux * demux)
|
|
|
|
{
|
|
|
|
gint i;
|
|
|
|
|
2015-03-15 13:40:36 +00:00
|
|
|
if (G_UNLIKELY (demux->common.global_tags_changed)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
GstEvent *tag_event;
|
2011-05-28 16:34:34 +00:00
|
|
|
gst_tag_list_add (demux->common.global_tags, GST_TAG_MERGE_REPLACE,
|
2009-09-23 15:19:34 +00:00
|
|
|
GST_TAG_CONTAINER_FORMAT, "Matroska", NULL);
|
|
|
|
GST_DEBUG_OBJECT (demux, "Sending global_tags %p : %" GST_PTR_FORMAT,
|
2011-05-28 16:34:34 +00:00
|
|
|
demux->common.global_tags, demux->common.global_tags);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2015-03-15 13:40:36 +00:00
|
|
|
tag_event =
|
|
|
|
gst_event_new_tag (gst_tag_list_copy (demux->common.global_tags));
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
for (i = 0; i < demux->common.src->len; i++) {
|
|
|
|
GstMatroskaTrackContext *stream;
|
|
|
|
|
|
|
|
stream = g_ptr_array_index (demux->common.src, i);
|
|
|
|
gst_pad_push_event (stream->pad, gst_event_ref (tag_event));
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_event_unref (tag_event);
|
2015-03-15 13:40:36 +00:00
|
|
|
demux->common.global_tags_changed = FALSE;
|
2009-09-23 15:19:34 +00:00
|
|
|
}
|
|
|
|
|
2015-03-14 15:39:09 +00:00
|
|
|
g_assert (demux->common.src->len == demux->common.num_streams);
|
|
|
|
for (i = 0; i < demux->common.src->len; i++) {
|
|
|
|
GstMatroskaTrackContext *stream;
|
|
|
|
|
|
|
|
stream = g_ptr_array_index (demux->common.src, i);
|
|
|
|
|
2015-03-27 21:58:31 +00:00
|
|
|
if (G_UNLIKELY (stream->tags_changed)) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Sending tags %p for pad %s:%s : %"
|
|
|
|
GST_PTR_FORMAT, stream->tags,
|
|
|
|
GST_DEBUG_PAD_NAME (stream->pad), stream->tags);
|
2015-03-14 15:39:09 +00:00
|
|
|
gst_pad_push_event (stream->pad,
|
2015-03-27 21:58:31 +00:00
|
|
|
gst_event_new_tag (gst_tag_list_copy (stream->tags)));
|
|
|
|
stream->tags_changed = FALSE;
|
2015-03-14 15:39:09 +00:00
|
|
|
}
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_element_send_event (GstElement * element, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
|
|
|
|
gboolean res;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2008-03-03 22:01:56 +00:00
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_SEEK) {
|
2016-02-23 14:57:18 +00:00
|
|
|
/* no seeking until we are (safely) ready */
|
|
|
|
if (demux->common.state != GST_MATROSKA_READ_STATE_DATA) {
|
2018-11-14 07:57:55 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"not ready for seeking yet, deferring seek: %" GST_PTR_FORMAT, event);
|
|
|
|
if (demux->deferred_seek_event)
|
|
|
|
gst_event_unref (demux->deferred_seek_event);
|
|
|
|
demux->deferred_seek_event = event;
|
|
|
|
demux->deferred_seek_pad = NULL;
|
|
|
|
return TRUE;
|
2016-02-23 14:57:18 +00:00
|
|
|
}
|
2008-08-02 18:35:21 +00:00
|
|
|
res = gst_matroska_demux_handle_seek_event (demux, NULL, event);
|
2005-10-18 18:12:31 +00:00
|
|
|
} else {
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Unhandled event of type %s",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
2005-10-18 18:12:31 +00:00
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
2003-11-21 21:34:27 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_move_to_entry (GstMatroskaDemux * demux,
|
2012-07-20 13:28:21 +00:00
|
|
|
GstMatroskaIndex * entry, gboolean reset, gboolean update)
|
2010-03-23 16:34:50 +00:00
|
|
|
{
|
2010-05-28 14:37:32 +00:00
|
|
|
gint i;
|
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
|
2012-07-20 13:28:21 +00:00
|
|
|
if (update) {
|
|
|
|
/* seek (relative to matroska segment) */
|
|
|
|
/* position might be invalid; will error when streaming resumes ... */
|
|
|
|
demux->common.offset = entry->pos + demux->common.ebml_segment_start;
|
2012-07-23 13:33:54 +00:00
|
|
|
demux->next_cluster_offset = 0;
|
2010-03-23 16:34:50 +00:00
|
|
|
|
2012-07-20 13:28:21 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Seeked to offset %" G_GUINT64_FORMAT ", block %d, " "time %"
|
|
|
|
GST_TIME_FORMAT, entry->pos + demux->common.ebml_segment_start,
|
|
|
|
entry->block, GST_TIME_ARGS (entry->time));
|
|
|
|
|
|
|
|
/* update the time */
|
|
|
|
gst_matroska_read_common_reset_streams (&demux->common, entry->time, TRUE);
|
2015-03-23 19:56:41 +00:00
|
|
|
gst_flow_combiner_reset (demux->flowcombiner);
|
2012-07-20 13:28:21 +00:00
|
|
|
demux->common.segment.position = entry->time;
|
|
|
|
demux->seek_block = entry->block;
|
|
|
|
demux->seek_first = TRUE;
|
|
|
|
demux->last_stop_end = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
2010-03-23 16:34:50 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
for (i = 0; i < demux->common.src->len; i++) {
|
|
|
|
GstMatroskaTrackContext *stream = g_ptr_array_index (demux->common.src, i);
|
2010-05-28 14:37:32 +00:00
|
|
|
|
|
|
|
if (reset) {
|
|
|
|
stream->to_offset = G_MAXINT64;
|
|
|
|
} else {
|
|
|
|
if (stream->from_offset != -1)
|
|
|
|
stream->to_offset = stream->from_offset;
|
|
|
|
}
|
|
|
|
stream->from_offset = -1;
|
2012-07-20 13:28:21 +00:00
|
|
|
stream->from_time = GST_CLOCK_TIME_NONE;
|
2010-03-23 16:34:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-02-10 10:56:33 +00:00
|
|
|
static gint
|
|
|
|
gst_matroska_cluster_compare (gint64 * i1, gint64 * i2)
|
|
|
|
{
|
|
|
|
if (*i1 < *i2)
|
|
|
|
return -1;
|
|
|
|
else if (*i1 > *i2)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-08-17 10:08:10 +00:00
|
|
|
/* searches for a cluster start from @pos,
|
|
|
|
* return GST_FLOW_OK and cluster position in @pos if found */
|
|
|
|
static GstFlowReturn
|
2017-06-10 11:46:20 +00:00
|
|
|
gst_matroska_demux_search_cluster (GstMatroskaDemux * demux, gint64 * pos,
|
|
|
|
gboolean forward)
|
2010-08-17 10:08:10 +00:00
|
|
|
{
|
|
|
|
gint64 newpos = *pos;
|
|
|
|
gint64 orig_offset;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2017-06-08 14:55:29 +00:00
|
|
|
const guint chunk = 128 * 1024;
|
2010-08-17 10:08:10 +00:00
|
|
|
GstBuffer *buf = NULL;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
2011-11-26 09:01:07 +00:00
|
|
|
gpointer data = NULL;
|
|
|
|
gsize size;
|
2010-08-17 10:08:10 +00:00
|
|
|
guint64 length;
|
|
|
|
guint32 id;
|
|
|
|
guint needed;
|
2014-12-29 14:35:19 +00:00
|
|
|
gint64 oldpos, oldlength;
|
2010-08-17 10:08:10 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
orig_offset = demux->common.offset;
|
2010-08-17 10:08:10 +00:00
|
|
|
|
2017-06-10 11:46:20 +00:00
|
|
|
GST_LOG_OBJECT (demux, "searching cluster %s offset %" G_GINT64_FORMAT,
|
|
|
|
forward ? "following" : "preceding", *pos);
|
2011-02-10 10:56:33 +00:00
|
|
|
|
|
|
|
if (demux->clusters) {
|
|
|
|
gint64 *cpos;
|
|
|
|
|
|
|
|
cpos = gst_util_array_binary_search (demux->clusters->data,
|
|
|
|
demux->clusters->len, sizeof (gint64),
|
|
|
|
(GCompareDataFunc) gst_matroska_cluster_compare,
|
2017-06-10 11:46:20 +00:00
|
|
|
forward ? GST_SEARCH_MODE_AFTER : GST_SEARCH_MODE_BEFORE, pos, NULL);
|
2011-02-10 10:56:33 +00:00
|
|
|
/* sanity check */
|
|
|
|
if (cpos) {
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"cluster reported at offset %" G_GINT64_FORMAT, *cpos);
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = *cpos;
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2011-02-10 10:56:33 +00:00
|
|
|
if (ret == GST_FLOW_OK && id == GST_MATROSKA_ID_CLUSTER) {
|
|
|
|
newpos = *cpos;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-17 10:08:10 +00:00
|
|
|
/* read in at newpos and scan for ebml cluster id */
|
2014-12-29 14:35:19 +00:00
|
|
|
oldpos = oldlength = -1;
|
2010-08-17 10:08:10 +00:00
|
|
|
while (1) {
|
|
|
|
GstByteReader reader;
|
|
|
|
gint cluster_pos;
|
2017-09-11 18:24:27 +00:00
|
|
|
guint toread = chunk;
|
2010-08-17 10:08:10 +00:00
|
|
|
|
2017-09-11 18:24:27 +00:00
|
|
|
if (!forward) {
|
|
|
|
/* never read beyond the requested target */
|
|
|
|
if (G_UNLIKELY (newpos < chunk)) {
|
|
|
|
toread = newpos;
|
|
|
|
newpos = 0;
|
|
|
|
} else {
|
|
|
|
newpos -= chunk;
|
|
|
|
}
|
|
|
|
}
|
2011-06-16 12:52:51 +00:00
|
|
|
if (buf != NULL) {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2011-06-16 12:52:51 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
buf = NULL;
|
|
|
|
}
|
2017-09-11 18:24:27 +00:00
|
|
|
ret = gst_pad_pull_range (demux->common.sinkpad, newpos, toread, &buf);
|
2010-08-17 10:08:10 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
break;
|
2012-01-13 23:12:05 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"read buffer size %" G_GSIZE_FORMAT " at offset %" G_GINT64_FORMAT,
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_get_size (buf), newpos);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
2014-12-29 14:35:19 +00:00
|
|
|
if (oldpos == newpos && oldlength == map.size) {
|
|
|
|
GST_ERROR_OBJECT (demux, "Stuck at same position");
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto exit;
|
|
|
|
} else {
|
|
|
|
oldpos = newpos;
|
|
|
|
oldlength = map.size;
|
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_byte_reader_init (&reader, data, size);
|
2017-06-10 11:46:20 +00:00
|
|
|
cluster_pos = -1;
|
|
|
|
while (1) {
|
|
|
|
gint found = gst_byte_reader_masked_scan_uint32 (&reader, 0xffffffff,
|
|
|
|
GST_MATROSKA_ID_CLUSTER, 0, gst_byte_reader_get_remaining (&reader));
|
|
|
|
if (forward) {
|
|
|
|
cluster_pos = found;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* need last occurrence when searching backwards */
|
|
|
|
if (found >= 0) {
|
|
|
|
cluster_pos = gst_byte_reader_get_pos (&reader) + found;
|
|
|
|
gst_byte_reader_skip (&reader, found + 4);
|
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-17 10:08:10 +00:00
|
|
|
if (cluster_pos >= 0) {
|
|
|
|
newpos += cluster_pos;
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"found cluster ebml id at offset %" G_GINT64_FORMAT, newpos);
|
|
|
|
/* extra checks whether we really sync'ed to a cluster:
|
|
|
|
* - either it is the first and only cluster
|
|
|
|
* - either there is a cluster after this one
|
|
|
|
* - either cluster length is undefined
|
|
|
|
*/
|
|
|
|
/* ok if first cluster (there may not a subsequent one) */
|
|
|
|
if (newpos == demux->first_cluster_offset) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "cluster is first cluster -> OK");
|
|
|
|
break;
|
|
|
|
}
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = newpos;
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2011-06-16 12:52:51 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "need more data -> continue");
|
2017-06-10 11:46:20 +00:00
|
|
|
goto next;
|
2011-06-16 12:52:51 +00:00
|
|
|
}
|
2010-08-17 10:08:10 +00:00
|
|
|
g_assert (id == GST_MATROSKA_ID_CLUSTER);
|
|
|
|
GST_DEBUG_OBJECT (demux, "cluster size %" G_GUINT64_FORMAT ", prefix %d",
|
|
|
|
length, needed);
|
|
|
|
/* ok if undefined length or first cluster */
|
2011-06-16 12:52:51 +00:00
|
|
|
if (length == GST_EBML_SIZE_UNKNOWN || length == G_MAXUINT64) {
|
2010-08-17 10:08:10 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "cluster has undefined length -> OK");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* skip cluster */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset += length + needed;
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2017-06-10 11:46:20 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto next;
|
2010-08-17 10:08:10 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "next element is %scluster",
|
|
|
|
id == GST_MATROSKA_ID_CLUSTER ? "" : "not ");
|
|
|
|
if (id == GST_MATROSKA_ID_CLUSTER)
|
|
|
|
break;
|
2017-06-10 11:46:20 +00:00
|
|
|
next:
|
|
|
|
if (forward)
|
|
|
|
newpos += 1;
|
2010-08-17 10:08:10 +00:00
|
|
|
} else {
|
|
|
|
/* partial cluster id may have been in tail of buffer */
|
2017-06-10 11:46:20 +00:00
|
|
|
newpos +=
|
|
|
|
forward ? MAX (gst_byte_reader_get_remaining (&reader), 4) - 3 : 3;
|
2010-08-17 10:08:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-05 14:01:19 +00:00
|
|
|
if (buf) {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2010-10-05 14:01:19 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
buf = NULL;
|
|
|
|
}
|
|
|
|
|
2011-02-10 10:56:33 +00:00
|
|
|
exit:
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = orig_offset;
|
2010-08-17 10:08:10 +00:00
|
|
|
*pos = newpos;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-08 11:37:54 +00:00
|
|
|
/* Three states to express: starts with I-frame, starts with delta, don't know */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CLUSTER_STATUS_NONE = 0,
|
|
|
|
CLUSTER_STATUS_STARTS_WITH_KEYFRAME,
|
|
|
|
CLUSTER_STATUS_STARTS_WITH_DELTAUNIT,
|
|
|
|
} ClusterStatus;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
guint64 offset;
|
|
|
|
guint64 size;
|
|
|
|
guint64 prev_size;
|
|
|
|
GstClockTime time;
|
|
|
|
ClusterStatus status;
|
|
|
|
} ClusterInfo;
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
cluster_status_get_nick (ClusterStatus status)
|
|
|
|
{
|
|
|
|
switch (status) {
|
|
|
|
case CLUSTER_STATUS_NONE:
|
|
|
|
return "none";
|
|
|
|
case CLUSTER_STATUS_STARTS_WITH_KEYFRAME:
|
|
|
|
return "key";
|
|
|
|
case CLUSTER_STATUS_STARTS_WITH_DELTAUNIT:
|
|
|
|
return "delta";
|
|
|
|
}
|
|
|
|
return "???";
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Skip ebml-coded number:
|
|
|
|
* 1xxx.. = 1 byte
|
|
|
|
* 01xx.. = 2 bytes
|
|
|
|
* 001x.. = 3 bytes, etc.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
bit_reader_skip_ebml_num (GstBitReader * br)
|
|
|
|
{
|
|
|
|
guint8 i, v = 0;
|
|
|
|
|
|
|
|
if (!gst_bit_reader_peek_bits_uint8 (br, &v, 8))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
if ((v & (0x80 >> i)) != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return gst_bit_reader_skip (br, (i + 1) * 8);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Don't probe more than that many bytes into the cluster for keyframe info
|
|
|
|
* (random value, mostly for sanity checking) */
|
|
|
|
#define MAX_CLUSTER_INFO_PROBE_LENGTH 256
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_peek_cluster_info (GstMatroskaDemux * demux,
|
|
|
|
ClusterInfo * cluster, guint64 offset)
|
|
|
|
{
|
|
|
|
demux->common.offset = offset;
|
|
|
|
demux->cluster_time = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
cluster->offset = offset;
|
|
|
|
cluster->size = 0;
|
|
|
|
cluster->prev_size = 0;
|
|
|
|
cluster->time = GST_CLOCK_TIME_NONE;
|
|
|
|
cluster->status = CLUSTER_STATUS_NONE;
|
|
|
|
|
|
|
|
/* parse first few elements in cluster */
|
|
|
|
do {
|
|
|
|
GstFlowReturn flow;
|
|
|
|
guint64 length;
|
|
|
|
guint32 id;
|
|
|
|
guint needed;
|
|
|
|
|
|
|
|
flow = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
|
|
|
|
|
|
|
if (flow != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "Offset %" G_GUINT64_FORMAT ", Element id 0x%x, "
|
|
|
|
"size %" G_GUINT64_FORMAT ", needed %d", demux->common.offset, id,
|
|
|
|
length, needed);
|
|
|
|
|
|
|
|
/* Reached start of next cluster without finding data, stop processing */
|
|
|
|
if (id == GST_MATROSKA_ID_CLUSTER && cluster->offset != offset)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* Not going to parse into these for now, stop processing */
|
|
|
|
if (id == GST_MATROSKA_ID_ENCRYPTEDBLOCK
|
|
|
|
|| id == GST_MATROSKA_ID_BLOCKGROUP || id == GST_MATROSKA_ID_BLOCK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* SimpleBlock: peek at headers to check if it's a keyframe */
|
|
|
|
if (id == GST_MATROSKA_ID_SIMPLEBLOCK) {
|
|
|
|
GstBitReader br;
|
|
|
|
guint8 *d, hdr_len, v = 0;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "SimpleBlock found");
|
|
|
|
|
|
|
|
/* SimpleBlock header is max. 21 bytes */
|
|
|
|
hdr_len = MIN (21, length);
|
|
|
|
|
|
|
|
flow = gst_matroska_read_common_peek_bytes (&demux->common,
|
|
|
|
demux->common.offset, hdr_len, NULL, &d);
|
|
|
|
|
|
|
|
if (flow != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
gst_bit_reader_init (&br, d, hdr_len);
|
|
|
|
|
|
|
|
/* skip prefix: ebml id (SimpleBlock) + element length */
|
|
|
|
if (!gst_bit_reader_skip (&br, 8 * needed))
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* skip track number (ebml coded) */
|
|
|
|
if (!bit_reader_skip_ebml_num (&br))
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* skip Timecode */
|
|
|
|
if (!gst_bit_reader_skip (&br, 16))
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* read flags */
|
|
|
|
if (!gst_bit_reader_get_bits_uint8 (&br, &v, 8))
|
|
|
|
break;
|
|
|
|
|
|
|
|
if ((v & 0x80) != 0)
|
|
|
|
cluster->status = CLUSTER_STATUS_STARTS_WITH_KEYFRAME;
|
|
|
|
else
|
|
|
|
cluster->status = CLUSTER_STATUS_STARTS_WITH_DELTAUNIT;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
flow = gst_matroska_demux_parse_id (demux, id, length, needed);
|
|
|
|
|
|
|
|
if (flow != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
case GST_MATROSKA_ID_CLUSTER:
|
|
|
|
if (length == G_MAXUINT64)
|
|
|
|
cluster->size = 0;
|
|
|
|
else
|
|
|
|
cluster->size = length + needed;
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_PREVSIZE:
|
|
|
|
cluster->prev_size = demux->cluster_prevsize;
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_CLUSTERTIMECODE:
|
|
|
|
cluster->time = demux->cluster_time * demux->common.time_scale;
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_SILENTTRACKS:
|
|
|
|
/* ignore and continue */
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (demux, "Unknown ebml id 0x%08x (possibly garbage), "
|
|
|
|
"bailing out", id);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
} while (demux->common.offset - offset < MAX_CLUSTER_INFO_PROBE_LENGTH);
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (demux, "Cluster @ %" G_GUINT64_FORMAT ": "
|
|
|
|
"time %" GST_TIME_FORMAT ", size %" G_GUINT64_FORMAT ", "
|
|
|
|
"prev_size %" G_GUINT64_FORMAT ", %s", cluster->offset,
|
|
|
|
GST_TIME_ARGS (cluster->time), cluster->size, cluster->prev_size,
|
|
|
|
cluster_status_get_nick (cluster->status));
|
|
|
|
|
|
|
|
/* return success as long as we could extract the minimum useful information */
|
|
|
|
return cluster->time != GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* returns TRUE if the cluster offset was updated */
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_scan_back_for_keyframe_cluster (GstMatroskaDemux * demux,
|
|
|
|
gint64 * cluster_offset, GstClockTime * cluster_time)
|
|
|
|
{
|
|
|
|
GstClockTime stream_start_time = demux->stream_start_time;
|
|
|
|
guint64 first_cluster_offset = demux->first_cluster_offset;
|
|
|
|
gint64 off = *cluster_offset;
|
|
|
|
ClusterInfo cluster = { 0, };
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (demux, "Checking if cluster starts with keyframe");
|
|
|
|
while (off > first_cluster_offset) {
|
|
|
|
if (!gst_matroska_demux_peek_cluster_info (demux, &cluster, off)) {
|
|
|
|
GST_LOG_OBJECT (demux,
|
|
|
|
"Couldn't get info on cluster @ %" G_GUINT64_FORMAT, off);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Keyframe? Then we're done */
|
|
|
|
if (cluster.status == CLUSTER_STATUS_STARTS_WITH_KEYFRAME) {
|
|
|
|
GST_LOG_OBJECT (demux,
|
|
|
|
"Found keyframe at start of cluster @ %" G_GUINT64_FORMAT, off);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We only scan back if we *know* we landed on a cluster that
|
|
|
|
* starts with a delta frame. */
|
|
|
|
if (cluster.status != CLUSTER_STATUS_STARTS_WITH_DELTAUNIT) {
|
|
|
|
GST_LOG_OBJECT (demux,
|
|
|
|
"No delta frame at start of cluster @ %" G_GUINT64_FORMAT, off);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "Cluster starts with delta frame, backtracking");
|
|
|
|
|
2018-08-15 11:14:24 +00:00
|
|
|
/* Don't scan back more than this much in time from the cluster we
|
|
|
|
* originally landed on. This is mostly a sanity check in case a file
|
|
|
|
* always has keyframes in the middle of clusters and never at the
|
|
|
|
* beginning. Without this we would always scan back to the beginning
|
|
|
|
* of the file in that case. */
|
2018-08-15 10:49:57 +00:00
|
|
|
if (cluster.time != GST_CLOCK_TIME_NONE) {
|
|
|
|
GstClockTimeDiff distance = GST_CLOCK_DIFF (cluster.time, *cluster_time);
|
|
|
|
|
2018-08-15 11:14:24 +00:00
|
|
|
if (distance < 0 || distance > demux->max_backtrack_distance * GST_SECOND) {
|
2018-08-15 10:49:57 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Haven't found cluster with keyframe within "
|
|
|
|
"%u secs of original seek target cluster, stopping",
|
2018-08-15 11:14:24 +00:00
|
|
|
demux->max_backtrack_distance);
|
2018-08-15 10:49:57 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-15 11:53:34 +00:00
|
|
|
/* If we have cluster prev_size we can skip back efficiently. If not,
|
|
|
|
* we'll just do a brute force search for a cluster identifier */
|
|
|
|
if (cluster.prev_size > 0 && off >= cluster.prev_size) {
|
|
|
|
off -= cluster.prev_size;
|
|
|
|
} else {
|
|
|
|
GstFlowReturn flow;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "Cluster has no or invalid prev size, searching "
|
|
|
|
"for previous cluster instead then");
|
|
|
|
|
|
|
|
flow = gst_matroska_demux_search_cluster (demux, &off, FALSE);
|
|
|
|
if (flow != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "cluster search yielded flow %s, stopping",
|
|
|
|
gst_flow_get_name (flow));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-08 11:37:54 +00:00
|
|
|
if (off <= first_cluster_offset) {
|
|
|
|
GST_LOG_OBJECT (demux, "Reached first cluster, stopping");
|
|
|
|
*cluster_offset = first_cluster_offset;
|
|
|
|
*cluster_time = stream_start_time;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
GST_LOG_OBJECT (demux, "Trying prev cluster @ %" G_GUINT64_FORMAT, off);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we found a cluster starting with a keyframe jump to that instead,
|
|
|
|
* otherwise leave everything as it was before */
|
|
|
|
if (cluster.time != GST_CLOCK_TIME_NONE
|
|
|
|
&& (cluster.offset == first_cluster_offset
|
|
|
|
|| cluster.status == CLUSTER_STATUS_STARTS_WITH_KEYFRAME)) {
|
|
|
|
*cluster_offset = cluster.offset;
|
|
|
|
*cluster_time = cluster.time;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-07-22 10:05:26 +00:00
|
|
|
/* bisect and scan through file for cluster starting before @time,
|
|
|
|
* returns fake index entry with corresponding info on cluster */
|
|
|
|
static GstMatroskaIndex *
|
|
|
|
gst_matroska_demux_search_pos (GstMatroskaDemux * demux, GstClockTime time)
|
|
|
|
{
|
2010-07-26 16:33:09 +00:00
|
|
|
GstMatroskaIndex *entry = NULL;
|
2011-05-23 15:48:57 +00:00
|
|
|
GstMatroskaReadState current_state;
|
2010-07-22 10:05:26 +00:00
|
|
|
GstClockTime otime, prev_cluster_time, current_cluster_time, cluster_time;
|
2017-06-10 11:46:20 +00:00
|
|
|
GstClockTime atime;
|
|
|
|
gint64 opos, newpos, current_offset;
|
2010-07-26 16:33:09 +00:00
|
|
|
gint64 prev_cluster_offset = -1, current_cluster_offset, cluster_offset;
|
2017-06-10 11:46:20 +00:00
|
|
|
gint64 apos, maxpos;
|
2017-06-08 14:39:06 +00:00
|
|
|
guint64 cluster_size = 0;
|
2010-07-22 10:05:26 +00:00
|
|
|
GstFlowReturn ret;
|
|
|
|
guint64 length;
|
|
|
|
guint32 id;
|
|
|
|
guint needed;
|
|
|
|
|
2017-06-10 11:46:20 +00:00
|
|
|
/* estimate new position, resync using cluster ebml id,
|
|
|
|
* and bisect further or scan forward to appropriate cluster */
|
2010-07-22 10:05:26 +00:00
|
|
|
|
2018-08-08 11:37:54 +00:00
|
|
|
/* save some current global state which will be touched by our scanning */
|
2011-05-23 15:48:57 +00:00
|
|
|
current_state = demux->common.state;
|
|
|
|
g_return_val_if_fail (current_state == GST_MATROSKA_READ_STATE_DATA, NULL);
|
2010-07-22 10:05:26 +00:00
|
|
|
|
|
|
|
current_cluster_offset = demux->cluster_offset;
|
|
|
|
current_cluster_time = demux->cluster_time;
|
2011-05-23 15:06:44 +00:00
|
|
|
current_offset = demux->common.offset;
|
2010-07-22 10:05:26 +00:00
|
|
|
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_SCANNING;
|
2010-07-22 10:05:26 +00:00
|
|
|
|
2017-06-10 13:14:41 +00:00
|
|
|
/* estimate using start and last known cluster */
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2017-06-10 11:46:20 +00:00
|
|
|
apos = demux->first_cluster_offset;
|
|
|
|
atime = demux->stream_start_time;
|
2017-06-10 13:14:41 +00:00
|
|
|
opos = demux->last_cluster_offset;
|
|
|
|
otime = demux->stream_last_time;
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2010-07-22 10:05:26 +00:00
|
|
|
|
2011-12-13 17:15:18 +00:00
|
|
|
/* sanitize */
|
2017-06-10 11:46:20 +00:00
|
|
|
time = MAX (time, atime);
|
|
|
|
otime = MAX (otime, atime);
|
|
|
|
opos = MAX (opos, apos);
|
|
|
|
|
|
|
|
maxpos = gst_matroska_read_common_get_length (&demux->common);
|
2011-12-13 17:15:18 +00:00
|
|
|
|
2017-06-10 11:46:20 +00:00
|
|
|
/* invariants;
|
|
|
|
* apos <= opos
|
|
|
|
* atime <= otime
|
|
|
|
* apos always refer to a cluster before target time;
|
|
|
|
* opos may or may not be after target time, but if it is once so,
|
|
|
|
* then also in next iteration
|
|
|
|
* */
|
2011-06-16 12:52:51 +00:00
|
|
|
|
2010-07-22 10:05:26 +00:00
|
|
|
retry:
|
|
|
|
GST_LOG_OBJECT (demux,
|
2017-06-10 11:46:20 +00:00
|
|
|
"apos: %" G_GUINT64_FORMAT ", atime: %" GST_TIME_FORMAT ", %"
|
|
|
|
GST_TIME_FORMAT " in stream time, "
|
2011-09-21 17:45:42 +00:00
|
|
|
"opos: %" G_GUINT64_FORMAT ", otime: %" GST_TIME_FORMAT ", %"
|
|
|
|
GST_TIME_FORMAT " in stream time (start %" GST_TIME_FORMAT "), time %"
|
2017-06-10 11:46:20 +00:00
|
|
|
GST_TIME_FORMAT, apos, GST_TIME_ARGS (atime),
|
|
|
|
GST_TIME_ARGS (atime - demux->stream_start_time), opos,
|
|
|
|
GST_TIME_ARGS (otime), GST_TIME_ARGS (otime - demux->stream_start_time),
|
2011-09-21 17:45:42 +00:00
|
|
|
GST_TIME_ARGS (demux->stream_start_time), GST_TIME_ARGS (time));
|
2013-10-24 11:16:42 +00:00
|
|
|
|
2017-06-10 11:46:20 +00:00
|
|
|
g_assert (atime <= otime);
|
|
|
|
g_assert (apos <= opos);
|
|
|
|
if (time == GST_CLOCK_TIME_NONE) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "searching last cluster");
|
|
|
|
newpos = maxpos;
|
|
|
|
if (newpos == -1) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "unknown file size; bailing out");
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
} else if (otime <= atime) {
|
|
|
|
newpos = apos;
|
2013-10-24 11:16:42 +00:00
|
|
|
} else {
|
2017-06-10 11:46:20 +00:00
|
|
|
newpos = apos +
|
|
|
|
gst_util_uint64_scale (opos - apos, time - atime, otime - atime);
|
|
|
|
if (maxpos != -1 && newpos > maxpos)
|
|
|
|
newpos = maxpos;
|
2013-10-24 11:16:42 +00:00
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"estimated offset for %" GST_TIME_FORMAT ": %" G_GINT64_FORMAT,
|
|
|
|
GST_TIME_ARGS (time), newpos);
|
|
|
|
|
2017-06-10 11:46:20 +00:00
|
|
|
/* search backwards */
|
|
|
|
if (newpos > apos) {
|
|
|
|
ret = gst_matroska_demux_search_cluster (demux, &newpos, FALSE);
|
|
|
|
if (ret != GST_FLOW_OK)
|
2010-07-22 10:05:26 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* then start scanning and parsing for cluster time,
|
2017-06-10 11:46:20 +00:00
|
|
|
* re-estimate if possible, otherwise next cluster and so on */
|
|
|
|
/* note that each re-estimate is entered with a change in apos or opos,
|
|
|
|
* avoiding infinite loop */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = newpos;
|
2010-07-22 10:05:26 +00:00
|
|
|
demux->cluster_time = cluster_time = GST_CLOCK_TIME_NONE;
|
2017-06-08 14:39:06 +00:00
|
|
|
cluster_size = 0;
|
2017-06-10 11:46:20 +00:00
|
|
|
prev_cluster_time = GST_CLOCK_TIME_NONE;
|
2010-07-22 10:05:26 +00:00
|
|
|
while (1) {
|
|
|
|
/* peek and parse some elements */
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2010-07-22 10:05:26 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto error;
|
|
|
|
GST_LOG_OBJECT (demux, "Offset %" G_GUINT64_FORMAT ", Element id 0x%x, "
|
2011-05-23 15:06:44 +00:00
|
|
|
"size %" G_GUINT64_FORMAT ", needed %d", demux->common.offset, id,
|
2010-07-22 10:05:26 +00:00
|
|
|
length, needed);
|
|
|
|
ret = gst_matroska_demux_parse_id (demux, id, length, needed);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (id == GST_MATROSKA_ID_CLUSTER) {
|
|
|
|
cluster_time = GST_CLOCK_TIME_NONE;
|
|
|
|
if (length == G_MAXUINT64)
|
|
|
|
cluster_size = 0;
|
|
|
|
else
|
|
|
|
cluster_size = length + needed;
|
|
|
|
}
|
|
|
|
if (demux->cluster_time != GST_CLOCK_TIME_NONE &&
|
|
|
|
cluster_time == GST_CLOCK_TIME_NONE) {
|
2011-05-23 15:06:44 +00:00
|
|
|
cluster_time = demux->cluster_time * demux->common.time_scale;
|
2010-07-22 10:05:26 +00:00
|
|
|
cluster_offset = demux->cluster_offset;
|
|
|
|
GST_DEBUG_OBJECT (demux, "found cluster at offset %" G_GINT64_FORMAT
|
|
|
|
" with time %" GST_TIME_FORMAT, cluster_offset,
|
|
|
|
GST_TIME_ARGS (cluster_time));
|
2017-06-10 11:46:20 +00:00
|
|
|
if (time == GST_CLOCK_TIME_NONE) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "found last cluster");
|
|
|
|
prev_cluster_time = cluster_time;
|
|
|
|
prev_cluster_offset = cluster_offset;
|
|
|
|
break;
|
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
if (cluster_time > time) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "overshot target");
|
|
|
|
/* cluster overshoots */
|
2010-10-05 14:00:45 +00:00
|
|
|
if (cluster_offset == demux->first_cluster_offset) {
|
|
|
|
/* but no prev one */
|
|
|
|
GST_DEBUG_OBJECT (demux, "but using first cluster anyway");
|
|
|
|
prev_cluster_time = cluster_time;
|
|
|
|
prev_cluster_offset = cluster_offset;
|
|
|
|
break;
|
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
if (prev_cluster_time != GST_CLOCK_TIME_NONE) {
|
|
|
|
/* prev cluster did not overshoot, so prev cluster is target */
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
/* re-estimate using this new position info */
|
|
|
|
opos = cluster_offset;
|
|
|
|
otime = cluster_time;
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
} else {
|
2017-06-10 11:46:20 +00:00
|
|
|
/* cluster undershoots */
|
|
|
|
GST_DEBUG_OBJECT (demux, "undershot target");
|
|
|
|
/* ok if close enough */
|
|
|
|
if (GST_CLOCK_DIFF (cluster_time, time) < 5 * GST_SECOND) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "target close enough");
|
|
|
|
prev_cluster_time = cluster_time;
|
|
|
|
prev_cluster_offset = cluster_offset;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (otime > time) {
|
|
|
|
/* we are in between atime and otime => can bisect if worthwhile */
|
|
|
|
if (prev_cluster_time != GST_CLOCK_TIME_NONE &&
|
|
|
|
cluster_time > prev_cluster_time &&
|
|
|
|
(GST_CLOCK_DIFF (prev_cluster_time, cluster_time) * 10 <
|
|
|
|
GST_CLOCK_DIFF (cluster_time, time))) {
|
|
|
|
/* we moved at least one cluster forward,
|
|
|
|
* and it looks like target is still far away,
|
|
|
|
* let's estimate again */
|
|
|
|
GST_DEBUG_OBJECT (demux, "bisecting with new apos");
|
|
|
|
apos = cluster_offset;
|
|
|
|
atime = cluster_time;
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
/* cluster undershoots, goto next one */
|
|
|
|
prev_cluster_time = cluster_time;
|
|
|
|
prev_cluster_offset = cluster_offset;
|
|
|
|
/* skip cluster if length is defined,
|
|
|
|
* otherwise will be skippingly parsed into */
|
|
|
|
if (cluster_size) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "skipping to next cluster");
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = cluster_offset + cluster_size;
|
2010-07-22 10:05:26 +00:00
|
|
|
demux->cluster_time = GST_CLOCK_TIME_NONE;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (demux, "parsing/skipping cluster elements");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
error:
|
2012-01-03 14:26:21 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2010-07-22 10:05:26 +00:00
|
|
|
if (prev_cluster_time != GST_CLOCK_TIME_NONE)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2018-08-08 11:37:54 +00:00
|
|
|
/* In the bisect loop above we always undershoot and then jump forward
|
|
|
|
* cluster-by-cluster until we overshoot, so if we get here we've gone
|
|
|
|
* over and the previous cluster is where we need to go to. */
|
|
|
|
cluster_offset = prev_cluster_offset;
|
|
|
|
cluster_time = prev_cluster_time;
|
|
|
|
|
|
|
|
/* If we have video and can easily backtrack, check if we landed on a cluster
|
|
|
|
* that starts with a keyframe - and if not backtrack until we find one that
|
|
|
|
* does. */
|
2018-08-15 11:14:24 +00:00
|
|
|
if (demux->have_nonintraonly_v_streams && demux->max_backtrack_distance > 0) {
|
2018-08-15 11:53:34 +00:00
|
|
|
if (gst_matroska_demux_scan_back_for_keyframe_cluster (demux,
|
|
|
|
&cluster_offset, &cluster_time)) {
|
|
|
|
GST_INFO_OBJECT (demux, "Adjusted cluster to %" GST_TIME_FORMAT " @ "
|
|
|
|
"%" G_GUINT64_FORMAT, GST_TIME_ARGS (cluster_time), cluster_offset);
|
2018-08-08 11:37:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-22 10:05:26 +00:00
|
|
|
entry = g_new0 (GstMatroskaIndex, 1);
|
2018-08-08 11:37:54 +00:00
|
|
|
entry->time = cluster_time;
|
|
|
|
entry->pos = cluster_offset - demux->common.ebml_segment_start;
|
2010-07-22 10:05:26 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "simulated index entry; time %" GST_TIME_FORMAT
|
|
|
|
", pos %" G_GUINT64_FORMAT, GST_TIME_ARGS (entry->time), entry->pos);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
|
|
|
|
/* restore some state */
|
|
|
|
demux->cluster_offset = current_cluster_offset;
|
|
|
|
demux->cluster_time = current_cluster_time;
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = current_offset;
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = current_state;
|
2010-07-22 10:05:26 +00:00
|
|
|
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
|
2008-08-02 18:35:21 +00:00
|
|
|
GstPad * pad, GstEvent * event)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2009-05-11 16:21:13 +00:00
|
|
|
GstMatroskaIndex *entry = NULL;
|
2010-07-22 10:05:26 +00:00
|
|
|
GstMatroskaIndex scan_entry;
|
2005-10-18 18:12:31 +00:00
|
|
|
GstSeekFlags flags;
|
|
|
|
GstSeekType cur_type, stop_type;
|
|
|
|
GstFormat format;
|
2012-04-26 11:47:27 +00:00
|
|
|
gboolean flush, keyunit, before, after, snap_next;
|
2005-10-18 18:12:31 +00:00
|
|
|
gdouble rate;
|
|
|
|
gint64 cur, stop;
|
2009-05-11 13:36:46 +00:00
|
|
|
GstMatroskaTrackContext *track = NULL;
|
2010-01-11 16:50:35 +00:00
|
|
|
GstSegment seeksegment = { 0, };
|
2011-10-06 11:04:54 +00:00
|
|
|
gboolean update = TRUE;
|
2012-03-10 13:44:08 +00:00
|
|
|
gboolean pad_locked = FALSE;
|
2013-07-25 04:39:58 +00:00
|
|
|
guint32 seqnum;
|
2015-01-30 15:30:40 +00:00
|
|
|
GstSearchMode snap_dir;
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
2008-08-02 18:35:21 +00:00
|
|
|
|
2009-05-11 13:36:46 +00:00
|
|
|
if (pad)
|
|
|
|
track = gst_pad_get_element_private (pad);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2015-01-30 15:30:40 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Have seek %" GST_PTR_FORMAT, event);
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
|
|
|
|
&stop_type, &stop);
|
2013-07-25 04:39:58 +00:00
|
|
|
seqnum = gst_event_get_seqnum (event);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
/* we can only seek on time */
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Can only seek on TIME");
|
2005-10-18 18:12:31 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-01-11 16:50:35 +00:00
|
|
|
/* copy segment, we need this because we still need the old
|
|
|
|
* segment when we close the current segment. */
|
2011-06-05 17:15:55 +00:00
|
|
|
memcpy (&seeksegment, &demux->common.segment, sizeof (GstSegment));
|
2010-01-11 16:50:35 +00:00
|
|
|
|
2011-12-21 16:43:10 +00:00
|
|
|
/* pull mode without index means that the actual duration is not known,
|
|
|
|
* we might be playing a file that's still being recorded
|
|
|
|
* so, invalidate our current duration, which is only a moving target,
|
|
|
|
* and should not be used to clamp anything */
|
2012-01-10 13:32:32 +00:00
|
|
|
if (!demux->streaming && !demux->common.index && demux->invalid_duration) {
|
|
|
|
seeksegment.duration = GST_CLOCK_TIME_NONE;
|
2011-12-21 16:43:10 +00:00
|
|
|
}
|
|
|
|
|
2015-01-30 15:30:40 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "configuring seek");
|
|
|
|
/* Subtract stream_start_time so we always seek on a segment
|
|
|
|
* in stream time */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (demux->stream_start_time)) {
|
|
|
|
seeksegment.start -= demux->stream_start_time;
|
|
|
|
seeksegment.position -= demux->stream_start_time;
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (seeksegment.stop))
|
|
|
|
seeksegment.stop -= demux->stream_start_time;
|
|
|
|
else
|
|
|
|
seeksegment.stop = seeksegment.duration;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_segment_do_seek (&seeksegment, rate, format, flags,
|
|
|
|
cur_type, cur, stop_type, stop, &update);
|
|
|
|
|
|
|
|
/* Restore the clip timestamp offset */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (demux->stream_start_time)) {
|
|
|
|
seeksegment.position += demux->stream_start_time;
|
|
|
|
seeksegment.start += demux->stream_start_time;
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (seeksegment.stop))
|
|
|
|
seeksegment.stop = seeksegment.duration;
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (seeksegment.stop))
|
|
|
|
seeksegment.stop += demux->stream_start_time;
|
2010-01-11 16:50:35 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 16:43:10 +00:00
|
|
|
/* restore segment duration (if any effect),
|
|
|
|
* would be determined again when parsing, but anyway ... */
|
2012-01-10 13:32:32 +00:00
|
|
|
seeksegment.duration = demux->common.segment.duration;
|
2011-12-21 16:43:10 +00:00
|
|
|
|
2018-11-28 03:52:16 +00:00
|
|
|
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
|
|
|
|
keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
|
|
|
|
after = ! !(flags & GST_SEEK_FLAG_SNAP_AFTER);
|
|
|
|
before = ! !(flags & GST_SEEK_FLAG_SNAP_BEFORE);
|
2011-10-06 11:04:54 +00:00
|
|
|
|
2012-06-11 10:54:27 +00:00
|
|
|
/* always do full update if flushing,
|
|
|
|
* otherwise problems might arise downstream with missing keyframes etc */
|
|
|
|
update = update || flush;
|
|
|
|
|
2010-01-11 16:50:35 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "New segment %" GST_SEGMENT_FORMAT, &seeksegment);
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
/* check sanity before we start flushing and all that */
|
2012-04-26 11:47:27 +00:00
|
|
|
snap_next = after && !before;
|
|
|
|
if (seeksegment.rate < 0)
|
2015-01-30 15:30:40 +00:00
|
|
|
snap_dir = snap_next ? GST_SEARCH_MODE_BEFORE : GST_SEARCH_MODE_AFTER;
|
|
|
|
else
|
|
|
|
snap_dir = snap_next ? GST_SEARCH_MODE_AFTER : GST_SEARCH_MODE_BEFORE;
|
|
|
|
|
2010-01-11 16:50:35 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-05-30 05:10:08 +00:00
|
|
|
track = gst_matroska_read_common_get_seek_track (&demux->common, track);
|
2011-05-28 05:29:09 +00:00
|
|
|
if ((entry = gst_matroska_read_common_do_index_seek (&demux->common, track,
|
2012-04-26 11:47:27 +00:00
|
|
|
seeksegment.position, &demux->seek_index, &demux->seek_entry,
|
2015-01-30 15:30:40 +00:00
|
|
|
snap_dir)) == NULL) {
|
2010-07-22 10:05:26 +00:00
|
|
|
/* pull mode without index can scan later on */
|
2011-12-21 14:06:57 +00:00
|
|
|
if (demux->streaming) {
|
2010-07-22 10:05:26 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "No matching seek entry in index");
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
return FALSE;
|
2012-07-20 12:25:43 +00:00
|
|
|
} else if (rate < 0.0) {
|
|
|
|
/* FIXME: We should build an index during playback or when scanning
|
|
|
|
* that can be used here. The reverse playback code requires seek_index
|
|
|
|
* and seek_entry to be set!
|
|
|
|
*/
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"No matching seek entry in index, needed for reverse playback");
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
return FALSE;
|
2010-07-22 10:05:26 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2010-01-11 16:50:35 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Seek position looks sane");
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2012-07-20 12:25:43 +00:00
|
|
|
if (!update) {
|
|
|
|
/* only have to update some segment,
|
|
|
|
* but also still have to honour flush and so on */
|
|
|
|
GST_DEBUG_OBJECT (demux, "... no update");
|
|
|
|
/* bad goto, bad ... */
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
2012-07-24 14:41:51 +00:00
|
|
|
if (demux->streaming)
|
|
|
|
goto finish;
|
2010-04-14 09:53:46 +00:00
|
|
|
|
2011-10-06 11:04:54 +00:00
|
|
|
next:
|
2005-10-18 18:12:31 +00:00
|
|
|
if (flush) {
|
2013-07-25 04:39:58 +00:00
|
|
|
GstEvent *flush_event = gst_event_new_flush_start ();
|
|
|
|
gst_event_set_seqnum (flush_event, seqnum);
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Starting flush");
|
2013-07-25 04:39:58 +00:00
|
|
|
gst_pad_push_event (demux->common.sinkpad, gst_event_ref (flush_event));
|
|
|
|
gst_matroska_demux_send_event (demux, flush_event);
|
2005-10-18 18:12:31 +00:00
|
|
|
} else {
|
2010-01-11 16:50:35 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Non-flushing seek, pausing task");
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_pad_pause_task (demux->common.sinkpad);
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2011-10-06 11:04:54 +00:00
|
|
|
/* ouch */
|
2013-06-14 12:09:50 +00:00
|
|
|
if (!update) {
|
|
|
|
GST_PAD_STREAM_LOCK (demux->common.sinkpad);
|
2013-07-09 09:17:59 +00:00
|
|
|
pad_locked = TRUE;
|
2011-10-06 11:04:54 +00:00
|
|
|
goto exit;
|
2013-06-14 12:09:50 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
/* now grab the stream lock so that streaming cannot continue, for
|
|
|
|
* non flushing seeks when the element is in PAUSED this could block
|
|
|
|
* forever. */
|
2010-01-11 16:50:35 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Waiting for streaming to stop");
|
2011-05-23 15:06:44 +00:00
|
|
|
GST_PAD_STREAM_LOCK (demux->common.sinkpad);
|
2012-03-10 13:44:08 +00:00
|
|
|
pad_locked = TRUE;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-07-22 10:05:26 +00:00
|
|
|
/* pull mode without index can do some scanning */
|
2011-12-21 14:06:57 +00:00
|
|
|
if (!demux->streaming && !entry) {
|
2013-07-25 04:39:58 +00:00
|
|
|
GstEvent *flush_event;
|
|
|
|
|
2010-07-22 10:05:26 +00:00
|
|
|
/* need to stop flushing upstream as we need it next */
|
2013-07-25 04:39:58 +00:00
|
|
|
if (flush) {
|
|
|
|
flush_event = gst_event_new_flush_stop (TRUE);
|
|
|
|
gst_event_set_seqnum (flush_event, seqnum);
|
|
|
|
gst_pad_push_event (demux->common.sinkpad, flush_event);
|
|
|
|
}
|
2011-11-26 09:01:07 +00:00
|
|
|
entry = gst_matroska_demux_search_pos (demux, seeksegment.position);
|
2010-07-22 10:05:26 +00:00
|
|
|
/* keep local copy */
|
|
|
|
if (entry) {
|
|
|
|
scan_entry = *entry;
|
|
|
|
g_free (entry);
|
|
|
|
entry = &scan_entry;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Scan failed to find matching position");
|
2013-07-25 04:39:58 +00:00
|
|
|
if (flush) {
|
|
|
|
flush_event = gst_event_new_flush_stop (TRUE);
|
|
|
|
gst_event_set_seqnum (flush_event, seqnum);
|
|
|
|
gst_matroska_demux_send_event (demux, flush_event);
|
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
goto seek_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-24 14:41:51 +00:00
|
|
|
finish:
|
2016-12-29 11:39:20 +00:00
|
|
|
if (keyunit && seeksegment.rate > 0) {
|
2012-04-26 11:47:27 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "seek to key unit, adjusting segment start from %"
|
|
|
|
GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (seeksegment.start), GST_TIME_ARGS (entry->time));
|
2011-12-13 17:15:18 +00:00
|
|
|
seeksegment.start = MAX (entry->time, demux->stream_start_time);
|
2012-01-10 13:32:32 +00:00
|
|
|
seeksegment.position = seeksegment.start;
|
2011-12-13 17:15:18 +00:00
|
|
|
seeksegment.time = seeksegment.start - demux->stream_start_time;
|
2016-12-29 11:39:20 +00:00
|
|
|
} else if (keyunit) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "seek to key unit, adjusting segment stop from %"
|
|
|
|
GST_TIME_FORMAT " to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (seeksegment.stop), GST_TIME_ARGS (entry->time));
|
|
|
|
seeksegment.stop = MAX (entry->time, demux->stream_start_time);
|
|
|
|
seeksegment.position = seeksegment.stop;
|
2006-04-20 13:23:40 +00:00
|
|
|
}
|
|
|
|
|
2012-07-24 14:41:51 +00:00
|
|
|
if (demux->streaming) {
|
|
|
|
GST_OBJECT_LOCK (demux);
|
2012-07-24 19:11:18 +00:00
|
|
|
/* track real position we should start at */
|
|
|
|
GST_DEBUG_OBJECT (demux, "storing segment start");
|
|
|
|
demux->requested_seek_time = seeksegment.position;
|
|
|
|
demux->seek_offset = entry->pos + demux->common.ebml_segment_start;
|
2012-07-24 14:41:51 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
/* need to seek to cluster start to pick up cluster time */
|
|
|
|
/* upstream takes care of flushing and all that
|
|
|
|
* ... and newsegment event handling takes care of the rest */
|
|
|
|
return perform_seek_to_offset (demux, rate,
|
2016-05-04 12:50:32 +00:00
|
|
|
entry->pos + demux->common.ebml_segment_start, seqnum, flags);
|
2012-07-24 14:41:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-06 11:04:54 +00:00
|
|
|
exit:
|
2008-08-08 16:20:26 +00:00
|
|
|
if (flush) {
|
2013-07-25 04:39:58 +00:00
|
|
|
GstEvent *flush_event = gst_event_new_flush_stop (TRUE);
|
|
|
|
gst_event_set_seqnum (flush_event, seqnum);
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Stopping flush");
|
2013-07-25 04:39:58 +00:00
|
|
|
gst_pad_push_event (demux->common.sinkpad, gst_event_ref (flush_event));
|
|
|
|
gst_matroska_demux_send_event (demux, flush_event);
|
2008-08-08 16:20:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (demux);
|
2010-01-11 16:50:35 +00:00
|
|
|
/* now update the real segment info */
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Committing new seek segment");
|
2011-06-05 17:15:55 +00:00
|
|
|
memcpy (&demux->common.segment, &seeksegment, sizeof (GstSegment));
|
2006-04-20 11:00:16 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
/* update some (segment) state */
|
2012-07-20 13:28:21 +00:00
|
|
|
if (!gst_matroska_demux_move_to_entry (demux, entry, TRUE, update))
|
2010-03-23 16:34:50 +00:00
|
|
|
goto seek_error;
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
/* notify start of new segment */
|
2011-06-05 17:15:55 +00:00
|
|
|
if (demux->common.segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
2005-10-18 18:12:31 +00:00
|
|
|
GstMessage *msg;
|
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
msg = gst_message_new_segment_start (GST_OBJECT (demux),
|
2011-06-05 17:15:55 +00:00
|
|
|
GST_FORMAT_TIME, demux->common.segment.start);
|
2013-07-25 04:39:58 +00:00
|
|
|
gst_message_set_seqnum (msg, seqnum);
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_element_post_message (GST_ELEMENT (demux), msg);
|
|
|
|
}
|
|
|
|
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
if (demux->new_segment)
|
|
|
|
gst_event_unref (demux->new_segment);
|
2012-07-20 09:07:58 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
/* On port from 0.10, discarded !update (for segment.update) here, FIXME? */
|
|
|
|
demux->new_segment = gst_event_new_segment (&demux->common.segment);
|
2013-07-25 04:39:58 +00:00
|
|
|
gst_event_set_seqnum (demux->new_segment, seqnum);
|
2012-07-20 09:07:58 +00:00
|
|
|
if (demux->common.segment.rate < 0 && demux->common.segment.stop == -1)
|
|
|
|
demux->to_time = demux->common.segment.position;
|
|
|
|
else
|
|
|
|
demux->to_time = GST_CLOCK_TIME_NONE;
|
2016-05-20 07:56:52 +00:00
|
|
|
demux->segment_seqnum = seqnum;
|
2008-08-08 16:20:26 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
/* restart our task since it might have been stopped when we did the
|
|
|
|
* flush. */
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_pad_start_task (demux->common.sinkpad,
|
2012-06-20 08:33:42 +00:00
|
|
|
(GstTaskFunction) gst_matroska_demux_loop, demux->common.sinkpad, NULL);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
/* streaming can continue now */
|
2012-03-10 13:44:08 +00:00
|
|
|
if (pad_locked) {
|
|
|
|
GST_PAD_STREAM_UNLOCK (demux->common.sinkpad);
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
seek_error:
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
{
|
2012-03-10 13:44:08 +00:00
|
|
|
if (pad_locked) {
|
|
|
|
GST_PAD_STREAM_UNLOCK (demux->common.sinkpad);
|
|
|
|
}
|
2010-02-16 01:40:19 +00:00
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Got a seek error"));
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
/*
|
|
|
|
* Handle whether we can perform the seek event or if we have to let the chain
|
|
|
|
* function handle seeks to build the seek indexes first.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_handle_seek_push (GstMatroskaDemux * demux, GstPad * pad,
|
|
|
|
GstEvent * event)
|
|
|
|
{
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstSeekType cur_type, stop_type;
|
|
|
|
GstFormat format;
|
|
|
|
gdouble rate;
|
|
|
|
gint64 cur, stop;
|
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
|
|
|
|
&stop_type, &stop);
|
|
|
|
|
|
|
|
/* sanity checks */
|
|
|
|
|
|
|
|
/* we can only seek on time */
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Can only seek on TIME");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stop_type != GST_SEEK_TYPE_NONE && stop != GST_CLOCK_TIME_NONE) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Seek end-time not supported in streaming mode");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(flags & GST_SEEK_FLAG_FLUSH)) {
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Non-flushing seek not supported in streaming mode");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & GST_SEEK_FLAG_SEGMENT) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Segment seek not supported in streaming mode");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for having parsed index already */
|
2011-05-23 15:06:44 +00:00
|
|
|
if (!demux->common.index_parsed) {
|
2010-04-14 09:53:46 +00:00
|
|
|
gboolean building_index;
|
2010-05-01 10:06:53 +00:00
|
|
|
guint64 offset = 0;
|
2010-04-14 09:53:46 +00:00
|
|
|
|
|
|
|
if (!demux->index_offset) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "no index (location); no seek in push mode");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
/* handle the seek event in the chain function */
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_SEEK;
|
2010-04-14 09:53:46 +00:00
|
|
|
/* no more seek can be issued until state reset to _DATA */
|
|
|
|
|
|
|
|
/* copy the event */
|
|
|
|
if (demux->seek_event)
|
|
|
|
gst_event_unref (demux->seek_event);
|
|
|
|
demux->seek_event = gst_event_ref (event);
|
|
|
|
|
|
|
|
/* set the building_index flag so that only one thread can setup the
|
|
|
|
* structures for index seeking. */
|
|
|
|
building_index = demux->building_index;
|
|
|
|
if (!building_index) {
|
|
|
|
demux->building_index = TRUE;
|
|
|
|
offset = demux->index_offset;
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
|
|
|
|
if (!building_index) {
|
|
|
|
/* seek to the first subindex or legacy index */
|
|
|
|
GST_INFO_OBJECT (demux, "Seeking to Cues at %" G_GUINT64_FORMAT, offset);
|
2013-09-10 20:57:49 +00:00
|
|
|
return perform_seek_to_offset (demux, rate, offset,
|
2016-05-04 12:50:32 +00:00
|
|
|
gst_event_get_seqnum (event), GST_SEEK_FLAG_NONE);
|
2010-04-14 09:53:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* well, we are handling it already */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* delegate to tweaked regular seek */
|
|
|
|
return gst_matroska_demux_handle_seek_event (demux, pad, event);
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
static gboolean
|
2011-11-28 17:25:52 +00:00
|
|
|
gst_matroska_demux_handle_src_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (parent);
|
2003-11-21 21:34:27 +00:00
|
|
|
gboolean res = TRUE;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
2010-04-14 09:53:46 +00:00
|
|
|
/* no seeking until we are (safely) ready */
|
2011-05-23 15:48:57 +00:00
|
|
|
if (demux->common.state != GST_MATROSKA_READ_STATE_DATA) {
|
2018-11-14 07:57:55 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"not ready for seeking yet, deferring seek event: %" GST_PTR_FORMAT,
|
|
|
|
event);
|
|
|
|
if (demux->deferred_seek_event)
|
|
|
|
gst_event_unref (demux->deferred_seek_event);
|
|
|
|
demux->deferred_seek_event = event;
|
|
|
|
demux->deferred_seek_pad = pad;
|
|
|
|
return TRUE;
|
2010-04-14 09:53:46 +00:00
|
|
|
}
|
2017-03-21 13:38:51 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
guint32 seqnum = gst_event_get_seqnum (event);
|
|
|
|
if (seqnum == demux->segment_seqnum) {
|
|
|
|
GST_LOG_OBJECT (pad,
|
|
|
|
"Drop duplicated SEEK event seqnum %" G_GUINT32_FORMAT, seqnum);
|
|
|
|
gst_event_unref (event);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
if (!demux->streaming)
|
|
|
|
res = gst_matroska_demux_handle_seek_event (demux, pad, event);
|
|
|
|
else
|
|
|
|
res = gst_matroska_demux_handle_seek_push (demux, pad, event);
|
2008-10-27 10:35:07 +00:00
|
|
|
gst_event_unref (event);
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-23 07:32:08 +00:00
|
|
|
case GST_EVENT_QOS:
|
|
|
|
{
|
|
|
|
GstMatroskaTrackContext *context = gst_pad_get_element_private (pad);
|
|
|
|
if (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
|
|
|
|
GstMatroskaTrackVideoContext *videocontext =
|
|
|
|
(GstMatroskaTrackVideoContext *) context;
|
|
|
|
gdouble proportion;
|
|
|
|
GstClockTimeDiff diff;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_event_parse_qos (event, NULL, &proportion, &diff, ×tamp);
|
2010-05-23 07:32:08 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
videocontext->earliest_time = timestamp + diff;
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
}
|
|
|
|
res = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-29 19:12:13 +00:00
|
|
|
case GST_EVENT_TOC_SELECT:
|
|
|
|
{
|
|
|
|
char *uid = NULL;
|
|
|
|
GstTocEntry *entry = NULL;
|
|
|
|
GstEvent *seek_event;
|
|
|
|
gint64 start_pos;
|
|
|
|
|
|
|
|
if (!demux->common.toc) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "no TOC to select");
|
|
|
|
return FALSE;
|
|
|
|
} else {
|
|
|
|
gst_event_parse_toc_select (event, &uid);
|
|
|
|
if (uid != NULL) {
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
entry = gst_toc_find_entry (demux->common.toc, uid);
|
|
|
|
if (entry == NULL) {
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
GST_WARNING_OBJECT (demux, "no TOC entry with given UID: %s", uid);
|
|
|
|
res = FALSE;
|
|
|
|
} else {
|
2012-07-04 17:52:22 +00:00
|
|
|
gst_toc_entry_get_start_stop_times (entry, &start_pos, NULL);
|
2012-03-29 19:12:13 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
seek_event = gst_event_new_seek (1.0,
|
|
|
|
GST_FORMAT_TIME,
|
|
|
|
GST_SEEK_FLAG_FLUSH,
|
|
|
|
GST_SEEK_TYPE_SET, start_pos, GST_SEEK_TYPE_SET, -1);
|
|
|
|
res = gst_matroska_demux_handle_seek_event (demux, pad, seek_event);
|
|
|
|
gst_event_unref (seek_event);
|
|
|
|
}
|
|
|
|
g_free (uid);
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (demux, "received empty TOC select event");
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-07-18 16:58:08 +00:00
|
|
|
/* events we don't need to handle */
|
|
|
|
case GST_EVENT_NAVIGATION:
|
2008-10-27 10:35:07 +00:00
|
|
|
gst_event_unref (event);
|
2006-04-25 16:38:50 +00:00
|
|
|
res = FALSE;
|
2004-07-18 16:58:08 +00:00
|
|
|
break;
|
|
|
|
|
2008-10-27 10:35:07 +00:00
|
|
|
case GST_EVENT_LATENCY:
|
2003-11-21 21:34:27 +00:00
|
|
|
default:
|
2011-05-23 15:06:44 +00:00
|
|
|
res = gst_pad_push_event (demux->common.sinkpad, event);
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2018-05-17 11:58:25 +00:00
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_handle_sink_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query)
|
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (parent);
|
|
|
|
gboolean res = FALSE;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_BITRATE:
|
|
|
|
{
|
|
|
|
if (G_UNLIKELY (demux->cached_length == G_MAXUINT64 ||
|
|
|
|
demux->common.offset >= demux->cached_length)) {
|
|
|
|
demux->cached_length =
|
|
|
|
gst_matroska_read_common_get_length (&demux->common);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (demux->cached_length < G_MAXUINT64
|
|
|
|
&& demux->common.segment.duration > 0) {
|
|
|
|
/* TODO: better results based on ranges/index tables */
|
|
|
|
guint bitrate =
|
|
|
|
gst_util_uint64_scale (8 * demux->cached_length, GST_SECOND,
|
|
|
|
demux->common.segment.duration);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "bitrate query byte length: %" G_GUINT64_FORMAT
|
|
|
|
" duration %" GST_TIME_FORMAT " resulting in a bitrate of %u",
|
|
|
|
demux->cached_length,
|
|
|
|
GST_TIME_ARGS (demux->common.segment.duration), bitrate);
|
|
|
|
|
|
|
|
gst_query_set_bitrate (query, bitrate);
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_query_default (pad, (GstObject *) demux, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_seek_to_previous_keyframe (GstMatroskaDemux * demux)
|
|
|
|
{
|
2012-01-03 14:26:21 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_EOS;
|
2010-03-23 16:34:50 +00:00
|
|
|
gboolean done = TRUE;
|
|
|
|
gint i;
|
|
|
|
|
2012-01-03 14:26:21 +00:00
|
|
|
g_return_val_if_fail (demux->seek_index, GST_FLOW_EOS);
|
2010-03-23 16:34:50 +00:00
|
|
|
g_return_val_if_fail (demux->seek_entry < demux->seek_index->len,
|
2012-01-03 14:26:21 +00:00
|
|
|
GST_FLOW_EOS);
|
2010-03-23 16:34:50 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "locating previous keyframe");
|
|
|
|
|
|
|
|
if (!demux->seek_entry) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "no earlier index entry");
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
for (i = 0; i < demux->common.src->len; i++) {
|
|
|
|
GstMatroskaTrackContext *stream = g_ptr_array_index (demux->common.src, i);
|
2010-03-23 16:34:50 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "segment start %" GST_TIME_FORMAT
|
|
|
|
", stream %d at %" GST_TIME_FORMAT,
|
2011-06-05 17:15:55 +00:00
|
|
|
GST_TIME_ARGS (demux->common.segment.start), stream->index,
|
2010-03-23 16:34:50 +00:00
|
|
|
GST_TIME_ARGS (stream->from_time));
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (stream->from_time)) {
|
2011-06-05 17:15:55 +00:00
|
|
|
if (stream->from_time > demux->common.segment.start) {
|
2010-03-23 16:34:50 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "stream %d not finished yet", stream->index);
|
|
|
|
done = FALSE;
|
|
|
|
}
|
2010-05-28 14:37:32 +00:00
|
|
|
} else {
|
|
|
|
/* nothing pushed for this stream;
|
|
|
|
* likely seek entry did not start at keyframe, so all was skipped.
|
|
|
|
* So we need an earlier entry */
|
|
|
|
done = FALSE;
|
2010-03-23 16:34:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!done) {
|
|
|
|
GstMatroskaIndex *entry;
|
|
|
|
|
|
|
|
entry = &g_array_index (demux->seek_index, GstMatroskaIndex,
|
|
|
|
--demux->seek_entry);
|
2012-07-20 13:28:21 +00:00
|
|
|
if (!gst_matroska_demux_move_to_entry (demux, entry, FALSE, TRUE))
|
2010-03-23 16:34:50 +00:00
|
|
|
goto exit;
|
2010-05-28 14:37:32 +00:00
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-12-16 11:43:27 +00:00
|
|
|
static GstFlowReturn
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_matroska_demux_parse_tracks (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2003-11-21 21:34:27 +00:00
|
|
|
guint32 id;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "Tracks");
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "Tracks", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
switch (id) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* one track within the "all-tracks" header */
|
2018-09-21 14:23:57 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKENTRY:{
|
|
|
|
GstMatroskaTrackContext *track;
|
|
|
|
ret = gst_matroska_demux_parse_stream (demux, ebml, &track);
|
|
|
|
if (track != NULL) {
|
|
|
|
if (gst_matroska_read_common_tracknumber_unique (&demux->common,
|
|
|
|
track->num)) {
|
|
|
|
gst_matroska_demux_add_stream (demux, track);
|
|
|
|
} else {
|
|
|
|
GST_ERROR_OBJECT (demux,
|
|
|
|
"TrackNumber %" G_GUINT64_FORMAT " is not unique", track->num);
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
gst_matroska_track_free (track);
|
|
|
|
track = NULL;
|
|
|
|
}
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2018-09-21 14:23:57 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
default:
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_parse_skip (&demux->common, ebml,
|
|
|
|
"Track", id);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "Tracks", ret);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2008-06-13 19:07:03 +00:00
|
|
|
demux->tracks_parsed = TRUE;
|
2018-09-21 20:24:02 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "signaling no more pads");
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT (demux));
|
2008-06-13 19:07:03 +00:00
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2018-09-21 18:38:02 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_update_tracks (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
guint num_tracks_found = 0;
|
|
|
|
guint32 id;
|
|
|
|
|
|
|
|
GST_INFO_OBJECT (demux, "Reparsing Tracks element");
|
|
|
|
|
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "Tracks");
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "Tracks", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
/* one track within the "all-tracks" header */
|
|
|
|
case GST_MATROSKA_ID_TRACKENTRY:{
|
|
|
|
GstMatroskaTrackContext *new_track;
|
|
|
|
gint old_track_index;
|
|
|
|
GstMatroskaTrackContext *old_track;
|
|
|
|
ret = gst_matroska_demux_parse_stream (demux, ebml, &new_track);
|
|
|
|
if (new_track == NULL)
|
|
|
|
break;
|
|
|
|
num_tracks_found++;
|
|
|
|
|
|
|
|
if (gst_matroska_read_common_tracknumber_unique (&demux->common,
|
|
|
|
new_track->num)) {
|
|
|
|
GST_ERROR_OBJECT (demux,
|
|
|
|
"Unexpected new TrackNumber: %" G_GUINT64_FORMAT, new_track->num);
|
|
|
|
goto track_mismatch_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
old_track_index =
|
|
|
|
gst_matroska_read_common_stream_from_num (&demux->common,
|
|
|
|
new_track->num);
|
|
|
|
g_assert (old_track_index != -1);
|
|
|
|
old_track = g_ptr_array_index (demux->common.src, old_track_index);
|
|
|
|
|
|
|
|
if (old_track->type != new_track->type) {
|
|
|
|
GST_ERROR_OBJECT (demux,
|
|
|
|
"Mismatch reparsing track %" G_GUINT64_FORMAT
|
|
|
|
" on track type. Expected %d, found %d", new_track->num,
|
|
|
|
old_track->type, new_track->type);
|
|
|
|
goto track_mismatch_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_strcmp0 (old_track->codec_id, new_track->codec_id) != 0) {
|
|
|
|
GST_ERROR_OBJECT (demux,
|
|
|
|
"Mismatch reparsing track %" G_GUINT64_FORMAT
|
|
|
|
" on codec id. Expected '%s', found '%s'", new_track->num,
|
|
|
|
old_track->codec_id, new_track->codec_id);
|
|
|
|
goto track_mismatch_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The new track matches the old track. No problems on our side.
|
|
|
|
* Let's make it replace the old track. */
|
|
|
|
new_track->pad = old_track->pad;
|
|
|
|
new_track->index = old_track->index;
|
|
|
|
new_track->pos = old_track->pos;
|
|
|
|
g_ptr_array_index (demux->common.src, old_track_index) = new_track;
|
|
|
|
gst_pad_set_element_private (new_track->pad, new_track);
|
|
|
|
|
|
|
|
if (!gst_caps_is_equal (old_track->caps, new_track->caps)) {
|
|
|
|
gst_pad_set_caps (new_track->pad, new_track->caps);
|
|
|
|
}
|
2018-10-17 10:58:08 +00:00
|
|
|
gst_caps_replace (&old_track->caps, NULL);
|
2018-09-21 18:38:02 +00:00
|
|
|
|
|
|
|
if (!gst_tag_list_is_equal (old_track->tags, new_track->tags)) {
|
|
|
|
GST_DEBUG_OBJECT (old_track->pad, "Sending tags %p: %"
|
|
|
|
GST_PTR_FORMAT, new_track->tags, new_track->tags);
|
|
|
|
gst_pad_push_event (new_track->pad,
|
|
|
|
gst_event_new_tag (gst_tag_list_copy (new_track->tags)));
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_matroska_track_free (old_track);
|
|
|
|
break;
|
|
|
|
|
|
|
|
track_mismatch_error:
|
|
|
|
gst_matroska_track_free (new_track);
|
|
|
|
new_track = NULL;
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
ret = gst_matroska_read_common_parse_skip (&demux->common, ebml,
|
|
|
|
"Track", id);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "Tracks", ret);
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_ERROR && demux->common.num_streams != num_tracks_found) {
|
|
|
|
GST_ERROR_OBJECT (demux,
|
|
|
|
"Mismatch on the number of tracks. Expected %du tracks, found %du",
|
|
|
|
demux->common.num_streams, num_tracks_found);
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/*
|
|
|
|
* Read signed/unsigned "EBML" numbers.
|
|
|
|
* Return: number of bytes processed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static gint
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_ebmlnum_uint (guint8 * data, guint size, guint64 * num)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
|
|
|
gint len_mask = 0x80, read = 1, n = 1, num_ffs = 0;
|
|
|
|
guint64 total;
|
|
|
|
|
|
|
|
if (size <= 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
total = data[0];
|
|
|
|
while (read <= 8 && !(total & len_mask)) {
|
|
|
|
read++;
|
|
|
|
len_mask >>= 1;
|
|
|
|
}
|
|
|
|
if (read > 8)
|
|
|
|
return -1;
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
if ((total &= (len_mask - 1)) == len_mask - 1)
|
|
|
|
num_ffs++;
|
|
|
|
if (size < read)
|
|
|
|
return -1;
|
|
|
|
while (n < read) {
|
|
|
|
if (data[n] == 0xff)
|
|
|
|
num_ffs++;
|
|
|
|
total = (total << 8) | data[n];
|
|
|
|
n++;
|
|
|
|
}
|
|
|
|
|
2004-12-18 22:40:24 +00:00
|
|
|
if (read == num_ffs && total != 0)
|
2003-11-21 21:34:27 +00:00
|
|
|
*num = G_MAXUINT64;
|
|
|
|
else
|
|
|
|
*num = total;
|
|
|
|
|
|
|
|
return read;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_ebmlnum_sint (guint8 * data, guint size, gint64 * num)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
|
|
|
guint64 unum;
|
|
|
|
gint res;
|
|
|
|
|
|
|
|
/* read as unsigned number first */
|
|
|
|
if ((res = gst_matroska_ebmlnum_uint (data, size, &unum)) < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
/* make signed */
|
2004-12-18 22:53:29 +00:00
|
|
|
if (unum == G_MAXUINT64)
|
2003-11-21 21:34:27 +00:00
|
|
|
*num = G_MAXINT64;
|
2004-12-18 22:40:24 +00:00
|
|
|
else
|
2004-12-18 22:53:29 +00:00
|
|
|
*num = unum - ((1 << ((7 * res) - 1)) - 1);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
/*
|
|
|
|
* Mostly used for subtitles. We add void filler data for each
|
|
|
|
* lagging stream to make sure we don't deadlock.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroska_demux_sync_streams (GstMatroskaDemux * demux)
|
|
|
|
{
|
2015-08-21 13:15:18 +00:00
|
|
|
GstClockTime gap_threshold;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
gint stream_nr;
|
|
|
|
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_LOG_OBJECT (demux, "Sync to %" GST_TIME_FORMAT,
|
2011-11-26 09:01:07 +00:00
|
|
|
GST_TIME_ARGS (demux->common.segment.position));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
g_assert (demux->common.num_streams == demux->common.src->len);
|
|
|
|
for (stream_nr = 0; stream_nr < demux->common.src->len; stream_nr++) {
|
2006-02-14 23:23:08 +00:00
|
|
|
GstMatroskaTrackContext *context;
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
context = g_ptr_array_index (demux->common.src, stream_nr);
|
2006-02-14 23:23:08 +00:00
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_LOG_OBJECT (demux,
|
|
|
|
"Checking for resync on stream %d (%" GST_TIME_FORMAT ")", stream_nr,
|
|
|
|
GST_TIME_ARGS (context->pos));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2015-08-21 13:15:18 +00:00
|
|
|
/* Only send gap events on non-subtitle streams if lagging way behind.
|
|
|
|
* The 0.5 second threshold for subtitle streams is also quite random. */
|
|
|
|
if (context->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
|
|
|
|
gap_threshold = GST_SECOND / 2;
|
|
|
|
else
|
|
|
|
gap_threshold = 3 * GST_SECOND;
|
2010-03-31 15:54:21 +00:00
|
|
|
|
2015-08-21 13:15:18 +00:00
|
|
|
/* Lag need only be considered if we have advanced into requested segment */
|
2010-01-28 17:58:08 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (context->pos) &&
|
2011-11-26 09:01:07 +00:00
|
|
|
GST_CLOCK_TIME_IS_VALID (demux->common.segment.position) &&
|
|
|
|
demux->common.segment.position > demux->common.segment.start &&
|
2015-08-21 13:15:18 +00:00
|
|
|
context->pos + gap_threshold < demux->common.segment.position) {
|
2012-04-30 20:59:58 +00:00
|
|
|
|
2011-05-04 09:55:21 +00:00
|
|
|
GstEvent *event;
|
2012-04-30 20:59:58 +00:00
|
|
|
guint64 start = context->pos;
|
2015-08-21 13:15:18 +00:00
|
|
|
guint64 stop = demux->common.segment.position - gap_threshold;
|
2010-02-26 17:10:32 +00:00
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
2012-04-30 20:59:58 +00:00
|
|
|
"Synchronizing stream %d with other by advancing time from %"
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_TIME_FORMAT " to %" GST_TIME_FORMAT, stream_nr,
|
2012-04-30 20:59:58 +00:00
|
|
|
GST_TIME_ARGS (start), GST_TIME_ARGS (stop));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2012-04-30 20:59:58 +00:00
|
|
|
context->pos = stop;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2012-04-30 20:59:58 +00:00
|
|
|
event = gst_event_new_gap (start, stop - start);
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
gst_pad_push_event (context->pad, event);
|
|
|
|
GST_OBJECT_LOCK (demux);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
}
|
2011-05-04 09:55:21 +00:00
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2012-09-27 23:43:38 +00:00
|
|
|
gst_matroska_demux_push_stream_headers (GstMatroskaDemux * demux,
|
gst/matroska/: not perfect yet though, needs some tweaking in flacdec; also, seeking could be better.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(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:
Add basic FLAC support (#311586), not perfect yet though, needs some
tweaking in flacdec; also, seeking could be better.
Do better bounds checking when deserialising vorbis stream headers
to make sure we don't read beyond the end of the buffer on bad input.
2006-09-04 15:06:25 +00:00
|
|
|
GstMatroskaTrackContext * stream)
|
|
|
|
{
|
2012-09-27 23:43:38 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
gint i, num;
|
2009-04-13 12:03:03 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
num = gst_buffer_list_length (stream->stream_headers);
|
|
|
|
for (i = 0; i < num; ++i) {
|
|
|
|
GstBuffer *buf;
|
2009-04-13 12:03:03 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
buf = gst_buffer_list_get (stream->stream_headers, i);
|
|
|
|
buf = gst_buffer_copy (buf);
|
2009-04-13 12:03:03 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_HEADER);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
if (stream->set_discont) {
|
|
|
|
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
stream->set_discont = FALSE;
|
2013-07-17 15:11:44 +00:00
|
|
|
} else {
|
|
|
|
GST_BUFFER_FLAG_UNSET (buf, GST_BUFFER_FLAG_DISCONT);
|
2009-05-07 13:58:43 +00:00
|
|
|
}
|
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
/* push out all headers in one go and use last flow return */
|
|
|
|
ret = gst_pad_push (stream->pad, buf);
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
/* don't need these any longer */
|
|
|
|
gst_buffer_list_unref (stream->stream_headers);
|
|
|
|
stream->stream_headers = NULL;
|
gst/matroska/: not perfect yet though, needs some tweaking in flacdec; also, seeking could be better.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(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:
Add basic FLAC support (#311586), not perfect yet though, needs some
tweaking in flacdec; also, seeking could be better.
Do better bounds checking when deserialising vorbis stream headers
to make sure we don't read beyond the end of the buffer on bad input.
2006-09-04 15:06:25 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
/* combine flows */
|
2014-05-26 16:21:25 +00:00
|
|
|
ret = gst_flow_combiner_update_flow (demux->flowcombiner, ret);
|
gst/matroska/: not perfect yet though, needs some tweaking in flacdec; also, seeking could be better.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(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:
Add basic FLAC support (#311586), not perfect yet though, needs some
tweaking in flacdec; also, seeking could be better.
Do better bounds checking when deserialising vorbis stream headers
to make sure we don't read beyond the end of the buffer on bad input.
2006-09-04 15:06:25 +00:00
|
|
|
|
2012-09-27 23:43:38 +00:00
|
|
|
return ret;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
2007-11-13 17:01:07 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_push_dvd_clut_change_event (GstMatroskaDemux * demux,
|
|
|
|
GstMatroskaTrackContext * stream)
|
|
|
|
{
|
|
|
|
gchar *buf, *start;
|
|
|
|
|
|
|
|
g_assert (!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB));
|
|
|
|
|
|
|
|
if (!stream->codec_priv)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* ideally, VobSub private data should be parsed and stored more convenient
|
|
|
|
* elsewhere, but for now, only interested in a small part */
|
|
|
|
|
|
|
|
/* make sure we have terminating 0 */
|
2011-11-26 09:01:07 +00:00
|
|
|
buf = g_strndup (stream->codec_priv, stream->codec_priv_size);
|
2007-11-13 17:01:07 +00:00
|
|
|
|
|
|
|
/* just locate and parse palette part */
|
2009-05-16 10:52:50 +00:00
|
|
|
start = strstr (buf, "palette:");
|
2007-11-13 17:01:07 +00:00
|
|
|
if (start) {
|
|
|
|
gint i;
|
2008-05-12 16:35:39 +00:00
|
|
|
guint32 clut[16];
|
|
|
|
guint32 col;
|
|
|
|
guint8 r, g, b, y, u, v;
|
2007-11-13 17:01:07 +00:00
|
|
|
|
|
|
|
start += 8;
|
|
|
|
while (g_ascii_isspace (*start))
|
|
|
|
start++;
|
|
|
|
for (i = 0; i < 16; i++) {
|
2008-05-12 16:35:39 +00:00
|
|
|
if (sscanf (start, "%06x", &col) != 1)
|
2007-11-13 17:01:07 +00:00
|
|
|
break;
|
|
|
|
start += 6;
|
|
|
|
while ((*start == ',') || g_ascii_isspace (*start))
|
|
|
|
start++;
|
2008-05-12 16:35:39 +00:00
|
|
|
/* sigh, need to convert this from vobsub pseudo-RGB to YUV */
|
|
|
|
r = (col >> 16) & 0xff;
|
|
|
|
g = (col >> 8) & 0xff;
|
|
|
|
b = col & 0xff;
|
|
|
|
y = CLAMP ((0.1494 * r + 0.6061 * g + 0.2445 * b) * 219 / 255 + 16, 0,
|
|
|
|
255);
|
|
|
|
u = CLAMP (0.6066 * r - 0.4322 * g - 0.1744 * b + 128, 0, 255);
|
|
|
|
v = CLAMP (-0.08435 * r - 0.3422 * g + 0.4266 * b + 128, 0, 255);
|
|
|
|
clut[i] = (y << 16) | (u << 8) | v;
|
2007-11-13 17:01:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* got them all without problems; build and send event */
|
|
|
|
if (i == 16) {
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_structure_new ("application/x-gst-dvd", "event", G_TYPE_STRING,
|
|
|
|
"dvd-spu-clut-change", "clut00", G_TYPE_INT, clut[0], "clut01",
|
|
|
|
G_TYPE_INT, clut[1], "clut02", G_TYPE_INT, clut[2], "clut03",
|
|
|
|
G_TYPE_INT, clut[3], "clut04", G_TYPE_INT, clut[4], "clut05",
|
|
|
|
G_TYPE_INT, clut[5], "clut06", G_TYPE_INT, clut[6], "clut07",
|
|
|
|
G_TYPE_INT, clut[7], "clut08", G_TYPE_INT, clut[8], "clut09",
|
|
|
|
G_TYPE_INT, clut[9], "clut10", G_TYPE_INT, clut[10], "clut11",
|
|
|
|
G_TYPE_INT, clut[11], "clut12", G_TYPE_INT, clut[12], "clut13",
|
|
|
|
G_TYPE_INT, clut[13], "clut14", G_TYPE_INT, clut[14], "clut15",
|
|
|
|
G_TYPE_INT, clut[15], NULL);
|
|
|
|
|
|
|
|
gst_pad_push_event (stream->pad,
|
2013-10-04 22:00:03 +00:00
|
|
|
gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_STICKY, s));
|
2007-11-13 17:01:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (buf);
|
|
|
|
}
|
|
|
|
|
2014-03-22 16:05:17 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_push_codec_data_all (GstMatroskaDemux * demux)
|
|
|
|
{
|
|
|
|
gint stream_nr;
|
|
|
|
|
|
|
|
g_assert (demux->common.num_streams == demux->common.src->len);
|
|
|
|
for (stream_nr = 0; stream_nr < demux->common.src->len; stream_nr++) {
|
|
|
|
GstMatroskaTrackContext *stream;
|
|
|
|
|
|
|
|
stream = g_ptr_array_index (demux->common.src, stream_nr);
|
|
|
|
|
|
|
|
if (stream->send_stream_headers) {
|
|
|
|
if (stream->stream_headers != NULL) {
|
|
|
|
gst_matroska_demux_push_stream_headers (demux, stream);
|
|
|
|
} else {
|
|
|
|
/* FIXME: perhaps we can just disable and skip this stream then */
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DECODE, (NULL),
|
|
|
|
("Failed to extract stream headers from codec private data"));
|
|
|
|
}
|
|
|
|
stream->send_stream_headers = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (stream->send_dvd_event) {
|
|
|
|
gst_matroska_demux_push_dvd_clut_change_event (demux, stream);
|
|
|
|
/* FIXME: should we send this event again after (flushing) seek ? */
|
|
|
|
stream->send_dvd_event = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_add_mpeg_seq_header (GstElement * element,
|
|
|
|
GstMatroskaTrackContext * stream, GstBuffer ** buf)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
2008-06-19 09:12:55 +00:00
|
|
|
guint8 *seq_header;
|
|
|
|
guint seq_header_len;
|
2011-11-26 09:01:07 +00:00
|
|
|
guint32 header, tmp;
|
2008-06-19 09:12:55 +00:00
|
|
|
|
|
|
|
if (stream->codec_state) {
|
|
|
|
seq_header = stream->codec_state;
|
|
|
|
seq_header_len = stream->codec_state_size;
|
|
|
|
} else if (stream->codec_priv) {
|
|
|
|
seq_header = stream->codec_priv;
|
|
|
|
seq_header_len = stream->codec_priv_size;
|
|
|
|
} else {
|
|
|
|
return GST_FLOW_OK;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2008-06-19 09:12:55 +00:00
|
|
|
|
|
|
|
/* Sequence header only needed for keyframes */
|
|
|
|
if (GST_BUFFER_FLAG_IS_SET (*buf, GST_BUFFER_FLAG_DELTA_UNIT))
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (gst_buffer_get_size (*buf) < 4)
|
2008-06-19 09:12:55 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (*buf, 0, &tmp, sizeof (guint32));
|
|
|
|
header = GUINT32_FROM_BE (tmp);
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
/* Sequence start code, if not found prepend */
|
|
|
|
if (header != 0x000001b3) {
|
|
|
|
GstBuffer *newbuf;
|
2010-12-22 18:58:21 +00:00
|
|
|
|
2011-01-03 18:06:35 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "Prepending MPEG sequence header");
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
newbuf = gst_buffer_new_wrapped (g_memdup (seq_header, seq_header_len),
|
|
|
|
seq_header_len);
|
|
|
|
|
|
|
|
gst_buffer_copy_into (newbuf, *buf, GST_BUFFER_COPY_TIMESTAMPS |
|
|
|
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_MEMORY, 0,
|
|
|
|
gst_buffer_get_size (*buf));
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
gst_buffer_unref (*buf);
|
|
|
|
*buf = newbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2008-06-19 09:12:55 +00:00
|
|
|
gst_matroska_demux_add_wvpk_header (GstElement * element,
|
|
|
|
GstMatroskaTrackContext * stream, GstBuffer ** buf)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
2008-06-19 10:48:57 +00:00
|
|
|
GstMatroskaTrackAudioContext *audiocontext =
|
|
|
|
(GstMatroskaTrackAudioContext *) stream;
|
|
|
|
GstBuffer *newbuf = NULL;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map, outmap;
|
2011-11-26 09:01:07 +00:00
|
|
|
guint8 *buf_data, *data;
|
2005-10-18 18:12:31 +00:00
|
|
|
Wavpack4Header wvh;
|
|
|
|
|
|
|
|
wvh.ck_id[0] = 'w';
|
|
|
|
wvh.ck_id[1] = 'v';
|
|
|
|
wvh.ck_id[2] = 'p';
|
|
|
|
wvh.ck_id[3] = 'k';
|
2008-06-19 10:48:57 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
wvh.version = GST_READ_UINT16_LE (stream->codec_priv);
|
|
|
|
wvh.track_no = 0;
|
|
|
|
wvh.index_no = 0;
|
|
|
|
wvh.total_samples = -1;
|
2008-06-19 10:48:57 +00:00
|
|
|
wvh.block_index = audiocontext->wvpk_block_index;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2008-06-19 10:48:57 +00:00
|
|
|
if (audiocontext->channels <= 2) {
|
2011-11-26 09:01:07 +00:00
|
|
|
guint32 block_samples, tmp;
|
|
|
|
gsize size = gst_buffer_get_size (*buf);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (*buf, 0, &tmp, sizeof (guint32));
|
|
|
|
block_samples = GUINT32_FROM_LE (tmp);
|
2008-06-19 10:48:57 +00:00
|
|
|
/* we need to reconstruct the header of the wavpack block */
|
|
|
|
|
|
|
|
/* -20 because ck_size is the size of the wavpack block -8
|
|
|
|
* and lace_size is the size of the wavpack block + 12
|
|
|
|
* (the three guint32 of the header that already are in the buffer) */
|
2011-11-26 09:01:07 +00:00
|
|
|
wvh.ck_size = size + sizeof (Wavpack4Header) - 20;
|
2008-06-19 10:48:57 +00:00
|
|
|
|
|
|
|
/* block_samples, flags and crc are already in the buffer */
|
2012-03-15 12:36:17 +00:00
|
|
|
newbuf = gst_buffer_new_allocate (NULL, sizeof (Wavpack4Header) - 12, NULL);
|
2008-06-19 10:48:57 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
|
|
|
|
data = outmap.data;
|
2008-06-19 10:48:57 +00:00
|
|
|
data[0] = 'w';
|
|
|
|
data[1] = 'v';
|
|
|
|
data[2] = 'p';
|
|
|
|
data[3] = 'k';
|
|
|
|
GST_WRITE_UINT32_LE (data + 4, wvh.ck_size);
|
|
|
|
GST_WRITE_UINT16_LE (data + 8, wvh.version);
|
|
|
|
GST_WRITE_UINT8 (data + 10, wvh.track_no);
|
|
|
|
GST_WRITE_UINT8 (data + 11, wvh.index_no);
|
|
|
|
GST_WRITE_UINT32_LE (data + 12, wvh.total_samples);
|
|
|
|
GST_WRITE_UINT32_LE (data + 16, wvh.block_index);
|
2016-02-18 09:10:14 +00:00
|
|
|
gst_buffer_unmap (newbuf, &outmap);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
/* Append data from buf: */
|
|
|
|
gst_buffer_copy_into (newbuf, *buf, GST_BUFFER_COPY_TIMESTAMPS |
|
|
|
|
GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_MEMORY, 0, size);
|
|
|
|
|
2008-06-19 10:48:57 +00:00
|
|
|
gst_buffer_unref (*buf);
|
|
|
|
*buf = newbuf;
|
|
|
|
audiocontext->wvpk_block_index += block_samples;
|
|
|
|
} else {
|
2011-12-01 15:29:15 +00:00
|
|
|
guint8 *outdata = NULL;
|
2008-06-19 10:48:57 +00:00
|
|
|
guint outpos = 0;
|
2011-12-01 15:29:15 +00:00
|
|
|
gsize buf_size, size, out_size = 0;
|
2008-06-19 10:48:57 +00:00
|
|
|
guint32 block_samples, flags, crc, blocksize;
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (*buf, &map, GST_MAP_READ);
|
|
|
|
buf_data = map.data;
|
|
|
|
buf_size = map.size;
|
2008-06-19 10:48:57 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (buf_size < 4) {
|
2011-01-03 18:06:35 +00:00
|
|
|
GST_ERROR_OBJECT (element, "Too small wavpack buffer");
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (*buf, &map);
|
2008-06-19 10:48:57 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
data = buf_data;
|
|
|
|
size = buf_size;
|
|
|
|
|
2008-06-19 10:48:57 +00:00
|
|
|
block_samples = GST_READ_UINT32_LE (data);
|
|
|
|
data += 4;
|
|
|
|
size -= 4;
|
|
|
|
|
|
|
|
while (size > 12) {
|
|
|
|
flags = GST_READ_UINT32_LE (data);
|
|
|
|
data += 4;
|
|
|
|
size -= 4;
|
|
|
|
crc = GST_READ_UINT32_LE (data);
|
|
|
|
data += 4;
|
|
|
|
size -= 4;
|
|
|
|
blocksize = GST_READ_UINT32_LE (data);
|
|
|
|
data += 4;
|
|
|
|
size -= 4;
|
|
|
|
|
|
|
|
if (blocksize == 0 || size < blocksize)
|
|
|
|
break;
|
|
|
|
|
2011-12-01 15:29:15 +00:00
|
|
|
g_assert ((newbuf == NULL) == (outdata == NULL));
|
|
|
|
|
2008-06-19 10:48:57 +00:00
|
|
|
if (newbuf == NULL) {
|
2011-11-26 09:01:07 +00:00
|
|
|
out_size = sizeof (Wavpack4Header) + blocksize;
|
2012-03-15 12:36:17 +00:00
|
|
|
newbuf = gst_buffer_new_allocate (NULL, out_size, NULL);
|
2008-06-19 10:48:57 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_copy_into (newbuf, *buf,
|
|
|
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS, 0, -1);
|
2008-06-19 10:48:57 +00:00
|
|
|
|
|
|
|
outpos = 0;
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
|
|
|
|
outdata = outmap.data;
|
2008-06-19 10:48:57 +00:00
|
|
|
} else {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (newbuf, &outmap);
|
2011-11-26 09:01:07 +00:00
|
|
|
out_size += sizeof (Wavpack4Header) + blocksize;
|
|
|
|
gst_buffer_set_size (newbuf, out_size);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (newbuf, &outmap, GST_MAP_WRITE);
|
|
|
|
outdata = outmap.data;
|
2008-06-19 10:48:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
outdata[outpos] = 'w';
|
|
|
|
outdata[outpos + 1] = 'v';
|
|
|
|
outdata[outpos + 2] = 'p';
|
|
|
|
outdata[outpos + 3] = 'k';
|
|
|
|
outpos += 4;
|
|
|
|
|
|
|
|
GST_WRITE_UINT32_LE (outdata + outpos,
|
|
|
|
blocksize + sizeof (Wavpack4Header) - 8);
|
|
|
|
GST_WRITE_UINT16_LE (outdata + outpos + 4, wvh.version);
|
|
|
|
GST_WRITE_UINT8 (outdata + outpos + 6, wvh.track_no);
|
|
|
|
GST_WRITE_UINT8 (outdata + outpos + 7, wvh.index_no);
|
|
|
|
GST_WRITE_UINT32_LE (outdata + outpos + 8, wvh.total_samples);
|
|
|
|
GST_WRITE_UINT32_LE (outdata + outpos + 12, wvh.block_index);
|
|
|
|
GST_WRITE_UINT32_LE (outdata + outpos + 16, block_samples);
|
|
|
|
GST_WRITE_UINT32_LE (outdata + outpos + 20, flags);
|
|
|
|
GST_WRITE_UINT32_LE (outdata + outpos + 24, crc);
|
|
|
|
outpos += 28;
|
|
|
|
|
2013-11-21 15:30:34 +00:00
|
|
|
memmove (outdata + outpos, data, blocksize);
|
2008-06-19 10:48:57 +00:00
|
|
|
outpos += blocksize;
|
|
|
|
data += blocksize;
|
|
|
|
size -= blocksize;
|
|
|
|
}
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (*buf, &map);
|
2008-06-19 10:48:57 +00:00
|
|
|
gst_buffer_unref (*buf);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
if (newbuf)
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (newbuf, &outmap);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2008-06-19 10:48:57 +00:00
|
|
|
*buf = newbuf;
|
|
|
|
audiocontext->wvpk_block_index += block_samples;
|
|
|
|
}
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
|
2010-12-22 18:58:21 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
2015-11-18 05:20:38 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_add_prores_header (GstElement * element,
|
|
|
|
GstMatroskaTrackContext * stream, GstBuffer ** buf)
|
|
|
|
{
|
|
|
|
GstBuffer *newbuf = gst_buffer_new_allocate (NULL, 8, NULL);
|
|
|
|
GstMapInfo map;
|
|
|
|
guint32 frame_size;
|
|
|
|
|
|
|
|
if (!gst_buffer_map (newbuf, &map, GST_MAP_WRITE)) {
|
|
|
|
GST_ERROR ("Failed to map newly allocated buffer");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
frame_size = gst_buffer_get_size (*buf);
|
|
|
|
|
|
|
|
GST_WRITE_UINT32_BE (map.data, frame_size);
|
|
|
|
map.data[4] = 'i';
|
|
|
|
map.data[5] = 'c';
|
|
|
|
map.data[6] = 'p';
|
|
|
|
map.data[7] = 'f';
|
|
|
|
|
|
|
|
gst_buffer_unmap (newbuf, &map);
|
|
|
|
*buf = gst_buffer_append (newbuf, *buf);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2010-06-23 09:12:00 +00:00
|
|
|
/* @text must be null-terminated */
|
|
|
|
static gboolean
|
|
|
|
gst_matroska_demux_subtitle_chunk_has_tag (GstElement * element,
|
|
|
|
const gchar * text)
|
|
|
|
{
|
|
|
|
gchar *tag;
|
|
|
|
|
2012-07-24 10:33:33 +00:00
|
|
|
g_return_val_if_fail (text != NULL, FALSE);
|
|
|
|
|
2010-06-23 09:12:00 +00:00
|
|
|
/* yes, this might all lead to false positives ... */
|
|
|
|
tag = (gchar *) text;
|
|
|
|
while ((tag = strchr (tag, '<'))) {
|
|
|
|
tag++;
|
|
|
|
if (*tag != '\0' && *(tag + 1) == '>') {
|
|
|
|
/* some common convenience ones */
|
|
|
|
/* maybe any character will do here ? */
|
|
|
|
switch (*tag) {
|
|
|
|
case 'b':
|
|
|
|
case 'i':
|
|
|
|
case 'u':
|
|
|
|
case 's':
|
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strstr (text, "<span"))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
|
|
|
GstMatroskaTrackContext * stream, GstBuffer ** buf)
|
2006-06-22 16:27:03 +00:00
|
|
|
{
|
|
|
|
GstMatroskaTrackSubtitleContext *sub_stream;
|
2011-11-26 09:01:07 +00:00
|
|
|
const gchar *encoding;
|
2006-06-22 16:27:03 +00:00
|
|
|
GError *err = NULL;
|
|
|
|
GstBuffer *newbuf;
|
|
|
|
gchar *utf8;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
2013-07-26 14:02:01 +00:00
|
|
|
gboolean needs_unmap = TRUE;
|
2006-06-22 16:27:03 +00:00
|
|
|
|
|
|
|
sub_stream = (GstMatroskaTrackSubtitleContext *) stream;
|
|
|
|
|
2012-07-24 10:33:33 +00:00
|
|
|
if (!gst_buffer_get_size (*buf) || !gst_buffer_map (*buf, &map, GST_MAP_READ))
|
2011-12-01 14:49:40 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2015-07-16 15:49:26 +00:00
|
|
|
/* The subtitle buffer we push out should not include a NUL terminator as
|
|
|
|
* part of the data. */
|
|
|
|
if (map.data[map.size - 1] == '\0') {
|
|
|
|
gst_buffer_set_size (*buf, map.size - 1);
|
2013-09-27 10:53:06 +00:00
|
|
|
gst_buffer_unmap (*buf, &map);
|
|
|
|
gst_buffer_map (*buf, &map, GST_MAP_READ);
|
|
|
|
}
|
|
|
|
|
2006-06-22 16:27:03 +00:00
|
|
|
if (!sub_stream->invalid_utf8) {
|
2015-07-15 10:44:52 +00:00
|
|
|
if (g_utf8_validate ((gchar *) map.data, map.size, NULL)) {
|
2010-06-23 09:12:00 +00:00
|
|
|
goto next;
|
2006-06-22 16:27:03 +00:00
|
|
|
}
|
2012-08-22 11:32:41 +00:00
|
|
|
GST_WARNING_OBJECT (element, "subtitle stream %" G_GUINT64_FORMAT
|
|
|
|
" is not valid UTF-8, this is broken according to the matroska"
|
|
|
|
" specification", stream->num);
|
2006-06-22 16:27:03 +00:00
|
|
|
sub_stream->invalid_utf8 = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* file with broken non-UTF8 subtitle, do the best we can do to fix it */
|
|
|
|
encoding = g_getenv ("GST_SUBTITLE_ENCODING");
|
|
|
|
if (encoding == NULL || *encoding == '\0') {
|
|
|
|
/* if local encoding is UTF-8 and no encoding specified
|
|
|
|
* via the environment variable, assume ISO-8859-15 */
|
|
|
|
if (g_get_charset (&encoding)) {
|
|
|
|
encoding = "ISO-8859-15";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
utf8 =
|
|
|
|
g_convert_with_fallback ((gchar *) map.data, map.size, "UTF-8", encoding,
|
|
|
|
(char *) "*", NULL, NULL, &err);
|
2006-06-22 16:27:03 +00:00
|
|
|
|
|
|
|
if (err) {
|
2008-08-30 14:15:03 +00:00
|
|
|
GST_LOG_OBJECT (element, "could not convert string from '%s' to UTF-8: %s",
|
2006-06-22 16:27:03 +00:00
|
|
|
encoding, err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
g_free (utf8);
|
|
|
|
|
|
|
|
/* invalid input encoding, fall back to ISO-8859-15 (always succeeds) */
|
|
|
|
encoding = "ISO-8859-15";
|
2012-01-23 16:25:37 +00:00
|
|
|
utf8 =
|
|
|
|
g_convert_with_fallback ((gchar *) map.data, map.size, "UTF-8",
|
|
|
|
encoding, (char *) "*", NULL, NULL, NULL);
|
2006-06-22 16:27:03 +00:00
|
|
|
}
|
|
|
|
|
2008-08-30 14:15:03 +00:00
|
|
|
GST_LOG_OBJECT (element, "converted subtitle text from %s to UTF-8 %s",
|
2006-06-22 16:27:03 +00:00
|
|
|
encoding, (err) ? "(using ISO-8859-15 as fallback)" : "");
|
|
|
|
|
|
|
|
if (utf8 == NULL)
|
|
|
|
utf8 = g_strdup ("invalid subtitle");
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
|
2013-07-26 14:02:01 +00:00
|
|
|
gst_buffer_unmap (*buf, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_copy_into (newbuf, *buf,
|
2011-12-02 01:58:30 +00:00
|
|
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_META,
|
|
|
|
0, -1);
|
2009-02-22 18:25:39 +00:00
|
|
|
gst_buffer_unref (*buf);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
*buf = newbuf;
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (*buf, &map, GST_MAP_READ);
|
2010-06-23 09:12:00 +00:00
|
|
|
|
|
|
|
next:
|
2013-09-20 08:19:22 +00:00
|
|
|
|
2011-12-01 12:34:52 +00:00
|
|
|
if (sub_stream->check_markup) {
|
|
|
|
/* caps claim markup text, so we need to escape text,
|
|
|
|
* except if text is already markup and then needs no further escaping */
|
|
|
|
sub_stream->seen_markup_tag = sub_stream->seen_markup_tag ||
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_matroska_demux_subtitle_chunk_has_tag (element, (gchar *) map.data);
|
2011-12-01 12:34:52 +00:00
|
|
|
|
|
|
|
if (!sub_stream->seen_markup_tag) {
|
2012-01-23 16:25:37 +00:00
|
|
|
utf8 = g_markup_escape_text ((gchar *) map.data, map.size);
|
2011-12-01 12:34:52 +00:00
|
|
|
|
2011-12-02 01:58:30 +00:00
|
|
|
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
|
2013-07-26 14:02:01 +00:00
|
|
|
gst_buffer_unmap (*buf, &map);
|
2011-12-02 01:58:30 +00:00
|
|
|
gst_buffer_copy_into (newbuf, *buf,
|
|
|
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS |
|
|
|
|
GST_BUFFER_COPY_META, 0, -1);
|
2011-12-01 12:34:52 +00:00
|
|
|
gst_buffer_unref (*buf);
|
|
|
|
|
|
|
|
*buf = newbuf;
|
2013-07-26 14:02:01 +00:00
|
|
|
needs_unmap = FALSE;
|
2011-12-01 12:34:52 +00:00
|
|
|
}
|
2010-06-23 09:12:00 +00:00
|
|
|
}
|
|
|
|
|
2013-07-26 14:02:01 +00:00
|
|
|
if (needs_unmap)
|
|
|
|
gst_buffer_unmap (*buf, &map);
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
return GST_FLOW_OK;
|
2006-06-22 16:27:03 +00:00
|
|
|
}
|
|
|
|
|
2010-07-12 15:29:12 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_check_aac (GstElement * element,
|
|
|
|
GstMatroskaTrackContext * stream, GstBuffer ** buf)
|
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
guint8 data[2];
|
2010-07-12 15:29:12 +00:00
|
|
|
guint size;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_extract (*buf, 0, data, 2);
|
|
|
|
size = gst_buffer_get_size (*buf);
|
2010-07-12 15:29:12 +00:00
|
|
|
|
|
|
|
if (size > 2 && data[0] == 0xff && (data[1] >> 4 == 0x0f)) {
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
/* tss, ADTS data, remove codec_data
|
|
|
|
* still assume it is at least parsed */
|
2012-03-27 14:41:06 +00:00
|
|
|
stream->caps = gst_caps_make_writable (stream->caps);
|
|
|
|
s = gst_caps_get_structure (stream->caps, 0);
|
2010-07-12 15:29:12 +00:00
|
|
|
g_assert (s);
|
|
|
|
gst_structure_remove_field (s, "codec_data");
|
2012-03-27 14:41:06 +00:00
|
|
|
gst_pad_set_caps (stream->pad, stream->caps);
|
2010-07-12 15:29:12 +00:00
|
|
|
GST_DEBUG_OBJECT (element, "ADTS AAC audio data; removing codec-data, "
|
2012-03-27 14:41:06 +00:00
|
|
|
"new caps: %" GST_PTR_FORMAT, stream->caps);
|
2010-07-12 15:29:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* disable subsequent checking */
|
|
|
|
stream->postprocess_frame = NULL;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_matroska_demux_align_buffer (GstMatroskaDemux * demux,
|
|
|
|
GstBuffer * buffer, gsize alignment)
|
|
|
|
{
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
if (map.size < sizeof (guintptr)) {
|
|
|
|
gst_buffer_unmap (buffer, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
if (((guintptr) map.data) & (alignment - 1)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
GstBuffer *new_buffer;
|
2012-08-08 15:39:07 +00:00
|
|
|
GstAllocationParams params = { 0, alignment - 1, 0, 0, };
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
new_buffer = gst_buffer_new_allocate (NULL,
|
2012-03-15 12:36:17 +00:00
|
|
|
gst_buffer_get_size (buffer), ¶ms);
|
2012-01-23 16:25:37 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
/* Copy data "by hand", so ensure alignment is kept: */
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_fill (new_buffer, 0, map.data, map.size);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_copy_into (new_buffer, buffer, GST_BUFFER_COPY_METADATA, 0, -1);
|
2012-01-13 23:12:05 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"We want output aligned on %" G_GSIZE_FORMAT ", reallocated",
|
2011-11-26 09:01:07 +00:00
|
|
|
alignment);
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buffer, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return new_buffer;
|
|
|
|
}
|
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buffer, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2005-10-28 15:32:48 +00:00
|
|
|
gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
2010-05-18 12:44:15 +00:00
|
|
|
GstEbmlRead * ebml, guint64 cluster_time, guint64 cluster_offset,
|
|
|
|
gboolean is_simpleblock)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2005-10-18 18:12:31 +00:00
|
|
|
GstMatroskaTrackContext *stream = NULL;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2004-08-25 14:41:12 +00:00
|
|
|
gboolean readblock = FALSE;
|
2003-11-21 21:34:27 +00:00
|
|
|
guint32 id;
|
2011-07-07 16:27:36 +00:00
|
|
|
guint64 block_duration = -1;
|
2015-11-03 10:40:15 +00:00
|
|
|
gint64 block_discardpadding = 0;
|
2004-08-25 14:41:12 +00:00
|
|
|
GstBuffer *buf = NULL;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
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
|
|
|
gint stream_num = -1, n, laces = 0;
|
2005-10-18 18:12:31 +00:00
|
|
|
guint size = 0;
|
|
|
|
gint *lace_size = NULL;
|
2004-08-25 14:41:12 +00:00
|
|
|
gint64 time = 0;
|
2005-10-28 15:32:48 +00:00
|
|
|
gint flags = 0;
|
2006-09-04 16:21:17 +00:00
|
|
|
gint64 referenceblock = 0;
|
2010-03-23 16:34:50 +00:00
|
|
|
gint64 offset;
|
2015-03-03 17:40:16 +00:00
|
|
|
GstClockTime buffer_timestamp;
|
2010-03-23 16:34:50 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
offset = gst_ebml_read_get_offset (ebml);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
2005-10-28 15:32:48 +00:00
|
|
|
if (!is_simpleblock) {
|
2010-08-16 14:05:41 +00:00
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK) {
|
|
|
|
goto data_error;
|
|
|
|
}
|
2005-10-28 15:32:48 +00:00
|
|
|
} else {
|
|
|
|
id = GST_MATROSKA_ID_SIMPLEBLOCK;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (id) {
|
2004-03-15 19:32:27 +00:00
|
|
|
/* one block inside the group. Note, block parsing is one
|
|
|
|
* of the harder things, so this code is a bit complicated.
|
|
|
|
* See http://www.matroska.org/ for documentation. */
|
2005-10-28 15:32:48 +00:00
|
|
|
case GST_MATROSKA_ID_SIMPLEBLOCK:
|
2005-10-18 18:12:31 +00:00
|
|
|
case GST_MATROSKA_ID_BLOCK:
|
|
|
|
{
|
|
|
|
guint64 num;
|
2004-03-15 19:32:27 +00:00
|
|
|
guint8 *data;
|
|
|
|
|
2009-06-23 10:42:33 +00:00
|
|
|
if (buf) {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2009-06-23 10:42:33 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
buf = NULL;
|
|
|
|
}
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
if ((ret = gst_ebml_read_buffer (ebml, &id, &buf)) != GST_FLOW_OK)
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
data = map.data;
|
|
|
|
size = map.size;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
|
|
|
/* first byte(s): blocknum */
|
2010-08-16 14:05:41 +00:00
|
|
|
if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0)
|
|
|
|
goto data_error;
|
2004-03-15 19:32:27 +00:00
|
|
|
data += n;
|
|
|
|
size -= n;
|
|
|
|
|
|
|
|
/* fetch stream from num */
|
2011-05-23 15:06:44 +00:00
|
|
|
stream_num = gst_matroska_read_common_stream_from_num (&demux->common,
|
|
|
|
num);
|
2010-07-09 14:57:33 +00:00
|
|
|
if (G_UNLIKELY (size < 3)) {
|
|
|
|
GST_WARNING_OBJECT (demux, "Invalid size %u", size);
|
2010-08-16 14:05:41 +00:00
|
|
|
/* non-fatal, try next block(group) */
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto done;
|
2010-07-09 14:57:33 +00:00
|
|
|
} else if (G_UNLIKELY (stream_num < 0 ||
|
2011-05-23 15:06:44 +00:00
|
|
|
stream_num >= demux->common.num_streams)) {
|
2010-07-09 14:57:33 +00:00
|
|
|
/* let's not give up on a stray invalid track number */
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Invalid stream %d for track number %" G_GUINT64_FORMAT
|
2010-07-16 16:04:44 +00:00
|
|
|
"; ignoring block", stream_num, num);
|
2010-08-16 14:05:41 +00:00
|
|
|
goto done;
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
stream = g_ptr_array_index (demux->common.src, stream_num);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
/* time (relative to cluster time) */
|
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
|
|
|
time = ((gint16) GST_READ_UINT16_BE (data));
|
2004-03-15 19:32:27 +00:00
|
|
|
data += 2;
|
|
|
|
size -= 2;
|
2005-10-18 18:12:31 +00:00
|
|
|
flags = GST_READ_UINT8 (data);
|
2004-03-15 19:32:27 +00:00
|
|
|
data += 1;
|
|
|
|
size -= 1;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2009-05-09 17:50:45 +00:00
|
|
|
GST_LOG_OBJECT (demux, "time %" G_GUINT64_FORMAT ", flags %d", time,
|
2009-05-07 15:09:44 +00:00
|
|
|
flags);
|
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
switch ((flags & 0x06) >> 1) {
|
|
|
|
case 0x0: /* no lacing */
|
|
|
|
laces = 1;
|
|
|
|
lace_size = g_new (gint, 1);
|
|
|
|
lace_size[0] = size;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x1: /* xiph lacing */
|
|
|
|
case 0x2: /* fixed-size lacing */
|
|
|
|
case 0x3: /* EBML lacing */
|
2010-08-16 14:05:41 +00:00
|
|
|
if (size == 0)
|
|
|
|
goto invalid_lacing;
|
2005-10-18 18:12:31 +00:00
|
|
|
laces = GST_READ_UINT8 (data) + 1;
|
2004-03-15 19:32:27 +00:00
|
|
|
data += 1;
|
|
|
|
size -= 1;
|
|
|
|
lace_size = g_new0 (gint, laces);
|
|
|
|
|
|
|
|
switch ((flags & 0x06) >> 1) {
|
|
|
|
case 0x1: /* xiph lacing */ {
|
|
|
|
guint temp, total = 0;
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
for (n = 0; ret == GST_FLOW_OK && n < laces - 1; n++) {
|
2004-03-15 19:32:27 +00:00
|
|
|
while (1) {
|
2010-08-16 14:05:41 +00:00
|
|
|
if (size == 0)
|
|
|
|
goto invalid_lacing;
|
2005-10-18 18:12:31 +00:00
|
|
|
temp = GST_READ_UINT8 (data);
|
2004-03-15 19:32:27 +00:00
|
|
|
lace_size[n] += temp;
|
|
|
|
data += 1;
|
|
|
|
size -= 1;
|
|
|
|
if (temp != 0xff)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
total += lace_size[n];
|
|
|
|
}
|
|
|
|
lace_size[n] = size - total;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x2: /* fixed-size lacing */
|
|
|
|
for (n = 0; n < laces; n++)
|
|
|
|
lace_size[n] = size / laces;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x3: /* EBML lacing */ {
|
|
|
|
guint total;
|
|
|
|
|
2010-08-16 14:05:41 +00:00
|
|
|
if ((n = gst_matroska_ebmlnum_uint (data, size, &num)) < 0)
|
|
|
|
goto data_error;
|
2004-03-15 19:32:27 +00:00
|
|
|
data += n;
|
|
|
|
size -= n;
|
|
|
|
total = lace_size[0] = num;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
for (n = 1; ret == GST_FLOW_OK && n < laces - 1; n++) {
|
2004-03-15 19:32:27 +00:00
|
|
|
gint64 snum;
|
|
|
|
gint r;
|
|
|
|
|
2010-08-16 14:05:41 +00:00
|
|
|
if ((r = gst_matroska_ebmlnum_sint (data, size, &snum)) < 0)
|
|
|
|
goto data_error;
|
2004-03-15 19:32:27 +00:00
|
|
|
data += r;
|
|
|
|
size -= r;
|
|
|
|
lace_size[n] = lace_size[n - 1] + snum;
|
|
|
|
total += lace_size[n];
|
|
|
|
}
|
2004-12-18 22:47:47 +00:00
|
|
|
if (n < laces)
|
|
|
|
lace_size[n] = size - total;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
|
|
|
|
2004-08-25 14:41:12 +00:00
|
|
|
readblock = TRUE;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
case GST_MATROSKA_ID_BLOCKDURATION:{
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = gst_ebml_read_uint (ebml, &id, &block_duration);
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "BlockDuration: %" G_GUINT64_FORMAT,
|
2008-06-23 16:13:40 +00:00
|
|
|
block_duration);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2015-11-03 10:40:15 +00:00
|
|
|
case GST_MATROSKA_ID_DISCARDPADDING:{
|
|
|
|
ret = gst_ebml_read_sint (ebml, &id, &block_discardpadding);
|
|
|
|
GST_DEBUG_OBJECT (demux, "DiscardPadding: %" GST_STIME_FORMAT,
|
|
|
|
GST_STIME_ARGS (block_discardpadding));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-07-18 16:58:08 +00:00
|
|
|
case GST_MATROSKA_ID_REFERENCEBLOCK:{
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = gst_ebml_read_sint (ebml, &id, &referenceblock);
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "ReferenceBlock: %" G_GINT64_FORMAT,
|
2008-06-23 16:13:40 +00:00
|
|
|
referenceblock);
|
2004-07-18 16:58:08 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
case GST_MATROSKA_ID_CODECSTATE:{
|
|
|
|
guint8 *data;
|
|
|
|
guint64 data_len = 0;
|
|
|
|
|
|
|
|
if ((ret =
|
|
|
|
gst_ebml_read_binary (ebml, &id, &data,
|
|
|
|
&data_len)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
2010-05-12 12:30:18 +00:00
|
|
|
if (G_UNLIKELY (stream == NULL)) {
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Unexpected CodecState subelement - ignoring");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
g_free (stream->codec_state);
|
|
|
|
stream->codec_state = data;
|
|
|
|
stream->codec_state_size = data_len;
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
|
|
|
|
/* Decode if necessary */
|
|
|
|
if (stream->encodings && stream->encodings->len > 0
|
|
|
|
&& stream->codec_state && stream->codec_state_size > 0) {
|
|
|
|
if (!gst_matroska_decode_data (stream->encodings,
|
2009-06-23 12:32:43 +00:00
|
|
|
&stream->codec_state, &stream->codec_state_size,
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
GST_MATROSKA_TRACK_ENCODING_SCOPE_CODEC_DATA, TRUE)) {
|
|
|
|
GST_WARNING_OBJECT (demux, "Decoding codec state failed");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-13 23:12:05 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "CodecState of %" G_GSIZE_FORMAT " bytes",
|
2008-06-19 09:12:55 +00:00
|
|
|
stream->codec_state_size);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
default:
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_parse_skip (&demux->common, ebml,
|
|
|
|
"BlockGroup", id);
|
2010-05-18 12:44:15 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +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
|
|
|
case GST_MATROSKA_ID_BLOCKVIRTUAL:
|
|
|
|
case GST_MATROSKA_ID_BLOCKADDITIONS:
|
|
|
|
case GST_MATROSKA_ID_REFERENCEPRIORITY:
|
|
|
|
case GST_MATROSKA_ID_REFERENCEVIRTUAL:
|
|
|
|
case GST_MATROSKA_ID_SLICES:
|
2009-05-07 15:09:44 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Skipping BlockGroup subelement 0x%x - ignoring", id);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
ret = gst_ebml_read_skip (ebml);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2005-10-28 15:32:48 +00:00
|
|
|
if (is_simpleblock)
|
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2010-08-16 14:05:41 +00:00
|
|
|
/* reading a number or so could have failed */
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto data_error;
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
if (ret == GST_FLOW_OK && readblock) {
|
2012-10-27 12:24:24 +00:00
|
|
|
gboolean invisible_frame = FALSE;
|
|
|
|
gboolean delta_unit = FALSE;
|
2004-08-25 14:41:12 +00:00
|
|
|
guint64 duration = 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
|
|
|
gint64 lace_time = 0;
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
GstEvent *protect_event;
|
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
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
stream = g_ptr_array_index (demux->common.src, stream_num);
|
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
|
|
|
|
|
|
|
if (cluster_time != GST_CLOCK_TIME_NONE) {
|
|
|
|
/* FIXME: What to do with negative timestamps? Give timestamp 0 or -1?
|
|
|
|
* Drop unless the lace contains timestamp 0? */
|
|
|
|
if (time < 0 && (-time) > cluster_time) {
|
|
|
|
lace_time = 0;
|
|
|
|
} else {
|
|
|
|
if (stream->timecodescale == 1.0)
|
2011-05-23 15:06:44 +00:00
|
|
|
lace_time = (cluster_time + time) * demux->common.time_scale;
|
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
|
|
|
else
|
|
|
|
lace_time =
|
|
|
|
gst_util_guint64_to_gdouble ((cluster_time + time) *
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.time_scale) * stream->timecodescale;
|
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
|
|
|
}
|
|
|
|
} else {
|
|
|
|
lace_time = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
/* Send the GST_PROTECTION event */
|
|
|
|
while ((protect_event = g_queue_pop_head (&stream->protection_event_queue))) {
|
|
|
|
GST_TRACE_OBJECT (demux, "pushing protection event for stream %d:%s",
|
|
|
|
stream->index, GST_STR_NULL (stream->name));
|
|
|
|
gst_pad_push_event (stream->pad, protect_event);
|
|
|
|
}
|
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-04-14 09:53:46 +00:00
|
|
|
/* need to refresh segment info ASAP */
|
2011-11-26 09:01:07 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (lace_time) && demux->need_segment) {
|
|
|
|
GstSegment *segment = &demux->common.segment;
|
2012-07-24 19:11:18 +00:00
|
|
|
guint64 clace_time;
|
2013-07-25 04:39:58 +00:00
|
|
|
GstEvent *segment_event;
|
2011-11-26 09:01:07 +00:00
|
|
|
|
2011-09-21 17:45:42 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (demux->stream_start_time)) {
|
|
|
|
demux->stream_start_time = lace_time;
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Setting stream start time to %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (lace_time));
|
|
|
|
}
|
2012-07-24 19:11:18 +00:00
|
|
|
clace_time = MAX (lace_time, demux->stream_start_time);
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (demux->common.segment.position) &&
|
|
|
|
demux->common.segment.position != 0) {
|
2012-07-23 15:37:58 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
2012-07-24 19:11:18 +00:00
|
|
|
"using stored seek position %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (demux->common.segment.position));
|
2017-07-01 16:57:47 +00:00
|
|
|
clace_time = demux->common.segment.position;
|
2012-07-24 19:11:18 +00:00
|
|
|
segment->position = GST_CLOCK_TIME_NONE;
|
2012-04-19 06:37:28 +00:00
|
|
|
}
|
2012-07-24 19:11:18 +00:00
|
|
|
segment->start = clace_time;
|
|
|
|
segment->stop = GST_CLOCK_TIME_NONE;
|
|
|
|
segment->time = segment->start - demux->stream_start_time;
|
|
|
|
segment->position = segment->start - demux->stream_start_time;
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"generated segment starting at %" GST_TIME_FORMAT ": %"
|
|
|
|
GST_SEGMENT_FORMAT, GST_TIME_ARGS (lace_time), segment);
|
2010-04-14 09:53:46 +00:00
|
|
|
/* now convey our segment notion downstream */
|
2013-07-25 04:39:58 +00:00
|
|
|
segment_event = gst_event_new_segment (segment);
|
|
|
|
if (demux->segment_seqnum)
|
|
|
|
gst_event_set_seqnum (segment_event, demux->segment_seqnum);
|
2013-10-02 13:56:53 +00:00
|
|
|
gst_matroska_demux_send_event (demux, segment_event);
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->need_segment = FALSE;
|
2013-07-25 04:39:58 +00:00
|
|
|
demux->segment_seqnum = 0;
|
2010-04-14 09:53:46 +00:00
|
|
|
}
|
|
|
|
|
2014-03-22 16:05:17 +00:00
|
|
|
/* send pending codec data headers for all streams,
|
|
|
|
* before we perform sync across all streams */
|
|
|
|
gst_matroska_demux_push_codec_data_all (demux);
|
2013-06-11 11:54:53 +00:00
|
|
|
|
2011-07-07 16:27:36 +00:00
|
|
|
if (block_duration != -1) {
|
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
|
|
|
if (stream->timecodescale == 1.0)
|
2011-05-23 15:06:44 +00:00
|
|
|
duration = gst_util_uint64_scale (block_duration,
|
|
|
|
demux->common.time_scale, 1);
|
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
|
|
|
else
|
|
|
|
duration =
|
|
|
|
gst_util_gdouble_to_guint64 (gst_util_guint64_to_gdouble
|
2011-05-23 15:06:44 +00:00
|
|
|
(gst_util_uint64_scale (block_duration, demux->common.time_scale,
|
2010-05-23 12:56:16 +00:00
|
|
|
1)) * stream->timecodescale);
|
2005-10-18 18:12:31 +00:00
|
|
|
} else if (stream->default_duration) {
|
2008-06-19 08:22:16 +00:00
|
|
|
duration = stream->default_duration * laces;
|
2004-08-25 14:41:12 +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
|
|
|
/* else duration is diff between timecode of this and next block */
|
2010-06-06 13:12:16 +00:00
|
|
|
|
2012-10-27 12:24:24 +00:00
|
|
|
if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
|
2016-02-17 13:37:44 +00:00
|
|
|
/* For SimpleBlock, look at the keyframe bit in flags. Otherwise,
|
|
|
|
a ReferenceBlock implies that this is not a keyframe. In either
|
|
|
|
case, it only makes sense for video streams. */
|
2012-10-27 12:24:24 +00:00
|
|
|
if ((is_simpleblock && !(flags & 0x80)) || referenceblock) {
|
|
|
|
delta_unit = TRUE;
|
|
|
|
invisible_frame = ((flags & 0x08)) &&
|
2013-06-21 11:11:32 +00:00
|
|
|
(!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8) ||
|
2017-12-13 09:22:17 +00:00
|
|
|
!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9) ||
|
|
|
|
!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_VIDEO_AV1));
|
2012-10-27 12:24:24 +00:00
|
|
|
}
|
2016-02-17 13:37:44 +00:00
|
|
|
|
|
|
|
/* If we're doing a keyframe-only trickmode, only push keyframes on video
|
|
|
|
* streams */
|
|
|
|
if (delta_unit
|
2018-05-17 11:58:25 +00:00
|
|
|
&& demux->common.segment.
|
|
|
|
flags & GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS) {
|
2016-02-17 13:37:44 +00:00
|
|
|
GST_LOG_OBJECT (demux, "Skipping non-keyframe on stream %d",
|
|
|
|
stream->index);
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
2012-10-27 12:24:24 +00:00
|
|
|
}
|
2010-06-06 13:12:16 +00:00
|
|
|
|
2004-08-25 14:41:12 +00:00
|
|
|
for (n = 0; n < laces; n++) {
|
2004-12-18 22:40:24 +00:00
|
|
|
GstBuffer *sub;
|
2008-06-19 08:22:16 +00:00
|
|
|
|
2010-05-13 10:10:54 +00:00
|
|
|
if (G_UNLIKELY (lace_size[n] > size)) {
|
|
|
|
GST_WARNING_OBJECT (demux, "Invalid lace size");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-05-23 07:32:08 +00:00
|
|
|
/* QoS for video track with an index. the assumption is that
|
|
|
|
index entries point to keyframes, but if that is not true we
|
|
|
|
will instad skip until the next keyframe. */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (lace_time) &&
|
|
|
|
stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO &&
|
2011-06-05 17:15:55 +00:00
|
|
|
stream->index_table && demux->common.segment.rate > 0.0) {
|
2010-05-23 07:32:08 +00:00
|
|
|
GstMatroskaTrackVideoContext *videocontext =
|
|
|
|
(GstMatroskaTrackVideoContext *) stream;
|
|
|
|
GstClockTime earliest_time;
|
2010-05-31 05:49:21 +00:00
|
|
|
GstClockTime earliest_stream_time;
|
|
|
|
|
2010-05-23 07:32:08 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
earliest_time = videocontext->earliest_time;
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2015-09-25 22:12:46 +00:00
|
|
|
earliest_stream_time =
|
|
|
|
gst_segment_position_from_running_time (&demux->common.segment,
|
2010-05-31 05:49:21 +00:00
|
|
|
GST_FORMAT_TIME, earliest_time);
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (lace_time) &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (earliest_stream_time) &&
|
|
|
|
lace_time <= earliest_stream_time) {
|
|
|
|
/* find index entry (keyframe) <= earliest_stream_time */
|
2010-05-23 07:32:08 +00:00
|
|
|
GstMatroskaIndex *entry =
|
|
|
|
gst_util_array_binary_search (stream->index_table->data,
|
|
|
|
stream->index_table->len, sizeof (GstMatroskaIndex),
|
|
|
|
(GCompareDataFunc) gst_matroska_index_seek_find,
|
2010-05-31 05:49:21 +00:00
|
|
|
GST_SEARCH_MODE_BEFORE, &earliest_stream_time, NULL);
|
|
|
|
|
2010-05-23 07:32:08 +00:00
|
|
|
/* if that entry (keyframe) is after the current the current
|
|
|
|
buffer, we can skip pushing (and thus decoding) all
|
|
|
|
buffers until that keyframe. */
|
|
|
|
if (entry && GST_CLOCK_TIME_IS_VALID (entry->time) &&
|
|
|
|
entry->time > lace_time) {
|
|
|
|
GST_LOG_OBJECT (demux, "Skipping lace before late keyframe");
|
|
|
|
stream->set_discont = TRUE;
|
|
|
|
goto next_lace;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
sub = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL,
|
|
|
|
gst_buffer_get_size (buf) - size, lace_size[n]);
|
2009-10-03 07:52:57 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "created subbuffer %p", sub);
|
2004-08-25 14:41:12 +00:00
|
|
|
|
2010-06-06 13:12:16 +00:00
|
|
|
if (delta_unit)
|
|
|
|
GST_BUFFER_FLAG_SET (sub, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
else
|
|
|
|
GST_BUFFER_FLAG_UNSET (sub, GST_BUFFER_FLAG_DELTA_UNIT);
|
|
|
|
|
2012-10-27 12:24:24 +00:00
|
|
|
if (invisible_frame)
|
|
|
|
GST_BUFFER_FLAG_SET (sub, GST_BUFFER_FLAG_DECODE_ONLY);
|
|
|
|
|
2006-09-04 16:21:17 +00:00
|
|
|
if (stream->encodings != NULL && stream->encodings->len > 0)
|
|
|
|
sub = gst_matroska_decode_buffer (stream, sub);
|
|
|
|
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
if (sub == NULL) {
|
|
|
|
GST_WARNING_OBJECT (demux, "Decoding buffer failed");
|
|
|
|
goto next_lace;
|
|
|
|
}
|
|
|
|
|
2015-03-11 20:25:40 +00:00
|
|
|
if (!stream->dts_only) {
|
2015-02-26 01:12:18 +00:00
|
|
|
GST_BUFFER_PTS (sub) = lace_time;
|
2015-03-11 20:25:40 +00:00
|
|
|
} else {
|
2015-02-26 01:12:18 +00:00
|
|
|
GST_BUFFER_DTS (sub) = lace_time;
|
2015-03-11 20:25:40 +00:00
|
|
|
if (stream->intra_only)
|
|
|
|
GST_BUFFER_PTS (sub) = lace_time;
|
|
|
|
}
|
2008-06-19 08:22:16 +00:00
|
|
|
|
2015-10-20 12:28:10 +00:00
|
|
|
buffer_timestamp = gst_matroska_track_get_buffer_timestamp (stream, sub);
|
|
|
|
|
2009-12-09 15:41:04 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (lace_time)) {
|
2009-12-09 19:42:44 +00:00
|
|
|
GstClockTime last_stop_end;
|
|
|
|
|
2009-12-09 15:43:41 +00:00
|
|
|
/* Check if this stream is after segment stop */
|
2011-06-05 17:15:55 +00:00
|
|
|
if (GST_CLOCK_TIME_IS_VALID (demux->common.segment.stop) &&
|
|
|
|
lace_time >= demux->common.segment.stop) {
|
2009-12-09 15:43:41 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Stream %d after segment stop %" GST_TIME_FORMAT, stream->index,
|
2011-06-05 17:15:55 +00:00
|
|
|
GST_TIME_ARGS (demux->common.segment.stop));
|
2010-03-23 16:34:50 +00:00
|
|
|
gst_buffer_unref (sub);
|
|
|
|
goto eos;
|
|
|
|
}
|
2012-07-20 09:07:58 +00:00
|
|
|
if (offset >= stream->to_offset
|
|
|
|
|| (GST_CLOCK_TIME_IS_VALID (demux->to_time)
|
|
|
|
&& lace_time > demux->to_time)) {
|
2010-03-23 16:34:50 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Stream %d after playback section",
|
|
|
|
stream->index);
|
|
|
|
gst_buffer_unref (sub);
|
|
|
|
goto eos;
|
2009-12-09 15:43:41 +00:00
|
|
|
}
|
|
|
|
|
2010-01-28 17:53:18 +00:00
|
|
|
/* handle gaps, e.g. non-zero start-time, or an cue index entry
|
|
|
|
* that landed us with timestamps not quite intended */
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-09-14 12:46:00 +00:00
|
|
|
if (demux->max_gap_time &&
|
|
|
|
GST_CLOCK_TIME_IS_VALID (demux->last_stop_end) &&
|
2011-06-05 17:15:55 +00:00
|
|
|
demux->common.segment.rate > 0.0) {
|
2010-01-28 17:53:18 +00:00
|
|
|
GstClockTimeDiff diff;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
/* only send segments with increasing start times,
|
2010-01-28 17:53:18 +00:00
|
|
|
* otherwise if these go back and forth downstream (sinks) increase
|
|
|
|
* accumulated time and running_time */
|
2011-09-08 13:02:05 +00:00
|
|
|
diff = GST_CLOCK_DIFF (demux->last_stop_end, lace_time);
|
2011-09-15 14:53:47 +00:00
|
|
|
if (diff > 0 && diff > demux->max_gap_time
|
2011-09-14 12:46:00 +00:00
|
|
|
&& lace_time > demux->common.segment.start
|
2011-06-05 17:15:55 +00:00
|
|
|
&& (!GST_CLOCK_TIME_IS_VALID (demux->common.segment.stop)
|
|
|
|
|| lace_time < demux->common.segment.stop)) {
|
2014-07-01 14:14:34 +00:00
|
|
|
GstEvent *event;
|
2009-12-09 15:41:04 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Gap of %" G_GINT64_FORMAT " ns detected in"
|
2010-02-15 10:33:02 +00:00
|
|
|
"stream %d (%" GST_TIME_FORMAT " -> %" GST_TIME_FORMAT "). "
|
2011-11-26 09:01:07 +00:00
|
|
|
"Sending updated SEGMENT events", diff,
|
2010-01-28 17:53:18 +00:00
|
|
|
stream->index, GST_TIME_ARGS (stream->pos),
|
|
|
|
GST_TIME_ARGS (lace_time));
|
2014-07-01 14:14:34 +00:00
|
|
|
|
|
|
|
event = gst_event_new_gap (demux->last_stop_end, diff);
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2014-07-01 14:14:34 +00:00
|
|
|
gst_pad_push_event (stream->pad, event);
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2009-12-09 15:41:04 +00:00
|
|
|
}
|
2008-06-19 08:22:16 +00:00
|
|
|
}
|
2009-12-09 19:42:44 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (demux->common.segment.position)
|
|
|
|
|| demux->common.segment.position < lace_time) {
|
|
|
|
demux->common.segment.position = lace_time;
|
2009-12-09 19:42:44 +00:00
|
|
|
}
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2009-12-09 19:42:44 +00:00
|
|
|
|
|
|
|
last_stop_end = lace_time;
|
|
|
|
if (duration) {
|
|
|
|
GST_BUFFER_DURATION (sub) = duration / laces;
|
|
|
|
last_stop_end += GST_BUFFER_DURATION (sub);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (demux->last_stop_end) ||
|
|
|
|
demux->last_stop_end < last_stop_end)
|
|
|
|
demux->last_stop_end = last_stop_end;
|
|
|
|
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-06-05 17:15:55 +00:00
|
|
|
if (demux->common.segment.duration == -1 ||
|
2011-12-12 14:15:46 +00:00
|
|
|
demux->stream_start_time + demux->common.segment.duration <
|
|
|
|
last_stop_end) {
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->common.segment.duration =
|
|
|
|
last_stop_end - demux->stream_start_time;
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2012-01-28 10:13:16 +00:00
|
|
|
if (!demux->invalid_duration) {
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (demux),
|
2012-09-02 00:31:53 +00:00
|
|
|
gst_message_new_duration_changed (GST_OBJECT_CAST (demux)));
|
2012-01-28 10:13:16 +00:00
|
|
|
demux->invalid_duration = TRUE;
|
|
|
|
}
|
2011-05-04 09:55:21 +00:00
|
|
|
} else {
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2009-12-09 19:42:44 +00:00
|
|
|
}
|
2008-06-19 08:22:16 +00:00
|
|
|
}
|
2009-12-09 19:42:44 +00:00
|
|
|
|
2009-12-09 15:41:04 +00:00
|
|
|
stream->pos = lace_time;
|
2008-06-19 08:22:16 +00:00
|
|
|
|
2005-01-27 23:30:17 +00:00
|
|
|
gst_matroska_demux_sync_streams (demux);
|
2004-08-25 14:41:12 +00:00
|
|
|
|
2006-04-20 13:23:40 +00:00
|
|
|
if (stream->set_discont) {
|
2010-05-28 14:37:32 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "marking DISCONT");
|
2006-04-20 13:23:40 +00:00
|
|
|
GST_BUFFER_FLAG_SET (sub, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
stream->set_discont = FALSE;
|
2013-07-17 15:11:44 +00:00
|
|
|
} else {
|
|
|
|
GST_BUFFER_FLAG_UNSET (sub, GST_BUFFER_FLAG_DISCONT);
|
2006-04-20 13:23:40 +00:00
|
|
|
}
|
|
|
|
|
2010-03-23 16:34:50 +00:00
|
|
|
/* reverse playback book-keeping */
|
|
|
|
if (!GST_CLOCK_TIME_IS_VALID (stream->from_time))
|
|
|
|
stream->from_time = lace_time;
|
2010-05-28 14:37:32 +00:00
|
|
|
if (stream->from_offset == -1)
|
|
|
|
stream->from_offset = offset;
|
2010-03-23 16:34:50 +00:00
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
2012-01-13 23:12:05 +00:00
|
|
|
"Pushing lace %d, data of size %" G_GSIZE_FORMAT
|
|
|
|
" for stream %d, time=%" GST_TIME_FORMAT " and duration=%"
|
|
|
|
GST_TIME_FORMAT, n, gst_buffer_get_size (sub), stream_num,
|
2015-03-03 17:40:16 +00:00
|
|
|
GST_TIME_ARGS (buffer_timestamp),
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (sub)));
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2011-12-30 17:41:46 +00:00
|
|
|
#if 0
|
2011-05-23 15:06:44 +00:00
|
|
|
if (demux->common.element_index) {
|
2009-05-14 12:46:14 +00:00
|
|
|
if (stream->index_writer_id == -1)
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_index_get_writer_id (demux->common.element_index,
|
2009-05-14 12:46:14 +00:00
|
|
|
GST_OBJECT (stream->pad), &stream->index_writer_id);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "adding association %" GST_TIME_FORMAT "-> %"
|
|
|
|
G_GUINT64_FORMAT " for writer id %d",
|
2015-03-03 17:40:16 +00:00
|
|
|
GST_TIME_ARGS (buffer_timestamp), cluster_offset,
|
2009-05-14 12:46:14 +00:00
|
|
|
stream->index_writer_id);
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_index_add_association (demux->common.element_index,
|
2009-05-14 12:46:14 +00:00
|
|
|
stream->index_writer_id, GST_BUFFER_FLAG_IS_SET (sub,
|
|
|
|
GST_BUFFER_FLAG_DELTA_UNIT) ? 0 : GST_ASSOCIATION_FLAG_KEY_UNIT,
|
2015-03-03 17:40:16 +00:00
|
|
|
GST_FORMAT_TIME, buffer_timestamp, GST_FORMAT_BYTES, cluster_offset,
|
|
|
|
NULL);
|
2009-05-14 12:46:14 +00:00
|
|
|
}
|
2011-12-30 17:41:46 +00:00
|
|
|
#endif
|
2009-05-14 12:46:14 +00:00
|
|
|
|
2008-06-19 09:12:55 +00:00
|
|
|
/* Postprocess the buffers depending on the codec used */
|
|
|
|
if (stream->postprocess_frame) {
|
2009-06-23 10:42:33 +00:00
|
|
|
GST_LOG_OBJECT (demux, "running post process");
|
2008-06-19 09:12:55 +00:00
|
|
|
ret = stream->postprocess_frame (GST_ELEMENT (demux), stream, &sub);
|
2006-06-22 16:27:03 +00:00
|
|
|
}
|
|
|
|
|
2011-09-27 14:59:24 +00:00
|
|
|
/* At this point, we have a sub-buffer pointing at data within a larger
|
|
|
|
buffer. This data might not be aligned with anything. If the data is
|
|
|
|
raw samples though, we want it aligned to the raw type (eg, 4 bytes
|
|
|
|
for 32 bit samples, etc), or bad things will happen downstream as
|
|
|
|
elements typically assume minimal alignment.
|
|
|
|
Therefore, create an aligned copy if necessary. */
|
2011-11-26 09:01:07 +00:00
|
|
|
sub = gst_matroska_demux_align_buffer (demux, sub, stream->alignment);
|
2011-09-27 14:59:24 +00:00
|
|
|
|
2015-11-03 10:40:15 +00:00
|
|
|
if (!strcmp (stream->codec_id, GST_MATROSKA_CODEC_ID_AUDIO_OPUS)) {
|
|
|
|
guint64 start_clip = 0, end_clip = 0;
|
|
|
|
|
|
|
|
/* Codec delay is part of the timestamps */
|
|
|
|
if (GST_BUFFER_PTS_IS_VALID (sub) && stream->codec_delay) {
|
|
|
|
if (GST_BUFFER_PTS (sub) > stream->codec_delay) {
|
|
|
|
GST_BUFFER_PTS (sub) -= stream->codec_delay;
|
|
|
|
} else {
|
|
|
|
GST_BUFFER_PTS (sub) = 0;
|
2018-02-16 22:40:50 +00:00
|
|
|
|
|
|
|
/* Opus GstAudioClippingMeta units are scaled by 48000/sample_rate.
|
|
|
|
That is, if a Opus track has audio encoded at 24000 Hz and 132
|
|
|
|
samples need to be clipped, GstAudioClippingMeta.start will be
|
|
|
|
set to 264. (This is also the case for buffer offsets.)
|
|
|
|
Opus sample rates are always divisors of 48000 Hz, which is the
|
|
|
|
maximum allowed sample rate. */
|
2015-11-03 10:40:15 +00:00
|
|
|
start_clip =
|
|
|
|
gst_util_uint64_scale_round (stream->codec_delay, 48000,
|
|
|
|
GST_SECOND);
|
|
|
|
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (sub)) {
|
|
|
|
if (GST_BUFFER_DURATION (sub) > stream->codec_delay)
|
|
|
|
GST_BUFFER_DURATION (sub) -= stream->codec_delay;
|
|
|
|
else
|
|
|
|
GST_BUFFER_DURATION (sub) = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (block_discardpadding) {
|
|
|
|
end_clip =
|
|
|
|
gst_util_uint64_scale_round (block_discardpadding, 48000,
|
|
|
|
GST_SECOND);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (start_clip || end_clip) {
|
|
|
|
gst_buffer_add_audio_clipping_meta (sub, GST_FORMAT_DEFAULT,
|
|
|
|
start_clip, end_clip);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-20 22:55:26 +00:00
|
|
|
if (GST_BUFFER_PTS_IS_VALID (sub)) {
|
|
|
|
stream->pos = GST_BUFFER_PTS (sub);
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (sub))
|
|
|
|
stream->pos += GST_BUFFER_DURATION (sub);
|
2015-02-26 01:12:18 +00:00
|
|
|
} else if (GST_BUFFER_DTS_IS_VALID (sub)) {
|
|
|
|
stream->pos = GST_BUFFER_DTS (sub);
|
|
|
|
if (GST_BUFFER_DURATION_IS_VALID (sub))
|
|
|
|
stream->pos += GST_BUFFER_DURATION (sub);
|
2013-09-20 22:55:26 +00:00
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
ret = gst_pad_push (stream->pad, sub);
|
2012-07-20 09:07:58 +00:00
|
|
|
|
2011-06-05 17:15:55 +00:00
|
|
|
if (demux->common.segment.rate < 0) {
|
2012-01-03 14:26:21 +00:00
|
|
|
if (lace_time > demux->common.segment.stop && ret == GST_FLOW_EOS) {
|
|
|
|
/* In reverse playback we can get a GST_FLOW_EOS when
|
2010-05-28 14:37:32 +00:00
|
|
|
* we are at the end of the segment, so we just need to jump
|
|
|
|
* back to the previous section. */
|
|
|
|
GST_DEBUG_OBJECT (demux, "downstream has reached end of segment");
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
}
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
/* combine flows */
|
2015-03-23 19:56:41 +00:00
|
|
|
ret = gst_flow_combiner_update_pad_flow (demux->flowcombiner,
|
|
|
|
stream->pad, ret);
|
2004-08-25 14:41:12 +00:00
|
|
|
|
Decode the codec private data and following ContentEncoding if necessary.
Original commit message from CVS:
* configure.ac:
* gst/matroska/Makefile.am:
* gst/matroska/lzo.c: (get_byte), (get_len), (copy),
(copy_backptr), (lzo1x_decode), (main):
* gst/matroska/lzo.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_read_track_encoding),
(gst_matroska_decompress_data), (gst_matroska_decode_data),
(gst_matroska_decode_buffer),
(gst_matroska_decode_content_encodings),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_blockgroup_or_simpleblock):
* gst/matroska/matroska-ids.h:
Decode the codec private data and following ContentEncoding if
necessary.
Support bzip2, lzo and header stripped compression. For lzo use the
ffmpeg lzo implementation as liblzo is GPL licensed.
Fix zlib decompression.
2008-08-02 18:18:05 +00:00
|
|
|
next_lace:
|
2004-08-25 14:41:12 +00:00
|
|
|
size -= lace_size[n];
|
2008-08-21 13:22:06 +00:00
|
|
|
if (lace_time != GST_CLOCK_TIME_NONE && duration)
|
2008-06-19 08:22:16 +00:00
|
|
|
lace_time += duration / laces;
|
2008-08-21 13:22:06 +00:00
|
|
|
else
|
|
|
|
lace_time = GST_CLOCK_TIME_NONE;
|
2004-08-25 14:41:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
done:
|
2011-11-26 09:01:07 +00:00
|
|
|
if (buf) {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (buf, &map);
|
2004-08-25 14:41:12 +00:00
|
|
|
gst_buffer_unref (buf);
|
2011-11-26 09:01:07 +00:00
|
|
|
}
|
2004-08-25 14:41:12 +00:00
|
|
|
g_free (lace_size);
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2010-03-23 16:34:50 +00:00
|
|
|
|
|
|
|
/* EXITS */
|
|
|
|
eos:
|
|
|
|
{
|
|
|
|
stream->eos = TRUE;
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
/* combine flows */
|
2015-03-23 19:56:41 +00:00
|
|
|
ret = gst_flow_combiner_update_pad_flow (demux->flowcombiner, stream->pad,
|
|
|
|
ret);
|
2010-03-23 16:34:50 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2010-08-16 14:05:41 +00:00
|
|
|
invalid_lacing:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_WARNING (demux, STREAM, DEMUX, (NULL), ("Invalid lacing size"));
|
|
|
|
/* non-fatal, try next block(group) */
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
data_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_WARNING (demux, STREAM, DEMUX, (NULL), ("Data error"));
|
|
|
|
/* non-fatal, try next block(group) */
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto done;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2009-12-16 11:48:02 +00:00
|
|
|
/* return FALSE if block(group) should be skipped (due to a seek) */
|
|
|
|
static inline gboolean
|
|
|
|
gst_matroska_demux_seek_block (GstMatroskaDemux * demux)
|
|
|
|
{
|
|
|
|
if (G_UNLIKELY (demux->seek_block)) {
|
|
|
|
if (!(--demux->seek_block)) {
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (demux, "should skip block due to seek");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_matroska_demux_parse_contents_seekentry (GstMatroskaDemux * demux,
|
|
|
|
GstEbmlRead * ebml)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret;
|
2005-10-18 18:12:31 +00:00
|
|
|
guint64 seek_pos = (guint64) - 1;
|
|
|
|
guint32 seek_id = 0;
|
|
|
|
guint32 id;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "Seek");
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "Seek", ret);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
switch (id) {
|
|
|
|
case GST_MATROSKA_ID_SEEKID:
|
|
|
|
{
|
|
|
|
guint64 t;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &t)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "SeekID: %" G_GUINT64_FORMAT, t);
|
|
|
|
seek_id = t;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
case GST_MATROSKA_ID_SEEKPOSITION:
|
|
|
|
{
|
|
|
|
guint64 t;
|
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
if ((ret = gst_ebml_read_uint (ebml, &id, &t)) != GST_FLOW_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (t > G_MAXINT64) {
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Too large SeekPosition %" G_GUINT64_FORMAT, t);
|
|
|
|
break;
|
2004-03-15 19:32:27 +00:00
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "SeekPosition: %" G_GUINT64_FORMAT, t);
|
|
|
|
seek_pos = t;
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
default:
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_parse_skip (&demux->common, ebml,
|
|
|
|
"SeekHead", id);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-03 14:26:21 +00:00
|
|
|
if (ret != GST_FLOW_OK && ret != GST_FLOW_EOS)
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
if (!seek_id || seek_pos == (guint64) - 1) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "Incomplete seekhead entry (0x%x/%"
|
2005-10-18 18:12:31 +00:00
|
|
|
G_GUINT64_FORMAT ")", seek_id, seek_pos);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return GST_FLOW_OK;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
switch (seek_id) {
|
2010-05-18 12:44:15 +00:00
|
|
|
case GST_MATROSKA_ID_SEEKHEAD:
|
|
|
|
{
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
case GST_MATROSKA_ID_CUES:
|
|
|
|
case GST_MATROSKA_ID_TAGS:
|
2008-06-13 19:07:03 +00:00
|
|
|
case GST_MATROSKA_ID_TRACKS:
|
|
|
|
case GST_MATROSKA_ID_SEGMENTINFO:
|
|
|
|
case GST_MATROSKA_ID_ATTACHMENTS:
|
|
|
|
case GST_MATROSKA_ID_CHAPTERS:
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
|
|
|
guint64 before_pos, length;
|
2010-05-18 12:44:15 +00:00
|
|
|
guint needed;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
/* remember */
|
2011-05-27 14:00:48 +00:00
|
|
|
length = gst_matroska_read_common_get_length (&demux->common);
|
2011-05-23 15:06:44 +00:00
|
|
|
before_pos = demux->common.offset;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-07-27 13:58:02 +00:00
|
|
|
if (length == (guint64) - 1) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "no upstream length, skipping SeakHead entry");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
/* check for validity */
|
2011-05-23 15:06:44 +00:00
|
|
|
if (seek_pos + demux->common.ebml_segment_start + 12 >= length) {
|
2005-10-18 18:12:31 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
"SeekHead reference lies outside file!" " (%"
|
2005-10-18 18:12:31 +00:00
|
|
|
G_GUINT64_FORMAT "+%" G_GUINT64_FORMAT "+12 >= %"
|
2011-05-23 15:06:44 +00:00
|
|
|
G_GUINT64_FORMAT ")", seek_pos, demux->common.ebml_segment_start,
|
|
|
|
length);
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
/* only pick up index location when streaming */
|
|
|
|
if (demux->streaming) {
|
|
|
|
if (seek_id == GST_MATROSKA_ID_CUES) {
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->index_offset = seek_pos + demux->common.ebml_segment_start;
|
2010-04-14 09:53:46 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Cues located at offset %" G_GUINT64_FORMAT,
|
|
|
|
demux->index_offset);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
/* seek */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = seek_pos + demux->common.ebml_segment_start;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
/* check ID */
|
2011-05-23 15:06:44 +00:00
|
|
|
if ((ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed)) !=
|
|
|
|
GST_FLOW_OK)
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
goto finish;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
if (id != seek_id) {
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"We looked for ID=0x%x but got ID=0x%x (pos=%" G_GUINT64_FORMAT ")",
|
2011-05-23 15:06:44 +00:00
|
|
|
seek_id, id, seek_pos + demux->common.ebml_segment_start);
|
2010-05-18 12:44:15 +00:00
|
|
|
} else {
|
|
|
|
/* now parse */
|
|
|
|
ret = gst_matroska_demux_parse_id (demux, id, length, needed);
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
finish:
|
|
|
|
/* seek back */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = before_pos;
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2011-02-10 10:56:33 +00:00
|
|
|
case GST_MATROSKA_ID_CLUSTER:
|
|
|
|
{
|
2011-05-23 15:06:44 +00:00
|
|
|
guint64 pos = seek_pos + demux->common.ebml_segment_start;
|
2011-02-10 10:56:33 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "Cluster position");
|
|
|
|
if (G_UNLIKELY (!demux->clusters))
|
|
|
|
demux->clusters = g_array_sized_new (TRUE, TRUE, sizeof (guint64), 100);
|
|
|
|
g_array_append_val (demux->clusters, pos);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
default:
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Ignoring Seek entry for ID=0x%x", seek_id);
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
|
|
|
}
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "Seek", ret);
|
2004-03-15 19:32:27 +00:00
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_matroska_demux_parse_contents (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2005-10-18 18:12:31 +00:00
|
|
|
guint32 id;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
DEBUG_ELEMENT_START (demux, ebml, "SeekHead");
|
|
|
|
|
|
|
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "SeekHead", ret);
|
|
|
|
return ret;
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
|
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
switch (id) {
|
|
|
|
case GST_MATROSKA_ID_SEEKENTRY:
|
|
|
|
{
|
2010-05-18 12:44:15 +00:00
|
|
|
ret = gst_matroska_demux_parse_contents_seekentry (demux, ebml);
|
2008-08-22 12:24:23 +00:00
|
|
|
/* Ignore EOS and errors here */
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Ignoring %s", gst_flow_get_name (ret));
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-12-07 23:05:58 +00:00
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
default:
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_parse_skip (&demux->common,
|
|
|
|
ebml, "SeekHead", id);
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-22 12:24:23 +00:00
|
|
|
|
gst/matroska/matroska-demux.c: Improve debug output everywhere and fix the EOS logic.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_reset),
(gst_matroska_demux_stream_from_num),
(gst_matroska_demux_encoding_cmp),
(gst_matroska_demux_encoding_order_unique),
(gst_matroska_demux_read_track_encoding),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_tracknumber_unique),
(gst_matroska_demux_add_stream), (gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attached_file),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_sync_streams), (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_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop):
Improve debug output everywhere and fix the EOS logic.
Check the values of the ContentEncoding elements more strictly and
don't use tracks for which it's invalid.
Check that the track number is unique for this stream.
Check that seek positions are below G_MAXINT64 as our seeks are
int64-based and overflows will fail badly.
After seeks also don't push SimpleBlocks until the first one
containing a keyframe is found. Before this was done only for normal
Blocks.
Update some FIXME/TODOs.
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_utf8), (gst_ebml_read_header):
Improve debug output.
* gst/matroska/matroska-ids.c:
(gst_matroska_track_init_video_context):
* gst/matroska/matroska-ids.h:
* gst/matroska/matroska-mux.c:
(gst_matroska_mux_video_pad_setcaps):
Remove eye mode and don't parse it anymore. We can't use that
information in GStreamer yet so it's useless.
2008-06-18 10:28:20 +00:00
|
|
|
DEBUG_ELEMENT_STOP (demux, ebml, "SeekHead", ret);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-02-10 10:56:33 +00:00
|
|
|
/* Sort clusters by position for easier searching */
|
2011-02-14 16:49:54 +00:00
|
|
|
if (demux->clusters)
|
|
|
|
g_array_sort (demux->clusters, (GCompareFunc) gst_matroska_cluster_compare);
|
2011-02-10 10:56:33 +00:00
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2010-08-16 14:05:41 +00:00
|
|
|
#define GST_FLOW_OVERFLOW GST_FLOW_CUSTOM_ERROR
|
|
|
|
|
2010-12-29 23:38:18 +00:00
|
|
|
#define MAX_BLOCK_SIZE (15 * 1024 * 1024)
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
static inline GstFlowReturn
|
|
|
|
gst_matroska_demux_check_read_size (GstMatroskaDemux * demux, guint64 bytes)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2010-12-29 23:38:18 +00:00
|
|
|
if (G_UNLIKELY (bytes > MAX_BLOCK_SIZE)) {
|
2010-05-18 12:44:15 +00:00
|
|
|
/* only a few blocks are expected/allowed to be large,
|
|
|
|
* and will be recursed into, whereas others will be read and must fit */
|
2010-08-16 14:05:41 +00:00
|
|
|
if (demux->streaming) {
|
|
|
|
/* fatal in streaming case, as we can't step over easily */
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
|
|
|
|
("reading large block of size %" G_GUINT64_FORMAT " not supported; "
|
|
|
|
"file might be corrupt.", bytes));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
} else {
|
|
|
|
/* indicate higher level to quietly give up */
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"too large block of size %" G_GUINT64_FORMAT, bytes);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
} else {
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-07-26 13:51:49 +00:00
|
|
|
/* returns TRUE if we truely are in error state, and should give up */
|
2014-09-04 13:21:20 +00:00
|
|
|
static inline GstFlowReturn
|
2010-07-26 13:51:49 +00:00
|
|
|
gst_matroska_demux_check_parse_error (GstMatroskaDemux * demux)
|
|
|
|
{
|
|
|
|
if (!demux->streaming && demux->next_cluster_offset > 0) {
|
|
|
|
/* just repositioning to where next cluster should be and try from there */
|
|
|
|
GST_WARNING_OBJECT (demux, "parse error, trying next cluster expected at %"
|
|
|
|
G_GUINT64_FORMAT, demux->next_cluster_offset);
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = demux->next_cluster_offset;
|
2010-07-26 13:51:49 +00:00
|
|
|
demux->next_cluster_offset = 0;
|
2014-09-04 13:21:20 +00:00
|
|
|
return GST_FLOW_OK;
|
2010-07-26 13:51:49 +00:00
|
|
|
} else {
|
2010-08-17 10:08:10 +00:00
|
|
|
gint64 pos;
|
2014-09-04 13:21:20 +00:00
|
|
|
GstFlowReturn ret;
|
2010-08-17 10:08:10 +00:00
|
|
|
|
|
|
|
/* sigh, one last attempt above and beyond call of duty ...;
|
|
|
|
* search for cluster mark following current pos */
|
2011-05-23 15:06:44 +00:00
|
|
|
pos = demux->common.offset;
|
2010-08-17 10:08:10 +00:00
|
|
|
GST_WARNING_OBJECT (demux, "parse error, looking for next cluster");
|
2017-06-10 11:46:20 +00:00
|
|
|
if ((ret = gst_matroska_demux_search_cluster (demux, &pos, TRUE)) !=
|
|
|
|
GST_FLOW_OK) {
|
2010-08-17 10:08:10 +00:00
|
|
|
/* did not work, give up */
|
2014-09-04 13:21:20 +00:00
|
|
|
return ret;
|
2010-08-17 10:08:10 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (demux, "... found at %" G_GUINT64_FORMAT, pos);
|
|
|
|
/* try that position */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = pos;
|
2014-09-04 13:21:20 +00:00
|
|
|
return GST_FLOW_OK;
|
2010-08-17 10:08:10 +00:00
|
|
|
}
|
2010-07-26 13:51:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-16 14:05:41 +00:00
|
|
|
static inline GstFlowReturn
|
|
|
|
gst_matroska_demux_flush (GstMatroskaDemux * demux, guint flush)
|
|
|
|
{
|
|
|
|
GST_LOG_OBJECT (demux, "skipping %d bytes", flush);
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset += flush;
|
2010-08-16 14:05:41 +00:00
|
|
|
if (demux->streaming) {
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
/* hard to skip large blocks when streaming */
|
|
|
|
ret = gst_matroska_demux_check_read_size (demux, flush);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
return ret;
|
2011-05-23 15:06:44 +00:00
|
|
|
if (flush <= gst_adapter_available (demux->common.adapter))
|
|
|
|
gst_adapter_flush (demux->common.adapter, flush);
|
2010-08-16 14:05:41 +00:00
|
|
|
else
|
2012-01-03 14:26:21 +00:00
|
|
|
return GST_FLOW_EOS;
|
2010-08-16 14:05:41 +00:00
|
|
|
}
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
/* initializes @ebml with @bytes from input stream at current offset.
|
2012-01-03 14:26:21 +00:00
|
|
|
* Returns EOS if insufficient available,
|
2010-05-18 12:44:15 +00:00
|
|
|
* ERROR if too much was attempted to read. */
|
|
|
|
static inline GstFlowReturn
|
|
|
|
gst_matroska_demux_take (GstMatroskaDemux * demux, guint64 bytes,
|
|
|
|
GstEbmlRead * ebml)
|
|
|
|
{
|
|
|
|
GstBuffer *buffer = NULL;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_LOG_OBJECT (demux, "taking %" G_GUINT64_FORMAT " bytes for parsing",
|
|
|
|
bytes);
|
|
|
|
ret = gst_matroska_demux_check_read_size (demux, bytes);
|
2010-08-16 14:05:41 +00:00
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK)) {
|
|
|
|
if (!demux->streaming) {
|
|
|
|
/* in pull mode, we can skip */
|
|
|
|
if ((ret = gst_matroska_demux_flush (demux, bytes)) == GST_FLOW_OK)
|
|
|
|
ret = GST_FLOW_OVERFLOW;
|
|
|
|
} else {
|
|
|
|
/* otherwise fatal */
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
goto exit;
|
2010-08-16 14:05:41 +00:00
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
if (demux->streaming) {
|
2011-05-23 15:06:44 +00:00
|
|
|
if (gst_adapter_available (demux->common.adapter) >= bytes)
|
|
|
|
buffer = gst_adapter_take_buffer (demux->common.adapter, bytes);
|
2010-05-18 12:44:15 +00:00
|
|
|
else
|
2012-01-03 14:26:21 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2010-05-18 12:44:15 +00:00
|
|
|
} else
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_bytes (&demux->common,
|
|
|
|
demux->common.offset, bytes, &buffer, NULL);
|
2010-05-18 12:44:15 +00:00
|
|
|
if (G_LIKELY (buffer)) {
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_ebml_read_init (ebml, GST_ELEMENT_CAST (demux), buffer,
|
|
|
|
demux->common.offset);
|
|
|
|
demux->common.offset += bytes;
|
2010-05-18 12:44:15 +00:00
|
|
|
}
|
|
|
|
exit:
|
|
|
|
return ret;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_check_seekability (GstMatroskaDemux * demux)
|
|
|
|
{
|
|
|
|
GstQuery *query;
|
|
|
|
gboolean seekable = FALSE;
|
|
|
|
gint64 start = -1, stop = -1;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
query = gst_query_new_seeking (GST_FORMAT_BYTES);
|
2011-05-23 15:06:44 +00:00
|
|
|
if (!gst_pad_peer_query (demux->common.sinkpad, query)) {
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "seeking query failed");
|
|
|
|
goto done;
|
|
|
|
}
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_query_parse_seeking (query, NULL, &seekable, &start, &stop);
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
/* try harder to query upstream size if we didn't get it the first time */
|
|
|
|
if (seekable && stop == -1) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "doing duration query to fix up unset stop");
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_pad_peer_query_duration (demux->common.sinkpad, GST_FORMAT_BYTES,
|
|
|
|
&stop);
|
2010-05-18 12:44:15 +00:00
|
|
|
}
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
/* if upstream doesn't know the size, it's likely that it's not seekable in
|
|
|
|
* practice even if it technically may be seekable */
|
|
|
|
if (seekable && (start != 0 || stop <= start)) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "seekable but unknown start/stop -> disable");
|
|
|
|
seekable = FALSE;
|
|
|
|
}
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
done:
|
|
|
|
GST_INFO_OBJECT (demux, "seekable: %d (%" G_GUINT64_FORMAT " - %"
|
|
|
|
G_GUINT64_FORMAT ")", seekable, start, stop);
|
|
|
|
demux->seekable = seekable;
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_query_unref (query);
|
|
|
|
}
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_matroska_demux_find_tracks (GstMatroskaDemux * demux)
|
|
|
|
{
|
|
|
|
guint32 id;
|
|
|
|
guint64 before_pos;
|
|
|
|
guint64 length;
|
|
|
|
guint needed;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Found Cluster element before Tracks, searching Tracks");
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
/* remember */
|
2011-05-23 15:06:44 +00:00
|
|
|
before_pos = demux->common.offset;
|
2008-07-02 08:47:00 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
/* Search Tracks element */
|
|
|
|
while (TRUE) {
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2010-05-18 12:44:15 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
if (id != GST_MATROSKA_ID_TRACKS) {
|
|
|
|
/* we may be skipping large cluster here, so forego size check etc */
|
|
|
|
/* ... but we can't skip undefined size; force error */
|
|
|
|
if (length == G_MAXUINT64) {
|
|
|
|
ret = gst_matroska_demux_check_read_size (demux, length);
|
|
|
|
break;
|
2008-06-16 10:59:39 +00:00
|
|
|
} else {
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset += needed;
|
|
|
|
demux->common.offset += length;
|
2008-06-16 10:59:39 +00:00
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
continue;
|
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-05-18 12:44:15 +00:00
|
|
|
/* will lead to track parsing ... */
|
|
|
|
ret = gst_matroska_demux_parse_id (demux, id, length, needed);
|
|
|
|
break;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
|
|
|
|
/* seek back */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.offset = before_pos;
|
2010-05-18 12:44:15 +00:00
|
|
|
|
2008-08-02 17:59:05 +00:00
|
|
|
return ret;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
#define GST_READ_CHECK(stmt) \
|
|
|
|
G_STMT_START { \
|
2010-08-16 14:05:41 +00:00
|
|
|
if (G_UNLIKELY ((ret = (stmt)) != GST_FLOW_OK)) { \
|
|
|
|
if (ret == GST_FLOW_OVERFLOW) { \
|
|
|
|
ret = GST_FLOW_OK; \
|
|
|
|
} \
|
2010-05-18 12:44:15 +00:00
|
|
|
goto read_error; \
|
2010-08-16 14:05:41 +00:00
|
|
|
} \
|
2010-05-18 12:44:15 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
static GstFlowReturn
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_matroska_demux_parse_id (GstMatroskaDemux * demux, guint32 id,
|
|
|
|
guint64 length, guint needed)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
2010-05-18 12:44:15 +00:00
|
|
|
GstEbmlRead ebml = { 0, };
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2010-05-18 12:44:15 +00:00
|
|
|
guint64 read;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-08-16 14:05:41 +00:00
|
|
|
GST_LOG_OBJECT (demux, "Parsing Element id 0x%x, "
|
|
|
|
"size %" G_GUINT64_FORMAT ", prefix %d", id, length, needed);
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
/* if we plan to read and parse this element, we need prefix (id + length)
|
|
|
|
* and the contents */
|
|
|
|
/* mind about overflow wrap-around when dealing with undefined size */
|
|
|
|
read = length;
|
|
|
|
if (G_LIKELY (length != G_MAXUINT64))
|
|
|
|
read += needed;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2011-05-23 15:48:57 +00:00
|
|
|
switch (demux->common.state) {
|
|
|
|
case GST_MATROSKA_READ_STATE_START:
|
2010-05-18 12:44:15 +00:00
|
|
|
switch (id) {
|
|
|
|
case GST_EBML_ID_HEADER:
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
2011-05-30 13:01:50 +00:00
|
|
|
ret = gst_matroska_read_common_parse_header (&demux->common, &ebml);
|
2010-05-18 12:44:15 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto parse_failed;
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_SEGMENT;
|
2010-05-18 12:44:15 +00:00
|
|
|
gst_matroska_demux_check_seekability (demux);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto invalid_header;
|
|
|
|
break;
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
break;
|
2011-05-23 15:48:57 +00:00
|
|
|
case GST_MATROSKA_READ_STATE_SEGMENT:
|
2010-05-18 12:44:15 +00:00
|
|
|
switch (id) {
|
|
|
|
case GST_MATROSKA_ID_SEGMENT:
|
|
|
|
/* eat segment prefix */
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, needed));
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
2014-09-04 13:21:20 +00:00
|
|
|
"Found Segment start at offset %" G_GUINT64_FORMAT " with size %"
|
|
|
|
G_GUINT64_FORMAT, demux->common.offset, length);
|
2010-05-18 12:44:15 +00:00
|
|
|
/* seeks are from the beginning of the segment,
|
|
|
|
* after the segment ID/length */
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.ebml_segment_start = demux->common.offset;
|
2014-09-04 13:21:20 +00:00
|
|
|
if (length == 0)
|
|
|
|
length = G_MAXUINT64;
|
|
|
|
demux->common.ebml_segment_length = length;
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_HEADER;
|
2010-05-18 12:44:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"Expected a Segment ID (0x%x), but received 0x%x!",
|
|
|
|
GST_MATROSKA_ID_SEGMENT, id);
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
2011-05-23 15:48:57 +00:00
|
|
|
case GST_MATROSKA_READ_STATE_SCANNING:
|
2010-07-22 10:05:26 +00:00
|
|
|
if (id != GST_MATROSKA_ID_CLUSTER &&
|
2017-01-18 10:27:38 +00:00
|
|
|
id != GST_MATROSKA_ID_PREVSIZE &&
|
2016-11-21 10:48:58 +00:00
|
|
|
id != GST_MATROSKA_ID_CLUSTERTIMECODE) {
|
|
|
|
if (demux->common.start_resync_offset != -1) {
|
|
|
|
/* we need to skip byte per byte if we are scanning for a new cluster
|
|
|
|
* after invalid data is found
|
|
|
|
*/
|
|
|
|
read = 1;
|
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
goto skip;
|
2016-11-21 10:48:58 +00:00
|
|
|
} else {
|
|
|
|
if (demux->common.start_resync_offset != -1) {
|
|
|
|
GST_LOG_OBJECT (demux, "Resync done, new cluster found!");
|
|
|
|
demux->common.start_resync_offset = -1;
|
|
|
|
demux->common.state = demux->common.state_to_restore;
|
|
|
|
}
|
|
|
|
}
|
2010-07-22 10:05:26 +00:00
|
|
|
/* fall-through */
|
2011-05-23 15:48:57 +00:00
|
|
|
case GST_MATROSKA_READ_STATE_HEADER:
|
|
|
|
case GST_MATROSKA_READ_STATE_DATA:
|
|
|
|
case GST_MATROSKA_READ_STATE_SEEK:
|
2010-05-18 12:44:15 +00:00
|
|
|
switch (id) {
|
2017-11-30 19:44:23 +00:00
|
|
|
case GST_EBML_ID_HEADER:
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_SEGMENT;
|
|
|
|
gst_matroska_demux_check_seekability (demux);
|
|
|
|
break;
|
2010-05-18 12:44:15 +00:00
|
|
|
case GST_MATROSKA_ID_SEGMENTINFO:
|
2011-06-05 17:15:55 +00:00
|
|
|
if (!demux->common.segmentinfo_parsed) {
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
2011-06-05 17:15:55 +00:00
|
|
|
ret = gst_matroska_read_common_parse_info (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &ebml);
|
2015-03-14 15:39:09 +00:00
|
|
|
if (ret == GST_FLOW_OK)
|
|
|
|
gst_matroska_demux_send_tags (demux);
|
2010-05-18 12:44:15 +00:00
|
|
|
} else {
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_TRACKS:
|
2018-09-21 18:38:02 +00:00
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
2010-05-18 12:44:15 +00:00
|
|
|
if (!demux->tracks_parsed) {
|
|
|
|
ret = gst_matroska_demux_parse_tracks (demux, &ebml);
|
|
|
|
} else {
|
2018-09-21 18:38:02 +00:00
|
|
|
ret = gst_matroska_demux_update_tracks (demux, &ebml);
|
2010-05-18 12:44:15 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_CLUSTER:
|
|
|
|
if (G_UNLIKELY (!demux->tracks_parsed)) {
|
|
|
|
if (demux->streaming) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "Cluster before Track");
|
|
|
|
goto not_streamable;
|
|
|
|
} else {
|
|
|
|
ret = gst_matroska_demux_find_tracks (demux);
|
|
|
|
if (!demux->tracks_parsed)
|
|
|
|
goto no_tracks;
|
|
|
|
}
|
|
|
|
}
|
2018-08-15 00:10:32 +00:00
|
|
|
if (demux->common.state == GST_MATROSKA_READ_STATE_HEADER) {
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_DATA;
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->first_cluster_offset = demux->common.offset;
|
2018-08-15 00:10:32 +00:00
|
|
|
|
2017-06-10 13:14:41 +00:00
|
|
|
if (!demux->streaming &&
|
|
|
|
!GST_CLOCK_TIME_IS_VALID (demux->common.segment.duration)) {
|
|
|
|
GstMatroskaIndex *last = NULL;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"estimating duration using last cluster");
|
|
|
|
if ((last = gst_matroska_demux_search_pos (demux,
|
|
|
|
GST_CLOCK_TIME_NONE)) != NULL) {
|
|
|
|
demux->last_cluster_offset =
|
|
|
|
last->pos + demux->common.ebml_segment_start;
|
|
|
|
demux->stream_last_time = last->time;
|
|
|
|
demux->common.segment.duration =
|
|
|
|
demux->stream_last_time - demux->stream_start_time;
|
|
|
|
/* above estimate should not be taken all too strongly */
|
|
|
|
demux->invalid_duration = TRUE;
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"estimated duration as %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (demux->common.segment.duration));
|
|
|
|
}
|
|
|
|
}
|
2018-08-15 00:10:32 +00:00
|
|
|
|
|
|
|
/* Peek at second cluster in order to figure out if we have cluster
|
|
|
|
* prev_size or not (which is never set on the first cluster for
|
|
|
|
* obvious reasons). This is useful in case someone initiates a
|
|
|
|
* seek or direction change before we reach the second cluster. */
|
|
|
|
if (!demux->streaming) {
|
|
|
|
ClusterInfo cluster = { 0, };
|
|
|
|
|
|
|
|
if (gst_matroska_demux_peek_cluster_info (demux, &cluster,
|
|
|
|
demux->first_cluster_offset) && cluster.size > 0) {
|
|
|
|
gst_matroska_demux_peek_cluster_info (demux, &cluster,
|
|
|
|
demux->first_cluster_offset + cluster.size);
|
|
|
|
}
|
|
|
|
demux->common.offset = demux->first_cluster_offset;
|
|
|
|
}
|
|
|
|
|
2018-11-14 07:57:55 +00:00
|
|
|
if (demux->deferred_seek_event) {
|
|
|
|
GstEvent *seek_event;
|
|
|
|
GstPad *seek_pad;
|
|
|
|
seek_event = demux->deferred_seek_event;
|
|
|
|
seek_pad = demux->deferred_seek_pad;
|
|
|
|
demux->deferred_seek_event = NULL;
|
|
|
|
demux->deferred_seek_pad = NULL;
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Handling deferred seek event: %" GST_PTR_FORMAT, seek_event);
|
|
|
|
gst_matroska_demux_handle_seek_event (demux, seek_pad,
|
|
|
|
seek_event);
|
|
|
|
gst_event_unref (seek_event);
|
|
|
|
}
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
/* send initial segment - we wait till we know the first
|
2011-09-21 17:45:42 +00:00
|
|
|
incoming timestamp, so we can properly set the start of
|
|
|
|
the segment. */
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->need_segment = TRUE;
|
2010-05-18 12:44:15 +00:00
|
|
|
}
|
|
|
|
demux->cluster_time = GST_CLOCK_TIME_NONE;
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->cluster_offset = demux->common.offset;
|
2017-01-18 10:27:38 +00:00
|
|
|
demux->cluster_prevsize = 0;
|
2010-05-18 12:44:15 +00:00
|
|
|
if (G_UNLIKELY (!demux->seek_first && demux->seek_block)) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "seek target block %" G_GUINT64_FORMAT
|
|
|
|
" not found in Cluster, trying next Cluster's first block instead",
|
|
|
|
demux->seek_block);
|
|
|
|
demux->seek_block = 0;
|
|
|
|
}
|
|
|
|
demux->seek_first = FALSE;
|
2010-07-26 13:51:49 +00:00
|
|
|
/* record next cluster for recovery */
|
|
|
|
if (read != G_MAXUINT64)
|
|
|
|
demux->next_cluster_offset = demux->cluster_offset + read;
|
2010-05-18 12:44:15 +00:00
|
|
|
/* eat cluster prefix */
|
|
|
|
gst_matroska_demux_flush (demux, needed);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_CLUSTERTIMECODE:
|
|
|
|
{
|
|
|
|
guint64 num;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
|
|
|
if ((ret = gst_ebml_read_uint (&ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
goto parse_failed;
|
|
|
|
GST_DEBUG_OBJECT (demux, "ClusterTimeCode: %" G_GUINT64_FORMAT, num);
|
|
|
|
demux->cluster_time = num;
|
2017-06-10 13:14:41 +00:00
|
|
|
/* track last cluster */
|
|
|
|
if (demux->cluster_offset > demux->last_cluster_offset) {
|
|
|
|
demux->last_cluster_offset = demux->cluster_offset;
|
|
|
|
demux->stream_last_time =
|
|
|
|
demux->cluster_time * demux->common.time_scale;
|
|
|
|
}
|
2011-12-30 17:41:46 +00:00
|
|
|
#if 0
|
2011-05-23 15:06:44 +00:00
|
|
|
if (demux->common.element_index) {
|
|
|
|
if (demux->common.element_index_writer_id == -1)
|
|
|
|
gst_index_get_writer_id (demux->common.element_index,
|
|
|
|
GST_OBJECT (demux), &demux->common.element_index_writer_id);
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_LOG_OBJECT (demux, "adding association %" GST_TIME_FORMAT "-> %"
|
|
|
|
G_GUINT64_FORMAT " for writer id %d",
|
|
|
|
GST_TIME_ARGS (demux->cluster_time), demux->cluster_offset,
|
2011-05-23 15:06:44 +00:00
|
|
|
demux->common.element_index_writer_id);
|
|
|
|
gst_index_add_association (demux->common.element_index,
|
|
|
|
demux->common.element_index_writer_id,
|
|
|
|
GST_ASSOCIATION_FLAG_KEY_UNIT,
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_FORMAT_TIME, demux->cluster_time,
|
|
|
|
GST_FORMAT_BYTES, demux->cluster_offset, NULL);
|
|
|
|
}
|
2011-12-30 17:41:46 +00:00
|
|
|
#endif
|
2010-05-18 12:44:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_MATROSKA_ID_BLOCKGROUP:
|
|
|
|
if (!gst_matroska_demux_seek_block (demux))
|
|
|
|
goto skip;
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
|
|
|
DEBUG_ELEMENT_START (demux, &ebml, "BlockGroup");
|
|
|
|
if ((ret = gst_ebml_read_master (&ebml, &id)) == GST_FLOW_OK) {
|
|
|
|
ret = gst_matroska_demux_parse_blockgroup_or_simpleblock (demux,
|
|
|
|
&ebml, demux->cluster_time, demux->cluster_offset, FALSE);
|
|
|
|
}
|
|
|
|
DEBUG_ELEMENT_STOP (demux, &ebml, "BlockGroup", ret);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_SIMPLEBLOCK:
|
|
|
|
if (!gst_matroska_demux_seek_block (demux))
|
|
|
|
goto skip;
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
|
|
|
DEBUG_ELEMENT_START (demux, &ebml, "SimpleBlock");
|
|
|
|
ret = gst_matroska_demux_parse_blockgroup_or_simpleblock (demux,
|
|
|
|
&ebml, demux->cluster_time, demux->cluster_offset, TRUE);
|
|
|
|
DEBUG_ELEMENT_STOP (demux, &ebml, "SimpleBlock", ret);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_ATTACHMENTS:
|
2011-06-06 09:17:27 +00:00
|
|
|
if (!demux->common.attachments_parsed) {
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
2011-06-06 09:17:27 +00:00
|
|
|
ret = gst_matroska_read_common_parse_attachments (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &ebml);
|
2015-03-14 15:39:09 +00:00
|
|
|
if (ret == GST_FLOW_OK)
|
|
|
|
gst_matroska_demux_send_tags (demux);
|
2010-05-18 12:44:15 +00:00
|
|
|
} else {
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_TAGS:
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
2011-06-05 04:45:23 +00:00
|
|
|
ret = gst_matroska_read_common_parse_metadata (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &ebml);
|
2015-03-14 15:39:09 +00:00
|
|
|
if (ret == GST_FLOW_OK)
|
|
|
|
gst_matroska_demux_send_tags (demux);
|
2010-05-18 12:44:15 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_CHAPTERS:
|
2012-03-29 19:12:13 +00:00
|
|
|
if (!demux->common.chapters_parsed) {
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
|
|
|
ret =
|
|
|
|
gst_matroska_read_common_parse_chapters (&demux->common, &ebml);
|
|
|
|
|
|
|
|
if (demux->common.toc) {
|
|
|
|
gst_matroska_demux_send_event (demux,
|
2012-06-06 12:17:08 +00:00
|
|
|
gst_event_new_toc (demux->common.toc, FALSE));
|
2012-03-29 19:12:13 +00:00
|
|
|
}
|
|
|
|
} else
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
2010-05-18 12:44:15 +00:00
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_SEEKHEAD:
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
|
|
|
ret = gst_matroska_demux_parse_contents (demux, &ebml);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_ID_CUES:
|
2011-05-23 15:06:44 +00:00
|
|
|
if (demux->common.index_parsed) {
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_parse_index (&demux->common, &ebml);
|
2010-05-18 12:44:15 +00:00
|
|
|
/* only push based; delayed index building */
|
2010-06-16 17:50:34 +00:00
|
|
|
if (ret == GST_FLOW_OK
|
2011-05-23 15:48:57 +00:00
|
|
|
&& demux->common.state == GST_MATROSKA_READ_STATE_SEEK) {
|
2010-05-18 12:44:15 +00:00
|
|
|
GstEvent *event;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
event = demux->seek_event;
|
|
|
|
demux->seek_event = NULL;
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
|
|
|
|
g_assert (event);
|
|
|
|
/* unlikely to fail, since we managed to seek to this point */
|
2015-04-28 13:59:25 +00:00
|
|
|
if (!gst_matroska_demux_handle_seek_event (demux, NULL, event)) {
|
|
|
|
gst_event_unref (event);
|
2010-05-18 12:44:15 +00:00
|
|
|
goto seek_failed;
|
2015-04-28 13:59:25 +00:00
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
2010-05-18 12:44:15 +00:00
|
|
|
/* resume data handling, main thread clear to seek again */
|
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-05-23 15:48:57 +00:00
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_DATA;
|
2010-05-18 12:44:15 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
}
|
|
|
|
break;
|
2017-01-18 10:27:38 +00:00
|
|
|
case GST_MATROSKA_ID_PREVSIZE:{
|
|
|
|
guint64 num;
|
|
|
|
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_take (demux, read, &ebml));
|
|
|
|
if ((ret = gst_ebml_read_uint (&ebml, &id, &num)) != GST_FLOW_OK)
|
|
|
|
goto parse_failed;
|
|
|
|
GST_LOG_OBJECT (demux, "ClusterPrevSize: %" G_GUINT64_FORMAT, num);
|
|
|
|
demux->cluster_prevsize = num;
|
|
|
|
demux->seen_cluster_prevsize = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
case GST_MATROSKA_ID_POSITION:
|
|
|
|
case GST_MATROSKA_ID_ENCRYPTEDBLOCK:
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
/* The WebM doesn't support the EncryptedBlock element.
|
|
|
|
* The Matroska spec doesn't give us more detail, how to parse this element,
|
|
|
|
* for example the field TransformID isn't specified yet.*/
|
2010-05-18 12:44:15 +00:00
|
|
|
case GST_MATROSKA_ID_SILENTTRACKS:
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"Skipping Cluster subelement 0x%x - ignoring", id);
|
|
|
|
/* fall-through */
|
|
|
|
default:
|
|
|
|
skip:
|
|
|
|
GST_DEBUG_OBJECT (demux, "skipping Element 0x%x", id);
|
|
|
|
GST_READ_CHECK (gst_matroska_demux_flush (demux, read));
|
|
|
|
break;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
|
|
|
|
if (ret == GST_FLOW_PARSE)
|
|
|
|
goto parse_failed;
|
|
|
|
|
|
|
|
exit:
|
|
|
|
gst_ebml_read_clear (&ebml);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
return ret;
|
2010-05-18 12:44:15 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
read_error:
|
|
|
|
{
|
|
|
|
/* simply exit, maybe not enough data yet */
|
|
|
|
/* no ebml to clear if read error */
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
parse_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
|
|
|
|
("Failed to parse Element 0x%x", id));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
not_streamable:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
|
|
|
|
("File layout does not permit streaming"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
no_tracks:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL),
|
|
|
|
("No Tracks element found"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
invalid_header:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Invalid header"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
seek_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX, (NULL), ("Failed to seek"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto exit;
|
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_matroska_demux_loop (GstPad * pad)
|
2003-11-21 21:34:27 +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
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (GST_PAD_PARENT (pad));
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
GstFlowReturn ret;
|
2010-05-18 12:44:15 +00:00
|
|
|
guint32 id;
|
|
|
|
guint64 length;
|
|
|
|
guint needed;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2009-09-23 07:50:37 +00:00
|
|
|
/* If we have to close a segment, send a new segment to do this now */
|
2011-05-23 15:48:57 +00:00
|
|
|
if (G_LIKELY (demux->common.state == GST_MATROSKA_READ_STATE_DATA)) {
|
2009-09-23 07:50:37 +00:00
|
|
|
if (G_UNLIKELY (demux->new_segment)) {
|
2008-08-08 16:20:26 +00:00
|
|
|
gst_matroska_demux_send_event (demux, demux->new_segment);
|
|
|
|
demux->new_segment = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2013-08-08 09:51:17 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2010-05-18 12:44:15 +00:00
|
|
|
goto eos;
|
2013-08-08 09:51:17 +00:00
|
|
|
} else if (ret == GST_FLOW_FLUSHING) {
|
|
|
|
goto pause;
|
|
|
|
} else if (ret != GST_FLOW_OK) {
|
2014-09-04 13:21:20 +00:00
|
|
|
ret = gst_matroska_demux_check_parse_error (demux);
|
|
|
|
|
|
|
|
/* Only handle EOS as no error if we're outside the segment already */
|
|
|
|
if (ret == GST_FLOW_EOS && (demux->common.ebml_segment_length != G_MAXUINT64
|
|
|
|
&& demux->common.offset >=
|
|
|
|
demux->common.ebml_segment_start +
|
|
|
|
demux->common.ebml_segment_length))
|
|
|
|
goto eos;
|
|
|
|
else if (ret != GST_FLOW_OK)
|
2010-07-26 13:51:49 +00:00
|
|
|
goto pause;
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
}
|
2010-05-18 12:44:15 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "Offset %" G_GUINT64_FORMAT ", Element id 0x%x, "
|
2011-05-23 15:06:44 +00:00
|
|
|
"size %" G_GUINT64_FORMAT ", needed %d", demux->common.offset, id,
|
2010-05-18 12:44:15 +00:00
|
|
|
length, needed);
|
|
|
|
|
|
|
|
ret = gst_matroska_demux_parse_id (demux, id, length, needed);
|
2012-01-03 14:26:21 +00:00
|
|
|
if (ret == GST_FLOW_EOS)
|
2010-03-23 16:34:50 +00:00
|
|
|
goto eos;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto pause;
|
2005-10-18 18:12:31 +00:00
|
|
|
|
|
|
|
/* check if we're at the end of a configured segment */
|
2011-05-23 15:06:44 +00:00
|
|
|
if (G_LIKELY (demux->common.src->len)) {
|
2005-10-18 18:12:31 +00:00
|
|
|
guint i;
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
g_assert (demux->common.num_streams == demux->common.src->len);
|
|
|
|
for (i = 0; i < demux->common.src->len; i++) {
|
|
|
|
GstMatroskaTrackContext *context = g_ptr_array_index (demux->common.src,
|
|
|
|
i);
|
2010-03-02 13:09:14 +00:00
|
|
|
GST_DEBUG_OBJECT (context->pad, "pos %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (context->pos));
|
|
|
|
if (context->eos == FALSE)
|
|
|
|
goto next;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2010-03-02 13:09:14 +00:00
|
|
|
|
|
|
|
GST_INFO_OBJECT (demux, "All streams are EOS");
|
2012-01-03 14:26:21 +00:00
|
|
|
ret = GST_FLOW_EOS;
|
2010-03-23 16:34:50 +00:00
|
|
|
goto eos;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
2010-03-02 13:09:14 +00:00
|
|
|
next:
|
2014-12-19 09:57:29 +00:00
|
|
|
if (G_UNLIKELY (demux->cached_length == G_MAXUINT64 ||
|
|
|
|
demux->common.offset >= demux->cached_length)) {
|
|
|
|
demux->cached_length = gst_matroska_read_common_get_length (&demux->common);
|
|
|
|
if (demux->common.offset == demux->cached_length) {
|
|
|
|
GST_LOG_OBJECT (demux, "Reached end of stream");
|
|
|
|
ret = GST_FLOW_EOS;
|
|
|
|
goto eos;
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
/* ERRORS */
|
2010-03-23 16:34:50 +00:00
|
|
|
eos:
|
|
|
|
{
|
2011-06-05 17:15:55 +00:00
|
|
|
if (demux->common.segment.rate < 0.0) {
|
2010-03-23 16:34:50 +00:00
|
|
|
ret = gst_matroska_demux_seek_to_previous_keyframe (demux);
|
|
|
|
if (ret == GST_FLOW_OK)
|
2010-05-28 14:37:32 +00:00
|
|
|
return;
|
2010-03-23 16:34:50 +00:00
|
|
|
}
|
|
|
|
/* fall-through */
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
pause:
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
{
|
|
|
|
const gchar *reason = gst_flow_get_name (ret);
|
2010-08-27 15:37:33 +00:00
|
|
|
gboolean push_eos = FALSE;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "pausing task, reason %s", reason);
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_pad_pause_task (demux->common.sinkpad);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
|
2012-01-03 14:26:21 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2010-08-27 15:37:33 +00:00
|
|
|
/* perform EOS logic */
|
|
|
|
|
2011-08-08 21:14:28 +00:00
|
|
|
/* If we were in the headers, make sure we send no-more-pads.
|
2015-06-25 09:57:25 +00:00
|
|
|
This will ensure decodebin does not get stuck thinking
|
2011-08-08 21:14:28 +00:00
|
|
|
the chain is not complete yet, and waiting indefinitely. */
|
|
|
|
if (G_UNLIKELY (demux->common.state == GST_MATROSKA_READ_STATE_HEADER)) {
|
|
|
|
if (demux->common.src->len == 0) {
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, FAILED, (NULL),
|
|
|
|
("No pads created"));
|
|
|
|
} else {
|
|
|
|
GST_ELEMENT_WARNING (demux, STREAM, DEMUX, (NULL),
|
|
|
|
("Failed to finish reading headers"));
|
|
|
|
}
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT (demux));
|
|
|
|
}
|
|
|
|
|
2011-06-05 17:15:55 +00:00
|
|
|
if (demux->common.segment.flags & GST_SEEK_FLAG_SEGMENT) {
|
2016-05-20 07:56:52 +00:00
|
|
|
GstEvent *event;
|
|
|
|
GstMessage *msg;
|
2010-08-27 15:37:33 +00:00
|
|
|
gint64 stop;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
|
2010-08-27 15:37:33 +00:00
|
|
|
/* for segment playback we need to post when (in stream time)
|
|
|
|
* we stopped, this is either stop (when set) or the duration. */
|
2011-06-05 17:15:55 +00:00
|
|
|
if ((stop = demux->common.segment.stop) == -1)
|
2010-08-27 15:37:33 +00:00
|
|
|
stop = demux->last_stop_end;
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
|
2010-08-27 15:37:33 +00:00
|
|
|
GST_LOG_OBJECT (demux, "Sending segment done, at end of segment");
|
2016-05-20 07:56:52 +00:00
|
|
|
msg = gst_message_new_segment_done (GST_OBJECT (demux), GST_FORMAT_TIME,
|
|
|
|
stop);
|
|
|
|
if (demux->segment_seqnum)
|
|
|
|
gst_message_set_seqnum (msg, demux->segment_seqnum);
|
|
|
|
gst_element_post_message (GST_ELEMENT (demux), msg);
|
|
|
|
|
|
|
|
event = gst_event_new_segment_done (GST_FORMAT_TIME, stop);
|
|
|
|
if (demux->segment_seqnum)
|
|
|
|
gst_event_set_seqnum (event, demux->segment_seqnum);
|
|
|
|
gst_matroska_demux_send_event (demux, event);
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
} else {
|
2010-08-27 15:37:33 +00:00
|
|
|
push_eos = TRUE;
|
2010-01-11 18:02:34 +00:00
|
|
|
}
|
2012-01-03 14:26:21 +00:00
|
|
|
} else if (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS) {
|
2010-08-27 15:37:33 +00:00
|
|
|
/* for fatal errors we post an error message */
|
2016-08-19 18:11:03 +00:00
|
|
|
GST_ELEMENT_FLOW_ERROR (demux, ret);
|
2010-08-27 15:37:33 +00:00
|
|
|
push_eos = TRUE;
|
|
|
|
}
|
|
|
|
if (push_eos) {
|
2016-05-20 07:56:52 +00:00
|
|
|
GstEvent *event;
|
|
|
|
|
2010-08-27 15:37:33 +00:00
|
|
|
/* send EOS, and prevent hanging if no streams yet */
|
|
|
|
GST_LOG_OBJECT (demux, "Sending EOS, at end of stream");
|
2016-05-20 07:56:52 +00:00
|
|
|
event = gst_event_new_eos ();
|
|
|
|
if (demux->segment_seqnum)
|
|
|
|
gst_event_set_seqnum (event, demux->segment_seqnum);
|
|
|
|
if (!gst_matroska_demux_send_event (demux, event) &&
|
2012-01-03 14:26:21 +00:00
|
|
|
(ret == GST_FLOW_EOS)) {
|
2010-08-27 15:37:33 +00:00
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
|
|
|
|
(NULL), ("got eos but no streams (yet)"));
|
gst/matroska/: Handle return values from pull_range in a more granular way to properly shut down on seeks.
Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_read_peek_bytes),
(gst_ebml_read_pull_bytes), (gst_ebml_read_element_id),
(gst_ebml_read_element_length), (gst_ebml_peek_id),
(gst_ebml_read_skip), (gst_ebml_read_buffer),
(gst_ebml_read_bytes), (gst_ebml_read_uint), (gst_ebml_read_sint),
(gst_ebml_read_float), (gst_ebml_read_ascii), (gst_ebml_read_utf8),
(gst_ebml_read_date), (gst_ebml_read_master),
(gst_ebml_read_binary), (gst_ebml_read_header):
* gst/matroska/ebml-read.h:
* gst/matroska/matroska-demux.c:
(gst_matroska_demux_combine_flows), (gst_matroska_demux_reset),
(gst_matroska_demux_read_track_encodings),
(gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_src_query),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_init_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(gst_matroska_demux_push_xiph_codec_priv_data),
(gst_matroska_demux_add_wvpk_header),
(gst_matroska_demux_check_subtitle_buffer),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id),
(gst_matroska_demux_loop_stream), (gst_matroska_demux_loop):
* gst/matroska/matroska-demux.h:
* gst/matroska/matroska-ids.h:
Handle return values from pull_range in a more granular way to properly
shut down on seeks.
Combine return values from push.
Implement proper error handling.
Prepare for handling seeking correctly.
2008-03-06 19:47:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
/*
|
|
|
|
* Create and push a flushing seek event upstream
|
|
|
|
*/
|
|
|
|
static gboolean
|
2013-09-10 20:57:49 +00:00
|
|
|
perform_seek_to_offset (GstMatroskaDemux * demux, gdouble rate, guint64 offset,
|
2016-05-04 12:50:32 +00:00
|
|
|
guint32 seqnum, GstSeekFlags flags)
|
2010-04-14 09:53:46 +00:00
|
|
|
{
|
|
|
|
GstEvent *event;
|
|
|
|
gboolean res = 0;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "Seeking to %" G_GUINT64_FORMAT, offset);
|
|
|
|
|
|
|
|
event =
|
2012-07-18 09:36:27 +00:00
|
|
|
gst_event_new_seek (rate, GST_FORMAT_BYTES,
|
2016-05-04 12:50:32 +00:00
|
|
|
flags | GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE,
|
|
|
|
GST_SEEK_TYPE_SET, offset, GST_SEEK_TYPE_NONE, -1);
|
2013-09-10 20:57:49 +00:00
|
|
|
gst_event_set_seqnum (event, seqnum);
|
2010-04-14 09:53:46 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
res = gst_pad_push_event (demux->common.sinkpad, event);
|
2010-04-14 09:53:46 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
/* segment event will update offset */
|
2010-04-14 09:53:46 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-12-16 11:43:27 +00:00
|
|
|
static GstFlowReturn
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
2009-12-16 11:43:27 +00:00
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (parent);
|
2009-12-16 11:43:27 +00:00
|
|
|
guint available;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2009-12-18 11:44:50 +00:00
|
|
|
guint needed = 0;
|
2009-12-16 11:43:27 +00:00
|
|
|
guint32 id;
|
|
|
|
guint64 length;
|
|
|
|
|
2010-04-14 09:53:46 +00:00
|
|
|
if (G_UNLIKELY (GST_BUFFER_IS_DISCONT (buffer))) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "got DISCONT");
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_adapter_clear (demux->common.adapter);
|
2010-05-25 03:36:46 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-05-30 05:10:08 +00:00
|
|
|
gst_matroska_read_common_reset_streams (&demux->common,
|
|
|
|
GST_CLOCK_TIME_NONE, FALSE);
|
2010-05-25 03:36:46 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2010-04-14 09:53:46 +00:00
|
|
|
}
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_adapter_push (demux->common.adapter, buffer);
|
2009-12-16 11:43:27 +00:00
|
|
|
buffer = NULL;
|
|
|
|
|
|
|
|
next:
|
2011-05-23 15:06:44 +00:00
|
|
|
available = gst_adapter_available (demux->common.adapter);
|
2009-12-16 11:43:27 +00:00
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
ret = gst_matroska_read_common_peek_id_length_push (&demux->common,
|
|
|
|
GST_ELEMENT_CAST (demux), &id, &length, &needed);
|
2014-09-04 13:21:20 +00:00
|
|
|
if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_EOS)) {
|
|
|
|
if (demux->common.ebml_segment_length != G_MAXUINT64
|
|
|
|
&& demux->common.offset >=
|
2016-11-21 10:48:58 +00:00
|
|
|
demux->common.ebml_segment_start + demux->common.ebml_segment_length) {
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
} else {
|
|
|
|
gint64 bytes_scanned;
|
|
|
|
if (demux->common.start_resync_offset == -1) {
|
|
|
|
demux->common.start_resync_offset = demux->common.offset;
|
|
|
|
demux->common.state_to_restore = demux->common.state;
|
|
|
|
}
|
|
|
|
bytes_scanned = demux->common.offset - demux->common.start_resync_offset;
|
|
|
|
if (bytes_scanned <= INVALID_DATA_THRESHOLD) {
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"parse error, looking for next cluster, actual offset %"
|
|
|
|
G_GUINT64_FORMAT ", start resync offset %" G_GUINT64_FORMAT,
|
|
|
|
demux->common.offset, demux->common.start_resync_offset);
|
|
|
|
demux->common.state = GST_MATROSKA_READ_STATE_SCANNING;
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (demux,
|
|
|
|
"unrecoverable parse error, next cluster not found and threshold "
|
|
|
|
"exceeded, bytes scanned %" G_GINT64_FORMAT, bytes_scanned);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 13:21:20 +00:00
|
|
|
}
|
2009-12-16 11:43:27 +00:00
|
|
|
|
|
|
|
GST_LOG_OBJECT (demux, "Offset %" G_GUINT64_FORMAT ", Element id 0x%x, "
|
2011-05-23 15:06:44 +00:00
|
|
|
"size %" G_GUINT64_FORMAT ", needed %d, available %d",
|
|
|
|
demux->common.offset, id, length, needed, available);
|
2009-12-16 11:43:27 +00:00
|
|
|
|
|
|
|
if (needed > available)
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2010-05-18 12:44:15 +00:00
|
|
|
ret = gst_matroska_demux_parse_id (demux, id, length, needed);
|
2012-01-03 14:26:21 +00:00
|
|
|
if (ret == GST_FLOW_EOS) {
|
2010-05-18 12:44:15 +00:00
|
|
|
/* need more data */
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
} else if (ret != GST_FLOW_OK) {
|
|
|
|
return ret;
|
|
|
|
} else
|
2009-12-16 11:43:27 +00:00
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_demux_handle_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event)
|
2009-12-16 11:43:27 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
2011-11-26 09:01:07 +00:00
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (parent);
|
2009-12-16 11:43:27 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux,
|
|
|
|
"have event type %s: %p on sink pad", GST_EVENT_TYPE_NAME (event), event);
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
2009-12-16 11:43:27 +00:00
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
const GstSegment *segment;
|
2009-12-16 11:43:27 +00:00
|
|
|
|
|
|
|
/* some debug output */
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_event_parse_segment (event, &segment);
|
|
|
|
/* FIXME: do we need to update segment base here (like accum in 0.10)? */
|
2009-12-16 11:43:27 +00:00
|
|
|
GST_DEBUG_OBJECT (demux,
|
2011-11-26 09:01:07 +00:00
|
|
|
"received format %d segment %" GST_SEGMENT_FORMAT, segment->format,
|
|
|
|
segment);
|
2009-12-16 11:43:27 +00:00
|
|
|
|
2011-05-23 15:48:57 +00:00
|
|
|
if (demux->common.state < GST_MATROSKA_READ_STATE_DATA) {
|
2010-04-14 09:53:46 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "still starting");
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we only expect a BYTE segment, e.g. following a seek */
|
2011-11-26 09:01:07 +00:00
|
|
|
if (segment->format != GST_FORMAT_BYTES) {
|
2010-04-14 09:53:46 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "unsupported segment format, ignoring");
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "clearing segment state");
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2010-04-14 09:53:46 +00:00
|
|
|
/* clear current segment leftover */
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_adapter_clear (demux->common.adapter);
|
2010-04-14 09:53:46 +00:00
|
|
|
/* and some streaming setup */
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->common.offset = segment->start;
|
2012-07-24 19:11:18 +00:00
|
|
|
/* accumulate base based on current position */
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (demux->common.segment.position))
|
|
|
|
demux->common.segment.base +=
|
|
|
|
(MAX (demux->common.segment.position, demux->stream_start_time)
|
|
|
|
- demux->stream_start_time) / fabs (demux->common.segment.rate);
|
2010-04-14 09:53:46 +00:00
|
|
|
/* do not know where we are;
|
2011-11-26 09:01:07 +00:00
|
|
|
* need to come across a cluster and generate segment */
|
|
|
|
demux->common.segment.position = GST_CLOCK_TIME_NONE;
|
2010-04-14 09:53:46 +00:00
|
|
|
demux->cluster_time = GST_CLOCK_TIME_NONE;
|
|
|
|
demux->cluster_offset = 0;
|
2017-01-18 10:27:38 +00:00
|
|
|
demux->cluster_prevsize = 0;
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->need_segment = TRUE;
|
2013-07-25 04:39:58 +00:00
|
|
|
demux->segment_seqnum = gst_event_get_seqnum (event);
|
2010-04-14 09:53:46 +00:00
|
|
|
/* but keep some of the upstream segment */
|
2011-11-26 09:01:07 +00:00
|
|
|
demux->common.segment.rate = segment->rate;
|
2016-05-04 12:50:32 +00:00
|
|
|
demux->common.segment.flags = segment->flags;
|
2012-07-24 19:11:18 +00:00
|
|
|
/* also check if need to keep some of the requested seek position */
|
|
|
|
if (demux->seek_offset == segment->start) {
|
|
|
|
GST_DEBUG_OBJECT (demux, "position matches requested seek");
|
|
|
|
demux->common.segment.position = demux->requested_seek_time;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (demux, "unexpected segment position");
|
|
|
|
}
|
|
|
|
demux->requested_seek_time = GST_CLOCK_TIME_NONE;
|
|
|
|
demux->seek_offset = -1;
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2010-04-14 09:53:46 +00:00
|
|
|
exit:
|
2011-11-26 09:01:07 +00:00
|
|
|
/* chain will send initial segment after pads have been added,
|
2010-04-14 09:53:46 +00:00
|
|
|
* or otherwise come up with one */
|
2009-12-16 11:43:27 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "eating event");
|
|
|
|
gst_event_unref (event);
|
|
|
|
res = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
{
|
2016-11-21 10:48:58 +00:00
|
|
|
if (demux->common.state != GST_MATROSKA_READ_STATE_DATA
|
|
|
|
&& demux->common.state != GST_MATROSKA_READ_STATE_SCANNING) {
|
2009-12-16 11:43:27 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
|
|
|
|
(NULL), ("got eos and didn't receive a complete header object"));
|
2011-05-23 15:06:44 +00:00
|
|
|
} else if (demux->common.num_streams == 0) {
|
2009-12-16 11:43:27 +00:00
|
|
|
GST_ELEMENT_ERROR (demux, STREAM, DEMUX,
|
|
|
|
(NULL), ("got eos but no streams (yet)"));
|
|
|
|
} else {
|
|
|
|
gst_matroska_demux_send_event (demux, event);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2010-04-14 09:53:46 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
{
|
2012-04-10 09:37:48 +00:00
|
|
|
guint64 dur;
|
|
|
|
|
2011-05-23 15:06:44 +00:00
|
|
|
gst_adapter_clear (demux->common.adapter);
|
2010-05-25 03:36:46 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-05-30 05:10:08 +00:00
|
|
|
gst_matroska_read_common_reset_streams (&demux->common,
|
|
|
|
GST_CLOCK_TIME_NONE, TRUE);
|
2015-03-23 19:56:41 +00:00
|
|
|
gst_flow_combiner_reset (demux->flowcombiner);
|
2012-04-10 09:37:48 +00:00
|
|
|
dur = demux->common.segment.duration;
|
|
|
|
gst_segment_init (&demux->common.segment, GST_FORMAT_TIME);
|
|
|
|
demux->common.segment.duration = dur;
|
2010-04-14 09:53:46 +00:00
|
|
|
demux->cluster_time = GST_CLOCK_TIME_NONE;
|
|
|
|
demux->cluster_offset = 0;
|
2017-01-18 10:27:38 +00:00
|
|
|
demux->cluster_prevsize = 0;
|
2011-05-04 09:55:21 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2010-04-14 09:53:46 +00:00
|
|
|
/* fall-through */
|
|
|
|
}
|
2009-12-16 11:43:27 +00:00
|
|
|
default:
|
2011-11-26 09:01:07 +00:00
|
|
|
res = gst_pad_event_default (pad, parent, event);
|
2009-12-16 11:43:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
static gboolean
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_demux_sink_activate (GstPad * sinkpad, GstObject * parent)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (parent);
|
|
|
|
GstQuery *query;
|
|
|
|
gboolean pull_mode = FALSE;
|
|
|
|
|
|
|
|
query = gst_query_new_scheduling ();
|
2010-04-14 09:53:46 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
if (gst_pad_peer_query (sinkpad, query))
|
2012-09-11 15:36:51 +00:00
|
|
|
pull_mode = gst_query_has_scheduling_mode_with_flags (query,
|
|
|
|
GST_PAD_MODE_PULL, GST_SCHEDULING_FLAG_SEEKABLE);
|
2011-11-26 09:01:07 +00:00
|
|
|
|
|
|
|
gst_query_unref (query);
|
|
|
|
|
|
|
|
if (pull_mode) {
|
2009-12-16 11:43:27 +00:00
|
|
|
GST_DEBUG ("going to pull mode");
|
2010-04-14 09:53:46 +00:00
|
|
|
demux->streaming = FALSE;
|
2011-11-26 09:01:07 +00:00
|
|
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PULL, TRUE);
|
2009-12-16 11:43:27 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG ("going to push (streaming) mode");
|
2010-04-14 09:53:46 +00:00
|
|
|
demux->streaming = TRUE;
|
2011-11-26 09:01:07 +00:00
|
|
|
return gst_pad_activate_mode (sinkpad, GST_PAD_MODE_PUSH, TRUE);
|
2009-12-16 11:43:27 +00:00
|
|
|
}
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_matroska_demux_sink_activate_mode (GstPad * sinkpad, GstObject * parent,
|
|
|
|
GstPadMode mode, gboolean active)
|
2005-10-18 18:12:31 +00:00
|
|
|
{
|
2011-11-26 09:01:07 +00:00
|
|
|
switch (mode) {
|
|
|
|
case GST_PAD_MODE_PULL:
|
|
|
|
if (active) {
|
2011-11-28 17:25:52 +00:00
|
|
|
/* if we have a scheduler we can start the task */
|
|
|
|
gst_pad_start_task (sinkpad, (GstTaskFunction) gst_matroska_demux_loop,
|
2012-06-20 08:33:42 +00:00
|
|
|
sinkpad, NULL);
|
2011-11-26 09:01:07 +00:00
|
|
|
} else {
|
2011-11-28 17:25:52 +00:00
|
|
|
gst_pad_stop_task (sinkpad);
|
2011-11-26 09:01:07 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
case GST_PAD_MODE_PUSH:
|
|
|
|
return TRUE;
|
|
|
|
default:
|
|
|
|
return FALSE;
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_matroska_demux_video_caps (GstMatroskaTrackVideoContext *
|
2009-01-30 17:26:19 +00:00
|
|
|
videocontext, const gchar * codec_id, guint8 * data, guint size,
|
2010-06-30 23:22:07 +00:00
|
|
|
gchar ** codec_name, guint32 * riff_fourcc)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2004-03-14 22:34:33 +00:00
|
|
|
GstMatroskaTrackContext *context = (GstMatroskaTrackContext *) videocontext;
|
2003-11-21 21:34:27 +00:00
|
|
|
GstCaps *caps = NULL;
|
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
g_assert (videocontext != NULL);
|
|
|
|
g_assert (codec_name != NULL);
|
|
|
|
|
2010-06-30 23:22:07 +00:00
|
|
|
if (riff_fourcc)
|
|
|
|
*riff_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 have all codec types from matroska-ids.h
|
|
|
|
* check if we have to do more special things with codec_private
|
|
|
|
*
|
|
|
|
* Add support for
|
|
|
|
* GST_MATROSKA_CODEC_ID_VIDEO_QUICKTIME
|
|
|
|
* GST_MATROSKA_CODEC_ID_VIDEO_SNOW
|
|
|
|
*/
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VFW_FOURCC)) {
|
|
|
|
gst_riff_strf_vids *vids = NULL;
|
|
|
|
|
|
|
|
if (data) {
|
2006-04-25 11:45:00 +00:00
|
|
|
GstBuffer *buf = NULL;
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
vids = (gst_riff_strf_vids *) data;
|
|
|
|
|
|
|
|
/* assure size is big enough */
|
|
|
|
if (size < 24) {
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_WARNING ("Too small BITMAPINFOHEADER (%d bytes)", size);
|
|
|
|
return NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
if (size < sizeof (gst_riff_strf_vids)) {
|
2009-03-31 14:06:50 +00:00
|
|
|
vids = g_new (gst_riff_strf_vids, 1);
|
|
|
|
memcpy (vids, data, size);
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2015-02-26 01:12:18 +00:00
|
|
|
context->dts_only = TRUE; /* VFW files only store DTS */
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* little-endian -> byte-order */
|
2004-03-14 22:34:33 +00:00
|
|
|
vids->size = GUINT32_FROM_LE (vids->size);
|
|
|
|
vids->width = GUINT32_FROM_LE (vids->width);
|
|
|
|
vids->height = GUINT32_FROM_LE (vids->height);
|
|
|
|
vids->planes = GUINT16_FROM_LE (vids->planes);
|
|
|
|
vids->bit_cnt = GUINT16_FROM_LE (vids->bit_cnt);
|
2003-11-21 21:34:27 +00:00
|
|
|
vids->compression = GUINT32_FROM_LE (vids->compression);
|
2004-03-14 22:34:33 +00:00
|
|
|
vids->image_size = GUINT32_FROM_LE (vids->image_size);
|
2003-11-21 21:34:27 +00:00
|
|
|
vids->xpels_meter = GUINT32_FROM_LE (vids->xpels_meter);
|
|
|
|
vids->ypels_meter = GUINT32_FROM_LE (vids->ypels_meter);
|
2004-03-14 22:34:33 +00:00
|
|
|
vids->num_colors = GUINT32_FROM_LE (vids->num_colors);
|
|
|
|
vids->imp_colors = GUINT32_FROM_LE (vids->imp_colors);
|
2003-12-07 23:05:58 +00:00
|
|
|
|
2006-04-25 11:45:00 +00:00
|
|
|
if (size > sizeof (gst_riff_strf_vids)) { /* some extra_data */
|
2011-11-26 09:01:07 +00:00
|
|
|
gsize offset = sizeof (gst_riff_strf_vids);
|
|
|
|
|
|
|
|
buf =
|
|
|
|
gst_buffer_new_wrapped (g_memdup ((guint8 *) vids + offset,
|
|
|
|
size - offset), size - offset);
|
2006-04-25 11:45:00 +00:00
|
|
|
}
|
|
|
|
|
2010-06-30 23:22:07 +00:00
|
|
|
if (riff_fourcc)
|
|
|
|
*riff_fourcc = vids->compression;
|
|
|
|
|
gst/: First batch implementing audio and video codec tags in demuxers.
Original commit message from CVS:
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
(gst_riff_create_audio_caps), (gst_riff_create_iavs_caps),
(gst_riff_create_video_template_caps),
(gst_riff_create_audio_template_caps),
(gst_riff_create_iavs_template_caps):
* gst-libs/gst/riff/riff-media.h:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_base_init),
(gst_asf_demux_audio_caps), (gst_asf_demux_add_audio_stream),
(gst_asf_demux_video_caps), (gst_asf_demux_add_video_stream):
* gst/avi/gstavidemux.c: (gst_avi_demux_add_stream):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_video_caps), (gst_matroska_demux_audio_caps),
(gst_matroska_demux_plugin_init): First batch implementing audio and
video codec tags in demuxers.
2004-02-23 22:16:21 +00:00
|
|
|
caps = gst_riff_create_video_caps (vids->compression, NULL, vids,
|
2006-04-25 11:45:00 +00:00
|
|
|
buf, NULL, codec_name);
|
|
|
|
|
2010-06-30 23:22:07 +00:00
|
|
|
if (caps == NULL) {
|
|
|
|
GST_WARNING ("Unhandled RIFF fourcc %" GST_FOURCC_FORMAT,
|
|
|
|
GST_FOURCC_ARGS (vids->compression));
|
2015-03-11 20:25:40 +00:00
|
|
|
} else {
|
|
|
|
static GstStaticCaps intra_caps = GST_STATIC_CAPS ("image/jpeg; "
|
|
|
|
"video/x-raw; image/png; video/x-dv; video/x-huffyuv; video/x-ffv; "
|
|
|
|
"video/x-compressed-yuv");
|
|
|
|
context->intra_only =
|
|
|
|
gst_caps_can_intersect (gst_static_caps_get (&intra_caps), caps);
|
2010-06-30 23:22:07 +00:00
|
|
|
}
|
|
|
|
|
2006-04-25 11:45:00 +00:00
|
|
|
if (buf)
|
|
|
|
gst_buffer_unref (buf);
|
2009-03-31 14:06:50 +00:00
|
|
|
|
|
|
|
if (vids != (gst_riff_strf_vids *) data)
|
|
|
|
g_free (vids);
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_UNCOMPRESSED)) {
|
2013-11-14 19:11:38 +00:00
|
|
|
GstVideoInfo info;
|
|
|
|
GstVideoFormat format;
|
2004-03-15 19:32:27 +00:00
|
|
|
|
2013-11-14 19:11:38 +00:00
|
|
|
gst_video_info_init (&info);
|
2006-04-10 15:43:54 +00:00
|
|
|
switch (videocontext->fourcc) {
|
|
|
|
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
2013-11-14 19:11:38 +00:00
|
|
|
format = GST_VIDEO_FORMAT_I420;
|
2006-04-10 15:43:54 +00:00
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
2013-11-14 19:11:38 +00:00
|
|
|
format = GST_VIDEO_FORMAT_YUY2;
|
2006-04-10 15:43:54 +00:00
|
|
|
break;
|
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
|
|
|
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
|
2013-11-14 19:11:38 +00:00
|
|
|
format = GST_VIDEO_FORMAT_YV12;
|
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
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
|
2013-11-14 19:11:38 +00:00
|
|
|
format = GST_VIDEO_FORMAT_UYVY;
|
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
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
|
2013-11-14 19:11:38 +00:00
|
|
|
format = GST_VIDEO_FORMAT_AYUV;
|
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
|
|
|
break;
|
2014-02-07 13:00:15 +00:00
|
|
|
case GST_MAKE_FOURCC ('Y', '8', '0', '0'):
|
|
|
|
case GST_MAKE_FOURCC ('Y', '8', ' ', ' '):
|
|
|
|
format = GST_VIDEO_FORMAT_GRAY8;
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('R', 'G', 'B', 24):
|
|
|
|
format = GST_VIDEO_FORMAT_RGB;
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('B', 'G', 'R', 24):
|
|
|
|
format = GST_VIDEO_FORMAT_BGR;
|
|
|
|
break;
|
2006-04-10 15:43:54 +00:00
|
|
|
default:
|
|
|
|
GST_DEBUG ("Unknown fourcc %" GST_FOURCC_FORMAT,
|
|
|
|
GST_FOURCC_ARGS (videocontext->fourcc));
|
|
|
|
return NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
|
2015-03-11 20:25:40 +00:00
|
|
|
context->intra_only = TRUE;
|
|
|
|
|
2013-11-14 19:11:38 +00:00
|
|
|
gst_video_info_set_format (&info, format, videocontext->pixel_width,
|
|
|
|
videocontext->pixel_height);
|
|
|
|
caps = gst_video_info_to_caps (&info);
|
|
|
|
*codec_name = gst_pb_utils_get_codec_description (caps);
|
2015-08-31 10:46:52 +00:00
|
|
|
context->alignment = 32;
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_SP)) {
|
2003-12-22 01:47:09 +00:00
|
|
|
caps = gst_caps_new_simple ("video/x-divx",
|
2004-03-15 19:32:27 +00:00
|
|
|
"divxversion", G_TYPE_INT, 4, NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("MPEG-4 simple profile");
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP) ||
|
2004-03-14 22:34:33 +00:00
|
|
|
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AP)) {
|
2005-10-21 17:00:58 +00:00
|
|
|
caps = gst_caps_new_simple ("video/mpeg",
|
|
|
|
"mpegversion", G_TYPE_INT, 4,
|
|
|
|
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
2009-01-08 15:56:46 +00:00
|
|
|
if (data) {
|
2011-11-26 09:01:07 +00:00
|
|
|
GstBuffer *priv;
|
2009-01-08 15:56:46 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
priv = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
2009-01-08 15:56:46 +00:00
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
|
|
|
|
gst_buffer_unref (priv);
|
2013-07-01 08:59:07 +00:00
|
|
|
|
|
|
|
gst_codec_utils_mpeg4video_caps_set_level_and_profile (caps, data, size);
|
2009-01-08 15:56:46 +00:00
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_ASP))
|
|
|
|
*codec_name = g_strdup ("MPEG-4 advanced simple profile");
|
|
|
|
else
|
|
|
|
*codec_name = g_strdup ("MPEG-4 advanced profile");
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MSMPEG4V3)) {
|
2005-10-21 17:00:58 +00:00
|
|
|
#if 0
|
2004-03-14 22:34:33 +00:00
|
|
|
caps = gst_caps_new_full (gst_structure_new ("video/x-divx",
|
2004-03-15 19:32:27 +00:00
|
|
|
"divxversion", G_TYPE_INT, 3, NULL),
|
|
|
|
gst_structure_new ("video/x-msmpeg",
|
|
|
|
"msmpegversion", G_TYPE_INT, 43, NULL), NULL);
|
2005-10-21 17:00:58 +00:00
|
|
|
#endif
|
|
|
|
caps = gst_caps_new_simple ("video/x-msmpeg",
|
|
|
|
"msmpegversion", G_TYPE_INT, 43, NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("Microsoft MPEG-4 v.3");
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1) ||
|
2004-03-14 22:34:33 +00:00
|
|
|
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG2)) {
|
2010-06-16 17:50:34 +00:00
|
|
|
gint mpegversion;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG1))
|
|
|
|
mpegversion = 1;
|
|
|
|
else
|
2010-06-16 17:50:34 +00:00
|
|
|
mpegversion = 2;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
caps = gst_caps_new_simple ("video/mpeg",
|
2004-03-15 19:32:27 +00:00
|
|
|
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
|
|
|
"mpegversion", G_TYPE_INT, mpegversion, NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup_printf ("MPEG-%d video", mpegversion);
|
2008-06-19 09:12:55 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_add_mpeg_seq_header;
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MJPEG)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("image/jpeg");
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("Motion-JPEG");
|
2015-03-11 20:25:40 +00:00
|
|
|
context->intra_only = TRUE;
|
2005-10-18 18:12:31 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEG4_AVC)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("video/x-h264");
|
2005-10-18 18:12:31 +00:00
|
|
|
if (data) {
|
2011-11-26 09:01:07 +00:00
|
|
|
GstBuffer *priv;
|
2010-04-01 13:18:43 +00:00
|
|
|
|
2010-04-30 15:30:31 +00:00
|
|
|
/* First byte is the version, second is the profile indication, and third
|
|
|
|
* is the 5 contraint_set_flags and 3 reserved bits. Fourth byte is the
|
|
|
|
* level indication. */
|
|
|
|
gst_codec_utils_h264_caps_set_level_and_profile (caps, data + 1,
|
|
|
|
size - 1);
|
2005-10-18 18:12:31 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
priv = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
|
|
|
|
gst_buffer_unref (priv);
|
|
|
|
|
2010-12-23 22:03:00 +00:00
|
|
|
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, "avc",
|
|
|
|
"alignment", G_TYPE_STRING, "au", NULL);
|
2011-04-13 15:47:05 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING ("No codec data found, assuming output is byte-stream");
|
|
|
|
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, "byte-stream",
|
|
|
|
NULL);
|
2005-10-18 18:12:31 +00:00
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("H264");
|
2014-01-06 13:54:38 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_MPEGH_HEVC)) {
|
|
|
|
caps = gst_caps_new_empty_simple ("video/x-h265");
|
|
|
|
if (data) {
|
|
|
|
GstBuffer *priv;
|
|
|
|
|
|
|
|
gst_codec_utils_h265_caps_set_level_tier_and_profile (caps, data + 1,
|
|
|
|
size - 1);
|
|
|
|
|
|
|
|
priv = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
|
|
|
|
gst_buffer_unref (priv);
|
|
|
|
|
|
|
|
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, "hvc1",
|
|
|
|
"alignment", G_TYPE_STRING, "au", NULL);
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("No codec data found, assuming output is byte-stream");
|
|
|
|
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, "byte-stream",
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
*codec_name = g_strdup ("HEVC");
|
2006-01-23 18:39:31 +00:00
|
|
|
} else if ((!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1)) ||
|
|
|
|
(!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2)) ||
|
|
|
|
(!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3)) ||
|
|
|
|
(!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4))) {
|
|
|
|
gint rmversion = -1;
|
|
|
|
|
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO1))
|
|
|
|
rmversion = 1;
|
|
|
|
else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO2))
|
|
|
|
rmversion = 2;
|
|
|
|
else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO3))
|
|
|
|
rmversion = 3;
|
|
|
|
else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_REALVIDEO4))
|
|
|
|
rmversion = 4;
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("video/x-pn-realvideo",
|
|
|
|
"rmversion", G_TYPE_INT, rmversion, NULL);
|
2008-08-25 14:15:43 +00:00
|
|
|
GST_DEBUG ("data:%p, size:0x%x", data, size);
|
|
|
|
/* We need to extract the extradata ! */
|
|
|
|
if (data && (size >= 0x22)) {
|
|
|
|
GstBuffer *priv;
|
|
|
|
guint rformat;
|
|
|
|
guint subformat;
|
|
|
|
|
|
|
|
subformat = GST_READ_UINT32_BE (data + 0x1a);
|
|
|
|
rformat = GST_READ_UINT32_BE (data + 0x1e);
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
priv =
|
|
|
|
gst_buffer_new_wrapped (g_memdup (data + 0x1a, size - 0x1a),
|
|
|
|
size - 0x1a);
|
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, "format",
|
|
|
|
G_TYPE_INT, rformat, "subformat", G_TYPE_INT, subformat, NULL);
|
2008-08-25 14:15:43 +00:00
|
|
|
gst_buffer_unref (priv);
|
|
|
|
|
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup_printf ("RealVideo %d.0", rmversion);
|
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 (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_THEORA)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("video/x-theora");
|
2012-09-27 23:43:38 +00:00
|
|
|
context->stream_headers =
|
|
|
|
gst_matroska_parse_xiph_stream_headers (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
/* FIXME: mark stream as broken and skip if there are no stream headers */
|
|
|
|
context->send_stream_headers = TRUE;
|
2008-02-29 06:18:55 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_DIRAC)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("video/x-dirac");
|
2010-04-27 13:26:13 +00:00
|
|
|
*codec_name = g_strdup_printf ("Dirac");
|
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP8)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("video/x-vp8");
|
2010-04-27 13:26:13 +00:00
|
|
|
*codec_name = g_strdup_printf ("On2 VP8");
|
2013-06-21 11:11:32 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_VP9)) {
|
|
|
|
caps = gst_caps_new_empty_simple ("video/x-vp9");
|
|
|
|
*codec_name = g_strdup_printf ("On2 VP9");
|
2017-12-13 09:22:17 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_AV1)) {
|
|
|
|
caps = gst_caps_new_empty_simple ("video/x-av1");
|
2018-07-25 20:39:18 +00:00
|
|
|
if (data) {
|
|
|
|
GstBuffer *priv;
|
|
|
|
|
|
|
|
priv = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
|
|
|
|
gst_buffer_unref (priv);
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("No codec data found, assuming output is byte-stream");
|
|
|
|
gst_caps_set_simple (caps, "stream-format", G_TYPE_STRING, "byte-stream",
|
|
|
|
NULL);
|
|
|
|
}
|
2017-12-13 09:22:17 +00:00
|
|
|
*codec_name = g_strdup_printf ("AOM AV1");
|
2015-11-18 05:20:38 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_VIDEO_PRORES)) {
|
|
|
|
guint32 fourcc;
|
|
|
|
const gchar *variant, *variant_descr = "";
|
|
|
|
|
|
|
|
/* Expect a fourcc in the codec private data */
|
2015-12-29 16:05:56 +00:00
|
|
|
if (!data || size < 4) {
|
|
|
|
GST_WARNING ("No or too small PRORESS fourcc (%d bytes)", size);
|
2015-11-18 05:20:38 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
fourcc = GST_STR_FOURCC (data);
|
|
|
|
switch (fourcc) {
|
|
|
|
case GST_MAKE_FOURCC ('a', 'p', 'c', 's'):
|
|
|
|
variant_descr = " 4:2:2 LT";
|
|
|
|
variant = "lt";
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('a', 'p', 'c', 'h'):
|
|
|
|
variant = "hq";
|
|
|
|
variant_descr = " 4:2:2 HQ";
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('a', 'p', '4', 'h'):
|
|
|
|
variant = "4444";
|
|
|
|
variant_descr = " 4:4:4:4";
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('a', 'p', 'c', 'o'):
|
|
|
|
variant = "proxy";
|
|
|
|
variant_descr = " 4:2:2 Proxy";
|
|
|
|
break;
|
|
|
|
case GST_MAKE_FOURCC ('a', 'p', 'c', 'n'):
|
|
|
|
default:
|
|
|
|
variant = "standard";
|
|
|
|
variant_descr = " 4:2:2 SD";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG ("Prores video, codec fourcc %" GST_FOURCC_FORMAT,
|
|
|
|
GST_FOURCC_ARGS (fourcc));
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("video/x-prores",
|
|
|
|
"format", G_TYPE_STRING, variant, NULL);
|
|
|
|
*codec_name = g_strdup_printf ("Apple ProRes%s", variant_descr);
|
|
|
|
context->postprocess_frame = gst_matroska_demux_add_prores_header;
|
2003-11-21 21:34:27 +00:00
|
|
|
} else {
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_WARNING ("Unknown codec '%s', cannot build Caps", codec_id);
|
2003-12-22 01:47:09 +00:00
|
|
|
return NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (caps != NULL) {
|
2003-12-22 01:47:09 +00:00
|
|
|
int i;
|
|
|
|
GstStructure *structure;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
2003-12-22 01:47:09 +00:00
|
|
|
structure = gst_caps_get_structure (caps, i);
|
2004-07-15 23:56:05 +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
|
|
|
/* FIXME: use the real unit here! */
|
2006-04-10 15:43:54 +00:00
|
|
|
GST_DEBUG ("video size %dx%d, target display size %dx%d (any unit)",
|
|
|
|
videocontext->pixel_width,
|
|
|
|
videocontext->pixel_height,
|
|
|
|
videocontext->display_width, videocontext->display_height);
|
|
|
|
|
|
|
|
/* pixel width and height are the w and h of the video in pixels */
|
|
|
|
if (videocontext->pixel_width > 0 && videocontext->pixel_height > 0) {
|
|
|
|
gint w = videocontext->pixel_width;
|
|
|
|
gint h = videocontext->pixel_height;
|
|
|
|
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"width", G_TYPE_INT, w, "height", G_TYPE_INT, h, NULL);
|
|
|
|
}
|
2004-07-15 23:56:05 +00:00
|
|
|
|
2011-07-16 17:38:51 +00:00
|
|
|
if (videocontext->display_width > 0 || videocontext->display_height > 0) {
|
2006-04-10 15:43:54 +00:00
|
|
|
int n, d;
|
|
|
|
|
2011-07-16 17:38:51 +00:00
|
|
|
if (videocontext->display_width <= 0)
|
|
|
|
videocontext->display_width = videocontext->pixel_width;
|
|
|
|
if (videocontext->display_height <= 0)
|
|
|
|
videocontext->display_height = videocontext->pixel_height;
|
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
/* calculate the pixel aspect ratio using the display and pixel w/h */
|
|
|
|
n = videocontext->display_width * videocontext->pixel_height;
|
|
|
|
d = videocontext->display_height * videocontext->pixel_width;
|
|
|
|
GST_DEBUG ("setting PAR to %d/%d", n, d);
|
|
|
|
gst_structure_set (structure, "pixel-aspect-ratio",
|
|
|
|
GST_TYPE_FRACTION,
|
|
|
|
videocontext->display_width * videocontext->pixel_height,
|
|
|
|
videocontext->display_height * videocontext->pixel_width, NULL);
|
|
|
|
}
|
2005-11-22 22:21:37 +00:00
|
|
|
|
2006-12-11 13:59:33 +00:00
|
|
|
if (videocontext->default_fps > 0.0) {
|
2013-11-26 09:20:31 +00:00
|
|
|
gint fps_n, fps_d;
|
2005-11-22 22:21:37 +00:00
|
|
|
|
2013-11-26 09:20:31 +00:00
|
|
|
gst_util_double_to_fraction (videocontext->default_fps, &fps_n, &fps_d);
|
2006-12-11 13:59:33 +00:00
|
|
|
|
2013-11-26 09:20:31 +00:00
|
|
|
GST_DEBUG ("using default fps %d/%d", fps_n, fps_d);
|
2009-05-07 15:09:44 +00:00
|
|
|
|
2013-11-26 09:20:31 +00:00
|
|
|
gst_structure_set (structure, "framerate", GST_TYPE_FRACTION, fps_n,
|
|
|
|
fps_d, NULL);
|
2006-12-11 13:59:33 +00:00
|
|
|
} else if (context->default_duration > 0) {
|
2011-04-15 06:24:56 +00:00
|
|
|
int fps_n, fps_d;
|
2006-12-11 13:59:33 +00:00
|
|
|
|
2014-08-14 15:17:27 +00:00
|
|
|
gst_video_guess_framerate (context->default_duration, &fps_n, &fps_d);
|
2006-04-10 15:43:54 +00:00
|
|
|
|
2011-04-15 06:24:56 +00:00
|
|
|
GST_INFO ("using default duration %" G_GUINT64_FORMAT
|
|
|
|
" framerate %d/%d", context->default_duration, fps_n, fps_d);
|
2009-05-07 15:09:44 +00:00
|
|
|
|
2011-04-15 06:24:56 +00:00
|
|
|
gst_structure_set (structure, "framerate", GST_TYPE_FRACTION,
|
|
|
|
fps_n, fps_d, NULL);
|
2003-11-21 21:34:27 +00:00
|
|
|
} else {
|
2006-04-10 15:43:54 +00:00
|
|
|
gst_structure_set (structure, "framerate", GST_TYPE_FRACTION,
|
2014-11-18 15:52:40 +00:00
|
|
|
0, 1, NULL);
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
2010-05-01 12:15:49 +00:00
|
|
|
|
2018-08-23 20:57:35 +00:00
|
|
|
switch (videocontext->interlace_mode) {
|
|
|
|
case GST_MATROSKA_INTERLACE_MODE_PROGRESSIVE:
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"interlace-mode", G_TYPE_STRING, "progressive", NULL);
|
|
|
|
break;
|
|
|
|
case GST_MATROSKA_INTERLACE_MODE_INTERLACED:
|
|
|
|
gst_structure_set (structure,
|
|
|
|
"interlace-mode", G_TYPE_STRING, "mixed", NULL);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2003-12-22 01:47:09 +00:00
|
|
|
}
|
2015-06-15 06:12:10 +00:00
|
|
|
if (videocontext->multiview_mode != GST_VIDEO_MULTIVIEW_MODE_NONE) {
|
|
|
|
if (gst_video_multiview_guess_half_aspect (videocontext->multiview_mode,
|
|
|
|
videocontext->pixel_width, videocontext->pixel_height,
|
|
|
|
videocontext->display_width * videocontext->pixel_height,
|
|
|
|
videocontext->display_height * videocontext->pixel_width)) {
|
|
|
|
videocontext->multiview_flags |= GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT;
|
|
|
|
}
|
|
|
|
gst_caps_set_simple (caps,
|
|
|
|
"multiview-mode", G_TYPE_STRING,
|
|
|
|
gst_video_multiview_mode_to_caps_string
|
|
|
|
(videocontext->multiview_mode), "multiview-flags",
|
|
|
|
GST_TYPE_VIDEO_MULTIVIEW_FLAGSET, videocontext->multiview_flags,
|
|
|
|
GST_FLAG_SET_MASK_EXACT, NULL);
|
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
|
2017-11-07 09:03:53 +00:00
|
|
|
if (videocontext->colorimetry.range != GST_VIDEO_COLOR_RANGE_UNKNOWN ||
|
|
|
|
videocontext->colorimetry.matrix != GST_VIDEO_COLOR_MATRIX_UNKNOWN ||
|
|
|
|
videocontext->colorimetry.transfer != GST_VIDEO_TRANSFER_UNKNOWN ||
|
|
|
|
videocontext->colorimetry.primaries !=
|
|
|
|
GST_VIDEO_COLOR_PRIMARIES_UNKNOWN) {
|
|
|
|
gchar *colorimetry =
|
|
|
|
gst_video_colorimetry_to_string (&videocontext->colorimetry);
|
|
|
|
gst_caps_set_simple (caps, "colorimetry", G_TYPE_STRING, colorimetry,
|
|
|
|
NULL);
|
|
|
|
GST_DEBUG ("setting colorimetry to %s", colorimetry);
|
|
|
|
g_free (colorimetry);
|
|
|
|
}
|
|
|
|
|
2012-03-12 10:47:35 +00:00
|
|
|
caps = gst_caps_simplify (caps);
|
2003-12-22 01:47:09 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2004-12-16 22:16:02 +00:00
|
|
|
/*
|
|
|
|
* Some AAC specific code... *sigh*
|
2006-11-15 11:19:13 +00:00
|
|
|
* FIXME: maybe we should use '15' and code the sample rate explicitly
|
|
|
|
* if the sample rate doesn't match the predefined rates exactly? (tpm)
|
2004-12-16 22:16:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static gint
|
|
|
|
aac_rate_idx (gint rate)
|
|
|
|
{
|
|
|
|
if (92017 <= rate)
|
|
|
|
return 0;
|
|
|
|
else if (75132 <= rate)
|
|
|
|
return 1;
|
|
|
|
else if (55426 <= rate)
|
|
|
|
return 2;
|
|
|
|
else if (46009 <= rate)
|
|
|
|
return 3;
|
|
|
|
else if (37566 <= rate)
|
|
|
|
return 4;
|
|
|
|
else if (27713 <= rate)
|
|
|
|
return 5;
|
|
|
|
else if (23004 <= rate)
|
|
|
|
return 6;
|
|
|
|
else if (18783 <= rate)
|
|
|
|
return 7;
|
|
|
|
else if (13856 <= rate)
|
|
|
|
return 8;
|
|
|
|
else if (11502 <= rate)
|
|
|
|
return 9;
|
|
|
|
else if (9391 <= rate)
|
|
|
|
return 10;
|
|
|
|
else
|
|
|
|
return 11;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
aac_profile_idx (const gchar * codec_id)
|
|
|
|
{
|
|
|
|
gint profile;
|
|
|
|
|
|
|
|
if (strlen (codec_id) <= 12)
|
|
|
|
profile = 3;
|
|
|
|
else if (!strncmp (&codec_id[12], "MAIN", 4))
|
|
|
|
profile = 0;
|
|
|
|
else if (!strncmp (&codec_id[12], "LC", 2))
|
|
|
|
profile = 1;
|
|
|
|
else if (!strncmp (&codec_id[12], "SSR", 3))
|
|
|
|
profile = 2;
|
|
|
|
else
|
|
|
|
profile = 3;
|
|
|
|
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
2014-02-27 00:43:48 +00:00
|
|
|
static guint
|
|
|
|
round_up_pow2 (guint n)
|
|
|
|
{
|
|
|
|
n = n - 1;
|
|
|
|
n = n | (n >> 1);
|
|
|
|
n = n | (n >> 2);
|
|
|
|
n = n | (n >> 4);
|
|
|
|
n = n | (n >> 8);
|
|
|
|
n = n | (n >> 16);
|
|
|
|
return n + 1;
|
|
|
|
}
|
|
|
|
|
2004-12-16 22:16:02 +00:00
|
|
|
#define AAC_SYNC_EXTENSION_TYPE 0x02b7
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
static GstCaps *
|
2005-10-18 18:12:31 +00:00
|
|
|
gst_matroska_demux_audio_caps (GstMatroskaTrackAudioContext *
|
2009-01-30 17:26:19 +00:00
|
|
|
audiocontext, const gchar * codec_id, guint8 * data, guint size,
|
2010-06-30 23:22:07 +00:00
|
|
|
gchar ** codec_name, guint16 * riff_audio_fmt)
|
2003-11-21 21:34:27 +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
|
|
|
GstMatroskaTrackContext *context = (GstMatroskaTrackContext *) audiocontext;
|
2003-11-21 21:34:27 +00:00
|
|
|
GstCaps *caps = NULL;
|
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
g_assert (audiocontext != NULL);
|
|
|
|
g_assert (codec_name != NULL);
|
|
|
|
|
2010-06-30 23:22:07 +00:00
|
|
|
if (riff_audio_fmt)
|
|
|
|
*riff_audio_fmt = 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 have all codec types from matroska-ids.h
|
|
|
|
* check if we have to do more special things with codec_private
|
|
|
|
* check if we need bitdepth in different places too
|
|
|
|
* implement channel position magic
|
|
|
|
* Add support for:
|
|
|
|
* GST_MATROSKA_CODEC_ID_AUDIO_AC3_BSID9
|
|
|
|
* GST_MATROSKA_CODEC_ID_AUDIO_AC3_BSID10
|
|
|
|
* GST_MATROSKA_CODEC_ID_AUDIO_QUICKTIME_QDMC
|
|
|
|
* GST_MATROSKA_CODEC_ID_AUDIO_QUICKTIME_QDM2
|
|
|
|
*/
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1) ||
|
|
|
|
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2) ||
|
|
|
|
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L3)) {
|
2010-06-16 17:50:34 +00:00
|
|
|
gint layer;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L1))
|
|
|
|
layer = 1;
|
|
|
|
else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_MPEG1_L2))
|
|
|
|
layer = 2;
|
|
|
|
else
|
2010-06-16 17:50:34 +00:00
|
|
|
layer = 3;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/mpeg",
|
2004-03-15 19:32:27 +00:00
|
|
|
"mpegversion", G_TYPE_INT, 1, "layer", G_TYPE_INT, layer, NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup_printf ("MPEG-1 layer %d", layer);
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE) ||
|
2004-03-14 22:34:33 +00:00
|
|
|
!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_LE)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
gboolean sign;
|
2010-06-16 17:50:34 +00:00
|
|
|
gint endianness;
|
2011-11-26 09:01:07 +00:00
|
|
|
GstAudioFormat format;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
sign = (audiocontext->bitdepth != 8);
|
2003-11-21 21:34:27 +00:00
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_INT_BE))
|
|
|
|
endianness = G_BIG_ENDIAN;
|
|
|
|
else
|
2010-06-16 17:50:34 +00:00
|
|
|
endianness = G_LITTLE_ENDIAN;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
format = gst_audio_format_build_integer (sign, endianness,
|
|
|
|
audiocontext->bitdepth, audiocontext->bitdepth);
|
|
|
|
|
2012-01-04 10:52:29 +00:00
|
|
|
/* FIXME: Channel mask and reordering */
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-raw",
|
2012-01-04 10:52:29 +00:00
|
|
|
"format", G_TYPE_STRING, gst_audio_format_to_string (format),
|
2015-11-11 15:53:19 +00:00
|
|
|
"layout", G_TYPE_STRING, "interleaved",
|
|
|
|
"channel-mask", GST_TYPE_BITMASK,
|
|
|
|
gst_audio_channel_get_fallback_mask (audiocontext->channels), NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
|
|
|
|
*codec_name = g_strdup_printf ("Raw %d-bit PCM audio",
|
|
|
|
audiocontext->bitdepth);
|
2014-02-27 00:37:20 +00:00
|
|
|
context->alignment = GST_ROUND_UP_8 (audiocontext->bitdepth) / 8;
|
2014-02-27 00:43:48 +00:00
|
|
|
context->alignment = round_up_pow2 (context->alignment);
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_PCM_FLOAT)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
const gchar *format;
|
|
|
|
if (audiocontext->bitdepth == 32)
|
|
|
|
format = "F32LE";
|
|
|
|
else
|
|
|
|
format = "F64LE";
|
2012-01-04 10:52:29 +00:00
|
|
|
/* FIXME: Channel mask and reordering */
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-raw",
|
2012-01-04 10:52:29 +00:00
|
|
|
"format", G_TYPE_STRING, format,
|
2015-11-11 15:53:19 +00:00
|
|
|
"layout", G_TYPE_STRING, "interleaved",
|
|
|
|
"channel-mask", GST_TYPE_BITMASK,
|
|
|
|
gst_audio_channel_get_fallback_mask (audiocontext->channels), NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup_printf ("Raw %d-bit floating-point audio",
|
|
|
|
audiocontext->bitdepth);
|
2011-09-27 14:59:24 +00:00
|
|
|
context->alignment = audiocontext->bitdepth / 8;
|
2014-02-27 00:43:48 +00:00
|
|
|
context->alignment = round_up_pow2 (context->alignment);
|
2004-05-01 02:46:38 +00:00
|
|
|
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AC3,
|
2005-10-18 18:12:31 +00:00
|
|
|
strlen (GST_MATROSKA_CODEC_ID_AUDIO_AC3))) {
|
2010-10-14 15:26:14 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-ac3",
|
|
|
|
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("AC-3 audio");
|
2008-11-16 14:41:32 +00:00
|
|
|
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_EAC3,
|
|
|
|
strlen (GST_MATROSKA_CODEC_ID_AUDIO_EAC3))) {
|
2010-10-14 15:26:14 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-eac3",
|
|
|
|
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
2008-11-16 14:41:32 +00:00
|
|
|
*codec_name = g_strdup ("E-AC-3 audio");
|
2012-08-29 15:24:00 +00:00
|
|
|
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_TRUEHD,
|
|
|
|
strlen (GST_MATROSKA_CODEC_ID_AUDIO_TRUEHD))) {
|
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-true-hd");
|
|
|
|
*codec_name = g_strdup ("Dolby TrueHD");
|
2005-10-18 18:12:31 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_DTS)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-dts");
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("DTS audio");
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_VORBIS)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-vorbis");
|
2012-09-27 23:43:38 +00:00
|
|
|
context->stream_headers =
|
|
|
|
gst_matroska_parse_xiph_stream_headers (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
/* FIXME: mark stream as broken and skip if there are no stream headers */
|
|
|
|
context->send_stream_headers = TRUE;
|
gst/matroska/: not perfect yet though, needs some tweaking in flacdec; also, seeking could be better.
Original commit message from CVS:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_push_hdr_buf),
(gst_matroska_demux_push_flac_codec_priv_data),
(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:
Add basic FLAC support (#311586), not perfect yet though, needs some
tweaking in flacdec; also, seeking could be better.
Do better bounds checking when deserialising vorbis stream headers
to make sure we don't read beyond the end of the buffer on bad input.
2006-09-04 15:06:25 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_FLAC)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-flac");
|
2012-09-27 23:43:38 +00:00
|
|
|
context->stream_headers =
|
|
|
|
gst_matroska_parse_flac_stream_headers (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
/* FIXME: mark stream as broken and skip if there are no stream headers */
|
|
|
|
context->send_stream_headers = TRUE;
|
2009-04-13 12:03:03 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_SPEEX)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-speex");
|
2012-09-27 23:43:38 +00:00
|
|
|
context->stream_headers =
|
|
|
|
gst_matroska_parse_speex_stream_headers (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
/* FIXME: mark stream as broken and skip if there are no stream headers */
|
|
|
|
context->send_stream_headers = TRUE;
|
2014-03-30 00:31:11 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_OPUS)) {
|
2015-11-03 18:33:10 +00:00
|
|
|
GstBuffer *tmp;
|
|
|
|
|
|
|
|
if (context->codec_priv_size >= 19) {
|
|
|
|
if (audiocontext->samplerate)
|
|
|
|
GST_WRITE_UINT32_LE ((guint8 *) context->codec_priv + 12,
|
|
|
|
audiocontext->samplerate);
|
|
|
|
if (context->codec_delay) {
|
|
|
|
guint64 delay =
|
|
|
|
gst_util_uint64_scale_round (context->codec_delay, 48000,
|
|
|
|
GST_SECOND);
|
|
|
|
GST_WRITE_UINT16_LE ((guint8 *) context->codec_priv + 10, delay);
|
|
|
|
}
|
|
|
|
|
|
|
|
tmp =
|
|
|
|
gst_buffer_new_wrapped (g_memdup (context->codec_priv,
|
|
|
|
context->codec_priv_size), context->codec_priv_size);
|
|
|
|
caps = gst_codec_utils_opus_create_caps_from_header (tmp, NULL);
|
|
|
|
gst_buffer_unref (tmp);
|
|
|
|
*codec_name = g_strdup ("Opus");
|
2016-02-04 15:59:04 +00:00
|
|
|
} else if (context->codec_priv_size == 0) {
|
|
|
|
GST_WARNING ("No Opus codec data found, trying to create one");
|
2016-02-29 10:10:24 +00:00
|
|
|
if (audiocontext->channels <= 2) {
|
2016-02-04 15:59:04 +00:00
|
|
|
guint8 streams, coupled, channels;
|
|
|
|
guint32 samplerate;
|
|
|
|
|
|
|
|
samplerate =
|
|
|
|
audiocontext->samplerate == 0 ? 48000 : audiocontext->samplerate;
|
|
|
|
channels = audiocontext->channels == 0 ? 2 : audiocontext->channels;
|
|
|
|
if (channels == 1) {
|
|
|
|
streams = 1;
|
|
|
|
coupled = 0;
|
|
|
|
} else {
|
|
|
|
streams = 1;
|
|
|
|
coupled = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps =
|
|
|
|
gst_codec_utils_opus_create_caps (samplerate, channels, 0, streams,
|
|
|
|
coupled, NULL);
|
|
|
|
if (caps) {
|
|
|
|
*codec_name = g_strdup ("Opus");
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("Failed to create Opus caps from audio context");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("No Opus codec data, and not enough info to create one");
|
|
|
|
}
|
2015-11-03 18:33:10 +00:00
|
|
|
} else {
|
2016-02-04 15:59:04 +00:00
|
|
|
GST_WARNING ("Invalid Opus codec data size (got %" G_GSIZE_FORMAT
|
|
|
|
", expected 19)", context->codec_priv_size);
|
2015-11-03 18:33:10 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_ACM)) {
|
2009-08-08 03:47:48 +00:00
|
|
|
gst_riff_strf_auds auds;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2013-12-23 14:44:30 +00:00
|
|
|
if (data && size >= 18) {
|
|
|
|
GstBuffer *codec_data = NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
|
|
|
/* little-endian -> byte-order */
|
2009-08-08 03:47:48 +00:00
|
|
|
auds.format = GST_READ_UINT16_LE (data);
|
|
|
|
auds.channels = GST_READ_UINT16_LE (data + 2);
|
|
|
|
auds.rate = GST_READ_UINT32_LE (data + 4);
|
|
|
|
auds.av_bps = GST_READ_UINT32_LE (data + 8);
|
|
|
|
auds.blockalign = GST_READ_UINT16_LE (data + 12);
|
2012-07-09 10:22:02 +00:00
|
|
|
auds.bits_per_sample = GST_READ_UINT16_LE (data + 16);
|
2009-08-08 03:47:48 +00:00
|
|
|
|
|
|
|
/* 18 is the waveformatex size */
|
2013-12-23 14:44:30 +00:00
|
|
|
if (size > 18) {
|
|
|
|
codec_data = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
|
|
|
|
data + 18, size - 18, 0, size - 18, NULL, NULL);
|
|
|
|
}
|
2009-08-08 03:47:48 +00:00
|
|
|
|
2010-06-30 23:22:07 +00:00
|
|
|
if (riff_audio_fmt)
|
|
|
|
*riff_audio_fmt = auds.format;
|
|
|
|
|
2012-01-04 10:52:29 +00:00
|
|
|
/* FIXME: Handle reorder map */
|
2015-11-04 11:52:17 +00:00
|
|
|
caps = gst_riff_create_audio_caps (auds.format, NULL, &auds, codec_data,
|
|
|
|
NULL, codec_name, NULL);
|
2013-12-23 14:44:30 +00:00
|
|
|
if (codec_data)
|
|
|
|
gst_buffer_unref (codec_data);
|
2010-06-30 23:22:07 +00:00
|
|
|
|
|
|
|
if (caps == NULL) {
|
|
|
|
GST_WARNING ("Unhandled RIFF audio format 0x%02x", auds.format);
|
|
|
|
}
|
2013-12-23 14:44:30 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING ("Invalid codec data size (%d expected, got %d)", 18, size);
|
2003-11-21 21:34:27 +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
|
|
|
} else if (g_str_has_prefix (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AAC)) {
|
2004-12-16 22:16:02 +00:00
|
|
|
GstBuffer *priv = NULL;
|
2010-06-16 18:02:58 +00:00
|
|
|
gint mpegversion;
|
2006-04-20 09:11:22 +00:00
|
|
|
gint rate_idx, profile;
|
2006-11-15 11:19:13 +00:00
|
|
|
guint8 *data = NULL;
|
|
|
|
|
|
|
|
/* unspecified AAC profile with opaque private 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
|
|
|
if (strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AAC) == 0) {
|
2006-11-15 11:19:13 +00:00
|
|
|
if (context->codec_priv_size >= 2) {
|
|
|
|
guint obj_type, freq_index, explicit_freq_bytes = 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
|
|
|
codec_id = GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4;
|
2010-06-17 08:44:33 +00:00
|
|
|
mpegversion = 4;
|
2006-11-15 11:19:13 +00:00
|
|
|
freq_index = (GST_READ_UINT16_BE (context->codec_priv) & 0x780) >> 7;
|
|
|
|
obj_type = (GST_READ_UINT16_BE (context->codec_priv) & 0xF800) >> 11;
|
|
|
|
if (freq_index == 15)
|
|
|
|
explicit_freq_bytes = 3;
|
|
|
|
GST_DEBUG ("obj_type = %u, freq_index = %u", obj_type, freq_index);
|
2011-11-26 09:01:07 +00:00
|
|
|
priv = gst_buffer_new_wrapped (g_memdup (context->codec_priv,
|
|
|
|
context->codec_priv_size), context->codec_priv_size);
|
2006-11-15 11:19:13 +00:00
|
|
|
/* assume SBR if samplerate <= 24kHz */
|
|
|
|
if (obj_type == 5 || (freq_index >= 6 && freq_index != 15) ||
|
|
|
|
(context->codec_priv_size == (5 + explicit_freq_bytes))) {
|
|
|
|
audiocontext->samplerate *= 2;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("Opaque A_AAC codec ID, but no codec private data");
|
2010-07-12 15:29:12 +00:00
|
|
|
/* this is pretty broken;
|
|
|
|
* maybe we need to make up some default private,
|
|
|
|
* or maybe ADTS data got dumped in.
|
|
|
|
* Let's set up some private data now, and check actual data later */
|
2006-11-15 11:19:13 +00:00
|
|
|
/* just try this and see what happens ... */
|
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_id = GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4;
|
2010-07-12 15:29:12 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_check_aac;
|
2006-11-15 11:19:13 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-20 09:11:22 +00:00
|
|
|
|
2006-11-15 11:19:13 +00:00
|
|
|
/* make up decoder-specific data if it is not supplied */
|
|
|
|
if (priv == NULL) {
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
|
2012-03-15 12:36:17 +00:00
|
|
|
priv = gst_buffer_new_allocate (NULL, 5, NULL);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (priv, &map, GST_MAP_WRITE);
|
|
|
|
data = map.data;
|
2006-11-15 11:19:13 +00:00
|
|
|
rate_idx = aac_rate_idx (audiocontext->samplerate);
|
|
|
|
profile = aac_profile_idx (codec_id);
|
2006-04-20 09:11:22 +00:00
|
|
|
|
2006-11-15 11:19:13 +00:00
|
|
|
data[0] = ((profile + 1) << 3) | ((rate_idx & 0xE) >> 1);
|
|
|
|
data[1] = ((rate_idx & 0x1) << 7) | (audiocontext->channels << 3);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2010-06-16 18:02:58 +00:00
|
|
|
if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2,
|
|
|
|
strlen (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG2))) {
|
|
|
|
mpegversion = 2;
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (priv, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_set_size (priv, 2);
|
2010-06-16 18:02:58 +00:00
|
|
|
} else if (!strncmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4,
|
|
|
|
strlen (GST_MATROSKA_CODEC_ID_AUDIO_AAC_MPEG4))) {
|
|
|
|
mpegversion = 4;
|
|
|
|
|
|
|
|
if (g_strrstr (codec_id, "SBR")) {
|
|
|
|
/* HE-AAC (aka SBR AAC) */
|
|
|
|
audiocontext->samplerate *= 2;
|
|
|
|
rate_idx = aac_rate_idx (audiocontext->samplerate);
|
|
|
|
data[2] = AAC_SYNC_EXTENSION_TYPE >> 3;
|
|
|
|
data[3] = ((AAC_SYNC_EXTENSION_TYPE & 0x07) << 5) | 5;
|
|
|
|
data[4] = (1 << 7) | (rate_idx << 3);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (priv, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
} else {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (priv, &map);
|
2011-11-26 09:01:07 +00:00
|
|
|
gst_buffer_set_size (priv, 2);
|
2010-06-16 18:02:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_unmap (priv, &map);
|
2010-06-16 18:02:58 +00:00
|
|
|
gst_buffer_unref (priv);
|
|
|
|
priv = NULL;
|
|
|
|
GST_ERROR ("Unknown AAC profile and no codec private data");
|
2004-12-16 22:16:02 +00:00
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2004-12-16 22:16:02 +00:00
|
|
|
if (priv) {
|
2010-06-16 18:02:58 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/mpeg",
|
|
|
|
"mpegversion", G_TYPE_INT, mpegversion,
|
2013-04-30 12:36:38 +00:00
|
|
|
"framed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"stream-format", G_TYPE_STRING, "raw", NULL);
|
2004-12-16 22:16:02 +00:00
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
|
2013-07-01 08:56:28 +00:00
|
|
|
if (context->codec_priv && context->codec_priv_size > 0)
|
|
|
|
gst_codec_utils_aac_caps_set_level_and_profile (caps,
|
|
|
|
context->codec_priv, context->codec_priv_size);
|
2010-06-16 18:02:58 +00:00
|
|
|
*codec_name = g_strdup_printf ("MPEG-%d AAC audio", mpegversion);
|
2011-10-10 18:02:58 +00:00
|
|
|
gst_buffer_unref (priv);
|
2004-12-16 22:16:02 +00:00
|
|
|
}
|
2004-08-25 14:41:12 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_TTA)) {
|
2006-04-10 15:43:54 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-tta",
|
|
|
|
"width", G_TYPE_INT, audiocontext->bitdepth, NULL);
|
|
|
|
*codec_name = g_strdup ("TTA audio");
|
2005-10-18 18:12:31 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_WAVPACK4)) {
|
2006-04-10 15:43:54 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-wavpack",
|
|
|
|
"width", G_TYPE_INT, audiocontext->bitdepth,
|
|
|
|
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
|
|
*codec_name = g_strdup ("Wavpack audio");
|
2008-06-19 09:12:55 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_add_wvpk_header;
|
2008-06-19 10:48:57 +00:00
|
|
|
audiocontext->wvpk_block_index = 0;
|
2006-01-23 18:39:31 +00:00
|
|
|
} else if ((!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4)) ||
|
2014-09-12 09:35:36 +00:00
|
|
|
(!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_28_8)) ||
|
2006-01-23 18:39:31 +00:00
|
|
|
(!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK))) {
|
|
|
|
gint raversion = -1;
|
|
|
|
|
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_14_4))
|
|
|
|
raversion = 1;
|
|
|
|
else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_COOK))
|
|
|
|
raversion = 8;
|
|
|
|
else
|
|
|
|
raversion = 2;
|
2008-08-25 14:15:43 +00:00
|
|
|
|
2006-01-23 18:39:31 +00:00
|
|
|
caps = gst_caps_new_simple ("audio/x-pn-realaudio",
|
|
|
|
"raversion", G_TYPE_INT, raversion, NULL);
|
2008-08-25 14:15:43 +00:00
|
|
|
/* Extract extra information from caps, mapping varies based on codec */
|
|
|
|
if (data && (size >= 0x50)) {
|
|
|
|
GstBuffer *priv;
|
|
|
|
guint flavor;
|
|
|
|
guint packet_size;
|
|
|
|
guint height;
|
|
|
|
guint leaf_size;
|
|
|
|
guint sample_width;
|
|
|
|
guint extra_data_size;
|
|
|
|
|
2017-11-13 12:51:20 +00:00
|
|
|
GST_DEBUG ("real audio raversion:%d", raversion);
|
2008-08-25 14:15:43 +00:00
|
|
|
if (raversion == 8) {
|
|
|
|
/* COOK */
|
|
|
|
flavor = GST_READ_UINT16_BE (data + 22);
|
|
|
|
packet_size = GST_READ_UINT32_BE (data + 24);
|
|
|
|
height = GST_READ_UINT16_BE (data + 40);
|
|
|
|
leaf_size = GST_READ_UINT16_BE (data + 44);
|
|
|
|
sample_width = GST_READ_UINT16_BE (data + 58);
|
|
|
|
extra_data_size = GST_READ_UINT32_BE (data + 74);
|
|
|
|
|
2017-11-13 12:51:20 +00:00
|
|
|
GST_DEBUG
|
2008-08-25 14:15:43 +00:00
|
|
|
("flavor:%d, packet_size:%d, height:%d, leaf_size:%d, sample_width:%d, extra_data_size:%d",
|
|
|
|
flavor, packet_size, height, leaf_size, sample_width,
|
|
|
|
extra_data_size);
|
|
|
|
gst_caps_set_simple (caps, "flavor", G_TYPE_INT, flavor, "packet_size",
|
|
|
|
G_TYPE_INT, packet_size, "height", G_TYPE_INT, height, "leaf_size",
|
|
|
|
G_TYPE_INT, leaf_size, "width", G_TYPE_INT, sample_width, NULL);
|
|
|
|
|
|
|
|
if ((size - 78) >= extra_data_size) {
|
2011-11-26 09:01:07 +00:00
|
|
|
priv = gst_buffer_new_wrapped (g_memdup (data + 78, extra_data_size),
|
|
|
|
extra_data_size);
|
2008-08-25 14:15:43 +00:00
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, priv, NULL);
|
|
|
|
gst_buffer_unref (priv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup_printf ("RealAudio %d.0", raversion);
|
2006-01-23 18:39:31 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_SIPR)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-sipro");
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("Sipro/ACELP.NET Voice Codec");
|
2006-01-23 18:39:31 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_RALF)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-ralf-mpeg4-generic");
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("Real Audio Lossless");
|
2006-01-23 18:39:31 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_AUDIO_REAL_ATRC)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("audio/x-vnd.sony.atrac3");
|
2006-04-10 15:43:54 +00:00
|
|
|
*codec_name = g_strdup ("Sony ATRAC3");
|
2003-11-21 21:34:27 +00:00
|
|
|
} else {
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_WARNING ("Unknown codec '%s', cannot build Caps", codec_id);
|
2003-12-22 01:47:09 +00:00
|
|
|
return NULL;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (caps != NULL) {
|
2006-04-10 15:43:54 +00:00
|
|
|
if (audiocontext->samplerate > 0 && audiocontext->channels > 0) {
|
|
|
|
gint i;
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2006-04-10 15:43:54 +00:00
|
|
|
for (i = 0; i < gst_caps_get_size (caps); i++) {
|
|
|
|
gst_structure_set (gst_caps_get_structure (caps, i),
|
|
|
|
"channels", G_TYPE_INT, audiocontext->channels,
|
|
|
|
"rate", G_TYPE_INT, audiocontext->samplerate, NULL);
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-10 15:43:54 +00:00
|
|
|
|
2012-03-12 10:47:35 +00:00
|
|
|
caps = gst_caps_simplify (caps);
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_demux_subtitle_caps (GstMatroskaTrackSubtitleContext *
|
|
|
|
subtitlecontext, const gchar * codec_id, gpointer data, guint size)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps = NULL;
|
2008-06-19 09:12:55 +00:00
|
|
|
GstMatroskaTrackContext *context =
|
|
|
|
(GstMatroskaTrackContext *) subtitlecontext;
|
|
|
|
|
2006-02-18 17:20:48 +00:00
|
|
|
/* for backwards compatibility */
|
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
|
|
|
if (!g_ascii_strcasecmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_ASCII))
|
2006-02-18 17:20:48 +00:00
|
|
|
codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8;
|
|
|
|
else if (!g_ascii_strcasecmp (codec_id, "S_SSA"))
|
|
|
|
codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_SSA;
|
|
|
|
else if (!g_ascii_strcasecmp (codec_id, "S_ASS"))
|
|
|
|
codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_ASS;
|
|
|
|
else if (!g_ascii_strcasecmp (codec_id, "S_USF"))
|
|
|
|
codec_id = GST_MATROSKA_CODEC_ID_SUBTITLE_USF;
|
|
|
|
|
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: Add GST_MATROSKA_CODEC_ID_SUBTITLE_BMP support
|
|
|
|
* Check if we have to do something with codec_private */
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_UTF8)) {
|
2010-06-23 09:12:00 +00:00
|
|
|
/* well, plain text simply does not have a lot of markup ... */
|
2012-09-02 01:50:50 +00:00
|
|
|
caps = gst_caps_new_simple ("text/x-raw", "format", G_TYPE_STRING,
|
|
|
|
"pango-markup", NULL);
|
2008-06-19 09:12:55 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_check_subtitle_buffer;
|
2011-12-01 12:34:52 +00:00
|
|
|
subtitlecontext->check_markup = TRUE;
|
2006-02-18 17:20:48 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_SSA)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("application/x-ssa");
|
2008-06-19 09:12:55 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_check_subtitle_buffer;
|
2011-12-01 12:38:06 +00:00
|
|
|
subtitlecontext->check_markup = FALSE;
|
2006-02-18 17:20:48 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_ASS)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("application/x-ass");
|
2008-06-19 09:12:55 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_check_subtitle_buffer;
|
2011-12-01 12:34:52 +00:00
|
|
|
subtitlecontext->check_markup = FALSE;
|
2006-02-18 17:20:48 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_USF)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("application/x-usf");
|
2008-06-19 09:12:55 +00:00
|
|
|
context->postprocess_frame = gst_matroska_demux_check_subtitle_buffer;
|
2011-12-01 12:34:52 +00:00
|
|
|
subtitlecontext->check_markup = FALSE;
|
2006-09-04 16:21:17 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_VOBSUB)) {
|
2012-08-20 22:30:38 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("subpicture/x-dvd");
|
2007-11-13 17:01:07 +00:00
|
|
|
((GstMatroskaTrackContext *) subtitlecontext)->send_dvd_event = TRUE;
|
2009-05-19 14:12:09 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_HDMVPGS)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("subpicture/x-pgs");
|
2009-02-15 18:49:44 +00:00
|
|
|
} else if (!strcmp (codec_id, GST_MATROSKA_CODEC_ID_SUBTITLE_KATE)) {
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("subtitle/x-kate");
|
2012-09-27 23:43:38 +00:00
|
|
|
context->stream_headers =
|
|
|
|
gst_matroska_parse_xiph_stream_headers (context->codec_priv,
|
|
|
|
context->codec_priv_size);
|
|
|
|
/* FIXME: mark stream as broken and skip if there are no stream headers */
|
|
|
|
context->send_stream_headers = TRUE;
|
2005-10-18 18:12:31 +00:00
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Unknown subtitle stream: codec_id='%s'", codec_id);
|
2011-11-26 09:01:07 +00:00
|
|
|
caps = gst_caps_new_empty_simple ("application/x-subtitle-unknown");
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2006-02-18 17:20:48 +00:00
|
|
|
if (data != NULL && size > 0) {
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
2011-11-26 09:01:07 +00:00
|
|
|
buf = gst_buffer_new_wrapped (g_memdup (data, size), size);
|
2006-02-18 17:20:48 +00:00
|
|
|
gst_caps_set_simple (caps, "codec_data", GST_TYPE_BUFFER, buf, NULL);
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2011-12-30 17:41:46 +00:00
|
|
|
#if 0
|
2009-05-14 12:46:14 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_set_index (GstElement * element, GstIndex * index)
|
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-05-23 15:06:44 +00:00
|
|
|
if (demux->common.element_index)
|
|
|
|
gst_object_unref (demux->common.element_index);
|
|
|
|
demux->common.element_index = index ? gst_object_ref (index) : NULL;
|
2009-05-14 12:46:14 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
2011-05-23 15:06:44 +00:00
|
|
|
GST_DEBUG_OBJECT (demux, "Set index %" GST_PTR_FORMAT,
|
|
|
|
demux->common.element_index);
|
2009-05-14 12:46:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstIndex *
|
|
|
|
gst_matroska_demux_get_index (GstElement * element)
|
|
|
|
{
|
|
|
|
GstIndex *result = NULL;
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (demux);
|
2011-05-23 15:06:44 +00:00
|
|
|
if (demux->common.element_index)
|
|
|
|
result = gst_object_ref (demux->common.element_index);
|
2009-05-14 12:46:14 +00:00
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (demux, "Returning index %" GST_PTR_FORMAT, result);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2011-12-30 17:41:46 +00:00
|
|
|
#endif
|
2009-05-14 12:46:14 +00:00
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_matroska_demux_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (element);
|
2005-10-18 18:12:31 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
|
|
|
|
/* handle upwards state changes here */
|
|
|
|
switch (transition) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2003-11-21 21:34:27 +00:00
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
/* handle downwards state changes */
|
2005-09-02 15:44:50 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2003-11-21 21:34:27 +00:00
|
|
|
gst_matroska_demux_reset (GST_ELEMENT (demux));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-18 18:12:31 +00:00
|
|
|
return ret;
|
2003-11-21 21:34:27 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 12:46:00 +00:00
|
|
|
static void
|
|
|
|
gst_matroska_demux_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_MATROSKA_DEMUX (object));
|
|
|
|
demux = GST_MATROSKA_DEMUX (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_MAX_GAP_TIME:
|
2011-09-14 12:46:00 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
demux->max_gap_time = g_value_get_uint64 (value);
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
break;
|
2018-08-15 11:14:24 +00:00
|
|
|
case PROP_MAX_BACKTRACK_DISTANCE:
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
demux->max_backtrack_distance = g_value_get_uint (value);
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
break;
|
2011-09-14 12:46:00 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_matroska_demux_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstMatroskaDemux *demux;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_IS_MATROSKA_DEMUX (object));
|
|
|
|
demux = GST_MATROSKA_DEMUX (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2015-04-27 10:22:11 +00:00
|
|
|
case PROP_MAX_GAP_TIME:
|
2011-09-14 12:46:00 +00:00
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
g_value_set_uint64 (value, demux->max_gap_time);
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
break;
|
2018-08-15 11:14:24 +00:00
|
|
|
case PROP_MAX_BACKTRACK_DISTANCE:
|
|
|
|
GST_OBJECT_LOCK (demux);
|
|
|
|
g_value_set_uint (value, demux->max_backtrack_distance);
|
|
|
|
GST_OBJECT_UNLOCK (demux);
|
|
|
|
break;
|
2011-09-14 12:46:00 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
matroska: Add the WebM encrypted content support in matroskademux
This commit:
1. Reads the WebM and Matroska ContentEncryption subelements.
2. Creates a GST_PROTECTION event for each ContentEncryption, which
will be sent before pushing the first source buffer.
The DRM system id field in this event is set to GST_PROTECTION_UNSPECIFIED_SYSTEM_ID,
because it isn't specified neither by Matroska nor by the WebM spec.
3. Reads the protection information of encrypted Block/SimpleBlock and
extracts the IV and the partitioning format (subsamples).
4. Creates the metadata protection for each encrypted Block/SimpleBlock,
with those informations: KeyID (extracted from ContentEncryption element),
IV and partitioning format.
5. Adds a new caps for WebM encrypted content named "application/x-webm-enc",
with the following new fields:
"encryption-algorithm": The encryption algorithm used.
values: "None", "DES", "3DES", "Twofish", "Blowfish", "AES".
"encoding-scope": The field that describes which Elements have been modified.
Values: "frame", "codec-data", "next-content".
"cipher-mode": The cipher mode used in the encryption.
Values: "None", "CTR".
https://bugzilla.gnome.org/show_bug.cgi?id=765275
2018-09-30 17:28:07 +00:00
|
|
|
static const gchar *
|
|
|
|
gst_matroska_track_encryption_algorithm_name (gint val)
|
|
|
|
{
|
|
|
|
GEnumValue *en;
|
|
|
|
GEnumClass *enum_class =
|
|
|
|
g_type_class_ref (MATROSKA_TRACK_ENCRYPTION_ALGORITHM_TYPE);
|
|
|
|
en = g_enum_get_value (G_ENUM_CLASS (enum_class), val);
|
|
|
|
return en ? en->value_nick : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
gst_matroska_track_encryption_cipher_mode_name (gint val)
|
|
|
|
{
|
|
|
|
GEnumValue *en;
|
|
|
|
GEnumClass *enum_class =
|
|
|
|
g_type_class_ref (MATROSKA_TRACK_ENCRYPTION_CIPHER_MODE_TYPE);
|
|
|
|
en = g_enum_get_value (G_ENUM_CLASS (enum_class), val);
|
|
|
|
return en ? en->value_nick : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const gchar *
|
|
|
|
gst_matroska_track_encoding_scope_name (gint val)
|
|
|
|
{
|
|
|
|
GEnumValue *en;
|
|
|
|
GEnumClass *enum_class =
|
|
|
|
g_type_class_ref (MATROSKA_TRACK_ENCODING_SCOPE_TYPE);
|
|
|
|
|
|
|
|
en = g_enum_get_value (G_ENUM_CLASS (enum_class), val);
|
|
|
|
return en ? en->value_nick : NULL;
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_matroska_demux_plugin_init (GstPlugin * plugin)
|
2003-11-21 21:34:27 +00:00
|
|
|
{
|
2006-04-20 09:11:22 +00:00
|
|
|
gst_riff_init ();
|
|
|
|
|
2011-02-18 01:57:55 +00:00
|
|
|
/* parser helper separate debug */
|
|
|
|
GST_DEBUG_CATEGORY_INIT (ebmlread_debug, "ebmlread",
|
|
|
|
0, "EBML stream helper class");
|
|
|
|
|
2003-11-21 21:34:27 +00:00
|
|
|
/* create an elementfactory for the matroska_demux element */
|
|
|
|
if (!gst_element_register (plugin, "matroskademux",
|
2004-03-15 19:32:27 +00:00
|
|
|
GST_RANK_PRIMARY, GST_TYPE_MATROSKA_DEMUX))
|
2003-11-21 21:34:27 +00:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|