diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:27 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:27 +0000 |
commit | 6cc1c73d2baa95c46edc04f57cbe9ed690dc2f21 (patch) | |
tree | 82b5546809a42a56a7bc18bacf8ed6e209ad006e /gst/avi | |
parent | d07ec45fa47fbd0e36224e11bcd8ba2faee1a78c (diff) |
don't mix tabs and spaces
Original commit message from CVS:
don't mix tabs and spaces
Diffstat (limited to 'gst/avi')
-rw-r--r-- | gst/avi/gstavi.c | 4 | ||||
-rw-r--r-- | gst/avi/gstavidecoder.c | 67 | ||||
-rw-r--r-- | gst/avi/gstavidemux.c | 545 | ||||
-rw-r--r-- | gst/avi/gstavimux.c | 225 |
4 files changed, 422 insertions, 419 deletions
diff --git a/gst/avi/gstavi.c b/gst/avi/gstavi.c index dbdc7859..4ab32d7b 100644 --- a/gst/avi/gstavi.c +++ b/gst/avi/gstavi.c @@ -40,8 +40,8 @@ plugin_init (GstPlugin * plugin) #endif /* ENABLE_NLS */ return (gst_element_register (plugin, "avidemux", - GST_RANK_PRIMARY, - GST_TYPE_AVI_DEMUX) && + GST_RANK_PRIMARY, + GST_TYPE_AVI_DEMUX) && gst_element_register (plugin, "avimux", GST_RANK_NONE, GST_TYPE_AVIMUX)); } diff --git a/gst/avi/gstavidecoder.c b/gst/avi/gstavidecoder.c index d4cb493f..dc5afd9d 100644 --- a/gst/avi/gstavidecoder.c +++ b/gst/avi/gstavidecoder.c @@ -66,7 +66,7 @@ GST_PADTEMPLATE_FACTORY (sink_templ, GST_PAD_SINK, GST_PAD_ALWAYS, GST_CAPS_NEW ("avidecoder_sink", - "video/avi", "RIFF", GST_PROPS_STRING ("AVI") + "video/avi", "RIFF", GST_PROPS_STRING ("AVI") ) ) @@ -75,12 +75,12 @@ GST_PADTEMPLATE_FACTORY (sink_templ, GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_NEW ("wincodec_src", - "video/raw", - "format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y', - '2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')), - GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) - ), "width", GST_PROPS_INT_RANGE (16, 4096), "height", - GST_PROPS_INT_RANGE (16, 4096) + "video/raw", + "format", GST_PROPS_LIST (GST_PROPS_FOURCC (GST_MAKE_FOURCC ('Y', 'U', 'Y', + '2')), GST_PROPS_FOURCC (GST_MAKE_FOURCC ('I', '4', '2', '0')), + GST_PROPS_FOURCC (GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) + ), "width", GST_PROPS_INT_RANGE (16, 4096), "height", + GST_PROPS_INT_RANGE (16, 4096) ) ) @@ -89,17 +89,17 @@ GST_PADTEMPLATE_FACTORY (sink_templ, GST_PAD_SRC, GST_PAD_ALWAYS, GST_CAPS_NEW ("src_audio", - "audio/raw", - "format", GST_PROPS_STRING ("int"), - "law", GST_PROPS_INT (0), - "endianness", GST_PROPS_INT (G_BYTE_ORDER), - "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE), - GST_PROPS_BOOLEAN (FALSE) - ), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) - ), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) - ), - "rate", GST_PROPS_INT_RANGE (11025, 48000), - "channels", GST_PROPS_INT_RANGE (1, 2) + "audio/raw", + "format", GST_PROPS_STRING ("int"), + "law", GST_PROPS_INT (0), + "endianness", GST_PROPS_INT (G_BYTE_ORDER), + "signed", GST_PROPS_LIST (GST_PROPS_BOOLEAN (TRUE), + GST_PROPS_BOOLEAN (FALSE) + ), "width", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) + ), "depth", GST_PROPS_LIST (GST_PROPS_INT (8), GST_PROPS_INT (16) + ), + "rate", GST_PROPS_INT_RANGE (11025, 48000), + "channels", GST_PROPS_INT_RANGE (1, 2) ) ) @@ -132,9 +132,10 @@ gst_avi_decoder_get_type (void) 0, (GInstanceInitFunc) gst_avi_decoder_init, }; + avi_decoder_type = - g_type_register_static (GST_TYPE_BIN, "GstAviDecoder", - &avi_decoder_info, 0); + g_type_register_static (GST_TYPE_BIN, "GstAviDecoder", + &avi_decoder_info, 0); } return avi_decoder_type; } @@ -148,9 +149,9 @@ gst_avi_decoder_class_init (GstAviDecoderClass * klass) gobject_class = (GObjectClass *) klass; gstelement_class = (GstElementClass *) klass; - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ - g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE, g_param_spec_long ("bitrate", "bitrate", "bitrate", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MEDIA_TIME, g_param_spec_long ("media_time", "media_time", "media_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ + g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_CURRENT_TIME, g_param_spec_long ("current_time", "current_time", "current_time", G_MINLONG, G_MAXLONG, 0, G_PARAM_READABLE)); /* CHECKME */ parent_class = g_type_class_ref (GST_TYPE_BIN); @@ -182,17 +183,17 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad, if (!strcmp (format, "strf_vids")) { targetcaps = - gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); + gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); media_type = AVI_TYPE_VIDEO; gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++); } else if (!strcmp (format, "strf_auds")) { targetcaps = - gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ)); + gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_audio_templ)); media_type = AVI_TYPE_AUDIO; gpadname = g_strdup_printf ("audio_%02d", avi_decoder->audio_count++); } else if (!strcmp (format, "strf_iavs")) { targetcaps = - gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); + gst_padtemplate_get_caps (GST_PADTEMPLATE_GET (src_video_templ)); media_type = AVI_TYPE_VIDEO; gpadname = g_strdup_printf ("video_%02d", avi_decoder->video_count++); } else { @@ -219,7 +220,7 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad, if (gst_caps_is_always_compatible (caps, targetcaps)) { gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder), - gst_element_get_pad (type, "src"), gpadname); + gst_element_get_pad (type, "src"), gpadname); avi_decoder->count++; goto done; @@ -247,11 +248,11 @@ gst_avi_decoder_new_pad (GstElement * element, GstPad * pad, if (new_element) { gst_pad_connect (pad, gst_element_get_pad (new_element, "sink")); gst_element_set_name (new_element, g_strdup_printf ("element%d", - avi_decoder->count)); + avi_decoder->count)); gst_bin_add (GST_BIN (avi_decoder), new_element); gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder), - gst_element_get_pad (new_element, padname), gpadname); + gst_element_get_pad (new_element, padname), gpadname); avi_decoder->count++; } else { @@ -271,10 +272,10 @@ gst_avi_decoder_init (GstAviDecoder * avi_decoder) gst_bin_add (GST_BIN (avi_decoder), avi_decoder->demuxer); gst_element_add_ghost_pad (GST_ELEMENT (avi_decoder), - gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink"); + gst_element_get_pad (avi_decoder->demuxer, "sink"), "sink"); g_signal_connect (G_OBJECT (avi_decoder->demuxer), "new_pad", - G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder); + G_CALLBACK (gst_avi_decoder_new_pad), avi_decoder); } else { g_warning ("wow!, no avi demuxer found. help me\n"); } @@ -317,11 +318,11 @@ gst_avi_decoder_get_property (GObject * object, guint prop_id, GValue * value, break; case ARG_MEDIA_TIME: g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer), - "media_time")); + "media_time")); break; case ARG_CURRENT_TIME: g_value_set_long (value, gst_util_get_long_arg (G_OBJECT (src->demuxer), - "current_time")); + "current_time")); break; default: break; diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 03403488..1c03ef2c 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -99,8 +99,8 @@ gst_avi_demux_get_type (void) }; avi_demux_type = - g_type_register_static (GST_TYPE_RIFF_READ, - "GstAviDemux", &avi_demux_info, 0); + g_type_register_static (GST_TYPE_RIFF_READ, + "GstAviDemux", &avi_demux_info, 0); } return avi_demux_type; @@ -147,7 +147,7 @@ gst_avi_demux_class_init (GstAviDemuxClass * klass) g_object_class_install_property (gobject_class, ARG_STREAMINFO, g_param_spec_boxed ("streaminfo", "Streaminfo", "Streaminfo", - GST_TYPE_CAPS, G_PARAM_READABLE)); + GST_TYPE_CAPS, G_PARAM_READABLE)); GST_DEBUG_CATEGORY_INIT (avidemux_debug, "avidemux", 0, "Demuxer for AVI streams"); @@ -347,38 +347,38 @@ gst_avi_demux_src_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_BYTES: - *dest_value = src_value * stream->strh->rate / - (stream->strh->scale * GST_SECOND); - break; - case GST_FORMAT_DEFAULT: - *dest_value = src_value * stream->strh->rate / - (stream->strh->scale * GST_SECOND); - break; - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + *dest_value = src_value * stream->strh->rate / + (stream->strh->scale * GST_SECOND); + break; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * stream->strh->rate / + (stream->strh->scale * GST_SECOND); + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_BYTES: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = ((gfloat) src_value) * GST_SECOND / stream->strh->rate; + break; + default: + res = FALSE; + break; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = ((((gfloat) src_value) * stream->strh->scale) / - stream->strh->rate) * GST_SECOND; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *dest_value = ((((gfloat) src_value) * stream->strh->scale) / + stream->strh->rate) * GST_SECOND; + break; + default: + res = FALSE; + break; } break; default: @@ -412,54 +412,54 @@ gst_avi_demux_handle_src_query (GstPad * pad, switch (type) { case GST_QUERY_TOTAL: switch (*format) { - case GST_FORMAT_TIME: - *value = (((gfloat) stream->strh->scale) * stream->strh->length / - stream->strh->rate) * GST_SECOND; - break; - case GST_FORMAT_BYTES: - if (stream->strh->type == GST_RIFF_FCC_auds) { - *value = stream->total_bytes; - } else - res = FALSE; - break; - case GST_FORMAT_DEFAULT: - if (stream->strh->type == GST_RIFF_FCC_auds) - *value = stream->strh->length * stream->strh->samplesize; - else if (stream->strh->type == GST_RIFF_FCC_vids) - *value = stream->strh->length; - else - res = FALSE; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = (((gfloat) stream->strh->scale) * stream->strh->length / + stream->strh->rate) * GST_SECOND; + break; + case GST_FORMAT_BYTES: + if (stream->strh->type == GST_RIFF_FCC_auds) { + *value = stream->total_bytes; + } else + res = FALSE; + break; + case GST_FORMAT_DEFAULT: + if (stream->strh->type == GST_RIFF_FCC_auds) + *value = stream->strh->length * stream->strh->samplesize; + else if (stream->strh->type == GST_RIFF_FCC_vids) + *value = stream->strh->length; + else + res = FALSE; + break; + default: + res = FALSE; + break; } break; case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - if (stream->strh->samplesize && - stream->strh->type == GST_RIFF_FCC_auds) { - *value = ((gfloat) stream->current_byte) * GST_SECOND / - stream->strh->rate; - } else { - *value = (((gfloat) stream->current_frame) * stream->strh->scale / - stream->strh->rate) * GST_SECOND; - } - break; - case GST_FORMAT_BYTES: - *value = stream->current_byte; - break; - case GST_FORMAT_DEFAULT: - if (stream->strh->samplesize && - stream->strh->type == GST_RIFF_FCC_auds) - *value = stream->current_byte * stream->strh->samplesize; - else - *value = stream->current_frame; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + if (stream->strh->samplesize && + stream->strh->type == GST_RIFF_FCC_auds) { + *value = ((gfloat) stream->current_byte) * GST_SECOND / + stream->strh->rate; + } else { + *value = (((gfloat) stream->current_frame) * stream->strh->scale / + stream->strh->rate) * GST_SECOND; + } + break; + case GST_FORMAT_BYTES: + *value = stream->current_byte; + break; + case GST_FORMAT_DEFAULT: + if (stream->strh->samplesize && + stream->strh->type == GST_RIFF_FCC_auds) + *value = stream->current_byte * stream->strh->samplesize; + else + *value = stream->current_frame; + break; + default: + res = FALSE; + break; } break; default: @@ -492,7 +492,7 @@ gst_avi_demux_sync_streams (GstAviDemux * avi, guint64 time) GST_DEBUG ("finding %d for time %" G_GINT64_FORMAT, i, time); entry = gst_avi_demux_index_entry_for_time (avi, stream->num, time, - GST_RIFF_IF_KEYFRAME); + GST_RIFF_IF_KEYFRAME); if (entry) { min_index = MIN (entry->index_nr, min_index); } @@ -510,7 +510,7 @@ gst_avi_demux_sync_streams (GstAviDemux * avi, guint64 time) next_entry = gst_avi_demux_index_next (avi, stream->num, min_index, 0); /* next entry with keyframe */ entry = gst_avi_demux_index_next (avi, stream->num, min_index, - GST_RIFF_IF_KEYFRAME); + GST_RIFF_IF_KEYFRAME); stream->current_byte = next_entry->bytes_before; stream->current_frame = next_entry->frames_before; @@ -539,9 +539,9 @@ gst_avi_demux_send_event (GstElement * element, GstEvent * event) * failed on this pad */ gst_event_ref (event); if (gst_avi_demux_handle_src_event (pad, event)) { - gst_event_unref (event); + gst_event_unref (event); - return TRUE; + return TRUE; } } @@ -576,56 +576,56 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event) switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: GST_DEBUG ("seek format %d, %08x", GST_EVENT_SEEK_FORMAT (event), - stream->strh->type); + stream->strh->type); switch (GST_EVENT_SEEK_FORMAT (event)) { - case GST_FORMAT_BYTES: - case GST_FORMAT_DEFAULT: - case GST_FORMAT_TIME:{ - gst_avi_index_entry *seek_entry, *entry = NULL; - gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event); - guint32 flags; - guint64 min_index; - - /* no seek on audio yet */ - if (stream->strh->type == GST_RIFF_FCC_auds) { - res = FALSE; - goto done; - } - GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset); - - flags = GST_RIFF_IF_KEYFRAME; - switch (GST_EVENT_SEEK_FORMAT (event)) { - case GST_FORMAT_BYTES: - entry = gst_avi_demux_index_entry_for_byte (avi, stream->num, - desired_offset, flags); - break; - case GST_FORMAT_DEFAULT: - entry = gst_avi_demux_index_entry_for_frame (avi, stream->num, - desired_offset, flags); - break; - case GST_FORMAT_TIME: - entry = gst_avi_demux_index_entry_for_time (avi, stream->num, - desired_offset, flags); - break; - } - - if (entry) { - min_index = gst_avi_demux_sync_streams (avi, entry->ts); - seek_entry = &avi->index_entries[min_index]; - - avi->seek_offset = seek_entry->offset + avi->index_offset; - avi->last_seek = entry->ts; - } else { - GST_DEBUG ("no index entry found for format=%d value=%" - G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset); - res = FALSE; - } - break; - } - default: - res = FALSE; - break; + case GST_FORMAT_BYTES: + case GST_FORMAT_DEFAULT: + case GST_FORMAT_TIME:{ + gst_avi_index_entry *seek_entry, *entry = NULL; + gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event); + guint32 flags; + guint64 min_index; + + /* no seek on audio yet */ + if (stream->strh->type == GST_RIFF_FCC_auds) { + res = FALSE; + goto done; + } + GST_DEBUG ("seeking to %" G_GINT64_FORMAT, desired_offset); + + flags = GST_RIFF_IF_KEYFRAME; + switch (GST_EVENT_SEEK_FORMAT (event)) { + case GST_FORMAT_BYTES: + entry = gst_avi_demux_index_entry_for_byte (avi, stream->num, + desired_offset, flags); + break; + case GST_FORMAT_DEFAULT: + entry = gst_avi_demux_index_entry_for_frame (avi, stream->num, + desired_offset, flags); + break; + case GST_FORMAT_TIME: + entry = gst_avi_demux_index_entry_for_time (avi, stream->num, + desired_offset, flags); + break; + } + + if (entry) { + min_index = gst_avi_demux_sync_streams (avi, entry->ts); + seek_entry = &avi->index_entries[min_index]; + + avi->seek_offset = seek_entry->offset + avi->index_offset; + avi->last_seek = entry->ts; + } else { + GST_DEBUG ("no index entry found for format=%d value=%" + G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset); + res = FALSE; + } + break; + } + default: + res = FALSE; + break; } break; default: @@ -682,7 +682,7 @@ gst_avi_demux_stream_avih (GstAviDemux * avi, } if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_avih)) { g_warning ("Too small avih (%d available, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih)); + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_avih)); gst_buffer_unref (buf); return FALSE; } @@ -751,7 +751,8 @@ gst_avi_demux_add_stream (GstAviDemux * avi) gst_riff_strf_vids *vids; gst_riff_strf_auds *auds; gst_riff_strf_iavs *iavs; - } strf; + } + strf; /* the stream starts with a 'strh' header */ if (!(tag = gst_riff_peek_tag (riff, NULL))) @@ -768,25 +769,25 @@ gst_avi_demux_add_stream (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_strf) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no strf as second tag)")); + ("Invalid AVI header (no strf as second tag)")); goto skip_stream; } switch (strh->type) { case GST_RIFF_FCC_vids: if (!gst_riff_read_strf_vids (riff, &strf.vids)) - return FALSE; + return FALSE; break; case GST_RIFF_FCC_auds: if (!gst_riff_read_strf_auds (riff, &strf.auds)) - return FALSE; + return FALSE; break; case GST_RIFF_FCC_iavs: if (!gst_riff_read_strf_iavs (riff, &strf.iavs)) - return FALSE; + return FALSE; break; default: g_warning ("Unknown stream type " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (strh->type)); + GST_FOURCC_ARGS (strh->type)); goto skip_stream; } @@ -801,22 +802,22 @@ gst_avi_demux_add_stream (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_strn: - if (name) - g_free (name); - if (!gst_riff_read_ascii (riff, &tag, &name)) - return FALSE; - break; + if (name) + g_free (name); + if (!gst_riff_read_ascii (riff, &tag, &name)) + return FALSE; + break; default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ - case GST_RIFF_TAG_strd: /* what is this? */ + case GST_RIFF_TAG_strd: /* what is this? */ case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } if (avi->level_up) { @@ -835,13 +836,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi) padname = g_strdup_printf ("video_%02d", avi->num_v_streams); templ = gst_element_class_get_pad_template (klass, "video_%02d"); caps = gst_riff_create_video_caps (strf.vids->compression, strh, - strf.vids, &codec_name); + strf.vids, &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC, - codec_name, NULL); + codec_name, NULL); gst_element_found_tags (GST_ELEMENT (avi), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); g_free (strf.vids); avi->num_v_streams++; break; @@ -854,13 +855,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi) padname = g_strdup_printf ("audio_%02d", avi->num_a_streams); templ = gst_element_class_get_pad_template (klass, "audio_%02d"); caps = gst_riff_create_audio_caps (strf.auds->format, strh, strf.auds, - &codec_name); + &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_AUDIO_CODEC, - codec_name, NULL); + codec_name, NULL); gst_element_found_tags (GST_ELEMENT (avi), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); g_free (strf.auds); avi->num_a_streams++; break; @@ -873,13 +874,13 @@ gst_avi_demux_add_stream (GstAviDemux * avi) padname = g_strdup_printf ("video_%02d", avi->num_v_streams); templ = gst_element_class_get_pad_template (klass, "video_%02d"); caps = gst_riff_create_iavs_caps (strh->fcc_handler, strh, strf.iavs, - &codec_name); + &codec_name); gst_tag_list_add (list, GST_TAG_MERGE_APPEND, GST_TAG_VIDEO_CODEC, - codec_name, NULL); + codec_name, NULL); gst_element_found_tags (GST_ELEMENT (avi), list); gst_tag_list_free (list); if (codec_name) - g_free (codec_name); + g_free (codec_name); g_free (strf.iavs); avi->num_v_streams++; break; @@ -935,7 +936,7 @@ skip_stream: /* add a "NULL" stream */ avi->num_streams++; - return TRUE; /* recoverable */ + return TRUE; /* recoverable */ } /* @@ -959,37 +960,37 @@ gst_avi_demux_stream_odml (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_dmlh:{ - gst_riff_dmlh dmlh, *_dmlh; - GstBuffer *buf; - - if (!gst_riff_read_data (riff, &tag, &buf)) - return FALSE; - if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) { - g_warning ("DMLH entry is too small (%d bytes, %d needed)", - GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh)); - gst_buffer_unref (buf); - break; - } - _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf); - dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes); - - GST_INFO ("dmlh tag found:"); - GST_INFO (" totalframes: %u", dmlh.totalframes); - - avi->num_frames = dmlh.totalframes; - gst_buffer_unref (buf); - break; + gst_riff_dmlh dmlh, *_dmlh; + GstBuffer *buf; + + if (!gst_riff_read_data (riff, &tag, &buf)) + return FALSE; + if (GST_BUFFER_SIZE (buf) < sizeof (gst_riff_dmlh)) { + g_warning ("DMLH entry is too small (%d bytes, %d needed)", + GST_BUFFER_SIZE (buf), (int) sizeof (gst_riff_dmlh)); + gst_buffer_unref (buf); + break; + } + _dmlh = (gst_riff_dmlh *) GST_BUFFER_DATA (buf); + dmlh.totalframes = GUINT32_FROM_LE (_dmlh->totalframes); + + GST_INFO ("dmlh tag found:"); + GST_INFO (" totalframes: %u", dmlh.totalframes); + + avi->num_frames = dmlh.totalframes; + gst_buffer_unref (buf); + break; } default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } if (avi->level_up) { @@ -1036,7 +1037,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_idx1) { g_warning ("No index after data, but " GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (tag)); + GST_FOURCC_ARGS (tag)); goto end; } @@ -1081,9 +1082,9 @@ gst_avi_demux_stream_index (GstAviDemux * avi) /* figure out if the index is 0 based or relative to the MOVI start */ if (i == 0) { if (target->offset < pos_before) - avi->index_offset = pos_before + 8; + avi->index_offset = pos_before + 8; else - avi->index_offset = 0; + avi->index_offset = 0; } target->bytes_before = stream->total_bytes; @@ -1098,11 +1099,11 @@ gst_avi_demux_stream_index (GstAviDemux * avi) if (stream->strh->samplesize && stream->strh->type == GST_RIFF_FCC_auds) { /* constant rate stream */ gst_pad_convert (stream->pad, GST_FORMAT_BYTES, - stream->total_bytes, &format, &target->ts); + stream->total_bytes, &format, &target->ts); } else { /* VBR stream */ gst_pad_convert (stream->pad, GST_FORMAT_DEFAULT, - stream->total_frames, &format, &target->ts); + stream->total_frames, &format, &target->ts); } stream->total_bytes += target->size; @@ -1115,7 +1116,7 @@ gst_avi_demux_stream_index (GstAviDemux * avi) stream = &avi->stream[i]; GST_DEBUG ("stream %u: %u frames, %" G_GINT64_FORMAT " bytes", - i, stream->total_frames, stream->total_bytes); + i, stream->total_frames, stream->total_bytes); } end: @@ -1159,16 +1160,16 @@ gst_avi_demux_stream_header (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_LIST) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no LIST at start): " - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + ("Invalid AVI header (no LIST at start): " + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return FALSE; } if (!gst_riff_read_list (riff, &tag)) return FALSE; if (tag != GST_RIFF_LIST_hdrl) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no hdrl at start): " - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + ("Invalid AVI header (no hdrl at start): " + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return FALSE; } @@ -1177,8 +1178,8 @@ gst_avi_demux_stream_header (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_avih) { GST_ELEMENT_ERROR (avi, STREAM, DEMUX, (NULL), - ("Invalid AVI header (no avih at start): " - GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); + ("Invalid AVI header (no avih at start): " + GST_FOURCC_FORMAT, GST_FOURCC_ARGS (tag))); return FALSE; } if (!gst_avi_demux_stream_avih (avi, &flags, &streams)) @@ -1195,44 +1196,44 @@ gst_avi_demux_stream_header (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_LIST: - if (!(tag = gst_riff_peek_list (riff))) - return FALSE; - - switch (tag) { - case GST_RIFF_LIST_strl: - if (!gst_riff_read_list (riff, &tag) || - !gst_avi_demux_add_stream (avi)) - return FALSE; - break; - - case GST_RIFF_LIST_odml: - if (!gst_riff_read_list (riff, &tag) || - !gst_avi_demux_stream_odml (avi)) - return FALSE; - break; - - default: - GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ - - case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; - } - - break; + if (!(tag = gst_riff_peek_list (riff))) + return FALSE; + + switch (tag) { + case GST_RIFF_LIST_strl: + if (!gst_riff_read_list (riff, &tag) || + !gst_avi_demux_add_stream (avi)) + return FALSE; + break; + + case GST_RIFF_LIST_odml: + if (!gst_riff_read_list (riff, &tag) || + !gst_avi_demux_stream_odml (avi)) + return FALSE; + break; + + default: + GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ + + case GST_RIFF_TAG_JUNK: + if (!gst_riff_read_skip (riff)) + return FALSE; + break; + } + + break; default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " in AVI header", + GST_FOURCC_ARGS (tag)); + /* fall-through */ case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } if (avi->level_up) { @@ -1243,7 +1244,7 @@ gst_avi_demux_stream_header (GstAviDemux * avi) if (avi->num_streams != streams) { g_warning ("Stream header mentioned %d streams, but %d available", - streams, avi->num_streams); + streams, avi->num_streams); } /* we've got streaminfo now */ @@ -1255,17 +1256,17 @@ gst_avi_demux_stream_header (GstAviDemux * avi) return FALSE; if (tag != GST_RIFF_TAG_LIST) { if (!gst_riff_read_skip (riff)) - return FALSE; + return FALSE; continue; } if (!(tag = gst_riff_peek_list (riff))) return FALSE; if (tag != GST_RIFF_LIST_movi) { if (tag == GST_RIFF_LIST_INFO) { - if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff)) - return FALSE; + if (!gst_riff_read_list (riff, &tag) || !gst_riff_read_info (riff)) + return FALSE; } else if (!gst_riff_read_skip (riff)) { - return FALSE; + return FALSE; } continue; } @@ -1307,7 +1308,7 @@ gst_avi_demux_handle_seek (GstAviDemux * avi) if (GST_PAD_IS_USABLE (stream->pad)) { event = gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME, - avi->last_seek + stream->delay, NULL); + avi->last_seek + stream->delay, NULL); gst_pad_push (stream->pad, GST_DATA (event)); } } @@ -1347,40 +1348,40 @@ gst_avi_demux_stream_data (GstAviDemux * avi) switch (tag) { case GST_RIFF_TAG_LIST: - if (!(tag = gst_riff_peek_list (riff))) - return FALSE; - - switch (tag) { - case GST_RIFF_LIST_AVIX: - case GST_RIFF_LIST_movi: - if (!gst_riff_read_list (riff, &tag)) - return FALSE; - /* we're now going to read buffers! */ - break; - - default: - GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data", - GST_FOURCC_ARGS (tag)); - /* fall-through */ - - case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; - } - - break; + if (!(tag = gst_riff_peek_list (riff))) + return FALSE; + + switch (tag) { + case GST_RIFF_LIST_AVIX: + case GST_RIFF_LIST_movi: + if (!gst_riff_read_list (riff, &tag)) + return FALSE; + /* we're now going to read buffers! */ + break; + + default: + GST_WARNING ("Unknown list " GST_FOURCC_FORMAT " before AVI data", + GST_FOURCC_ARGS (tag)); + /* fall-through */ + + case GST_RIFF_TAG_JUNK: + if (!gst_riff_read_skip (riff)) + return FALSE; + break; + } + + break; default: - GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data", - GST_FOURCC_ARGS (tag)); - /* fall-through */ + GST_WARNING ("Unknown tag " GST_FOURCC_FORMAT " before AVI data", + GST_FOURCC_ARGS (tag)); + /* fall-through */ case GST_RIFF_TAG_idx1: case GST_RIFF_TAG_JUNK: - if (!gst_riff_read_skip (riff)) - return FALSE; - break; + if (!gst_riff_read_skip (riff)) + return FALSE; + break; } } @@ -1391,7 +1392,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi) if (stream_nr < 0 || stream_nr >= avi->num_streams) { /* recoverable */ g_warning ("Invalid stream ID %d (" GST_FOURCC_FORMAT ")", - stream_nr, GST_FOURCC_ARGS (tag)); + stream_nr, GST_FOURCC_ARGS (tag)); if (!gst_riff_read_skip (riff)) return FALSE; } else { @@ -1407,11 +1408,11 @@ gst_avi_demux_stream_data (GstAviDemux * avi) /* get time of this buffer */ stream = &avi->stream[stream_nr]; entry = gst_avi_demux_index_next (avi, stream_nr, - stream->current_entry + 1, 0); + stream->current_entry + 1, 0); if (entry) { stream->current_entry = entry->index_nr; if (entry->flags & GST_RIFF_IF_KEYFRAME) { - GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT); + GST_BUFFER_FLAG_SET (buf, GST_BUFFER_KEY_UNIT); } } format = GST_FORMAT_TIME; @@ -1419,7 +1420,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi) /* set delay (if any) */ if (stream->strh->init_frames == stream->current_frame && - stream->delay == 0) + stream->delay == 0) stream->delay = next_ts; stream->current_frame++; @@ -1431,15 +1432,15 @@ gst_avi_demux_stream_data (GstAviDemux * avi) gst_buffer_unref (buf); } else { if (!stream->pad || !GST_PAD_IS_USABLE (stream->pad)) { - gst_buffer_unref (buf); + gst_buffer_unref (buf); } else { - GstClockTime dur_ts; + GstClockTime dur_ts; - GST_BUFFER_TIMESTAMP (buf) = next_ts; - gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts); - GST_BUFFER_DURATION (buf) = dur_ts - next_ts; + GST_BUFFER_TIMESTAMP (buf) = next_ts; + gst_pad_query (stream->pad, GST_QUERY_POSITION, &format, &dur_ts); + GST_BUFFER_DURATION (buf) = dur_ts - next_ts; - gst_pad_push (stream->pad, GST_DATA (buf)); + gst_pad_push (stream->pad, GST_DATA (buf)); } } } @@ -1455,19 +1456,19 @@ gst_avi_demux_loop (GstElement * element) switch (avi->state) { case GST_AVI_DEMUX_START: if (!gst_avi_demux_stream_init (avi)) - return; + return; avi->state = GST_AVI_DEMUX_HEADER; /* fall-through */ case GST_AVI_DEMUX_HEADER: if (!gst_avi_demux_stream_header (avi)) - return; + return; avi->state = GST_AVI_DEMUX_MOVI; /* fall-through */ case GST_AVI_DEMUX_MOVI: if (!gst_avi_demux_stream_data (avi)) - return; + return; break; default: diff --git a/gst/avi/gstavimux.c b/gst/avi/gstavimux.c index f5287db0..d613d0cc 100644 --- a/gst/avi/gstavimux.c +++ b/gst/avi/gstavimux.c @@ -68,40 +68,40 @@ static GstStaticPadTemplate video_sink_factory = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("video/x-raw-yuv, " - "format = (fourcc) { YUY2, I420 }, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-jpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-divx, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "divxversion = (int) [ 3, 5 ]; " - "video/x-xvid, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-3ivx, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-msmpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "msmpegversion = (int) [ 41, 43 ]; " - "video/mpeg, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ], " - "mpegversion = (int) 1, " - "systemstream = (boolean) FALSE; " - "video/x-h263, " - "width = (int) [ 16, 4096 ], " - "height = (int) [ 16, 4096 ]; " - "video/x-dv, " - "width = (int) 720, " - "height = (int) { 576, 480 }, " - "systemstream = (boolean) FALSE; " - "video/x-huffyuv, " - "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]") + "format = (fourcc) { YUY2, I420 }, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-jpeg, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-divx, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "divxversion = (int) [ 3, 5 ]; " + "video/x-xvid, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-3ivx, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-msmpeg, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "msmpegversion = (int) [ 41, 43 ]; " + "video/mpeg, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " + "mpegversion = (int) 1, " + "systemstream = (boolean) FALSE; " + "video/x-h263, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ]; " + "video/x-dv, " + "width = (int) 720, " + "height = (int) { 576, 480 }, " + "systemstream = (boolean) FALSE; " + "video/x-huffyuv, " + "width = (int) [ 16, 4096 ], " "height = (int) [ 16, 4096 ]") ); static GstStaticPadTemplate audio_sink_factory = @@ -109,22 +109,22 @@ static GstStaticPadTemplate audio_sink_factory = GST_PAD_SINK, GST_PAD_REQUEST, GST_STATIC_CAPS ("audio/x-raw-int, " - "endianness = (int) LITTLE_ENDIAN, " - "signed = (boolean) { TRUE, FALSE }, " - "width = (int) { 8, 16 }, " - "depth = (int) { 8, 16 }, " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/mpeg, " - "mpegversion = (int) 1, " - "layer = (int) [ 1, 3 ], " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-vorbis, " - "rate = (int) [ 1000, 96000 ], " - "channels = (int) [ 1, 2 ]; " - "audio/x-ac3, " - "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]") + "endianness = (int) LITTLE_ENDIAN, " + "signed = (boolean) { TRUE, FALSE }, " + "width = (int) { 8, 16 }, " + "depth = (int) { 8, 16 }, " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/mpeg, " + "mpegversion = (int) 1, " + "layer = (int) [ 1, 3 ], " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-vorbis, " + "rate = (int) [ 1000, 96000 ], " + "channels = (int) [ 1, 2 ]; " + "audio/x-ac3, " + "rate = (int) [ 1000, 96000 ], " "channels = (int) [ 1, 2 ]") ); @@ -163,8 +163,9 @@ gst_avimux_get_type (void) 0, (GInstanceInitFunc) gst_avimux_init, }; + avimux_type = - g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, "GstAviMux", &avimux_info, 0); } return avimux_type; } @@ -202,7 +203,7 @@ gst_avimux_class_init (GstAviMuxClass * klass) g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BIGFILE, g_param_spec_boolean ("bigfile", "Bigfile Support", - "Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE)); + "Support for openDML-2.0 (big) AVI files", 0, G_PARAM_READWRITE)); gstelement_class->request_new_pad = gst_avimux_request_new_pad; @@ -230,7 +231,7 @@ gst_avimux_init (GstAviMux * avimux) avimux->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, - "src"), "src"); + "src"), "src"); gst_element_add_pad (GST_ELEMENT (avimux), avimux->srcpad); GST_FLAG_SET (GST_ELEMENT (avimux), GST_ELEMENT_EVENT_AWARE); @@ -303,11 +304,11 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps) avimux->vids.compression = format; switch (format) { case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - avimux->vids.bit_cnt = 16; - break; + avimux->vids.bit_cnt = 16; + break; case GST_MAKE_FOURCC ('I', '4', '2', '0'): - avimux->vids.bit_cnt = 12; - break; + avimux->vids.bit_cnt = 12; + break; } } else { avimux->vids.bit_cnt = 24; @@ -323,15 +324,15 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps) gst_structure_get_int (structure, "divxversion", &divxversion); switch (divxversion) { - case 3: - avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3'); - break; - case 4: - avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X'); - break; - case 5: - avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0'); - break; + case 3: + avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', '3'); + break; + case 4: + avimux->vids.compression = GST_MAKE_FOURCC ('D', 'I', 'V', 'X'); + break; + case 5: + avimux->vids.compression = GST_MAKE_FOURCC ('D', 'X', '5', '0'); + break; } } else if (!strcmp (mimetype, "video/x-xvid")) { avimux->vids.compression = GST_MAKE_FOURCC ('X', 'V', 'I', 'D'); @@ -342,15 +343,15 @@ gst_avimux_vidsinkconnect (GstPad * pad, const GstCaps * vscaps) gst_structure_get_int (structure, "msmpegversion", &msmpegversion); switch (msmpegversion) { - case 41: - avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4'); - break; - case 42: - avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2'); - break; - case 43: - avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3'); - break; + case 41: + avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', 'G', '4'); + break; + case 42: + avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '2'); + break; + case 43: + avimux->vids.compression = GST_MAKE_FOURCC ('M', 'P', '4', '3'); + break; } } else if (!strcmp (mimetype, "video/x-dv")) { avimux->vids.compression = GST_MAKE_FOURCC ('D', 'V', 'S', 'D'); @@ -417,13 +418,13 @@ gst_avimux_audsinkconnect (GstPad * pad, const GstCaps * vscaps) gst_structure_get_int (structure, "layer", &layer); switch (layer) { - case 3: - avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3; - break; - case 1: - case 2: - avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12; - break; + case 3: + avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL3; + break; + case 1: + case 2: + avimux->auds.format = GST_RIFF_WAVE_FORMAT_MPEGL12; + break; } } else if (!strcmp (mimetype, "audio/x-vorbis")) { avimux->auds.format = GST_RIFF_WAVE_FORMAT_VORBIS3; @@ -544,17 +545,17 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux) /* first, let's see what actually needs to be in the buffer */ GST_BUFFER_SIZE (buffer) = 0; - GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */ - if (avimux->video_pad_connected) { /* we have video */ - GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */ - GST_BUFFER_SIZE (buffer) += 24; /* odml header */ + GST_BUFFER_SIZE (buffer) += 32 + sizeof (gst_riff_avih); /* avi header */ + if (avimux->video_pad_connected) { /* we have video */ + GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids); /* vid hdr */ + GST_BUFFER_SIZE (buffer) += 24; /* odml header */ } - if (avimux->audio_pad_connected) { /* we have audio */ - GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */ + if (avimux->audio_pad_connected) { /* we have audio */ + GST_BUFFER_SIZE (buffer) += 28 + sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds); /* aud hdr */ } /* this is the "riff size" */ avimux->header_size = GST_BUFFER_SIZE (buffer); - GST_BUFFER_SIZE (buffer) += 12; /* avi data header */ + GST_BUFFER_SIZE (buffer) += 12; /* avi data header */ /* allocate the buffer */ buffdata = GST_BUFFER_DATA (buffer) = g_malloc (GST_BUFFER_SIZE (buffer)); @@ -630,8 +631,8 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux) memcpy (buffdata, "LIST", 4); buffdata += 4; temp32 = - LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) + - 4 * 5); + LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_vids) + + 4 * 5); memcpy (buffdata, &temp32, 4); buffdata += 4; memcpy (buffdata, "strl", 4); @@ -726,8 +727,8 @@ gst_avimux_riff_get_avi_header (GstAviMux * avimux) memcpy (buffdata, "LIST", 4); buffdata += 4; temp32 = - LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) + - 4 * 5); + LE_FROM_GUINT32 (sizeof (gst_riff_strh) + sizeof (gst_riff_strf_auds) + + 4 * 5); memcpy (buffdata, &temp32, 4); buffdata += 4; memcpy (buffdata, "strl", 4); @@ -901,8 +902,8 @@ gst_avimux_add_index (GstAviMux * avimux, guchar * code, guint32 flags, if (avimux->idx_index == avimux->idx_count) { avimux->idx_count += 256; avimux->idx = - realloc (avimux->idx, - avimux->idx_count * sizeof (gst_riff_index_entry)); + realloc (avimux->idx, + avimux->idx_count * sizeof (gst_riff_index_entry)); } memcpy (&(avimux->idx[avimux->idx_index].id), code, 4); avimux->idx[avimux->idx_index].flags = LE_FROM_GUINT32 (flags); @@ -928,7 +929,7 @@ gst_avimux_write_index (GstAviMux * avimux) buffer = gst_buffer_new (); GST_BUFFER_SIZE (buffer) = avimux->idx_index * sizeof (gst_riff_index_entry); GST_BUFFER_DATA (buffer) = (unsigned char *) avimux->idx; - avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */ + avimux->idx = NULL; /* will be free()'ed by gst_buffer_unref() */ avimux->total_data += GST_BUFFER_SIZE (buffer); gst_pad_push (avimux->srcpad, GST_DATA (buffer)); @@ -947,7 +948,7 @@ gst_avimux_bigfile (GstAviMux * avimux, gboolean last) if (avimux->is_bigfile) { /* sarch back */ event = gst_event_new_seek (GST_FORMAT_BYTES | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->avix_start); /* if the event succeeds */ gst_pad_push (avimux->srcpad, GST_DATA (event)); @@ -957,7 +958,7 @@ gst_avimux_bigfile (GstAviMux * avimux, gboolean last) /* go back to current location */ event = gst_event_new_seek (GST_FORMAT_BYTES | - GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data); + GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, avimux->total_data); gst_pad_push (avimux->srcpad, GST_DATA (event)); } avimux->avix_start = avimux->total_data; @@ -983,7 +984,7 @@ gst_avimux_start_file (GstAviMux * avimux) avimux->total_data = 0; avimux->total_frames = 0; - avimux->data_size = 4; /* ? */ + avimux->data_size = 4; /* ? */ avimux->datax_size = 0; avimux->num_frames = 0; avimux->numx_frames = 0; @@ -992,7 +993,7 @@ gst_avimux_start_file (GstAviMux * avimux) avimux->avix_start = 0; avimux->idx_index = 0; - avimux->idx_offset = 0; /* see 10 lines below */ + avimux->idx_offset = 0; /* see 10 lines below */ avimux->idx_size = 0; avimux->idx_count = 0; avimux->idx = NULL; @@ -1035,7 +1036,7 @@ gst_avimux_stop_file (GstAviMux * avimux) } if (avimux->audio_pad_connected) { avimux->auds_hdr.length = - (avimux->audio_time * avimux->auds.rate) / GST_SECOND; + (avimux->audio_time * avimux->auds.rate) / GST_SECOND; } /* set rate and everything having to do with that */ @@ -1044,13 +1045,13 @@ gst_avimux_stop_file (GstAviMux * avimux) /* calculate bps if needed */ if (!avimux->auds.av_bps) { if (avimux->audio_time) { - avimux->auds_hdr.rate = - (GST_SECOND * avimux->audio_size) / avimux->audio_time; + avimux->auds_hdr.rate = + (GST_SECOND * avimux->audio_size) / avimux->audio_time; } else { - GST_ELEMENT_ERROR (avimux, STREAM, MUX, - (_("No or invalid input audio, AVI stream will be corrupt.")), - (NULL)); - avimux->auds_hdr.rate = 0; + GST_ELEMENT_ERROR (avimux, STREAM, MUX, + (_("No or invalid input audio, AVI stream will be corrupt.")), + (NULL)); + avimux->auds_hdr.rate = 0; } avimux->auds.av_bps = avimux->auds_hdr.rate * avimux->auds_hdr.scale; } @@ -1058,7 +1059,7 @@ gst_avimux_stop_file (GstAviMux * avimux) } if (avimux->video_pad_connected) { avimux->avi_hdr.max_bps += ((avimux->vids.bit_cnt + 7) / 8) * - (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size; + (1000000. / avimux->avi_hdr.us_frame) * avimux->vids.image_size; } /* seek and rewrite the header */ @@ -1101,11 +1102,11 @@ gst_avimux_handle_event (GstPad * pad, GstEvent * event) case GST_EVENT_EOS: /* is this allright? */ if (pad == avimux->videosinkpad) { - avimux->video_pad_eos = TRUE; + avimux->video_pad_eos = TRUE; } else if (pad == avimux->audiosinkpad) { - avimux->audio_pad_eos = TRUE; + avimux->audio_pad_eos = TRUE; } else { - g_warning ("Unknown pad for EOS!"); + g_warning ("Unknown pad for EOS!"); } break; default: @@ -1256,7 +1257,7 @@ gst_avimux_do_one_buffer (GstAviMux * avimux) { if (avimux->video_buffer_queue && avimux->audio_buffer_queue) { if (GST_BUFFER_TIMESTAMP (avimux->video_buffer_queue) <= - GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue)) + GST_BUFFER_TIMESTAMP (avimux->audio_buffer_queue)) gst_avimux_do_video_buffer (avimux); else gst_avimux_do_audio_buffer (avimux); |