📄 main.cc
字号:
extern void GetLinesForDrawing(DecodedImageData* dimg,int first,int last);#if 0int main(int argc,char** argv){ InitULib(argc,argv); DecodedImageData dimg; dimg.m_may_modify=false; dimg.m_field_lines=true; dimg.m_src_y_start=10; dimg.m_src_y_end =40; dimg.m_dst_y_start=1; GetLinesForDrawing(&dimg,10,20);}#endifint main(int argc, char ** argv){ do { DvdApp * m = new DvdApp(argc,argv); delete m; videosink_x11.reset(); } while (loop);}void DvdApp::InitOptions(){ if(!_initialized) { imgtypes=false; qscales=false; mvs=false; mvcol=false; audio=false; ac3=false; mvf=false; mvb=false; mvcolor=false; mvpf=false; mvbf=false; mv_holdmode=false; fpsdisplay=false; x11_output=false; // try MGA first vcd=0; resize=false; rescale=false; filtered_resize=false; }}DvdApp::DvdApp(int argc,char** argv) : system_demux(system_resync), vidcon(video_extractor), video_ptsvideo(vidcon), video_dec(video_ptsvideo), ac3stream(0x08), syncer(&syncer_realtime){ int scaled_width,scaled_height; VideoDecoder_Options vdec_options; // possibly initialize user options to default values InitOptions();#if 0 && ENABLE_MMX cout << "CPU capabilities detected: "; if (cpucapabilities.HasMMX()) cout << "MMX "; if (cpucapabilities.HasKNI()) cout << "KNI "; if (cpucapabilities.Has3dNow()) cout << "3dNow! "; if (cpucapabilities.HasMTRR()) cout << "MTRR "; if (cpucapabilities.HasCMOV()) cout << "CMOV "; if (cpucapabilities.HasFPU()) cout << "FPU "; cout << endl;#endif#if LINUX // Try to use MGA if available. bool mga_available = videosink_mga.MGA_Available(); if (mga_available) { outputobject = &videosink_mga; resizer = &videosink_mga; } else { outputobject = &videosink_x11; resizer = &pp_resize; if (!default_x11server.AskDisplay()) { cerr << "Cannot open display.\n"; throw "no display"; } }#else // Use X11 output by default outputobject = &videosink_x11; resizer = &pp_resize; if (!default_x11server.AskDisplay()) { cerr << "Cannot open display.\n"; throw "no display"; }#endif try {#if 1 int c; // only parse the command line args if we haven't before (from _initialized) while (!_initialized && (c=getopt(argc,argv,"f3rlcdv:wpuT:S:BbPHMQVW:FYOCdmAa:hXxD:sN:L")) != EOF) { switch (c) { case 'v': {#ifndef NDEBUG int level=atoi(optarg); if (level>7) level=7; if (level<0) level=0; switch(level) { case 7: vdec_options.Trace_SliceData = true; case 6: vdec_options.Trace_DCTCoeff = true; case 5: vdec_options.Trace_MB = true; case 4: vdec_options.Trace_SlcH = true; case 3: vdec_options.Trace_PicH = true; case 2: vdec_options.Trace_GOPH = true; case 1: vdec_options.Trace_SeqH = true; case 0: break; }#else cerr << "Ignoring option -v#: Verbose output was not compiled in.\n";#endif } break; case 'M': if (!options.Postproc_ShowMBs) options.Postproc_ShowMBs = true; else { pp_mblks.SetBigMarks(); } break; case 'd': pp_mblks.SetStaticMode(0); break; case 'l': pp_mblks.SetStaticMode(255); break; case 'P': vdec_options.DecodeP = vdec_options.DecodeB = false; break; case 'B': vdec_options.DecodeB = false; break; case 'x': imgtypes=true; break; case 'Q': qscales=true; break; case 'V': mvs=true; break; case 'C': mvcol=true; break; case 'O': mv_holdmode=true; break; case 'c': mvcolor=true; break; case 'f': mvf=true; break; case 'r': mvb=true; break; case 'p': mvpf=true; break; case 'b': mvbf=true; break; case 'A': audio=true; break; case '3': ac3=true; break; case 'a': ac3stream = atoi(optarg) + 0x80; break; case 'N': maxframes = atoi(optarg); break; case 'F': outputobject = &videosink_ppm; resizer = &pp_resize; break; case 'Y': outputobject = &videosink_yuv; resizer = &pp_resize; break; case 's': fpsdisplay=true; break; case 'h': usage(); exit(10); break; case 'T': { int speed=atoi(optarg); if (speed<=0) { cerr << "Speed must be greater than 0%, using 1%\n"; speed=1; } syncer_realtime.SetSpeed(speed); } break; case 'S': { char* w = strtok(optarg,"xX"); char* h = strtok(NULL,"xX"); if (!w || !h) { cerr << "invalid size argument (1)\n"; exit(5); } scaled_width = atoi(w); scaled_height = atoi(h); rescale=true; } break; case 'H': filtered_resize = true; break; case 'X': x11_output=true; break; case 'L': loop=true; break; case 'U': fullscreen=true; break;#if LINUX case 'D': vcd=atoi(optarg); break;#endif } } // make sure we don't re-initialize from the command line args _initialized = true; if (x11_output) { outputobject = &videosink_x11; resizer = &pp_resize; if (!default_x11server.AskDisplay()) { cerr << "Cannot open display.\n"; throw "no display"; } } if (filtered_resize && resizer==&pp_resize) { cout << "bla\n"; resizer=&pp_filteredresize; } lastoutput = outputobject; if (optind==argc && !vcd) { usage(); exit(5); } video_dec.SetOptions(vdec_options); if (rescale) resizer->SetScaledSize(scaled_width,scaled_height); ifstream str; if (!vcd) { if (strcmp(argv[optind],"-")==0) InitStreamSource_cin(); else { str.open(argv[optind]); InitStreamSource(str); } } else { InitStreamSourceVCD(vcd); } InitVideoDecoder1(); if (audio) InitAudioDecoder(); if (ac3) InitAC3Decoder(); if (filtered_resize) InsertPostprocessor(pp_filteredresize); else InsertPostprocessor(pp_resize); if (qscales) InsertPostprocessor(pp_qscale); if (options.Postproc_ShowMBs) InsertPostprocessor(pp_mblks); if (fpsdisplay) InsertPostprocessor(pp_fps); if (mvs) { if (!mvf && !mvb) { mvf=mvb=true; } pp_mv.SelectMVs(mvf,mvb); pp_mv.ColoredVectors(mvcolor); pp_mv.SelectFrametypes(mvpf,mvbf); InsertPostprocessor(pp_mv); }#if 0 if (imgtypes) InsertPostprocessor(pp_imgtype);#endif if (mvcol) { pp_mvcol.SetHoldMode(mv_holdmode); pp_mvcol.SelectFrametypes(mvpf,mvbf); InsertPostprocessor(pp_mvcol); } InitVideoDecoder2(); //str.seekg(200000,ios::beg); ViewMPEG(audio,ac3);#endif#if 0 ifstream str(argv[1]); ShowSystemPackets(str);#endif#if 0 ifstream str(argv[1]); //ShowVideoAccessUnitPackets(str); //ShowVideoSyntax(str); DecodeVideo(str);#endif#if 0 CheckMemAlloc();#endif#if 0 if (!ProcessOptions(argc,argv, options)) return 0;#endif } catch (Excpt_Base& e) { MessageDisplay::Show(e.m_severity , e.m_text); } catch (const char* txt) { cerr << "error: " << txt << endl; } catch (...) { cerr << "error occurred... quitting...\n"; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -