mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
av: Port remaining simple bits
This commit is contained in:
parent
0f206124b6
commit
f5c112990f
8 changed files with 24 additions and 45 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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},
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include <libavutil/mem.h>
|
||||
|
||||
G_CONST_RETURN gchar *
|
||||
gst_ffmpeg_get_codecid_longname (enum CodecID codec_id)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue