LordSputnik

libav migration issue

Apr 17th, 2014
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. puts("Doing SHIZ!");
  2. printf("LIBAV VERSION: %i\n",LIBAVCODEC_VERSION_MAJOR);
  3.  
  4. AVCodec* codec = avcodec_find_decoder(file->codec_context->codec_id);
  5.  
  6. if (avcodec_open2(file->codec_context, codec, NULL) < 0)
  7.     return NULL;
  8.  
  9. AVPacket packet;
  10. int decoded;
  11.  
  12. enum AVSampleFormat sample_format = file->codec_context->sample_fmt;
  13. AVFrame* frame = avcodec_alloc_frame();
  14.  
  15. if(av_read_frame(file->format_context, &packet) != 0)
  16.     return NULL;
  17.  
  18. avcodec_decode_audio4(file->codec_context, frame, &decoded, &packet);
  19.  
  20. if(decoded != 0)
  21. {
  22.     puts("Doing SHIZA!");
  23.     if(frame->format != sample_format)
  24.         return NULL;
  25. }
  26. else
  27. {
  28.     puts("Doing SHIZB!");
  29.     return NULL;
  30. }
  31.  
  32. puts("Doing SHIZ2!");
  33.  
  34. ///////////////////////
  35. // Output
  36. ///////////////////////
  37. // Doing SHIZ!
  38. // LIBAV VERSION: 54
  39. // [flac @ 0x11e3160] invalid sync code
  40. // [flac @ 0x11e3160] invalid frame header
  41. // [flac @ 0x11e3160] decode_frame() failed
  42. // Doing SHIZB!
  43. ///////////////////////
Advertisement
Add Comment
Please, Sign In to add comment