summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuenter Bartsch <guenter@users.sourceforge.net>2002-10-23 21:22:01 +0000
committerGuenter Bartsch <guenter@users.sourceforge.net>2002-10-23 21:22:01 +0000
commit7e401324c7add88e09c26ca06f4b23cfc668fa2c (patch)
treedc1163c32a8f74ab5ffbeea29e5571f63fee88b1 /src
parente7cd5022531590fb18c7ed4d27fc643f9578e114 (diff)
downloadxine-lib-7e401324c7add88e09c26ca06f4b23cfc668fa2c.tar.gz
xine-lib-7e401324c7add88e09c26ca06f4b23cfc668fa2c.tar.bz2
content detection for non-seekable streams
CVS patchset: 2976 CVS date: 2002/10/23 21:22:01
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_mpeg.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/demuxers/demux_mpeg.c b/src/demuxers/demux_mpeg.c
index 717dee423..2e92d311f 100644
--- a/src/demuxers/demux_mpeg.c
+++ b/src/demuxers/demux_mpeg.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_mpeg.c,v 1.86 2002/10/23 21:03:17 guenter Exp $
+ * $Id: demux_mpeg.c,v 1.87 2002/10/23 21:22:01 guenter Exp $
*
* demultiplexer for mpeg 1/2 program streams
* reads streams of variable blocksizes
@@ -1178,8 +1178,35 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
int i, j;
int ok = 0;
- if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) == 0
- || input->get_blocksize(input)) {
+ if (input->get_capabilities(input) & INPUT_CAP_BLOCK ) {
+ free (this);
+ return NULL;
+ }
+
+ if ((input->get_capabilities(input) & INPUT_CAP_SEEKABLE) == 0) {
+
+ /* try preview */
+
+ if ((input->get_capabilities(input) & INPUT_CAP_PREVIEW) == 0) {
+ free (this);
+ return NULL;
+ }
+
+ input->get_optional_data (input, buf, INPUT_OPTIONAL_DATA_PREVIEW);
+
+#ifdef LOG
+ printf ("demux_mpeg: %02x %02x %02x %02x\n",
+ buf[0], buf[1], buf[2], buf[3]);
+#endif
+
+ /*
+ * look for mpeg header
+ */
+
+ if (!buf[0] && !buf[1] && (buf[2] == 0x01)
+ && (buf[3] == 0xba)) /* if so, take it */
+ break;
+
free (this);
return NULL;
}