changeset 24905:170dcb44069a

moved to fix_parameters() the code that decides if the PSM is needed
author nicodvb
date Fri, 02 Nov 2007 18:50:41 +0000
parents 75e930e20f48
children e3fec0def910
files libmpdemux/muxer_mpeg.c
diffstat 1 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/muxer_mpeg.c	Fri Nov 02 17:48:27 2007 +0000
+++ b/libmpdemux/muxer_mpeg.c	Fri Nov 02 18:50:41 2007 +0000
@@ -666,7 +666,7 @@
 
 static int psm_is_late(muxer_priv_t *priv)
 {
-	return (priv->scr >= priv->last_psm_scr + 27000000ULL);
+	return (!priv->data_size || (priv->scr >= priv->last_psm_scr + 27000000ULL));
 }
 
 static int write_mpeg_pes_header(muxer_headers_t *h, uint8_t *pes_id, uint8_t *buff, uint16_t plen, int stuffing_len, int mux_type)
@@ -2227,9 +2227,11 @@
 	muxer_headers_t *spriv = stream->priv;
 	muxer_t *muxer = stream->muxer;
 	muxer_priv_t *priv = muxer->priv;
+	uint32_t stream_format;
 
 	if(stream->type == MUXER_TYPE_AUDIO)
 	{
+		stream_format = stream->wf->wFormatTag;
 		spriv->is_ready = 1;
 		if(conf_abuf_size)
 			spriv->max_buffer_size = conf_abuf_size*1024;
@@ -2251,6 +2253,7 @@
 	}
 	else	//video
 	{
+		stream_format = stream->bih->biCompression;
 		if(conf_vbuf_size)
 			spriv->max_buffer_size = conf_vbuf_size*1024;
 		else
@@ -2270,6 +2273,12 @@
 		else
 			spriv->is_ready = 1;
 	}
+	
+	if(priv->is_genmpeg2)
+	{
+		add_to_psm(priv, spriv->id, stream_format);
+		priv->psm_streams_cnt++;
+	}
 }
 
 
@@ -2371,16 +2380,6 @@
 		}
 	}
 
-
-	if(spriv->psm_fixed == 0)
-	{
-		add_to_psm(priv, spriv->id, stream_format);
-		spriv->psm_fixed = 1;
-		priv->psm_streams_cnt++;
-		if((priv->psm_streams_cnt == muxer->num_videos + muxer->num_audios) && priv->use_psm)
-			write_psm_block(muxer, muxer->stream);
-	}
-
 	flush_buffers(muxer, 0);
 }