I’m trying to write a program that accepts a webM file (media) as a parameter, and then output the stream details via TTY in as much detail as possible. I figured I’d try to open the file in binary mode, but am not sure where to start.
Thanks for the help.
This sounds like a very high level question, so I’ll answer it as such:
If you’re creating a command line program in C/C++ that needs to accept parameters, look up how to use the ‘argc’ and ‘argv’ parameters to the main() function.
Once you have the parameter being passed into your main function, you will try to open it using some file reading library (there are several to choose from based on your needs and platform). Yes, you will want to open a WebM file in binary mode if the file library cares about the difference. If using fopen(), specify “rb” to read in binary mode– this won’t make any difference on Unix (vs. plain “r”) but it will make a big difference on Windows.
From there, you can start reading bytes from the WebM file and processing them. Be advised that WebM is based on the Matroska multimedia format which is quite involved. If you are doing this as an academic exercise, more power to you. If you are looking to get something accomplished on a tight deadline, there are libraries you can call to do the heavy lifting of Matroska parsing on your behalf.