summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1c18686)
raw | patch | inline | side by side (parent: 1c18686)
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | |
Tue, 15 Mar 2011 10:02:42 +0000 (11:02 +0100) | ||
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | |
Tue, 15 Mar 2011 10:02:42 +0000 (11:02 +0100) |
This makes the code easier to read, doesn't store every buffer
in the instance until the next buffer is to be drawn and
fixes an unitialized variable compiler warning.
in the instance until the next buffer is to be drawn and
fixes an unitialized variable compiler warning.
gst/dvdsub/gstdvdsubdec.c | patch | blob | history | |
gst/dvdsub/gstdvdsubdec.h | patch | blob | history |
index 5b53f39eebbd29eda9b66a45cc5ac2cc68d96e9a..868d5b38ba130c7bf8342aba5035da884051076c 100644 (file)
dec->next_ts = 0;
dec->next_event_ts = GST_CLOCK_TIME_NONE;
- dec->out_buffer = NULL;
dec->buf_dirty = TRUE;
dec->use_ARGB = FALSE;
}
g_assert (dec->next_ts <= end_ts);
/* Check if we need to redraw the output buffer */
- if (dec->buf_dirty) {
- if (dec->out_buffer) {
- gst_buffer_unref (dec->out_buffer);
- dec->out_buffer = NULL;
- }
-
- flow = gst_pad_alloc_buffer_and_set_caps (dec->srcpad, 0,
- 4 * dec->in_width * dec->in_height, GST_PAD_CAPS (dec->srcpad),
- &out_buf);
+ if (!dec->buf_dirty) {
+ flow = GST_FLOW_OK;
+ goto out;
+ }
- if (flow != GST_FLOW_OK) {
- GST_DEBUG_OBJECT (dec, "alloc buffer failed: flow = %s",
- gst_flow_get_name (flow));
- goto out;
- }
+ flow = gst_pad_alloc_buffer_and_set_caps (dec->srcpad, 0,
+ 4 * dec->in_width * dec->in_height, GST_PAD_CAPS (dec->srcpad), &out_buf);
- /* Clear the buffer */
- /* FIXME - move this into the buffer rendering code */
- for (y = 0; y < dec->in_height; y++) {
- guchar *line = GST_BUFFER_DATA (out_buf) + 4 * dec->in_width * y;
-
- for (x = 0; x < dec->in_width; x++) {
- line[0] = 0; /* A */
- if (!dec->use_ARGB) {
- line[1] = 16; /* Y */
- line[2] = 128; /* U */
- line[3] = 128; /* V */
- } else {
- line[1] = 0; /* R */
- line[2] = 0; /* G */
- line[3] = 0; /* B */
- }
+ if (flow != GST_FLOW_OK) {
+ GST_DEBUG_OBJECT (dec, "alloc buffer failed: flow = %s",
+ gst_flow_get_name (flow));
+ goto out;
+ }
- line += 4;
+ /* Clear the buffer */
+ /* FIXME - move this into the buffer rendering code */
+ for (y = 0; y < dec->in_height; y++) {
+ guchar *line = GST_BUFFER_DATA (out_buf) + 4 * dec->in_width * y;
+
+ for (x = 0; x < dec->in_width; x++) {
+ line[0] = 0; /* A */
+ if (!dec->use_ARGB) {
+ line[1] = 16; /* Y */
+ line[2] = 128; /* U */
+ line[3] = 128; /* V */
+ } else {
+ line[1] = 0; /* R */
+ line[2] = 0; /* G */
+ line[3] = 0; /* B */
}
- }
- /* FIXME: do we really want to honour the forced_display flag
- * for subtitles streans? */
- if (dec->visible || dec->forced_display) {
- gst_dvd_sub_dec_merge_title (dec, out_buf);
+ line += 4;
}
+ }
- dec->out_buffer = out_buf;
- dec->buf_dirty = FALSE;
- } else {
- goto out;
+ /* FIXME: do we really want to honour the forced_display flag
+ * for subtitles streans? */
+ if (dec->visible || dec->forced_display) {
+ gst_dvd_sub_dec_merge_title (dec, out_buf);
}
- out_buf = gst_buffer_create_sub (dec->out_buffer, 0,
- GST_BUFFER_SIZE (dec->out_buffer));
+ dec->buf_dirty = FALSE;
GST_BUFFER_TIMESTAMP (out_buf) = dec->next_ts;
if (GST_CLOCK_TIME_IS_VALID (dec->next_event_ts)) {
flow = gst_pad_push (dec->srcpad, out_buf);
out:
-
dec->next_ts = end_ts;
return flow;
}
index bd2af43110738a3cb5caf3993a41129307b73a41..52ea1268853f36f2c9f7d6a4e16c305d5da10103 100644 (file)
GstClockTime next_event_ts;
- GstBuffer *out_buffer;
gboolean buf_dirty;
};