changeset 17846:27e97a75ef70

recommitted version 1.22 + Rich's 1.25
author nicodvb
date Mon, 13 Mar 2006 07:08:01 +0000
parents 0ebc8dfa136a
children f5131b5b0061
files libmpdemux/muxer_lavf.c
diffstat 1 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/muxer_lavf.c	Mon Mar 13 06:50:55 2006 +0000
+++ b/libmpdemux/muxer_lavf.c	Mon Mar 13 07:08:01 2006 +0000
@@ -103,17 +103,16 @@
 
 static muxer_stream_t* lavf_new_stream(muxer_t *muxer, int type)
 {
-	muxer_priv_t *priv;
+	muxer_priv_t *priv = muxer->priv;
 	muxer_stream_t *stream;
 	muxer_stream_priv_t *spriv;
 	AVCodecContext *ctx;
 
 	if(!muxer || (type != MUXER_TYPE_VIDEO && type != MUXER_TYPE_AUDIO))
 	{
-		mp_msg(MSGT_MUXER, MSGL_ERR, "NULL MUXER PASSED OR UNKNOW TYPE %d\n", type);
+		mp_msg(MSGT_MUXER, MSGL_ERR, "UNKNOW TYPE %d\n", type);
 		return NULL;
 	}
-	priv = muxer->priv;
 	
 	stream = calloc(1, sizeof(muxer_stream_t));
 	if(!stream)
@@ -183,20 +182,19 @@
 #else
 	ctx = &(spriv->avstream->codec);
 #endif
+	
+        if(stream->wf && stream->wf->nAvgBytesPerSec)
+            ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8;
         ctx->rc_buffer_size= stream->vbv_size;
         ctx->rc_max_rate= stream->max_rate;
 
 	if(stream->type == MUXER_TYPE_AUDIO)
 	{
-		if(!stream->wf)
-			return;
 		ctx->codec_id = codec_get_wav_id(stream->wf->wFormatTag); 
 #if 0 //breaks aac in mov at least
 		ctx->codec_tag = codec_get_wav_tag(ctx->codec_id);
 #endif
 		mp_msg(MSGT_MUXER, MSGL_INFO, "AUDIO CODEC ID: %x, TAG: %x\n", ctx->codec_id, (uint32_t) ctx->codec_tag);
-		if(stream->wf->nAvgBytesPerSec)
-			ctx->bit_rate = stream->wf->nAvgBytesPerSec * 8;
 		ctx->sample_rate = stream->wf->nSamplesPerSec;
 //                mp_msg(MSGT_MUXER, MSGL_INFO, "stream->h.dwSampleSize: %d\n", stream->h.dwSampleSize);
 		ctx->channels = stream->wf->nChannels;
@@ -221,8 +219,6 @@
 	}
 	else if(stream->type == MUXER_TYPE_VIDEO)
 	{
-		if(!stream->bih)
-			return;
 		ctx->codec_id = codec_get_bmp_id(stream->bih->biCompression);
                 if(ctx->codec_id <= 0)
                     ctx->codec_tag= stream->bih->biCompression;