summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}