summaryrefslogtreecommitdiff
path: root/ext/modplug
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2012-03-29 17:41:53 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2012-03-29 17:41:53 +0200
commit860ccd414dbb313fabf065b92838f0f39037584b (patch)
tree0d5c0d3510db3ca3d7e6487420e8d09f74ae1961 /ext/modplug
parenta9ec4d62a89dd53aa295af02c7d5f57ef936359b (diff)
parentd84d98943af42ce645ee022207bcf04e747d2d4a (diff)
downloadgstreamer-plugins-bad-860ccd414dbb313fabf065b92838f0f39037584b.tar.gz
Merge remote-tracking branch 'origin/0.10'
Conflicts: NEWS RELEASE common configure.ac docs/libs/gst-plugins-bad-libs-sections.txt docs/plugins/gst-plugins-bad-plugins.args docs/plugins/gst-plugins-bad-plugins.hierarchy docs/plugins/gst-plugins-bad-plugins.interfaces docs/plugins/inspect/plugin-adpcmdec.xml docs/plugins/inspect/plugin-adpcmenc.xml docs/plugins/inspect/plugin-assrender.xml docs/plugins/inspect/plugin-audiovisualizers.xml docs/plugins/inspect/plugin-autoconvert.xml docs/plugins/inspect/plugin-bayer.xml docs/plugins/inspect/plugin-bz2.xml docs/plugins/inspect/plugin-camerabin2.xml docs/plugins/inspect/plugin-celt.xml docs/plugins/inspect/plugin-dataurisrc.xml docs/plugins/inspect/plugin-debugutilsbad.xml docs/plugins/inspect/plugin-dtmf.xml docs/plugins/inspect/plugin-dtsdec.xml docs/plugins/inspect/plugin-dvbsuboverlay.xml docs/plugins/inspect/plugin-dvdspu.xml docs/plugins/inspect/plugin-faac.xml docs/plugins/inspect/plugin-faad.xml docs/plugins/inspect/plugin-gsm.xml docs/plugins/inspect/plugin-h264parse.xml docs/plugins/inspect/plugin-mms.xml docs/plugins/inspect/plugin-modplug.xml docs/plugins/inspect/plugin-mpeg2enc.xml docs/plugins/inspect/plugin-mpegdemux2.xml docs/plugins/inspect/plugin-mpegtsdemux.xml docs/plugins/inspect/plugin-mpegvideoparse.xml docs/plugins/inspect/plugin-mplex.xml docs/plugins/inspect/plugin-pcapparse.xml docs/plugins/inspect/plugin-rawparse.xml docs/plugins/inspect/plugin-rtpmux.xml docs/plugins/inspect/plugin-rtpvp8.xml docs/plugins/inspect/plugin-scaletempo.xml docs/plugins/inspect/plugin-schro.xml docs/plugins/inspect/plugin-sdp.xml docs/plugins/inspect/plugin-segmentclip.xml docs/plugins/inspect/plugin-shm.xml docs/plugins/inspect/plugin-videomaxrate.xml docs/plugins/inspect/plugin-videoparsersbad.xml docs/plugins/inspect/plugin-vp8.xml docs/plugins/inspect/plugin-y4mdec.xml ext/celt/gstceltdec.c ext/dts/gstdtsdec.c ext/modplug/gstmodplug.cc ext/opus/gstopusenc.c gst-libs/gst/video/gstbasevideocodec.c gst-libs/gst/video/gstbasevideocodec.h gst-libs/gst/video/gstbasevideodecoder.c gst-libs/gst/video/gstbasevideodecoder.h gst-libs/gst/video/gstbasevideoencoder.c gst-libs/gst/video/gstbasevideoencoder.h gst/adpcmdec/Makefile.am gst/audiovisualizers/gstbaseaudiovisualizer.c gst/h264parse/gsth264parse.c gst/mpegdemux/mpegtsparse.c gst/mpegtsdemux/mpegtsbase.c gst/mpegtsdemux/mpegtspacketizer.c gst/mpegtsdemux/mpegtsparse.c gst/mpegtsdemux/tsdemux.c gst/mpegtsdemux/tsdemux.h gst/mxf/mxfdemux.c gst/rawparse/gstaudioparse.c gst/videoparsers/gsth263parse.c gst/videoparsers/gsth264parse.c sys/d3dvideosink/d3dvideosink.c sys/decklink/gstdecklinksink.cpp sys/dvb/gstdvbsrc.c sys/shm/gstshmsrc.c sys/vdpau/h264/gstvdph264dec.c sys/vdpau/mpeg/gstvdpmpegdec.c tests/examples/opencv/gst_element_print_properties.c win32/common/config.h
Diffstat (limited to 'ext/modplug')
-rw-r--r--ext/modplug/gstmodplug.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc
index d849a44e1..3d7cbc04f 100644
--- a/ext/modplug/gstmodplug.cc
+++ b/ext/modplug/gstmodplug.cc
@@ -491,6 +491,10 @@ gst_modplug_load_song (GstModPlug * modplug)
gst_structure_get_int (structure, "channels", &modplug->channel);
gst_structure_get_int (structure, "rate", &modplug->frequency);
+
+ GST_DEBUG_OBJECT (modplug,
+ "Audio settings: %d bits, %d channel(s), %d Hz sampling rate",
+ modplug->bits, modplug->channel, modplug->frequency);
gst_pad_set_caps (modplug->srcpad, newcaps);
gst_caps_unref (newcaps);
@@ -672,7 +676,8 @@ gst_modplug_loop (GstModPlug * modplug)
if (modplug->offset == modplug->song_size) {
GstTagList *tags;
gboolean ok;
- gchar comment[16384];
+ #define COMMENT_SIZE 16384
+ gchar comment[COMMENT_SIZE];
GstSegment seg;
ok = gst_modplug_load_song (modplug);
@@ -695,7 +700,9 @@ gst_modplug_loop (GstModPlug * modplug)
GST_TAG_BEATS_PER_MINUTE,
(gdouble) modplug->mSoundFile->GetMusicTempo (), NULL);
- if (modplug->mSoundFile->GetSongComments ((gchar *) & comment, 16384, 32)) {
+ if (modplug->mSoundFile->GetSongComments ((gchar *) & comment,
+ COMMENT_SIZE, 32)) {
+ comment[COMMENT_SIZE - 1] = '\0';
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND,
GST_TAG_COMMENT, comment, NULL);
}
@@ -713,7 +720,7 @@ gst_modplug_loop (GstModPlug * modplug)
gfloat temp;
temp = (gfloat) modplug->song_length / modplug->seek_at;
- seek_to_pos = (int) (modplug->mSoundFile->GetMaxPosition () / temp);
+ seek_to_pos = (gint) (modplug->mSoundFile->GetMaxPosition () / temp);
GST_DEBUG_OBJECT (modplug, "Seeking to row %d", seek_to_pos);
@@ -722,7 +729,9 @@ gst_modplug_loop (GstModPlug * modplug)
}
/* read and output a buffer */
- out = gst_buffer_new_allocate (NULL, modplug->read_bytes, NULL);
+ GST_LOG_OBJECT (modplug, "Read %d bytes", (gint)modplug->read_bytes);
+ /* libmodplug 0.8.7 trashes memory */
+ out = gst_buffer_new_allocate (NULL, modplug->read_bytes * 2, NULL);
gst_buffer_map (out, &map, GST_MAP_WRITE);
if (!modplug->mSoundFile->Read (map.data, modplug->read_bytes)) {
@@ -730,6 +739,7 @@ gst_modplug_loop (GstModPlug * modplug)
goto eos;
}
gst_buffer_unmap (out, &map);
+ gst_buffer_resize (out, 0, modplug->read_bytes);
GST_BUFFER_DURATION (out) =
gst_util_uint64_scale_int (modplug->read_samples, GST_SECOND,
@@ -796,6 +806,7 @@ gst_modplug_change_state (GstElement * element, GstStateChange transition)
}
if (modplug->mSoundFile) {
modplug->mSoundFile->Destroy ();
+ delete modplug->mSoundFile;
modplug->mSoundFile = NULL;
}
break;