Changeset 7400 in vbox for trunk/src/VBox/Frontends/VBoxHeadless
- Timestamp:
- Mar 10, 2008 1:44:45 PM (17 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.cpp
r7292 r7400 26 26 #include <VBox/log.h> 27 27 #include <png.h> 28 #include <iprt/stream.h> 28 29 29 30 // external constructor for dynamic loading … … 75 76 FFmpegFB::FFmpegFB(ULONG width, ULONG height, ULONG bitrate, 76 77 com::Bstr filename) : 78 mfUrlOpen(false), 77 79 mBitRate(bitrate), 78 80 mPixelFormat(FramebufferPixelFormat_Opaque), … … 131 133 if (mpFormatContext != 0) 132 134 { 133 /* Dummy update to make sure we get all the frame (timing). */ 134 BOOL dummy; 135 NotifyUpdate(0, 0, 0, 0, &dummy); 136 /* Write the last pending frame before exiting */ 137 int rc = do_rgb_to_yuv_conversion(); 138 if (rc == S_OK) 139 do_encoding_and_write(); 135 if (mfUrlOpen) 136 { 137 /* Dummy update to make sure we get all the frame (timing). */ 138 BOOL dummy; 139 NotifyUpdate(0, 0, 0, 0, &dummy); 140 /* Write the last pending frame before exiting */ 141 int rc = do_rgb_to_yuv_conversion(); 142 if (rc == S_OK) 143 do_encoding_and_write(); 140 144 #if 1 141 /* Add another 10 seconds. */142 for (int i = 10*25; i > 0; i--)143 do_encoding_and_write();145 /* Add another 10 seconds. */ 146 for (int i = 10*25; i > 0; i--) 147 do_encoding_and_write(); 144 148 #endif 145 /* write a png file of the last frame */ 146 write_png(); 147 avcodec_close(mpStream->codec); 148 av_write_trailer(mpFormatContext); 149 /* free the streams */ 150 for(int i = 0; i < mpFormatContext->nb_streams; i++) { 151 av_freep(&mpFormatContext->streams[i]->codec); 152 av_freep(&mpFormatContext->streams[i]); 149 /* write a png file of the last frame */ 150 write_png(); 151 avcodec_close(mpStream->codec); 152 av_write_trailer(mpFormatContext); 153 /* free the streams */ 154 for(int i = 0; i < mpFormatContext->nb_streams; i++) { 155 av_freep(&mpFormatContext->streams[i]->codec); 156 av_freep(&mpFormatContext->streams[i]); 157 } 158 url_fclose(&mpFormatContext->pb); 153 159 } 154 url_fclose(&mpFormatContext->pb);155 160 av_free(mpFormatContext); 156 161 } … … 782 787 szFileName, URL_WRONLY); 783 788 AssertReturn(rcUrlFopen >= 0, E_UNEXPECTED); 789 mfUrlOpen = true; 784 790 av_write_header(mpFormatContext); 785 791 return S_OK; -
trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.h
r6000 r7400 109 109 110 110 private: 111 /** true if url_fopen actually succeeded */ 112 bool mfUrlOpen; 111 113 /** Guest framebuffer width */ 112 114 ULONG mGuestWidth;
Note:
See TracChangeset
for help on using the changeset viewer.