Jump to content

Taking back control of TV output


Recommended Posts

On most video cards there are several outputs. Noteably, there are a couple that support your PC's monitor, and one that supports output ready to pipe into your television.

The TV output runs on a different "stream" as it were. If you run your monitor plus TV at the same time in clone mode and connected to your PC's video card, you'll see your PC's desktop directly on your TV.

However, most video players (winamp/WMP etc) allow a "theatre mode" where the video stream they're playing will "take over" the TV output of your monitor card. You can even minimize the play back application, allowing you to see full screen video on your TV and nothing but your PC's desktop (and the minimized app) on your monitor. Hence, I'm refering to the TV output from your video card as being a separate "stream".

Now, many apps take over the TV stream and hold it. So if my PVR starts to record, that's it: it hogs the TV ouput stream and prevents me from, say, playing back a different video file. DVD Burning software will often take over and hog the TV stream, and starting video playback software then fails to gain control of the stream. You see the video playback on your PC, but it doesn't display on your TV.

When I want to take back control of my TV stream (in order to use it for another app) the only workaround I can find right now is to start a computer game. The game instantly takes over the TV stream, leaving the original stream-hog-app still working but simply no longer using the TV stream. I can the exit the game, return to my desktop, and start up my playback app. Finally, I can watch a video on my TV and allow the original hog app to work away in the background.

Now, starting up a computer game, waiting for all the game producers logos etc to play, eventually getting up to the game menu and exiting the game is a very time costly exercise.

So I need a way via AutoIT to take back the TV output stream. Someone savy about video modes might know away of sending a video stream change/cease command. Or perhaps I'll need to run a small utility that will seize control over the TV output stream, and then immediately exit.

I'd appreciate some help with this, as it's something I have to deal with everyday.

Link to comment
Share on other sites

I have experience, but since nVidia takes care of the dual-screens for me, I have had no trouble.

#)

So do you send different apps to different screen, or just let them play using the default screen. Tell me more about your setup.
Link to comment
Share on other sites

When i do use dual-screens, nVidia adds an extra menu to Windows' application menu.

From there there are options such as expand to this desktop, move to desktop #, cover all desktops....

Just "out-of-the-box" - never had trouble since day 1.

#)

Link to comment
Share on other sites

When i do use dual-screens, nVidia adds an extra menu to Windows' application menu.

From there there are options such as expand to this desktop, move to desktop #, cover all desktops....

I've replicated the situation that you've described using my card's software. I'll specify how I set that up, in case there are any differences.

1. Changed the card over to "extend desktop" mode. You now have the TV being a continuation on the right of the PC monitor.

2. Dragged the playback app (winamp) over to the 2nd/tv desktop.

3. Manually maximized the video screen

During step 1 I lost overlay mode on the card since, apparently, overlay mode isn't available when using extended desktops. Herein lies a problem. With overlay mode, you're able to have an app take over the video stream and display what it wants - i.e. not the desktop. So, I could minimize the desktop etc, and still be able to watch video playback simply because I'm seeing the overlay stream, not the desktop "stream".

During step 1, the loss of the overlay mode means that your TV now literally sees what you're displaying on the desktop. No video playback tricks available. With the winamp video window on the tv desktop all works well...until you minimize your desktop. In which case, the winamp video screen becomes minimized (as you would expect), and because it's not in overlay mode, all you see is your minimized desktop. I tested setting up a second desktop and moving winamp over to there, but then my remote control software can't communicate with it, since they're on different desktops.

Now, since my PC is needs to be used by other people at the same time as playing back video, I can't have a vulnerability such as minimizing the desktop (a frequently used operation) takes out the video stream. Either, I need to find a way to stop simple actions like screen minimization from taking the video stream (I can't see a way of doing that without overlay) or go back to using the "clone mode" single screen mode I was previously using, which allows for winamp to be minimized and for full screen video to still be shown.

Link to comment
Share on other sites

Now I see your problem.

What about writing a custom "Minimize All" program, and run that program instead of using Windows' Minimize All?

Something to get you started:

HotKeySet("#{TAB}", "_minAll")

while 1
   Sleep(1000)
wend

Func _minAll()
   $var = WinList()
   For $i = 1 to $var[0][0]
     If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
       If Not StringInStr($var[$i][0], "WinAmp") Then
          WinSetState($var[$i][1], "", @SW_MINIMIZE)
       EndIf
     EndIf
   Next
EndFunc

Modify to your needs, or make it use an INI!

#)

edit: forgot that while loop...

Edited by nfwu
Link to comment
Share on other sites

Now I see your problem.

What about writing a custom "Minimize All" program, and run that program instead of using Windows' Minimize All?

Wow. A very novel approach.

OK. I've investigated that approach.

HotKeySet

Win-M (etc)- These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above.

So it's impossible to trap the commonest way (for me) of minimizing the desktop. I guess as a workaround you could train yourself to use a arbitrary, trapable key sequence for minimizing.

Alternatively, I could write a "winamp protetection script" that would monitor winamp's state while running, and restore it should it become minimized.

Link to comment
Share on other sites

Alternatively, I could write a "winamp protetection script" that would monitor winamp's state while running, and restore it should it become minimized.

I've done some extensive testing with winamp. Winamp is one of the few applications that responds extremely poorly to state changes (minimization/restore) issued by AutoIt. Sometimes it responds, sometimes it doesn't. Sometimes it get's stuck in between, leaving "outline graphics".

After winamp is minimized, I've tested both restoring winamp and restoring the winamp video window. Sometimes the video window comes back perfectly. Sometimes it just disappears altogether. Sometimes it comes back as a black window, with audio playing but no video etc. So basically it's a nightmare to try and restore winamp effectively and reliably after minimization. About the only decent success I've had is in manually clicking on winamp in the taskbar. That's fairly successfully. But actually issuing state changes to winamp or its video window isn't going to be reliable.

The big advantage in using overlay clone mode is that you can do just about anything to winamp and the overlay video stream is completely unaffected.

You can:

. minimize winamp

. allow the screen saver to kick in etc

Take it out of overlay mode, and your video playback becomes highly fragile.

I know there is code that can forcefully usurp an app's hold on the overlay clone stream and take it over. Virtually all games do this automatically. So if I could find a utility or some windows commands to let me replicate that, I'd have a stable and effective playback system.

Link to comment
Share on other sites

I've had a look at each of the links you cited. While they all talk about outputing to TV from PC, their concerns are things like: no image showing up on TV; wrong resolution; unable to activate clone mode etc. I'm not having problems with any of the issues raised.

Funnily enough, there was one thread which you listed that was exactly on topic

which is actually my own thread - this one. So that was amusing and ironic. But good that it can be found :D

I did some extensive searching before starting this thread, but haven't found a single mention of the specific problem for I need a solution. Still, I will certainly continue with my search efforts.

Link to comment
Share on other sites

I've replicated the situation that you've described using my card's software. I'll specify how I set that up, in case there are any differences.

1. Changed the card over to "extend desktop" mode. You now have the TV being a continuation on the right of the PC monitor.

2. Dragged the playback app (winamp) over to the 2nd/tv desktop.

3. Manually maximized the video screen

During step 1 I lost overlay mode on the card since, apparently, overlay mode isn't available when using extended desktops. Herein lies a problem. With overlay mode, you're able to have an app take over the video stream and display what it wants - i.e. not the desktop. So, I could minimize the desktop etc, and still be able to watch video playback simply because I'm seeing the overlay stream, not the desktop "stream".

During step 1, the loss of the overlay mode means that your TV now literally sees what you're displaying on the desktop. No video playback tricks available. With the winamp video window on the tv desktop all works well...until you minimize your desktop. In which case, the winamp video screen becomes minimized (as you would expect), and because it's not in overlay mode, all you see is your minimized desktop. I tested setting up a second desktop and moving winamp over to there, but then my remote control software can't communicate with it, since they're on different desktops.

Now, since my PC is needs to be used by other people at the same time as playing back video, I can't have a vulnerability such as minimizing the desktop (a frequently used operation) takes out the video stream. Either, I need to find a way to stop simple actions like screen minimization from taking the video stream (I can't see a way of doing that without overlay) or go back to using the "clone mode" single screen mode I was previously using, which allows for winamp to be minimized and for full screen video to still be shown.

I have an older video card (ATI All-In-Wonder 128) but don't have two screens attached to my PC and haven't tried what you are referring to. I may be able to test if I can understand fully what you are trying.

Are you saying that you have your regular PC monitor and a TV attached to one video card?

Are you also saying that you want to have your PC monitor display just PC information and the TV display the video output from your playback software regardless of what is happening on your PC monitor?

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

Link to comment
Share on other sites

I have an older video card (ATI All-In-Wonder 128) but don't have two screens attached to my PC and haven't tried what you are referring to. I may be able to test if I can understand fully what you are trying.

I'm running a Radeon 9200.

Are you saying that you have your regular PC monitor and a TV attached to one video card?

Correct. One PC video card. Two connections to it. 1. DVI to the monitor 2. TV-Out to the TV

Are you also saying that you want to have your PC monitor display just PC information and the TV display the video output from your playback software regardless of what is happening on your PC monitor?

Correct. The PC monitor should show the normal desktop, allow browsers to run, MS Office, etc. Meanwhile, the TV will be receiving video output from, say, a pre-recorded TV show.

Now, I have the setup working 100% perfectly for over a year. So my question is not one of how to get the basics working.

This is a summary of what I need

Normal pattern of current behaviour

1. Desire to watch TV from the PC

2. Press "play", sit back and watch video output on the TV

3. Annoying family members begin using the computer, minimizing apps, letting the screen saver go on etc.

4. TV viewing continues uninterrupted

Outcome: 100% successful. This is my current setup.

Frequent pattern of current behavior

1. PVR software (or anything else that automatically outputs to the overlay stream) happens to be running on and off throughout the day.

2. Desire to watch TV from the PC

3. Press "play", sit back and watch .... er the output from the PVR. Not the output from the playback.

Outcome: 100% failure. Another app. got there first. First in gets permanent hold of the overlay stream.

Current work around: very laborious

1. PVR software (or anything else that automatically outputs to the overlay stream) happens to be running on and off throughout the day.

1. Desire to watch TV from the PC

2. Start up a PC game (any will do)

3. PC games forces control of the overlay stream to it. PVR software still doing its job, but no longer outputs to the overlay stream.

4. Exit the PC game.

5. Press "play", sit back and watch video output on the TV

3. Annoying family members begin using the computer, minimizing apps, letting the screen saver go on etc.

4. TV viewing continues uninterrupted

Outcome: 100% successful. 100% inconvenient. I don't want to manually have to load up Sim City 4, wait for it to go through its load up banners, and then exit it prior to watching a TV session

Ideal, Future pattern of behaviour

1. PVR software (or anything else that automatically outputs to the overlay stream) happens to be running on and off throughout the day.

2. Desire to watch TV from the PC

3. Use an AutoIt script to run a utility or issue some windows commands

4. PVR loses its control of the overlay output stream

5. Press "play", sit back and watch .... er the output from the PVR. Not the output from the playback.

Outcome: 100% successful. Just have to find out how to achieve step 3 now.

Extended desktop/Multiple windows management software workaround

1. PVR software (or anything else that automatically outputs to the overlay stream) happens to be running on and off throughout the day.

2. Desire to watch TV from the PC

3. Because the PVR runs on the LHS on the extended desktop, it isn't outputting anything to the TV (running off the RHS) in the first place.

4. Press "play", sit back and watch video output on the TV

5. Annoying family members begin using the computer, minimizing apps, letting the screen saver go on etc.

6. TV viewing ceases everytime a family member minimizes etc. Video playback is very fragile and can be interrupted in so many different ways.

So there you have it. The problem stems from the fact that only one app can use the overlay stream at any time, and normally, first in gets to hold it for as long as they wish.

But I do have programs that can force control of the stream away from an already running app. So I know it can be done. I just want to do it without the overhead of a piece of software that takes two minutes to load up.

Link to comment
Share on other sites

3. Use an AutoIt script to run a utility or issue some windows commands

Try this program. It runs a blank, black fullscreen until you press the ESC key. (Made by me in C++)

http://www.autoitscript.com/fileman/users/nfwu/help/FullScreen.exe

#)

Link to comment
Share on other sites

Try this program. It runs a blank, black fullscreen until you press the ESC key. (Made by me in C++)

http://www.autoitscript.com/fileman/users/nfwu/help/FullScreen.exe

#)

Eureka! It works pefectly. 1000 thank yous.

Could I have the same again but it automatically exits by itself?

Then, my autoit script can go:

1. Figure out the next video file to view

2. Run nfwu's amazing script

3. run winamp with the next file to view

Link to comment
Share on other sites

Try this program. It runs a blank, black fullscreen until you press the ESC key. (Made by me in C++)

http://www.autoitscript.com/fileman/users/nfwu/help/FullScreen.exe

I made exactly such little app for me in AutoIt long time ago:

#Compiler_Icon=black.ico

#NoTrayIcon 
#include <GUIConstants.au3>

GUICreate("Black", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0x000000)
GUISetState(@SW_SHOW)

While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        
    Sleep(100)
WEnd

black.ICO

Link to comment
Share on other sites

I made exactly such little app for me in AutoIt long time ago:

I tested your script. It doesn't have the desired effect for me. Your script creates a window which happens to take up the whole screen, as opposed to one that runs in true "full screen" mode. Edited by Zaxon
Link to comment
Share on other sites

Eureka! It works pefectly. 1000 thank yous.

Could I have the same again but it automatically exits by itself?

Then, my autoit script can go:

1. Figure out the next video file to view

2. Run nfwu's amazing script

3. run winamp with the next file to view

Amazing... I didn't really expect it to work... just testing things out.

Anyway, here is the auto exit version: (2KB smaller than the previous version... lol... but 691KB is still big for a C++ app.)

http://www.autoitscript.com/fileman/users/nfwu/help/FullScreen_AutoExit.exe

For those who are interested, this is the source code: (Sorry, but I just _love_ to use the Allegro library)

#include <allegro.h>

void init();
void deinit();

int main() {
    init();
    deinit();
    return 0;
}
END_OF_MAIN()

void init() {
    int depth, res;
    allegro_init();
    depth = desktop_color_depth();
    if (depth == 0) depth = 32;
    set_color_depth(depth);
    res = set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 640, 480, 0, 0);
    if (res != 0) {
        allegro_message(allegro_error);
        exit(-1);
    }
    install_timer();
    install_keyboard();
    install_mouse();
}

void deinit() {
    clear_keybuf();
}

#)

edit: woot! 700th post!

Edited by nfwu
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...