summaryrefslogtreecommitdiffstats
path: root/mencoder.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-06 23:59:46 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-12-06 23:59:46 +0000
commitf513ccbb36627a4a802dd94848f77a3115ce63c7 (patch)
treedabe1a080b268e0c8cc214f675872886dbdf88b0 /mencoder.c
parent150c85d4f404d120e5f89e0af48f7f60759a08ca (diff)
downloadmpv-f513ccbb36627a4a802dd94848f77a3115ce63c7.tar.bz2
mpv-f513ccbb36627a4a802dd94848f77a3115ce63c7.tar.xz
new video codec: frameno (just the number of frame - for 3-pass encoding)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3362 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'mencoder.c')
-rw-r--r--mencoder.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/mencoder.c b/mencoder.c
index 605ed5e208..a39ff1bd2f 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -1,5 +1,7 @@
-#define VCODEC_DIVX4 1
+#define VCODEC_FRAMENO 1
+#define VCODEC_DIVX4 2
+
#define ACODEC_PCM 1
#define ACODEC_VBRMP3 2
@@ -288,6 +290,8 @@ char** filenames=NULL;
char* filename=NULL;
int num_filenames;
+int decoded_frameno=0;
+
//int out_buffer_size=0x200000;
//unsigned char* out_buffer=malloc(out_buffer_size);
@@ -366,7 +370,7 @@ sh_video=d_video->sh;
sh_video->codec=NULL;
-if(out_video_codec){
+if(out_video_codec>1){
if(video_family!=-1) mp_msg(MSGT_MENCODER,MSGL_INFO,MSGTR_TryForceVideoFmt,video_family);
while(1){
@@ -501,6 +505,16 @@ switch(mux_v->codec){
case 0:
mux_v->bih=sh_video->bih;
break;
+case VCODEC_FRAMENO:
+ mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
+ mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
+ mux_v->bih->biWidth=vo_w;
+ mux_v->bih->biHeight=vo_h;
+ mux_v->bih->biPlanes=1;
+ mux_v->bih->biBitCount=24;
+ mux_v->bih->biCompression=mmioFOURCC('F','r','N','o');
+ mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8);
+ break;
case VCODEC_DIVX4:
mux_v->bih=malloc(sizeof(BITMAPINFOHEADER));
mux_v->bih->biSize=sizeof(BITMAPINFOHEADER);
@@ -575,6 +589,9 @@ aviwrite_write_header(muxer,muxer_f);
switch(mux_v->codec){
case 0:
break;
+case VCODEC_FRAMENO:
+ decoded_frameno=0;
+ break;
case VCODEC_DIVX4:
// init divx4linux:
divx4_param.x_dim=vo_w;
@@ -730,7 +747,7 @@ if(sh_audio){
// get video frame!
in_size=video_read_frame(sh_video,&frame_time,&start,force_fps);
if(in_size<0){ eof=1; break; }
- sh_video->timer+=frame_time;
+ sh_video->timer+=frame_time; ++decoded_frameno;
v_timer_corr-=frame_time-(float)mux_v->h.dwScale/mux_v->h.dwRate;
@@ -763,6 +780,10 @@ case 0:
mux_v->buffer=start;
if(skip_flag<=0) aviwrite_write_chunk(muxer,mux_v,muxer_f,in_size,(sh_video->ds->flags&1)?0x10:0);
break;
+case VCODEC_FRAMENO:
+ mux_v->buffer=&decoded_frameno; // tricky
+ aviwrite_write_chunk(muxer,mux_v,muxer_f,sizeof(int),0);
+ break;
case VCODEC_DIVX4:
blit_frame=decode_video(&video_out,sh_video,start,in_size,0);
if(skip_flag>0) break;
@@ -888,6 +909,12 @@ fseek(muxer_f,0,SEEK_SET);
aviwrite_write_header(muxer,muxer_f); // update header
fclose(muxer_f);
+printf("\nVideo stream: %8.3f kbit/s (%d bps) size: %d bytes %5.3f secs\n",
+ (float)(mux_v->size/mux_v->timer*8.0f/1000.0f), (int)(mux_v->size/mux_v->timer), mux_v->size, (float)mux_v->timer);
+if(sh_audio)
+printf("\nAudio stream: %8.3f kbit/s (%d bps) size: %d bytes %5.3f secs\n",
+ (float)(mux_a->size/mux_a->timer*8.0f/1000.0f), (int)(mux_a->size/mux_a->timer), mux_a->size, (float)mux_a->timer);
+
if(stream) free_stream(stream); // kill cache thread
return interrupted;