GNOME Bugzilla – Bug 379298
[avimux] allow multiple audio streams
Last modified: 2007-01-14 17:56:58 UTC
Some enhancements and fixes to avimux: * a bit of code restructuring/clean-up * in particular, allow for more (than 2) streams: restricted to 1 video; multiple audio (e.g. for DVD transcoding, if so desired) * small fix in AVIX header * don't boast vorbis in caps (since setcaps won't accept them anyway --e.g. no samplerate or channels-- and vorbis in AVI is a bit ??, at least for other players ...)
Created attachment 77144 [details] [review] Patch with modifications Patch implementing changes given above. Note that: * unit test (check) has also slightly changed, because ... * reaction to (un)linking --e.g. excluding from collectpads-- has been removed; this is more aligned with other muxers and according to discussion in bug #374682
Created attachment 80148 [details] [review] Revised patch with modifications In case of releasing a request(ed) pad before streaming actually starts, the original patch produces incorrect stream tags in the resulting AVI file. This patch fixes this, all else is the same.
Was going to commit this, but 'make elements/avimux.valgrind' shows the following leak: Running suite(s): avimux==9571== ==9571== 646 (8 direct, 638 indirect) bytes in 1 blocks are definitely lost in loss record 1,861 of 1,911 ==9571== at 0x4022396: malloc (vg_replace_malloc.c:149) ==9571== by 0x426ECE5: g_malloc (gmem.c:131) ==9571== by 0x427E747: g_slice_alloc (gslice.c:777) ==9571== by 0x427F89A: g_slist_append (gslist.c:69) ==9571== by 0x465BC3E: gst_avi_mux_reset (gstavimux.c:341) ==9571== by 0x465DA4D: gst_avi_mux_change_state (gstavimux.c:1716) ==9571== by 0x405BA99: gst_element_change_state (gstelement.c:2275) ==9571== by 0x405BB81: gst_element_change_state (gstelement.c:2308) ==9571== by 0x405E922: gst_element_set_state_func (gstelement.c:2236) ==9571== by 0x405AC82: gst_element_set_state (gstelement.c:2144) ==9571== by 0x80492F6: cleanup_avimux (avimux.c:135) ==9571== by 0x8049D41: check_avimux_pad (avimux.c:223) ==9571== by 0x8049E6E: test_video_pad (avimux.c:231) ==9571== by 0x402C35D: srunner_run_all (in /home/tpm/uninstalled/head/gstreamer/libs/gst/check/.libs/libgstcheck-0.10.so.0.10.0) ==9571== by 0x8049128: main (avimux.c:268) ==9572== ==9572== 630 (8 direct, 622 indirect) bytes in 1 blocks are definitely lost in loss record 1,861 of 1,912 ==9572== at 0x4022396: malloc (vg_replace_malloc.c:149) ==9572== by 0x426ECE5: g_malloc (gmem.c:131) ==9572== by 0x427E747: g_slice_alloc (gslice.c:777) ==9572== by 0x427F89A: g_slist_append (gslist.c:69) ==9572== by 0x465BC3E: gst_avi_mux_reset (gstavimux.c:341) ==9572== by 0x465DA4D: gst_avi_mux_change_state (gstavimux.c:1716) ==9572== by 0x405BA99: gst_element_change_state (gstelement.c:2275) ==9572== by 0x405BB81: gst_element_change_state (gstelement.c:2308) ==9572== by 0x405E922: gst_element_set_state_func (gstelement.c:2236) ==9572== by 0x405AC82: gst_element_set_state (gstelement.c:2144) ==9572== by 0x80492F6: cleanup_avimux (avimux.c:135) ==9572== by 0x8049D41: check_avimux_pad (avimux.c:223) ==9572== by 0x8049DCE: test_audio_pad (avimux.c:239) ==9572== by 0x402C35D: srunner_run_all (in /home/tpm/uninstalled/head/gstreamer/libs/gst/check/.libs/libgstcheck-0.10.so.0.10.0) ==9572== by 0x8049128: main (avimux.c:268) That should probably be fixed before committing (follow-up patch is fine for me).
Created attachment 80209 [details] [review] Patch to fix memory leak Fix mem leak in finalization (silly mistake; including mis-remembering having run this check for another element :-( )
Thanks! Committed: 2007-01-14 Tim-Philipp Müller <tim at centricular dot net> Patch by: Mark Nauwelaerts <manauw at skynet be> * gst/avi/gstavimux.c: (gst_avi_mux_finalize), (gst_avi_mux_pad_reset), (gst_avi_mux_reset), (gst_avi_mux_init), (gst_avi_mux_vidsink_set_caps), (gst_avi_mux_audsink_set_caps), (gst_avi_mux_request_new_pad), (gst_avi_mux_release_pad), (gst_avi_mux_riff_get_avi_header), (gst_avi_mux_riff_get_avix_header), (gst_avi_mux_riff_get_header), (gst_avi_mux_write_avix_index), (gst_avi_mux_add_index), (gst_avi_mux_bigfile), (gst_avi_mux_start_file), (gst_avi_mux_stop_file), (gst_avi_mux_handle_event), (gst_avi_mux_do_buffer), (gst_avi_mux_do_one_buffer), (gst_avi_mux_change_state): * gst/avi/gstavimux.h: * tests/check/elements/avimux.c: (teardown_src_pad): Add support for more than one audio stream; write better AVIX header; refactor code a bit; don't announce vorbis caps on our audio sink pads since we don't support it anyway. Closes #379298.