topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday April 7, 2020, 4:17 pm
  • Proudly celebrating 15 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mediaguycouk [ switch to compact view ]

Pages: prev1 2 3 [4] 5 6 7 8 9 10next
76
Developer's Corner / Call a webpage with a command line c# program
« on: March 25, 2009, 10:23 AM »
I'm converting a Form based C# application to an automatic command line based C# version. However I need to call a webpage (like a cron job would), but I don't know how to do it from the command line. In a form I would call play.webBrowser1.Url = new Uri(address); (after calling the play class that has a web browser element).

Anyone help with this? I don't think I need any feedback from the page at all.

77
Just some links for my comment

http://www.bingegame...-microsoft-and-sony/

http://www.shacknews...m/onearticle.x/57308 // Valve: Left 4 Dead Half-price Sale Saw 3000% Increase, Beat Launch Numbers

78
What's interesting with the comparison with xbox live is that steam don't like 'extra' payments.

A news item was on a site the other day saying that they couldn't have new achievements with the new DLC for Left 4 Dead as achievements are only available on paid for downloads. Valve said that it was 'more important that their content was free'.

79
I was worried it might be that way.

What I really wanted was to not have to re-write a whole application when a token based system was already built into the serverside code.

Basically I would have to re-write this actionscript into Java (which I don't know)

Spoiler
Code: ActionScript [Select]
  1. // Written by Graham Robinson - [email protected]
  2. trace("build 0169");
  3.  
  4. // To make life easier all applications of main.asc are the same. The secuirty checks that happen between
  5. // Internal, ISS authenticated, etc happen by what is defined on the next line
  6.  
  7. load("appsettings.asc");
  8.  
  9. // IP CHECK (our website here. No http:// or trailing /)
  10. var VALID_REFERRER = "xxx.xxx.xxx.ac.uk";
  11.  
  12. // Bypass referral
  13. // If you are testing on your local computer you can bypass the reffer check
  14. // You will still need to pass security to the host unless you use the public profile
  15.  
  16. //var BYPASS_REFERRER = "yes"; // Comment out as necessary
  17. var BYPASS_REFERRER = "no"; // << ALWAYS USE THIS FOR A LIVE SYSTEM
  18.  
  19. // IP CHECK (power referrer to allow server to connect to itself and for streaming)
  20. var POWER_REFERRER = "rtmp://xxx.xxx.ac.uk/"+application.name ;
  21.  
  22. // Note to self. When you get hold of flash media encoder 2, you need to see how it connects
  23. // to the server as the unique key and referrer checks will fail when using the laptop.
  24. // The laptop itself may need a static address just to allow entry via IP.
  25.  
  26. function checkInternal(internalTime, internalTimeHash, pClient) {
  27.         var internal_lv = new LoadVars();
  28.         internal_lv.load("http://127.0.0.1/flashserver_secure/serversecuritycheck_internal.php?time="+internalTime+"&hash="+internalTimeHash+"&nothingelse");
  29.         internal_lv.onLoad = function( success )
  30.         {
  31.                 //trace("Internal check: "+internal_lv.passed);
  32.                 if (internal_lv.passed == "yes") {
  33.                         //trace("Accepting connection from internal function")
  34.                         application.acceptConnection(pClient);
  35.                 } else {
  36.                         //trace("Rejecting connection from internal function")
  37.                         application.rejectConnection(pClient);
  38.                 }
  39.         }      
  40. }
  41. function checkISS(issTime, issTimeHash, pClient) {
  42.         var iss_lv = new LoadVars();
  43.         iss_lv.load("http://127.0.0.1/flashserver_secure/serversecuritycheck_iss.php?time="+issTime+"&hash="+issTimeHash+"&nothingelse");
  44.         iss_lv.onLoad = function( success )
  45.         {
  46.                 //trace("ISS Check: "+iss_lv.passed);
  47.                 if (iss_lv.passed == "yes") {
  48.                         //trace("Accepting connection from iss function")
  49.                         application.acceptConnection(pClient);
  50.                 } else {
  51.                         //trace("Rejecting connection from iss function")
  52.                         application.rejectConnection(pClient);
  53.                 }
  54.         }
  55. }
  56.  
  57. // Some code to work with published live servers
  58.  
  59. // Define the variable we will share to tell when the stream has started
  60. isStreaming = new Object();
  61.  
  62. isStreaming.connected = "no";
  63. isStreaming.streaming = "no";
  64. isStreaming.clientID = "";
  65.  
  66. Client.prototype.FCPublish = function(streamname) {
  67.         //this.call("onFCPublish", null, {code:"NetStream.Publish.Start", description:"name"});
  68.         //trace("I'm funning in a FCPublish function");
  69.         isStreaming.streaming = "yes";
  70. }
  71.  
  72. Client.prototype.FCUnpublish = function(streamname) {
  73. // perform your clean up
  74.         //this.call("onFCUnpublish", null, {code:"NetStream.Unpublish.Success", description:"name"});
  75.         //trace("I'm funning in a FCUnpublish function");
  76.         isStreaming.streaming = "no";
  77. }
  78.  
  79. Client.prototype.releaseStream = function(streamname) {
  80.         // Nothing really needs to go here as FCPublish does all the work
  81.         // However the function needs to be defined to remove the 'unknown method' error
  82.         //trace("I'm funning in a releaseStream function");
  83. }
  84.  
  85. // Ripping check
  86. // this will store references of all clients, and ensure there are no replays
  87. clientKeyList = new Object();
  88.  
  89. application.onConnect = function(pClient, uniqueKey, applicationName, internalTime, internalTimeHash, issTime, issTimeHash) {
  90.         //trace("SECURITY_METHOD = "+SECURITY_METHOD);
  91.         if (pClient.referrer == POWER_REFERRER && LIVE == "yes") {
  92.                 this.acceptConnection(pClient);
  93.                 trace("Power referrer conneted: " + pClient.ip);
  94.                 isStreaming.connected = "yes";
  95.                 isStreaming.clientID = pClient;
  96.         } else {
  97.                 //pClient.writeAccess = ""; // prevents creating shared object or live streams.
  98.  
  99.                 // Only allow flash movies to play when they are on our streaming server
  100.                 // Note, this does not stop people from putting our .swf file onto their servers
  101.                 if (pClient.referrer.split("/")[2] == VALID_REFERRER || BYPASS_REFERRER == "yes") {
  102.                         //trace("Accepted IP: "+pClient.referrer);
  103.                         if (uniqueKey != undefined) { // make sure there is always a uniqueKey
  104.                                 if ( clientKeyList[uniqueKey] == undefined ) {
  105.                                         // This client has never connected -- allow the connection
  106.                                         pClient.uniqueKey   = uniqueKey;
  107.                                         clientKeyList[uniqueKey]  = pClient;
  108.  
  109.                                         if (isStreaming.connected == "yes" || LIVE == "no") {
  110.                                                 if (isStreaming.streaming == "yes" || LIVE == "no") {
  111.                                                         // Run the correct security check based on the security type
  112.                                                         if (SECURITY_METHOD == "internal") {
  113.                                                                 //trace("running checkInternal");
  114.                                                                 checkInternal(internalTime, internalTimeHash, pClient);
  115.                                                         } else if (SECURITY_METHOD == "iss") {
  116.                                                                 //trace("running checkISS");
  117.                                                                 checkISS(issTime, issTimeHash, pClient);
  118.                                                         } else {
  119.                                                                 //trace("Accepted due to security being none");
  120.                                                                 this.acceptConnection(pClient);
  121.                                                         }
  122.                                                 } else {
  123.                                                         //trace("Rejected: Broadcast is connected but not streaming");
  124.                                                         this.rejectConnection(pClient, {msg:"notStreaming"});
  125.                                                 }
  126.                                         } else {
  127.                                                 //trace("Rejected: Broadcast is not connected");
  128.                                                 this.rejectConnection(pClient, {msg:"notConnected"});
  129.                                         }
  130.                                 } else {
  131.                                         trace("Rejected UniqueID");
  132.                                         this.rejectConnection(pClient);
  133.                            }
  134.                         } else {
  135.                                   trace("Rejected No UniqueID");
  136.                                   this.rejectConnection(pClient);
  137.                         }
  138.                 } else {
  139.                         // If the .swf wasn't on our server, reject and trace the referrer
  140.                         this.rejectConnection(pClient, {msg:"Bad referrer"}) ;
  141.                         //this.acceptConnection(pClient); // ONLY FOR TESTING PURPOSES
  142.                         trace("Rejected IP: "+pClient.referrer);
  143.                 }
  144.         }
  145. }
  146.  
  147. application.onDisconnect = function(pClient){
  148.         if (pClient == isStreaming.clientID) {
  149.                 isStreaming.connected = "no";
  150.                 isStreaming.clientID = "";
  151.                 trace("Power referrer disconnected");
  152.         }
  153.         //clean up the keys
  154.         delete clientKeyList[pClient.uniqueKey];
  155.         //trace("Client disconnected");
  156. }


82
Anything based on FFMPEG should do it. Or you can just run FFMPEG I expect

ffmpeg -i "c:\movie.mov" -b 1000k c:\movie.swf

that should do it.

(I've got a custom application that installs ffmpeg and converts media files into Flash 8 @350Kb/s @1MB/s and H.264 @1MB/s. You can untick the ones you don't want)

83
Hi there. I'm stumped on something and would like some ideas passed around even if you don't know how to technically achieve what I'm asking for.

Before I start with the problem I'm using
Wowza - Flash streaming server
Flash CS4
JW Media Player (Longtail media player) - Under licence editing the source code.

I have videos on a streaming server that require authentication. Users log in with their university username and password and a $_SESSION variable is logged to show the user is logged in.

In the past I have totally hacked at the source code of JW Media Player to ensure that the video doesn't play without checking the session is logged in. A written application in Flash Media Server 2 also checked this information.

For this new version I would like both Wowza and JW Media player to be as 'vanilla' as possible. The reason for this is Wowza and JW Media Player both have built in authentication.

Wowza uses a secure token before an application (a whole folder of videos) can be played. The trouble is the token doesn't change and if I hard code the token into the flash player someone would only have to download the movie player to be able to play all moves.

What I would prefer to do is to pass some code to the flash player that makes it create the key, however I want it to be useless after it is used.

Before I would use the (sudo) code of

Decrypt (jr;;p, 13/3/09)

Function decrypt(input, date) {
 if (date < today) {
  exit("password can only be decrypted on the date it is created");
 } else {
  return decryptcode(input); // return token to the flash code and not to the user
 }
}


However if I'm doing the decryption inside the flash player it is using the client for its information. The client clock might be incorrect or they might just change it.

What would be best is if the web server were to pass the token at the beginning, but that would just involve the user right clicking and viewing source, which is even worse.

Any ideas or was that a really bad explanation?

84
Living Room / Re: Gimme a drink mate ... pic
« on: March 09, 2009, 05:38 AM »
awww

85
Living Room / Re: TV via broadband ?
« on: January 20, 2009, 12:13 PM »
UK has the brilliant tvcatchup.com which allows you to legally watch nearly all live Freeview channels.

86
Powergramo didn't work? I've been using it for months and think it's brilliant!

87
General Software Discussion / Re: Microsoft Songsmith
« on: January 13, 2009, 02:02 AM »
It it just me... or is that a macbook pro in the song?

88
I've just bought VM Ware, but I found this out about it

VM Ware Player = Plays virtual PCs but cannot make virtual hard drives
VM Ware Workstation = 30 day trial, after 30 days cannot play virtual PCs

Both together = Create hard drive in VM Workstation (even once the trial has expired) and then turn it on in VM Player

89
As for the MP3 bug, that's only if you use windows media player - and who does?

I thought that one of the major :up: to Win7 was that now WMP plays WMV, DivX, Xvid and H.264 it will play most things people throw at it

91
Interesting that you are allowed to upgrade OSX to Vista without buying the full version

ultimatestealvista.jpg

92
Found Deals and Discounts / Backup4All [December 22nd]
« on: December 17, 2008, 03:11 AM »
50% off Backup4All on Bits Du Jour

I'm personally on 3 and use it with Acronis True Image. Backup4All does my My Documents for quick backup and extraction and True Image does the whole hard drive.

http://www.bitsdujou...ftware/backupforall/

93
Something that I have learnt, which I havn't followed here, is that I shouldn't ask direct questions. I should say what I'm doing and ask for general advise.

Here is what I'm doing...

I have a front end interface for ffmpeg. Ffmpeg is a command line video encoding. The class in this case is Ffmpeg.cs, which runs all the arguements

Code: C# [Select]
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Text;
  6. using System.Windows.Forms;
  7.  
  8. namespace H264Convert
  9. {
  10.     class Ffmpeg
  11.     {
  12.         // Where FFMPEG should be
  13.         // This is also in Form1.cs
  14.         public string ffmpegLocation = @"C:\program files\ffmpeg\ffmpeg.exe";
  15.  
  16.         // Create a new process
  17.         System.Diagnostics.Process proc = new System.Diagnostics.Process();
  18.  
  19.         // Function to actually envoke FFMPEG
  20.         public void runFFMPEG(string inputFile, string outputFile, string aspectRatio,
  21.             string dimensions, string bitRate, string passes, string videoTypeArg,
  22.             string audioFrequency, string audioBitRate, string deinterlace, string otherArgs, string audioCodec)
  23.         {
  24.             // See if the video to be output already exists
  25.             if (File.Exists(outputFile))
  26.             {
  27.                
  28.                 // and stop FFMPEG from starting
  29.                 return;
  30.             }
  31.             // Create arguements from passed variables
  32.             string arguement = " -i \"" + inputFile + "\"" +
  33.                 " -aspect " + aspectRatio +
  34.                 " -pass " + passes +
  35.                 " " + videoTypeArg +
  36.                 " -b " + bitRate +
  37.                 " -ar " + audioFrequency +
  38.                 " -ab " + audioBitRate +
  39.                 " -acodec " + audioCodec +
  40.                 " -s " + dimensions +
  41.                 " " + deinterlace +
  42.                 " " + otherArgs +
  43.                 " " + "-y" + // Overwrite
  44.                 " \"" + outputFile + "\"";
  45.  
  46.             // Stop proc raising events
  47.             proc.EnableRaisingEvents = false;
  48.             // Location of file to start (FFMPEG)
  49.             proc.StartInfo.FileName = ffmpegLocation;
  50.             // Arguements to pass to file
  51.             proc.StartInfo.Arguments = arguement;
  52.             // Use shell execute
  53.             proc.StartInfo.UseShellExecute = false;
  54.             // Don't show FFMPEG
  55.             proc.StartInfo.CreateNoWindow = false;
  56.             // Do not steal information from the FFMPEG window
  57.             proc.StartInfo.RedirectStandardOutput = false;
  58.             proc.StartInfo.RedirectStandardInput = false;
  59.             proc.StartInfo.RedirectStandardError = false;
  60.             // Start FFMPEG
  61.             proc.Start();
  62.             // Change processor priority from 'Normal' to 'Below Normal'
  63.             proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
  64.             // Don't do anything else until it is done
  65.             proc.WaitForExit();
  66.             // Once FFMPEG is finished it will close. Just be sure that it is
  67.             proc.Close();
  68.             // Exit out of function
  69.             return;
  70.         }
  71.     }
  72. }

What I want is for the program to read the output from Ffmpeg.exe...

Code: C# [Select]
  1. StreamReader sr = proc.StandardError;
  2.          
  3.             while ((s = sr.ReadLine()) != null)
  4.             {
  5.                 t += s;
  6.             }
  7.  
  8.             doSomethingWith(t);

... and update a progress bar and text box based on what the streamreader reads.

So I thought I needed to pass the text box, but is there a better way?

94
I never knew that, thanks.

Is it possible to do it in the class itself (so it is usable by all functions?)

Something like Class class = new Class(textbox);

95
If I have a textbox in a form called 'textbox' and a class called 'class' is there any way of doing this?

Form1:
textbox.text = "";
Class class = new Class();
class.runfunction()

Class:
public void runfunction()
{
 form1.textbox.text = "Some text"; // This would never work, but how could it?
}

96
Developer's Corner / Re: C# Drag and Drop fail
« on: November 11, 2008, 02:00 PM »
I shall thank Nutcase - http://channel9.msdn...agging-and-Dropping/

Visual Studio 2005 on Vista needs to run as administrator, explorer runs as a normal user. Vista doesn't allow programs using different privileges to interact.

So my code has worked for 3 hours :'(

(And thanks for the debug command, I didn't know it existed)

97
Developer's Corner / C# Drag and Drop fail
« on: November 11, 2008, 12:30 PM »
Hi all, I'm doing really badly on my first try at a drag and drop. I'm trying to have a listBox that can have a file dragged onto it from Windows Explorer

From the very simple example here - http://support.microsoft.com/kb/307966 I have

Set AllowDrop on the list to TRUE
Set the event DragDrop
Set the event DragEnter

I have the following code

Code: C# [Select]
  1. private void listFilesToConvert_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
  2.         {
  3.             // DEBUG
  4.             MessageBox.Show("DragEnter");
  5.  
  6.             if (e.Data.GetDataPresent(DataFormats.FileDrop))
  7.                 e.Effect = DragDropEffects.All;
  8.             else
  9.                 e.Effect = DragDropEffects.None;
  10.         }
  11.  
  12.         private void listFilesToConvert_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
  13.         {
  14.             // DEBUG
  15.             MessageBox.Show("DragDrop");
  16.            
  17.             string[] s = (string[])e.Data.GetData(DataFormats.FileDrop);
  18.             int i;
  19.             for (i = 0; i < s.Length; i++)
  20.                 listFilesToConvert.Items.Add(s[i]);
  21.  
  22.         }

I can't say I understand it all, but it looks very similar to other code on the net. It's probably something simple but I can't work it out.

Neither debug message boxes fire.

Cheers

Graham R

98
That's so simple it's brilliant. Why the hell didn't I think of that! I've even done that in a different part of the program.


99
Another question I'm stuck on.

I have two forms (for this example) called Main and Ffmpeg. Inside main there is a [Start] and a [Cancel] button. There is a Start_Clicked function and a Cancel_Clicked function.

Inside Start_Click I start ffmpeg (Ffmpeg ffmpeg = new Ffmpeg). This ffmpeg class opens up ffmpeg.exe and sends some arguments. (The code is in https://www.donation...ex.php?topic=15549.0)

Now my question is, how can I send proc.Kill(); to ffmpeg? The Cancel_Clicked function doesn't know what ffmpeg is.

Advanced thanks for your help. Learning languages is damn near impossible without people like yourself that help!

Graham

100
Thanks for that. Really hard to get things like this exactly right without working code snippits

Code: C# [Select]
  1. System.Diagnostics.Process proc = new System.Diagnostics.Process();
  2. proc.Start();
  3. proc.PriorityClass = System.Diagnostics.ProcessPriorityClass.BelowNormal;
  4. proc.WaitForExit();
  5. proc.Close();

Pages: prev1 2 3 [4] 5 6 7 8 9 10next