# HG changeset patch # User arpi # Date 1042940932 0 # Node ID c671e9adbe22976981d5667bd622fd117e64053f # Parent 454ddf1e295f3d44c86f9af2b2df418c6312f5da Cleanup of the muxer API, func parameters muxer & muxer_f eliminated. patch by Andriy N. Gritsenko diff -r 454ddf1e295f -r c671e9adbe22 TOOLS/vivodump.c --- a/TOOLS/vivodump.c Sun Jan 19 01:25:35 2003 +0000 +++ b/TOOLS/vivodump.c Sun Jan 19 01:48:52 2003 +0000 @@ -149,7 +149,7 @@ int frames=0; FILE *f=fopen("paulvandykforanangel.viv","rb"); FILE *f2=fopen("GB1.avi","wb"); -muxer_t* avi=muxer_new_muxer(MUXER_TYPE_AVI); +muxer_t* avi=muxer_new_muxer(MUXER_TYPE_AVI,f2); muxer_stream_t* mux=muxer_new_stream(avi,MUXER_TYPE_VIDEO); //unsigned char* buffer=malloc(0x200000); int i,len; @@ -169,7 +169,7 @@ mux->bih->biPlanes=1; mux->bih->biBitCount=24; mux->bih->biCompression=0x6f766976;// 7669766f; -muxer_write_header(avi,f2); +muxer_write_header(avi); /* c=fgetc(f); if(c) printf("error! not vivo file?\n"); @@ -222,7 +222,7 @@ // end of frame: printf("Frame size: %d\n",mux->buffer_len); h263_decode_picture_header(mux->buffer); - muxer_write_chunk(avi,mux,f2,mux->buffer_len,0x10); + muxer_write_chunk(mux,mux->buffer_len,0x10); mux->buffer_len=0; if((v_id&0xF0)==0x10) fprintf(stderr,"hmm. last video packet %02X\n",v_id); @@ -258,8 +258,8 @@ mux->bih->biHeight=height; mux->bih->biSizeImage=3*width*height; -muxer_write_index(avi,f2); +muxer_write_index(avi); fseek(f2,0,SEEK_SET); -muxer_write_header(avi,f2); +muxer_write_header(avi); } diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_divx4.c --- a/libmpcodecs/ve_divx4.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_divx4.c Sun Jan 19 01:48:52 2003 +0000 @@ -44,7 +44,6 @@ static int pass; extern char* passtmpfile; -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); #include @@ -273,7 +272,7 @@ enc_result.quantizer); } } - mencoder_write_chunk(mux_v,vf->priv->enc_frame.length,enc_result.is_key_frame?0x10:0); + muxer_write_chunk(mux_v,vf->priv->enc_frame.length,enc_result.is_key_frame?0x10:0); return 1; } diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_lavc.c --- a/libmpcodecs/ve_lavc.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_lavc.c Sun Jan 19 01:48:52 2003 +0000 @@ -27,7 +27,6 @@ #include "vf.h" extern char* passtmpfile; -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); //===========================================================================// @@ -486,7 +485,7 @@ out_size = avcodec_encode_video(lavc_venc_context, mux_v->buffer, mux_v->buffer_size, pic); - mencoder_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0); + muxer_write_chunk(mux_v,out_size,lavc_venc_context->coded_frame->key_frame?0x10:0); #if LIBAVCODEC_BUILD >= 4643 /* store psnr / pict size / type / qscale */ diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_libdv.c --- a/libmpcodecs/ve_libdv.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_libdv.c Sun Jan 19 01:48:52 2003 +0000 @@ -23,8 +23,6 @@ #include -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); - #ifndef DV_WIDTH #define DV_WIDTH 720 #define DV_PAL_HEIGHT 576 @@ -78,7 +76,7 @@ (mpi->flags&MP_IMGFLAG_YUV) ? e_dv_color_yuv : e_dv_color_rgb, mux_v->buffer); - mencoder_write_chunk(mux_v, 480 * (vf->priv->enc->isPAL ? 300 : 250) , 0x10); + muxer_write_chunk(mux_v, 480 * (vf->priv->enc->isPAL ? 300 : 250) , 0x10); return 1; } diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_qtvideo.c --- a/libmpcodecs/ve_qtvideo.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_qtvideo.c Sun Jan 19 01:48:52 2003 +0000 @@ -90,8 +90,6 @@ static OSErr (*GetComponentInfo)(Component prev,ComponentDescription* desc,Handle h1,Handle h2,Handle h3); -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); - //static int format=mmioFOURCC('S','V','Q','1'); static int format=mmioFOURCC('S','V','Q','3'); @@ -260,7 +258,7 @@ printf("Size %i->%i \n",stride*height,compressedsize); printf("Ratio: %i:1\n",(stride*height)/compressedsize); #endif - mencoder_write_chunk(mux_v, compressedsize , similarity?0:0x10); + muxer_write_chunk(mux_v, compressedsize , similarity?0:0x10); if(((*desc)->idSize)>MAX_IDSIZE){ printf("FATAL! idSize=%d too big, increase MAX_IDSIZE in ve_qtvideo.c!\n",((*desc)->idSize)); diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_rawrgb.c --- a/libmpcodecs/ve_rawrgb.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_rawrgb.c Sun Jan 19 01:48:52 2003 +0000 @@ -16,8 +16,6 @@ #include "mp_image.h" #include "vf.h" -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); - //===========================================================================// struct vf_priv_s { @@ -48,7 +46,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ mux_v->buffer=mpi->planes[0]; - mencoder_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10); + muxer_write_chunk(mux_v, mpi->width*mpi->height*3, 0x10); return 1; } diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_vfw.c --- a/libmpcodecs/ve_vfw.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_vfw.c Sun Jan 19 01:48:52 2003 +0000 @@ -25,8 +25,6 @@ #include "muxer.h" -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); - //===========================================================================// static char *vfw_param_codec = NULL; @@ -244,7 +242,7 @@ int ret; // flip_upside_down(vo_image_ptr,vo_image_ptr,3*vo_w,vo_h); // dirty hack ret=vfw_encode_frame(mux_v->bih, mux_v->buffer, vfw_bih, mpi->planes[0], &flags, 10000); - mencoder_write_chunk(mux_v,mux_v->bih->biSizeImage,flags); + muxer_write_chunk(mux_v,mux_v->bih->biSizeImage,flags); return 1; } diff -r 454ddf1e295f -r c671e9adbe22 libmpcodecs/ve_xvid.c --- a/libmpcodecs/ve_xvid.c Sun Jan 19 01:25:35 2003 +0000 +++ b/libmpcodecs/ve_xvid.c Sun Jan 19 01:48:52 2003 +0000 @@ -65,7 +65,6 @@ }; extern char* passtmpfile; -extern void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags); static int xvidenc_pass = 0; static int xvidenc_quality = 4; @@ -454,7 +453,7 @@ } // write output - mencoder_write_chunk(fp->mux, fp->enc_frame.length, fp->enc_frame.intra==1 ? 0x10 : 0); + muxer_write_chunk(fp->mux, fp->enc_frame.length, fp->enc_frame.intra==1 ? 0x10 : 0); // update the VBR engine vbrUpdate(&fp->vbr_state, enc_stats.quant, fp->enc_frame.intra, diff -r 454ddf1e295f -r c671e9adbe22 mencoder.c --- a/mencoder.c Sun Jan 19 01:25:35 2003 +0000 +++ b/mencoder.c Sun Jan 19 01:48:52 2003 +0000 @@ -306,11 +306,6 @@ static muxer_t* muxer=NULL; static FILE* muxer_f=NULL; -// callback for ve_*.c: -void mencoder_write_chunk(muxer_stream_t *s,int len,unsigned int flags){ - muxer_write_chunk(muxer,s,muxer_f,len,flags); -} - extern void print_wave_header(WAVEFORMATEX *h); int main(int argc,char* argv[]){ @@ -606,7 +601,7 @@ mencoder_exit(1,NULL); } -muxer=muxer_new_muxer(out_file_format); +muxer=muxer_new_muxer(out_file_format,muxer_f); // ============= VIDEO =============== @@ -815,7 +810,7 @@ } // if(sh_audio) printf(MSGTR_WritingAVIHeader); -muxer_write_header(muxer,muxer_f); +muxer_write_header(muxer); decoded_frameno=0; @@ -1001,7 +996,7 @@ } } if(len<=0) break; // EOF? - muxer_write_chunk(muxer,mux_a,muxer_f,len,0x10); + muxer_write_chunk(mux_a,len,0x10); if(!mux_a->h.dwSampleSize && mux_a->timer>0) mux_a->wf->nAvgBytesPerSec=0.5f+(double)mux_a->size/mux_a->timer; // avg bps (VBR) if(mux_a->buffer_len>=len){ @@ -1081,11 +1076,11 @@ switch(mux_v->codec){ case VCODEC_COPY: mux_v->buffer=start; - if(skip_flag<=0) muxer_write_chunk(muxer,mux_v,muxer_f,in_size,(sh_video->ds->flags&1)?0x10:0); + if(skip_flag<=0) muxer_write_chunk(mux_v,in_size,(sh_video->ds->flags&1)?0x10:0); break; case VCODEC_FRAMENO: mux_v->buffer=(unsigned char *)&decoded_frameno; // tricky - if(skip_flag<=0) muxer_write_chunk(muxer,mux_v,muxer_f,sizeof(int),0x10); + if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),0x10); break; default: // decode_video will callback down to ve_*.c encoders, through the video filters @@ -1096,7 +1091,7 @@ // unwanted skipping of a frame, what to do? if(skip_limit==0){ // skipping not allowed -> write empty frame: - muxer_write_chunk(muxer,mux_v,muxer_f,0,0); + muxer_write_chunk(mux_v,0,0); } else { // skipping allowed -> skip it and distriubute timer error: v_timer_corr-=(float)mux_v->h.dwScale/mux_v->h.dwRate; @@ -1113,7 +1108,7 @@ if(!tv_param_on && !verbose) printf(MSGTR_DuplicateFrames,-skip_flag); while(skip_flag<0){ duplicatedframes++; - muxer_write_chunk(muxer,mux_v,muxer_f,0,0); + muxer_write_chunk(mux_v,0,0); ++skip_flag; } } else @@ -1272,11 +1267,11 @@ #endif printf(MSGTR_WritingAVIIndex); -muxer_write_index(muxer,muxer_f); +muxer_write_index(muxer); muxer_f_size=ftello(muxer_f); printf(MSGTR_FixupAVIHeader); fseek(muxer_f,0,SEEK_SET); -muxer_write_header(muxer,muxer_f); // update header +muxer_write_header(muxer); // update header if(ferror(muxer_f) || fclose(muxer_f) != 0) { mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_ErrorWritingFile, out_filename); mencoder_exit(1, NULL);