Getting started with http media streaming in C
-
30-05-2021 - |
题
Alrighty so, I've been wanting to learn C for awhile, and now I have a project idea that's actually relevant to a website I want to build, but I have a few initial questions on how to get started. This isn't really a "how to program" question or anything, I can get started with C programming fine, I know how to read and communicate with various APIs and protocols as long as I have documentation, etc. I'm just looking for a starting point, I guess.
The program would be something similar to ice or shoutcast, so basically audio streaming. Does anyone think they could give a brief, high-level overview of what would be required? As I said the end product would be a url you pop in a .pls file and you can stream it to w/e client you want. What protocols, libraries, and documentation should I be looking at?
解决方案
If you want this to be a toy for learning, you might want to do all the work yourself; it's a complicated problem, and getting it right is definitely going to be educational. A copy of Advanced Programming the Unix Environment, 2nd edition or TCP/IP Illustrated, Vol 1 would be helpful but not strictly necessary.
If you want this to be useful too, I'd suggest starting with libev
or libevent
. libevent
has some built-in HTTP handling, which might be nice, but there are reports that libevent
s HTTP handling isn't perfect. libev
doesn't provide built-in HTTP handling, but it should be easier to write with libev
than performing all the work by hand. Using these pre-written event-based libraries will improve the stability and reliability of your program compared to writing the entire thing by hand, though they aren't doing anything that you can't do yourself.