- Timestamp:
- Jan 10, 2017 11:43:13 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/VideoRec.cpp
r65216 r65221 43 43 static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStrm); 44 44 static int videoRecRGBToYUV(PVIDEORECSTREAM pStrm); 45 46 using namespace com; 45 47 46 48 /** … … 647 649 * other important file, causing unintentional data loss. */ 648 650 649 /** @todo Make mode configurable. */ 651 vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pStream->Codec.VPX.Config, 0); 652 if (rcv != VPX_CODEC_OK) 653 { 654 LogRel(("VideoRec: Failed to get default configuration for VPX codec: %s\n", vpx_codec_err_to_string(rcv))); 655 return VERR_INVALID_PARAMETER; 656 } 657 658 com::Utf8Str options(pszOptions); 659 size_t pos = 0; 660 661 /* By default we enable both, video and audio recording (if available). */ 650 662 #ifdef VBOX_WITH_AUDIO_VIDEOREC 651 663 WebMWriter::Mode enmMode = WebMWriter::Mode_AudioVideo; … … 654 666 #endif 655 667 656 uint64_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE;657 #ifdef DEBUG658 fOpen |= RTFILE_O_CREATE_REPLACE;659 #else660 fOpen |= RTFILE_O_CREATE;661 #endif662 663 int rc = pStream->pEBML->create(pszFile, fOpen, enmMode,664 WebMWriter::AudioCodec_Opus, WebMWriter::VideoCodec_VP8);665 if (RT_FAILURE(rc))666 {667 LogRel(("VideoRec: Failed to create the video capture output file '%s' (%Rrc)\n", pszFile, rc));668 return rc;669 }670 671 vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pStream->Codec.VPX.Config, 0);672 if (rcv != VPX_CODEC_OK)673 {674 LogFlow(("Failed to configure codec: %s\n", vpx_codec_err_to_string(rcv)));675 return VERR_INVALID_PARAMETER;676 }677 678 com::Utf8Str options(pszOptions);679 size_t pos = 0;680 681 668 do { 682 669 … … 684 671 pos = options.parseKeyValue(key, value, pos); 685 672 686 if (key == "quality")687 { 688 if (value == "realtime")673 if (key.compare("vc_quality", Utf8Str::CaseInsensitive)) 674 { 675 if (value.compare("realtime", Utf8Str::CaseInsensitive)) 689 676 { 690 677 pStream->uEncoderDeadline = VPX_DL_REALTIME; 691 678 } 692 else if (value == "good")679 else if (value.compare("good", Utf8Str::CaseInsensitive)) 693 680 { 694 681 pStream->uEncoderDeadline = 1000000 / uFps; 695 682 } 696 else if (value == "best")683 else if (value.compare("best", Utf8Str::CaseInsensitive)) 697 684 { 698 685 pStream->uEncoderDeadline = VPX_DL_BEST_QUALITY; … … 704 691 } 705 692 } 693 if (key.compare("vc_enabled", Utf8Str::CaseInsensitive)) 694 { 695 #ifdef VBOX_WITH_AUDIO_VIDEOREC 696 if (value.compare("false", Utf8Str::CaseInsensitive)) /* Disable audio. */ 697 { 698 enmMode = WebMWriter::Mode_Audio; 699 LogRel(("VideoRec: Only audio will be recorded\n")); 700 } 701 #endif 702 } 703 if (key.compare("ac_enabled", Utf8Str::CaseInsensitive)) 704 { 705 #ifdef VBOX_WITH_AUDIO_VIDEOREC 706 if (value.compare("false", Utf8Str::CaseInsensitive)) /* Disable audio. */ 707 { 708 enmMode = WebMWriter::Mode_Video; 709 LogRel(("VideoRec: Only video will be recorded\n")); 710 } 711 #endif 712 } 706 713 else 707 714 LogRel(("VideoRec: Unknown option '%s' (value '%s'), skipping\n", key.c_str(), value.c_str())); 708 715 709 716 } while(pos != com::Utf8Str::npos); 717 718 uint64_t fOpen = RTFILE_O_WRITE | RTFILE_O_DENY_WRITE; 719 #ifdef DEBUG 720 fOpen |= RTFILE_O_CREATE_REPLACE; 721 #else 722 fOpen |= RTFILE_O_CREATE; 723 #endif 724 725 int rc = pStream->pEBML->create(pszFile, fOpen, enmMode, 726 WebMWriter::AudioCodec_Opus, WebMWriter::VideoCodec_VP8); 727 if (RT_FAILURE(rc)) 728 { 729 LogRel(("VideoRec: Failed to create the video capture output file '%s' (%Rrc)\n", pszFile, rc)); 730 return rc; 731 } 710 732 711 733 /* target bitrate in kilobits per second */
Note:
See TracChangeset
for help on using the changeset viewer.