Click here to Skip to main content
15,898,035 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralNT Windows Service in C++ to call a SQL Server Stored Procedure Pin
Anand Sundaram14-Jun-04 6:56
Anand Sundaram14-Jun-04 6:56 
GeneralRe: NT Windows Service in C++ to call a SQL Server Stored Procedure Pin
Xiangyang Liu 刘向阳14-Jun-04 7:05
Xiangyang Liu 刘向阳14-Jun-04 7:05 
GeneralStored Procedure Concept Pin
Sridhar Sanikommu14-Jun-04 6:44
Sridhar Sanikommu14-Jun-04 6:44 
GeneralRe: Stored Procedure Concept Pin
David Crow14-Jun-04 8:55
David Crow14-Jun-04 8:55 
GeneralRe: Stored Procedure Concept Pin
Sridhar Sanikommu14-Jun-04 9:15
Sridhar Sanikommu14-Jun-04 9:15 
GeneralRe: Stored Procedure Concept Pin
David Crow14-Jun-04 10:21
David Crow14-Jun-04 10:21 
GeneralRe: Stored Procedure Concept Pin
Sridhar Sanikommu14-Jun-04 10:50
Sridhar Sanikommu14-Jun-04 10:50 
Generaldirect stream copy with AVIFile Pin
Zizilamoroso14-Jun-04 6:32
Zizilamoroso14-Jun-04 6:32 
I have a question regarding copying of whole compressed (DIVX) streams with the AVIFile API.

This code snippet copies the video stream to another file, but that file gets about 10 times bigger than the original. I guess the target stream is uncompressed, but the streaminfo explicitely states DIVX.

How can I copy streams from one file to the other without decompressing/compressing (direct stream copy)?


<br />
	HRESULT hr=S_OK;<br />
<br />
	PAVIFILE pSourceFile=NULL;<br />
	PAVIFILE pTargetFile=NULL;<br />
<br />
	PAVISTREAM pSourceStream=NULL;<br />
	PAVISTREAM pTargetStream=NULL;<br />
<br />
	AVISTREAMINFO streaminfo;<br />
	BITMAPINFOHEADER bitmapinfo;<br />
<br />
	AVIFileInit();<br />
<br />
	//	SOURCE<br />
	hr=AVIFileOpen(&pSourceFile,"test_source.avi",OF_SHARE_DENY_WRITE,0L);<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	hr=AVIFileGetStream(pSourceFile,&pSourceStream,streamtypeVIDEO,0);<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	LONG bitmapinfosize=sizeof(bitmapinfo);<br />
	hr=AVIStreamReadFormat(pSourceStream,0,&bitmapinfo,&bitmapinfosize);<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	hr=AVIStreamInfo(pSourceStream,&streaminfo,sizeof(streaminfo));<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	//	TARGET<br />
	hr=AVIFileOpen(&pTargetFile,"test_target.avi",OF_CREATE|OF_WRITE,0L);<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	hr=AVIFileCreateStream(pTargetFile,&pTargetStream,&streaminfo);<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	hr=AVIStreamSetFormat(pTargetStream,0,&bitmapinfo,sizeof(bitmapinfo));<br />
	if(FAILED(hr))<br />
		...<br />
<br />
	LONG lbuffersize=20000;<br />
	BYTE* buffer;<br />
	buffer=new BYTE[lbuffersize];<br />
<br />
	//	COPY LOOP<br />
	LONG lPos=0;<br />
	LONG lLen=0;<br />
	for(long lPos=AVIStreamStart(pSourceStream);lPos<AVIStreamEnd(pSourceStream);lPos++)<br />
	{<br />
		hr=AVIStreamRead(pSourceStream,lPos,1,buffer,lbuffersize,&lLen,NULL);<br />
		if(FAILED(hr))<br />
			...<br />
<br />
		DWORD dwFlag=0;<br />
		if(AVIStreamIsKeyFrame(pSourceStream,lPos))<br />
			dwFlag=AVIIF_KEYFRAME;<br />
<br />
		hr=AVIStreamWrite(pTargetStream,lPos,1,buffer,lbuffersize,dwFlag,NULL,NULL);<br />
		if(FAILED(hr))<br />
			...<br />
	}<br />
<br />
	//	RELEASE<br />
	if(pTargetStream)<br />
		AVIStreamRelease(pTargetStream);<br />
<br />
	if(pTargetFile)<br />
		AVIFileRelease(pTargetFile);<br />
<br />
	if(pSourceStream)<br />
		AVIStreamRelease(pSourceStream);<br />
<br />
	if(pSourceFile)<br />
		AVIFileRelease(pSourceFile);<br />
<br />
	delete[] buffer;<br />
<br />
	AVIFileExit();



using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]

GeneralI shut down explorer.exe but it restarts itself... Pin
Ian Bowler14-Jun-04 5:50
Ian Bowler14-Jun-04 5:50 
GeneralRe: I shut down explorer.exe but it restarts itself... Pin
toxcct14-Jun-04 6:01
toxcct14-Jun-04 6:01 
GeneralRe: I shut down explorer.exe but it restarts itself... Pin
Ian Bowler14-Jun-04 6:16
Ian Bowler14-Jun-04 6:16 
GeneralRe: I shut down explorer.exe but it restarts itself... Pin
jmkhael14-Jun-04 6:41
jmkhael14-Jun-04 6:41 
GeneralRe: I shut down explorer.exe but it restarts itself... Pin
Ian Bowler14-Jun-04 6:50
Ian Bowler14-Jun-04 6:50 
GeneralRe: I shut down explorer.exe but it restarts itself... Pin
Dan Madden14-Jun-04 9:37
Dan Madden14-Jun-04 9:37 
QuestionHow to show xp toolbar? Pin
JabraJabra14-Jun-04 4:55
JabraJabra14-Jun-04 4:55 
Generallooking for a tool or utility Pin
Anonymous14-Jun-04 4:55
Anonymous14-Jun-04 4:55 
QuestionHow to convert HTML to word DOC? Pin
Tcpip200514-Jun-04 4:31
Tcpip200514-Jun-04 4:31 
AnswerRe: How to convert HTML to word DOC? Pin
vcplusplus14-Jun-04 5:09
vcplusplus14-Jun-04 5:09 
QuestionHow to read all (or cell) data from *.xls? Pin
superwolf100814-Jun-04 4:06
superwolf100814-Jun-04 4:06 
AnswerRe: How to read all (or cell) data from *.xls? Pin
CAmelinckx14-Jun-04 4:33
CAmelinckx14-Jun-04 4:33 
GeneralRe: How to read all (or cell) data from *.xls? Pin
CAmelinckx14-Jun-04 4:40
CAmelinckx14-Jun-04 4:40 
QuestionHow to add 24bit BMP to Toolbar Pin
JabraJabra14-Jun-04 3:58
JabraJabra14-Jun-04 3:58 
AnswerRe: How to add 24bit BMP to Toolbar Pin
Johan Rosengren14-Jun-04 9:18
Johan Rosengren14-Jun-04 9:18 
GeneralRe: How to add 24bit BMP to Toolbar Pin
JabraJabra14-Jun-04 12:24
JabraJabra14-Jun-04 12:24 
GeneralRe: How to add 24bit BMP to Toolbar Pin
Johan Rosengren14-Jun-04 20:22
Johan Rosengren14-Jun-04 20:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.