|
Hi all,
I am getting a continuous video and audio packet from some source (Flv video codec) (Mp3 audio codec) and we have to send it to flash media server(or red5) through RTMP protocol.
Basically, I want to publish live stream through RTMP protocol to flash media server(or red5), so that there is live playback on a Flash player.
I am looking for a Visual C code snippet to do this.
Any suggestions on where to start and how to get this accomplished?
Many Thanks!
|
|
|
|
|
RTMP is a propritary protocol, and Red5 is written in Java, so good luck on that one.
If you want to scour Red5's code for RTMP stuff and translate it to Visual C, I'm sure you could figure it out, but you might as well use other tools like ManyCam (free) and Virtual Audio Cable (like $15, I think) and patch stuff through to Adobe's Flash Media Live Encoder (which is free).
|
|
|
|
|
Hi,
Thanks for your answer, I have got a better solution, Iam using RTMPD code for my application , its in vc++ and fits to my requirements.
|
|
|
|
|
Hi,
Would you mind sharing your find? Which RTMPD did you find, use?
Thanks in advance...
|
|
|
|
|
The home of the project is: http://www.rtmpd.com
There is an application written especially for that inside that server
RFC1925
With sufficient thrust, pigs
fly just fine. However, this
is not necessarily a good
idea. It is hard to be sure
where they are going to land,
and it could be dangerous
sitting under them as they fly
overhead.
|
|
|
|
|
Hi,
Thanks for the response. Did you take that implementation and convert it over for a client application by any chance? If so, would you care to share your implementation?
|
|
|
|
|
Lol, that whole thing is mine
Basically is doing the following:
flash publisher --> rtmpd --> streaming_server(rtmpd, FMS, etc) --> flash layer 1,2,...,N
Now, flash publisher talks with rtmpd via RTMP protocol (the first arrow). flash publisher is the "provider". But this can be changed. It can totally replaced with a custom internal stream. The over all structure would become:
rtmpd(doing screen capture INTERNALLY for example) --> streaming_server(rtmpd, FMS, etc) --> flash layer 1,2,...,N
You need to dig into the code a little bit though...
The server is running on:
Windows
BSD (Mac OS X, FreeBSD, NetBSD, OpenBSD, etc)
Linux (many distros here...)
Someone reported that ported it to SunOS. Not sure about that....
As a server, I recommend to run it on FreeBSD for best performance.
Have fun
RFC1925
With sufficient thrust, pigs
fly just fine. However, this
is not necessarily a good
idea. It is hard to be sure
where they are going to land,
and it could be dangerous
sitting under them as they fly
overhead.
|
|
|
|
|
Hi,
Hmmm... I will have to check it out. I have not looked at the code repository yet. Although I am some what familiar with the project (at least I know where I can find it ).
I want to use this with an open source server that is compatible with FMIS, such as red5, crtmp, etc. etc.
Anyway thanks for the heads up.
|
|
|
|
|
g++ 4.1.2 on codepad.org generates this error for the last statement in main() , below, but Visual Studio 2005 compiles it without error. Which is correct according to the C++ standard, or is this behavior undefined and both are correct?
In function 'int main()':
Line 13: error: conversion from 'const char [8]' to non-scalar type 'N' requested
compilation terminated due to -Wfatal-errors.
#include <string>
using namespace std;
struct N {
N(const string & t_) { }
};
int main()
{
string s1 = string("bananas");
string s2 = "bananas";
N n1 = string("bananas");
N n2 = "bananas";
}
|
|
|
|
|
g++ is correct. That line requires two user-defined conversions (const char* -> string -> N) in order for the only possible match for operator= (the one implicitly defined by the compiler for N). As C++ will only consider function matches that require one user-defined conversion (section13.3.3.1.2 of the 1998 standard), that operator= can't be used.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I have been trying to maniupulate a wide character string into an ansi character(8bit) string followed with some general string length checks:
CString TxString;
char* pOutputString;
size_t CharCountXyz;
int CharCount2;
int CharCount3;
char BasicString[100];
int CharCount9;
...
pOutputString = CW2A(TxString);
CharCount2 = sizeof(TxString);
CharCount3 = sizeof(pOutputString);
CharCountXyz = strlen(pOutputString);
sprintf(BasicString, "ABCDEF");
CharCount9 = strlen(BasicString);
I added the last two lines to test strlen in its basic form, sure enough it worked when used to test 'BasicString' but curiously, the test on 'pOutputString' also worked???
modified on Tuesday, September 8, 2009 10:50 AM
|
|
|
|
|
GC104 wrote: sprintf(BasicString, "ABCDEF");
Since BasicString is a pointer, have you allocated memory for it?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi, sorry, I made a typo, should be:
char BasicString[100];
mistake made due to VC++ machine not on internet.
Geoff
|
|
|
|
|
GC104 wrote: pOutputString = CW2A(TxString);
That's a bad thing to do - CW2A creates a temporary object to manage the ASCII string used to hold the result of the wide to ASCII conversion. That temporary object is destructed at the end of the line above, causing pOutputString to point at deallocated memory.
GC104 wrote: sprintf(BasicString, "ABCDEF");
That's bad as well - mainly because you don't assign a value to BasicString - where is the "12345" going to go?!?!??!
You need to learn about pointers and strings and memory management in C/C++...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for feedback, I see your point made about the CW2A and memory deallocation - would be nice if this was made clear in the MSDN documentation!
Eventually, the "12345" will be sent through the serial port using 'WriteFile'. I have been under the imporession that the characters /strings need to be in an ansi 8 bit format for the writing to serial port to work. Any suggestions for an alternative to CW2A macro?
Sprintf(BasicString, "ABCDDEF") : Bad because I haven't initialised it as soon as I declared it? or the fact that I'm using sprintf to load the string?
I also take your point about needing to learn about pointers. I am wading through numerous c++ books but there's nothing like creating a real application
|
|
|
|
|
Easy one first:
GC104 wrote: Sprintf(BasicString, "ABCDDEF") : Bad because I haven't initialised it as soon as I declared it? or the fact that I'm using sprintf to load the string?
Bad because it wasn't char BasicString[100]; when I answered the question - it was (IIRC) char* BasicString
Also - sprintf is less than optimal for assigning a string to another string - strcpy is better, I guess.
GC104 wrote: Any suggestions for an alternative to CW2A macro?
CW2A isn't a macro. It's a class. There are a few alternatives:
- Make sure that pOutputString has storage associated with it and strcpy the CW2A into it:
char pOutputString[1024];
strcpy(pOutputString, CW2A(TxString));
- Declare pOutputString to be of type CW2A and assign TXString to it. THat way the storage is associated with the lifetime of pOutputString, which is what you want:
CW2A pOutputString = TxString; - Declare pOutputString to be of some other ASCII string type and assign CW2A(TXString) to it. That way there is storage associated with the lifetime of pOutputString, which is what you want:
std::string pOutputString = CW2A(TxString);
I'd go for option 2, personally.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am learning to use VS2005 creating a VC++ MFC project to unterface to serial ports. I am in the initial stages of getting to grips with creating a serial port class. I am finding a few problems along the way with vartiable / data member initialisation.
CGCSerial h-file
int CharCount;
int CharCount2;
int CharCountThree;
CString TxString;
size_t InputStringLength;
TCHAR * pStr;
char * pOutputString;
cpp-file(s)
CMyDrawView::OnToolWrite2SerialPort
//member function called by clicking on windows menu item
{
CGCSerial *pGcSp = new CGCSerial(_T("12345")); //create instance of CGCSerial class
pGcSp -> GCTx; //call transmit member function
delete pGcSp; //cleanup
}
CGCSerial::GCSerial(TxString)
{
//constructor
CharCount2 = 0
CharCountThree = 0;
}
CGCSerial::~GCSerial
{
//destructor
}
CGCSerial::GCTx
{
InputStringLength = wcslen(TxString); //measuring length of incoming string
CharCountThree = sizeof(InputStringLength); //load CharCount3 with something
TempString.Format(_T("executing function CGCSerial::GCTx"));
AfxMessageBox(TempString);
pStr = TxString.GetBuffer(256);
CharCount2 = sizeof(pStr);
TxString.ReleaseBuffer;
InputStringLength = wcslen(pStr); //measuring length of
CharCount2 = 0x2345; // ###
CharCountThree = 0x5678; //###
CharCount2 = sizeof(TxString);
CharCountThree = sizeof(pOutputString);
pOutputString = CW2A(TxString); //convert wide string to ANSI string
...
...
}
My problem is that I admit this code doesn't look the most useful and is due to getting to grips with VC++ functions. The lines marked with ### don't seem to get executed! If I use the debugger, the debugger stops at these lines but upon viewing these data member's they do not get loaded with 0x2345 & 0x5678 respectively??? Is this a compiler bug??
any help would be greatly appreciated
modified on Tuesday, September 8, 2009 8:21 AM
|
|
|
|
|
GC104 wrote: CharCount2 = 0x2345; // ###
CharCountThree = 0x5678; //###
CharCount2 = sizeof(TxString);
CharCountThree = sizeof(pOutputString);
Maybe the compiler optimizes that to:
CharCount2 = sizeof(TxString);
CharCountThree = sizeof(pOutputString);</blockquote>
BTW please use the code block to submit code snippets.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Could it be that you are debugging a release build?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi all,
Thanks for responses. It looks like CPallini nailed it - the compiler doing its job! I have since added more data members to capture the results of the various functions I used on the original code. However this time, the debugger runs through eacdh line and loads each variable with the value I was expected
many thanks
Geoff
|
|
|
|
|
Hi every body!
Is there any way/tool to find out which module creates a specific file? E.g one can see a process named Process.exe and this process has loaded a few DLL. What I want to know is which of theses DLLs creates a given file (e.g. C:\file.ext)
Thank you masters!
|
|
|
|
|
unless you have the source code to the dll, I doubt it after the file has been created and closed. If the file is open, there are tools around that are the windows equivalent of the 'lsof' command - systinternals (now part of Microsoft) has a tool to display (iirc) open files vs the processes that have them open
'g'
[edit] I was wondering if the file properties (custom) would be useful, but surely that depends on a well behaved application filling them out in the first place[/edit]
|
|
|
|
|
Thank you for your answer. I meant something like that I can examine a specific DIRECTORY or FOLDER so that I can catch every process that attamps to create or modifiy a file.
Thank you masters!
|
|
|
|
|
|
Further to R.selvam's answer - FileMon's been deprectaed - MS recommend you use ProcMon[^] now. That allows you to capture more than just file accesses, for example registry accesses as well.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|