Using Media Foundation, I'm trying to capture the screen and record and render it with EVR at the same time. I've written a custom media source for this. It works almost perfectly.
The only problem is, by default without reversing the image, EVR renders the screen correctly, but the recorded video is vertically flipped. I'm literally passing the same IMFSample to the sinks. I reversed the image and it records just fine, but now EVR renders it vertically flipped. Why are EVR and sink writer inconsistent and is there a solution for this problem?
Other possibly useful information:
Capture method: Buffer swapping with DirectX9
Media type:
check = MFExtern.MFCreateMediaType(out var mediaType);
check = mediaType.SetGUID(MFAttributesClsid.MF_MT_MAJOR_TYPE, MFMediaType.Video);
check = mediaType.SetGUID(MFAttributesClsid.MF_MT_SUBTYPE, MFMediaType.RGB32);
check = mediaType.SetUINT32(MFAttributesClsid.MF_MT_INTERLACE_MODE, (uint)MFVideoInterlaceMode.Progressive);
check = mediaType.SetSize(MFAttributesClsid.MF_MT_FRAME_SIZE, (uint)mode.Width, (uint)mode.Height);
check = mediaType.SetRatio(MFAttributesClsid.MF_MT_FRAME_RATE, FrameRateNumerator, FrameRateDenominator);
check = mediaType.SetRatio(MFAttributesClsid.MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
check = mediaType.SetBoolean(MFAttributesClsid.MF_MT_ALL_SAMPLES_INDEPENDENT, true);
Related
After docking and undocking the laptop, as a result of two screens disappearing and one screen appearing or vice-a-versa, all windows are migrated to one screen.
How to accomplish the following desired behavior: keep windows associated with disconnected screens, with the tags the had on those screens, letting these windows be invisible (that's ok), until I explicitly choose to migrate a specific window to the current screen (via a lua command / script of some sort that lets me browse the list of windows). Also, when the screen configuration changes back (e.g. upon re-docking), all windows should become accessible, as if no screen changes ever happened. The use case is that, while undocked, I don't need to access all windows.
I looked at no_offscreen, but it didn't seem to be related. Not really sure where to begin.
You need to implement a request::screen handler on the tag and move the tags to the remaining screen. Then optionally add a taglist filter to hide them. Once the screen is back, move the tags back to the original screen
See https://www.reddit.com/r/awesomewm/comments/5r9mgu/client_layout_not_preserved_when_switching/ for a close enough example.
Another way would be to stop using "real" screens and use "fake" ones. This way you can ignore the fact that they are disconnected and keep it as if it was still there. This require some more mechanic to prevent the "real" screen from overlapping a the fake one (a recipe for disaster)
Taking Emmanuel's answer as the guide, here's what seems to work for me.
My screen.outputs where nil, so I created an ID from resolution:
function firstkey(t) -- sorry, not a Lua programmer...
for i, e in pairs(t) do
return i
end
return nil
end
local function get_screen_id(s)
return tostring(s.geometry.width) .. "x" .. tostring(s.geometry.height) .. "x" .. tostring(firstkey(s.outputs))
end
In awful.screen.connect_for_each_screen(function(s):
-- Check if existing tags belong to this new screen that's being added
local restored = false;
local all_tags = root.tags()
for i, t in pairs(all_tags) do
if get_screen_id(s) == t.screen_id then
t.screen = s
restored = true;
end
end
-- On restored screen, select a tag
-- If this screen is entirely brand new, then create tags for it
if restored then
local first_tag = nil;
for i, t in pairs(s.tags) do -- not sure how else to get first elem
first_tag = t
break
end
first_tag.selected = true
else
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layoutThens[1])
-- Assign the tag to this screen, to restore as the screen disconnects/connects
for k, v in pairs(s.tags) do
v.screen_id = get_screen_id(s)
end
end
And handle the signal when screen disappears:
tag.connect_signal("request::screen", function(t)
-- Screen has disconnected, re-assign orphan tags to a live screen
-- Find a live screen
local live_screen = nil;
for s in screen do
if s ~= t.screen then
live_screen = s;
break
end
end
-- Move the orphaned tag to the live screen
t.screen = live_screen
end)
I'm trying to implement a very customized implementation of awesome.
I have two monitors. I'd like to have my first client always open on the left monitor (a Chrome window in kiosk mode), then all clients after open up on the right monitor.
Are there any custom layouts that accomodate this?
I'd be willing to program it myself, but I'm not sure how to bind a script to some kind of "new client" event.
The new client event is the manage event. It is emitted whenever, well, a new client gets managed by awesome.
To send the first client that ever appears to screen 1 and all following ones to screen 2, you could do something like this:
local first = true
client.connect_signal("manage", function(c)
if first then
c.screen = 1
else
c.screen = 2
end
first = false
end)
Background
I have an ASP.NET web application with a VB.NET back end. In this application users can create payment requests which must be approved by a manager before they are sent to accounts payable for further processing. Within my request page (the page where the user enters the request information) I have a button that links to a separate .aspx page which provides a print preview of the request. When the request is approved by all of the required approvers, I have a VB.NET function that contains a WebBrowser object that navigates to the print preview page behind the scenes and takes a snap shot of it, then saves it as a .tiff file to an internal file share which is then picked up by a internal process and imported into another internal application called OnBase to go through processing for accounts payable.
The Problem
My problem is that when the my function takes the snap shot of the print preview page, the saved tiff has a lower resolution than desired. In other words, it looks kind of crappy when it is viewed through OnBase and when it is printed out.
The Question
How do I increase the resolution of the generated .tiff file at the time that the snapshot of the webpage is generated?
The Code
Private Sub CaptureWebPage()
Try
Dim tiffFileName As String
tiffFileName = OnBasePath & "CheckRequest_" & CurrentRequestId & ".tiff"
Dim impersonateCode As New AliasAccount("TheUsername", "ThePassword")
impersonateCode.BeginImpersonation()
Dim browser As Windows.Forms.WebBrowser = New Windows.Forms.WebBrowser
browser.ScrollBarsEnabled = False
browser.ScriptErrorsSuppressed = True
browser.Navigate(OnBasePath & htmlFileName)
While browser.ReadyState <> Windows.Forms.WebBrowserReadyState.Complete
System.Windows.Forms.Application.DoEvents()
End While
System.Threading.Thread.Sleep(1500)
browser.ClientSize = New Size(950, 768)
Dim Height As Integer = browser.Document.Body.ScrollRectangle.Bottom
browser.ClientSize = New Size(950, Height)
Dim bmp As Bitmap = New Bitmap(browser.Bounds.Width, Height)
browser.DrawToBitmap(bmp, browser.Bounds)
If File.Exists(tiffFileName) Then
File.Delete(tiffFileName)
End If
If File.Exists(OnBasePath & htmlFileName) Then
File.Delete(OnBasePath & htmlFileName)
End If
bmp.Save(tiffFileName.ToString(), ImageFormat.Tiff)
bmp.Dispose()
impersonateCode.EndImpersonation()
Catch ex As Exception
Throw
End Try
End Sub
Additional Information
I have tried to use the .SetResolution method of my bitmap object, but it doesn't actually change the resolution of the generated .tiff file. I have tried to Google this numerous times find a solution, but haven't found anything useful.
Thanks In Advance
Screen "resolution" is much lower than print "resolution". Typically desktop monitors are around 100ppi, where a normal printer on a desk might be 600dpi.
The only suggestion I have for getting a higher resolution rendering of the web page would be configure what is grabbing the screenshot to use a resolution 3x what you are using now, and then set its zoom to 300%. Text elements and vector graphics will be rendered smoothly. Images will still be their web resolutions, and you may even lose image quality through interpolation when sizing up.
You could try and print the page to a virtual print driver in PDF format. I have found OnBase sometimes does strange things with image files, it doesn't like colour or grey scale TIFFs. Instead use JPEG for colour / grey scale.
I am changing image through flex every time i change it saved into server directory with same name(which i am referring to show). So when i refresh my page my browser didn't send new request to server since it's already in request.so didn't getting new image.Tip:- when i clear browser history it will come with new image
You can try adding an additional time-stamp to the image source each time u make a new request, which would make the request look different for the browser.
Example :
var src:String = "image.png";
src = src + "?" + new Date().getTime().toString();
Since you mentioned that you're refreshing the browser, then I assume that your embedded SWF file will also need to be refreshed.
When you embed your SWF, you need to add a parameter that would be random across all time (i.e. datetime stamp, etc.)
var mySWF = "swf/YourEmbeddedFlashFile.swf?guid=" + rnd();
and declare a js function:
function rnd()
{
return String((new Date()).getTime()).replace(/\D/gi, '')
}
I'm writing a flex app, which must record an audio and then playback. It records just fine, I can hear the flv on the server, but when it comes to the playback it cuts the end a little bit, and each time I ask to reproduce again it cuts a little bit more. What can it be? I guess it's something related to buffer management, but I don't know exactly. Any thoughts?
EDIT: Here's the code I'm using to playback. It is called from a mediator:
var streamPlayClient:Object = new Object();
this.stream.client = streamPlayClient;
streamPlayClient.onPlayStatus = function(infoObject:Object):void {
if (infoObject.code == "NetStream.Buffer.Flush") {
stopPlayback();
}
}
this.stream.play("flv:" + this.streamName);
As it turns out, I have to handle the NetStream.Buffer.Empty event, instead of the NetStream.Play.Complete or the NetStream.Buffer.Flush.