patch-modules_codec_avcodec_encoder_c 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. --- vlc-2.2.4.orig/modules/codec/avcodec/encoder.c 2015-10-21 19:48:45.000000000 +0200
  2. +++ vlc-2.2.4/modules/codec/avcodec/encoder.c 2016-09-24 20:35:02.681191261 +0200
  3. @@ -41,7 +41,7 @@
  4. #include <vlc_cpu.h>
  5. #include <libavcodec/avcodec.h>
  6. -#include <libavutil/audioconvert.h>
  7. +#include <libavutil/channel_layout.h>
  8. #include "avcodec.h"
  9. #include "avcommon.h"
  10. @@ -311,7 +311,7 @@ int OpenEncoder( vlc_object_t *p_this )
  11. else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
  12. &psz_namecodec ) )
  13. {
  14. - if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == PIX_FMT_NONE )
  15. + if( FindFfmpegChroma( p_enc->fmt_out.i_codec ) == AV_PIX_FMT_NONE )
  16. return VLC_EGENERIC; /* handed chroma output */
  17. i_cat = VIDEO_ES;
  18. @@ -555,7 +555,7 @@ int OpenEncoder( vlc_object_t *p_this )
  19. if( p_codec->pix_fmts )
  20. {
  21. - const enum PixelFormat *p = p_codec->pix_fmts;
  22. + const enum AVPixelFormat *p = p_codec->pix_fmts;
  23. for( ; *p != -1; p++ )
  24. {
  25. if( *p == p_context->pix_fmt ) break;
  26. @@ -1017,7 +1017,7 @@ errmsg:
  27. }
  28. }
  29. - p_sys->frame = avcodec_alloc_frame();
  30. + p_sys->frame = av_frame_alloc();
  31. if( !p_sys->frame )
  32. {
  33. goto error;
  34. @@ -1048,7 +1048,7 @@ static void vlc_av_packet_Release(block_
  35. {
  36. vlc_av_packet_t *b = (void *) block;
  37. - av_free_packet(&b->packet);
  38. + av_packet_unref(&b->packet);
  39. free(b);
  40. }
  41. @@ -1088,7 +1088,7 @@ static block_t *EncodeVideo( encoder_t *
  42. AVFrame *frame = NULL;
  43. if( likely(p_pict) ) {
  44. frame = p_sys->frame;
  45. - avcodec_get_frame_defaults( frame );
  46. + av_frame_unref( frame );
  47. for( i_plane = 0; i_plane < p_pict->i_planes; i_plane++ )
  48. {
  49. p_sys->frame->data[i_plane] = p_pict->p[i_plane].p_pixels;
  50. @@ -1188,7 +1188,7 @@ static block_t *EncodeVideo( encoder_t *
  51. av_pkt.duration / p_sys->p_context->time_base.den, p_sys->p_context );
  52. if( unlikely(p_block == NULL) )
  53. {
  54. - av_free_packet( &av_pkt );
  55. + av_packet_unref( &av_pkt );
  56. return NULL;
  57. }
  58. @@ -1329,7 +1329,7 @@ static block_t *handle_delay_buffer( enc
  59. //How much we need to copy from new packet
  60. const int leftover = leftover_samples * p_sys->p_context->channels * p_sys->i_sample_bytes;
  61. - avcodec_get_frame_defaults( p_sys->frame );
  62. + av_frame_unref( p_sys->frame );
  63. p_sys->frame->format = p_sys->p_context->sample_fmt;
  64. p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
  65. @@ -1451,7 +1451,7 @@ static block_t *EncodeAudio( encoder_t *
  66. while( ( p_aout_buf->i_nb_samples >= p_sys->i_frame_size ) ||
  67. ( p_sys->b_variable && p_aout_buf->i_nb_samples ) )
  68. {
  69. - avcodec_get_frame_defaults( p_sys->frame );
  70. + av_frame_unref( p_sys->frame );
  71. if( p_sys->b_variable )
  72. p_sys->frame->nb_samples = p_aout_buf->i_nb_samples;
  73. else
  74. @@ -1514,7 +1514,7 @@ void CloseEncoder( vlc_object_t *p_this
  75. encoder_t *p_enc = (encoder_t *)p_this;
  76. encoder_sys_t *p_sys = p_enc->p_sys;
  77. - /*FIXME: we should use avcodec_free_frame, but we don't require so new avcodec that has it*/
  78. + /*FIXME: we should use av_frame_free, but we don't require so new avcodec that has it*/
  79. av_freep( &p_sys->frame );
  80. vlc_avcodec_lock();