ffmpeg2.0.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. diff -rupN a/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c b/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c
  2. --- a/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c 2013-01-02 22:46:59.000000000 +0100
  3. +++ b/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c 2013-07-22 18:12:18.001576713 +0200
  4. @@ -28,6 +28,8 @@
  5. #include "tsmf_constants.h"
  6. #include "tsmf_decoder.h"
  7. +#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
  8. +
  9. /* Compatibility with older FFmpeg */
  10. #if LIBAVUTIL_VERSION_MAJOR < 50
  11. #define AVMEDIA_TYPE_VIDEO 0
  12. @@ -39,7 +41,7 @@ typedef struct _TSMFFFmpegDecoder
  13. ITSMFDecoder iface;
  14. int media_type;
  15. - enum CodecID codec_id;
  16. + enum AVCodecID codec_id;
  17. AVCodecContext* codec_context;
  18. AVCodec* codec;
  19. AVFrame* frame;
  20. @@ -54,7 +56,7 @@ static boolean tsmf_ffmpeg_init_context(
  21. {
  22. TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;
  23. - mdecoder->codec_context = avcodec_alloc_context();
  24. + mdecoder->codec_context = avcodec_alloc_context3(NULL);
  25. if (!mdecoder->codec_context)
  26. {
  27. DEBUG_WARN("avcodec_alloc_context failed.");
  28. @@ -88,16 +90,6 @@ static boolean tsmf_ffmpeg_init_audio_st
  29. mdecoder->codec_context->channels = media_type->Channels;
  30. mdecoder->codec_context->block_align = media_type->BlockAlign;
  31. -#ifdef AV_CPU_FLAG_SSE2
  32. - mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
  33. -#else
  34. -#if LIBAVCODEC_VERSION_MAJOR < 53
  35. - mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMXEXT;
  36. -#else
  37. - mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMX2;
  38. -#endif
  39. -#endif
  40. -
  41. return true;
  42. }
  43. @@ -174,7 +166,7 @@ static boolean tsmf_ffmpeg_prepare(ITSMF
  44. {
  45. TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;
  46. - if (avcodec_open(mdecoder->codec_context, mdecoder->codec) < 0)
  47. + if (avcodec_open2(mdecoder->codec_context, mdecoder->codec, NULL) < 0)
  48. {
  49. DEBUG_WARN("avcodec_open failed.");
  50. return false;
  51. @@ -372,8 +364,9 @@ static boolean tsmf_ffmpeg_decode_audio(
  52. av_init_packet(&pkt);
  53. pkt.data = (uint8*) src;
  54. pkt.size = src_size;
  55. - len = avcodec_decode_audio3(mdecoder->codec_context,
  56. - (int16_t*) dst, &frame_size, &pkt);
  57. + AVFrame * frame = avcodec_alloc_frame ();
  58. + len = avcodec_decode_audio4(mdecoder->codec_context,
  59. + frame, &frame_size, &pkt);
  60. }
  61. #endif
  62. if (len <= 0 || frame_size <= 0)
  63. @@ -499,7 +492,6 @@ TSMFDecoderEntry(void)
  64. if (!initialized)
  65. {
  66. - avcodec_init();
  67. avcodec_register_all();
  68. initialized = true;
  69. }