[MPlayer-cvslog] CVS: main/libmpdemux muxer_lavf.c,1.4,1.5
Nico Sabbi CVS
syncmail at mplayerhq.hu
Sun Apr 17 11:13:50 CEST 2005
CVS change done by Nico Sabbi CVS
Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv28159
Modified Files:
muxer_lavf.c
Log Message:
added missing initializer in URLProtocolo; mux packets only if len > 0; second mencoder's a/v sync model
Index: muxer_lavf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer_lavf.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- muxer_lavf.c 6 Apr 2005 11:57:09 -0000 1.4
+++ muxer_lavf.c 17 Apr 2005 09:13:48 -0000 1.5
@@ -81,6 +81,7 @@
mp_write,
mp_seek,
mp_close,
+ NULL
};
static muxer_stream_t* lavf_new_stream(muxer_t *muxer, int type)
@@ -102,7 +103,7 @@
mp_msg(MSGT_MUXER, MSGL_ERR, "Could not alloc muxer_stream, EXIT\n");
return NULL;
}
- stream->b_buffer = malloc(2048);
+ stream->b_buffer = (unsigned char *)malloc(2048);
if(!stream->b_buffer)
{
mp_msg(MSGT_MUXER, MSGL_ERR, "Could not alloc b_buffer, EXIT\n");
@@ -167,7 +168,9 @@
ctx->channels = stream->wf->nChannels;
if(stream->h.dwRate && (stream->h.dwScale * (int64_t)ctx->sample_rate) % stream->h.dwRate == 0)
ctx->frame_size= (stream->h.dwScale * (int64_t)ctx->sample_rate) / stream->h.dwRate;
-// printf("ctx->block_align = stream->wf->nBlockAlign; %d=%d stream->wf->nAvgBytesPerSec:%d\n", ctx->block_align, stream->wf->nBlockAlign, stream->wf->nAvgBytesPerSec);
+ mp_msg(MSGT_MUXER, MSGL_V, "MUXER_LAVF(audio stream) frame_size: %d, scale: %u, sps: %u, rate: %u, ctx->block_align = stream->wf->nBlockAlign; %d=%d stream->wf->nAvgBytesPerSec:%d\n",
+ ctx->frame_size, stream->h.dwScale, ctx->sample_rate, stream->h.dwRate,
+ ctx->block_align, stream->wf->nBlockAlign, stream->wf->nAvgBytesPerSec);
ctx->block_align = stream->wf->nBlockAlign;
}
else if(stream->type == MUXER_TYPE_VIDEO)
@@ -188,18 +191,17 @@
muxer_priv_t *priv = (muxer_priv_t *) muxer->priv;
muxer_stream_priv_t *spriv = (muxer_stream_priv_t *) stream->priv;
AVPacket pkt;
- AVCodecContext *ctx;
stream->size += len;
- if(stream->type == MUXER_TYPE_VIDEO && !len)
- return;
+ if(len)
+ {
av_init_packet(&pkt);
pkt.size = len;
pkt.stream_index= spriv->avstream->index;
pkt.data = stream->buffer;
- if((stream->type == MUXER_TYPE_VIDEO) && (flags & AVIIF_KEYFRAME))
+ if(flags & AVIIF_KEYFRAME)
pkt.flags |= PKT_FLAG_KEY;
else
pkt.flags = 0;
@@ -208,16 +210,16 @@
//pkt.pts = AV_NOPTS_VALUE;
pkt.pts = AV_TIME_BASE * stream->timer;
- if(stream->h.dwSampleSize) // CBR
- stream->h.dwLength += len / stream->h.dwSampleSize;
- else // VBR
- stream->h.dwLength++;
-
- //;
if(av_interleaved_write_frame(priv->oc, &pkt) != 0) //av_write_frame(priv->oc, &pkt)
{
mp_msg(MSGT_MUXER, MSGL_ERR, "Error while writing frame\n");
}
+ }
+
+ if(stream->h.dwSampleSize) // CBR
+ stream->h.dwLength += len / stream->h.dwSampleSize;
+ else // VBR
+ stream->h.dwLength++;
stream->timer = (double) stream->h.dwLength * stream->h.dwScale / stream->h.dwRate;
return;
More information about the MPlayer-cvslog
mailing list