*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("text/plain; text/x-pango-markup")
+ GST_STATIC_CAPS ("text/x-raw, format= { pango-markup, utf8 }")
);
gst_static_pad_template_get (&sink_templ));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
- gst_element_class_set_details_simple (element_class,
+ gst_element_class_set_static_metadata (element_class,
"Subtitle parser", "Codec/Parser/Subtitle",
"Parses subtitle (.sub) files into text streams",
"Gustavo J. A. M. Carneiro <gjc@inescporto.pt>, "
break;
}
default:
- ret = gst_pad_peer_query (self->sinkpad, query);
+ ret = gst_pad_query_default (pad, parent, query);
break;
}
GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
&self->segment);
- self->next_offset = 0;
-
self->need_segment = TRUE;
} else {
GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
}
break;
case GST_SUB_PARSE_REGEX_SUBRIP:
- result = (gpointer) g_regex_new ("^ {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a"
+ result = (gpointer)
+ g_regex_new ("^[\\s\\n]*[\\n]? {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a"
" ?[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,3}"
" +--> +[0-9]{1,2}: ?[0-9]{1,2}: ?[0-9]{1,2}[,.] {0,2}[0-9]{1,2}",
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
switch (format) {
case GST_SUB_PARSE_FORMAT_MDVDSUB:
self->parse_line = parse_mdvdsub;
- return gst_caps_new_empty_simple ("text/x-pango-markup");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "pango-markup", NULL);
case GST_SUB_PARSE_FORMAT_SUBRIP:
self->parse_line = parse_subrip;
- return gst_caps_new_empty_simple ("text/x-pango-markup");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "pango-markup", NULL);
case GST_SUB_PARSE_FORMAT_MPSUB:
self->parse_line = parse_mpsub;
- return gst_caps_new_empty_simple ("text/plain");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "utf8", NULL);
#ifndef GST_DISABLE_XML
case GST_SUB_PARSE_FORMAT_SAMI:
self->parse_line = parse_sami;
sami_context_init (&self->state);
- return gst_caps_new_empty_simple ("text/x-pango-markup");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "pango-markup", NULL);
#endif
case GST_SUB_PARSE_FORMAT_TMPLAYER:
self->parse_line = parse_tmplayer;
self->state.max_duration = 5 * GST_SECOND;
- return gst_caps_new_empty_simple ("text/plain");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "utf8", NULL);
case GST_SUB_PARSE_FORMAT_MPL2:
self->parse_line = parse_mpl2;
- return gst_caps_new_empty_simple ("text/x-pango-markup");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "pango-markup", NULL);
case GST_SUB_PARSE_FORMAT_DKS:
self->parse_line = parse_dks;
- return gst_caps_new_empty_simple ("text/plain");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "utf8", NULL);
case GST_SUB_PARSE_FORMAT_SUBVIEWER:
self->parse_line = parse_subviewer;
- return gst_caps_new_empty_simple ("text/plain");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "utf8", NULL);
case GST_SUB_PARSE_FORMAT_QTTEXT:
self->parse_line = parse_qttext;
qttext_context_init (&self->state);
- return gst_caps_new_empty_simple ("text/x-pango-markup");
+ return gst_caps_new_simple ("text/x-raw",
+ "format", G_TYPE_STRING, "pango-markup", NULL);
case GST_SUB_PARSE_FORMAT_UNKNOWN:
default:
GST_DEBUG ("no subtitle format detected");
* subtitles which are discontinuous by nature. */
}
- self->offset = GST_BUFFER_OFFSET (buf) + gst_buffer_get_size (buf);
- self->next_offset = self->offset;
+ self->offset += gst_buffer_get_size (buf);
gst_adapter_push (self->adapter, buf);
case GST_STATE_CHANGE_READY_TO_PAUSED:
/* format detection will init the parser state */
self->offset = 0;
- self->next_offset = 0;
self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
self->valid_utf8 = TRUE;
self->first_buffer = TRUE;
* otherwise convert as always */
if (!g_utf8_validate (str, 128, &end) && (end - str) < 120) {
gchar *converted_str;
- GError *err = NULL;
gsize tmp;
const gchar *enc;
enc = "ISO-8859-15";
}
}
- converted_str = gst_convert_to_utf8 (str, 128, enc, &tmp, &err);
+ converted_str = gst_convert_to_utf8 (str, 128, enc, &tmp, NULL);
if (converted_str != NULL) {
g_free (str);
str = converted_str;
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
- "subparse",
+ subparse,
"Subtitle parsing",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)