Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

patch-ffmpeg-0.11

By: skuda on Jul 19th, 2012  |  syntax: None  |  size: 2.17 KB  |  views: 164  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. diff --git a/src/zm_ffmpeg_camera.cpp b/src/zm_ffmpeg_camera.cpp
  2. index 42927f6..61df606 100644
  3. --- a/src/zm_ffmpeg_camera.cpp
  4. +++ b/src/zm_ffmpeg_camera.cpp
  5. @@ -108,7 +108,7 @@ int FfmpegCamera::PrimeCapture()
  6.      Info( "Priming capture from %s", mPath.c_str() );
  7.  
  8.      // Open the input, not necessarily a file
  9. -    if ( av_open_input_file( &mFormatContext, mPath.c_str(), NULL, 0, NULL ) !=0 )
  10. +    if ( avformat_open_input( &mFormatContext, mPath.c_str(), NULL, NULL ) !=0 )
  11.          Fatal( "Unable to open input %s due to: %s", mPath.c_str(), strerror(errno) );
  12.  
  13.      // Locate stream info from input
  14. @@ -139,7 +139,7 @@ int FfmpegCamera::PrimeCapture()
  15.          Fatal( "Can't find codec for video stream from %s", mPath.c_str() );
  16.  
  17.      // Open the codec
  18. -    if ( avcodec_open( mCodecContext, mCodec ) < 0 )
  19. +    if ( avcodec_open2( mCodecContext, mCodec, NULL ) < 0 )
  20.          Fatal( "Unable to open codec for video stream from %s", mPath.c_str() );
  21.  
  22.      // Allocate space for the native video frame
  23.  
  24. diff --git a/src/zm_mpeg.cpp b/src/zm_mpeg.cpp
  25. index f5de2a4..d614346 100644
  26. --- a/src/zm_mpeg.cpp
  27. +++ b/src/zm_mpeg.cpp
  28. @@ -167,10 +167,12 @@ void VideoStream::SetParameters()
  29.  {
  30.         /* set the output parameters (must be done even if no
  31.            parameters). */
  32. -       if ( av_set_parameters(ofc, NULL) < 0 )
  33. +       /*
  34. +     * Removed in last ffmpeg
  35. +     * if ( av_set_parameters(ofc, NULL) < 0 )
  36.         {
  37.                 Panic( "Invalid output format parameters" );
  38. -       }
  39. +       }*/
  40.         //dump_format(ofc, 0, filename, 1);
  41.  }
  42.  
  43. @@ -259,7 +261,7 @@ void VideoStream::OpenStream()
  44.         if ( !(of->flags & AVFMT_NOFILE) )
  45.         {
  46.  #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51,2,1)
  47. -               if ( avio_open(&ofc->pb, filename, URL_WRONLY) < 0 )
  48. +               if ( avio_open(&ofc->pb, filename, AVIO_FLAG_WRITE) < 0 )
  49.  #else
  50.                 if ( url_fopen(&ofc->pb, filename, URL_WRONLY) < 0 )
  51.  #endif
  52. @@ -278,7 +280,7 @@ void VideoStream::OpenStream()
  53.         }
  54.  
  55.         /* write the stream header, if any */
  56. -       av_write_header(ofc);
  57. +       avformat_write_header(ofc, NULL);
  58.  }
  59.  
  60.  VideoStream::VideoStream( const char *filename, const char *format, int bitrate, double frame_rate, int colours, int subpixelorder, int width, int height )