OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
2006-10-20 17:02:19 +00:00
|
|
|
* Copyright (C) 2004 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
|
2016-03-07 12:29:43 +00:00
|
|
|
* Copyright (C) 2016 Philippe Normand <pnormand@igalia.com>
|
|
|
|
* Copyright (C) 2016 Jan Schmidt <jan@centricular.com>
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-10-07 08:56:35 +00:00
|
|
|
#include <stdio.h>
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
#include <stdlib.h>
|
2009-10-07 08:56:35 +00:00
|
|
|
#include <string.h>
|
2005-02-01 15:04:07 +00:00
|
|
|
#include <sys/types.h>
|
2009-02-28 23:23:20 +00:00
|
|
|
#include <glib.h>
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
|
|
|
#include "gstsubparse.h"
|
gst/subparse/: Add very basic parser for SSA subtitle streams (as often found in matroska files).
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstssaparse.c: (gst_ssa_parse_base_init),
(gst_ssa_parse_dispose), (gst_ssa_parse_init),
(gst_ssa_parse_class_init), (gst_ssa_parse_src_event),
(gst_ssa_parse_sink_event), (gst_ssa_parse_setcaps),
(gst_ssa_parse_remove_override_codes), (gst_ssa_parse_parse_line),
(gst_ssa_parse_chain), (gst_ssa_parse_change_state):
* gst/subparse/gstssaparse.h:
* gst/subparse/gstsubparse.c: (plugin_init):
Add very basic parser for SSA subtitle streams (as often
found in matroska files).
2006-02-19 14:16:16 +00:00
|
|
|
#include "gstssaparse.h"
|
2006-05-15 09:14:35 +00:00
|
|
|
#include "samiparse.h"
|
2006-10-23 12:06:44 +00:00
|
|
|
#include "tmplayerparse.h"
|
2007-03-10 11:17:52 +00:00
|
|
|
#include "mpl2parse.h"
|
2009-12-01 16:13:24 +00:00
|
|
|
#include "qttextparse.h"
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2006-10-23 12:06:44 +00:00
|
|
|
GST_DEBUG_CATEGORY (sub_parse_debug);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2006-05-17 17:49:10 +00:00
|
|
|
#define DEFAULT_ENCODING NULL
|
2016-03-07 12:29:43 +00:00
|
|
|
#define ATTRIBUTE_REGEX "\\s?[a-zA-Z0-9\\. \t\\(\\)]*"
|
|
|
|
static const gchar *allowed_srt_tags[] = { "i", "b", "u", NULL };
|
|
|
|
static const gchar *allowed_vtt_tags[] =
|
|
|
|
{ "i", "b", "c", "u", "v", "ruby", "rt", NULL };
|
2006-05-17 17:49:10 +00:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2009-11-07 10:08:19 +00:00
|
|
|
PROP_ENCODING,
|
|
|
|
PROP_VIDEOFPS
|
2006-05-17 17:49:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_sub_parse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void
|
|
|
|
gst_sub_parse_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
|
2006-05-15 09:14:35 +00:00
|
|
|
static GstStaticPadTemplate sink_templ = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2006-10-23 12:06:44 +00:00
|
|
|
GST_STATIC_CAPS ("application/x-subtitle; application/x-subtitle-sami; "
|
2009-10-22 08:02:11 +00:00
|
|
|
"application/x-subtitle-tmplayer; application/x-subtitle-mpl2; "
|
2013-12-18 14:24:02 +00:00
|
|
|
"application/x-subtitle-dks; application/x-subtitle-qttext;"
|
2016-03-07 12:29:43 +00:00
|
|
|
"application/x-subtitle-lrc; application/x-subtitle-vtt")
|
2006-05-15 09:14:35 +00:00
|
|
|
);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2012-09-02 01:41:34 +00:00
|
|
|
GST_STATIC_CAPS ("text/x-raw, format= { pango-markup, utf8 }")
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
static gboolean gst_sub_parse_src_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
2011-11-16 16:25:17 +00:00
|
|
|
static gboolean gst_sub_parse_src_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query);
|
2011-11-17 11:48:25 +00:00
|
|
|
static gboolean gst_sub_parse_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
static GstStateChangeReturn gst_sub_parse_change_state (GstElement * element,
|
2005-09-02 15:43:18 +00:00
|
|
|
GstStateChange transition);
|
2005-05-06 03:32:51 +00:00
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
static GstFlowReturn gst_sub_parse_chain (GstPad * sinkpad, GstObject * parent,
|
|
|
|
GstBuffer * buf);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2011-04-19 09:35:53 +00:00
|
|
|
#define gst_sub_parse_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstSubParse, gst_sub_parse, GST_TYPE_ELEMENT);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
static void
|
|
|
|
gst_sub_parse_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstSubParse *subparse = GST_SUBPARSE (object);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (subparse, "cleaning up subtitle parser");
|
|
|
|
|
2006-05-17 17:49:10 +00:00
|
|
|
if (subparse->encoding) {
|
|
|
|
g_free (subparse->encoding);
|
|
|
|
subparse->encoding = NULL;
|
|
|
|
}
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
|
|
|
|
if (subparse->detected_encoding) {
|
|
|
|
g_free (subparse->detected_encoding);
|
|
|
|
subparse->detected_encoding = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (subparse->adapter) {
|
2009-09-01 14:06:51 +00:00
|
|
|
g_object_unref (subparse->adapter);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
subparse->adapter = NULL;
|
|
|
|
}
|
|
|
|
|
2006-10-18 18:40:12 +00:00
|
|
|
if (subparse->textbuf) {
|
|
|
|
g_string_free (subparse->textbuf, TRUE);
|
|
|
|
subparse->textbuf = NULL;
|
|
|
|
}
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
|
|
|
|
GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_sub_parse_class_init (GstSubParseClass * klass)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
object_class->dispose = gst_sub_parse_dispose;
|
2006-05-17 17:49:10 +00:00
|
|
|
object_class->set_property = gst_sub_parse_set_property;
|
|
|
|
object_class->get_property = gst_sub_parse_get_property;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
|
2016-03-03 07:46:24 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class, &sink_templ);
|
|
|
|
gst_element_class_add_static_pad_template (element_class, &src_templ);
|
2012-04-09 23:45:16 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class,
|
2011-04-19 09:35:53 +00:00
|
|
|
"Subtitle parser", "Codec/Parser/Subtitle",
|
|
|
|
"Parses subtitle (.sub) files into text streams",
|
|
|
|
"Gustavo J. A. M. Carneiro <gjc@inescporto.pt>, "
|
2015-07-16 16:15:33 +00:00
|
|
|
"GStreamer maintainers <gstreamer-devel@lists.freedesktop.org>");
|
2011-04-19 09:35:53 +00:00
|
|
|
|
2005-12-01 01:12:55 +00:00
|
|
|
element_class->change_state = gst_sub_parse_change_state;
|
2006-05-17 17:49:10 +00:00
|
|
|
|
2006-06-22 10:10:51 +00:00
|
|
|
g_object_class_install_property (object_class, PROP_ENCODING,
|
gst/playback/gstplaybasebin.*: Add 'subtitle-encoding' property to playbin, so applications can force a subtitle enco...
Original commit message from CVS:
Patch by: Young-Ho Cha <ganadist at chollian net>
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(gst_play_base_bin_init), (gst_play_base_bin_dispose),
(set_encoding_element), (decodebin_element_added_cb),
(decodebin_element_removed_cb), (setup_subtitle), (setup_source),
(gst_play_base_bin_set_property), (gst_play_base_bin_get_property):
* gst/playback/gstplaybasebin.h:
Add 'subtitle-encoding' property to playbin, so applications can
force a subtitle encoding for non-UTF8 subtitles (#342268).
* gst/subparse/gstsubparse.c: (gst_sub_parse_class_init),
(gst_sub_parse_set_property):
Rename recently-added 'encoding' property to 'subtitle-encoding'
(so it can be proxied by playbin/decodebin in a generic way
with less danger of false positives).
2006-05-29 13:21:00 +00:00
|
|
|
g_param_spec_string ("subtitle-encoding", "subtitle charset encoding",
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
"Encoding to assume if input subtitles are not in UTF-8 or any other "
|
|
|
|
"Unicode encoding. If not set, the GST_SUBTITLE_ENCODING environment "
|
|
|
|
"variable will be checked for an encoding to use. If that is not set "
|
|
|
|
"either, ISO-8859-15 will be assumed.", DEFAULT_ENCODING,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-11-07 10:08:19 +00:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_VIDEOFPS,
|
2009-11-07 10:31:09 +00:00
|
|
|
gst_param_spec_fraction ("video-fps", "Video framerate",
|
2009-11-07 10:08:19 +00:00
|
|
|
"Framerate of the video stream. This is needed by some subtitle "
|
|
|
|
"formats to synchronize subtitles and video properly. If not set "
|
|
|
|
"and the subtitle format requires it subtitles may be out of sync.",
|
2010-10-13 13:12:38 +00:00
|
|
|
0, 1, G_MAXINT, 1, 24000, 1001,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_sub_parse_init (GstSubParse * subparse)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-11-16 18:21:46 +00:00
|
|
|
subparse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
|
2005-12-12 09:52:37 +00:00
|
|
|
gst_pad_set_chain_function (subparse->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_sub_parse_chain));
|
|
|
|
gst_pad_set_event_function (subparse->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_sub_parse_sink_event));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (subparse), subparse->sinkpad);
|
|
|
|
|
2005-11-16 18:21:46 +00:00
|
|
|
subparse->srcpad = gst_pad_new_from_static_template (&src_templ, "src");
|
2005-12-12 09:52:37 +00:00
|
|
|
gst_pad_set_event_function (subparse->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_sub_parse_src_event));
|
2009-08-04 12:29:41 +00:00
|
|
|
gst_pad_set_query_function (subparse->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_sub_parse_src_query));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (subparse), subparse->srcpad);
|
|
|
|
|
|
|
|
subparse->textbuf = g_string_new (NULL);
|
2005-05-06 03:32:51 +00:00
|
|
|
subparse->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
|
2020-03-20 18:09:17 +00:00
|
|
|
subparse->strip_pango_markup = FALSE;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
subparse->flushing = FALSE;
|
2007-03-09 16:28:04 +00:00
|
|
|
gst_segment_init (&subparse->segment, GST_FORMAT_TIME);
|
|
|
|
subparse->need_segment = TRUE;
|
2006-05-17 17:49:10 +00:00
|
|
|
subparse->encoding = g_strdup (DEFAULT_ENCODING);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
subparse->detected_encoding = NULL;
|
|
|
|
subparse->adapter = gst_adapter_new ();
|
2009-11-07 10:31:09 +00:00
|
|
|
|
|
|
|
subparse->fps_n = 24000;
|
|
|
|
subparse->fps_d = 1001;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Source pad functions.
|
|
|
|
*/
|
|
|
|
|
2009-08-04 12:29:41 +00:00
|
|
|
static gboolean
|
2011-11-16 16:25:17 +00:00
|
|
|
gst_sub_parse_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
2009-08-04 12:29:41 +00:00
|
|
|
{
|
2011-11-16 16:25:17 +00:00
|
|
|
GstSubParse *self = GST_SUBPARSE (parent);
|
2009-08-04 12:29:41 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
GST_DEBUG ("Handling %s query", GST_QUERY_TYPE_NAME (query));
|
2009-08-04 12:29:41 +00:00
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
2009-08-04 12:32:51 +00:00
|
|
|
case GST_QUERY_POSITION:{
|
|
|
|
GstFormat fmt;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_position (query, &fmt, NULL);
|
2009-08-04 12:32:51 +00:00
|
|
|
if (fmt != GST_FORMAT_TIME) {
|
|
|
|
ret = gst_pad_peer_query (self->sinkpad, query);
|
|
|
|
} else {
|
|
|
|
ret = TRUE;
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_position (query, GST_FORMAT_TIME, self->segment.position);
|
2009-08-04 12:32:51 +00:00
|
|
|
}
|
2011-08-10 09:49:38 +00:00
|
|
|
break;
|
2009-08-04 12:32:51 +00:00
|
|
|
}
|
2009-08-04 12:29:41 +00:00
|
|
|
case GST_QUERY_SEEKING:
|
|
|
|
{
|
|
|
|
GstFormat fmt;
|
|
|
|
gboolean seekable = FALSE;
|
|
|
|
|
|
|
|
ret = TRUE;
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_parse_seeking (query, &fmt, NULL, NULL, NULL);
|
2009-08-04 12:29:41 +00:00
|
|
|
if (fmt == GST_FORMAT_TIME) {
|
|
|
|
GstQuery *peerquery = gst_query_new_seeking (GST_FORMAT_BYTES);
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
seekable = gst_pad_peer_query (self->sinkpad, peerquery);
|
2009-08-04 12:29:41 +00:00
|
|
|
if (seekable)
|
|
|
|
gst_query_parse_seeking (peerquery, NULL, &seekable, NULL, NULL);
|
|
|
|
gst_query_unref (peerquery);
|
|
|
|
}
|
|
|
|
|
2011-05-17 09:25:31 +00:00
|
|
|
gst_query_set_seeking (query, fmt, seekable, seekable ? 0 : -1, -1);
|
2009-08-04 12:29:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2012-09-11 14:28:26 +00:00
|
|
|
ret = gst_pad_query_default (pad, parent, query);
|
2009-08-04 12:29:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
static gboolean
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_sub_parse_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2005-12-12 09:52:37 +00:00
|
|
|
{
|
2011-11-17 11:48:25 +00:00
|
|
|
GstSubParse *self = GST_SUBPARSE (parent);
|
2005-12-12 09:52:37 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
GST_DEBUG ("Handling %s event", GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
{
|
|
|
|
GstFormat format;
|
2011-05-16 11:48:11 +00:00
|
|
|
GstSeekFlags flags;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
GstSeekType start_type, stop_type;
|
|
|
|
gint64 start, stop;
|
|
|
|
gdouble rate;
|
|
|
|
gboolean update;
|
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags,
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
&start_type, &start, &stop_type, &stop);
|
|
|
|
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_WARNING_OBJECT (self, "we only support seeking in TIME format");
|
|
|
|
gst_event_unref (event);
|
|
|
|
goto beach;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert that seek to a seeking in bytes at position 0,
|
|
|
|
FIXME: could use an index */
|
|
|
|
ret = gst_pad_push_event (self->sinkpad,
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, 0));
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
/* Apply the seek to our segment */
|
2011-05-16 11:48:11 +00:00
|
|
|
gst_segment_do_seek (&self->segment, rate, format, flags,
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
start_type, start, stop_type, stop, &update);
|
|
|
|
|
2007-03-09 16:28:04 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "segment after seek: %" GST_SEGMENT_FORMAT,
|
|
|
|
&self->segment);
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
|
2017-06-24 20:03:21 +00:00
|
|
|
/* will mark need_segment when receiving segment from upstream,
|
|
|
|
* after FLUSH and all that has happened,
|
|
|
|
* rather than racing with chain */
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (self, "seek to 0 bytes failed");
|
|
|
|
}
|
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
}
|
2005-12-12 09:52:37 +00:00
|
|
|
default:
|
2011-11-17 11:48:25 +00:00
|
|
|
ret = gst_pad_event_default (pad, parent, event);
|
2005-12-12 09:52:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
beach:
|
2005-12-12 09:52:37 +00:00
|
|
|
return ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2006-05-17 17:49:10 +00:00
|
|
|
static void
|
|
|
|
gst_sub_parse_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstSubParse *subparse = GST_SUBPARSE (object);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (subparse);
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_ENCODING:
|
|
|
|
g_free (subparse->encoding);
|
|
|
|
subparse->encoding = g_value_dup_string (value);
|
gst/playback/gstplaybasebin.*: Add 'subtitle-encoding' property to playbin, so applications can force a subtitle enco...
Original commit message from CVS:
Patch by: Young-Ho Cha <ganadist at chollian net>
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_class_init),
(gst_play_base_bin_init), (gst_play_base_bin_dispose),
(set_encoding_element), (decodebin_element_added_cb),
(decodebin_element_removed_cb), (setup_subtitle), (setup_source),
(gst_play_base_bin_set_property), (gst_play_base_bin_get_property):
* gst/playback/gstplaybasebin.h:
Add 'subtitle-encoding' property to playbin, so applications can
force a subtitle encoding for non-UTF8 subtitles (#342268).
* gst/subparse/gstsubparse.c: (gst_sub_parse_class_init),
(gst_sub_parse_set_property):
Rename recently-added 'encoding' property to 'subtitle-encoding'
(so it can be proxied by playbin/decodebin in a generic way
with less danger of false positives).
2006-05-29 13:21:00 +00:00
|
|
|
GST_LOG_OBJECT (object, "subtitle encoding set to %s",
|
|
|
|
GST_STR_NULL (subparse->encoding));
|
2006-05-17 17:49:10 +00:00
|
|
|
break;
|
2009-11-07 10:08:19 +00:00
|
|
|
case PROP_VIDEOFPS:
|
|
|
|
{
|
2009-11-07 10:31:09 +00:00
|
|
|
subparse->fps_n = gst_value_get_fraction_numerator (value);
|
|
|
|
subparse->fps_d = gst_value_get_fraction_denominator (value);
|
|
|
|
GST_DEBUG_OBJECT (object, "video framerate set to %d/%d", subparse->fps_n,
|
|
|
|
subparse->fps_d);
|
|
|
|
|
|
|
|
if (!subparse->state.have_internal_fps) {
|
|
|
|
subparse->state.fps_n = subparse->fps_n;
|
|
|
|
subparse->state.fps_d = subparse->fps_d;
|
|
|
|
}
|
2009-11-07 10:08:19 +00:00
|
|
|
break;
|
|
|
|
}
|
2006-05-17 17:49:10 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (subparse);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_sub_parse_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstSubParse *subparse = GST_SUBPARSE (object);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (subparse);
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_ENCODING:
|
|
|
|
g_value_set_string (value, subparse->encoding);
|
|
|
|
break;
|
2009-11-07 10:08:19 +00:00
|
|
|
case PROP_VIDEOFPS:
|
2009-11-07 10:31:09 +00:00
|
|
|
gst_value_set_fraction (value, subparse->fps_n, subparse->fps_d);
|
2009-11-07 10:08:19 +00:00
|
|
|
break;
|
2006-05-17 17:49:10 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GST_OBJECT_UNLOCK (subparse);
|
|
|
|
}
|
|
|
|
|
2010-03-15 21:49:53 +00:00
|
|
|
static const gchar *
|
2009-06-11 21:32:28 +00:00
|
|
|
gst_sub_parse_get_format_description (GstSubParseFormat format)
|
|
|
|
{
|
|
|
|
switch (format) {
|
|
|
|
case GST_SUB_PARSE_FORMAT_MDVDSUB:
|
|
|
|
return "MicroDVD";
|
|
|
|
case GST_SUB_PARSE_FORMAT_SUBRIP:
|
|
|
|
return "SubRip";
|
|
|
|
case GST_SUB_PARSE_FORMAT_MPSUB:
|
|
|
|
return "MPSub";
|
|
|
|
case GST_SUB_PARSE_FORMAT_SAMI:
|
|
|
|
return "SAMI";
|
|
|
|
case GST_SUB_PARSE_FORMAT_TMPLAYER:
|
|
|
|
return "TMPlayer";
|
|
|
|
case GST_SUB_PARSE_FORMAT_MPL2:
|
|
|
|
return "MPL2";
|
|
|
|
case GST_SUB_PARSE_FORMAT_SUBVIEWER:
|
|
|
|
return "SubViewer";
|
2009-10-22 08:02:11 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_DKS:
|
|
|
|
return "DKS";
|
2016-03-07 12:29:43 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_VTT:
|
|
|
|
return "WebVTT";
|
2009-12-01 16:13:24 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
|
|
|
return "QTtext";
|
2013-12-18 14:24:02 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_LRC:
|
|
|
|
return "LRC";
|
2009-06-11 21:32:28 +00:00
|
|
|
default:
|
|
|
|
case GST_SUB_PARSE_FORMAT_UNKNOWN:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
static gchar *
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gst_convert_to_utf8 (const gchar * str, gsize len, const gchar * encoding,
|
|
|
|
gsize * consumed, GError ** err)
|
|
|
|
{
|
|
|
|
gchar *ret = NULL;
|
|
|
|
|
|
|
|
*consumed = 0;
|
2010-03-15 21:49:53 +00:00
|
|
|
/* The char cast is necessary in glib < 2.24 */
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
ret =
|
2010-03-15 21:49:53 +00:00
|
|
|
g_convert_with_fallback (str, len, "UTF-8", encoding, (char *) "*",
|
|
|
|
consumed, NULL, err);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
if (ret == NULL)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* + 3 to skip UTF-8 BOM if it was added */
|
|
|
|
len = strlen (ret);
|
|
|
|
if (len >= 3 && (guint8) ret[0] == 0xEF && (guint8) ret[1] == 0xBB
|
|
|
|
&& (guint8) ret[2] == 0xBF)
|
2013-11-21 15:19:47 +00:00
|
|
|
memmove (ret, ret + 3, len + 1 - 3);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
detect_encoding (const gchar * str, gsize len)
|
|
|
|
{
|
|
|
|
if (len >= 3 && (guint8) str[0] == 0xEF && (guint8) str[1] == 0xBB
|
|
|
|
&& (guint8) str[2] == 0xBF)
|
|
|
|
return g_strdup ("UTF-8");
|
|
|
|
|
|
|
|
if (len >= 2 && (guint8) str[0] == 0xFE && (guint8) str[1] == 0xFF)
|
|
|
|
return g_strdup ("UTF-16BE");
|
|
|
|
|
|
|
|
if (len >= 2 && (guint8) str[0] == 0xFF && (guint8) str[1] == 0xFE)
|
|
|
|
return g_strdup ("UTF-16LE");
|
|
|
|
|
|
|
|
if (len >= 4 && (guint8) str[0] == 0x00 && (guint8) str[1] == 0x00
|
|
|
|
&& (guint8) str[2] == 0xFE && (guint8) str[3] == 0xFF)
|
|
|
|
return g_strdup ("UTF-32BE");
|
|
|
|
|
|
|
|
if (len >= 4 && (guint8) str[0] == 0xFF && (guint8) str[1] == 0xFE
|
|
|
|
&& (guint8) str[2] == 0x00 && (guint8) str[3] == 0x00)
|
|
|
|
return g_strdup ("UTF-32LE");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
convert_encoding (GstSubParse * self, const gchar * str, gsize len,
|
|
|
|
gsize * consumed)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2006-03-24 17:57:39 +00:00
|
|
|
const gchar *encoding;
|
|
|
|
GError *err = NULL;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gchar *ret = NULL;
|
|
|
|
|
|
|
|
*consumed = 0;
|
|
|
|
|
|
|
|
/* First try any detected encoding */
|
|
|
|
if (self->detected_encoding) {
|
|
|
|
ret =
|
|
|
|
gst_convert_to_utf8 (str, len, self->detected_encoding, consumed, &err);
|
|
|
|
|
|
|
|
if (!err)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
GST_WARNING_OBJECT (self, "could not convert string from '%s' to UTF-8: %s",
|
2009-03-05 08:58:12 +00:00
|
|
|
self->detected_encoding, err->message);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
g_free (self->detected_encoding);
|
|
|
|
self->detected_encoding = NULL;
|
2015-08-19 12:19:05 +00:00
|
|
|
g_clear_error (&err);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
}
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
/* Otherwise check if it's UTF8 */
|
2006-03-24 17:57:39 +00:00
|
|
|
if (self->valid_utf8) {
|
|
|
|
if (g_utf8_validate (str, len, NULL)) {
|
|
|
|
GST_LOG_OBJECT (self, "valid UTF-8, no conversion needed");
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
*consumed = len;
|
2006-03-24 17:57:39 +00:00
|
|
|
return g_strndup (str, len);
|
|
|
|
}
|
|
|
|
GST_INFO_OBJECT (self, "invalid UTF-8!");
|
|
|
|
self->valid_utf8 = FALSE;
|
|
|
|
}
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* 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 15:34:09 +00:00
|
|
|
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
/* Else try fallback */
|
2006-05-17 17:49:10 +00:00
|
|
|
encoding = self->encoding;
|
|
|
|
if (encoding == NULL || *encoding == '\0') {
|
|
|
|
encoding = g_getenv ("GST_SUBTITLE_ENCODING");
|
|
|
|
}
|
2006-03-24 17:57:39 +00:00
|
|
|
if (encoding == NULL || *encoding == '\0') {
|
|
|
|
/* if local encoding is UTF-8 and no encoding specified
|
|
|
|
* via the environment variable, assume ISO-8859-15 */
|
|
|
|
if (g_get_charset (&encoding)) {
|
|
|
|
encoding = "ISO-8859-15";
|
|
|
|
}
|
|
|
|
}
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* 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 15:34:09 +00:00
|
|
|
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
ret = gst_convert_to_utf8 (str, len, encoding, consumed, &err);
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* 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 15:34:09 +00:00
|
|
|
|
2006-03-24 17:57:39 +00:00
|
|
|
if (err) {
|
|
|
|
GST_WARNING_OBJECT (self, "could not convert string from '%s' to UTF-8: %s",
|
|
|
|
encoding, err->message);
|
2015-08-19 12:19:05 +00:00
|
|
|
g_clear_error (&err);
|
2006-03-24 17:57:39 +00:00
|
|
|
|
|
|
|
/* invalid input encoding, fall back to ISO-8859-15 (always succeeds) */
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
ret = gst_convert_to_utf8 (str, len, "ISO-8859-15", consumed, NULL);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
2006-03-24 17:57:39 +00:00
|
|
|
|
2006-11-14 11:54:14 +00:00
|
|
|
GST_LOG_OBJECT (self,
|
|
|
|
"successfully converted %" G_GSIZE_FORMAT " characters from %s to UTF-8"
|
2006-03-24 17:57:39 +00:00
|
|
|
"%s", len, encoding, (err) ? " , using ISO-8859-15 as fallback" : "");
|
|
|
|
|
|
|
|
return ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2005-12-01 01:12:55 +00:00
|
|
|
get_next_line (GstSubParse * self)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-05-06 03:32:51 +00:00
|
|
|
char *line = NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
const char *line_end;
|
|
|
|
int line_len;
|
|
|
|
gboolean have_r = FALSE;
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
line_end = strchr (self->textbuf->str, '\n');
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
if (!line_end) {
|
|
|
|
/* end-of-line not found; return for more data */
|
|
|
|
return NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
/* get rid of '\r' */
|
2005-05-06 03:32:51 +00:00
|
|
|
if (line_end != self->textbuf->str && *(line_end - 1) == '\r') {
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
line_end--;
|
|
|
|
have_r = TRUE;
|
|
|
|
}
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
line_len = line_end - self->textbuf->str;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
line = g_strndup (self->textbuf->str, line_len);
|
2005-05-06 03:32:51 +00:00
|
|
|
self->textbuf = g_string_erase (self->textbuf, 0,
|
|
|
|
line_len + (have_r ? 2 : 1));
|
|
|
|
return line;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2005-05-06 03:32:51 +00:00
|
|
|
parse_mdvdsub (ParserState * state, const gchar * line)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-05-06 03:32:51 +00:00
|
|
|
const gchar *line_split;
|
|
|
|
gchar *line_chunk;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
guint start_frame, end_frame;
|
2011-05-16 11:48:11 +00:00
|
|
|
guint64 clip_start = 0, clip_stop = 0;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
gboolean in_seg = FALSE;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
GString *markup;
|
2005-05-06 03:32:51 +00:00
|
|
|
gchar *ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
|
|
|
/* style variables */
|
|
|
|
gboolean italic;
|
|
|
|
gboolean bold;
|
|
|
|
guint fontsize;
|
2009-11-07 10:31:09 +00:00
|
|
|
gdouble fps = 0.0;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
|
|
|
if (sscanf (line, "{%u}{%u}", &start_frame, &end_frame) != 2) {
|
|
|
|
g_warning ("Parse of the following line, assumed to be in microdvd .sub"
|
|
|
|
" format, failed:\n%s", line);
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
|
2007-01-08 12:30:03 +00:00
|
|
|
/* skip the {%u}{%u} part */
|
|
|
|
line = strchr (line, '}') + 1;
|
|
|
|
line = strchr (line, '}') + 1;
|
|
|
|
|
|
|
|
/* see if there's a first line with a framerate */
|
2009-11-07 10:31:09 +00:00
|
|
|
if (start_frame == 1 && end_frame == 1) {
|
2007-01-08 12:30:03 +00:00
|
|
|
gchar *rest, *end = NULL;
|
|
|
|
|
|
|
|
rest = g_strdup (line);
|
|
|
|
g_strdelimit (rest, ",", '.');
|
2009-11-07 10:31:09 +00:00
|
|
|
fps = g_ascii_strtod (rest, &end);
|
|
|
|
if (end != rest) {
|
2009-11-16 08:57:56 +00:00
|
|
|
gst_util_double_to_fraction (fps, &state->fps_n, &state->fps_d);
|
|
|
|
GST_INFO ("framerate from file: %d/%d ('%s')", state->fps_n,
|
|
|
|
state->fps_d, rest);
|
2009-11-07 10:31:09 +00:00
|
|
|
}
|
2007-01-08 12:30:03 +00:00
|
|
|
g_free (rest);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-11-07 10:31:09 +00:00
|
|
|
state->start_time =
|
|
|
|
gst_util_uint64_scale (start_frame, GST_SECOND * state->fps_d,
|
|
|
|
state->fps_n);
|
|
|
|
state->duration =
|
|
|
|
gst_util_uint64_scale (end_frame - start_frame, GST_SECOND * state->fps_d,
|
|
|
|
state->fps_n);
|
2005-05-06 03:32:51 +00:00
|
|
|
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
/* Check our segment start/stop */
|
|
|
|
in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
|
|
|
|
state->start_time, state->start_time + state->duration, &clip_start,
|
|
|
|
&clip_stop);
|
|
|
|
|
|
|
|
/* No need to parse that text if it's out of segment */
|
|
|
|
if (in_seg) {
|
|
|
|
state->start_time = clip_start;
|
|
|
|
state->duration = clip_stop - clip_start;
|
|
|
|
} else {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
markup = g_string_new (NULL);
|
|
|
|
while (1) {
|
|
|
|
italic = FALSE;
|
|
|
|
bold = FALSE;
|
|
|
|
fontsize = 0;
|
|
|
|
/* parse style markup */
|
|
|
|
if (strncmp (line, "{y:i}", 5) == 0) {
|
|
|
|
italic = TRUE;
|
|
|
|
line = strchr (line, '}') + 1;
|
|
|
|
}
|
|
|
|
if (strncmp (line, "{y:b}", 5) == 0) {
|
|
|
|
bold = TRUE;
|
|
|
|
line = strchr (line, '}') + 1;
|
|
|
|
}
|
|
|
|
if (sscanf (line, "{s:%u}", &fontsize) == 1) {
|
|
|
|
line = strchr (line, '}') + 1;
|
|
|
|
}
|
2008-02-23 09:51:26 +00:00
|
|
|
/* forward slashes at beginning/end signify italics too */
|
|
|
|
if (g_str_has_prefix (line, "/")) {
|
|
|
|
italic = TRUE;
|
|
|
|
++line;
|
|
|
|
}
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
if ((line_split = strchr (line, '|')))
|
|
|
|
line_chunk = g_markup_escape_text (line, line_split - line);
|
|
|
|
else
|
|
|
|
line_chunk = g_markup_escape_text (line, strlen (line));
|
2008-02-23 09:51:26 +00:00
|
|
|
|
|
|
|
/* Remove italics markers at end of line/stanza (CHECKME: are end slashes
|
|
|
|
* always at the end of a line or can they span multiple lines?) */
|
|
|
|
if (g_str_has_suffix (line_chunk, "/")) {
|
|
|
|
line_chunk[strlen (line_chunk) - 1] = '\0';
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
markup = g_string_append (markup, "<span");
|
|
|
|
if (italic)
|
|
|
|
g_string_append (markup, " style=\"italic\"");
|
|
|
|
if (bold)
|
|
|
|
g_string_append (markup, " weight=\"bold\"");
|
|
|
|
if (fontsize)
|
|
|
|
g_string_append_printf (markup, " size=\"%u\"", fontsize * 1000);
|
|
|
|
g_string_append_printf (markup, ">%s</span>", line_chunk);
|
|
|
|
g_free (line_chunk);
|
|
|
|
if (line_split) {
|
|
|
|
g_string_append (markup, "\n");
|
|
|
|
line = line_split + 1;
|
2005-05-06 03:32:51 +00:00
|
|
|
} else {
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
break;
|
2005-05-06 03:32:51 +00:00
|
|
|
}
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
ret = markup->str;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
g_string_free (markup, FALSE);
|
2005-05-06 03:32:51 +00:00
|
|
|
GST_DEBUG ("parse_mdvdsub returning (%f+%f): %s",
|
|
|
|
state->start_time / (double) GST_SECOND,
|
|
|
|
state->duration / (double) GST_SECOND, ret);
|
|
|
|
return ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2006-10-19 09:00:21 +00:00
|
|
|
static void
|
|
|
|
strip_trailing_newlines (gchar * txt)
|
|
|
|
{
|
|
|
|
if (txt) {
|
|
|
|
guint len;
|
|
|
|
|
|
|
|
len = strlen (txt);
|
|
|
|
while (len > 1 && txt[len - 1] == '\n') {
|
|
|
|
txt[len - 1] = '\0';
|
|
|
|
--len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-20 18:27:06 +00:00
|
|
|
/* we want to escape text in general, but retain basic markup like
|
|
|
|
* <i></i>, <u></u>, and <b></b>. The easiest and safest way is to
|
|
|
|
* just unescape a white list of allowed markups again after
|
|
|
|
* escaping everything (the text between these simple markers isn't
|
|
|
|
* necessarily escaped, so it seems best to do it like this) */
|
|
|
|
static void
|
2016-03-07 12:29:43 +00:00
|
|
|
subrip_unescape_formatting (gchar * txt, gconstpointer allowed_tags_ptr,
|
|
|
|
gboolean allows_tag_attributes)
|
2006-02-20 18:27:06 +00:00
|
|
|
{
|
2016-03-07 12:29:43 +00:00
|
|
|
gchar *res;
|
|
|
|
GRegex *tag_regex;
|
|
|
|
gchar *allowed_tags_pattern, *search_pattern;
|
|
|
|
const gchar *replace_pattern;
|
2006-02-20 18:27:06 +00:00
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
/* No processing needed if no escaped tag marker found in the string. */
|
|
|
|
if (strstr (txt, "<") == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Build a list of alternates for our regexp.
|
|
|
|
* FIXME: Could be built once and stored */
|
|
|
|
allowed_tags_pattern = g_strjoinv ("|", (gchar **) allowed_tags_ptr);
|
|
|
|
/* Look for starting/ending escaped tags with optional attributes. */
|
|
|
|
search_pattern = g_strdup_printf ("<(/)?\\ *(%s)(%s)>",
|
|
|
|
allowed_tags_pattern, ATTRIBUTE_REGEX);
|
|
|
|
/* And unescape appropriately */
|
|
|
|
if (allows_tag_attributes) {
|
|
|
|
replace_pattern = "<\\1\\2\\3>";
|
|
|
|
} else {
|
|
|
|
replace_pattern = "<\\1\\2>";
|
2006-02-20 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
tag_regex = g_regex_new (search_pattern, 0, 0, NULL);
|
|
|
|
res = g_regex_replace (tag_regex, txt, strlen (txt), 0,
|
|
|
|
replace_pattern, 0, NULL);
|
2015-09-30 17:17:13 +00:00
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
/* res will always be shorter than the input or identical, so this
|
|
|
|
* copy is OK */
|
|
|
|
strcpy (txt, res);
|
|
|
|
|
|
|
|
g_free (res);
|
|
|
|
g_free (search_pattern);
|
|
|
|
g_free (allowed_tags_pattern);
|
2016-07-19 12:26:06 +00:00
|
|
|
|
|
|
|
g_regex_unref (tag_regex);
|
2006-02-20 18:27:06 +00:00
|
|
|
}
|
|
|
|
|
2007-02-10 18:19:37 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
subrip_remove_unhandled_tag (gchar * start, gchar * stop)
|
|
|
|
{
|
|
|
|
gchar *tag, saved;
|
|
|
|
|
|
|
|
tag = start + strlen ("<");
|
|
|
|
if (*tag == '/')
|
|
|
|
++tag;
|
|
|
|
|
|
|
|
if (g_ascii_tolower (*tag) < 'a' || g_ascii_tolower (*tag) > 'z')
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
saved = *stop;
|
|
|
|
*stop = '\0';
|
|
|
|
GST_LOG ("removing unhandled tag '%s'", start);
|
|
|
|
*stop = saved;
|
2013-11-21 15:19:47 +00:00
|
|
|
memmove (start, stop, strlen (stop) + 1);
|
2007-02-10 18:19:37 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove tags we haven't explicitly allowed earlier on, like font tags
|
|
|
|
* for example */
|
|
|
|
static void
|
|
|
|
subrip_remove_unhandled_tags (gchar * txt)
|
|
|
|
{
|
|
|
|
gchar *pos, *gt;
|
|
|
|
|
|
|
|
for (pos = txt; pos != NULL && *pos != '\0'; ++pos) {
|
|
|
|
if (strncmp (pos, "<", 4) == 0 && (gt = strstr (pos + 4, ">"))) {
|
|
|
|
if (subrip_remove_unhandled_tag (pos, gt + strlen (">")))
|
|
|
|
--pos;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
/* we only allow a fixed set of tags like <i>, <u> and <b>, so let's
|
|
|
|
* take a simple approach. This code assumes the input has been
|
|
|
|
* escaped and subrip_unescape_formatting() has then been run over the
|
|
|
|
* input! This function adds missing closing markup tags and removes
|
|
|
|
* broken closing tags for tags that have never been opened. */
|
2006-10-20 17:02:19 +00:00
|
|
|
static void
|
2016-03-07 12:29:43 +00:00
|
|
|
subrip_fix_up_markup (gchar ** p_txt, gconstpointer allowed_tags_ptr)
|
2006-10-20 17:02:19 +00:00
|
|
|
{
|
|
|
|
gchar *cur, *next_tag;
|
2018-05-12 12:53:02 +00:00
|
|
|
GPtrArray *open_tags = NULL;
|
2006-10-20 17:02:19 +00:00
|
|
|
guint num_open_tags = 0;
|
2016-03-07 12:29:43 +00:00
|
|
|
const gchar *iter_tag;
|
|
|
|
guint offset = 0;
|
|
|
|
guint index;
|
|
|
|
gchar *cur_tag;
|
|
|
|
gchar *end_tag;
|
|
|
|
GRegex *tag_regex;
|
|
|
|
GMatchInfo *match_info;
|
|
|
|
gchar **allowed_tags = (gchar **) allowed_tags_ptr;
|
2006-10-20 17:02:19 +00:00
|
|
|
|
|
|
|
g_assert (*p_txt != NULL);
|
|
|
|
|
2018-05-12 12:53:02 +00:00
|
|
|
open_tags = g_ptr_array_new_with_free_func (g_free);
|
2006-10-20 17:02:19 +00:00
|
|
|
cur = *p_txt;
|
|
|
|
while (*cur != '\0') {
|
|
|
|
next_tag = strchr (cur, '<');
|
|
|
|
if (next_tag == NULL)
|
|
|
|
break;
|
2016-03-07 12:29:43 +00:00
|
|
|
offset = 0;
|
|
|
|
index = 0;
|
|
|
|
while (index < g_strv_length (allowed_tags)) {
|
|
|
|
iter_tag = allowed_tags[index];
|
|
|
|
/* Look for a white listed tag */
|
|
|
|
cur_tag = g_strconcat ("<", iter_tag, ATTRIBUTE_REGEX, ">", NULL);
|
|
|
|
tag_regex = g_regex_new (cur_tag, 0, 0, NULL);
|
2016-03-29 11:16:38 +00:00
|
|
|
(void) g_regex_match (tag_regex, next_tag, 0, &match_info);
|
2016-03-07 12:29:43 +00:00
|
|
|
|
|
|
|
if (g_match_info_matches (match_info)) {
|
|
|
|
gint start_pos, end_pos;
|
|
|
|
gchar *word = g_match_info_fetch (match_info, 0);
|
|
|
|
g_match_info_fetch_pos (match_info, 0, &start_pos, &end_pos);
|
|
|
|
if (start_pos == 0) {
|
|
|
|
offset = strlen (word);
|
2006-10-20 17:02:19 +00:00
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
g_free (word);
|
2006-10-20 17:02:19 +00:00
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
g_match_info_free (match_info);
|
|
|
|
g_regex_unref (tag_regex);
|
|
|
|
g_free (cur_tag);
|
|
|
|
index++;
|
|
|
|
if (offset) {
|
|
|
|
/* OK we found a tag, let's keep track of it */
|
2018-05-12 12:53:02 +00:00
|
|
|
g_ptr_array_add (open_tags, g_ascii_strdown (iter_tag, -1));
|
2006-10-20 17:02:19 +00:00
|
|
|
++num_open_tags;
|
|
|
|
break;
|
2016-03-07 12:29:43 +00:00
|
|
|
}
|
2006-10-20 17:02:19 +00:00
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
|
|
|
|
if (offset) {
|
|
|
|
next_tag += offset;
|
|
|
|
cur = next_tag;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*next_tag == '<' && *(next_tag + 1) == '/') {
|
|
|
|
end_tag = strchr (cur, '>');
|
2016-03-29 11:16:38 +00:00
|
|
|
if (end_tag) {
|
2018-05-30 09:39:40 +00:00
|
|
|
const gchar *last = NULL;
|
|
|
|
if (num_open_tags > 0)
|
|
|
|
last = g_ptr_array_index (open_tags, num_open_tags - 1);
|
2016-03-29 11:16:38 +00:00
|
|
|
if (num_open_tags == 0
|
2018-05-12 12:53:02 +00:00
|
|
|
|| g_ascii_strncasecmp (end_tag - 1, last, strlen (last))) {
|
|
|
|
GST_LOG ("broken input, closing tag '%s' is not open", end_tag - 1);
|
2016-03-29 11:16:38 +00:00
|
|
|
memmove (next_tag, end_tag + 1, strlen (end_tag) + 1);
|
|
|
|
next_tag -= strlen (end_tag);
|
|
|
|
} else {
|
|
|
|
--num_open_tags;
|
2018-05-12 12:53:02 +00:00
|
|
|
g_ptr_array_remove_index (open_tags, num_open_tags);
|
2016-03-29 11:16:38 +00:00
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
++next_tag;
|
2006-10-20 17:02:19 +00:00
|
|
|
cur = next_tag;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num_open_tags > 0) {
|
|
|
|
GString *s;
|
|
|
|
|
|
|
|
s = g_string_new (*p_txt);
|
|
|
|
while (num_open_tags > 0) {
|
2018-05-12 16:19:50 +00:00
|
|
|
GST_LOG ("adding missing closing tag '%s'",
|
|
|
|
(char *) g_ptr_array_index (open_tags, num_open_tags - 1));
|
2006-10-20 17:02:19 +00:00
|
|
|
g_string_append_c (s, '<');
|
|
|
|
g_string_append_c (s, '/');
|
2018-05-12 12:53:02 +00:00
|
|
|
g_string_append (s, g_ptr_array_index (open_tags, num_open_tags - 1));
|
2006-10-20 17:02:19 +00:00
|
|
|
g_string_append_c (s, '>');
|
|
|
|
--num_open_tags;
|
|
|
|
}
|
|
|
|
g_free (*p_txt);
|
|
|
|
*p_txt = g_string_free (s, FALSE);
|
|
|
|
}
|
2018-05-12 12:53:02 +00:00
|
|
|
g_ptr_array_free (open_tags, TRUE);
|
2006-10-20 17:02:19 +00:00
|
|
|
}
|
|
|
|
|
2009-06-10 13:37:36 +00:00
|
|
|
static gboolean
|
|
|
|
parse_subrip_time (const gchar * ts_string, GstClockTime * t)
|
|
|
|
{
|
|
|
|
gchar s[128] = { '\0', };
|
|
|
|
gchar *end, *p;
|
|
|
|
guint hour, min, sec, msec, len;
|
|
|
|
|
|
|
|
while (*ts_string == ' ')
|
|
|
|
++ts_string;
|
|
|
|
|
|
|
|
g_strlcpy (s, ts_string, sizeof (s));
|
|
|
|
if ((end = strstr (s, "-->")))
|
|
|
|
*end = '\0';
|
|
|
|
g_strchomp (s);
|
|
|
|
|
|
|
|
/* ms may be in these formats:
|
|
|
|
* hh:mm:ss,500 = 500ms
|
|
|
|
* hh:mm:ss, 5 = 5ms
|
|
|
|
* hh:mm:ss, 5 = 50ms
|
|
|
|
* hh:mm:ss, 50 = 50ms
|
|
|
|
* hh:mm:ss,5 = 500ms
|
2009-08-09 10:13:16 +00:00
|
|
|
* and the same with . instead of ,.
|
|
|
|
* sscanf() doesn't differentiate between ' 5' and '5' so munge
|
2009-06-10 13:37:36 +00:00
|
|
|
* the white spaces within the timestamp to '0' (I'm sure there's a
|
|
|
|
* way to make sscanf() do this for us, but how?)
|
|
|
|
*/
|
|
|
|
g_strdelimit (s, " ", '0');
|
2009-08-09 10:13:16 +00:00
|
|
|
g_strdelimit (s, ".", ',');
|
2009-06-10 13:37:36 +00:00
|
|
|
|
|
|
|
/* make sure we have exactly three digits after he comma */
|
|
|
|
p = strchr (s, ',');
|
2019-01-11 15:43:03 +00:00
|
|
|
if (p == NULL) {
|
|
|
|
/* If there isn't a ',' the timestamp is broken */
|
|
|
|
/* https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/532#note_100179 */
|
|
|
|
GST_WARNING ("failed to parse subrip timestamp string '%s'", s);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-06-10 13:37:36 +00:00
|
|
|
++p;
|
|
|
|
len = strlen (p);
|
|
|
|
if (len > 3) {
|
|
|
|
p[3] = '\0';
|
|
|
|
} else
|
|
|
|
while (len < 3) {
|
|
|
|
g_strlcat (&p[len], "0", 2);
|
|
|
|
++len;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_LOG ("parsing timestamp '%s'", s);
|
|
|
|
if (sscanf (s, "%u:%u:%u,%u", &hour, &min, &sec, &msec) != 4) {
|
2020-03-11 00:01:34 +00:00
|
|
|
/* https://www.w3.org/TR/webvtt1/#webvtt-timestamp
|
|
|
|
*
|
|
|
|
* The hours component is optional with webVTT, for example
|
|
|
|
* mm:ss,500 is a valid webVTT timestamp. When not present,
|
|
|
|
* hours is 0.
|
|
|
|
*/
|
|
|
|
hour = 0;
|
|
|
|
|
|
|
|
if (sscanf (s, "%u:%u,%u", &min, &sec, &msec) != 3) {
|
|
|
|
GST_WARNING ("failed to parse subrip timestamp string '%s'", s);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-06-10 13:37:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
*t = ((hour * 3600) + (min * 60) + sec) * GST_SECOND + msec * GST_MSECOND;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
/* cue settings are part of the WebVTT specification. They are
|
|
|
|
* declared after the time interval in the first line of the
|
|
|
|
* cue. Example: 00:00:01,000 --> 00:00:02,000 D:vertical-lr A:start
|
|
|
|
* See also http://www.whatwg.org/specs/web-apps/current-work/webvtt.html
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
parse_webvtt_cue_settings (ParserState * state, const gchar * settings)
|
|
|
|
{
|
|
|
|
gchar **splitted_settings = g_strsplit_set (settings, " \t", -1);
|
|
|
|
gint i = 0;
|
|
|
|
gint16 text_position, text_size;
|
|
|
|
gint16 line_position;
|
|
|
|
gboolean vertical_found = FALSE;
|
|
|
|
gboolean alignment_found = FALSE;
|
|
|
|
|
|
|
|
while (i < g_strv_length (splitted_settings)) {
|
2016-03-29 11:16:38 +00:00
|
|
|
gboolean valid_tag = FALSE;
|
2016-03-07 12:29:43 +00:00
|
|
|
switch (splitted_settings[i][0]) {
|
|
|
|
case 'T':
|
2016-03-29 11:16:38 +00:00
|
|
|
if (sscanf (splitted_settings[i], "T:%" G_GINT16_FORMAT "%%",
|
|
|
|
&text_position) > 0) {
|
|
|
|
state->text_position = (guint8) text_position;
|
|
|
|
valid_tag = TRUE;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
break;
|
|
|
|
case 'D':
|
2016-03-29 11:16:38 +00:00
|
|
|
if (strlen (splitted_settings[i]) > 2) {
|
|
|
|
vertical_found = TRUE;
|
2016-07-19 12:26:06 +00:00
|
|
|
g_free (state->vertical);
|
2016-03-29 11:16:38 +00:00
|
|
|
state->vertical = g_strdup (splitted_settings[i] + 2);
|
|
|
|
valid_tag = TRUE;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
break;
|
|
|
|
case 'L':
|
|
|
|
if (g_str_has_suffix (splitted_settings[i], "%")) {
|
2016-03-29 11:16:38 +00:00
|
|
|
if (sscanf (splitted_settings[i], "L:%" G_GINT16_FORMAT "%%",
|
|
|
|
&line_position) > 0) {
|
|
|
|
state->line_position = line_position;
|
|
|
|
valid_tag = TRUE;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
} else {
|
2016-03-29 11:16:38 +00:00
|
|
|
if (sscanf (splitted_settings[i], "L:%" G_GINT16_FORMAT,
|
|
|
|
&line_position) > 0) {
|
|
|
|
state->line_number = line_position;
|
|
|
|
valid_tag = TRUE;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'S':
|
2016-03-29 11:16:38 +00:00
|
|
|
if (sscanf (splitted_settings[i], "S:%" G_GINT16_FORMAT "%%",
|
|
|
|
&text_size) > 0) {
|
|
|
|
state->text_size = (guint8) text_size;
|
|
|
|
valid_tag = TRUE;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
break;
|
|
|
|
case 'A':
|
2016-03-29 11:16:38 +00:00
|
|
|
if (strlen (splitted_settings[i]) > 2) {
|
2016-07-19 12:26:06 +00:00
|
|
|
g_free (state->alignment);
|
2016-03-29 11:16:38 +00:00
|
|
|
state->alignment = g_strdup (splitted_settings[i] + 2);
|
|
|
|
alignment_found = TRUE;
|
|
|
|
valid_tag = TRUE;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-03-29 11:16:38 +00:00
|
|
|
if (!valid_tag) {
|
|
|
|
GST_LOG ("Invalid or unrecognised setting found: %s",
|
|
|
|
splitted_settings[i]);
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
g_strfreev (splitted_settings);
|
2016-07-19 12:26:06 +00:00
|
|
|
if (!vertical_found) {
|
|
|
|
g_free (state->vertical);
|
2016-03-07 12:29:43 +00:00
|
|
|
state->vertical = g_strdup ("");
|
2016-07-19 12:26:06 +00:00
|
|
|
}
|
|
|
|
if (!alignment_found) {
|
|
|
|
g_free (state->alignment);
|
2016-03-07 12:29:43 +00:00
|
|
|
state->alignment = g_strdup ("");
|
2016-07-19 12:26:06 +00:00
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
static gchar *
|
2005-05-06 03:32:51 +00:00
|
|
|
parse_subrip (ParserState * state, const gchar * line)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-05-06 03:32:51 +00:00
|
|
|
gchar *ret;
|
|
|
|
|
|
|
|
switch (state->state) {
|
2016-04-06 11:00:10 +00:00
|
|
|
case 0:{
|
|
|
|
char *endptr;
|
2016-04-15 11:54:32 +00:00
|
|
|
guint64 id;
|
2016-04-06 11:00:10 +00:00
|
|
|
|
|
|
|
/* looking for a single integer as a Cue ID, but we
|
|
|
|
* don't actually use it */
|
2016-04-15 11:54:32 +00:00
|
|
|
errno = 0;
|
|
|
|
id = g_ascii_strtoull (line, &endptr, 10);
|
|
|
|
if (id == G_MAXUINT64 && errno == ERANGE)
|
|
|
|
state->state = 1;
|
|
|
|
else if (id == 0 && errno == EINVAL)
|
|
|
|
state->state = 1;
|
|
|
|
else if (endptr != line && *endptr == '\0')
|
2005-05-06 03:32:51 +00:00
|
|
|
state->state = 1;
|
|
|
|
return NULL;
|
2016-04-06 11:00:10 +00:00
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
case 1:
|
2009-06-10 13:37:36 +00:00
|
|
|
{
|
|
|
|
GstClockTime ts_start, ts_end;
|
|
|
|
gchar *end_time;
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
/* looking for start_time --> end_time */
|
2009-06-10 13:37:36 +00:00
|
|
|
if ((end_time = strstr (line, " --> ")) &&
|
|
|
|
parse_subrip_time (line, &ts_start) &&
|
|
|
|
parse_subrip_time (end_time + strlen (" --> "), &ts_end) &&
|
|
|
|
state->start_time <= ts_end) {
|
2005-05-06 03:32:51 +00:00
|
|
|
state->state = 2;
|
2009-06-10 13:37:36 +00:00
|
|
|
state->start_time = ts_start;
|
|
|
|
state->duration = ts_end - ts_start;
|
2005-05-06 03:32:51 +00:00
|
|
|
} else {
|
2009-06-10 13:37:36 +00:00
|
|
|
GST_DEBUG ("error parsing subrip time line '%s'", line);
|
2005-05-06 03:32:51 +00:00
|
|
|
state->state = 0;
|
|
|
|
}
|
|
|
|
return NULL;
|
2009-06-10 13:37:36 +00:00
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
case 2:
|
2007-06-05 21:36:11 +00:00
|
|
|
{
|
|
|
|
/* No need to parse that text if it's out of segment */
|
2011-05-16 11:48:11 +00:00
|
|
|
guint64 clip_start = 0, clip_stop = 0;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
gboolean in_seg = FALSE;
|
|
|
|
|
|
|
|
/* Check our segment start/stop */
|
|
|
|
in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
|
|
|
|
state->start_time, state->start_time + state->duration,
|
|
|
|
&clip_start, &clip_stop);
|
|
|
|
|
|
|
|
if (in_seg) {
|
|
|
|
state->start_time = clip_start;
|
|
|
|
state->duration = clip_stop - clip_start;
|
|
|
|
} else {
|
|
|
|
state->state = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 21:36:11 +00:00
|
|
|
/* looking for subtitle text; empty line ends this subtitle entry */
|
2005-05-06 03:32:51 +00:00
|
|
|
if (state->buf->len)
|
|
|
|
g_string_append_c (state->buf, '\n');
|
|
|
|
g_string_append (state->buf, line);
|
|
|
|
if (strlen (line) == 0) {
|
|
|
|
ret = g_markup_escape_text (state->buf->str, state->buf->len);
|
|
|
|
g_string_truncate (state->buf, 0);
|
|
|
|
state->state = 0;
|
2016-03-07 12:29:43 +00:00
|
|
|
subrip_unescape_formatting (ret, state->allowed_tags,
|
|
|
|
state->allows_tag_attributes);
|
2007-02-10 18:19:37 +00:00
|
|
|
subrip_remove_unhandled_tags (ret);
|
2006-10-19 09:00:21 +00:00
|
|
|
strip_trailing_newlines (ret);
|
2016-03-07 12:29:43 +00:00
|
|
|
subrip_fix_up_markup (&ret, state->allowed_tags);
|
2005-05-06 03:32:51 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
default:
|
2005-12-12 09:52:37 +00:00
|
|
|
g_return_val_if_reached (NULL);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-18 14:24:02 +00:00
|
|
|
static gchar *
|
|
|
|
parse_lrc (ParserState * state, const gchar * line)
|
|
|
|
{
|
|
|
|
gint m, s, c;
|
|
|
|
const gchar *start;
|
|
|
|
gint milli;
|
|
|
|
|
|
|
|
if (line[0] != '[')
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (sscanf (line, "[%u:%02u.%03u]", &m, &s, &c) != 3 &&
|
|
|
|
sscanf (line, "[%u:%02u.%02u]", &m, &s, &c) != 3)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
start = strchr (line, ']');
|
|
|
|
if (start - line == 9)
|
|
|
|
milli = 10;
|
|
|
|
else
|
|
|
|
milli = 1;
|
|
|
|
|
|
|
|
state->start_time = gst_util_uint64_scale (m, 60 * GST_SECOND, 1)
|
|
|
|
+ gst_util_uint64_scale (s, GST_SECOND, 1)
|
|
|
|
+ gst_util_uint64_scale (c, milli * GST_MSECOND, 1);
|
|
|
|
state->duration = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
return g_strdup (start + 1);
|
|
|
|
}
|
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
/* WebVTT is a new subtitle format for the upcoming HTML5 video track
|
|
|
|
* element. This format is similar to Subrip, the biggest differences
|
|
|
|
* are that there can be cue settings detailing how to display the cue
|
|
|
|
* text and more markup tags are allowed.
|
|
|
|
* See also http://www.whatwg.org/specs/web-apps/current-work/webvtt.html
|
|
|
|
*/
|
|
|
|
static gchar *
|
|
|
|
parse_webvtt (ParserState * state, const gchar * line)
|
|
|
|
{
|
2016-04-06 11:00:10 +00:00
|
|
|
/* Cue IDs are optional in WebVTT, but not in subrip,
|
|
|
|
* so when in state 0 (cue ID), also check if we're
|
|
|
|
* already at the start --> end time marker */
|
|
|
|
if (state->state == 0 || state->state == 1) {
|
2016-03-07 12:29:43 +00:00
|
|
|
GstClockTime ts_start, ts_end;
|
|
|
|
gchar *end_time;
|
|
|
|
gchar *cue_settings = NULL;
|
|
|
|
|
|
|
|
/* looking for start_time --> end_time */
|
|
|
|
if ((end_time = strstr (line, " --> ")) &&
|
|
|
|
parse_subrip_time (line, &ts_start) &&
|
|
|
|
parse_subrip_time (end_time + strlen (" --> "), &ts_end) &&
|
|
|
|
state->start_time <= ts_end) {
|
|
|
|
state->state = 2;
|
|
|
|
state->start_time = ts_start;
|
|
|
|
state->duration = ts_end - ts_start;
|
|
|
|
cue_settings = strstr (end_time + strlen (" --> "), " ");
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("error parsing subrip time line '%s'", line);
|
|
|
|
state->state = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
state->text_position = 0;
|
|
|
|
state->text_size = 0;
|
|
|
|
state->line_position = 0;
|
|
|
|
state->line_number = 0;
|
|
|
|
|
|
|
|
if (cue_settings)
|
|
|
|
parse_webvtt_cue_settings (state, cue_settings + 1);
|
|
|
|
else {
|
2016-07-19 12:26:06 +00:00
|
|
|
g_free (state->vertical);
|
2016-03-07 12:29:43 +00:00
|
|
|
state->vertical = g_strdup ("");
|
2016-07-19 12:26:06 +00:00
|
|
|
g_free (state->alignment);
|
2016-03-07 12:29:43 +00:00
|
|
|
state->alignment = g_strdup ("");
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
} else
|
|
|
|
return parse_subrip (state, line);
|
|
|
|
}
|
|
|
|
|
2007-06-05 21:36:11 +00:00
|
|
|
static void
|
2009-10-22 08:02:11 +00:00
|
|
|
unescape_newlines_br (gchar * read)
|
2007-06-05 21:36:11 +00:00
|
|
|
{
|
|
|
|
gchar *write = read;
|
|
|
|
|
2019-08-29 17:42:39 +00:00
|
|
|
/* Replace all occurrences of '[br]' with a newline as version 2
|
2007-06-05 21:36:11 +00:00
|
|
|
* of the subviewer format uses this for newlines */
|
|
|
|
|
|
|
|
if (read[0] == '\0' || read[1] == '\0' || read[2] == '\0' || read[3] == '\0')
|
|
|
|
return;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if (strncmp (read, "[br]", 4) == 0) {
|
|
|
|
*write = '\n';
|
|
|
|
read += 4;
|
|
|
|
} else {
|
|
|
|
*write = *read;
|
|
|
|
read++;
|
|
|
|
}
|
|
|
|
write++;
|
|
|
|
} while (*read);
|
|
|
|
|
|
|
|
*write = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
parse_subviewer (ParserState * state, const gchar * line)
|
|
|
|
{
|
|
|
|
guint h1, m1, s1, ms1;
|
|
|
|
guint h2, m2, s2, ms2;
|
|
|
|
gchar *ret;
|
|
|
|
|
|
|
|
/* TODO: Maybe also parse the fields in the header, especially DELAY.
|
|
|
|
* For examples see the unit test or
|
|
|
|
* http://www.doom9.org/index.html?/sub.htm */
|
|
|
|
|
|
|
|
switch (state->state) {
|
|
|
|
case 0:
|
|
|
|
/* looking for start_time,end_time */
|
|
|
|
if (sscanf (line, "%u:%u:%u.%u,%u:%u:%u.%u",
|
|
|
|
&h1, &m1, &s1, &ms1, &h2, &m2, &s2, &ms2) == 8) {
|
|
|
|
state->state = 1;
|
|
|
|
state->start_time =
|
|
|
|
(((guint64) h1) * 3600 + m1 * 60 + s1) * GST_SECOND +
|
|
|
|
ms1 * GST_MSECOND;
|
|
|
|
state->duration =
|
|
|
|
(((guint64) h2) * 3600 + m2 * 60 + s2) * GST_SECOND +
|
|
|
|
ms2 * GST_MSECOND - state->start_time;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
/* No need to parse that text if it's out of segment */
|
2011-05-16 11:48:11 +00:00
|
|
|
guint64 clip_start = 0, clip_stop = 0;
|
2007-06-05 21:36:11 +00:00
|
|
|
gboolean in_seg = FALSE;
|
|
|
|
|
|
|
|
/* Check our segment start/stop */
|
|
|
|
in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
|
|
|
|
state->start_time, state->start_time + state->duration,
|
|
|
|
&clip_start, &clip_stop);
|
|
|
|
|
|
|
|
if (in_seg) {
|
|
|
|
state->start_time = clip_start;
|
|
|
|
state->duration = clip_stop - clip_start;
|
|
|
|
} else {
|
|
|
|
state->state = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* looking for subtitle text; empty line ends this subtitle entry */
|
|
|
|
if (state->buf->len)
|
|
|
|
g_string_append_c (state->buf, '\n');
|
|
|
|
g_string_append (state->buf, line);
|
|
|
|
if (strlen (line) == 0) {
|
|
|
|
ret = g_strdup (state->buf->str);
|
2009-10-22 08:02:11 +00:00
|
|
|
unescape_newlines_br (ret);
|
2007-06-05 21:36:11 +00:00
|
|
|
strip_trailing_newlines (ret);
|
|
|
|
g_string_truncate (state->buf, 0);
|
|
|
|
state->state = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
static gchar *
|
2005-05-06 03:32:51 +00:00
|
|
|
parse_mpsub (ParserState * state, const gchar * line)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-05-06 03:32:51 +00:00
|
|
|
gchar *ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
float t1, t2;
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
switch (state->state) {
|
|
|
|
case 0:
|
|
|
|
/* looking for two floats (offset, duration) */
|
|
|
|
if (sscanf (line, "%f %f", &t1, &t2) == 2) {
|
|
|
|
state->state = 1;
|
|
|
|
state->start_time += state->duration + GST_SECOND * t1;
|
|
|
|
state->duration = GST_SECOND * t2;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
case 1:
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
{ /* No need to parse that text if it's out of segment */
|
2011-05-16 11:48:11 +00:00
|
|
|
guint64 clip_start = 0, clip_stop = 0;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
gboolean in_seg = FALSE;
|
|
|
|
|
|
|
|
/* Check our segment start/stop */
|
|
|
|
in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
|
|
|
|
state->start_time, state->start_time + state->duration,
|
|
|
|
&clip_start, &clip_stop);
|
|
|
|
|
|
|
|
if (in_seg) {
|
|
|
|
state->start_time = clip_start;
|
|
|
|
state->duration = clip_stop - clip_start;
|
|
|
|
} else {
|
|
|
|
state->state = 0;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
/* looking for subtitle text; empty line ends this
|
|
|
|
* subtitle entry */
|
|
|
|
if (state->buf->len)
|
|
|
|
g_string_append_c (state->buf, '\n');
|
|
|
|
g_string_append (state->buf, line);
|
|
|
|
if (strlen (line) == 0) {
|
|
|
|
ret = g_strdup (state->buf->str);
|
|
|
|
g_string_truncate (state->buf, 0);
|
|
|
|
state->state = 0;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
2005-05-17 15:44:31 +00:00
|
|
|
return NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-22 08:02:11 +00:00
|
|
|
static const gchar *
|
|
|
|
dks_skip_timestamp (const gchar * line)
|
|
|
|
{
|
|
|
|
while (*line && *line != ']')
|
|
|
|
line++;
|
|
|
|
if (*line == ']')
|
|
|
|
line++;
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
parse_dks (ParserState * state, const gchar * line)
|
|
|
|
{
|
|
|
|
guint h, m, s;
|
|
|
|
|
|
|
|
switch (state->state) {
|
|
|
|
case 0:
|
|
|
|
/* Looking for the start time and text */
|
|
|
|
if (sscanf (line, "[%u:%u:%u]", &h, &m, &s) == 3) {
|
|
|
|
const gchar *text;
|
|
|
|
state->start_time = (((guint64) h) * 3600 + m * 60 + s) * GST_SECOND;
|
|
|
|
text = dks_skip_timestamp (line);
|
|
|
|
if (*text) {
|
|
|
|
state->state = 1;
|
|
|
|
g_string_append (state->buf, text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
case 1:
|
|
|
|
{
|
2011-05-16 11:48:11 +00:00
|
|
|
guint64 clip_start = 0, clip_stop = 0;
|
2009-10-22 08:02:11 +00:00
|
|
|
gboolean in_seg;
|
|
|
|
gchar *ret;
|
|
|
|
|
|
|
|
/* Looking for the end time */
|
|
|
|
if (sscanf (line, "[%u:%u:%u]", &h, &m, &s) == 3) {
|
|
|
|
state->state = 0;
|
|
|
|
state->duration = (((guint64) h) * 3600 + m * 60 + s) * GST_SECOND -
|
|
|
|
state->start_time;
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("Failed to parse subtitle end time");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if this subtitle is out of the current segment */
|
|
|
|
in_seg = gst_segment_clip (state->segment, GST_FORMAT_TIME,
|
|
|
|
state->start_time, state->start_time + state->duration,
|
|
|
|
&clip_start, &clip_stop);
|
|
|
|
|
|
|
|
if (!in_seg) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
state->start_time = clip_start;
|
|
|
|
state->duration = clip_stop - clip_start;
|
|
|
|
|
|
|
|
ret = g_strdup (state->buf->str);
|
|
|
|
g_string_truncate (state->buf, 0);
|
|
|
|
unescape_newlines_br (ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
g_assert_not_reached ();
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
static void
|
2005-05-06 03:32:51 +00:00
|
|
|
parser_state_init (ParserState * state)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-12-12 09:52:37 +00:00
|
|
|
GST_DEBUG ("initialising parser");
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
if (state->buf) {
|
|
|
|
g_string_truncate (state->buf, 0);
|
|
|
|
} else {
|
|
|
|
state->buf = g_string_new (NULL);
|
|
|
|
}
|
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
state->start_time = 0;
|
|
|
|
state->duration = 0;
|
2008-05-25 20:51:35 +00:00
|
|
|
state->max_duration = 0; /* no limit */
|
2005-12-12 09:52:37 +00:00
|
|
|
state->state = 0;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
state->segment = NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-12-01 16:22:57 +00:00
|
|
|
parser_state_dispose (GstSubParse * self, ParserState * state)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-05-06 03:32:51 +00:00
|
|
|
if (state->buf) {
|
|
|
|
g_string_free (state->buf, TRUE);
|
|
|
|
state->buf = NULL;
|
|
|
|
}
|
2016-07-19 12:26:06 +00:00
|
|
|
|
|
|
|
g_free (state->vertical);
|
|
|
|
state->vertical = NULL;
|
|
|
|
g_free (state->alignment);
|
|
|
|
state->alignment = NULL;
|
|
|
|
|
2009-12-01 16:13:24 +00:00
|
|
|
if (state->user_data) {
|
|
|
|
switch (self->parser_type) {
|
2013-07-16 17:30:50 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
|
|
|
qttext_context_deinit (state);
|
|
|
|
break;
|
2009-12-01 16:13:24 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_SAMI:
|
2013-07-16 17:30:50 +00:00
|
|
|
sami_context_deinit (state);
|
2009-12-01 16:13:24 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
state->allowed_tags = NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2009-02-28 23:23:20 +00:00
|
|
|
/* regex type enum */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
GST_SUB_PARSE_REGEX_UNKNOWN = 0,
|
|
|
|
GST_SUB_PARSE_REGEX_MDVDSUB = 1,
|
|
|
|
GST_SUB_PARSE_REGEX_SUBRIP = 2,
|
2009-10-22 08:02:11 +00:00
|
|
|
GST_SUB_PARSE_REGEX_DKS = 3,
|
2016-03-07 12:29:43 +00:00
|
|
|
GST_SUB_PARSE_REGEX_VTT = 4,
|
2009-02-28 23:23:20 +00:00
|
|
|
} GstSubParseRegex;
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gst_sub_parse_data_format_autodetect_regex_once (GstSubParseRegex regtype)
|
|
|
|
{
|
|
|
|
gpointer result = NULL;
|
|
|
|
GError *gerr = NULL;
|
|
|
|
switch (regtype) {
|
|
|
|
case GST_SUB_PARSE_REGEX_MDVDSUB:
|
|
|
|
result =
|
2011-05-23 14:02:20 +00:00
|
|
|
(gpointer) g_regex_new ("^\\{[0-9]+\\}\\{[0-9]+\\}",
|
|
|
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
2009-02-28 23:23:20 +00:00
|
|
|
if (result == NULL) {
|
|
|
|
g_warning ("Compilation of mdvd regex failed: %s", gerr->message);
|
2015-08-19 12:19:05 +00:00
|
|
|
g_clear_error (&gerr);
|
2009-02-28 23:23:20 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case GST_SUB_PARSE_REGEX_SUBRIP:
|
2012-04-24 08:13:08 +00:00
|
|
|
result = (gpointer)
|
|
|
|
g_regex_new ("^[\\s\\n]*[\\n]? {0,3}[ 0-9]{1,4}\\s*(\x0d)?\x0a"
|
2011-09-01 00:51:17 +00:00
|
|
|
" ?[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}",
|
2011-05-23 14:02:20 +00:00
|
|
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
2009-02-28 23:23:20 +00:00
|
|
|
if (result == NULL) {
|
|
|
|
g_warning ("Compilation of subrip regex failed: %s", gerr->message);
|
2015-08-19 12:19:05 +00:00
|
|
|
g_clear_error (&gerr);
|
2009-02-28 23:23:20 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-10-22 08:02:11 +00:00
|
|
|
case GST_SUB_PARSE_REGEX_DKS:
|
2010-03-15 13:10:09 +00:00
|
|
|
result = (gpointer) g_regex_new ("^\\[[0-9]+:[0-9]+:[0-9]+\\].*",
|
2011-05-23 14:02:20 +00:00
|
|
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, &gerr);
|
2009-10-22 08:02:11 +00:00
|
|
|
if (result == NULL) {
|
|
|
|
g_warning ("Compilation of dks regex failed: %s", gerr->message);
|
2015-08-19 12:19:05 +00:00
|
|
|
g_clear_error (&gerr);
|
2009-10-22 08:02:11 +00:00
|
|
|
}
|
|
|
|
break;
|
2016-03-07 12:29:43 +00:00
|
|
|
case GST_SUB_PARSE_REGEX_VTT:
|
|
|
|
result = (gpointer)
|
|
|
|
g_regex_new ("^(\\xef\\xbb\\xbf)?WEBVTT[\\xa\\xd\\x20\\x9]", 0, 0,
|
|
|
|
&gerr);
|
|
|
|
if (result == NULL) {
|
|
|
|
g_warning ("Compilation of vtt regex failed: %s", gerr->message);
|
|
|
|
g_error_free (gerr);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-02-28 23:23:20 +00:00
|
|
|
default:
|
|
|
|
GST_WARNING ("Trying to allocate regex of unknown type %u", regtype);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
/*
|
|
|
|
* FIXME: maybe we should pass along a second argument, the preceding
|
|
|
|
* text buffer, because that is how this originally worked, even though
|
|
|
|
* I don't really see the use of that.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static GstSubParseFormat
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_sub_parse_data_format_autodetect (gchar * match_str)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2006-10-23 12:06:44 +00:00
|
|
|
guint n1, n2, n3;
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* 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 15:34:09 +00:00
|
|
|
|
2009-02-28 23:23:20 +00:00
|
|
|
static GOnce mdvd_rx_once = G_ONCE_INIT;
|
|
|
|
static GOnce subrip_rx_once = G_ONCE_INIT;
|
2009-10-22 08:02:11 +00:00
|
|
|
static GOnce dks_rx_once = G_ONCE_INIT;
|
2016-03-07 12:29:43 +00:00
|
|
|
static GOnce vtt_rx_once = G_ONCE_INIT;
|
2009-02-28 23:23:20 +00:00
|
|
|
|
|
|
|
GRegex *mdvd_grx;
|
|
|
|
GRegex *subrip_grx;
|
2009-10-22 08:02:11 +00:00
|
|
|
GRegex *dks_grx;
|
2016-03-07 12:29:43 +00:00
|
|
|
GRegex *vtt_grx;
|
2009-02-28 23:23:20 +00:00
|
|
|
|
|
|
|
g_once (&mdvd_rx_once,
|
|
|
|
(GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
|
|
|
|
(gpointer) GST_SUB_PARSE_REGEX_MDVDSUB);
|
|
|
|
g_once (&subrip_rx_once,
|
|
|
|
(GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
|
|
|
|
(gpointer) GST_SUB_PARSE_REGEX_SUBRIP);
|
2009-10-22 08:02:11 +00:00
|
|
|
g_once (&dks_rx_once,
|
|
|
|
(GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
|
|
|
|
(gpointer) GST_SUB_PARSE_REGEX_DKS);
|
2016-03-07 12:29:43 +00:00
|
|
|
g_once (&vtt_rx_once,
|
|
|
|
(GThreadFunc) gst_sub_parse_data_format_autodetect_regex_once,
|
|
|
|
(gpointer) GST_SUB_PARSE_REGEX_VTT);
|
2009-02-28 23:23:20 +00:00
|
|
|
|
|
|
|
mdvd_grx = (GRegex *) mdvd_rx_once.retval;
|
|
|
|
subrip_grx = (GRegex *) subrip_rx_once.retval;
|
2009-10-22 08:02:11 +00:00
|
|
|
dks_grx = (GRegex *) dks_rx_once.retval;
|
2016-03-07 12:29:43 +00:00
|
|
|
vtt_grx = (GRegex *) vtt_rx_once.retval;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2014-11-28 13:28:06 +00:00
|
|
|
if (g_regex_match (mdvd_grx, match_str, 0, NULL)) {
|
2006-05-15 09:14:35 +00:00
|
|
|
GST_LOG ("MicroDVD (frame based) format detected");
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
return GST_SUB_PARSE_FORMAT_MDVDSUB;
|
|
|
|
}
|
2014-11-28 13:28:06 +00:00
|
|
|
if (g_regex_match (subrip_grx, match_str, 0, NULL)) {
|
2006-05-15 09:14:35 +00:00
|
|
|
GST_LOG ("SubRip (time based) format detected");
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
return GST_SUB_PARSE_FORMAT_SUBRIP;
|
|
|
|
}
|
2014-11-28 13:28:06 +00:00
|
|
|
if (g_regex_match (dks_grx, match_str, 0, NULL)) {
|
2009-10-22 08:02:11 +00:00
|
|
|
GST_LOG ("DKS (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_DKS;
|
|
|
|
}
|
2016-03-07 12:29:43 +00:00
|
|
|
if (g_regex_match (vtt_grx, match_str, 0, NULL) == TRUE) {
|
|
|
|
GST_LOG ("WebVTT (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_VTT;
|
|
|
|
}
|
2007-06-05 21:36:11 +00:00
|
|
|
|
ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* 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 15:34:09 +00:00
|
|
|
if (!strncmp (match_str, "FORMAT=TIME", 11)) {
|
2006-05-15 09:14:35 +00:00
|
|
|
GST_LOG ("MPSub (time based) format detected");
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
return GST_SUB_PARSE_FORMAT_MPSUB;
|
|
|
|
}
|
2006-05-15 15:31:30 +00:00
|
|
|
if (strstr (match_str, "<SAMI>") != NULL ||
|
|
|
|
strstr (match_str, "<sami>") != NULL) {
|
2006-05-15 09:14:35 +00:00
|
|
|
GST_LOG ("SAMI (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_SAMI;
|
|
|
|
}
|
2006-10-23 12:06:44 +00:00
|
|
|
/* we're boldly assuming the first subtitle appears within the first hour */
|
|
|
|
if (sscanf (match_str, "0:%02u:%02u:", &n1, &n2) == 2 ||
|
|
|
|
sscanf (match_str, "0:%02u:%02u=", &n1, &n2) == 2 ||
|
|
|
|
sscanf (match_str, "00:%02u:%02u:", &n1, &n2) == 2 ||
|
|
|
|
sscanf (match_str, "00:%02u:%02u=", &n1, &n2) == 2 ||
|
|
|
|
sscanf (match_str, "00:%02u:%02u,%u=", &n1, &n2, &n3) == 3) {
|
|
|
|
GST_LOG ("TMPlayer (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_TMPLAYER;
|
|
|
|
}
|
2007-03-10 11:17:52 +00:00
|
|
|
if (sscanf (match_str, "[%u][%u]", &n1, &n2) == 2) {
|
|
|
|
GST_LOG ("MPL2 (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_MPL2;
|
|
|
|
}
|
2007-06-05 21:36:11 +00:00
|
|
|
if (strstr (match_str, "[INFORMATION]") != NULL) {
|
|
|
|
GST_LOG ("SubViewer (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_SUBVIEWER;
|
|
|
|
}
|
2009-12-01 16:13:24 +00:00
|
|
|
if (strstr (match_str, "{QTtext}") != NULL) {
|
|
|
|
GST_LOG ("QTtext (time based) format detected");
|
|
|
|
return GST_SUB_PARSE_FORMAT_QTTEXT;
|
|
|
|
}
|
2013-12-18 14:07:47 +00:00
|
|
|
/* We assume the LRC file starts immediately */
|
|
|
|
if (match_str[0] == '[') {
|
|
|
|
gboolean all_lines_good = TRUE;
|
|
|
|
gchar **split;
|
|
|
|
gchar **ptr;
|
|
|
|
|
|
|
|
ptr = split = g_strsplit (match_str, "\n", -1);
|
|
|
|
while (*ptr && *(ptr + 1)) {
|
|
|
|
gchar *str = *ptr;
|
|
|
|
gint len = strlen (str);
|
|
|
|
|
|
|
|
if (sscanf (str, "[%u:%02u.%02u]", &n1, &n2, &n3) == 3 ||
|
|
|
|
sscanf (str, "[%u:%02u.%03u]", &n1, &n2, &n3) == 3) {
|
|
|
|
all_lines_good = TRUE;
|
|
|
|
} else if (str[len - 1] == ']' && strchr (str, ':') != NULL) {
|
|
|
|
all_lines_good = TRUE;
|
|
|
|
} else {
|
|
|
|
all_lines_good = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
g_strfreev (split);
|
|
|
|
|
|
|
|
if (all_lines_good)
|
|
|
|
return GST_SUB_PARSE_FORMAT_LRC;
|
|
|
|
}
|
2007-06-05 21:36:11 +00:00
|
|
|
|
2006-05-15 09:14:35 +00:00
|
|
|
GST_DEBUG ("no subtitle format detected");
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
return GST_SUB_PARSE_FORMAT_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
static GstCaps *
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_sub_parse_format_autodetect (GstSubParse * self)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-05-06 03:32:51 +00:00
|
|
|
gchar *data;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
GstSubParseFormat format;
|
|
|
|
|
2009-06-10 13:37:36 +00:00
|
|
|
if (strlen (self->textbuf->str) < 30) {
|
2005-05-06 03:32:51 +00:00
|
|
|
GST_DEBUG ("File too small to be a subtitles file");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = g_strndup (self->textbuf->str, 35);
|
2005-12-01 01:12:55 +00:00
|
|
|
format = gst_sub_parse_data_format_autodetect (data);
|
2005-05-06 03:32:51 +00:00
|
|
|
g_free (data);
|
|
|
|
|
|
|
|
self->parser_type = format;
|
2009-06-11 21:32:28 +00:00
|
|
|
self->subtitle_codec = gst_sub_parse_get_format_description (format);
|
2005-05-06 03:32:51 +00:00
|
|
|
parser_state_init (&self->state);
|
2016-07-07 15:37:51 +00:00
|
|
|
self->state.allowed_tags = NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
|
|
|
switch (format) {
|
|
|
|
case GST_SUB_PARSE_FORMAT_MDVDSUB:
|
2005-05-06 03:32:51 +00:00
|
|
|
self->parse_line = parse_mdvdsub;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "pango-markup", NULL);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_SUBRIP:
|
2016-03-07 12:29:43 +00:00
|
|
|
self->state.allowed_tags = (gpointer) allowed_srt_tags;
|
|
|
|
self->state.allows_tag_attributes = FALSE;
|
2005-05-06 03:32:51 +00:00
|
|
|
self->parse_line = parse_subrip;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "pango-markup", NULL);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_MPSUB:
|
2005-05-06 03:32:51 +00:00
|
|
|
self->parse_line = parse_mpsub;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "utf8", NULL);
|
2006-05-15 09:14:35 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_SAMI:
|
|
|
|
self->parse_line = parse_sami;
|
|
|
|
sami_context_init (&self->state);
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "pango-markup", NULL);
|
2006-10-23 12:06:44 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_TMPLAYER:
|
|
|
|
self->parse_line = parse_tmplayer;
|
2008-05-25 20:51:35 +00:00
|
|
|
self->state.max_duration = 5 * GST_SECOND;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "utf8", NULL);
|
2007-03-10 11:17:52 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_MPL2:
|
|
|
|
self->parse_line = parse_mpl2;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "pango-markup", NULL);
|
2009-10-22 08:02:11 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_DKS:
|
|
|
|
self->parse_line = parse_dks;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "utf8", NULL);
|
2016-03-07 12:29:43 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_VTT:
|
|
|
|
self->state.allowed_tags = (gpointer) allowed_vtt_tags;
|
|
|
|
self->state.allows_tag_attributes = TRUE;
|
|
|
|
self->parse_line = parse_webvtt;
|
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "pango-markup", NULL);
|
2007-06-05 21:36:11 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_SUBVIEWER:
|
|
|
|
self->parse_line = parse_subviewer;
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "utf8", NULL);
|
2009-12-01 16:13:24 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
|
|
|
self->parse_line = parse_qttext;
|
|
|
|
qttext_context_init (&self->state);
|
2012-09-02 01:41:34 +00:00
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "pango-markup", NULL);
|
2013-12-18 14:24:02 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_LRC:
|
|
|
|
self->parse_line = parse_lrc;
|
|
|
|
return gst_caps_new_simple ("text/x-raw",
|
|
|
|
"format", G_TYPE_STRING, "utf8", NULL);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_UNKNOWN:
|
|
|
|
default:
|
|
|
|
GST_DEBUG ("no subtitle format detected");
|
|
|
|
GST_ELEMENT_ERROR (self, STREAM, WRONG_TYPE,
|
|
|
|
("The input is not a valid/supported subtitle file"), (NULL));
|
2005-05-06 03:32:51 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-12-01 01:12:55 +00:00
|
|
|
feed_textbuf (GstSubParse * self, GstBuffer * buf)
|
2005-05-06 03:32:51 +00:00
|
|
|
{
|
2008-05-03 15:39:04 +00:00
|
|
|
gboolean discont;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gsize consumed;
|
|
|
|
gchar *input = NULL;
|
2011-03-27 14:35:28 +00:00
|
|
|
const guint8 *data;
|
|
|
|
gsize avail;
|
2008-05-03 15:39:04 +00:00
|
|
|
|
|
|
|
discont = GST_BUFFER_IS_DISCONT (buf);
|
|
|
|
|
|
|
|
if (GST_BUFFER_OFFSET_IS_VALID (buf) &&
|
|
|
|
GST_BUFFER_OFFSET (buf) != self->offset) {
|
|
|
|
self->offset = GST_BUFFER_OFFSET (buf);
|
|
|
|
discont = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (discont) {
|
|
|
|
GST_INFO ("discontinuity");
|
2005-05-06 03:32:51 +00:00
|
|
|
/* flush the parser state */
|
|
|
|
parser_state_init (&self->state);
|
|
|
|
g_string_truncate (self->textbuf, 0);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gst_adapter_clear (self->adapter);
|
2009-12-01 19:42:42 +00:00
|
|
|
if (self->parser_type == GST_SUB_PARSE_FORMAT_SAMI)
|
|
|
|
sami_context_reset (&self->state);
|
2008-05-03 15:39:04 +00:00
|
|
|
/* we could set a flag to make sure that the next buffer we push out also
|
|
|
|
* has the DISCONT flag set, but there's no point really given that it's
|
|
|
|
* subtitles which are discontinuous by nature. */
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2013-02-14 00:35:45 +00:00
|
|
|
self->offset += gst_buffer_get_size (buf);
|
2005-11-29 16:21:13 +00:00
|
|
|
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gst_adapter_push (self->adapter, buf);
|
|
|
|
|
2011-03-27 14:35:28 +00:00
|
|
|
avail = gst_adapter_available (self->adapter);
|
2011-06-05 22:47:58 +00:00
|
|
|
data = gst_adapter_map (self->adapter, avail);
|
|
|
|
input = convert_encoding (self, (const gchar *) data, avail, &consumed);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
|
|
|
|
if (input && consumed > 0) {
|
|
|
|
self->textbuf = g_string_append (self->textbuf, input);
|
2011-11-10 17:32:39 +00:00
|
|
|
gst_adapter_unmap (self->adapter);
|
|
|
|
gst_adapter_flush (self->adapter, consumed);
|
2011-03-27 14:35:28 +00:00
|
|
|
} else {
|
2011-11-10 17:32:39 +00:00
|
|
|
gst_adapter_unmap (self->adapter);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_free (input);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2020-03-20 18:09:17 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
xml_text (GMarkupParseContext * context,
|
|
|
|
const gchar * text, gsize text_len, gpointer user_data, GError ** error)
|
|
|
|
{
|
|
|
|
gchar **accum = (gchar **) user_data;
|
|
|
|
gchar *concat;
|
|
|
|
|
|
|
|
if (*accum) {
|
|
|
|
concat = g_strconcat (*accum, text, NULL);
|
|
|
|
g_free (*accum);
|
|
|
|
*accum = concat;
|
|
|
|
} else {
|
|
|
|
*accum = g_strdup (text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
strip_pango_markup (gchar * markup, GError ** error)
|
|
|
|
{
|
|
|
|
GMarkupParser parser = { 0, };
|
|
|
|
GMarkupParseContext *context;
|
|
|
|
gchar *accum = NULL;
|
|
|
|
|
|
|
|
parser.text = xml_text;
|
|
|
|
context = g_markup_parse_context_new (&parser, 0, &accum, NULL);
|
|
|
|
|
|
|
|
g_markup_parse_context_parse (context, "<root>", 6, NULL);
|
|
|
|
g_markup_parse_context_parse (context, markup, strlen (markup), error);
|
|
|
|
g_markup_parse_context_parse (context, "</root>", 7, NULL);
|
|
|
|
if (*error)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
g_markup_parse_context_end_parse (context, error);
|
|
|
|
if (*error)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
done:
|
|
|
|
g_markup_parse_context_free (context);
|
|
|
|
return accum;
|
|
|
|
|
|
|
|
error:
|
|
|
|
g_free (accum);
|
|
|
|
accum = NULL;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_sub_parse_negotiate (GstSubParse * self, GstCaps * preferred)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
const GstStructure *s1, *s2;
|
|
|
|
|
|
|
|
caps = gst_pad_get_allowed_caps (self->srcpad);
|
|
|
|
|
|
|
|
s1 = gst_caps_get_structure (preferred, 0);
|
|
|
|
|
|
|
|
if (!g_strcmp0 (gst_structure_get_string (s1, "format"), "utf8")) {
|
|
|
|
GstCaps *intersected = gst_caps_intersect (caps, preferred);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
caps = intersected;
|
|
|
|
}
|
|
|
|
|
|
|
|
caps = gst_caps_fixate (caps);
|
|
|
|
|
|
|
|
if (gst_caps_is_empty (caps)) {
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
s2 = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
self->strip_pango_markup =
|
|
|
|
!g_strcmp0 (gst_structure_get_string (s2, "format"), "utf8")
|
|
|
|
&& !g_strcmp0 (gst_structure_get_string (s1, "format"), "pango-markup");
|
|
|
|
|
|
|
|
if (self->strip_pango_markup) {
|
|
|
|
GST_INFO_OBJECT (self, "We will convert from pango-markup to utf8");
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_pad_set_caps (self->srcpad, caps);
|
|
|
|
|
|
|
|
done:
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
static GstFlowReturn
|
2005-12-01 01:12:55 +00:00
|
|
|
handle_buffer (GstSubParse * self, GstBuffer * buf)
|
2005-05-06 03:32:51 +00:00
|
|
|
{
|
2005-12-12 09:52:37 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2012-01-20 15:11:54 +00:00
|
|
|
gchar *line, *subtitle;
|
2013-05-10 10:21:31 +00:00
|
|
|
gboolean need_tags = FALSE;
|
2005-05-06 03:32:51 +00:00
|
|
|
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
if (self->first_buffer) {
|
2012-01-20 15:11:54 +00:00
|
|
|
GstMapInfo map;
|
|
|
|
|
|
|
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
|
|
|
self->detected_encoding = detect_encoding ((gchar *) map.data, map.size);
|
|
|
|
gst_buffer_unmap (buf, &map);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
self->first_buffer = FALSE;
|
2009-11-07 10:31:09 +00:00
|
|
|
self->state.fps_n = self->fps_n;
|
|
|
|
self->state.fps_d = self->fps_d;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
}
|
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
feed_textbuf (self, buf);
|
|
|
|
|
|
|
|
/* make sure we know the format */
|
|
|
|
if (G_UNLIKELY (self->parser_type == GST_SUB_PARSE_FORMAT_UNKNOWN)) {
|
2020-03-20 18:09:17 +00:00
|
|
|
GstCaps *preferred;
|
|
|
|
|
|
|
|
if (!(preferred = gst_sub_parse_format_autodetect (self))) {
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
2005-05-06 03:32:51 +00:00
|
|
|
}
|
2020-03-20 18:09:17 +00:00
|
|
|
|
|
|
|
if (!gst_sub_parse_negotiate (self, preferred)) {
|
|
|
|
gst_caps_unref (preferred);
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
2005-12-12 09:52:37 +00:00
|
|
|
}
|
2020-03-20 18:09:17 +00:00
|
|
|
|
|
|
|
gst_caps_unref (preferred);
|
|
|
|
|
2013-05-10 10:21:31 +00:00
|
|
|
need_tags = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Push newsegment if needed */
|
|
|
|
if (self->need_segment) {
|
|
|
|
GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
|
|
|
|
&self->segment);
|
|
|
|
|
|
|
|
gst_pad_push_event (self->srcpad, gst_event_new_segment (&self->segment));
|
|
|
|
self->need_segment = FALSE;
|
|
|
|
}
|
2009-06-11 21:32:28 +00:00
|
|
|
|
2013-05-10 10:21:31 +00:00
|
|
|
if (need_tags) {
|
2009-06-11 21:32:28 +00:00
|
|
|
/* push tags */
|
|
|
|
if (self->subtitle_codec != NULL) {
|
2011-11-02 11:08:22 +00:00
|
|
|
GstTagList *tags;
|
|
|
|
|
|
|
|
tags = gst_tag_list_new (GST_TAG_SUBTITLE_CODEC, self->subtitle_codec,
|
|
|
|
NULL);
|
2012-07-27 21:59:31 +00:00
|
|
|
gst_pad_push_event (self->srcpad, gst_event_new_tag (tags));
|
2009-06-11 21:32:28 +00:00
|
|
|
}
|
2005-05-06 03:32:51 +00:00
|
|
|
}
|
|
|
|
|
2009-02-26 14:09:03 +00:00
|
|
|
while (!self->flushing && (line = get_next_line (self))) {
|
2008-10-10 17:13:40 +00:00
|
|
|
guint offset = 0;
|
|
|
|
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
/* Set segment on our parser state machine */
|
2007-03-09 16:28:04 +00:00
|
|
|
self->state.segment = &self->segment;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
/* Now parse the line, out of segment lines will just return NULL */
|
2016-04-06 11:00:10 +00:00
|
|
|
GST_LOG_OBJECT (self, "State %d. Parsing line '%s'", self->state.state,
|
|
|
|
line + offset);
|
2008-10-10 17:13:40 +00:00
|
|
|
subtitle = self->parse_line (&self->state, line + offset);
|
2005-05-06 03:32:51 +00:00
|
|
|
g_free (line);
|
|
|
|
|
|
|
|
if (subtitle) {
|
2020-03-20 18:09:17 +00:00
|
|
|
guint subtitle_len;
|
|
|
|
|
|
|
|
if (self->strip_pango_markup) {
|
|
|
|
GError *error = NULL;
|
|
|
|
gchar *stripped;
|
|
|
|
|
|
|
|
if ((stripped = strip_pango_markup (subtitle, &error))) {
|
|
|
|
g_free (subtitle);
|
|
|
|
subtitle = stripped;
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (self, "Failed to strip pango markup: %s",
|
|
|
|
error->message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
subtitle_len = strlen (subtitle);
|
2005-05-06 03:32:51 +00:00
|
|
|
|
2006-10-20 17:02:19 +00:00
|
|
|
/* +1 for terminating NUL character */
|
2011-04-29 11:28:17 +00:00
|
|
|
buf = gst_buffer_new_and_alloc (subtitle_len + 1);
|
|
|
|
|
|
|
|
/* copy terminating NUL character as well */
|
|
|
|
gst_buffer_fill (buf, 0, subtitle, subtitle_len + 1);
|
|
|
|
gst_buffer_set_size (buf, subtitle_len);
|
|
|
|
|
|
|
|
GST_BUFFER_TIMESTAMP (buf) = self->state.start_time;
|
|
|
|
GST_BUFFER_DURATION (buf) = self->state.duration;
|
|
|
|
|
|
|
|
/* in some cases (e.g. tmplayer) we can only determine the duration
|
|
|
|
* of a text chunk from the timestamp of the next text chunk; in those
|
|
|
|
* cases, we probably want to limit the duration to something
|
|
|
|
* reasonable, so we don't end up showing some text for e.g. 40 seconds
|
|
|
|
* just because nothing else is being said during that time */
|
|
|
|
if (self->state.max_duration > 0 && GST_BUFFER_DURATION_IS_VALID (buf)) {
|
|
|
|
if (GST_BUFFER_DURATION (buf) > self->state.max_duration)
|
|
|
|
GST_BUFFER_DURATION (buf) = self->state.max_duration;
|
|
|
|
}
|
2008-05-25 20:51:35 +00:00
|
|
|
|
2011-05-16 11:48:11 +00:00
|
|
|
self->segment.position = self->state.start_time;
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
|
2011-04-29 11:28:17 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "Sending text '%s', %" GST_TIME_FORMAT " + %"
|
|
|
|
GST_TIME_FORMAT, subtitle, GST_TIME_ARGS (self->state.start_time),
|
|
|
|
GST_TIME_ARGS (self->state.duration));
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
g_free (self->state.vertical);
|
2016-07-19 12:26:06 +00:00
|
|
|
self->state.vertical = NULL;
|
2016-03-07 12:29:43 +00:00
|
|
|
g_free (self->state.alignment);
|
2016-07-19 12:26:06 +00:00
|
|
|
self->state.alignment = NULL;
|
|
|
|
|
2011-04-29 11:28:17 +00:00
|
|
|
ret = gst_pad_push (self->srcpad, buf);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2008-05-03 15:45:23 +00:00
|
|
|
/* move this forward (the tmplayer parser needs this) */
|
|
|
|
if (self->state.duration != GST_CLOCK_TIME_NONE)
|
|
|
|
self->state.start_time += self->state.duration;
|
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
g_free (subtitle);
|
|
|
|
subtitle = NULL;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2007-03-09 10:49:53 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (self, "flow: %s", gst_flow_get_name (ret));
|
2005-12-12 09:52:37 +00:00
|
|
|
break;
|
2007-03-09 10:49:53 +00:00
|
|
|
}
|
2005-12-12 09:52:37 +00:00
|
|
|
}
|
|
|
|
}
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
return ret;
|
2005-05-06 03:32:51 +00:00
|
|
|
}
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_sub_parse_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * buf)
|
2005-05-06 03:32:51 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn ret;
|
2005-12-01 01:12:55 +00:00
|
|
|
GstSubParse *self;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
self = GST_SUBPARSE (parent);
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
|
2005-05-06 03:32:51 +00:00
|
|
|
ret = handle_buffer (self, buf);
|
|
|
|
|
|
|
|
return ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
static gboolean
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_sub_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
2005-12-12 09:52:37 +00:00
|
|
|
{
|
2011-11-17 11:48:25 +00:00
|
|
|
GstSubParse *self = GST_SUBPARSE (parent);
|
2005-12-12 09:52:37 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
2018-01-25 18:39:11 +00:00
|
|
|
GST_LOG_OBJECT (self, "%s event", GST_EVENT_TYPE_NAME (event));
|
2005-12-12 09:52:37 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2018-01-25 18:39:11 +00:00
|
|
|
case GST_EVENT_STREAM_GROUP_DONE:
|
2005-12-12 09:52:37 +00:00
|
|
|
case GST_EVENT_EOS:{
|
|
|
|
/* Make sure the last subrip chunk is pushed out even
|
|
|
|
* if the file does not have an empty line at the end */
|
2007-03-10 11:17:52 +00:00
|
|
|
if (self->parser_type == GST_SUB_PARSE_FORMAT_SUBRIP ||
|
2008-05-03 15:45:23 +00:00
|
|
|
self->parser_type == GST_SUB_PARSE_FORMAT_TMPLAYER ||
|
2009-12-01 19:42:42 +00:00
|
|
|
self->parser_type == GST_SUB_PARSE_FORMAT_MPL2 ||
|
2019-05-06 10:48:49 +00:00
|
|
|
self->parser_type == GST_SUB_PARSE_FORMAT_QTTEXT ||
|
|
|
|
self->parser_type == GST_SUB_PARSE_FORMAT_VTT) {
|
2011-03-27 14:35:28 +00:00
|
|
|
gchar term_chars[] = { '\n', '\n', '\0' };
|
2008-05-03 15:45:23 +00:00
|
|
|
GstBuffer *buf = gst_buffer_new_and_alloc (2 + 1);
|
2005-12-12 09:52:37 +00:00
|
|
|
|
2018-01-25 18:39:11 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "%s: force pushing of any remaining text",
|
|
|
|
GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
2011-03-27 14:35:28 +00:00
|
|
|
gst_buffer_fill (buf, 0, term_chars, 3);
|
|
|
|
gst_buffer_set_size (buf, 2);
|
|
|
|
|
2005-12-12 09:52:37 +00:00
|
|
|
GST_BUFFER_OFFSET (buf) = self->offset;
|
2011-11-17 11:48:25 +00:00
|
|
|
gst_sub_parse_chain (pad, parent, buf);
|
2005-12-12 09:52:37 +00:00
|
|
|
}
|
2011-11-17 11:48:25 +00:00
|
|
|
ret = gst_pad_event_default (pad, parent, event);
|
2005-12-12 09:52:37 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-05-16 11:48:11 +00:00
|
|
|
case GST_EVENT_SEGMENT:
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
{
|
2012-01-24 17:42:51 +00:00
|
|
|
const GstSegment *s;
|
|
|
|
gst_event_parse_segment (event, &s);
|
|
|
|
if (s->format == GST_FORMAT_TIME)
|
|
|
|
gst_event_copy_segment (event, &self->segment);
|
2011-05-16 11:48:11 +00:00
|
|
|
GST_DEBUG_OBJECT (self, "newsegment (%s)",
|
|
|
|
gst_format_get_name (self->segment.format));
|
|
|
|
|
|
|
|
/* if not time format, we'll either start with a 0 timestamp anyway or
|
|
|
|
* it's following a seek in which case we'll have saved the requested
|
|
|
|
* seek segment and don't want to overwrite it (remember that on a seek
|
|
|
|
* we always just seek back to the start in BYTES format and just throw
|
|
|
|
* away all text that's before the requested position; if the subtitles
|
|
|
|
* come from an upstream demuxer, it won't be able to handle our BYTES
|
|
|
|
* seek request and instead send us a newsegment from the seek request
|
|
|
|
* it received via its video pads instead, so all is fine then too) */
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
ret = TRUE;
|
2005-12-12 09:52:37 +00:00
|
|
|
gst_event_unref (event);
|
2017-06-24 20:03:21 +00:00
|
|
|
/* in either case, let's not simply discard this event;
|
|
|
|
* trigger sending of the saved requested seek segment
|
|
|
|
* or the one taken here from upstream */
|
|
|
|
self->need_segment = TRUE;
|
2005-12-12 09:52:37 +00:00
|
|
|
break;
|
|
|
|
}
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
case GST_EVENT_FLUSH_START:
|
|
|
|
{
|
|
|
|
self->flushing = TRUE;
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
ret = gst_pad_event_default (pad, parent, event);
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
{
|
|
|
|
self->flushing = FALSE;
|
|
|
|
|
2011-11-17 11:48:25 +00:00
|
|
|
ret = gst_pad_event_default (pad, parent, event);
|
docs/libs/tmpl/gstcolorbalance.sgml: Updated.
Original commit message from CVS:
2006-02-05 Julien MOUTTE <julien@moutte.net>
* docs/libs/tmpl/gstcolorbalance.sgml: Updated.
* ext/pango/gsttextoverlay.c: (gst_text_overlay_init),
(gst_text_overlay_src_event), (gst_text_overlay_collected):
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_sub_parse_src_event), (parse_mdvdsub), (parse_subrip),
(parse_mpsub), (parser_state_init), (handle_buffer),
(gst_sub_parse_chain), (gst_sub_parse_sink_event),
(plugin_init):
* gst/subparse/gstsubparse.h: Introduce seeking code.
2006-02-05 16:03:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-12-12 09:52:37 +00:00
|
|
|
default:
|
2011-11-17 11:48:25 +00:00
|
|
|
ret = gst_pad_event_default (pad, parent, event);
|
2005-12-12 09:52:37 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
2005-12-01 01:12:55 +00:00
|
|
|
gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
2005-12-12 09:52:37 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2005-12-01 01:12:55 +00:00
|
|
|
GstSubParse *self = GST_SUBPARSE (element);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2005-05-06 03:32:51 +00:00
|
|
|
/* format detection will init the parser state */
|
2006-10-18 18:40:12 +00:00
|
|
|
self->offset = 0;
|
2005-05-06 03:32:51 +00:00
|
|
|
self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
|
2020-03-20 18:09:17 +00:00
|
|
|
self->strip_pango_markup = FALSE;
|
2006-03-24 17:57:39 +00:00
|
|
|
self->valid_utf8 = TRUE;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
self->first_buffer = TRUE;
|
|
|
|
g_free (self->detected_encoding);
|
|
|
|
self->detected_encoding = NULL;
|
2006-10-18 18:40:12 +00:00
|
|
|
g_string_truncate (self->textbuf, 0);
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gst_adapter_clear (self->adapter);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-04-19 09:35:53 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
2005-12-12 09:52:37 +00:00
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2009-12-01 16:22:57 +00:00
|
|
|
parser_state_dispose (self, &self->state);
|
2005-12-12 09:52:37 +00:00
|
|
|
self->parser_type = GST_SUB_PARSE_FORMAT_UNKNOWN;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
2006-01-26 23:21:31 +00:00
|
|
|
/*
|
|
|
|
* Typefind support.
|
|
|
|
*/
|
|
|
|
|
2006-10-23 12:06:44 +00:00
|
|
|
/* FIXME 0.11: these caps are ugly, use app/x-subtitle + type field or so;
|
|
|
|
* also, give different subtitle formats really different types */
|
2007-03-10 11:17:52 +00:00
|
|
|
static GstStaticCaps mpl2_caps =
|
|
|
|
GST_STATIC_CAPS ("application/x-subtitle-mpl2");
|
2008-09-03 10:12:04 +00:00
|
|
|
#define SUB_CAPS (gst_static_caps_get (&sub_caps))
|
|
|
|
|
2006-10-23 12:06:44 +00:00
|
|
|
static GstStaticCaps tmp_caps =
|
|
|
|
GST_STATIC_CAPS ("application/x-subtitle-tmplayer");
|
2008-09-03 10:12:04 +00:00
|
|
|
#define TMP_CAPS (gst_static_caps_get (&tmp_caps))
|
|
|
|
|
2006-01-26 23:21:31 +00:00
|
|
|
static GstStaticCaps sub_caps = GST_STATIC_CAPS ("application/x-subtitle");
|
2008-09-03 10:12:04 +00:00
|
|
|
#define MPL2_CAPS (gst_static_caps_get (&mpl2_caps))
|
2006-01-26 23:21:31 +00:00
|
|
|
|
2008-09-03 10:12:04 +00:00
|
|
|
static GstStaticCaps smi_caps = GST_STATIC_CAPS ("application/x-subtitle-sami");
|
2006-05-15 09:14:35 +00:00
|
|
|
#define SAMI_CAPS (gst_static_caps_get (&smi_caps))
|
2006-01-26 23:21:31 +00:00
|
|
|
|
2009-10-22 08:02:11 +00:00
|
|
|
static GstStaticCaps dks_caps = GST_STATIC_CAPS ("application/x-subtitle-dks");
|
|
|
|
#define DKS_CAPS (gst_static_caps_get (&dks_caps))
|
|
|
|
|
2016-03-07 12:29:43 +00:00
|
|
|
static GstStaticCaps vtt_caps = GST_STATIC_CAPS ("application/x-subtitle-vtt");
|
|
|
|
#define VTT_CAPS (gst_static_caps_get (&vtt_caps))
|
|
|
|
|
2009-12-01 16:13:24 +00:00
|
|
|
static GstStaticCaps qttext_caps =
|
|
|
|
GST_STATIC_CAPS ("application/x-subtitle-qttext");
|
|
|
|
#define QTTEXT_CAPS (gst_static_caps_get (&qttext_caps))
|
|
|
|
|
2013-12-18 14:07:47 +00:00
|
|
|
static GstStaticCaps lrc_caps = GST_STATIC_CAPS ("application/x-subtitle-lrc");
|
|
|
|
#define LRC_CAPS (gst_static_caps_get (&lrc_caps))
|
|
|
|
|
2006-01-26 23:21:31 +00:00
|
|
|
static void
|
|
|
|
gst_subparse_type_find (GstTypeFind * tf, gpointer private)
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
{
|
|
|
|
GstSubParseFormat format;
|
2006-05-15 09:14:35 +00:00
|
|
|
const guint8 *data;
|
|
|
|
GstCaps *caps;
|
2006-03-09 12:56:35 +00:00
|
|
|
gchar *str;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
gchar *encoding = NULL;
|
2008-10-15 11:25:09 +00:00
|
|
|
const gchar *end;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
if (!(data = gst_type_find_peek (tf, 0, 129)))
|
2006-01-26 23:21:31 +00:00
|
|
|
return;
|
2006-03-09 12:56:35 +00:00
|
|
|
|
|
|
|
/* make sure string passed to _autodetect() is NUL-terminated */
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
str = g_malloc0 (129);
|
|
|
|
memcpy (str, data, 128);
|
|
|
|
|
|
|
|
if ((encoding = detect_encoding (str, 128)) != NULL) {
|
|
|
|
gchar *converted_str;
|
|
|
|
GError *err = NULL;
|
|
|
|
gsize tmp;
|
|
|
|
|
|
|
|
converted_str = gst_convert_to_utf8 (str, 128, encoding, &tmp, &err);
|
|
|
|
if (converted_str == NULL) {
|
|
|
|
GST_DEBUG ("Encoding '%s' detected but conversion failed: %s", encoding,
|
|
|
|
err->message);
|
2015-08-19 12:19:05 +00:00
|
|
|
g_clear_error (&err);
|
2008-10-15 11:25:09 +00:00
|
|
|
} else {
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
g_free (str);
|
2008-10-15 11:25:09 +00:00
|
|
|
str = converted_str;
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
}
|
2012-01-24 17:44:21 +00:00
|
|
|
g_free (encoding);
|
2008-10-15 11:25:09 +00:00
|
|
|
}
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
|
2008-10-15 11:25:09 +00:00
|
|
|
/* Check if at least the first 120 chars are valid UTF8,
|
|
|
|
* otherwise convert as always */
|
|
|
|
if (!g_utf8_validate (str, 128, &end) && (end - str) < 120) {
|
|
|
|
gchar *converted_str;
|
|
|
|
gsize tmp;
|
|
|
|
const gchar *enc;
|
|
|
|
|
|
|
|
enc = g_getenv ("GST_SUBTITLE_ENCODING");
|
|
|
|
if (enc == NULL || *enc == '\0') {
|
|
|
|
/* if local encoding is UTF-8 and no encoding specified
|
|
|
|
* via the environment variable, assume ISO-8859-15 */
|
|
|
|
if (g_get_charset (&enc)) {
|
|
|
|
enc = "ISO-8859-15";
|
|
|
|
}
|
|
|
|
}
|
2012-12-16 12:34:14 +00:00
|
|
|
converted_str = gst_convert_to_utf8 (str, 128, enc, &tmp, NULL);
|
2011-05-23 14:02:34 +00:00
|
|
|
if (converted_str != NULL) {
|
2008-10-15 11:25:09 +00:00
|
|
|
g_free (str);
|
|
|
|
str = converted_str;
|
|
|
|
}
|
gst/subparse/: Add support for UTF16/UTF32 subtitles as long as the first bytes of the first buffer contain the BOM. ...
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_sub_parse_dispose),
(gst_sub_parse_class_init), (gst_sub_parse_init),
(gst_convert_to_utf8), (detect_encoding), (convert_encoding),
(get_next_line), (gst_sub_parse_data_format_autodetect),
(feed_textbuf), (handle_buffer), (gst_sub_parse_change_state),
(gst_subparse_type_find):
* gst/subparse/gstsubparse.h:
Add support for UTF16/UTF32 subtitles as long as the first bytes of
the first buffer contain the BOM. This also adds support for other
encodings that allow NUL bytes via the encoding property.
Fixes bugs #552237 and #456788.
2008-10-13 08:58:29 +00:00
|
|
|
}
|
|
|
|
|
2006-03-09 12:56:35 +00:00
|
|
|
format = gst_sub_parse_data_format_autodetect (str);
|
|
|
|
g_free (str);
|
|
|
|
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
switch (format) {
|
|
|
|
case GST_SUB_PARSE_FORMAT_MDVDSUB:
|
2006-01-26 23:21:31 +00:00
|
|
|
GST_DEBUG ("MicroDVD format detected");
|
2006-05-15 09:14:35 +00:00
|
|
|
caps = SUB_CAPS;
|
2006-01-26 23:21:31 +00:00
|
|
|
break;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_SUBRIP:
|
2006-01-26 23:21:31 +00:00
|
|
|
GST_DEBUG ("SubRip format detected");
|
2006-05-15 09:14:35 +00:00
|
|
|
caps = SUB_CAPS;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
break;
|
2006-01-26 23:21:31 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_MPSUB:
|
2006-02-21 12:16:16 +00:00
|
|
|
GST_DEBUG ("MPSub format detected");
|
2006-05-15 09:14:35 +00:00
|
|
|
caps = SUB_CAPS;
|
|
|
|
break;
|
|
|
|
case GST_SUB_PARSE_FORMAT_SAMI:
|
|
|
|
GST_DEBUG ("SAMI (time-based) format detected");
|
|
|
|
caps = SAMI_CAPS;
|
2006-01-26 23:21:31 +00:00
|
|
|
break;
|
2006-10-23 12:06:44 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_TMPLAYER:
|
|
|
|
GST_DEBUG ("TMPlayer (time based) format detected");
|
|
|
|
caps = TMP_CAPS;
|
2007-03-10 11:17:52 +00:00
|
|
|
break;
|
|
|
|
/* FIXME: our MPL2 typefinding is not really good enough to warrant
|
|
|
|
* returning a high probability (however, since we registered our
|
|
|
|
* typefinder here with a rank of MARGINAL we should pretty much only
|
|
|
|
* be called if most other typefinders have already run */
|
|
|
|
case GST_SUB_PARSE_FORMAT_MPL2:
|
|
|
|
GST_DEBUG ("MPL2 (time based) format detected");
|
|
|
|
caps = MPL2_CAPS;
|
2007-06-05 21:36:11 +00:00
|
|
|
break;
|
|
|
|
case GST_SUB_PARSE_FORMAT_SUBVIEWER:
|
|
|
|
GST_DEBUG ("SubViewer format detected");
|
|
|
|
caps = SUB_CAPS;
|
2006-10-23 12:06:44 +00:00
|
|
|
break;
|
2009-10-22 08:02:11 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_DKS:
|
|
|
|
GST_DEBUG ("DKS format detected");
|
|
|
|
caps = DKS_CAPS;
|
|
|
|
break;
|
2009-12-01 16:13:24 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_QTTEXT:
|
|
|
|
GST_DEBUG ("QTtext format detected");
|
|
|
|
caps = QTTEXT_CAPS;
|
|
|
|
break;
|
2013-12-18 14:07:47 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_LRC:
|
|
|
|
GST_DEBUG ("LRC format detected");
|
|
|
|
caps = LRC_CAPS;
|
2016-03-29 09:23:08 +00:00
|
|
|
break;
|
2016-03-07 12:29:43 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_VTT:
|
|
|
|
GST_DEBUG ("WebVTT format detected");
|
|
|
|
caps = VTT_CAPS;
|
2013-12-18 14:07:47 +00:00
|
|
|
break;
|
2006-05-15 09:14:35 +00:00
|
|
|
default:
|
2006-01-26 23:21:31 +00:00
|
|
|
case GST_SUB_PARSE_FORMAT_UNKNOWN:
|
|
|
|
GST_DEBUG ("no subtitle format detected");
|
|
|
|
return;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
2006-01-26 23:21:31 +00:00
|
|
|
|
|
|
|
/* if we're here, it's ok */
|
2006-05-15 09:14:35 +00:00
|
|
|
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, caps);
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2005-12-01 01:12:55 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (sub_parse_debug, "subparse", 0, ".sub parser");
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
|
2006-01-26 23:21:31 +00:00
|
|
|
if (!gst_type_find_register (plugin, "subparse_typefind", GST_RANK_MARGINAL,
|
2016-03-07 12:29:43 +00:00
|
|
|
gst_subparse_type_find, "srt,sub,mpsub,mdvd,smi,txt,dks,vtt",
|
|
|
|
SUB_CAPS, NULL, NULL))
|
2006-01-26 23:21:31 +00:00
|
|
|
return FALSE;
|
|
|
|
|
gst/subparse/: Add very basic parser for SSA subtitle streams (as often found in matroska files).
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstssaparse.c: (gst_ssa_parse_base_init),
(gst_ssa_parse_dispose), (gst_ssa_parse_init),
(gst_ssa_parse_class_init), (gst_ssa_parse_src_event),
(gst_ssa_parse_sink_event), (gst_ssa_parse_setcaps),
(gst_ssa_parse_remove_override_codes), (gst_ssa_parse_parse_line),
(gst_ssa_parse_chain), (gst_ssa_parse_change_state):
* gst/subparse/gstssaparse.h:
* gst/subparse/gstsubparse.c: (plugin_init):
Add very basic parser for SSA subtitle streams (as often
found in matroska files).
2006-02-19 14:16:16 +00:00
|
|
|
if (!gst_element_register (plugin, "subparse",
|
|
|
|
GST_RANK_PRIMARY, GST_TYPE_SUBPARSE) ||
|
|
|
|
!gst_element_register (plugin, "ssaparse",
|
|
|
|
GST_RANK_PRIMARY, GST_TYPE_SSA_PARSE)) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla...
Original commit message from CVS:
* configure.ac:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_new):
* ext/ogg/gstogmparse.c: (gst_ogm_text_parse_get_type),
(gst_ogm_text_parse_base_init), (gst_ogm_text_parse_init),
(gst_ogm_parse_get_sink_querytypes), (gst_ogm_parse_sink_convert),
(gst_ogm_parse_sink_query), (gst_ogm_parse_chain),
(gst_ogm_parse_plugin_init):
* ext/pango/gsttextoverlay.c: (gst_textoverlay_linkedpads),
(gst_textoverlay_link), (gst_textoverlay_getcaps),
(gst_textoverlay_event), (gst_textoverlay_video_chain),
(gst_textoverlay_loop), (gst_textoverlay_init), (plugin_init):
* ext/pango/gsttextoverlay.h:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_handle_seek_event),
(gst_matroska_demux_sync_streams),
(gst_matroska_demux_parse_blockgroup),
(gst_matroska_demux_subtitle_caps),
(gst_matroska_demux_plugin_init):
* gst/matroska/matroska-ids.h:
* gst/playback/gstdecodebin.c: (close_pad_link):
* gst/playback/gstplaybasebin.c: (gst_play_base_bin_init),
(gen_preroll_element), (remove_groups), (add_stream),
(new_decoded_pad), (setup_subtitles), (gen_source_element),
(setup_source):
* gst/playback/gstplaybasebin.h:
* gst/playback/gstplaybin.c: (gen_text_element), (setup_sinks):
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c: (gst_subparse_get_type),
(gst_subparse_base_init), (gst_subparse_class_init),
(gst_subparse_init), (gst_subparse_formats),
(gst_subparse_eventmask), (gst_subparse_event),
(gst_subparse_handle_event), (convert_encoding), (get_next_line),
(parse_mdvdsub), (parse_mdvdsub_init), (parse_subrip),
(parse_subrip_deinit), (parse_subrip_init), (parse_mpsub),
(parse_mpsub_deinit), (parse_mpsub_init),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_format_autodetect), (gst_subparse_loop),
(gst_subparse_change_state), (gst_subparse_type_find),
(plugin_init):
* gst/subparse/gstsubparse.h:
* gst/typefind/gsttypefindfunctions.c: (ogmtext_type_find),
(plugin_init):
Add subtitle support, .sub parser (supports SRT and MPsub),
OGM text support, Matroska UTF-8 text support, deadlock fixes
all over the place, subtitle awareness in decodebin/playbin
and some fixes to textoverlay to handle subtitles in a stream
correctly. Fixes #100931.
2005-01-08 18:22:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2012-04-05 13:11:05 +00:00
|
|
|
subparse,
|
gst/subparse/: Add very basic parser for SSA subtitle streams (as often found in matroska files).
Original commit message from CVS:
* gst/subparse/Makefile.am:
* gst/subparse/gstssaparse.c: (gst_ssa_parse_base_init),
(gst_ssa_parse_dispose), (gst_ssa_parse_init),
(gst_ssa_parse_class_init), (gst_ssa_parse_src_event),
(gst_ssa_parse_sink_event), (gst_ssa_parse_setcaps),
(gst_ssa_parse_remove_override_codes), (gst_ssa_parse_parse_line),
(gst_ssa_parse_chain), (gst_ssa_parse_change_state):
* gst/subparse/gstssaparse.h:
* gst/subparse/gstsubparse.c: (plugin_init):
Add very basic parser for SSA subtitle streams (as often
found in matroska files).
2006-02-19 14:16:16 +00:00
|
|
|
"Subtitle parsing",
|
2005-10-16 13:54:44 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|