1 /* GStreamer Matroska muxer/demuxer
2 * (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3 * (C) 2006 Tim-Philipp Müller <tim centricular net>
5 * matroska-ids.c: matroska track context utility functions
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
27 #include "matroska-ids.h"
30 gst_matroska_track_init_video_context (GstMatroskaTrackContext ** p_context)
32 GstMatroskaTrackVideoContext *video_context;
34 g_assert (p_context != NULL && *p_context != NULL);
36 /* already set up? (track info might come before track type) */
37 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
38 GST_LOG ("video context already set up");
42 /* it better not have been set up as some other track type ... */
43 if ((*p_context)->type != 0) {
44 g_return_val_if_reached (FALSE);
47 video_context = g_renew (GstMatroskaTrackVideoContext, *p_context, 1);
48 *p_context = (GstMatroskaTrackContext *) video_context;
51 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_VIDEO;
52 video_context->display_width = 0;
53 video_context->display_height = 0;
54 video_context->pixel_width = 0;
55 video_context->pixel_height = 0;
56 video_context->asr_mode = 0;
57 video_context->fourcc = 0;
58 video_context->default_fps = 0.0;
59 video_context->earliest_time = GST_CLOCK_TIME_NONE;
64 gst_matroska_track_init_audio_context (GstMatroskaTrackContext ** p_context)
66 GstMatroskaTrackAudioContext *audio_context;
68 g_assert (p_context != NULL && *p_context != NULL);
70 /* already set up? (track info might come before track type) */
71 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_AUDIO)
74 /* it better not have been set up as some other track type ... */
75 if ((*p_context)->type != 0) {
76 g_return_val_if_reached (FALSE);
79 audio_context = g_renew (GstMatroskaTrackAudioContext, *p_context, 1);
80 *p_context = (GstMatroskaTrackContext *) audio_context;
83 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
84 audio_context->channels = 1;
85 audio_context->samplerate = 8000;
90 gst_matroska_track_init_subtitle_context (GstMatroskaTrackContext ** p_context)
92 GstMatroskaTrackSubtitleContext *subtitle_context;
94 g_assert (p_context != NULL && *p_context != NULL);
96 /* already set up? (track info might come before track type) */
97 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
100 /* it better not have been set up as some other track type ... */
101 if ((*p_context)->type != 0) {
102 g_return_val_if_reached (FALSE);
105 subtitle_context = g_renew (GstMatroskaTrackSubtitleContext, *p_context, 1);
106 *p_context = (GstMatroskaTrackContext *) subtitle_context;
108 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
109 subtitle_context->invalid_utf8 = FALSE;
110 subtitle_context->seen_markup_tag = FALSE;
115 gst_matroska_register_tags (void)
117 /* TODO: register other custom tags */