summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2003-04-06 01:17:10 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2003-04-06 01:17:10 +0000
commitc32323f0ba6c1c4df13eecdcbf7d42833c334622 (patch)
tree495a214242cbe7298860ff6a251d0c7110608c58 /src
parentbb653b8883c232f5a215b8a108f1c7fc4c92f1b3 (diff)
downloadxine-lib-c32323f0ba6c1c4df13eecdcbf7d42833c334622.tar.gz
xine-lib-c32323f0ba6c1c4df13eecdcbf7d42833c334622.tar.bz2
OGM subtitles by andreas heinchen, cosmetics
CVS patchset: 4543 CVS date: 2003/04/06 01:17:10
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_ogg.c102
-rw-r--r--src/libmpeg2/decode.c8
-rw-r--r--src/xine-engine/load_plugins.c8
3 files changed, 104 insertions, 14 deletions
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index 4f052897a..c3b96176e 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_ogg.c,v 1.68 2003/03/07 12:51:47 guenter Exp $
+ * $Id: demux_ogg.c,v 1.69 2003/04/06 01:17:11 guenter Exp $
*
* demultiplexer for ogg streams
*
@@ -44,7 +44,7 @@
/*
#define LOG
-*/
+ */
#define CHUNKSIZE 8500
#define PACKET_TYPE_HEADER 0x01
@@ -62,6 +62,7 @@
#define WRAP_THRESHOLD 900000
+#define SUB_BUFSIZE 1024
typedef struct demux_ogg_s {
demux_plugin_t demux_plugin;
@@ -89,6 +90,7 @@ typedef struct demux_ogg_s {
int num_audio_streams;
int num_video_streams;
+ int num_spu_streams;
off_t avg_bitrate;
@@ -280,6 +282,87 @@ static void send_ogg_buf (demux_ogg_t *this,
this->video_fifo->put (this->video_fifo, buf);
}
+ } else if ((this->buf_types[stream_num] & 0xFF000000) == BUF_SPU_BASE) {
+
+ buf_element_t *buf;
+ int hdrlen,i,ignore;
+ char *subtitle,*str;
+ int lenbytes;
+ int lines,start,end;
+ uint32_t *val;
+
+ hdrlen = (*op->packet & PACKET_LEN_BITS01) >> 6;
+ hdrlen |= (*op->packet & PACKET_LEN_BITS2) << 1;
+
+ for (i = 0, lenbytes = 0; i < hdrlen; i++) {
+ lenbytes = lenbytes << 8;
+ lenbytes += *((unsigned char *) op->packet + hdrlen - i);
+ }
+
+ if (op->packet[0] == PACKET_TYPE_HEADER ) {
+#ifdef LOG
+ printf ("demux_ogg: Textstreamheaderpacket");
+#endif
+ } else if (op->packet[0] == PACKET_TYPE_COMMENT ) {
+#ifdef LOG
+ printf ("demux_ogg: textstreamheaderpacket");
+#endif
+ } else {
+ subtitle = (char *)&op->packet[hdrlen + 1];
+ if ((strlen(subtitle) > 1) || (*subtitle != ' ')) {
+
+ start = op->granulepos;
+ end = start+lenbytes;
+
+ buf = this->video_fifo->buffer_pool_alloc (this->video_fifo);
+
+ buf->type = this->buf_types[stream_num];
+ buf->pts = 0;
+
+ val = (uint32_t * )buf->content;
+
+ /*num_lines will be set later, when we know the correct value*/
+ *val++ = 0;
+
+ /*times are in ms*/
+ *val++ = 1;
+ *val++ = start;
+ *val++ = end;
+ str = (char *)val;
+
+ for ( i=0, ignore=0, lines=0 ; i<strlen(subtitle) ; i++ ) {
+ /*fixme: the maximum SUB_BUFSIZE isn't considered*/
+ /*fixme: font tags aren't ignored correctly*/
+ switch (subtitle[i]) {
+ case '<':
+ ignore=1;
+ break;
+ case '>':
+ ignore=0;
+ break;
+ case 13:
+ if (ignore==0) {
+ str[0]=0;
+ lines++;
+ str+=1;
+ }
+ break;
+ default:
+ if (ignore==0) {
+ str[0]=subtitle[i];
+ str+=1;
+ }
+ break;
+ }
+ str[0]=0;
+ }
+
+ val = (uint32_t * )buf->content;
+ *val = lines;
+
+ this->video_fifo->put (this->video_fifo, buf);
+ }
+ }
}
}
@@ -679,7 +762,14 @@ static void demux_ogg_send_header (demux_ogg_t *this) {
printf ("demux_ogg: old header detected but stream type is unknown\n");
this->buf_types[stream_num] = BUF_CONTROL_NOP;
}
-
+ } else if (!strncmp (&op.packet[1], "text", 4)) {
+ int channel=0;
+#ifdef LOG
+ printf ("demux_ogg: textstream detected.\n");
+#endif
+ this->preview_buffers[stream_num] = 2;
+ channel= this->num_spu_streams++;
+ this->buf_types[stream_num] = BUF_SPU_TEXT | channel;
} else {
printf ("demux_ogg: unknown stream type (signature >%.8s<). hex dump of bos packet follows:\n",
op.packet);
@@ -872,6 +962,7 @@ static void demux_ogg_send_headers (demux_plugin_t *this_gen) {
this->num_streams = 0;
this->num_audio_streams = 0;
this->num_video_streams = 0;
+ this->num_spu_streams = 0;
this->avg_bitrate = 1;
this->input->seek (this->input, 0, SEEK_SET);
@@ -889,6 +980,7 @@ static void demux_ogg_send_headers (demux_plugin_t *this_gen) {
this->stream->stream_info[XINE_STREAM_INFO_HAS_VIDEO] = this->num_video_streams>0;
this->stream->stream_info[XINE_STREAM_INFO_HAS_AUDIO] = this->num_audio_streams>0;
+ this->stream->stream_info[XINE_STREAM_INFO_MAX_SPU_CHANNEL] = this->num_spu_streams;
}
static int demux_ogg_seek (demux_plugin_t *this_gen,
@@ -1098,3 +1190,7 @@ plugin_info_t xine_plugin_info[] = {
{ PLUGIN_DEMUX, 20, "ogg", XINE_VERSION_CODE, NULL, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
+
+
+
+
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 3b8a9b964..d44940e3a 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -207,13 +207,7 @@ static void remember_metainfo (mpeg2dec_t *mpeg2dec) {
mpeg2dec->stream->stream_info[XINE_STREAM_INFO_FRAME_DURATION] = 3000;
}
- if (mpeg2dec->picture->mpeg1)
- mpeg2dec->stream->meta_info[XINE_META_INFO_VIDEOCODEC]
- = strdup ("MPEG-1");
- else
- mpeg2dec->stream->meta_info[XINE_META_INFO_VIDEOCODEC]
- = strdup ("MPEG-2");
-
+ mpeg2dec->stream->meta_info[XINE_META_INFO_VIDEOCODEC] = strdup ("MPEG");
}
diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c
index 6ff102b97..c9f877f02 100644
--- a/src/xine-engine/load_plugins.c
+++ b/src/xine-engine/load_plugins.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: load_plugins.c,v 1.144 2003/03/14 21:37:53 jstembridge Exp $
+ * $Id: load_plugins.c,v 1.145 2003/04/06 01:17:11 guenter Exp $
*
*
* Load input/demux/audio_out/video_out/codec plugins
@@ -1032,9 +1032,9 @@ static demux_plugin_t *probe_demux (xine_stream_t *stream, int method1, int meth
while (node) {
demux_plugin_t *plugin;
-#ifdef LOG
- printf ("load_plugins: probing demux '%s'\n", node->info->id);
-#endif
+ if (stream->xine->verbosity >= XINE_VERBOSITY_DEBUG)
+ printf ("load_plugins: probing demux '%s'\n", node->info->id);
+
if ((plugin = ((demux_class_t *)node->plugin_class)->open_plugin(node->plugin_class, stream, input))) {
pthread_mutex_unlock (&catalog->lock);
return plugin;