Mercurial > mplayer.hg
comparison mencoder.c @ 4743:171dcc22b607
using mencoder_exit instead exit and return
| author | alex |
|---|---|
| date | Sun, 17 Feb 2002 13:50:26 +0000 |
| parents | f5af54e6c393 |
| children | 4b794a67e9ca |
comparison
equal
deleted
inserted
replaced
| 4742:a34682347090 | 4743:171dcc22b607 |
|---|---|
| 78 int lavc_param_vme = 3; | 78 int lavc_param_vme = 3; |
| 79 int lavc_param_vqscale = 0; | 79 int lavc_param_vqscale = 0; |
| 80 int lavc_param_keyint = -1; | 80 int lavc_param_keyint = -1; |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 #ifdef USE_WIN32DLL | |
| 83 static BITMAPINFOHEADER* vfw_bih=NULL; | 84 static BITMAPINFOHEADER* vfw_bih=NULL; |
| 85 char *vfw_codecname = NULL; | |
| 86 codecs_t *vfw_codec = NULL; | |
| 87 #endif | |
| 84 | 88 |
| 85 #ifdef HAVE_LIBCSS | 89 #ifdef HAVE_LIBCSS |
| 86 #include "libmpdemux/dvdauth.h" | 90 #include "libmpdemux/dvdauth.h" |
| 87 #endif | 91 #endif |
| 88 | 92 |
| 221 | 225 |
| 222 #ifdef USE_DVDREAD | 226 #ifdef USE_DVDREAD |
| 223 #include "spudec.h" | 227 #include "spudec.h" |
| 224 #endif | 228 #endif |
| 225 | 229 |
| 230 /* FIXME */ | |
| 231 void mencoder_exit(int level, char *how) | |
| 232 { | |
| 233 if (how) | |
| 234 printf("Exiting... (%s)\n", how); | |
| 235 else | |
| 236 printf("Exiting...\n"); | |
| 237 | |
| 238 exit(level); | |
| 239 } | |
| 240 | |
| 226 void parse_cfgfiles( m_config_t* conf ) | 241 void parse_cfgfiles( m_config_t* conf ) |
| 227 { | 242 { |
| 228 char *conffile; | 243 char *conffile; |
| 229 if ((conffile = get_path("mencoder")) == NULL) { | 244 if ((conffile = get_path("mencoder")) == NULL) { |
| 230 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem); | 245 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem); |
| 231 } else { | 246 } else { |
| 232 if (m_config_parse_config_file(conf, conffile) < 0) | 247 if (m_config_parse_config_file(conf, conffile) < 0) |
| 233 exit(1); | 248 mencoder_exit(1,"configfile error"); |
| 234 free(conffile); | 249 free(conffile); |
| 235 } | 250 } |
| 236 } | 251 } |
| 237 | 252 |
| 238 //--------------------------------------------------------------------------- | 253 //--------------------------------------------------------------------------- |
| 394 | 409 |
| 395 // check codec.conf | 410 // check codec.conf |
| 396 if(!parse_codec_cfg(get_path("codecs.conf"))){ | 411 if(!parse_codec_cfg(get_path("codecs.conf"))){ |
| 397 if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ | 412 if(!parse_codec_cfg(CONFDIR"/codecs.conf")){ |
| 398 mp_msg(MSGT_MENCODER,MSGL_HINT,MSGTR_CopyCodecsConf); | 413 mp_msg(MSGT_MENCODER,MSGL_HINT,MSGTR_CopyCodecsConf); |
| 399 exit(1); | 414 mencoder_exit(1,NULL); |
| 400 } | 415 } |
| 401 } | 416 } |
| 402 | 417 |
| 403 /* Test for cpu capabilities (and corresponding OS support) for optimizing */ | 418 /* Test for cpu capabilities (and corresponding OS support) for optimizing */ |
| 404 #ifdef ARCH_X86 | 419 #ifdef ARCH_X86 |
| 429 mconfig = m_config_new(playtree); | 444 mconfig = m_config_new(playtree); |
| 430 m_config_register_options(mconfig,mencoder_opts); | 445 m_config_register_options(mconfig,mencoder_opts); |
| 431 // TODO : add something to let modules register their options | 446 // TODO : add something to let modules register their options |
| 432 parse_cfgfiles(mconfig); | 447 parse_cfgfiles(mconfig); |
| 433 | 448 |
| 434 if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline | 449 if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) mencoder_exit(1, "error parsing cmdline"); |
| 435 playtree = play_tree_cleanup(playtree); | 450 playtree = play_tree_cleanup(playtree); |
| 436 if(playtree) { | 451 if(playtree) { |
| 437 playtree_iter = play_tree_iter_new(playtree,mconfig); | 452 playtree_iter = play_tree_iter_new(playtree,mconfig); |
| 438 if(playtree_iter) { | 453 if(playtree_iter) { |
| 439 if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { | 454 if(play_tree_iter_step(playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { |
| 444 } | 459 } |
| 445 } | 460 } |
| 446 | 461 |
| 447 if(!filename && !vcd_track && !dvd_title && !tv_param_on){ | 462 if(!filename && !vcd_track && !dvd_title && !tv_param_on){ |
| 448 printf("\nMissing filename!\n\n"); | 463 printf("\nMissing filename!\n\n"); |
| 449 exit(1); | 464 mencoder_exit(1,NULL); |
| 450 } | 465 } |
| 451 | 466 |
| 452 mp_msg_init(verbose+MSGL_STATUS); | 467 mp_msg_init(verbose+MSGL_STATUS); |
| 453 | 468 |
| 454 stream=open_stream(filename,vcd_track,&file_format); | 469 stream=open_stream(filename,vcd_track,&file_format); |
| 455 | 470 |
| 456 if(!stream){ | 471 if(!stream){ |
| 457 printf("Cannot open file/device\n"); | 472 printf("Cannot open file/device\n"); |
| 458 exit(1); | 473 mencoder_exit(1,NULL); |
| 459 } | 474 } |
| 460 | 475 |
| 461 printf("success: format: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos)); | 476 printf("success: format: %d data: 0x%X - 0x%X\n",file_format, (int)(stream->start_pos),(int)(stream->end_pos)); |
| 462 | 477 |
| 463 if(stream_cache_size) stream_enable_cache(stream,stream_cache_size*1024,0,0); | 478 if(stream_cache_size) stream_enable_cache(stream,stream_cache_size*1024,0,0); |
| 465 #ifdef HAVE_LIBCSS | 480 #ifdef HAVE_LIBCSS |
| 466 // current_module="libcss"; | 481 // current_module="libcss"; |
| 467 if (dvdimportkey) { | 482 if (dvdimportkey) { |
| 468 if (dvd_import_key(dvdimportkey)) { | 483 if (dvd_import_key(dvdimportkey)) { |
| 469 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDkey); | 484 mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_ErrorDVDkey); |
| 470 exit(1); | 485 mencoder_exit(1,NULL); |
| 471 } | 486 } |
| 472 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CmdlineDVDkey); | 487 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_CmdlineDVDkey); |
| 473 } | 488 } |
| 474 if (dvd_auth_device) { | 489 if (dvd_auth_device) { |
| 475 // if (dvd_auth(dvd_auth_device,f)) { | 490 // if (dvd_auth(dvd_auth_device,f)) { |
| 476 if (dvd_auth(dvd_auth_device,filename)) { | 491 if (dvd_auth(dvd_auth_device,filename)) { |
| 477 mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error in DVD auth...\n"); | 492 mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error in DVD auth...\n"); |
| 478 exit(1); | 493 mencoder_exit(1,NULL); |
| 479 } | 494 } |
| 480 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_DVDauthOk); | 495 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_DVDauthOk); |
| 481 } | 496 } |
| 482 #endif | 497 #endif |
| 483 | 498 |
| 485 | 500 |
| 486 //demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id); | 501 //demuxer=demux_open(stream,file_format,video_id,audio_id,dvdsub_id); |
| 487 demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id); | 502 demuxer=demux_open(stream,file_format,audio_id,video_id,dvdsub_id); |
| 488 if(!demuxer){ | 503 if(!demuxer){ |
| 489 printf("Cannot open demuxer\n"); | 504 printf("Cannot open demuxer\n"); |
| 490 exit(1); | 505 mencoder_exit(1,NULL); |
| 491 } | 506 } |
| 492 | 507 |
| 493 d_audio=demuxer2 ? demuxer2->audio : demuxer->audio; | 508 d_audio=demuxer2 ? demuxer2->audio : demuxer->audio; |
| 494 d_video=demuxer->video; | 509 d_video=demuxer->video; |
| 495 d_dvdsub=demuxer->sub; | 510 d_dvdsub=demuxer->sub; |
| 496 sh_audio=d_audio->sh; | 511 sh_audio=d_audio->sh; |
| 497 sh_video=d_video->sh; | 512 sh_video=d_video->sh; |
| 498 | 513 |
| 499 if(!video_read_properties(sh_video)){ | 514 if(!video_read_properties(sh_video)){ |
| 500 printf("Couldn't read video properties\n"); | 515 printf("Couldn't read video properties\n"); |
| 501 exit(1); | 516 mencoder_exit(1,NULL); |
| 502 } | 517 } |
| 503 | 518 |
| 504 mp_msg(MSGT_MENCODER,MSGL_INFO,"[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", | 519 mp_msg(MSGT_MENCODER,MSGL_INFO,"[V] filefmt:%d fourcc:0x%X size:%dx%d fps:%5.2f ftime:=%6.4f\n", |
| 505 demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, | 520 demuxer->file_format,sh_video->format, sh_video->disp_w,sh_video->disp_h, |
| 506 sh_video->fps,sh_video->frametime | 521 sh_video->fps,sh_video->frametime |
| 525 continue; | 540 continue; |
| 526 } | 541 } |
| 527 if(bestprio==-1 || !video_codec) { | 542 if(bestprio==-1 || !video_codec) { |
| 528 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format); | 543 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantFindVideoCodec,sh_video->format); |
| 529 mp_msg(MSGT_MENCODER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); | 544 mp_msg(MSGT_MENCODER,MSGL_HINT, MSGTR_TryUpgradeCodecsConfOrRTFM,get_path("codecs.conf")); |
| 530 exit(1); | 545 mencoder_exit(1,NULL); |
| 531 } | 546 } |
| 532 } else { | 547 } else { |
| 533 if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue; | 548 if(video_codec && strcmp(sh_video->codec->name,video_codec)) continue; |
| 534 else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue; | 549 else if(video_family!=-1 && sh_video->codec->driver!=video_family) continue; |
| 535 else if(video_family==-1 && !video_codec && sh_video->codec->priority) { | 550 else if(video_family==-1 && !video_codec && sh_video->codec->priority) { |
| 573 if(out_fmt==IMGFMT_UYVY) break; | 588 if(out_fmt==IMGFMT_UYVY) break; |
| 574 } | 589 } |
| 575 } | 590 } |
| 576 if(i>=CODECS_MAX_OUTFMT){ | 591 if(i>=CODECS_MAX_OUTFMT){ |
| 577 mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_VOincompCodec); | 592 mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_VOincompCodec); |
| 578 exit(1); // exit_player(MSGTR_Exit_error); | 593 mencoder_exit(1,NULL); // exit_player(MSGTR_Exit_error); |
| 579 } | 594 } |
| 580 sh_video->outfmtidx=i; | 595 sh_video->outfmtidx=i; |
| 581 | 596 |
| 582 if((out_fmt==IMGFMT_YV12 || out_fmt==IMGFMT_IYUV || out_fmt==IMGFMT_I420) && | 597 if((out_fmt==IMGFMT_YV12 || out_fmt==IMGFMT_IYUV || out_fmt==IMGFMT_I420) && |
| 583 (vo_w!=0 || vo_h!=0)) | 598 (vo_w!=0 || vo_h!=0)) |
| 604 if (IMGFMT_IS_RGB(out_fmt)) | 619 if (IMGFMT_IS_RGB(out_fmt)) |
| 605 vo_image_ptr = vo_image = malloc(vo_w*vo_h*IMGFMT_RGB_DEPTH(out_fmt)/8); | 620 vo_image_ptr = vo_image = malloc(vo_w*vo_h*IMGFMT_RGB_DEPTH(out_fmt)/8); |
| 606 | 621 |
| 607 if(!init_video(sh_video,pitches)){ | 622 if(!init_video(sh_video,pitches)){ |
| 608 mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_CouldntInitVideoCodec); | 623 mp_msg(MSGT_MENCODER,MSGL_FATAL,MSGTR_CouldntInitVideoCodec); |
| 609 exit(1); | 624 mencoder_exit(1,NULL); |
| 610 } | 625 } |
| 611 | 626 |
| 612 } // if(out_video_codec) | 627 } // if(out_video_codec) |
| 613 | 628 |
| 614 if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf)){ | 629 if(sh_audio && (out_audio_codec || seek_to_sec || !sh_audio->wf)){ |
| 661 | 676 |
| 662 // set up output file: | 677 // set up output file: |
| 663 muxer_f=fopen(out_filename,"wb"); | 678 muxer_f=fopen(out_filename,"wb"); |
| 664 if(!muxer_f) { | 679 if(!muxer_f) { |
| 665 printf("Cannot open output file '%s'\n", out_filename); | 680 printf("Cannot open output file '%s'\n", out_filename); |
| 666 exit(1); | 681 mencoder_exit(1,NULL); |
| 667 } | 682 } |
| 668 | 683 |
| 669 muxer=aviwrite_new_muxer(); | 684 muxer=aviwrite_new_muxer(); |
| 670 | 685 |
| 671 // ============= VIDEO =============== | 686 // ============= VIDEO =============== |
| 756 mux_v->bih->biCompression=mmioFOURCC('F','r','N','o'); | 771 mux_v->bih->biCompression=mmioFOURCC('F','r','N','o'); |
| 757 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); | 772 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); |
| 758 break; | 773 break; |
| 759 case VCODEC_VFW: | 774 case VCODEC_VFW: |
| 760 #ifdef USE_WIN32DLL | 775 #ifdef USE_WIN32DLL |
| 776 #if 0 | |
| 777 if (!vfw_codecname) | |
| 778 { | |
| 779 printf("No vfw/dshow codec specified! It's requested!\n"); | |
| 780 mencoder_exit(1, NULL); | |
| 781 } | |
| 782 #endif | |
| 761 vfw_bih=malloc(sizeof(BITMAPINFOHEADER)); | 783 vfw_bih=malloc(sizeof(BITMAPINFOHEADER)); |
| 762 vfw_bih->biSize=sizeof(BITMAPINFOHEADER); | 784 vfw_bih->biSize=sizeof(BITMAPINFOHEADER); |
| 763 vfw_bih->biWidth=vo_w; | 785 vfw_bih->biWidth=vo_w; |
| 764 vfw_bih->biHeight=vo_h; | 786 vfw_bih->biHeight=vo_h; |
| 765 vfw_bih->biPlanes=1; | 787 vfw_bih->biPlanes=1; |
| 769 // mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3')); | 791 // mux_v->bih=vfw_open_encoder("divxc32.dll",vfw_bih,mmioFOURCC('D', 'I', 'V', '3')); |
| 770 mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0); | 792 mux_v->bih=vfw_open_encoder("AvidAVICodec.dll",vfw_bih, 0); |
| 771 break; | 793 break; |
| 772 #else | 794 #else |
| 773 printf("No support for Win32/VfW codecs compiled in\n"); | 795 printf("No support for Win32/VfW codecs compiled in\n"); |
| 774 return 0; /* FIXME */ | 796 mencoder_exit(1,NULL); |
| 775 #endif | 797 #endif |
| 776 case VCODEC_NULL: | 798 case VCODEC_NULL: |
| 777 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); | 799 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); |
| 778 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); | 800 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); |
| 779 mux_v->bih->biWidth=vo_w; | 801 mux_v->bih->biWidth=vo_w; |
| 784 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); | 806 mux_v->bih->biSizeImage=mux_v->bih->biWidth*mux_v->bih->biHeight*(mux_v->bih->biBitCount/8); |
| 785 break; | 807 break; |
| 786 case VCODEC_DIVX4: | 808 case VCODEC_DIVX4: |
| 787 #ifndef HAVE_DIVX4ENCORE | 809 #ifndef HAVE_DIVX4ENCORE |
| 788 printf("No support for Divx4 encore compiled in\n"); | 810 printf("No support for Divx4 encore compiled in\n"); |
| 789 return 0; /* FIXME */ | 811 mencoder_exit(1,NULL); |
| 790 #else | 812 #else |
| 791 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); | 813 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); |
| 792 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); | 814 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); |
| 793 mux_v->bih->biWidth=vo_w; | 815 mux_v->bih->biWidth=vo_w; |
| 794 mux_v->bih->biHeight=vo_h; | 816 mux_v->bih->biHeight=vo_h; |
| 802 break; | 824 break; |
| 803 #endif | 825 #endif |
| 804 case VCODEC_LIBAVCODEC: | 826 case VCODEC_LIBAVCODEC: |
| 805 #ifndef USE_LIBAVCODEC | 827 #ifndef USE_LIBAVCODEC |
| 806 printf("No support for FFmpeg's libavcodec compiled in\n"); | 828 printf("No support for FFmpeg's libavcodec compiled in\n"); |
| 807 return 0; /* FIXME */ | 829 mencoder_exit(1,NULL); |
| 808 #else | 830 #else |
| 809 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); | 831 mux_v->bih=malloc(sizeof(BITMAPINFOHEADER)); |
| 810 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); | 832 mux_v->bih->biSize=sizeof(BITMAPINFOHEADER); |
| 811 mux_v->bih->biWidth=vo_w; | 833 mux_v->bih->biWidth=vo_w; |
| 812 mux_v->bih->biHeight=vo_h; | 834 mux_v->bih->biHeight=vo_h; |
| 813 mux_v->bih->biPlanes=1; | 835 mux_v->bih->biPlanes=1; |
| 814 mux_v->bih->biBitCount=24; | 836 mux_v->bih->biBitCount=24; |
| 815 if (!lavc_param_vcodec) | 837 if (!lavc_param_vcodec) |
| 816 { | 838 { |
| 817 printf("No libavcodec codec specified! It's requested!\n"); | 839 printf("No libavcodec codec specified! It's requested!\n"); |
| 818 return 0; /* FIXME */ | 840 mencoder_exit(1,NULL); |
| 819 } | 841 } |
| 820 else | 842 else |
| 821 { | 843 { |
| 822 const char *vcodec = lavc_param_vcodec; | 844 const char *vcodec = lavc_param_vcodec; |
| 823 if (!strcasecmp(vcodec, "mpeg1video")) | 845 if (!strcasecmp(vcodec, "mpeg1video")) |
| 958 decoded_frameno=0; | 980 decoded_frameno=0; |
| 959 break; | 981 break; |
| 960 case VCODEC_DIVX4: | 982 case VCODEC_DIVX4: |
| 961 #ifndef HAVE_DIVX4ENCORE | 983 #ifndef HAVE_DIVX4ENCORE |
| 962 printf("No support for Divx4 encore compiled in\n"); | 984 printf("No support for Divx4 encore compiled in\n"); |
| 963 return 0; /* FIXME */ | 985 mencoder_exit(1,NULL); |
| 964 #else | 986 #else |
| 965 // init divx4linux: | 987 // init divx4linux: |
| 966 divx4_param.x_dim=vo_w; | 988 divx4_param.x_dim=vo_w; |
| 967 divx4_param.y_dim=vo_h; | 989 divx4_param.y_dim=vo_h; |
| 968 divx4_param.framerate=(float)mux_v->h.dwRate/mux_v->h.dwScale; | 990 divx4_param.framerate=(float)mux_v->h.dwRate/mux_v->h.dwScale; |
| 982 case IMGFMT_BGR24: | 1004 case IMGFMT_BGR24: |
| 983 enc_frame.colorspace=ENC_CSP_RGB24; break; | 1005 enc_frame.colorspace=ENC_CSP_RGB24; break; |
| 984 default: | 1006 default: |
| 985 mp_msg(MSGT_MENCODER,MSGL_ERR,"divx4: unsupported picture format (%s)!\n", | 1007 mp_msg(MSGT_MENCODER,MSGL_ERR,"divx4: unsupported picture format (%s)!\n", |
| 986 vo_format_name(out_fmt)); | 1008 vo_format_name(out_fmt)); |
| 1009 mencoder_exit(1,NULL); | |
| 987 } | 1010 } |
| 988 switch(pass){ | 1011 switch(pass){ |
| 989 case 1: | 1012 case 1: |
| 990 if (VbrControl_init_2pass_vbr_analysis(passtmpfile, divx4_param.quality) == -1) | 1013 if (VbrControl_init_2pass_vbr_analysis(passtmpfile, divx4_param.quality) == -1) |
| 991 { | 1014 { |
| 1042 #endif | 1065 #endif |
| 1043 | 1066 |
| 1044 if (!lavc_venc_codec) | 1067 if (!lavc_venc_codec) |
| 1045 { | 1068 { |
| 1046 printf(MSGTR_MissingLAVCcodec, lavc_param_vcodec); | 1069 printf(MSGTR_MissingLAVCcodec, lavc_param_vcodec); |
| 1047 return 0; /* FIXME */ | 1070 mencoder_exit(1,NULL); |
| 1048 } | 1071 } |
| 1049 | 1072 |
| 1050 memset(&lavc_venc_context, 0, sizeof(lavc_venc_context)); | 1073 memset(&lavc_venc_context, 0, sizeof(lavc_venc_context)); |
| 1051 | 1074 |
| 1052 // lavc_venc_context.width = mux_v->bih->biWidth; | 1075 // lavc_venc_context.width = mux_v->bih->biWidth; |
| 1088 } | 1111 } |
| 1089 | 1112 |
| 1090 if (avcodec_open(&lavc_venc_context, lavc_venc_codec) != 0) | 1113 if (avcodec_open(&lavc_venc_context, lavc_venc_codec) != 0) |
| 1091 { | 1114 { |
| 1092 printf(MSGTR_CantOpenCodec); | 1115 printf(MSGTR_CantOpenCodec); |
| 1093 return 0; /* FIXME */ | 1116 mencoder_exit(1,NULL); |
| 1094 } | 1117 } |
| 1095 | 1118 |
| 1096 if (lavc_venc_context.codec->encode == NULL) | 1119 if (lavc_venc_context.codec->encode == NULL) |
| 1097 { | 1120 { |
| 1098 printf("avcodec init failed (ctx->codec->encode == NULL)!\n"); | 1121 printf("avcodec init failed (ctx->codec->encode == NULL)!\n"); |
| 1099 return 0; | 1122 mencoder_exit(1,NULL); |
| 1100 } | 1123 } |
| 1101 | 1124 |
| 1102 #if 1 | 1125 #if 1 |
| 1103 if (out_fmt != IMGFMT_YV12 && out_fmt != IMGFMT_I420) | 1126 if (out_fmt != IMGFMT_YV12 && out_fmt != IMGFMT_I420 && out_fmt != IMGFMT_IYUV) |
| 1104 { | 1127 { |
| 1105 printf("Not supported image format! (%s)\n", | 1128 printf("Not supported image format! (%s)\n", |
| 1106 vo_format_name(out_fmt)); | 1129 vo_format_name(out_fmt)); |
| 1107 return 0; /* FIXME */ | 1130 mencoder_exit(1,NULL); |
| 1108 } | 1131 } |
| 1109 | 1132 |
| 1110 memset(&lavc_venc_picture, 0, sizeof(lavc_venc_picture)); | 1133 memset(&lavc_venc_picture, 0, sizeof(lavc_venc_picture)); |
| 1111 | 1134 |
| 1112 { | 1135 { |
| 1145 break; | 1168 break; |
| 1146 #endif | 1169 #endif |
| 1147 default: | 1170 default: |
| 1148 printf("Not supported image format! (%s)\n", | 1171 printf("Not supported image format! (%s)\n", |
| 1149 vo_format_name(out_fmt)); | 1172 vo_format_name(out_fmt)); |
| 1150 return 0; /* FIXME */ | 1173 mencoder_exit(1,NULL); |
| 1151 } | 1174 } |
| 1152 | 1175 |
| 1153 printf("Using picture format: %s\n", vo_format_name(out_fmt)); | 1176 printf("Using picture format: %s\n", vo_format_name(out_fmt)); |
| 1154 | 1177 |
| 1155 memset(&lavc_venc_picture, 0, sizeof(lavc_venc_picture)); | 1178 memset(&lavc_venc_picture, 0, sizeof(lavc_venc_picture)); |
| 1468 } | 1491 } |
| 1469 #endif | 1492 #endif |
| 1470 case VCODEC_DIVX4: | 1493 case VCODEC_DIVX4: |
| 1471 #ifndef HAVE_DIVX4ENCORE | 1494 #ifndef HAVE_DIVX4ENCORE |
| 1472 printf("No support for Divx4 encore compiled in\n"); | 1495 printf("No support for Divx4 encore compiled in\n"); |
| 1473 return 0; /* FIXME */ | 1496 mencoder_exit(1,NULL); |
| 1474 #else | 1497 #else |
| 1475 blit_frame=decode_video(&video_out,sh_video,start,in_size,0); | 1498 blit_frame=decode_video(&video_out,sh_video,start,in_size,0); |
| 1476 draw_sub(); | 1499 draw_sub(); |
| 1477 if(skip_flag>0) break; | 1500 if(skip_flag>0) break; |
| 1478 if(!blit_frame){ | 1501 if(!blit_frame){ |
