This is primarily a continuation of a discussion I've been having with HTPCGB, but anyone is welcome to jump in.
To address these problems, a different approach is probably required. Ideally, a common service for recording/transcoding streams and presenting them to the MVP would be available to UbuStream or any other plugin that needed this capability. A generic class library (dll) might be one option.
Currently, UbuStream leverages off (and extends) the External Recorder plugin in order to present its stations as GB-PVR channels (channel mode). External Recorder provides the ability to create an "ersatz" capture source within the GB-PVR config program. This capture source is configured by specifying a media player (typically VLC) and the parameters required by the player to both play and record a single stream (the URL being part of the parameter string). The capture source is then assigned a channel number and, to all intents and purposes, appears to GB-PVR as if it was a "standard" capture source (a TV capture card, for instance).
When the channel is selected in Live TV mode, the video stream is rendered in GB-PVR's video display area. When the channel is selected in Timeshift mode, the player is invoked using the recording parameters you specified and starts recording the stream to an MPEG2 file. GB-PVR now starts playing back the MPEG2 file (and this is why MVP users can see the output) while it is being recorded, allowing the user to pause, rewind, fast forward, etc. However, if you want more than one streaming channel to be available, you have to set up a separate External Recorder capture source for each one.
UbuStream builds on this architecture by providing a simple command processor application (UbuStreamCmd.exe) that can look up an URL in the UbuStream database and build the parameters to the media player "on the fly". When configuring the External Recorder capture source, the name of the media player app is replaced with the UbuStreamCmd.exe app and, instead of hard coding the URL within the parameter string, the symbol {channel} is used. Now, the capture source may be configured to contain multiple channels (just like a regular capture source) each with a channel name and number.
At run time, when the channel is selected, GB-PVR passes the channel number to the capture source, in this case External Recorder, who, in turn, passes it to UbuStreamCmd. UbuStreamCmd uses the channel number to look up the channel name in the GB-PVR database and then tries to find a station with the same name in the UbuStream station database. If it finds one, it uses the data associated with the station to build a command line consisting of the correct player app for the station's stream followed by a parameter string with the {channel} symbol replaced by the station's URL (and, if applicable, the correct argument for forcing full screen playback appended to it) and then executes the command.
To make the UbuStream stations even more like regular channels and easier to use, the UbuStream config program lets you mark stations for inclusion in the capture source and provides a utility to generate an XMLTV format EPG file with "dummy" program entries for each station selected. (The program length and number of days generated is configurable). When this XMLTV file is defined as its EPG source, the capture source's Generate EPG button will automatically populate its channel list and create EPG entries in the GB-PVR database. Now, the stations will show up in the TV Guide so they may be selected for viewing and recording.
For examples of the External Recorder configuration parameters, check out this short document I put together for UbuStream "channel mode" users.
So, this does the job and provides a reasonable level of functionality for MVP users (and others who prefer a seamless integration of streaming stations with their other TV channels). So what's wrong with it? Well, after reading the above description you're probably thinking "Phew! That's a heck of a lot of work just to watch a lousy streaming video on my MVP. Why can't I just select it from a list and have it play, like most UbuStream users?". Well exactly. It's a bit klunky.
Also it's really designed for use with a fairly static set of streams whose URLs are not likely to change. With the new release of UbuStream (and other plugins like the CNN plugin) there's the ability to watch a dynamic, frequently changing set of video streams. For the MVP users, the prospect of reconfiguring the External Recorder capture source to include a different set of "stations" as channels every day probably sounds like a nightmare. A simpler solution might be to set up the channels in the capture source with generic names ("Stream1", "Stream2", "Stream3" for instance) and then go into the UbuStream config app every day and change the names of the stations you want to view to those names. But still..... There must be a better way.
When I put together this rather Byzantine solution to treating media streams as GB-PVR channels, some 9 months ago, I was completely overwhelmed by the difficulty of the task and totally in awe of the External Recorder plugin for having solved what I viewed as the most difficult parts of the puzzle. But now, having got my hands a bit dirty with this GB-PVR plugin stuff, I'm wondering if a "better mousetrap" could be built.
Such a service would be generic enough to provide a foundation for a variety of stream-related plugins to be built. (Hopefully, UbuStream will still be the "gold standard" for this plugin genre, but that's another story.... ). And MVP support would be guaranteed: built right into the infrastructure.
Standardizing on VLC as a "required" component would be a simplifying assumption, I think, since it is proven to be able to do the neccessary transcoding and recording and also permits playing files while they are still being recorded. (Another VLC capability that may or may not be relevant is its ability to act as a stream server, so a stream in some format (say mp4) might be re-streamed as pure MPEG2 - not sure if MVPs could receive such a stream). The downside of course would be that RealPlayer streams (and anything else VLC can't handle) would not be playable in this scenario.
When I get time, I'll have another read of the ExternalRecorder source and see if further opportunities present themselves or additional revelations become manifest. It took a lot of effort for me to understand it 9 months ago. Hopefully, it'll be a bit clearer to me now.
Additional resources:
HTPCGB Wrote:As for supporting the mediaMVP, what is limiting us? Is it a programming challenge or the GBPVR API? Or both?UbuStream's existing "channel mode" provides mediaMVP users with the ability to watch (and listen to) streaming content. However, it requires a relatively complex and labor-intensive set-up and configuration procedure, doesn't lend itself well to frequently changing sets of streaming URLs and mandates that the streams be presented as GB-PVR channels within a capture source rather than just as streams to be selected from a list.
To address these problems, a different approach is probably required. Ideally, a common service for recording/transcoding streams and presenting them to the MVP would be available to UbuStream or any other plugin that needed this capability. A generic class library (dll) might be one option.
Currently, UbuStream leverages off (and extends) the External Recorder plugin in order to present its stations as GB-PVR channels (channel mode). External Recorder provides the ability to create an "ersatz" capture source within the GB-PVR config program. This capture source is configured by specifying a media player (typically VLC) and the parameters required by the player to both play and record a single stream (the URL being part of the parameter string). The capture source is then assigned a channel number and, to all intents and purposes, appears to GB-PVR as if it was a "standard" capture source (a TV capture card, for instance).
When the channel is selected in Live TV mode, the video stream is rendered in GB-PVR's video display area. When the channel is selected in Timeshift mode, the player is invoked using the recording parameters you specified and starts recording the stream to an MPEG2 file. GB-PVR now starts playing back the MPEG2 file (and this is why MVP users can see the output) while it is being recorded, allowing the user to pause, rewind, fast forward, etc. However, if you want more than one streaming channel to be available, you have to set up a separate External Recorder capture source for each one.
UbuStream builds on this architecture by providing a simple command processor application (UbuStreamCmd.exe) that can look up an URL in the UbuStream database and build the parameters to the media player "on the fly". When configuring the External Recorder capture source, the name of the media player app is replaced with the UbuStreamCmd.exe app and, instead of hard coding the URL within the parameter string, the symbol {channel} is used. Now, the capture source may be configured to contain multiple channels (just like a regular capture source) each with a channel name and number.
At run time, when the channel is selected, GB-PVR passes the channel number to the capture source, in this case External Recorder, who, in turn, passes it to UbuStreamCmd. UbuStreamCmd uses the channel number to look up the channel name in the GB-PVR database and then tries to find a station with the same name in the UbuStream station database. If it finds one, it uses the data associated with the station to build a command line consisting of the correct player app for the station's stream followed by a parameter string with the {channel} symbol replaced by the station's URL (and, if applicable, the correct argument for forcing full screen playback appended to it) and then executes the command.
To make the UbuStream stations even more like regular channels and easier to use, the UbuStream config program lets you mark stations for inclusion in the capture source and provides a utility to generate an XMLTV format EPG file with "dummy" program entries for each station selected. (The program length and number of days generated is configurable). When this XMLTV file is defined as its EPG source, the capture source's Generate EPG button will automatically populate its channel list and create EPG entries in the GB-PVR database. Now, the stations will show up in the TV Guide so they may be selected for viewing and recording.
For examples of the External Recorder configuration parameters, check out this short document I put together for UbuStream "channel mode" users.
So, this does the job and provides a reasonable level of functionality for MVP users (and others who prefer a seamless integration of streaming stations with their other TV channels). So what's wrong with it? Well, after reading the above description you're probably thinking "Phew! That's a heck of a lot of work just to watch a lousy streaming video on my MVP. Why can't I just select it from a list and have it play, like most UbuStream users?". Well exactly. It's a bit klunky.
Also it's really designed for use with a fairly static set of streams whose URLs are not likely to change. With the new release of UbuStream (and other plugins like the CNN plugin) there's the ability to watch a dynamic, frequently changing set of video streams. For the MVP users, the prospect of reconfiguring the External Recorder capture source to include a different set of "stations" as channels every day probably sounds like a nightmare. A simpler solution might be to set up the channels in the capture source with generic names ("Stream1", "Stream2", "Stream3" for instance) and then go into the UbuStream config app every day and change the names of the stations you want to view to those names. But still..... There must be a better way.
When I put together this rather Byzantine solution to treating media streams as GB-PVR channels, some 9 months ago, I was completely overwhelmed by the difficulty of the task and totally in awe of the External Recorder plugin for having solved what I viewed as the most difficult parts of the puzzle. But now, having got my hands a bit dirty with this GB-PVR plugin stuff, I'm wondering if a "better mousetrap" could be built.
- I would like the user to be able to select a station from a list (or some other simple UI control) and have it play. Period.
- Configuration should consist of adding stations to the database (either automatically or via the config app). Period.
- An MVP user should just have to check an "mediaMVP support required" checkbox once in the config app and then forget about it. Maybe not even that.
- Explicit requests to record streams to file (both scheduled and manual recordings - either via the GB-PVR progam recording screens or by some other means) should be supported.
Such a service would be generic enough to provide a foundation for a variety of stream-related plugins to be built. (Hopefully, UbuStream will still be the "gold standard" for this plugin genre, but that's another story.... ). And MVP support would be guaranteed: built right into the infrastructure.
Standardizing on VLC as a "required" component would be a simplifying assumption, I think, since it is proven to be able to do the neccessary transcoding and recording and also permits playing files while they are still being recorded. (Another VLC capability that may or may not be relevant is its ability to act as a stream server, so a stream in some format (say mp4) might be re-streamed as pure MPEG2 - not sure if MVPs could receive such a stream). The downside of course would be that RealPlayer streams (and anything else VLC can't handle) would not be playable in this scenario.
When I get time, I'll have another read of the ExternalRecorder source and see if further opportunities present themselves or additional revelations become manifest. It took a lot of effort for me to understand it 9 months ago. Hopefully, it'll be a bit clearer to me now.
Additional resources:
- External Recorder wiki page.
- UbuStream wiki page (the sections regarding "channel mode" are most relevant to this discussion).
[SIZE=1]GBPVR v1.3.11 [/SIZE][SIZE=1]HVR-1250, [/SIZE][SIZE=1]ES7300[/SIZE][SIZE=1], 4GB, GeForce 9300, LianLi, Vista.[/SIZE]
[SIZE=1]GBPVR v1.0.08 [/SIZE][SIZE=1]PVR-150, [/SIZE][SIZE=1]P4 2.26GHz, [/SIZE][SIZE=1]1GB,[/SIZE][SIZE=1] GeForce 6200, [/SIZE]Coupden, XP[SIZE=1]
[/SIZE]
Author: UbuStream plugin, UbuRadio plugin, EPGExtra utility.
[SIZE=1]GBPVR v1.0.08 [/SIZE][SIZE=1]PVR-150, [/SIZE][SIZE=1]P4 2.26GHz, [/SIZE][SIZE=1]1GB,[/SIZE][SIZE=1] GeForce 6200, [/SIZE]Coupden, XP[SIZE=1]
[/SIZE]
Author: UbuStream plugin, UbuRadio plugin, EPGExtra utility.