mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
Merge branch 'master' into 0.11
Conflicts: configure.ac ext/ffmpeg/gstffmpegcodecmap.c ext/ffmpeg/gstffmpegdec.c ext/ffmpeg/gstffmpegdeinterlace.c ext/ffmpeg/gstffmpegmux.c ext/libswscale/gstffmpegscale.c
This commit is contained in:
commit
bde3117e72
6 changed files with 67 additions and 56 deletions
|
@ -107,10 +107,8 @@ gst_ffmpegaudioresample_base_init (gpointer g_class)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||||
gst_static_pad_template_get (&src_factory));
|
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&sink_factory));
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
gst_element_class_set_details_simple (element_class,
|
||||||
"FFMPEG Audio resampling element", "Filter/Converter/Audio",
|
"FFMPEG Audio resampling element", "Filter/Converter/Audio",
|
||||||
"Converts audio from one samplerate to another",
|
"Converts audio from one samplerate to another",
|
||||||
|
|
|
@ -475,27 +475,44 @@ gst_ffmpegdec_finalize (GObject * object)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_ffmpegdec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
gst_ffmpegdec_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
{
|
{
|
||||||
gboolean res;
|
GstFFMpegDec *ffmpegdec;
|
||||||
|
gboolean res = FALSE;
|
||||||
|
|
||||||
/* just forward to peer */
|
ffmpegdec = (GstFFMpegDec *) parent;
|
||||||
res = gst_pad_query_default (pad, parent, query);
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
GstFormat bfmt;
|
|
||||||
|
|
||||||
bfmt = GST_FORMAT_BYTES;
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
|
case GST_QUERY_LATENCY:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (ffmpegdec, "latency query %d",
|
||||||
|
ffmpegdec->context->has_b_frames);
|
||||||
|
if ((res = gst_pad_peer_query (ffmpegdec->sinkpad, query))) {
|
||||||
|
if (ffmpegdec->context->has_b_frames) {
|
||||||
|
gboolean live;
|
||||||
|
GstClockTime min_lat, max_lat, our_lat;
|
||||||
|
|
||||||
/* ok, do bitrate calc... */
|
gst_query_parse_latency (query, &live, &min_lat, &max_lat);
|
||||||
if ((type != GST_QUERY_POSITION && type != GST_QUERY_TOTAL) ||
|
if (ffmpegdec->format.video.fps_n > 0)
|
||||||
*fmt != GST_FORMAT_TIME || ffmpegdec->context->bit_rate == 0 ||
|
our_lat =
|
||||||
!gst_pad_query (peer, type, &bfmt, value))
|
gst_util_uint64_scale_int (ffmpegdec->context->has_b_frames *
|
||||||
return FALSE;
|
GST_SECOND, ffmpegdec->format.video.fps_d,
|
||||||
|
ffmpegdec->format.video.fps_n);
|
||||||
if (ffmpegdec->pcache && type == GST_QUERY_POSITION)
|
else
|
||||||
*value -= GST_BUFFER_SIZE (ffmpegdec->pcache);
|
our_lat =
|
||||||
*value *= GST_SECOND / ffmpegdec->context->bit_rate;
|
gst_util_uint64_scale_int (ffmpegdec->context->has_b_frames *
|
||||||
|
GST_SECOND, 1, 25);
|
||||||
|
if (min_lat != -1)
|
||||||
|
min_lat += our_lat;
|
||||||
|
if (max_lat != -1)
|
||||||
|
max_lat += our_lat;
|
||||||
|
gst_query_set_latency (query, live, min_lat, max_lat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
res = gst_pad_query_default (pad, query);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -1634,6 +1651,9 @@ check_keyframe (GstFFMpegDec * ffmpegdec)
|
||||||
if (!ffmpegdec->has_b_frames && ffmpegdec->picture->pict_type == FF_B_TYPE) {
|
if (!ffmpegdec->has_b_frames && ffmpegdec->picture->pict_type == FF_B_TYPE) {
|
||||||
GST_DEBUG_OBJECT (ffmpegdec, "we have B frames");
|
GST_DEBUG_OBJECT (ffmpegdec, "we have B frames");
|
||||||
ffmpegdec->has_b_frames = TRUE;
|
ffmpegdec->has_b_frames = TRUE;
|
||||||
|
/* Emit latency message to recalculate it */
|
||||||
|
gst_element_post_message (GST_ELEMENT_CAST (ffmpegdec),
|
||||||
|
gst_message_new_latency (GST_OBJECT_CAST (ffmpegdec)));
|
||||||
}
|
}
|
||||||
|
|
||||||
is_itype = (ffmpegdec->picture->pict_type == FF_I_TYPE);
|
is_itype = (ffmpegdec->picture->pict_type == FF_I_TYPE);
|
||||||
|
@ -3173,14 +3193,6 @@ gst_ffmpegdec_register (GstPlugin * plugin)
|
||||||
case CODEC_ID_MP3:
|
case CODEC_ID_MP3:
|
||||||
rank = GST_RANK_NONE;
|
rank = GST_RANK_NONE;
|
||||||
break;
|
break;
|
||||||
/* TEMPORARILY DISABLING AC3/EAC3/DTS for 0.10.12 release
|
|
||||||
* due to downmixing failure.
|
|
||||||
* See Bug #608892 for more details */
|
|
||||||
case CODEC_ID_EAC3:
|
|
||||||
case CODEC_ID_AC3:
|
|
||||||
case CODEC_ID_DTS:
|
|
||||||
rank = GST_RANK_NONE;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
rank = GST_RANK_MARGINAL;
|
rank = GST_RANK_MARGINAL;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
#include <gst/base/gstcollectpads.h>
|
#include <gst/base/gstcollectpads2.h>
|
||||||
|
|
||||||
#include "gstffmpeg.h"
|
#include "gstffmpeg.h"
|
||||||
#include "gstffmpegcodecmap.h"
|
#include "gstffmpegcodecmap.h"
|
||||||
|
@ -40,7 +40,7 @@ typedef struct _GstFFMpegMuxPad GstFFMpegMuxPad;
|
||||||
|
|
||||||
struct _GstFFMpegMuxPad
|
struct _GstFFMpegMuxPad
|
||||||
{
|
{
|
||||||
GstCollectData collect; /* we extend the CollectData */
|
GstCollectData2 collect; /* we extend the CollectData2 */
|
||||||
|
|
||||||
gint padnum;
|
gint padnum;
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,7 @@ struct _GstFFMpegMux
|
||||||
{
|
{
|
||||||
GstElement element;
|
GstElement element;
|
||||||
|
|
||||||
GstCollectPads *collect;
|
GstCollectPads2 *collect;
|
||||||
/* We need to keep track of our pads, so we do so here. */
|
/* We need to keep track of our pads, so we do so here. */
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ static void gst_ffmpegmux_finalize (GObject * object);
|
||||||
static gboolean gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps);
|
static gboolean gst_ffmpegmux_setcaps (GstPad * pad, GstCaps * caps);
|
||||||
static GstPad *gst_ffmpegmux_request_new_pad (GstElement * element,
|
static GstPad *gst_ffmpegmux_request_new_pad (GstElement * element,
|
||||||
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
GstPadTemplate * templ, const gchar * name, const GstCaps * caps);
|
||||||
static GstFlowReturn gst_ffmpegmux_collected (GstCollectPads * pads,
|
static GstFlowReturn gst_ffmpegmux_collected (GstCollectPads2 * pads,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
static gboolean gst_ffmpegmux_sink_event (GstPad * pad, GstObject * parent,
|
static gboolean gst_ffmpegmux_sink_event (GstPad * pad, GstObject * parent,
|
||||||
|
@ -272,17 +272,20 @@ gst_ffmpegmux_base_init (gpointer g_class)
|
||||||
/* pad templates */
|
/* pad templates */
|
||||||
srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
|
srctempl = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, srccaps);
|
||||||
gst_element_class_add_pad_template (element_class, srctempl);
|
gst_element_class_add_pad_template (element_class, srctempl);
|
||||||
|
gst_object_unref (srctempl);
|
||||||
|
|
||||||
if (audiosinkcaps) {
|
if (audiosinkcaps) {
|
||||||
audiosinktempl = gst_pad_template_new ("audio_%u",
|
audiosinktempl = gst_pad_template_new ("audio_%u",
|
||||||
GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
|
GST_PAD_SINK, GST_PAD_REQUEST, audiosinkcaps);
|
||||||
gst_element_class_add_pad_template (element_class, audiosinktempl);
|
gst_element_class_add_pad_template (element_class, audiosinktempl);
|
||||||
|
gst_object_unref (audiosinktempl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videosinkcaps) {
|
if (videosinkcaps) {
|
||||||
videosinktempl = gst_pad_template_new ("video_%u",
|
videosinktempl = gst_pad_template_new ("video_%u",
|
||||||
GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
|
GST_PAD_SINK, GST_PAD_REQUEST, videosinkcaps);
|
||||||
gst_element_class_add_pad_template (element_class, videosinktempl);
|
gst_element_class_add_pad_template (element_class, videosinktempl);
|
||||||
|
gst_object_unref (videosinktempl);
|
||||||
}
|
}
|
||||||
|
|
||||||
beach:
|
beach:
|
||||||
|
@ -329,9 +332,9 @@ gst_ffmpegmux_init (GstFFMpegMux * ffmpegmux, GstFFMpegMuxClass * g_class)
|
||||||
gst_pad_set_caps (ffmpegmux->srcpad, gst_pad_template_get_caps (templ));
|
gst_pad_set_caps (ffmpegmux->srcpad, gst_pad_template_get_caps (templ));
|
||||||
gst_element_add_pad (GST_ELEMENT (ffmpegmux), ffmpegmux->srcpad);
|
gst_element_add_pad (GST_ELEMENT (ffmpegmux), ffmpegmux->srcpad);
|
||||||
|
|
||||||
ffmpegmux->collect = gst_collect_pads_new ();
|
ffmpegmux->collect = gst_collect_pads2_new ();
|
||||||
gst_collect_pads_set_function (ffmpegmux->collect,
|
gst_collect_pads2_set_function (ffmpegmux->collect,
|
||||||
(GstCollectPadsFunction) gst_ffmpegmux_collected, ffmpegmux);
|
(GstCollectPads2Function) gst_ffmpegmux_collected, ffmpegmux);
|
||||||
|
|
||||||
ffmpegmux->context = g_new0 (AVFormatContext, 1);
|
ffmpegmux->context = g_new0 (AVFormatContext, 1);
|
||||||
ffmpegmux->context->oformat = oclass->in_plugin;
|
ffmpegmux->context->oformat = oclass->in_plugin;
|
||||||
|
@ -437,8 +440,8 @@ gst_ffmpegmux_request_new_pad (GstElement * element,
|
||||||
/* create pad */
|
/* create pad */
|
||||||
pad = gst_pad_new_from_template (templ, padname);
|
pad = gst_pad_new_from_template (templ, padname);
|
||||||
collect_pad = (GstFFMpegMuxPad *)
|
collect_pad = (GstFFMpegMuxPad *)
|
||||||
gst_collect_pads_add_pad (ffmpegmux->collect, pad,
|
gst_collect_pads2_add_pad (ffmpegmux->collect, pad,
|
||||||
sizeof (GstFFMpegMuxPad), NULL);
|
sizeof (GstFFMpegMuxPad));
|
||||||
collect_pad->padnum = ffmpegmux->context->nb_streams;
|
collect_pad->padnum = ffmpegmux->context->nb_streams;
|
||||||
|
|
||||||
/* small hack to put our own event pad function and chain up to collect pad */
|
/* small hack to put our own event pad function and chain up to collect pad */
|
||||||
|
@ -543,7 +546,7 @@ beach:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
|
gst_ffmpegmux_collected (GstCollectPads2 * pads, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) user_data;
|
GstFFMpegMux *ffmpegmux = (GstFFMpegMux *) user_data;
|
||||||
GSList *collected;
|
GSList *collected;
|
||||||
|
@ -592,8 +595,8 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
|
|
||||||
/* FIXME : This doesn't work for RAW AUDIO...
|
/* FIXME : This doesn't work for RAW AUDIO...
|
||||||
* in fact I'm wondering if it even works for any kind of audio... */
|
* in fact I'm wondering if it even works for any kind of audio... */
|
||||||
buffer = gst_collect_pads_peek (ffmpegmux->collect,
|
buffer = gst_collect_pads2_peek (ffmpegmux->collect,
|
||||||
(GstCollectData *) collect_pad);
|
(GstCollectData2 *) collect_pad);
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
st->codec->frame_size =
|
st->codec->frame_size =
|
||||||
st->codec->sample_rate *
|
st->codec->sample_rate *
|
||||||
|
@ -686,8 +689,8 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
for (collected = ffmpegmux->collect->data; collected;
|
for (collected = ffmpegmux->collect->data; collected;
|
||||||
collected = g_slist_next (collected)) {
|
collected = g_slist_next (collected)) {
|
||||||
GstFFMpegMuxPad *collect_pad = (GstFFMpegMuxPad *) collected->data;
|
GstFFMpegMuxPad *collect_pad = (GstFFMpegMuxPad *) collected->data;
|
||||||
GstBuffer *buffer = gst_collect_pads_peek (ffmpegmux->collect,
|
GstBuffer *buffer = gst_collect_pads2_peek (ffmpegmux->collect,
|
||||||
(GstCollectData *) collect_pad);
|
(GstCollectData2 *) collect_pad);
|
||||||
|
|
||||||
/* if there's no buffer, just continue */
|
/* if there's no buffer, just continue */
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
|
@ -724,8 +727,8 @@ gst_ffmpegmux_collected (GstCollectPads * pads, gpointer user_data)
|
||||||
gsize size;
|
gsize size;
|
||||||
|
|
||||||
/* push out current buffer */
|
/* push out current buffer */
|
||||||
buf = gst_collect_pads_pop (ffmpegmux->collect,
|
buf = gst_collect_pads2_pop (ffmpegmux->collect,
|
||||||
(GstCollectData *) best_pad);
|
(GstCollectData2 *) best_pad);
|
||||||
|
|
||||||
ffmpegmux->context->streams[best_pad->padnum]->codec->frame_number++;
|
ffmpegmux->context->streams[best_pad->padnum]->codec->frame_number++;
|
||||||
|
|
||||||
|
@ -802,12 +805,12 @@ gst_ffmpegmux_change_state (GstElement * element, GstStateChange transition)
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
gst_collect_pads_start (ffmpegmux->collect);
|
gst_collect_pads2_start (ffmpegmux->collect);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
gst_collect_pads_stop (ffmpegmux->collect);
|
gst_collect_pads2_stop (ffmpegmux->collect);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -103,10 +103,8 @@ gst_ffmpegscale_base_init (gpointer g_class)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_static_pad_template (element_class, &src_factory);
|
||||||
gst_static_pad_template_get (&src_factory));
|
gst_element_class_add_static_pad_template (element_class, &sink_factory);
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&sink_factory));
|
|
||||||
gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
|
gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
|
||||||
"Filter/Converter/Video/Scaler",
|
"Filter/Converter/Video/Scaler",
|
||||||
"Converts video from one resolution to another",
|
"Converts video from one resolution to another",
|
||||||
|
|
|
@ -371,10 +371,10 @@ gst_post_proc_base_init (GstPostProcClass * klass)
|
||||||
g_free (longname);
|
g_free (longname);
|
||||||
g_free (description);
|
g_free (description);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_static_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&gst_post_proc_src_template));
|
&gst_post_proc_src_template);
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_static_pad_template (element_class,
|
||||||
gst_static_pad_template_get (&gst_post_proc_sink_template));
|
&gst_post_proc_sink_template);
|
||||||
|
|
||||||
klass->filterid = ppidx;
|
klass->filterid = ppidx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 85afbb1d00d58812df5d634e946b2fcf653bcd8e
|
Subproject commit 0b8b3387a977dcdb6fb9e53bcc9966d34b2e4cec
|
Loading…
Reference in a new issue