Index: vc1dec.c
===================================================================
--- vc1dec.c	(revision 26400)
+++ vc1dec.c	(working copy)
@@ -3008,12 +3008,20 @@
     MpegEncContext *s = &v->s;
     GetBitContext gb;
 
-    if (!avctx->extradata_size || !avctx->extradata) return -1;
+	/* dont enable the next check: if a codec open fails, a stream will still be read later 
+	* (unless the user quits, but she might need another stream 
+	* in that case, the vc1 tables are not initialized, the stream gets decoded, and all goes 
+	* downhill from there
+	*/
+//    if (!avctx->extradata_size || !avctx->extradata) return -1;
     if (!(avctx->flags & CODEC_FLAG_GRAY))
         avctx->pix_fmt = avctx->get_format(avctx, avctx->codec->pix_fmts);
     else
         avctx->pix_fmt = PIX_FMT_GRAY8;
-    avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
+	if(avctx->hwaccel_context)
+	    avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
+	else
+		avctx->hwaccel = NULL;
     v->s.avctx = avctx;
     avctx->flags |= CODEC_FLAG_EMU_EDGE;
     v->s.flags |= CODEC_FLAG_EMU_EDGE;
@@ -3060,42 +3068,40 @@
         uint8_t *buf2 = NULL;
         int seq_initialized = 0, ep_initialized = 0;
 
-        if(avctx->extradata_size < 16) {
-            av_log(avctx, AV_LOG_ERROR, "Extradata size too small: %i\n", avctx->extradata_size);
-            return -1;
-        }
-
-        buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
-        start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv
-        next = start;
-        for(; next < end; start = next){
-            next = find_next_marker(start + 4, end);
-            size = next - start - 4;
-            if(size <= 0) continue;
-            buf2_size = vc1_unescape_buffer(start + 4, size, buf2);
-            init_get_bits(&gb, buf2, buf2_size * 8);
-            switch(AV_RB32(start)){
-            case VC1_CODE_SEQHDR:
-                if(vc1_decode_sequence_header(avctx, v, &gb) < 0){
-                    av_free(buf2);
-                    return -1;
-                }
-                seq_initialized = 1;
-                break;
-            case VC1_CODE_ENTRYPOINT:
-                if(vc1_decode_entry_point(avctx, v, &gb) < 0){
-                    av_free(buf2);
-                    return -1;
-                }
-                ep_initialized = 1;
-                break;
-            }
-        }
-        av_free(buf2);
-        if(!seq_initialized || !ep_initialized){
-            av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
-            return -1;
-        }
+        if(avctx->extradata_size >= 16) 
+		{
+			buf2 = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+			start = find_next_marker(start, end); // in WVC1 extradata first byte is its size, but can be 0 in mkv
+			next = start;
+			for(; next < end; start = next){
+				next = find_next_marker(start + 4, end);
+				size = next - start - 4;
+				if(size <= 0) continue;
+				buf2_size = vc1_unescape_buffer(start + 4, size, buf2);
+				init_get_bits(&gb, buf2, buf2_size * 8);
+				switch(AV_RB32(start)){
+				case VC1_CODE_SEQHDR:
+					if(vc1_decode_sequence_header(avctx, v, &gb) < 0){
+						av_free(buf2);
+						return -1;
+					}
+					seq_initialized = 1;
+					break;
+				case VC1_CODE_ENTRYPOINT:
+					if(vc1_decode_entry_point(avctx, v, &gb) < 0){
+						av_free(buf2);
+						return -1;
+					}
+					ep_initialized = 1;
+					break;
+				}
+			}
+			av_free(buf2);
+			if(!seq_initialized || !ep_initialized){
+				av_log(avctx, AV_LOG_ERROR, "Incomplete extradata\n");
+				return -1;
+			}
+		}
     }
     avctx->has_b_frames= !!(avctx->max_b_frames);
     s->low_delay = !avctx->has_b_frames;
@@ -3283,10 +3289,13 @@
     s->me.qpel_put= s->dsp.put_qpel_pixels_tab;
     s->me.qpel_avg= s->dsp.avg_qpel_pixels_tab;
 
+#if CONFIG_VC1_VDPAU_DECODER
     if ((CONFIG_VC1_VDPAU_DECODER)
         &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
         ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
-    else if (avctx->hwaccel) {
+	else 
+#endif	//	#if CONFIG_VC1_VDPAU_DECODER
+    if (avctx->hwaccel) {
         if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
             return -1;
         if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
