Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
plz let me know hw to use this method as i m getting same value for each video and its negative.
Posted

1 solution

Perhaps you should review the documentation for this function. It states that the function will return a HRESULT.

If you check out the directShow error codes[^], you can see that from VFW_E_INVALIDMEDIATYPE onwards, the most significant nibble (most significant hex digit) is 8 - this implies that the most significant bit is set.

When negative integers are represented in computers, it is done by setting the most significant bit.

An example may be seen here:

Code
C++
HRESULT num = 0x80040200;       // VFW_E_INVALIDMEDIATYPE
printf("Num = %d\n", num);
printf("Num = %u\n", num);
printf("Num = 0x%X\n", num);


Output
Num = -2147220992
Num = 2147746304
Num = 0x80040200



So to sum up, what I'm getting at is that binary data may be interpreted in different ways. Above, I've interpreted it as both signed and unsigned (%d) and (%u) in the last line I've chosen to display in (uppercase) hexadecimal format (%X).

The point is, you're not actually getting a negative fame length - you're getting an error code which you are then interpreting as a signed int. I'd suggest error checking and a look at the error codes page I linked.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900