Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 654628
Collapse All | Expand All

(-)a/ext/libav/gstav.c (-2 / +2 lines)
Lines 30-36 Link Here
30
#include <libavcodec/avcodec.h>
30
#include <libavcodec/avcodec.h>
31
#include <libavformat/avformat.h>
31
#include <libavformat/avformat.h>
32
#include <libavfilter/avfiltergraph.h>
32
//#include <libavfilter/avfiltergraph.h>
33
#include "gstav.h"
33
#include "gstav.h"
34
#include "gstavutils.h"
34
#include "gstavutils.h"
Lines 158-164 plugin_init (GstPlugin * plugin) Link Here
158
  gst_ffmpeg_init_pix_fmt_info ();
158
  gst_ffmpeg_init_pix_fmt_info ();
159
  av_register_all ();
159
  av_register_all ();
160
  avfilter_register_all ();
160
  //avfilter_register_all ();
161
  gst_ffmpegaudenc_register (plugin);
161
  gst_ffmpegaudenc_register (plugin);
162
  gst_ffmpegvidenc_register (plugin);
162
  gst_ffmpegvidenc_register (plugin);
(-)a/ext/libav/gstavauddec.c (-10 / +10 lines)
Lines 283-289 gst_ffmpegauddec_propose_allocation (GstAudioDecoder * decoder, Link Here
283
  gst_allocation_params_init (&params);
283
  gst_allocation_params_init (&params);
284
  params.flags = GST_MEMORY_FLAG_ZERO_PADDED;
284
  params.flags = GST_MEMORY_FLAG_ZERO_PADDED;
285
  params.align = 15;
285
  params.align = 15;
286
  params.padding = FF_INPUT_BUFFER_PADDING_SIZE;
286
  params.padding = AV_INPUT_BUFFER_PADDING_SIZE;
287
  /* we would like to have some padding so that we don't have to
287
  /* we would like to have some padding so that we don't have to
288
   * memcpy. We don't suggest an allocator. */
288
   * memcpy. We don't suggest an allocator. */
289
  gst_query_add_allocation_param (query, NULL, &params);
289
  gst_query_add_allocation_param (query, NULL, &params);
Lines 665-671 gst_ffmpegauddec_drain (GstFFMpegAudDec * ffmpegdec) Link Here
665
665
666
  oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
666
  oclass = (GstFFMpegAudDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
667
667
668
  if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
668
  if (oclass->in_plugin->capabilities & AV_CODEC_CAP_DELAY) {
669
    gint have_data, len;
669
    gint have_data, len;
670
670
671
    GST_LOG_OBJECT (ffmpegdec,
671
    GST_LOG_OBJECT (ffmpegdec,
Lines 744-753 gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) Link Here
744
  bsize = map.size;
744
  bsize = map.size;
745
745
746
  if (bsize > 0 && (!GST_MEMORY_IS_ZERO_PADDED (map.memory)
746
  if (bsize > 0 && (!GST_MEMORY_IS_ZERO_PADDED (map.memory)
747
          || (map.maxsize - map.size) < FF_INPUT_BUFFER_PADDING_SIZE)) {
747
          || (map.maxsize - map.size) < AV_INPUT_BUFFER_PADDING_SIZE)) {
748
    /* add padding */
748
    /* add padding */
749
    if (ffmpegdec->padded_size < bsize + FF_INPUT_BUFFER_PADDING_SIZE) {
749
    if (ffmpegdec->padded_size < bsize + AV_INPUT_BUFFER_PADDING_SIZE) {
750
      ffmpegdec->padded_size = bsize + FF_INPUT_BUFFER_PADDING_SIZE;
750
      ffmpegdec->padded_size = bsize + AV_INPUT_BUFFER_PADDING_SIZE;
751
      ffmpegdec->padded = g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
751
      ffmpegdec->padded = g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
752
      GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
752
      GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
753
          ffmpegdec->padded_size);
753
          ffmpegdec->padded_size);
Lines 755-761 gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) Link Here
755
    GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
755
    GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
756
        "Copy input to add padding");
756
        "Copy input to add padding");
757
    memcpy (ffmpegdec->padded, bdata, bsize);
757
    memcpy (ffmpegdec->padded, bdata, bsize);
758
    memset (ffmpegdec->padded + bsize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
758
    memset (ffmpegdec->padded + bsize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
759
759
760
    bdata = ffmpegdec->padded;
760
    bdata = ffmpegdec->padded;
761
    do_padding = TRUE;
761
    do_padding = TRUE;
Lines 764-770 gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) Link Here
764
  }
764
  }
765
765
766
  do {
766
  do {
767
    guint8 tmp_padding[FF_INPUT_BUFFER_PADDING_SIZE];
767
    guint8 tmp_padding[AV_INPUT_BUFFER_PADDING_SIZE];
768
768
769
    data = bdata;
769
    data = bdata;
770
    size = bsize;
770
    size = bsize;
Lines 773-787 gst_ffmpegauddec_handle_frame (GstAudioDecoder * decoder, GstBuffer * inbuf) Link Here
773
      /* add temporary padding */
773
      /* add temporary padding */
774
      GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
774
      GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
775
          "Add temporary input padding");
775
          "Add temporary input padding");
776
      memcpy (tmp_padding, data + size, FF_INPUT_BUFFER_PADDING_SIZE);
776
      memcpy (tmp_padding, data + size, AV_INPUT_BUFFER_PADDING_SIZE);
777
      memset (data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
777
      memset (data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
778
    }
778
    }
779
779
780
    /* decode a frame of audio now */
780
    /* decode a frame of audio now */
781
    len = gst_ffmpegauddec_frame (ffmpegdec, data, size, &have_data, &ret);
781
    len = gst_ffmpegauddec_frame (ffmpegdec, data, size, &have_data, &ret);
782
782
783
    if (do_padding) {
783
    if (do_padding) {
784
      memcpy (data + size, tmp_padding, FF_INPUT_BUFFER_PADDING_SIZE);
784
      memcpy (data + size, tmp_padding, AV_INPUT_BUFFER_PADDING_SIZE);
785
    }
785
    }
786
786
787
    if (ret != GST_FLOW_OK) {
787
    if (ret != GST_FLOW_OK) {
(-)a/ext/libav/gstavaudenc.c (-4 / +3 lines)
Lines 283-289 gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) Link Here
283
  }
283
  }
284
284
285
  /* some other defaults */
285
  /* some other defaults */
286
  ffmpegaudenc->context->rc_strategy = 2;
287
  ffmpegaudenc->context->b_frame_strategy = 0;
286
  ffmpegaudenc->context->b_frame_strategy = 0;
288
  ffmpegaudenc->context->coder_type = 0;
287
  ffmpegaudenc->context->coder_type = 0;
289
  ffmpegaudenc->context->context_model = 0;
288
  ffmpegaudenc->context->context_model = 0;
Lines 330-336 gst_ffmpegaudenc_set_format (GstAudioEncoder * encoder, GstAudioInfo * info) Link Here
330
            oclass->in_plugin) < 0)
329
            oclass->in_plugin) < 0)
331
      GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
330
      GST_DEBUG_OBJECT (ffmpegaudenc, "Failed to set context defaults");
332
331
333
    if ((oclass->in_plugin->capabilities & CODEC_CAP_EXPERIMENTAL) &&
332
    if ((oclass->in_plugin->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
334
        ffmpegaudenc->compliance != GST_FFMPEG_EXPERIMENTAL) {
333
        ffmpegaudenc->compliance != GST_FFMPEG_EXPERIMENTAL) {
335
      GST_ELEMENT_ERROR (ffmpegaudenc, LIBRARY, SETTINGS,
334
      GST_ELEMENT_ERROR (ffmpegaudenc, LIBRARY, SETTINGS,
336
          ("Codec is experimental, but settings don't allow encoders to "
335
          ("Codec is experimental, but settings don't allow encoders to "
Lines 602-608 gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, Link Here
602
        pkt->size, 0, pkt->size, pkt, gst_ffmpegaudenc_free_avpacket);
601
        pkt->size, 0, pkt->size, pkt, gst_ffmpegaudenc_free_avpacket);
603
602
604
    codec = ffmpegaudenc->context->codec;
603
    codec = ffmpegaudenc->context->codec;
605
    if ((codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) || !buffer) {
604
    if ((codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) || !buffer) {
606
      /* FIXME: Not really correct, as -1 means "all the samples we got
605
      /* FIXME: Not really correct, as -1 means "all the samples we got
607
         given so far", which may not be true depending on the codec,
606
         given so far", which may not be true depending on the codec,
608
         but we have no way to know AFAICT */
607
         but we have no way to know AFAICT */
Lines 626-632 gst_ffmpegaudenc_drain (GstFFMpegAudEnc * ffmpegaudenc) Link Here
626
625
627
  oclass = (GstFFMpegAudEncClass *) (G_OBJECT_GET_CLASS (ffmpegaudenc));
626
  oclass = (GstFFMpegAudEncClass *) (G_OBJECT_GET_CLASS (ffmpegaudenc));
628
627
629
  if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
628
  if (oclass->in_plugin->capabilities & AV_CODEC_CAP_DELAY) {
630
    gint have_data, try = 0;
629
    gint have_data, try = 0;
631
630
632
    GST_LOG_OBJECT (ffmpegaudenc,
631
    GST_LOG_OBJECT (ffmpegaudenc,
(-)a/ext/libav/gstavcfg.c (-21 / +38 lines)
Lines 42-50 gst_ffmpeg_pass_get_type (void) Link Here
42
  if (!ffmpeg_pass_type) {
42
  if (!ffmpeg_pass_type) {
43
    static const GEnumValue ffmpeg_passes[] = {
43
    static const GEnumValue ffmpeg_passes[] = {
44
      {0, "Constant Bitrate Encoding", "cbr"},
44
      {0, "Constant Bitrate Encoding", "cbr"},
45
      {CODEC_FLAG_QSCALE, "Constant Quantizer", "quant"},
45
      {AV_CODEC_FLAG_QSCALE, "Constant Quantizer", "quant"},
46
      {CODEC_FLAG_PASS1, "VBR Encoding - Pass 1", "pass1"},
46
      {AV_CODEC_FLAG_PASS1, "VBR Encoding - Pass 1", "pass1"},
47
      {CODEC_FLAG_PASS2, "VBR Encoding - Pass 2", "pass2"},
47
      {AV_CODEC_FLAG_PASS2, "VBR Encoding - Pass 2", "pass2"},
48
      {0, NULL, NULL},
48
      {0, NULL, NULL},
49
    };
49
    };
50
50
Lines 66-72 gst_ffmpeg_lim_pass_get_type (void) Link Here
66
  if (!ffmpeg_lim_pass_type) {
66
  if (!ffmpeg_lim_pass_type) {
67
    static const GEnumValue ffmpeg_lim_passes[] = {
67
    static const GEnumValue ffmpeg_lim_passes[] = {
68
      {0, "Constant Bitrate Encoding", "cbr"},
68
      {0, "Constant Bitrate Encoding", "cbr"},
69
      {CODEC_FLAG_QSCALE, "Constant Quantizer", "quant"},
69
      {AV_CODEC_FLAG_QSCALE, "Constant Quantizer", "quant"},
70
      {0, NULL, NULL},
70
      {0, NULL, NULL},
71
    };
71
    };
72
72
Lines 121-129 gst_ffmpeg_mb_cmp_get_type (void) Link Here
121
      {FF_CMP_VSSE, "VSSE", "vsse"},
121
      {FF_CMP_VSSE, "VSSE", "vsse"},
122
#if 0
122
#if 0
123
/* economize a bit for now */
123
/* economize a bit for now */
124
      {FF_CMP_NSSE, "NSSE", "nsse"},
124
      {AV_CMP_NSSE, "NSSE", "nsse"},
125
      {FF_CMP_W53, "W53", "w53"},
125
      {AV_CMP_W53, "W53", "w53"},
126
      {FF_CMP_W97, "W97", "w97"},
126
      {AV_CMP_W97, "W97", "w97"},
127
#endif
127
#endif
128
      {0, NULL, NULL},
128
      {0, NULL, NULL},
129
    };
129
    };
Lines 260-280 gst_ffmpeg_flags_get_type (void) Link Here
260
  /* FIXME: This needs some serious resyncing with avcodec.h */
260
  /* FIXME: This needs some serious resyncing with avcodec.h */
261
  if (!ffmpeg_flags_type) {
261
  if (!ffmpeg_flags_type) {
262
    static const GFlagsValue ffmpeg_flags[] = {
262
    static const GFlagsValue ffmpeg_flags[] = {
263
      {CODEC_FLAG_QSCALE, "Use fixed qscale", "qscale"},
263
      {AV_CODEC_FLAG_QSCALE, "Use fixed qscale", "qscale"},
264
      {CODEC_FLAG_4MV, "Allow 4 MV per MB", "4mv"},
264
      {AV_CODEC_FLAG_4MV, "Allow 4 MV per MB", "4mv"},
265
      {CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"},
265
      {AV_CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"},
266
      {CODEC_FLAG_GMC, "GMC", "gmc"},
266
      //{AV_CODEC_FLAG_GMC, "GMC", "gmc"},
267
      {CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"},
267
      //{AV_CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"},
268
      {CODEC_FLAG_LOOP_FILTER, "Loop filter", "loop-filter"},
268
      {AV_CODEC_FLAG_LOOP_FILTER, "Loop filter", "loop-filter"},
269
      {CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"},
269
      {AV_CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"},
270
      {CODEC_FLAG_NORMALIZE_AQP,
270
      //{AV_CODEC_FLAG_NORMALIZE_AQP,
271
          "Normalize Adaptive Quantization (masking, etc)", "aqp"},
271
      //    "Normalize Adaptive Quantization (masking, etc)", "aqp"},
272
      {CODEC_FLAG_GLOBAL_HEADER,
272
      {AV_CODEC_FLAG_GLOBAL_HEADER,
273
            "Global headers in extradata instead of every keyframe",
273
            "Global headers in extradata instead of every keyframe",
274
          "global-headers"},
274
          "global-headers"},
275
      {CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction",
275
      {AV_CODEC_FLAG_AC_PRED,
276
            "H263 Advanced Intra Coding / MPEG4 AC prediction",
276
          "aic"},
277
          "aic"},
277
      {CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"},
278
      {AV_CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"},
278
      {0, NULL, NULL},
279
      {0, NULL, NULL},
279
    };
280
    };
280
281
Lines 487-517 gst_ffmpeg_cfg_init (void) Link Here
487
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
488
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
488
  gst_ffmpeg_add_pspec (pspec, config.qblur, FALSE, mpeg, NULL);
489
  gst_ffmpeg_add_pspec (pspec, config.qblur, FALSE, mpeg, NULL);
489
490
491
#if 0
490
  pspec = g_param_spec_float ("rc-qsquish", "Ratecontrol Limiting Method",
492
  pspec = g_param_spec_float ("rc-qsquish", "Ratecontrol Limiting Method",
491
      "0 means limit by clipping, otherwise use nice continuous function",
493
      "0 means limit by clipping, otherwise use nice continuous function",
492
      0, 99.0f, 1.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
494
      0, 99.0f, 1.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
493
  gst_ffmpeg_add_pspec (pspec, config.rc_qsquish, FALSE, mpeg, NULL);
495
  gst_ffmpeg_add_pspec (pspec, config.rc_qsquish, FALSE, mpeg, NULL);
496
#endif
494
497
498
#if 0
495
  pspec = g_param_spec_float ("rc-qmod-amp", "Ratecontrol Mod",
499
  pspec = g_param_spec_float ("rc-qmod-amp", "Ratecontrol Mod",
496
      "Ratecontrol Mod", 0, 99.0f, 0,
500
      "Ratecontrol Mod", 0, 99.0f, 0,
497
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
501
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
498
  gst_ffmpeg_add_pspec (pspec, config.rc_qmod_amp, FALSE, mpeg, NULL);
502
  gst_ffmpeg_add_pspec (pspec, config.rc_qmod_amp, FALSE, mpeg, NULL);
503
#endif
499
504
505
#if 0
500
  pspec = g_param_spec_int ("rc-qmod-freq", "Ratecontrol Freq",
506
  pspec = g_param_spec_int ("rc-qmod-freq", "Ratecontrol Freq",
501
      "Ratecontrol Freq", 0, 0, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
507
      "Ratecontrol Freq", 0, 0, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
502
  gst_ffmpeg_add_pspec (pspec, config.rc_qmod_freq, FALSE, mpeg, NULL);
508
  gst_ffmpeg_add_pspec (pspec, config.rc_qmod_freq, FALSE, mpeg, NULL);
509
#endif
503
510
504
  pspec = g_param_spec_int ("rc-buffer-size", "Ratecontrol Buffer Size",
511
  pspec = g_param_spec_int ("rc-buffer-size", "Ratecontrol Buffer Size",
505
      "Decoder bitstream buffer size", 0, G_MAXINT, 0,
512
      "Decoder bitstream buffer size", 0, G_MAXINT, 0,
506
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
513
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
507
  gst_ffmpeg_add_pspec (pspec, config.rc_buffer_size, FALSE, mpeg, NULL);
514
  gst_ffmpeg_add_pspec (pspec, config.rc_buffer_size, FALSE, mpeg, NULL);
508
515
516
#if 0
509
  pspec =
517
  pspec =
510
      g_param_spec_float ("rc-buffer-aggressivity",
518
      g_param_spec_float ("rc-buffer-aggressivity",
511
      "Ratecontrol Buffer Aggressivity", "Ratecontrol Buffer Aggressivity", 0,
519
      "Ratecontrol Buffer Aggressivity", "Ratecontrol Buffer Aggressivity", 0,
512
      99.0f, 1.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
520
      99.0f, 1.0f, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
513
  gst_ffmpeg_add_pspec (pspec, config.rc_buffer_aggressivity, FALSE, mpeg,
521
  gst_ffmpeg_add_pspec (pspec, config.rc_buffer_aggressivity, FALSE, mpeg,
514
      NULL);
522
      NULL);
523
#endif
515
524
516
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT (57, 3, 0)
525
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT (57, 3, 0)
517
  pspec = g_param_spec_int ("rc-max-rate", "Ratecontrol Maximum Bitrate",
526
  pspec = g_param_spec_int ("rc-max-rate", "Ratecontrol Maximum Bitrate",
Lines 529-545 gst_ffmpeg_cfg_init (void) Link Here
529
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
538
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
530
  gst_ffmpeg_add_pspec (pspec, config.rc_min_rate, FALSE, mpeg, NULL);
539
  gst_ffmpeg_add_pspec (pspec, config.rc_min_rate, FALSE, mpeg, NULL);
531
540
541
#if 0
532
  pspec =
542
  pspec =
533
      g_param_spec_float ("rc-initial-cplx",
543
      g_param_spec_float ("rc-initial-cplx",
534
      "Initial Complexity for Pass 1 Ratecontrol",
544
      "Initial Complexity for Pass 1 Ratecontrol",
535
      "Initial Complexity for Pass 1 Ratecontrol", 0, 9999999.0f, 0,
545
      "Initial Complexity for Pass 1 Ratecontrol", 0, 9999999.0f, 0,
536
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
546
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
537
  gst_ffmpeg_add_pspec (pspec, config.rc_initial_cplx, FALSE, mpeg, NULL);
547
  gst_ffmpeg_add_pspec (pspec, config.rc_initial_cplx, FALSE, mpeg, NULL);
548
#endif
538
549
550
#if 0
539
  pspec = g_param_spec_string ("rc-eq", "Ratecontrol Equation",
551
  pspec = g_param_spec_string ("rc-eq", "Ratecontrol Equation",
540
      "Ratecontrol Equation", "tex^qComp",
552
      "Ratecontrol Equation", "tex^qComp",
541
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
553
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
542
  gst_ffmpeg_add_pspec (pspec, config.rc_eq, FALSE, mpeg, NULL);
554
  gst_ffmpeg_add_pspec (pspec, config.rc_eq, FALSE, mpeg, NULL);
555
#endif
543
556
544
  pspec = g_param_spec_float ("b-quant-factor", "B-Quantizer Factor",
557
  pspec = g_param_spec_float ("b-quant-factor", "B-Quantizer Factor",
545
      "Factor in B-Frame Quantizer Computation",
558
      "Factor in B-Frame Quantizer Computation",
Lines 630-648 gst_ffmpeg_cfg_init (void) Link Here
630
      0, 16000, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
643
      0, 16000, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
631
  gst_ffmpeg_add_pspec (pspec, config.me_range, FALSE, mpeg, NULL);
644
  gst_ffmpeg_add_pspec (pspec, config.me_range, FALSE, mpeg, NULL);
632
645
646
#if 0
633
  pspec = g_param_spec_int ("intra-quant-bias",
647
  pspec = g_param_spec_int ("intra-quant-bias",
634
      "Intra Quantizer Bias",
648
      "Intra Quantizer Bias",
635
      "Intra Quantizer Bias",
649
      "Intra Quantizer Bias",
636
      -1000000, 1000000, FF_DEFAULT_QUANT_BIAS,
650
      -1000000, 1000000, AV_DEFAULT_QUANT_BIAS,
637
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
651
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
638
  gst_ffmpeg_add_pspec (pspec, config.intra_quant_bias, FALSE, mpeg, NULL);
652
  gst_ffmpeg_add_pspec (pspec, config.intra_quant_bias, FALSE, mpeg, NULL);
653
#endif
639
654
655
#if 0
640
  pspec = g_param_spec_int ("inter-quant-bias",
656
  pspec = g_param_spec_int ("inter-quant-bias",
641
      "Inter Quantizer Bias",
657
      "Inter Quantizer Bias",
642
      "Inter Quantizer Bias",
658
      "Inter Quantizer Bias",
643
      -1000000, 1000000, FF_DEFAULT_QUANT_BIAS,
659
      -1000000, 1000000, AV_DEFAULT_QUANT_BIAS,
644
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
660
      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
645
  gst_ffmpeg_add_pspec (pspec, config.inter_quant_bias, FALSE, mpeg, NULL);
661
  gst_ffmpeg_add_pspec (pspec, config.inter_quant_bias, FALSE, mpeg, NULL);
662
#endif
646
663
647
  pspec = g_param_spec_int ("noise-reduction",
664
  pspec = g_param_spec_int ("noise-reduction",
648
      "Noise Reduction",
665
      "Noise Reduction",
(-)a/ext/libav/gstavcodecmap.c (-14 / +15 lines)
Lines 825-834 gst_ffmpeg_codecid_to_caps (enum AVCodecID codec_id, Link Here
825
      if (encode && context) {
825
      if (encode && context) {
826
826
827
        gst_caps_set_simple (caps,
827
        gst_caps_set_simple (caps,
828
            "annex-f", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_4MV,
828
            "annex-f", G_TYPE_BOOLEAN, context->flags & AV_CODEC_FLAG_4MV,
829
            "annex-j", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_LOOP_FILTER,
829
            "annex-j", G_TYPE_BOOLEAN, context->flags & AV_CODEC_FLAG_LOOP_FILTER,
830
            "annex-i", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_AC_PRED,
830
            "annex-i", G_TYPE_BOOLEAN, context->flags & AV_CODEC_FLAG_AC_PRED,
831
            "annex-t", G_TYPE_BOOLEAN, context->flags & CODEC_FLAG_AC_PRED,
831
            "annex-t", G_TYPE_BOOLEAN, context->flags & AV_CODEC_FLAG_AC_PRED,
832
            NULL);
832
            NULL);
833
      }
833
      }
834
      break;
834
      break;
Lines 3181-3187 gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id, Link Here
3181
       * as is, as that is what most players do. */
3181
       * as is, as that is what most players do. */
3182
      context->extradata =
3182
      context->extradata =
3183
          av_mallocz (GST_ROUND_UP_16 (size * 2 +
3183
          av_mallocz (GST_ROUND_UP_16 (size * 2 +
3184
              FF_INPUT_BUFFER_PADDING_SIZE));
3184
              AV_INPUT_BUFFER_PADDING_SIZE));
3185
      copy_config (context->extradata, data, size, &extrasize);
3185
      copy_config (context->extradata, data, size, &extrasize);
3186
      GST_DEBUG ("escaped size: %d", extrasize);
3186
      GST_DEBUG ("escaped size: %d", extrasize);
3187
      context->extradata_size = extrasize;
3187
      context->extradata_size = extrasize;
Lines 3192-3198 gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id, Link Here
3192
      GST_DEBUG ("copy codec_data");
3192
      GST_DEBUG ("copy codec_data");
3193
      context->extradata =
3193
      context->extradata =
3194
          av_mallocz (GST_ROUND_UP_16 (map.size +
3194
          av_mallocz (GST_ROUND_UP_16 (map.size +
3195
              FF_INPUT_BUFFER_PADDING_SIZE));
3195
              AV_INPUT_BUFFER_PADDING_SIZE));
3196
      memcpy (context->extradata, map.data, map.size);
3196
      memcpy (context->extradata, map.data, map.size);
3197
      context->extradata_size = map.size;
3197
      context->extradata_size = map.size;
3198
    }
3198
    }
Lines 3216-3222 gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id, Link Here
3216
    {
3216
    {
3217
      const gchar *mime = gst_structure_get_name (str);
3217
      const gchar *mime = gst_structure_get_name (str);
3218
3218
3219
      context->flags |= CODEC_FLAG_4MV;
3219
      context->flags |= AV_CODEC_FLAG_4MV;
3220
3220
3221
      if (!strcmp (mime, "video/x-divx"))
3221
      if (!strcmp (mime, "video/x-divx"))
3222
        context->codec_tag = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
3222
        context->codec_tag = GST_MAKE_FOURCC ('D', 'I', 'V', 'X');
Lines 3228-3234 gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id, Link Here
3228
        profile = gst_structure_get_string (str, "profile");
3228
        profile = gst_structure_get_string (str, "profile");
3229
        if (profile) {
3229
        if (profile) {
3230
          if (g_strcmp0 (profile, "advanced-simple") == 0)
3230
          if (g_strcmp0 (profile, "advanced-simple") == 0)
3231
            context->flags |= CODEC_FLAG_GMC | CODEC_FLAG_QPEL;
3231
            context->flags |= AV_CODEC_FLAG_QPEL;
3232
            /* FIXME use the "gmc" private option of the libxvid encoder */
3232
        }
3233
        }
3233
      }
3234
      }
3234
      break;
3235
      break;
Lines 3334-3351 gst_ffmpeg_caps_with_codecid (enum AVCodecID codec_id, Link Here
3334
      gboolean val;
3335
      gboolean val;
3335
3336
3336
      if (!gst_structure_get_boolean (str, "annex-f", &val) || val)
3337
      if (!gst_structure_get_boolean (str, "annex-f", &val) || val)
3337
        context->flags |= CODEC_FLAG_4MV;
3338
        context->flags |= AV_CODEC_FLAG_4MV;
3338
      else
3339
      else
3339
        context->flags &= ~CODEC_FLAG_4MV;
3340
        context->flags &= ~AV_CODEC_FLAG_4MV;
3340
      if ((!gst_structure_get_boolean (str, "annex-i", &val) || val) &&
3341
      if ((!gst_structure_get_boolean (str, "annex-i", &val) || val) &&
3341
          (!gst_structure_get_boolean (str, "annex-t", &val) || val))
3342
          (!gst_structure_get_boolean (str, "annex-t", &val) || val))
3342
        context->flags |= CODEC_FLAG_AC_PRED;
3343
        context->flags |= AV_CODEC_FLAG_AC_PRED;
3343
      else
3344
      else
3344
        context->flags &= ~CODEC_FLAG_AC_PRED;
3345
        context->flags &= ~AV_CODEC_FLAG_AC_PRED;
3345
      if (!gst_structure_get_boolean (str, "annex-j", &val) || val)
3346
      if (!gst_structure_get_boolean (str, "annex-j", &val) || val)
3346
        context->flags |= CODEC_FLAG_LOOP_FILTER;
3347
        context->flags |= AV_CODEC_FLAG_LOOP_FILTER;
3347
      else
3348
      else
3348
        context->flags &= ~CODEC_FLAG_LOOP_FILTER;
3349
        context->flags &= ~AV_CODEC_FLAG_LOOP_FILTER;
3349
      break;
3350
      break;
3350
    }
3351
    }
3351
    case AV_CODEC_ID_ADPCM_G726:
3352
    case AV_CODEC_ID_ADPCM_G726:
(-)a/ext/libav/gstavcodecmap.h (-1 / +1 lines)
Lines 155-161 gst_ffmpeg_formatid_to_caps (const gchar *format_name); Link Here
155
155
156
/*
156
/*
157
 * _formatid_get_codecids () can be used to get the codecIDs
157
 * _formatid_get_codecids () can be used to get the codecIDs
158
 * (CODEC_ID_NONE-terminated list) that fit that specific
158
 * (AV_CODEC_ID_NONE-terminated list) that fit that specific
159
 * output format.
159
 * output format.
160
 */
160
 */
161
161
(-)a/ext/libav/gstavviddec.c (-18 / +15 lines)
Lines 237-243 gst_ffmpegviddec_class_init (GstFFMpegVidDecClass * klass) Link Here
237
          DEFAULT_OUTPUT_CORRUPT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
237
          DEFAULT_OUTPUT_CORRUPT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
238
238
239
  caps = klass->in_plugin->capabilities;
239
  caps = klass->in_plugin->capabilities;
240
  if (caps & (CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS)) {
240
  if (caps & (AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS)) {
241
    g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_THREADS,
241
    g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_THREADS,
242
        g_param_spec_int ("max-threads", "Maximum decode threads",
242
        g_param_spec_int ("max-threads", "Maximum decode threads",
243
            "Maximum number of worker threads to spawn. (0 = auto)",
243
            "Maximum number of worker threads to spawn. (0 = auto)",
Lines 365-371 gst_ffmpegviddec_open (GstFFMpegVidDec * ffmpegdec) Link Here
365
      oclass->in_plugin->name, oclass->in_plugin->id);
365
      oclass->in_plugin->name, oclass->in_plugin->id);
366
366
367
  gst_ffmpegviddec_context_set_flags (ffmpegdec->context,
367
  gst_ffmpegviddec_context_set_flags (ffmpegdec->context,
368
      CODEC_FLAG_OUTPUT_CORRUPT, ffmpegdec->output_corrupt);
368
      AV_CODEC_FLAG_OUTPUT_CORRUPT, ffmpegdec->output_corrupt);
369
369
370
  return TRUE;
370
  return TRUE;
371
371
Lines 495-501 gst_ffmpegviddec_set_format (GstVideoDecoder * decoder, Link Here
495
    gboolean is_live;
495
    gboolean is_live;
496
496
497
    if (ffmpegdec->max_threads == 0) {
497
    if (ffmpegdec->max_threads == 0) {
498
      if (!(oclass->in_plugin->capabilities & CODEC_CAP_AUTO_THREADS))
498
      if (!(oclass->in_plugin->capabilities & AV_CODEC_CAP_AUTO_THREADS))
499
        ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads ();
499
        ffmpegdec->context->thread_count = gst_ffmpeg_auto_max_threads ();
500
      else
500
      else
501
        ffmpegdec->context->thread_count = 0;
501
        ffmpegdec->context->thread_count = 0;
Lines 624-633 gst_ffmpegvideodec_prepare_dr_pool (GstFFMpegVidDec * ffmpegdec, Link Here
624
  avcodec_align_dimensions2 (ffmpegdec->context, &width, &height,
624
  avcodec_align_dimensions2 (ffmpegdec->context, &width, &height,
625
      linesize_align);
625
      linesize_align);
626
626
627
  if (ffmpegdec->context->flags & CODEC_FLAG_EMU_EDGE)
627
  edge = 0;
628
    edge = 0;
629
  else
630
    edge = avcodec_get_edge_width ();
631
628
632
  /* increase the size for the padding */
629
  /* increase the size for the padding */
633
  width += edge << 1;
630
  width += edge << 1;
Lines 732-738 gst_ffmpegviddec_can_direct_render (GstFFMpegVidDec * ffmpegdec) Link Here
732
    return FALSE;
729
    return FALSE;
733
730
734
  oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
731
  oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
735
  return ((oclass->in_plugin->capabilities & CODEC_CAP_DR1) == CODEC_CAP_DR1);
732
  return ((oclass->in_plugin->capabilities & AV_CODEC_CAP_DR1) == AV_CODEC_CAP_DR1);
736
}
733
}
737
734
738
/* called when ffmpeg wants us to allocate a buffer to write the decoded frame
735
/* called when ffmpeg wants us to allocate a buffer to write the decoded frame
Lines 1769-1775 gst_ffmpegviddec_drain (GstVideoDecoder * decoder) Link Here
1769
1766
1770
  oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
1767
  oclass = (GstFFMpegVidDecClass *) (G_OBJECT_GET_CLASS (ffmpegdec));
1771
1768
1772
  if (oclass->in_plugin->capabilities & CODEC_CAP_DELAY) {
1769
  if (oclass->in_plugin->capabilities & AV_CODEC_CAP_DELAY) {
1773
    gint have_data, len;
1770
    gint have_data, len;
1774
    GstFlowReturn ret;
1771
    GstFlowReturn ret;
1775
1772
Lines 1815-1824 gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder, Link Here
1815
  bsize = minfo.size;
1812
  bsize = minfo.size;
1816
1813
1817
  if (bsize > 0 && (!GST_MEMORY_IS_ZERO_PADDED (minfo.memory)
1814
  if (bsize > 0 && (!GST_MEMORY_IS_ZERO_PADDED (minfo.memory)
1818
          || (minfo.maxsize - minfo.size) < FF_INPUT_BUFFER_PADDING_SIZE)) {
1815
          || (minfo.maxsize - minfo.size) < AV_INPUT_BUFFER_PADDING_SIZE)) {
1819
    /* add padding */
1816
    /* add padding */
1820
    if (ffmpegdec->padded_size < bsize + FF_INPUT_BUFFER_PADDING_SIZE) {
1817
    if (ffmpegdec->padded_size < bsize + AV_INPUT_BUFFER_PADDING_SIZE) {
1821
      ffmpegdec->padded_size = bsize + FF_INPUT_BUFFER_PADDING_SIZE;
1818
      ffmpegdec->padded_size = bsize + AV_INPUT_BUFFER_PADDING_SIZE;
1822
      ffmpegdec->padded = g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
1819
      ffmpegdec->padded = g_realloc (ffmpegdec->padded, ffmpegdec->padded_size);
1823
      GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
1820
      GST_LOG_OBJECT (ffmpegdec, "resized padding buffer to %d",
1824
          ffmpegdec->padded_size);
1821
          ffmpegdec->padded_size);
Lines 1826-1832 gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder, Link Here
1826
    GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
1823
    GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
1827
        "Copy input to add padding");
1824
        "Copy input to add padding");
1828
    memcpy (ffmpegdec->padded, bdata, bsize);
1825
    memcpy (ffmpegdec->padded, bdata, bsize);
1829
    memset (ffmpegdec->padded + bsize, 0, FF_INPUT_BUFFER_PADDING_SIZE);
1826
    memset (ffmpegdec->padded + bsize, 0, AV_INPUT_BUFFER_PADDING_SIZE);
1830
1827
1831
    bdata = ffmpegdec->padded;
1828
    bdata = ffmpegdec->padded;
1832
    do_padding = TRUE;
1829
    do_padding = TRUE;
Lines 1835-1841 gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder, Link Here
1835
  }
1832
  }
1836
1833
1837
  do {
1834
  do {
1838
    guint8 tmp_padding[FF_INPUT_BUFFER_PADDING_SIZE];
1835
    guint8 tmp_padding[AV_INPUT_BUFFER_PADDING_SIZE];
1839
1836
1840
    /* parse, if at all possible */
1837
    /* parse, if at all possible */
1841
    data = bdata;
1838
    data = bdata;
Lines 1845-1852 gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder, Link Here
1845
      /* add temporary padding */
1842
      /* add temporary padding */
1846
      GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
1843
      GST_CAT_TRACE_OBJECT (CAT_PERFORMANCE, ffmpegdec,
1847
          "Add temporary input padding");
1844
          "Add temporary input padding");
1848
      memcpy (tmp_padding, data + size, FF_INPUT_BUFFER_PADDING_SIZE);
1845
      memcpy (tmp_padding, data + size, AV_INPUT_BUFFER_PADDING_SIZE);
1849
      memset (data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
1846
      memset (data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
1850
    }
1847
    }
1851
1848
1852
    /* decode a frame of audio/video now */
1849
    /* decode a frame of audio/video now */
Lines 1862-1868 gst_ffmpegviddec_handle_frame (GstVideoDecoder * decoder, Link Here
1862
    }
1859
    }
1863
1860
1864
    if (do_padding) {
1861
    if (do_padding) {
1865
      memcpy (data + size, tmp_padding, FF_INPUT_BUFFER_PADDING_SIZE);
1862
      memcpy (data + size, tmp_padding, AV_INPUT_BUFFER_PADDING_SIZE);
1866
    }
1863
    }
1867
1864
1868
    if (len == 0 && have_data == 0) {
1865
    if (len == 0 && have_data == 0) {
Lines 2143-2149 gst_ffmpegviddec_propose_allocation (GstVideoDecoder * decoder, Link Here
2143
  gst_allocation_params_init (&params);
2140
  gst_allocation_params_init (&params);
2144
  params.flags = GST_MEMORY_FLAG_ZERO_PADDED;
2141
  params.flags = GST_MEMORY_FLAG_ZERO_PADDED;
2145
  params.align = DEFAULT_STRIDE_ALIGN;
2142
  params.align = DEFAULT_STRIDE_ALIGN;
2146
  params.padding = FF_INPUT_BUFFER_PADDING_SIZE;
2143
  params.padding = AV_INPUT_BUFFER_PADDING_SIZE;
2147
  /* we would like to have some padding so that we don't have to
2144
  /* we would like to have some padding so that we don't have to
2148
   * memcpy. We don't suggest an allocator. */
2145
   * memcpy. We don't suggest an allocator. */
2149
  gst_query_add_allocation_param (query, NULL, &params);
2146
  gst_query_add_allocation_param (query, NULL, &params);
(-)a/ext/libav/gstavvidenc.c (-18 / +22 lines)
Lines 68-85 enum Link Here
68
  PROP_CFG_BASE,
68
  PROP_CFG_BASE,
69
};
69
};
70
70
71
#if 0
71
#define GST_TYPE_ME_METHOD (gst_ffmpegvidenc_me_method_get_type())
72
#define GST_TYPE_ME_METHOD (gst_ffmpegvidenc_me_method_get_type())
72
static GType
73
static GType
73
gst_ffmpegvidenc_me_method_get_type (void)
74
gst_ffmpegvidenc_me_method_get_type (void)
74
{
75
{
75
  static GType ffmpegenc_me_method_type = 0;
76
  static GType ffmpegenc_me_method_type = 0;
76
  static GEnumValue ffmpegenc_me_methods[] = {
77
  static GEnumValue ffmpegenc_me_methods[] = {
77
    {ME_ZERO, "None (Very low quality)", "zero"},
78
    {FF_CMP_ZERO, "None (Very low quality)", "zero"},
78
    {ME_FULL, "Full (Slow, unmaintained)", "full"},
79
    {FF_CMP_FULL, "Full (Slow, unmaintained)", "full"},
79
    {ME_LOG, "Logarithmic (Low quality, unmaintained)", "logarithmic"},
80
    {FF_CMP_LOG, "Logarithmic (Low quality, unmaintained)", "logarithmic"},
80
    {ME_PHODS, "phods (Low quality, unmaintained)", "phods"},
81
    {FF_CMP_PHODS, "phods (Low quality, unmaintained)", "phods"},
81
    {ME_EPZS, "EPZS (Best quality, Fast)", "epzs"},
82
    {FF_CMP_EPZS, "EPZS (Best quality, Fast)", "epzs"},
82
    {ME_X1, "X1 (Experimental)", "x1"},
83
    {FF_CMP_X1, "X1 (Experimental)", "x1"},
83
    {0, NULL, NULL},
84
    {0, NULL, NULL},
84
  };
85
  };
85
  if (!ffmpegenc_me_method_type) {
86
  if (!ffmpegenc_me_method_type) {
Lines 88-93 gst_ffmpegvidenc_me_method_get_type (void) Link Here
88
  }
89
  }
89
  return ffmpegenc_me_method_type;
90
  return ffmpegenc_me_method_type;
90
}
91
}
92
#endif
91
93
92
/* A number of function prototypes are given so we can refer to them later. */
94
/* A number of function prototypes are given so we can refer to them later. */
93
static void gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass);
95
static void gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass);
Lines 201-210 gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass) Link Here
201
      g_param_spec_int ("gop-size", "GOP Size",
203
      g_param_spec_int ("gop-size", "GOP Size",
202
          "Number of frames within one GOP", 0, G_MAXINT,
204
          "Number of frames within one GOP", 0, G_MAXINT,
203
          DEFAULT_VIDEO_GOP_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
205
          DEFAULT_VIDEO_GOP_SIZE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
206
#if 0
204
  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ME_METHOD,
207
  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_ME_METHOD,
205
      g_param_spec_enum ("me-method", "ME Method", "Motion Estimation Method",
208
      g_param_spec_enum ("me-method", "ME Method", "Motion Estimation Method",
206
          GST_TYPE_ME_METHOD, ME_EPZS,
209
          GST_TYPE_ME_METHOD, FF_CMP_EPZS,
207
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
210
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
211
#endif
208
212
209
  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFSIZE,
213
  g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFSIZE,
210
      g_param_spec_int ("buffer-size", "Buffer Size",
214
      g_param_spec_int ("buffer-size", "Buffer Size",
Lines 216-222 gst_ffmpegvidenc_class_init (GstFFMpegVidEncClass * klass) Link Here
216
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
220
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
217
221
218
  caps = klass->in_plugin->capabilities;
222
  caps = klass->in_plugin->capabilities;
219
  if (caps & (CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS)) {
223
  if (caps & (AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS)) {
220
    g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_THREADS,
224
    g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_THREADS,
221
        g_param_spec_int ("max-threads", "Maximum encode threads",
225
        g_param_spec_int ("max-threads", "Maximum encode threads",
222
            "Maximum number of worker threads to spawn. (0 = auto)",
226
            "Maximum number of worker threads to spawn. (0 = auto)",
Lines 259-265 gst_ffmpegvidenc_init (GstFFMpegVidEnc * ffmpegenc) Link Here
259
  ffmpegenc->file = NULL;
263
  ffmpegenc->file = NULL;
260
264
261
  ffmpegenc->bitrate = DEFAULT_VIDEO_BITRATE;
265
  ffmpegenc->bitrate = DEFAULT_VIDEO_BITRATE;
262
  ffmpegenc->me_method = ME_EPZS;
266
  //ffmpegenc->me_method = FF_CMP_EPZS;
263
  ffmpegenc->buffer_size = 512 * 1024;
267
  ffmpegenc->buffer_size = 512 * 1024;
264
  ffmpegenc->gop_size = DEFAULT_VIDEO_GOP_SIZE;
268
  ffmpegenc->gop_size = DEFAULT_VIDEO_GOP_SIZE;
265
  ffmpegenc->rtp_payload_size = 0;
269
  ffmpegenc->rtp_payload_size = 0;
Lines 321-332 gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder, Link Here
321
  ffmpegenc->context->bit_rate = ffmpegenc->bitrate;
325
  ffmpegenc->context->bit_rate = ffmpegenc->bitrate;
322
  ffmpegenc->context->bit_rate_tolerance = ffmpegenc->bitrate;
326
  ffmpegenc->context->bit_rate_tolerance = ffmpegenc->bitrate;
323
  ffmpegenc->context->gop_size = ffmpegenc->gop_size;
327
  ffmpegenc->context->gop_size = ffmpegenc->gop_size;
324
  ffmpegenc->context->me_method = ffmpegenc->me_method;
328
  //ffmpegenc->context->me_method = ffmpegenc->me_method;
325
  GST_DEBUG_OBJECT (ffmpegenc, "Setting avcontext to bitrate %d, gop_size %d",
329
  GST_DEBUG_OBJECT (ffmpegenc, "Setting avcontext to bitrate %d, gop_size %d",
326
      ffmpegenc->bitrate, ffmpegenc->gop_size);
330
      ffmpegenc->bitrate, ffmpegenc->gop_size);
327
331
328
  if (ffmpegenc->max_threads == 0) {
332
  if (ffmpegenc->max_threads == 0) {
329
    if (!(oclass->in_plugin->capabilities & CODEC_CAP_AUTO_THREADS))
333
    if (!(oclass->in_plugin->capabilities & AV_CODEC_CAP_AUTO_THREADS))
330
      ffmpegenc->context->thread_count = gst_ffmpeg_auto_max_threads ();
334
      ffmpegenc->context->thread_count = gst_ffmpeg_auto_max_threads ();
331
    else
335
    else
332
      ffmpegenc->context->thread_count = 0;
336
      ffmpegenc->context->thread_count = 0;
Lines 343-358 gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder, Link Here
343
  gst_ffmpeg_cfg_fill_context (ffmpegenc, ffmpegenc->context);
347
  gst_ffmpeg_cfg_fill_context (ffmpegenc, ffmpegenc->context);
344
348
345
  /* then handle some special cases */
349
  /* then handle some special cases */
346
  ffmpegenc->context->lmin = (ffmpegenc->lmin * FF_QP2LAMBDA + 0.5);
350
  ffmpegenc->context->qmin = (ffmpegenc->lmin * FF_QP2LAMBDA + 0.5);
347
  ffmpegenc->context->lmax = (ffmpegenc->lmax * FF_QP2LAMBDA + 0.5);
351
  ffmpegenc->context->qmax = (ffmpegenc->lmax * FF_QP2LAMBDA + 0.5);
348
352
349
  if (ffmpegenc->interlaced) {
353
  if (ffmpegenc->interlaced) {
350
    ffmpegenc->context->flags |=
354
    ffmpegenc->context->flags |=
351
        CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME;
355
        AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME;
352
  }
356
  }
353
357
354
  /* some other defaults */
358
  /* some other defaults */
355
  ffmpegenc->context->rc_strategy = 2;
359
  //ffmpegenc->context->rc_strategy = 2;
356
  ffmpegenc->context->b_frame_strategy = 0;
360
  ffmpegenc->context->b_frame_strategy = 0;
357
  ffmpegenc->context->coder_type = 0;
361
  ffmpegenc->context->coder_type = 0;
358
  ffmpegenc->context->context_model = 0;
362
  ffmpegenc->context->context_model = 0;
Lines 362-379 gst_ffmpegvidenc_set_format (GstVideoEncoder * encoder, Link Here
362
  ffmpegenc->context->flags |= ffmpegenc->pass;
366
  ffmpegenc->context->flags |= ffmpegenc->pass;
363
  switch (ffmpegenc->pass) {
367
  switch (ffmpegenc->pass) {
364
      /* some additional action depends on type of pass */
368
      /* some additional action depends on type of pass */
365
    case CODEC_FLAG_QSCALE:
369
    case AV_CODEC_FLAG_QSCALE:
366
      ffmpegenc->context->global_quality
370
      ffmpegenc->context->global_quality
367
          = ffmpegenc->picture->quality = FF_QP2LAMBDA * ffmpegenc->quantizer;
371
          = ffmpegenc->picture->quality = FF_QP2LAMBDA * ffmpegenc->quantizer;
368
      break;
372
      break;
369
    case CODEC_FLAG_PASS1:     /* need to prepare a stats file */
373
    case AV_CODEC_FLAG_PASS1:     /* need to prepare a stats file */
370
      /* we don't close when changing caps, fingers crossed */
374
      /* we don't close when changing caps, fingers crossed */
371
      if (!ffmpegenc->file)
375
      if (!ffmpegenc->file)
372
        ffmpegenc->file = g_fopen (ffmpegenc->filename, "w");
376
        ffmpegenc->file = g_fopen (ffmpegenc->filename, "w");
373
      if (!ffmpegenc->file)
377
      if (!ffmpegenc->file)
374
        goto open_file_err;
378
        goto open_file_err;
375
      break;
379
      break;
376
    case CODEC_FLAG_PASS2:
380
    case AV_CODEC_FLAG_PASS2:
377
    {                           /* need to read the whole stats file ! */
381
    {                           /* need to read the whole stats file ! */
378
      gsize size;
382
      gsize size;
379
383

Return to bug 654628