summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog60
-rw-r--r--ext/smoothwave/gstsmoothwave.c80
-rw-r--r--ext/smoothwave/gstsmoothwave.h49
-rw-r--r--gst/mpeg2sub/gstmpeg2subt.c18
-rw-r--r--gst/smoothwave/gstsmoothwave.c80
-rw-r--r--gst/smoothwave/gstsmoothwave.h49
6 files changed, 257 insertions, 79 deletions
diff --git a/ChangeLog b/ChangeLog
index b6e0567b..d525a72f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,63 @@
+2005-01-26 Jan Schmidt <thaytan@mad.scientist.com>
+ * ext/a52dec/gsta52dec.c: (gst_a52dec_push),
+ (gst_a52dec_handle_event), (gst_a52dec_chain):
+ Add some debug output. Check that a discont has a valid
+ time associated.
+ * ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
+ (gst_alsa_sink_loop):
+ Ignore TAG events. A little extra debug for broken timestamps.
+ * ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
+ (dvdnavsrc_change_state):
+ Ensure we send a discont to engage the link before we send any
+ other events.
+ * ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
+ (dvdreadsrc_finalize), (_close), (_open), (_seek_title),
+ (_seek_chapter), (seek_sector), (dvdreadsrc_get),
+ (dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
+ Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
+ dvd://title works in totem because typefinding sends a seek that ends
+ up going back to chapter 1 regardless.
+ * ext/mpeg2dec/gstmpeg2dec.c:
+ * ext/mpeg2dec/gstmpeg2dec.h:
+ Output correct timestamps and handle disconts.
+ * ext/ogg/gstoggdemux.c: (get_relative):
+ Small guard against a null dereference.
+ * ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
+ (gst_textoverlay_set_property):
+ Free memory when done. Don't call gst_event_filler_get_duration on
+ EOS events. Use GST_LOG and GST_WARNING instead of g_message and
+ g_warning.
+ * ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
+ (draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
+ (gst_sw_srclink), (gst_smoothwave_chain):
+ Draw solid lines, prettier colours.
+ * gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
+ Add a default palette that'll work for some movies.
+ * gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
+ (gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
+ (gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
+ * gst/mpegstream/gstdvddemux.h:
+ * gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
+ (gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
+ * gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
+ (gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
+ * gst/mpegstream/gstmpegparse.h:
+ Use PTM/NAV events when for timestamp adjustment when connected to
+ dvdnavsrc. Don't use many discont events where one suffices.
+ * gst/playback/gstplaybasebin.c: (group_destroy),
+ (gen_preroll_element), (gst_play_base_bin_add_element):
+ * gst/playback/gstplaybasebin.h:
+ Make sure we remove subtitles from the same bin we put them in.
+ * gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
+ (gst_subparse_buffer_format_autodetect),
+ (gst_subparse_change_state):
+ Fix some memleaks and invalid accesses.
+ * gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
+ (oggskel_type_find), (cmml_type_find), (plugin_init):
+ Some typefind functions for Annodex v3.0 files
+ * gst/wavparse/gstwavparse.h:
+ GstRiffReadClass is the correct parent class.
+
2005-01-25 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst-libs/gst/riff/riff-media.c:
diff --git a/ext/smoothwave/gstsmoothwave.c b/ext/smoothwave/gstsmoothwave.c
index 4fd998fd..16d57da6 100644
--- a/ext/smoothwave/gstsmoothwave.c
+++ b/ext/smoothwave/gstsmoothwave.c
@@ -195,6 +195,27 @@ gst_smoothwave_init (GstSmoothWave * smoothwave)
smoothwave->samples_consumed = 0;
}
+inline guchar *
+draw_line (guchar * cur_pos, gint diff_y, gint stride)
+{
+ gint j;
+
+ if (diff_y > 0) {
+ for (j = diff_y; j > 0; j--) {
+ cur_pos += stride;
+ *cur_pos = 0xff;
+ }
+ } else if (diff_y < 0) {
+ for (j = diff_y; j < 0; j++) {
+ cur_pos -= stride;
+ *cur_pos = 0xff;
+ }
+ } else {
+ *cur_pos = 0xff;
+ }
+ return cur_pos;
+}
+
static void
gst_smoothwave_dispose (GObject * object)
{
@@ -247,7 +268,6 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
GstSmoothWave *smoothwave;
guint32 bytesperread;
gint samples_per_frame;
- gint qheight;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
@@ -290,27 +310,60 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
gst_adapter_push (smoothwave->adapter, buf);
while (gst_adapter_available (smoothwave->adapter) > MAX (bytesperread,
samples_per_frame * smoothwave->channels * sizeof (gint16))) {
+ guint32 *ptr;
+ gint i;
+ gint qheight;
const gint16 *samples =
(const guint16 *) gst_adapter_peek (smoothwave->adapter, bytesperread);
- register guint32 *ptr;
- gint i;
+ gint stride = smoothwave->width;
/* First draw the new waveform */
if (smoothwave->channels == 2) {
+ guchar *cur_pos[2];
+ gint prev_y[2];
+
qheight = smoothwave->height / 4;
- for (i = 0; i < smoothwave->width; i++) {
- gint16 y1 = (gint32) (samples[i * 2] * qheight) / 32768 + qheight;
- gint16 y2 = (gint32) (samples[(i * 2) + 1] * qheight) / 32768 +
- (qheight + smoothwave->height / 2);
- smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
- smoothwave->imagebuffer[y2 * smoothwave->width + i] = 0xff;
+ prev_y[0] = (gint32) (*samples) * qheight / 32768;
+ samples++;
+ prev_y[1] = (gint32) (*samples) * qheight / 32768;
+ samples++;
+ cur_pos[0] = smoothwave->imagebuffer + ((prev_y[0] + qheight) * stride);
+ cur_pos[1] =
+ smoothwave->imagebuffer + ((prev_y[1] +
+ (3 * smoothwave->height / 4)) * stride);
+ *(cur_pos[0]) = 0xff;
+ *(cur_pos[1]) = 0xff;
+
+ for (i = 1; i < smoothwave->width; i++) {
+ gint diff_y = (gint) (*samples) * qheight / 32768 - prev_y[0];
+
+ samples++;
+ cur_pos[0] = draw_line (cur_pos[0], diff_y, stride);
+ cur_pos[0]++;
+ prev_y[0] += diff_y;
+
+ diff_y = (gint) (*samples) * qheight / 32768 - prev_y[1];
+ samples++;
+ cur_pos[1] = draw_line (cur_pos[1], diff_y, stride);
+ cur_pos[1]++;
+ prev_y[1] += diff_y;
}
} else {
qheight = smoothwave->height / 2;
- for (i = 0; i < smoothwave->width; i++) {
- gint16 y1 = (gint32) (samples[i] * qheight) / 32768 + qheight;
-
- smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
+ guchar *cur_pos;
+ gint prev_y;
+
+ prev_y = (gint32) (*samples) * qheight / 32768;
+ samples++;
+ cur_pos = smoothwave->imagebuffer + ((prev_y + qheight) * stride);
+ *cur_pos = 0xff;
+ for (i = 1; i < smoothwave->width; i++) {
+ gint diff_y = (gint) (*samples) * qheight / 32768 - prev_y;
+
+ samples++;
+ cur_pos = draw_line (cur_pos, diff_y, stride);
+ cur_pos++;
+ prev_y += diff_y;
}
}
@@ -338,7 +391,6 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
in = smoothwave->imagebuffer;
for (i = 0; i < (smoothwave->width * smoothwave->height); i++) {
- // guchar t = *in++;
*out++ = smoothwave->palette[*in++]; // t | (t << 8) | (t << 16) | (t << 24);
}
gst_pad_push (smoothwave->srcpad, GST_DATA (bufout));
diff --git a/ext/smoothwave/gstsmoothwave.h b/ext/smoothwave/gstsmoothwave.h
index a0dfe402..fe935a78 100644
--- a/ext/smoothwave/gstsmoothwave.h
+++ b/ext/smoothwave/gstsmoothwave.h
@@ -26,8 +26,9 @@
#include <gst/bytestream/adapter.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_SMOOTHWAVE \
(gst_smoothwave_get_type())
@@ -40,36 +41,38 @@ extern "C" {
#define GST_IS_SMOOTHWAVE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SMOOTHWAVE))
-typedef struct _GstSmoothWave GstSmoothWave;
-typedef struct _GstSmoothWaveClass GstSmoothWaveClass;
+ typedef struct _GstSmoothWave GstSmoothWave;
+ typedef struct _GstSmoothWaveClass GstSmoothWaveClass;
-struct _GstSmoothWave {
- GstElement element;
+ struct _GstSmoothWave
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
- GstAdapter *adapter;
+ GstPad *sinkpad, *srcpad;
+ GstAdapter *adapter;
- guchar *imagebuffer;
- GstClockTime audio_basetime;
- guint64 samples_consumed;
+ guchar *imagebuffer;
+ GstClockTime audio_basetime;
+ guint64 samples_consumed;
- gint sample_rate;
- gint width,height;
- gdouble fps;
- gint channels;
- guint32 palette[256];
-};
+ gint sample_rate;
+ gint width, height;
+ gdouble fps;
+ gint channels;
+ guint32 palette[256];
+ };
-struct _GstSmoothWaveClass {
- GstElementClass parent_class;
-};
+ struct _GstSmoothWaveClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_smoothwave_get_type(void);
+ GType gst_smoothwave_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_SMOOTHWAVE_H__ */
+#endif /* __GST_SMOOTHWAVE_H__ */
diff --git a/gst/mpeg2sub/gstmpeg2subt.c b/gst/mpeg2sub/gstmpeg2subt.c
index e6dd86a1..23a2456e 100644
--- a/gst/mpeg2sub/gstmpeg2subt.c
+++ b/gst/mpeg2sub/gstmpeg2subt.c
@@ -112,6 +112,13 @@ enum
SPU_END = 0xff
};
+static guint32 default_clut[16] = {
+ 0xb48080, 0x248080, 0x628080, 0xd78080,
+ 0x808080, 0x808080, 0x808080, 0x808080,
+ 0x808080, 0x808080, 0x808080, 0x808080,
+ 0x808080, 0x808080, 0x808080, 0x808080
+};
+
typedef struct RLE_state
{
gint id;
@@ -233,11 +240,12 @@ gst_mpeg2subt_init (GstMpeg2Subt * mpeg2subt)
mpeg2subt->start_display_time = GST_CLOCK_TIME_NONE;
mpeg2subt->end_display_time = GST_CLOCK_TIME_NONE;
mpeg2subt->forced_display = FALSE;
- memset (mpeg2subt->current_clut, 0, 16 * sizeof (guint32));
- memset (mpeg2subt->subtitle_index, 0, sizeof (mpeg2subt->subtitle_index));
- memset (mpeg2subt->menu_index, 0, sizeof (mpeg2subt->menu_index));
- memset (mpeg2subt->subtitle_alpha, 0, sizeof (mpeg2subt->subtitle_alpha));
- memset (mpeg2subt->menu_alpha, 0, sizeof (mpeg2subt->menu_alpha));
+
+ memcpy (mpeg2subt->current_clut, default_clut, sizeof (guint32) * 16);
+ gst_setup_palette (mpeg2subt, mpeg2subt->menu_index, mpeg2subt->menu_alpha);
+ gst_setup_palette (mpeg2subt, mpeg2subt->subtitle_index,
+ mpeg2subt->subtitle_alpha);
+
memset (mpeg2subt->out_buffers, 0, sizeof (mpeg2subt->out_buffers));
mpeg2subt->pending_video_buffer = NULL;
mpeg2subt->next_video_time = GST_CLOCK_TIME_NONE;
diff --git a/gst/smoothwave/gstsmoothwave.c b/gst/smoothwave/gstsmoothwave.c
index 4fd998fd..16d57da6 100644
--- a/gst/smoothwave/gstsmoothwave.c
+++ b/gst/smoothwave/gstsmoothwave.c
@@ -195,6 +195,27 @@ gst_smoothwave_init (GstSmoothWave * smoothwave)
smoothwave->samples_consumed = 0;
}
+inline guchar *
+draw_line (guchar * cur_pos, gint diff_y, gint stride)
+{
+ gint j;
+
+ if (diff_y > 0) {
+ for (j = diff_y; j > 0; j--) {
+ cur_pos += stride;
+ *cur_pos = 0xff;
+ }
+ } else if (diff_y < 0) {
+ for (j = diff_y; j < 0; j++) {
+ cur_pos -= stride;
+ *cur_pos = 0xff;
+ }
+ } else {
+ *cur_pos = 0xff;
+ }
+ return cur_pos;
+}
+
static void
gst_smoothwave_dispose (GObject * object)
{
@@ -247,7 +268,6 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
GstSmoothWave *smoothwave;
guint32 bytesperread;
gint samples_per_frame;
- gint qheight;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
@@ -290,27 +310,60 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
gst_adapter_push (smoothwave->adapter, buf);
while (gst_adapter_available (smoothwave->adapter) > MAX (bytesperread,
samples_per_frame * smoothwave->channels * sizeof (gint16))) {
+ guint32 *ptr;
+ gint i;
+ gint qheight;
const gint16 *samples =
(const guint16 *) gst_adapter_peek (smoothwave->adapter, bytesperread);
- register guint32 *ptr;
- gint i;
+ gint stride = smoothwave->width;
/* First draw the new waveform */
if (smoothwave->channels == 2) {
+ guchar *cur_pos[2];
+ gint prev_y[2];
+
qheight = smoothwave->height / 4;
- for (i = 0; i < smoothwave->width; i++) {
- gint16 y1 = (gint32) (samples[i * 2] * qheight) / 32768 + qheight;
- gint16 y2 = (gint32) (samples[(i * 2) + 1] * qheight) / 32768 +
- (qheight + smoothwave->height / 2);
- smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
- smoothwave->imagebuffer[y2 * smoothwave->width + i] = 0xff;
+ prev_y[0] = (gint32) (*samples) * qheight / 32768;
+ samples++;
+ prev_y[1] = (gint32) (*samples) * qheight / 32768;
+ samples++;
+ cur_pos[0] = smoothwave->imagebuffer + ((prev_y[0] + qheight) * stride);
+ cur_pos[1] =
+ smoothwave->imagebuffer + ((prev_y[1] +
+ (3 * smoothwave->height / 4)) * stride);
+ *(cur_pos[0]) = 0xff;
+ *(cur_pos[1]) = 0xff;
+
+ for (i = 1; i < smoothwave->width; i++) {
+ gint diff_y = (gint) (*samples) * qheight / 32768 - prev_y[0];
+
+ samples++;
+ cur_pos[0] = draw_line (cur_pos[0], diff_y, stride);
+ cur_pos[0]++;
+ prev_y[0] += diff_y;
+
+ diff_y = (gint) (*samples) * qheight / 32768 - prev_y[1];
+ samples++;
+ cur_pos[1] = draw_line (cur_pos[1], diff_y, stride);
+ cur_pos[1]++;
+ prev_y[1] += diff_y;
}
} else {
qheight = smoothwave->height / 2;
- for (i = 0; i < smoothwave->width; i++) {
- gint16 y1 = (gint32) (samples[i] * qheight) / 32768 + qheight;
-
- smoothwave->imagebuffer[y1 * smoothwave->width + i] = 0xff;
+ guchar *cur_pos;
+ gint prev_y;
+
+ prev_y = (gint32) (*samples) * qheight / 32768;
+ samples++;
+ cur_pos = smoothwave->imagebuffer + ((prev_y + qheight) * stride);
+ *cur_pos = 0xff;
+ for (i = 1; i < smoothwave->width; i++) {
+ gint diff_y = (gint) (*samples) * qheight / 32768 - prev_y;
+
+ samples++;
+ cur_pos = draw_line (cur_pos, diff_y, stride);
+ cur_pos++;
+ prev_y += diff_y;
}
}
@@ -338,7 +391,6 @@ gst_smoothwave_chain (GstPad * pad, GstData * _data)
in = smoothwave->imagebuffer;
for (i = 0; i < (smoothwave->width * smoothwave->height); i++) {
- // guchar t = *in++;
*out++ = smoothwave->palette[*in++]; // t | (t << 8) | (t << 16) | (t << 24);
}
gst_pad_push (smoothwave->srcpad, GST_DATA (bufout));
diff --git a/gst/smoothwave/gstsmoothwave.h b/gst/smoothwave/gstsmoothwave.h
index a0dfe402..fe935a78 100644
--- a/gst/smoothwave/gstsmoothwave.h
+++ b/gst/smoothwave/gstsmoothwave.h
@@ -26,8 +26,9 @@
#include <gst/bytestream/adapter.h>
#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+extern "C"
+{
+#endif /* __cplusplus */
#define GST_TYPE_SMOOTHWAVE \
(gst_smoothwave_get_type())
@@ -40,36 +41,38 @@ extern "C" {
#define GST_IS_SMOOTHWAVE_CLASS(obj) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SMOOTHWAVE))
-typedef struct _GstSmoothWave GstSmoothWave;
-typedef struct _GstSmoothWaveClass GstSmoothWaveClass;
+ typedef struct _GstSmoothWave GstSmoothWave;
+ typedef struct _GstSmoothWaveClass GstSmoothWaveClass;
-struct _GstSmoothWave {
- GstElement element;
+ struct _GstSmoothWave
+ {
+ GstElement element;
- GstPad *sinkpad,*srcpad;
- GstAdapter *adapter;
+ GstPad *sinkpad, *srcpad;
+ GstAdapter *adapter;
- guchar *imagebuffer;
- GstClockTime audio_basetime;
- guint64 samples_consumed;
+ guchar *imagebuffer;
+ GstClockTime audio_basetime;
+ guint64 samples_consumed;
- gint sample_rate;
- gint width,height;
- gdouble fps;
- gint channels;
- guint32 palette[256];
-};
+ gint sample_rate;
+ gint width, height;
+ gdouble fps;
+ gint channels;
+ guint32 palette[256];
+ };
-struct _GstSmoothWaveClass {
- GstElementClass parent_class;
-};
+ struct _GstSmoothWaveClass
+ {
+ GstElementClass parent_class;
+ };
-GType gst_smoothwave_get_type(void);
+ GType gst_smoothwave_get_type (void);
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif /* __cplusplus */
-#endif /* __GST_SMOOTHWAVE_H__ */
+#endif /* __GST_SMOOTHWAVE_H__ */