summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/demuxers/demux_mpeg_block.c4
-rw-r--r--src/libmad/xine_decoder.c14
2 files changed, 16 insertions, 2 deletions
diff --git a/src/demuxers/demux_mpeg_block.c b/src/demuxers/demux_mpeg_block.c
index 5026774fd..da81fbb60 100644
--- a/src/demuxers/demux_mpeg_block.c
+++ b/src/demuxers/demux_mpeg_block.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_block.c,v 1.155 2003/01/10 21:11:01 miguelfreitas Exp $
+ * $Id: demux_mpeg_block.c,v 1.156 2003/01/11 11:29:22 esnel Exp $
*
* demultiplexer for mpeg 1/2 program streams
*
@@ -1089,6 +1089,8 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
return NULL;
}
+ input->seek(input, 0, SEEK_SET);
+
demux_mpeg_block_accept_input (this, input);
#ifdef LOG
printf("demux_mpeg_block:open_plugin:Accepting detection_method XINE_DEMUX_CONTENT_STRATEGY blocksize=%d\n",this->blocksize);
diff --git a/src/libmad/xine_decoder.c b/src/libmad/xine_decoder.c
index 7e939bbf6..b53682387 100644
--- a/src/libmad/xine_decoder.c
+++ b/src/libmad/xine_decoder.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: xine_decoder.c,v 1.39 2003/01/08 01:02:29 miguelfreitas Exp $
+ * $Id: xine_decoder.c,v 1.40 2003/01/11 11:29:22 esnel Exp $
*
* stuff needed to turn libmad into a xine decoder plugin
*/
@@ -59,6 +59,7 @@ typedef struct mad_decoder_s {
uint8_t buffer[INPUT_BUF_SIZE];
int bytes_in_buffer;
+ int preview_mode;
} mad_decoder_t;
@@ -72,6 +73,7 @@ static void mad_reset (audio_decoder_t *this_gen) {
this->pts = 0;
this->bytes_in_buffer = 0;
+ this->preview_mode = 0;
mad_synth_init (&this->synth);
mad_stream_init (&this->stream);
@@ -135,6 +137,15 @@ static void mad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf) {
if ((buf->decoder_flags & BUF_FLAG_HEADER) == 0) {
+ /* reset decoder on leaving preview mode */
+ if ((buf->decoder_flags & BUF_FLAG_PREVIEW) == 0) {
+ if (this->preview_mode) {
+ mad_reset (this_gen);
+ }
+ } else {
+ this->preview_mode = 1;
+ }
+
xine_fast_memcpy (&this->buffer[this->bytes_in_buffer],
buf->content, buf->size);
this->bytes_in_buffer += buf->size;
@@ -293,6 +304,7 @@ static audio_decoder_t *open_plugin (audio_decoder_class_t *class_gen, xine_stre
this->output_open = 0;
this->bytes_in_buffer = 0;
+ this->preview_mode = 0;
this->xstream = stream;