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_doctype_get_type (void)
32 static GType doctype_type = 0;
34 static const GEnumValue doctype_types[] = {
35 {GST_MATROSKA_DOCTYPE_MATROSKA, "Matroska", "matroska"},
36 {GST_MATROSKA_DOCTYPE_WEBM, "WebM", "webm"},
41 doctype_type = g_enum_register_static ("GstMatroskaDoctype", doctype_types);
47 gst_matroska_track_init_video_context (GstMatroskaTrackContext ** p_context)
49 GstMatroskaTrackVideoContext *video_context;
51 g_assert (p_context != NULL && *p_context != NULL);
53 /* already set up? (track info might come before track type) */
54 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
55 GST_LOG ("video context already set up");
59 /* it better not have been set up as some other track type ... */
60 if ((*p_context)->type != 0) {
61 g_return_val_if_reached (FALSE);
64 video_context = g_renew (GstMatroskaTrackVideoContext, *p_context, 1);
65 *p_context = (GstMatroskaTrackContext *) video_context;
68 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_VIDEO;
69 video_context->display_width = 0;
70 video_context->display_height = 0;
71 video_context->pixel_width = 0;
72 video_context->pixel_height = 0;
73 video_context->asr_mode = 0;
74 video_context->fourcc = 0;
75 video_context->default_fps = 0.0;
80 gst_matroska_track_init_audio_context (GstMatroskaTrackContext ** p_context)
82 GstMatroskaTrackAudioContext *audio_context;
84 g_assert (p_context != NULL && *p_context != NULL);
86 /* already set up? (track info might come before track type) */
87 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_AUDIO)
90 /* it better not have been set up as some other track type ... */
91 if ((*p_context)->type != 0) {
92 g_return_val_if_reached (FALSE);
95 audio_context = g_renew (GstMatroskaTrackAudioContext, *p_context, 1);
96 *p_context = (GstMatroskaTrackContext *) audio_context;
99 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
100 audio_context->channels = 1;
101 audio_context->samplerate = 8000;
106 gst_matroska_track_init_subtitle_context (GstMatroskaTrackContext ** p_context)
108 GstMatroskaTrackSubtitleContext *subtitle_context;
110 g_assert (p_context != NULL && *p_context != NULL);
112 /* already set up? (track info might come before track type) */
113 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
116 /* it better not have been set up as some other track type ... */
117 if ((*p_context)->type != 0) {
118 g_return_val_if_reached (FALSE);
121 subtitle_context = g_renew (GstMatroskaTrackSubtitleContext, *p_context, 1);
122 *p_context = (GstMatroskaTrackContext *) subtitle_context;
124 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
125 subtitle_context->invalid_utf8 = FALSE;
130 gst_matroska_register_tags (void)
132 /* TODO: register other custom tags */