#include "libavformat/internal.h"
#include "libavutil/opt.h"
#include "libavutil/time.h"
+#include "libavutil/wchar_filename.h"
#include <windows.h>
/**
int ret;
if (!strncmp(filename, "title=", 6)) {
+ wchar_t *name_w = NULL;
name = filename + 6;
- hwnd = FindWindow(NULL, name);
+
+ if(utf8towchar(name, &name_w)) {
+ ret = AVERROR(errno);
+ goto error;
+ }
+ if(!name_w) {
+ ret = AVERROR(EINVAL);
+ goto error;
+ }
+
+ hwnd = FindWindowW(NULL, name_w);
+ av_freep(&name_w);
if (!hwnd) {
av_log(s1, AV_LOG_ERROR,
"Can't find window '%s', aborting.\n", name);
gdigrab->header_size = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) +
(bpp <= 8 ? (1 << bpp) : 0) * sizeof(RGBQUAD) /* palette size */;
gdigrab->time_base = av_inv_q(gdigrab->framerate);
- gdigrab->time_frame = av_gettime() / av_q2d(gdigrab->time_base);
+ gdigrab->time_frame = av_gettime_relative() / av_q2d(gdigrab->time_base);
gdigrab->hwnd = hwnd;
gdigrab->source_hdc = source_hdc;
/* wait based on the frame rate */
for (;;) {
- curtime = av_gettime();
+ curtime = av_gettime_relative();
delay = time_frame * av_q2d(time_base) - curtime;
if (delay <= 0) {
if (delay < INT64_C(-1000000) * av_q2d(time_base)) {
if (av_new_packet(pkt, file_size) < 0)
return AVERROR(ENOMEM);
- pkt->pts = curtime;
+ pkt->pts = av_gettime();
/* Blit screen grab */
if (!BitBlt(dest_hdc, 0, 0,
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
+ .category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};
/** gdi grabber device demuxer declaration */
-AVInputFormat ff_gdigrab_demuxer = {
+const AVInputFormat ff_gdigrab_demuxer = {
.name = "gdigrab",
.long_name = NULL_IF_CONFIG_SMALL("GDI API Windows frame grabber"),
.priv_data_size = sizeof(struct gdigrab),