diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c index 1c084d649b..1e1e4fa100 100644 --- a/ext/libav/gstavauddec.c +++ b/ext/libav/gstavauddec.c @@ -132,7 +132,7 @@ static void gst_ffmpegauddec_init (GstFFMpegAudDec * ffmpegdec) { /* some ffmpeg data */ - ffmpegdec->context = avcodec_alloc_context (); + ffmpegdec->context = avcodec_alloc_context3 (NULL); ffmpegdec->opened = FALSE; gst_audio_decoder_set_drainable (GST_AUDIO_DECODER (ffmpegdec), TRUE); @@ -317,7 +317,7 @@ gst_ffmpegauddec_set_format (GstAudioDecoder * decoder, GstCaps * caps) /* workaround encoder bugs */ ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT; - ffmpegdec->context->error_recognition = 1; + ffmpegdec->context->err_recognition = 1; ffmpegdec->context->opaque = ffmpegdec; ffmpegdec->context->get_buffer = gst_ffmpegauddec_get_buffer; diff --git a/ext/libav/gstavaudenc.c b/ext/libav/gstavaudenc.c index ea7498cd9f..e7588b0a2c 100644 --- a/ext/libav/gstavaudenc.c +++ b/ext/libav/gstavaudenc.c @@ -391,7 +391,7 @@ gst_ffmpegaudenc_encode_audio (GstFFMpegAudEnc * ffmpegaudenc, if (*have_data) { GstBuffer *outbuf; - AVCodec *codec; + const AVCodec *codec; GST_LOG_OBJECT (ffmpegaudenc, "pushing size %d", pkt.size); @@ -589,7 +589,7 @@ gst_ffmpegaudenc_register (GstPlugin * plugin) } /* only encoders */ - if (!in_plugin->encode) { + if (!in_plugin->encode2) { goto next; } diff --git a/ext/libav/gstavcfg.c b/ext/libav/gstavcfg.c index 5a0b56f6d7..4ce9456f46 100644 --- a/ext/libav/gstavcfg.c +++ b/ext/libav/gstavcfg.c @@ -147,7 +147,6 @@ gst_ffmpeg_dct_algo_get_type (void) {FF_DCT_FASTINT, "Fast Integer", "fastint"}, {FF_DCT_INT, "Accurate Integer", "int"}, {FF_DCT_MMX, "MMX", "mmx"}, - {FF_DCT_MLIB, "MLIB", "mlib"}, {FF_DCT_ALTIVEC, "ALTIVEC", "altivec"}, {FF_DCT_FAAN, "FAAN", "faan"}, {0, NULL, NULL}, @@ -173,8 +172,6 @@ gst_ffmpeg_idct_algo_get_type (void) {FF_IDCT_SIMPLE, "Simple", "simple"}, {FF_IDCT_SIMPLEMMX, "Simple MMX", "simplemmx"}, {FF_IDCT_LIBMPEG2MMX, "LIBMPEG2MMX", "libmpeg2mmx"}, - {FF_IDCT_PS2, "PS2", "ps2"}, - {FF_IDCT_MLIB, "MLIB", "mlib"}, {FF_IDCT_ARM, "ARM", "arm"}, {FF_IDCT_ALTIVEC, "ALTIVEC", "altivec"}, {FF_IDCT_SH4, "SH4", "sh4"}, @@ -263,16 +260,11 @@ gst_ffmpeg_flags_get_type (void) if (!ffmpeg_flags_type) { static const GFlagsValue ffmpeg_flags[] = { - {CODEC_FLAG_OBMC, "Use overlapped block motion compensation (h263+)", - "obmc"}, {CODEC_FLAG_QSCALE, "Use fixed qscale", "qscale"}, {CODEC_FLAG_4MV, "Allow 4 MV per MB", "4mv"}, - {CODEC_FLAG_H263P_AIV, "H.263 alternative inter VLC", "aiv"}, {CODEC_FLAG_QPEL, "Quartel Pel Motion Compensation", "qpel"}, {CODEC_FLAG_GMC, "GMC", "gmc"}, {CODEC_FLAG_MV0, "Always try a MB with MV (0,0)", "mv0"}, - {CODEC_FLAG_PART, - "Store MV, DC and AC coefficients in seperate partitions", "part"}, {CODEC_FLAG_LOOP_FILTER, "Loop filter", "loop-filter"}, {CODEC_FLAG_GRAY, "Only decode/encode grayscale", "gray"}, {CODEC_FLAG_NORMALIZE_AQP, @@ -282,13 +274,9 @@ gst_ffmpeg_flags_get_type (void) "global-headers"}, {CODEC_FLAG_AC_PRED, "H263 Advanced Intra Coding / MPEG4 AC prediction", "aic"}, - {CODEC_FLAG_H263P_UMV, "Unlimited Motion Vector", "umv"}, {CODEC_FLAG_CBP_RD, "Rate Distoration Optimization for CBP", "cbp-rd"}, {CODEC_FLAG_QP_RD, "Rate Distoration Optimization for QP selection", "qp-rd"}, - {CODEC_FLAG_H263P_SLICE_STRUCT, "H263 slice struct", "ss"}, - {CODEC_FLAG_SVCD_SCAN_OFFSET, - "Reserve space for SVCD scan offset user data", "scanoffset"}, {CODEC_FLAG_CLOSED_GOP, "Closed GOP", "closedgop"}, {0, NULL, NULL}, }; diff --git a/ext/libav/gstavdemux.c b/ext/libav/gstavdemux.c index c744e56ed1..a964964c6f 100644 --- a/ext/libav/gstavdemux.c +++ b/ext/libav/gstavdemux.c @@ -1138,8 +1138,8 @@ gst_ffmpegdemux_open (GstFFMpegDemux * demux) location = g_strdup_printf ("gstpipe://%p", &demux->ffpipe); GST_DEBUG_OBJECT (demux, "about to call av_open_input_file %s", location); - res = av_open_input_file (&demux->context, location, - oclass->in_plugin, 0, NULL); + res = avformat_open_input (&demux->context, location, + oclass->in_plugin, NULL); g_free (location); GST_DEBUG_OBJECT (demux, "av_open_input returned %d", res); diff --git a/ext/libav/gstavmux.c b/ext/libav/gstavmux.c index fad4a653e8..fb981fe7c2 100644 --- a/ext/libav/gstavmux.c +++ b/ext/libav/gstavmux.c @@ -57,7 +57,6 @@ struct _GstFFMpegMux /*< private > */ /* event_function is the collectpads default eventfunction */ GstPadEventFunction event_function; - int preload; int max_delay; }; @@ -295,8 +294,8 @@ gst_ffmpegmux_class_init (GstFFMpegMuxClass * klass) g_object_class_install_property (gobject_class, PROP_PRELOAD, g_param_spec_int ("preload", "preload", - "Set the initial demux-decode delay (in microseconds)", 0, G_MAXINT, - 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + "Set the initial demux-decode delay (in microseconds) (DEPRECATED)", + 0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_MAXDELAY, g_param_spec_int ("maxdelay", "maxdelay", @@ -333,7 +332,6 @@ gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux, GstFFMpegMuxClass * g_class) ffmpegmux->videopads = 0; ffmpegmux->audiopads = 0; - ffmpegmux->preload = 0; ffmpegmux->max_delay = 0; } @@ -347,7 +345,6 @@ gst_ffmpegmux_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_PRELOAD: - src->preload = g_value_get_int (value); break; case PROP_MAXDELAY: src->max_delay = g_value_get_int (value); @@ -368,7 +365,6 @@ gst_ffmpegmux_get_property (GObject * object, guint prop_id, GValue * value, switch (prop_id) { case PROP_PRELOAD: - g_value_set_int (value, src->preload); break; case PROP_MAXDELAY: g_value_set_int (value, src->max_delay); @@ -439,10 +435,10 @@ gst_ffmpegmux_request_new_pad (GstElement * element, gst_element_add_pad (element, pad); /* AVStream needs to be created */ - st = av_new_stream (ffmpegmux->context, collect_pad->padnum); + st = avformat_new_stream (ffmpegmux->context, NULL); + st->id = collect_pad->padnum; st->codec->codec_type = type; st->codec->codec_id = CODEC_ID_NONE; /* this is a check afterwards */ - st->stream_copy = 1; /* we're not the actual encoder */ st->codec->bit_rate = bitrate; st->codec->frame_size = framesize; /* we fill in codec during capsnego */ @@ -474,7 +470,6 @@ gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps) collect_pad = (GstFFMpegMuxPad *) gst_pad_get_element_private (pad); st = ffmpegmux->context->streams[collect_pad->padnum]; - ffmpegmux->context->preload = ffmpegmux->preload; ffmpegmux->context->max_delay = ffmpegmux->max_delay; /* for the format-specific guesses, we'll go to @@ -548,7 +543,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data) /* open "file" (gstreamer protocol to next element) */ if (!ffmpegmux->opened) { - int open_flags = URL_WRONLY; + int open_flags = AVIO_FLAG_WRITE; /* we do need all streams to have started capsnego, * or things will go horribly wrong */ @@ -642,19 +637,13 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data) open_flags |= GST_FFMPEG_URL_STREAMHEADER; } - if (url_fopen (&ffmpegmux->context->pb, + if (avio_open (&ffmpegmux->context->pb, ffmpegmux->context->filename, open_flags) < 0) { GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, TOO_LAZY, (NULL), ("Failed to open stream context in avmux")); return GST_FLOW_ERROR; } - if (av_set_parameters (ffmpegmux->context, NULL) < 0) { - GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, INIT, (NULL), - ("Failed to initialize muxer")); - return GST_FLOW_ERROR; - } - /* now open the mux format */ if (avformat_write_header (ffmpegmux->context, NULL) < 0) { GST_ELEMENT_ERROR (ffmpegmux, LIBRARY, SETTINGS, (NULL), @@ -666,7 +655,7 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data) ffmpegmux->opened = TRUE; /* flush the header so it will be used as streamheader */ - put_flush_packet (ffmpegmux->context->pb); + avio_flush (ffmpegmux->context->pb); } /* take the one with earliest timestamp, @@ -773,8 +762,8 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data) /* close down */ av_write_trailer (ffmpegmux->context); ffmpegmux->opened = FALSE; - put_flush_packet (ffmpegmux->context->pb); - url_fclose (ffmpegmux->context->pb); + avio_flush (ffmpegmux->context->pb); + avio_close (ffmpegmux->context->pb); gst_pad_push_event (ffmpegmux->srcpad, gst_event_new_eos ()); return GST_FLOW_EOS; } @@ -812,7 +801,7 @@ gst_ffmpegmux_change_state (GstElement * element, GstStateChange transition) gst_tag_setter_reset_tags (GST_TAG_SETTER (ffmpegmux)); if (ffmpegmux->opened) { ffmpegmux->opened = FALSE; - url_fclose (ffmpegmux->context->pb); + avio_close (ffmpegmux->context->pb); } break; case GST_STATE_CHANGE_READY_TO_NULL: diff --git a/ext/libav/gstavutils.c b/ext/libav/gstavutils.c index 7a8fd7467c..fc91812c5b 100644 --- a/ext/libav/gstavutils.c +++ b/ext/libav/gstavutils.c @@ -26,6 +26,8 @@ #include #endif +#include + G_CONST_RETURN gchar * gst_ffmpeg_get_codecid_longname (enum CodecID codec_id) { diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 0ddd6283e8..8e069f1b57 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -241,7 +241,7 @@ static void gst_ffmpegviddec_init (GstFFMpegVidDec * ffmpegdec) { /* some ffmpeg data */ - ffmpegdec->context = avcodec_alloc_context (); + ffmpegdec->context = avcodec_alloc_context3 (NULL); ffmpegdec->picture = avcodec_alloc_frame (); ffmpegdec->opened = FALSE; ffmpegdec->skip_frame = ffmpegdec->lowres = 0; @@ -394,7 +394,7 @@ gst_ffmpegviddec_set_format (GstVideoDecoder * decoder, /* workaround encoder bugs */ ffmpegdec->context->workaround_bugs |= FF_BUG_AUTODETECT; - ffmpegdec->context->error_recognition = 1; + ffmpegdec->context->err_recognition = 1; /* for slow cpus */ ffmpegdec->context->lowres = ffmpegdec->lowres; diff --git a/ext/libav/gstavvidenc.c b/ext/libav/gstavvidenc.c index 51f4ab91a9..8dd5a0db94 100644 --- a/ext/libav/gstavvidenc.c +++ b/ext/libav/gstavvidenc.c @@ -220,7 +220,7 @@ static void gst_ffmpegvidenc_init (GstFFMpegVidEnc * ffmpegenc) { /* ffmpeg objects */ - ffmpegenc->context = avcodec_alloc_context (); + ffmpegenc->context = avcodec_alloc_context3 (NULL); ffmpegenc->picture = avcodec_alloc_frame (); ffmpegenc->opened = FALSE; @@ -236,7 +236,7 @@ gst_ffmpegvidenc_init (GstFFMpegVidEnc * ffmpegenc) ffmpegenc->lmax = 31; ffmpegenc->max_key_interval = 0; - gst_ffmpeg_cfg_set_defaults3 (ffmpegenc, NULL); + gst_ffmpeg_cfg_set_defaults (ffmpegenc); } static void @@ -328,7 +328,7 @@ gst_ffmpegvidenc_getcaps (GstVideoEncoder * encoder, GstCaps * filter) /* need to start with a fresh codec_context each time around, since * codec_close may have released stuff causing the next pass to segfault */ - ctx = avcodec_alloc_context (); + ctx = avcodec_alloc_context3 (NULL); if (!ctx) { GST_DEBUG_OBJECT (ffmpegenc, "no context"); break; @@ -981,7 +981,7 @@ gst_ffmpegvidenc_register (GstPlugin * plugin) } /* only video encoders */ - if (!in_plugin->encode || in_plugin->type != AVMEDIA_TYPE_VIDEO) + if (!in_plugin->encode2 || in_plugin->type != AVMEDIA_TYPE_VIDEO) goto next; /* FIXME : We should have a method to know cheaply whether we have a mapping