gstreamer/gst/matroska/matroska-ids.c
Sebastian Dröge 6cf110c1e3 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

120 lines
3.8 KiB
C

/* GStreamer Matroska muxer/demuxer
* (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
* (C) 2006 Tim-Philipp Müller <tim centricular net>
*
* matroska-ids.c: matroska track context utility functions
*
* 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
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "matroska-ids.h"
gboolean
gst_matroska_track_init_video_context (GstMatroskaTrackContext ** p_context)
{
GstMatroskaTrackVideoContext *video_context;
g_assert (p_context != NULL && *p_context != NULL);
/* already set up? (track info might come before track type) */
if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
GST_LOG ("video context already set up");
return TRUE;
}
/* it better not have been set up as some other track type ... */
if ((*p_context)->type != 0) {
g_return_val_if_reached (FALSE);
}
video_context = g_renew (GstMatroskaTrackVideoContext, *p_context, 1);
*p_context = (GstMatroskaTrackContext *) video_context;
/* defaults */
(*p_context)->type = GST_MATROSKA_TRACK_TYPE_VIDEO;
video_context->display_width = 0;
video_context->display_height = 0;
video_context->pixel_width = 0;
video_context->pixel_height = 0;
video_context->asr_mode = 0;
video_context->fourcc = 0;
video_context->default_fps = 0.0;
return TRUE;
}
gboolean
gst_matroska_track_init_audio_context (GstMatroskaTrackContext ** p_context)
{
GstMatroskaTrackAudioContext *audio_context;
g_assert (p_context != NULL && *p_context != NULL);
/* already set up? (track info might come before track type) */
if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_AUDIO)
return TRUE;
/* it better not have been set up as some other track type ... */
if ((*p_context)->type != 0) {
g_return_val_if_reached (FALSE);
}
audio_context = g_renew (GstMatroskaTrackAudioContext, *p_context, 1);
*p_context = (GstMatroskaTrackContext *) audio_context;
/* defaults */
(*p_context)->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
audio_context->channels = 1;
audio_context->samplerate = 8000;
return TRUE;
}
gboolean
gst_matroska_track_init_subtitle_context (GstMatroskaTrackContext ** p_context)
{
GstMatroskaTrackSubtitleContext *subtitle_context;
g_assert (p_context != NULL && *p_context != NULL);
/* already set up? (track info might come before track type) */
if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
return TRUE;
/* it better not have been set up as some other track type ... */
if ((*p_context)->type != 0) {
g_return_val_if_reached (FALSE);
}
subtitle_context = g_renew (GstMatroskaTrackSubtitleContext, *p_context, 1);
*p_context = (GstMatroskaTrackContext *) subtitle_context;
(*p_context)->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
subtitle_context->invalid_utf8 = FALSE;
return TRUE;
}
void
gst_matroska_register_tags (void)
{
/* FIXME: Remove this when we depend on core 0.10.21 */
if (!gst_tag_exists (GST_TAG_ATTACHMENT))
gst_tag_register (GST_TAG_ATTACHMENT, GST_TAG_FLAG_META, GST_TYPE_BUFFER,
"attachment", "file attached to this stream", gst_tag_merge_use_first);
/* TODO: register other custom tags */
}