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->eye_mode = 0;
57 video_context->asr_mode = 0;
58 video_context->fourcc = 0;
63 gst_matroska_track_init_audio_context (GstMatroskaTrackContext ** p_context)
65 GstMatroskaTrackAudioContext *audio_context;
67 g_assert (p_context != NULL && *p_context != NULL);
69 /* already set up? (track info might come before track type) */
70 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_AUDIO)
73 /* it better not have been set up as some other track type ... */
74 if ((*p_context)->type != 0) {
75 g_return_val_if_reached (FALSE);
78 audio_context = g_renew (GstMatroskaTrackAudioContext, *p_context, 1);
79 *p_context = (GstMatroskaTrackContext *) audio_context;
82 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_AUDIO;
83 audio_context->channels = 1;
84 audio_context->samplerate = 8000;
89 gst_matroska_track_init_subtitle_context (GstMatroskaTrackContext ** p_context)
91 GstMatroskaTrackSubtitleContext *subtitle_context;
93 g_assert (p_context != NULL && *p_context != NULL);
95 /* already set up? (track info might come before track type) */
96 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_SUBTITLE)
99 /* it better not have been set up as some other track type ... */
100 if ((*p_context)->type != 0) {
101 g_return_val_if_reached (FALSE);
104 subtitle_context = g_renew (GstMatroskaTrackSubtitleContext, *p_context, 1);
105 *p_context = (GstMatroskaTrackContext *) subtitle_context;
107 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_SUBTITLE;
108 subtitle_context->invalid_utf8 = FALSE;
113 gst_matroska_track_init_complex_context (GstMatroskaTrackContext ** p_context)
115 GstMatroskaTrackComplexContext *complex_context;
117 g_assert (p_context != NULL && *p_context != NULL);
119 /* already set up? (track info might come before track type) */
120 if ((*p_context)->type == GST_MATROSKA_TRACK_TYPE_COMPLEX)
123 /* it better not have been set up as some other track type ... */
124 if ((*p_context)->type != 0) {
125 g_return_val_if_reached (FALSE);
128 complex_context = g_renew (GstMatroskaTrackComplexContext, *p_context, 1);
129 *p_context = (GstMatroskaTrackContext *) complex_context;
130 (*p_context)->type = GST_MATROSKA_TRACK_TYPE_COMPLEX;