Guest User

fftest.cpp

a guest
Sep 24th, 2014
195
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. extern "C" {
  4.   #include <libavcodec/avcodec.h>
  5.   #include <libavformat/avformat.h>
  6.   #include <libavutil/avutil.h>
  7. }
  8. #include <mutex>
  9.  
  10. int main(int argc, char *argv[]) {
  11.   // initialize av decoders
  12.   static std::once_flag initFlag;
  13.   std::call_once(initFlag, []() { av_register_all(); });
  14.  
  15.   // shared_ptr make it exception-safe
  16.   std::shared_ptr<AVFormatContext> avFormat(avformat_alloc_context(),
  17.             &avformat_free_context);
  18.  
  19.   // open and parse header information
  20.   auto avFormatPtr = avFormat.get();
  21.   avformat_network_init();
  22.   // if (avformat_open_input( &avFormatPtr, "rtp://localhost:5000",
  23.   if (avformat_open_input( &avFormatPtr, "rpi.sdp",
  24.               nullptr, nullptr) != 0)
  25.     throw std::runtime_error("Error while calling avformat_open_input (probably invalid file format)" );
  26.  
  27.  
  28.   fprintf(stderr, "past\n");
  29.   fprintf(stderr, "version: %d.%d.%d\n", LIBAVFORMAT_VERSION_MAJOR,
  30.                                          LIBAVFORMAT_VERSION_MINOR,
  31.                                          LIBAVFORMAT_VERSION_MICRO);
  32.  
  33.   if (avformat_find_stream_info(avFormat.get(), nullptr) < 0)
  34.     throw std::runtime_error("Error while calling avformat_find_stream_info");
  35.  
  36.   fprintf(stderr, "past\n");
  37.  
  38.   return 0;
  39. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×