From d52d22ca12c6008a6b32e9ca4e3461eb3282cc87 Mon Sep 17 00:00:00 2001 From: Michal Benes Date: Tue, 1 Nov 2005 14:36:02 +0000 Subject: [PATCH] add a unit test for matroskamux fix the bugs that the unit test exposed Original commit message from CVS: Patch by: Michal Benes * check/Makefile.am: * gst/matroska/ebml-write.c: (gst_ebml_write_seek): * gst/matroska/matroska-mux.c: (gst_matroska_mux_handle_src_event), (gst_matroska_mux_audio_pad_setcaps), (gst_matroska_mux_start): add a unit test for matroskamux fix the bugs that the unit test exposed --- ChangeLog | 11 +++++++++++ check/Makefile.am | 4 +++- gst/matroska/ebml-write.c | 3 +-- gst/matroska/matroska-mux.c | 12 ++++-------- tests/check/Makefile.am | 4 +++- 5 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1ae81a..b42970d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-11-01 Thomas Vander Stichele + + Patch by: Michal Benes + + * check/Makefile.am: + * gst/matroska/ebml-write.c: (gst_ebml_write_seek): + * gst/matroska/matroska-mux.c: (gst_matroska_mux_handle_src_event), + (gst_matroska_mux_audio_pad_setcaps), (gst_matroska_mux_start): + add a unit test for matroskamux + fix the bugs that the unit test exposed + 2005-11-01 Tim-Philipp Müller * gst/autodetect/gstautoaudiosink.c: diff --git a/check/Makefile.am b/check/Makefile.am index 7962f68..256c19a 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -18,7 +18,9 @@ clean-local: clean-local-check TESTS = $(check_PROGRAMS) check_PROGRAMS = \ - elements/level + elements/level \ + elements/matroskamux + # these tests don't even pass noinst_PROGRAMS = diff --git a/gst/matroska/ebml-write.c b/gst/matroska/ebml-write.c index 46c8384..2017740 100644 --- a/gst/matroska/ebml-write.c +++ b/gst/matroska/ebml-write.c @@ -384,8 +384,7 @@ gst_ebml_write_seek (GstEbmlWrite * ebml, guint64 pos) } } - seek = gst_event_new_newsegment (FALSE, 1.0, GST_FORMAT_BYTES, - pos, -1, GST_CLOCK_TIME_NONE); + seek = gst_event_new_newsegment (FALSE, 1.0, GST_FORMAT_BYTES, pos, -1, 0); peer_pad = GST_PAD_PEER (ebml->srcpad); if (peer_pad) { gst_pad_send_event (peer_pad, seek); diff --git a/gst/matroska/matroska-mux.c b/gst/matroska/matroska-mux.c index ca8ab86..d922cbd 100644 --- a/gst/matroska/matroska-mux.c +++ b/gst/matroska/matroska-mux.c @@ -389,11 +389,8 @@ gst_matroska_mux_reset (GstElement * element) static gboolean gst_matroska_mux_handle_src_event (GstPad * pad, GstEvent * event) { - GstMatroskaMux *mux; GstEventType type; - mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad)); - type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN; switch (type) { @@ -607,7 +604,6 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps) GstMatroskaTrackContext *context = NULL; GstMatroskaTrackAudioContext *audiocontext; GstMatroskaPad *collect_pad; - GstMatroskaMux *mux = GST_MATROSKA_MUX (gst_pad_get_parent (pad)); const gchar *mimetype; gint samplerate = 0, channels = 0; GstStructure *structure; @@ -763,15 +759,14 @@ gst_matroska_mux_audio_pad_setcaps (GstPad * pad, GstCaps * caps) audiocontext->samplerate = GST_READ_UINT32_LE (hdr + 1); } } else { - GST_WARNING_OBJECT (mux, "Vorbis header does not contain " + GST_WARNING ("Vorbis header does not contain " "three buffers (found %d buffers), Ignoring.", bufarr->len); } } } if (priv_data == NULL) { - GST_WARNING_OBJECT (mux, - "Could not write Vorbis header into codec private data. " + GST_WARNING ("Could not write Vorbis header into codec private data. " "You will probably not be able to play the stream."); } @@ -1085,7 +1080,8 @@ gst_matroska_mux_start (GstMatroskaMux * mux) collect_pad = (GstMatroskaPad *) collected->data; thepad = collect_pad->collect.pad; - if (GST_PAD_IS_USABLE (thepad)) { + if (GST_PAD_IS_USABLE (thepad) + && collect_pad->track->codec_id != 0) { collect_pad->track->num = tracknum++; child = gst_ebml_write_master_start (ebml, GST_MATROSKA_ID_TRACKENTRY); gst_matroska_mux_track_header (mux, collect_pad->track); diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 7962f68..256c19a 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -18,7 +18,9 @@ clean-local: clean-local-check TESTS = $(check_PROGRAMS) check_PROGRAMS = \ - elements/level + elements/level \ + elements/matroskamux + # these tests don't even pass noinst_PROGRAMS = -- 2.7.4