diff options
Diffstat (limited to 'gst')
35 files changed, 310 insertions, 160 deletions
diff --git a/gst/aiff/aiffparse.c b/gst/aiff/aiffparse.c index 575b309b5..4fe5f64e4 100644 --- a/gst/aiff/aiffparse.c +++ b/gst/aiff/aiffparse.c @@ -52,6 +52,11 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <string.h> #include <math.h> diff --git a/gst/audiovisualizers/gstbaseaudiovisualizer.c b/gst/audiovisualizers/gstbaseaudiovisualizer.c index da0482ade..27c605f2f 100644 --- a/gst/audiovisualizers/gstbaseaudiovisualizer.c +++ b/gst/audiovisualizers/gstbaseaudiovisualizer.c @@ -32,6 +32,11 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <string.h> #include "gstbaseaudiovisualizer.h" diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c index 39cd2b91b..1a3e2a0f3 100644 --- a/gst/camerabin/gstcamerabin.c +++ b/gst/camerabin/gstcamerabin.c @@ -151,11 +151,16 @@ # include <config.h> #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <string.h> #include <stdlib.h> #include <gst/gst.h> #include <gst/tag/tag.h> +#include <gst/glib-compat-private.h> /* FIXME: include #include <gst/gst-i18n-plugin.h> and use _(" ") */ #include "gstcamerabin.h" @@ -210,9 +215,10 @@ static guint camerabin_signals[LAST_SIGNAL]; #define DEFAULT_FLAGS GST_CAMERABIN_FLAG_SOURCE_RESIZE | \ GST_CAMERABIN_FLAG_VIEWFINDER_SCALE | \ - GST_CAMERABIN_FLAG_AUDIO_CONVERSION | \ + GST_CAMERABIN_FLAG_VIEWFINDER_COLOR_CONVERSION | \ GST_CAMERABIN_FLAG_IMAGE_COLOR_CONVERSION | \ - GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION + GST_CAMERABIN_FLAG_VIDEO_COLOR_CONVERSION | \ + GST_CAMERABIN_FLAG_AUDIO_CONVERSION /* Using "bilinear" as default zoom method */ #define CAMERABIN_DEFAULT_ZOOM_METHOD 1 @@ -236,25 +242,37 @@ static guint camerabin_signals[LAST_SIGNAL]; GST_DEBUG_OBJECT ((c), "Processing counter incremented to: %d", \ (c)->processing_counter); \ if ((c)->processing_counter == 1) \ - g_object_notify (G_OBJECT (c), "idle"); \ + g_object_notify (G_OBJECT (c), "idle"); #define CAMERABIN_PROCESSING_DEC_UNLOCKED(c) \ (c)->processing_counter -= 1; \ GST_DEBUG_OBJECT ((c), "Processing counter decremented to: %d", \ (c)->processing_counter); \ g_assert ((c)->processing_counter >= 0); \ - if ((c)->processing_counter == 0) \ - g_object_notify (G_OBJECT (c), "idle"); \ + if ((c)->processing_counter == 0) { \ + g_cond_signal ((c)->idle_cond); \ + g_object_notify (G_OBJECT (c), "idle"); \ + } #define CAMERABIN_PROCESSING_INC(c) \ g_mutex_lock ((c)->capture_mutex); \ CAMERABIN_PROCESSING_INC_UNLOCKED ((c)); \ - g_mutex_unlock ((c)->capture_mutex); \ + g_mutex_unlock ((c)->capture_mutex); #define CAMERABIN_PROCESSING_DEC(c) \ g_mutex_lock ((c)->capture_mutex); \ CAMERABIN_PROCESSING_DEC_UNLOCKED ((c)); \ - g_mutex_unlock ((c)->capture_mutex); \ + g_mutex_unlock ((c)->capture_mutex); + +#define CAMERABIN_PROCESSING_WAIT_IDLE(c) \ + g_mutex_lock ((c)->capture_mutex); \ + if ((c)->processing_counter > 0) { \ + GST_DEBUG_OBJECT ((c), "Waiting for processing operations to finish %d", \ + (c)->processing_counter); \ + g_cond_wait ((c)->idle_cond, (c)->capture_mutex); \ + GST_DEBUG_OBJECT ((c), "Processing operations finished"); \ + } \ + g_mutex_unlock ((c)->capture_mutex); /* * static helper functions declaration @@ -933,6 +951,10 @@ camerabin_dispose_elements (GstCameraBin * camera) g_cond_free (camera->cond); camera->cond = NULL; } + if (camera->idle_cond) { + g_cond_free (camera->idle_cond); + camera->idle_cond = NULL; + } if (camera->filename) { g_string_free (camera->filename, TRUE); camera->filename = NULL; @@ -1607,6 +1629,9 @@ reset_video_capture_caps (GstCameraBin * camera) /* Interrupt ongoing capture */ gst_camerabin_do_stop (camera); + /* prevent image captures from being lost */ + CAMERABIN_PROCESSING_WAIT_IDLE (camera); + gst_element_get_state (GST_ELEMENT (camera), &state, &pending, 0); if (state == GST_STATE_PAUSED || state == GST_STATE_PLAYING) { GST_INFO_OBJECT (camera, @@ -3348,6 +3373,7 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass) /* concurrency control */ camera->capture_mutex = g_mutex_new (); camera->cond = g_cond_new (); + camera->idle_cond = g_cond_new (); camera->processing_counter = 0; /* pad names for output and input selectors */ @@ -3923,8 +3949,10 @@ gst_camerabin_change_state (GstElement * element, GstStateChange transition) } /* reset processing counter */ - GST_DEBUG_OBJECT (camera, "Reset processing counter to 0"); + GST_DEBUG_OBJECT (camera, "Reset processing counter from %d to 0", + camera->processing_counter); camera->processing_counter = 0; + g_cond_signal (camera->idle_cond); g_object_notify (G_OBJECT (camera), "idle"); g_mutex_unlock (camera->capture_mutex); diff --git a/gst/camerabin/gstcamerabin.h b/gst/camerabin/gstcamerabin.h index 066545c94..1c0a075f5 100644 --- a/gst/camerabin/gstcamerabin.h +++ b/gst/camerabin/gstcamerabin.h @@ -129,6 +129,7 @@ struct _GstCameraBin /* concurrency control */ GMutex *capture_mutex; GCond *cond; + GCond *idle_cond; gboolean capturing; gboolean eos_handled; /* everytime a new capture is started this is incremented, when it is diff --git a/gst/camerabin/gstinputselector.c b/gst/camerabin/gstinputselector.c index 750d6ce87..6af1918a5 100644 --- a/gst/camerabin/gstinputselector.c +++ b/gst/camerabin/gstinputselector.c @@ -35,6 +35,7 @@ #include <string.h> +#include <gst/glib-compat-private.h> #include "gstinputselector.h" #include "gstcamerabin-marshal.h" diff --git a/gst/camerabin2/gstcamerabin2.c b/gst/camerabin2/gstcamerabin2.c index 8bf1e2799..aeb38974b 100644 --- a/gst/camerabin2/gstcamerabin2.c +++ b/gst/camerabin2/gstcamerabin2.c @@ -165,6 +165,7 @@ #include "gstcamerabin2.h" #include <gst/gst-i18n-plugin.h> #include <gst/pbutils/pbutils.h> +#include <gst/glib-compat-private.h> #if GLIB_CHECK_VERSION(2,29,6) #define gst_camerabin2_atomic_int_add g_atomic_int_add @@ -817,15 +818,13 @@ gst_camera_bin_class_init (GstCameraBin2Class * klass) /* TODO * Review before stable - * - We use a profile for video recording properties and here we have - * elements for image capture. This is slightly inconsistent. * - One problem with using encodebin for images here is how jifmux * autoplugging works. We need to give it a higher rank and fix its * caps (it has image/jpeg on sink and src pads). Preliminary tests * show that jifmux is picked if image/jpeg is the caps of a container * profile. So this could work. * - There seems to be a problem with encodebin for images currently as - * it autoplugs a videorate that ony starts outputing buffers after + * it autoplugs a videorate that only starts outputing buffers after * getting the 2nd buffer. */ g_object_class_install_property (object_class, PROP_IMAGE_ENCODING_PROFILE, diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 9c9d1ba8c..3bc047108 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -31,6 +31,10 @@ # include <config.h> #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <gst/interfaces/photography.h> #include "gstwrappercamerabinsrc.h" diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c index efcda2117..dc9f949f8 100644 --- a/gst/cdxaparse/gstcdxaparse.c +++ b/gst/cdxaparse/gstcdxaparse.c @@ -22,6 +22,11 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <string.h> #include "gstcdxaparse.h" diff --git a/gst/coloreffects/gstchromahold.c b/gst/coloreffects/gstchromahold.c index 1c5524af4..4f6a7d434 100644 --- a/gst/coloreffects/gstchromahold.c +++ b/gst/coloreffects/gstchromahold.c @@ -40,6 +40,10 @@ #include "config.h" #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include "gstchromahold.h" #include <stdlib.h> diff --git a/gst/dvbsuboverlay/gstdvbsuboverlay.c b/gst/dvbsuboverlay/gstdvbsuboverlay.c index aa26cdaad..235f86a24 100644 --- a/gst/dvbsuboverlay/gstdvbsuboverlay.c +++ b/gst/dvbsuboverlay/gstdvbsuboverlay.c @@ -38,6 +38,7 @@ # include <config.h> #endif +#include <gst/glib-compat-private.h> #include "gstdvbsuboverlay.h" #include <string.h> diff --git a/gst/dvdspu/gstdvdspu.c b/gst/dvdspu/gstdvdspu.c index 488b46625..ea348fe22 100644 --- a/gst/dvdspu/gstdvdspu.c +++ b/gst/dvdspu/gstdvdspu.c @@ -32,6 +32,10 @@ # include <config.h> #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <gst/gst-i18n-plugin.h> #include <gst/video/video.h> diff --git a/gst/geometrictransform/gstrotate.c b/gst/geometrictransform/gstrotate.c index 6c5ba62cb..764feb56a 100644 --- a/gst/geometrictransform/gstrotate.c +++ b/gst/geometrictransform/gstrotate.c @@ -134,7 +134,7 @@ gst_rotate_base_init (gpointer gclass) gst_element_class_set_details_simple (element_class, "rotate", "Transform/Effect/Video", - "Warps the picture into an arc shaped form", + "Rotates the picture by an arbitrary angle", "Thiago Santos<thiago.sousa.santos@collabora.co.uk>"); } @@ -154,7 +154,7 @@ rotate_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x, h = gt->height; /* our parameters */ - ar = rotate->angle * G_PI / 180.0; /* angle of rotation, degrees to radians */ + ar = rotate->angle; /* angle of rotation */ /* get in and out centers */ cox = 0.5 * w; diff --git a/gst/hls/Makefile.am b/gst/hls/Makefile.am index 687b568e0..fec8eeb27 100644 --- a/gst/hls/Makefile.am +++ b/gst/hls/Makefile.am @@ -6,8 +6,8 @@ libgstfragmented_la_SOURCES = \ gsthlsdemux.c \ gstfragmentedplugin.c -libgstfragmented_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(SOUP_CFLAGS) -libgstfragmented_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(SOUP_LIBS) +libgstfragmented_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(SOUP_CFLAGS) +libgstfragmented_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(SOUP_LIBS) libgstfragmented_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -no-undefined libgstfragmented_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/gst/hls/gsthlsdemux.c b/gst/hls/gsthlsdemux.c index 7a7d5f669..f0f4b522d 100644 --- a/gst/hls/gsthlsdemux.c +++ b/gst/hls/gsthlsdemux.c @@ -41,9 +41,13 @@ # include "config.h" #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS #include <string.h> #include <gst/base/gsttypefindhelper.h> +#include <gst/glib-compat-private.h> #include "gsthlsdemux.h" static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src_%u", diff --git a/gst/hls/m3u8.c b/gst/hls/m3u8.c index 449b63ee9..c27f159b5 100644 --- a/gst/hls/m3u8.c +++ b/gst/hls/m3u8.c @@ -23,6 +23,7 @@ #include <errno.h> #include <glib.h> +#include <gst/glib-compat-private.h> #include "gstfragmented.h" #include "m3u8.h" diff --git a/gst/inter/Makefile.am b/gst/inter/Makefile.am index 7728de991..e40495987 100644 --- a/gst/inter/Makefile.am +++ b/gst/inter/Makefile.am @@ -22,14 +22,15 @@ noinst_HEADERS = \ gstintersurface.h libgstinter_la_CFLAGS = \ - $(GST_CFLAGS) \ + $(GST_PLUGINS_BAD_CFLAGS) \ $(GST_PLUGINS_BASE_CFLAGS) \ - $(GST_BASE_CFLAGS) + $(GST_BASE_CFLAGS) \ + $(GST_CFLAGS) libgstinter_la_LIBADD = \ - $(GST_LIBS) \ - $(GST_BASE_LIBS) \ $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ -lgstaudio-@GST_MAJORMINOR@ \ + $(GST_BASE_LIBS) \ + $(GST_LIBS) \ $(LIBM) libgstinter_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) @@ -39,12 +40,13 @@ gstintertest_SOURCES = \ gstintertest.c gstintertest_CFLAGS = \ - $(GST_CFLAGS) \ - $(GST_PLUGINS_BASE_CFLAGS) + $(GST_PLUGINS_BAD_CFLAGS) \ + $(GST_PLUGINS_BASE_CFLAGS) \ + $(GST_CFLAGS) gstintertest_LDADD = \ - $(GST_LIBS) \ $(GST_PLUGINS_BASE_LIBS) \ + $(GST_LIBS) \ $(LIBM) Android.mk: Makefile.am $(BUILT_SOURCES) diff --git a/gst/inter/gstintersurface.c b/gst/inter/gstintersurface.c index 1d23e5de1..0fc1c84cc 100644 --- a/gst/inter/gstintersurface.c +++ b/gst/inter/gstintersurface.c @@ -23,6 +23,7 @@ #include <string.h> +#include <gst/glib-compat-private.h> #include "gstintersurface.h" static GList *list; diff --git a/gst/inter/gstintertest.c b/gst/inter/gstintertest.c index cb7b08c66..ff4c65f47 100644 --- a/gst/inter/gstintertest.c +++ b/gst/inter/gstintertest.c @@ -29,6 +29,7 @@ #endif #include <gst/gst.h> +#include <gst/glib-compat-private.h> #include <stdlib.h> //#define GETTEXT_PACKAGE "intertest" @@ -80,8 +81,10 @@ main (int argc, char *argv[]) GstInterTest *intertest2; GMainLoop *main_loop; +#if !GLIB_CHECK_VERSION (2, 31, 0) if (!g_thread_supported ()) g_thread_init (NULL); +#endif context = g_option_context_new ("- FIXME"); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); diff --git a/gst/liveadder/Makefile.am b/gst/liveadder/Makefile.am index 4fe8e2959..0bbeff90f 100644 --- a/gst/liveadder/Makefile.am +++ b/gst/liveadder/Makefile.am @@ -1,7 +1,7 @@ plugin_LTLIBRARIES = libgstliveadder.la libgstliveadder_la_SOURCES = liveadder.c -libgstliveadder_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) +libgstliveadder_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstliveadder_la_LIBADD = \ $(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_MAJORMINOR@ \ $(GST_BASE_LIBS) $(GST_LIBS) diff --git a/gst/liveadder/liveadder.c b/gst/liveadder/liveadder.c index fc3154ce9..d22bcb7d9 100644 --- a/gst/liveadder/liveadder.c +++ b/gst/liveadder/liveadder.c @@ -44,6 +44,7 @@ #include "liveadder.h" +#include <gst/glib-compat-private.h> #include <gst/audio/audio.h> #include <string.h> diff --git a/gst/mpegdemux/gstmpegdemux.c b/gst/mpegdemux/gstmpegdemux.c index 4bf623546..8e7bd2310 100644 --- a/gst/mpegdemux/gstmpegdemux.c +++ b/gst/mpegdemux/gstmpegdemux.c @@ -46,6 +46,10 @@ #include "config.h" #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <string.h> #include "gstmpegdefs.h" @@ -114,8 +118,8 @@ static GstStaticPadTemplate audio_template = GST_STATIC_PAD_TEMPLATE ("audio_%02x", GST_PAD_SRC, GST_PAD_SOMETIMES, - GST_STATIC_CAPS ("audio/mpeg, " - "mpegversion = (int) { 1, 4 };" + GST_STATIC_CAPS ("audio/mpeg, mpegversion = (int) 1;" + "audio/mpeg, mpegversion = (int) 4, stream-format = (string) { adts, loas };" "audio/x-private1-lpcm; " "audio/x-private1-ac3;" "audio/x-private1-dts;" "audio/ac3") ); diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c index 2c6db7da3..012c1cc71 100644 --- a/gst/mpegdemux/gstmpegtsdemux.c +++ b/gst/mpegdemux/gstmpegtsdemux.c @@ -125,7 +125,10 @@ enum #define AUDIO_CAPS \ GST_STATIC_CAPS ( \ "audio/mpeg, " \ - "mpegversion = (int) { 1, 4 };" \ + "mpegversion = (int) 1;" \ + "audio/mpeg, " \ + "mpegversion = (int) 4, " \ + "stream-format = (string) { adts, loas };" \ "audio/x-lpcm, " \ "width = (int) { 16, 20, 24 }, " \ "rate = (int) { 48000, 96000 }, " \ @@ -396,6 +399,14 @@ gst_mpegts_demux_reset (GstMpegTSDemux * demux) demux->last_buf_ts = GST_CLOCK_TIME_NONE; } +static void +gst_mpegts_demux_no_more_pads (GstElement * demux) +{ + /* We should really call no-more-pads here, but we don't as + this would preclude addition of more pads if/when new streams + are added. */ +} + #if 0 static void gst_mpegts_demux_remove_pads (GstMpegTSDemux * demux) @@ -1083,7 +1094,7 @@ gst_mpegts_demux_sync_streams (GstMpegTSDemux * demux, GstClockTime time) any pad that might be waiting for data */ if (!stream->pad && demux->pending_pads > 0) { demux->pending_pads = 0; - gst_element_no_more_pads (GST_ELEMENT (demux)); + gst_mpegts_demux_no_more_pads (GST_ELEMENT (demux)); } if (stream->pad) { @@ -1329,7 +1340,7 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first, If not, we'll add pads as we get data for them, and will end up hitting decodebin2's overrun threshold (if using decodebin2) */ GST_DEBUG_OBJECT (demux, "All pads added, we can signal no-more-pads"); - gst_element_no_more_pads (GST_ELEMENT (demux)); + gst_mpegts_demux_no_more_pads (GST_ELEMENT (demux)); } else { GST_DEBUG_OBJECT (demux, "All pads could not be added, we will not signal no-more-pads"); @@ -1384,7 +1395,7 @@ gst_mpegts_demux_data_cb (GstPESFilter * filter, gboolean first, "Adding pad due to received data, decreasing pending pads to %d", demux->pending_pads); if (demux->pending_pads == 0) - gst_element_no_more_pads (GST_ELEMENT (demux)); + gst_mpegts_demux_no_more_pads (GST_ELEMENT (demux)); stream->discont = TRUE; @@ -1738,7 +1749,7 @@ gst_mpegts_stream_parse_pmt (GstMpegTSStream * stream, GST_DEBUG_OBJECT (demux, "Done parsing PMT, pending pads now %d", demux->pending_pads); if (demux->pending_pads == 0) - gst_element_no_more_pads (GST_ELEMENT (demux)); + gst_mpegts_demux_no_more_pads (GST_ELEMENT (demux)); return TRUE; diff --git a/gst/mpegpsmux/mpegpsmux.c b/gst/mpegpsmux/mpegpsmux.c index 3fff4be51..b9e40fbe5 100644 --- a/gst/mpegpsmux/mpegpsmux.c +++ b/gst/mpegpsmux/mpegpsmux.c @@ -69,7 +69,9 @@ static GstStaticPadTemplate mpegpsmux_sink_factory = "video/x-dirac;" "video/x-h264;" "audio/mpeg, " - "mpegversion = (int) { 1, 2, 4 };" + "mpegversion = (int) { 1, 2 };" + "audio/mpeg, " + "mpegversion = (int) 4, stream-format = (string) { raw, adts }; " "audio/x-lpcm, " "width = (int) { 16, 20, 24 }, " "rate = (int) { 48000, 96000 }, " diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index bdf4caddb..bb200df74 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -32,6 +32,10 @@ #include "config.h" #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <stdlib.h> #include <string.h> @@ -174,6 +178,7 @@ mpegts_base_class_init (MpegTSBaseClass * klass) element_class = GST_ELEMENT_CLASS (klass); element_class->change_state = mpegts_base_change_state; + gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template)); diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index 6261ff908..70b464a64 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -144,7 +144,10 @@ struct _TSDemuxStream #define AUDIO_CAPS \ GST_STATIC_CAPS ( \ "audio/mpeg, " \ - "mpegversion = (int) { 1, 4 };" \ + "mpegversion = (int) 1;" \ + "audio/mpeg, " \ + "mpegversion = (int) 4, " \ + "stream-format = (string) adts; " \ "audio/x-lpcm, " \ "width = (int) { 16, 20, 24 }, " \ "rate = (int) { 48000, 96000 }, " \ @@ -1082,11 +1085,12 @@ create_pad_for_stream (MpegTSBase * base, MpegTSBaseStream * bstream, case ST_DSMCC_D: MPEGTS_BIT_UNSET (base->is_pes, bstream->pid); break; - case ST_AUDIO_AAC: + case ST_AUDIO_AAC: /* ADTS */ template = gst_static_pad_template_get (&audio_template); name = g_strdup_printf ("audio_%04x", bstream->pid); caps = gst_caps_new_simple ("audio/mpeg", - "mpegversion", G_TYPE_INT, 4, NULL); + "mpegversion", G_TYPE_INT, 4, + "stream-format", G_TYPE_STRING, "adts", NULL); break; case ST_VIDEO_MPEG4: template = gst_static_pad_template_get (&video_template); diff --git a/gst/mpegtsmux/mpegtsmux.c b/gst/mpegtsmux/mpegtsmux.c index 3e3b3f9e1..6abfc9380 100644 --- a/gst/mpegtsmux/mpegtsmux.c +++ b/gst/mpegtsmux/mpegtsmux.c @@ -88,6 +88,10 @@ #include <stdio.h> #include <string.h> +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <gst/video/video.h> #include "mpegtsmux.h" @@ -117,7 +121,9 @@ static GstStaticPadTemplate mpegtsmux_sink_factory = "video/x-dirac;" "video/x-h264,stream-format=(string)byte-stream;" "audio/mpeg, " - "mpegversion = (int) { 1, 2, 4 };" + "mpegversion = (int) { 1, 2 };" + "audio/mpeg, " + "mpegversion = (int) 4, stream-format = (string) { raw, adts };" "audio/x-lpcm, " "width = (int) { 16, 20, 24 }, " "rate = (int) { 48000, 96000 }, " @@ -659,27 +665,6 @@ mpegtsmux_choose_best_stream (MpegTsMux * mux) #define COLLECT_DATA_PAD(collect_data) (((GstCollectData2 *)(collect_data))->pad) -static MpegTsPadData * -find_pad_data (MpegTsMux * mux, GstPad * pad) -{ - GSList *walk; - MpegTsPadData *ts_data = NULL; - - GST_COLLECT_PADS2_STREAM_LOCK (mux->collect); - walk = mux->collect->pad_list; - while (walk) { - if (((GstCollectData2 *) walk->data)->pad == pad) { - ts_data = (MpegTsPadData *) walk->data; - break; - } - - walk = g_slist_next (walk); - } - GST_COLLECT_PADS2_STREAM_UNLOCK (mux->collect); - - return ts_data; -} - static gboolean mpegtsmux_sink_event (GstPad * pad, GstEvent * event) { @@ -688,7 +673,7 @@ mpegtsmux_sink_event (GstPad * pad, GstEvent * event) gboolean res = TRUE; gboolean forward = TRUE; - ts_data = find_pad_data (mux, pad); + ts_data = (MpegTsPadData *) gst_pad_get_element_private (pad); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_CUSTOM_DOWNSTREAM: diff --git a/gst/mve/Makefile.am b/gst/mve/Makefile.am index 272b91857..8be4517d3 100644 --- a/gst/mve/Makefile.am +++ b/gst/mve/Makefile.am @@ -1,6 +1,6 @@ plugin_LTLIBRARIES = libgstmve.la -libgstmve_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_CFLAGS) +libgstmve_la_CFLAGS = $(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) libgstmve_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) libgstmve_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstmve_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/gst/mve/gstmvemux.c b/gst/mve/gstmvemux.c index 3bf07b01e..fdec7f096 100644 --- a/gst/mve/gstmvemux.c +++ b/gst/mve/gstmvemux.c @@ -31,6 +31,7 @@ gst-launch-0.10 filesrc location=movie.mve ! mvedemux name=d ! #include <string.h> #include <gst/gst.h> +#include <gst/glib-compat-private.h> #include "gstmvemux.h" #include "mve.h" diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 47042103d..f56c4f386 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -54,6 +54,10 @@ #include "config.h" #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include "mxfdemux.h" #include "mxfessence.h" diff --git a/gst/rawparse/gstrawparse.c b/gst/rawparse/gstrawparse.c index 59a3093f8..2148ca7f6 100644 --- a/gst/rawparse/gstrawparse.c +++ b/gst/rawparse/gstrawparse.c @@ -29,6 +29,10 @@ #include <string.h> +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <gst/gst.h> #include <gst/base/gstbasetransform.h> #include <gst/base/gstadapter.h> diff --git a/gst/sdp/gstsdpdemux.c b/gst/sdp/gstsdpdemux.c index 0eb46a045..30e98fd09 100644 --- a/gst/sdp/gstsdpdemux.c +++ b/gst/sdp/gstsdpdemux.c @@ -47,6 +47,10 @@ #include "config.h" #endif +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include "gstsdpdemux.h" #include <gst/rtp/gstrtppayloads.h> diff --git a/gst/tta/gstttaparse.c b/gst/tta/gstttaparse.c index e7c131ba9..80f93b7b9 100644 --- a/gst/tta/gstttaparse.c +++ b/gst/tta/gstttaparse.c @@ -19,6 +19,10 @@ * Boston, MA 02111-1307, USA. */ +/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex + * with newer GLib versions (>= 2.31.0) */ +#define GLIB_DISABLE_DEPRECATION_WARNINGS + #include <gst/gst.h> #include <math.h> diff --git a/gst/videoparsers/gsth264parse.c b/gst/videoparsers/gsth264parse.c index bb9a93c9d..2ba6af0ae 100644 --- a/gst/videoparsers/gsth264parse.c +++ b/gst/videoparsers/gsth264parse.c @@ -176,15 +176,12 @@ gst_h264_parse_reset_frame (GstH264Parse * h264parse) GST_DEBUG_OBJECT (h264parse, "reset frame"); /* done parsing; reset state */ - h264parse->nalu.valid = FALSE; - h264parse->nalu.offset = 0; - h264parse->nalu.sc_offset = 0; - h264parse->nalu.size = 0; - h264parse->current_off = 0; + h264parse->current_off = -1; h264parse->picture_start = FALSE; h264parse->update_caps = FALSE; h264parse->idr_pos = -1; + h264parse->sei_pos = -1; h264parse->keyframe = FALSE; h264parse->frame_start = FALSE; gst_adapter_clear (h264parse->frame_out); @@ -291,6 +288,9 @@ gst_h264_parse_get_string (GstH264Parse * parse, gboolean format, gint code) static void gst_h264_parse_format_from_caps (GstCaps * caps, guint * format, guint * align) { + g_return_if_fail (gst_caps_is_fixed (caps)); + + GST_DEBUG ("parsing caps: %" GST_PTR_FORMAT, caps); if (format) *format = GST_H264_PARSE_FORMAT_NONE; @@ -330,9 +330,20 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, GstCaps * in_caps) guint format = GST_H264_PARSE_FORMAT_NONE; guint align = GST_H264_PARSE_ALIGN_NONE; + g_return_if_fail ((in_caps == NULL) || gst_caps_is_fixed (in_caps)); + caps = gst_pad_get_allowed_caps (GST_BASE_PARSE_SRC_PAD (h264parse)); GST_DEBUG_OBJECT (h264parse, "allowed caps: %" GST_PTR_FORMAT, caps); + /* concentrate on leading structure, since decodebin2 parser + * capsfilter always includes parser template caps */ + if (caps) { + caps = gst_caps_make_writable (caps); + gst_caps_truncate (caps); + GST_DEBUG_OBJECT (h264parse, "negotiating with caps: %" GST_PTR_FORMAT, + caps); + } + if (in_caps && caps) { if (gst_caps_can_intersect (in_caps, caps)) { GST_DEBUG_OBJECT (h264parse, "downstream accepts upstream caps"); @@ -343,6 +354,8 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, GstCaps * in_caps) } if (caps) { + /* fixate to avoid ambiguity with lists when parsing */ + gst_pad_fixate_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps); gst_h264_parse_format_from_caps (caps, &format, &align); gst_caps_unref (caps); } @@ -504,6 +517,15 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu) GST_TIME_ARGS (h264parse->ts_trn_nb)); break; } + /* mark SEI pos */ + if (h264parse->sei_pos == -1) { + if (h264parse->format == GST_H264_PARSE_FORMAT_AVC) + h264parse->sei_pos = gst_adapter_available (h264parse->frame_out); + else + h264parse->sei_pos = nalu->offset - 4; + GST_DEBUG_OBJECT (h264parse, "marking SEI in frame at offset %d", + h264parse->sei_pos); + } break; case GST_H264_NAL_SLICE: @@ -547,6 +569,12 @@ gst_h264_parse_process_nal (GstH264Parse * h264parse, GstH264NalUnit * nalu) GST_DEBUG_OBJECT (h264parse, "marking IDR in frame at offset %d", h264parse->idr_pos); } + /* if SEI preceeds (faked) IDR, then we have to insert config there */ + if (h264parse->sei_pos >= 0 && h264parse->idr_pos > h264parse->sei_pos) { + h264parse->idr_pos = h264parse->sei_pos; + GST_DEBUG_OBJECT (h264parse, "moved IDR mark to SEI position %d", + h264parse->idr_pos); + } break; default: gst_h264_parser_parse_nal (nalparser, nalu); @@ -575,10 +603,6 @@ gst_h264_parse_collect_nal (GstH264Parse * h264parse, const guint8 * data, GstH264NalUnitType nal_type = nalu->type; GstH264NalUnit nnalu; - if (h264parse->align == GST_H264_PARSE_ALIGN_NAL) { - return TRUE; - } - GST_DEBUG_OBJECT (h264parse, "parsing collected nal"); parse_res = gst_h264_parser_identify_nalu (h264parse->nalparser, data, nalu->offset + nalu->size, size, &nnalu); @@ -631,9 +655,10 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, guint8 *data; gsize size; guint current_off = 0; - gboolean drain; + gboolean drain, nonext; GstH264NalParser *nalparser = h264parse->nalparser; GstH264NalUnit nalu; + GstH264ParserResult pres; gst_buffer_map (buffer, &map, GST_MAP_READ); data = map.data; @@ -658,15 +683,39 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, GST_LOG_OBJECT (h264parse, "resuming frame parsing"); } - drain = FALSE; - nalu = h264parse->nalu; + drain = GST_BASE_PARSE_DRAINING (parse); + nonext = FALSE; + current_off = h264parse->current_off; + if (current_off < 0) + current_off = 0; + g_assert (current_off < size); + GST_DEBUG_OBJECT (h264parse, "last parse position %d", current_off); + + /* check for initial skip */ + if (h264parse->current_off == -1) { + pres = + gst_h264_parser_identify_nalu_unchecked (nalparser, data, current_off, + size, &nalu); + switch (pres) { + case GST_H264_PARSER_OK: + if (nalu.sc_offset > 0) { + *skipsize = nalu.sc_offset; + goto skip; + } + break; + case GST_H264_PARSER_NO_NAL: + *skipsize = size - 3; + goto skip; + break; + default: + g_assert_not_reached (); + break; + } + } - GST_DEBUG_OBJECT (h264parse, "last parse position %u", current_off); while (TRUE) { - GstH264ParserResult pres; - - if (h264parse->packetized) + if (h264parse->packetized_chunked) pres = gst_h264_parser_identify_nalu_unchecked (nalparser, data, current_off, size, &nalu); @@ -677,131 +726,121 @@ gst_h264_parse_check_valid_frame (GstBaseParse * parse, switch (pres) { case GST_H264_PARSER_OK: - GST_DEBUG_OBJECT (h264parse, "complete nal found. " - "current offset: %u, Nal offset: %u, Nal Size: %u", - current_off, nalu.offset, nalu.size); - - GST_DEBUG_OBJECT (h264parse, "current off. %u", - nalu.offset + nalu.size); - - if (!h264parse->nalu.size && !h264parse->nalu.valid) - h264parse->nalu = nalu; - - /* need 2 bytes of next nal */ - if (!h264parse->packetized && (nalu.offset + nalu.size + 4 + 2 > size)) { - if (GST_BASE_PARSE_DRAINING (parse)) { - drain = TRUE; - } else { - GST_DEBUG_OBJECT (h264parse, "need more bytes of next nal"); - current_off = nalu.sc_offset; - goto more; - } - } + GST_DEBUG_OBJECT (h264parse, "complete nal (offset, size): (%u, %u) ", + nalu.offset, nalu.size); break; + case GST_H264_PARSER_NO_NAL_END: + GST_DEBUG_OBJECT (h264parse, "not a complete nal found at offset %u", + nalu.offset); + /* if draining, accept it as complete nal */ + if (drain) { + nonext = TRUE; + nalu.size = size - nalu.offset; + GST_DEBUG_OBJECT (h264parse, "draining, accepting with size %u", + nalu.size); + /* if it's not too short at least */ + if (nalu.size < 2) + goto broken; + break; + } + /* otherwise need more */ + goto more; case GST_H264_PARSER_BROKEN_LINK: - goto out; + g_assert_not_reached (); + break; case GST_H264_PARSER_ERROR: - current_off = size - 3; - goto parsing_error; + /* should not really occur either */ + GST_DEBUG_OBJECT (h264parse, "error parsing Nal Unit"); + /* fall-through */ case GST_H264_PARSER_NO_NAL: - /* don't expect to have found any NAL so far */ - g_assert (h264parse->nalu.size == 0); - current_off = h264parse->nalu.sc_offset = size - 3; - goto more; + g_assert_not_reached (); + break; case GST_H264_PARSER_BROKEN_DATA: GST_WARNING_OBJECT (h264parse, "input stream is corrupt; " - "it contains a NAL unit of length %d", nalu.size); - + "it contains a NAL unit of length %u", nalu.size); + broken: /* broken nal at start -> arrange to skip it, * otherwise have it terminate current au * (and so it will be skipped on next frame round) */ - if (nalu.sc_offset == h264parse->nalu.sc_offset) { - *skipsize = nalu.offset; - + if (current_off == 0) { GST_DEBUG_OBJECT (h264parse, "skipping broken nal"); - goto invalid; + *skipsize = nalu.offset; + goto skip; } else { + GST_DEBUG_OBJECT (h264parse, "terminating au"); nalu.size = 0; + nalu.offset = nalu.sc_offset; goto end; } - case GST_H264_PARSER_NO_NAL_END: - GST_DEBUG_OBJECT (h264parse, "not a complete nal found at offset %u", - nalu.offset); - - current_off = nalu.sc_offset; - /* We keep the reference to this nal so we start over the parsing - * here */ - if (!h264parse->nalu.size && !h264parse->nalu.valid) - h264parse->nalu = nalu; - - if (GST_BASE_PARSE_DRAINING (parse)) { - drain = TRUE; - GST_DEBUG_OBJECT (h264parse, "draining NAL %" G_GSIZE_FORMAT " %u %u", - size, h264parse->nalu.offset, h264parse->nalu.size); - /* Can't parse the nalu */ - if (size - h264parse->nalu.offset < 2) { - *skipsize = nalu.offset; - goto invalid; - } - - /* We parse it anyway */ - nalu.size = size - nalu.offset; - break; - } - goto more; + break; + default: + g_assert_not_reached (); + break; } - current_off = nalu.offset + nalu.size; - GST_DEBUG_OBJECT (h264parse, "%p complete nal found. Off: %u, Size: %u", data, nalu.offset, nalu.size); + /* simulate no next nal if none needed */ + nonext = nonext || (h264parse->align == GST_H264_PARSE_ALIGN_NAL); + + if (!nonext && !h264parse->packetized_chunked) { + if (nalu.offset + nalu.size + 4 + 2 > size) { + GST_DEBUG_OBJECT (h264parse, "not enough data for next NALU"); + if (drain) { + GST_DEBUG_OBJECT (h264parse, "but draining anyway"); + nonext = TRUE; + } else { + goto more; + } + } + } + gst_h264_parse_process_nal (h264parse, &nalu); - /* if no next nal, we know it's complete here */ - if (drain || gst_h264_parse_collect_nal (h264parse, data, size, &nalu)) + + if (nonext) break; - /* In packetized mode we know there's only on NALU in each input packet */ - if (h264parse->packetized) + /* In packetized mode we know there's only on NALU in each input packet, + * but we may not have seen the whole AU already, possibly need more */ + if (h264parse->packetized_chunked) { + if (h264parse->packetized_last) + break; + /* next NALU expected at end of current data */ + current_off = size; + goto more; + } + + /* if no next nal, we know it's complete here */ + if (gst_h264_parse_collect_nal (h264parse, data, size, &nalu)) break; GST_DEBUG_OBJECT (h264parse, "Looking for more"); + current_off = nalu.offset + nalu.size; } end: - *skipsize = h264parse->nalu.sc_offset; - *framesize = nalu.offset + nalu.size - h264parse->nalu.sc_offset; - h264parse->current_off = current_off; + *framesize = nalu.offset + nalu.size; gst_buffer_unmap (buffer, &map); return TRUE; -parsing_error: - GST_DEBUG_OBJECT (h264parse, "error parsing Nal Unit"); - more: /* ask for best next available */ *framesize = G_MAXUINT; - if (!h264parse->nalu.size) { - /* skip up to initial startcode */ - *skipsize = h264parse->nalu.sc_offset; - /* but mind some stuff will have been skipped */ - g_assert (current_off >= *skipsize); - current_off -= *skipsize; - h264parse->nalu.sc_offset = 0; - } else { - *skipsize = 0; - } + *skipsize = 0; /* Restart parsing from here next time */ - h264parse->current_off = current_off; + if (current_off > 0) + h264parse->current_off = current_off; /* Fall-through. */ out: gst_buffer_unmap (buffer, &map); return FALSE; -invalid: +skip: + GST_DEBUG_OBJECT (h264parse, "skipping %d", *skipsize); gst_h264_parse_reset_frame (h264parse); goto out; } @@ -1873,7 +1912,17 @@ gst_h264_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) nalu.data + nalu.offset, nalu.size); /* at least this should make sense */ GST_BUFFER_TIMESTAMP (sub) = GST_BUFFER_TIMESTAMP (buffer); - GST_LOG_OBJECT (h264parse, "pushing NAL of size %d", nalu.size); + /* transfer flags (e.g. DISCONT) for first fragment */ + if (nalu.offset <= nl) + gst_buffer_copy_metadata (sub, buffer, GST_BUFFER_COPY_FLAGS); + /* in reverse playback, baseparse gathers buffers, so we cannot + * guarantee a buffer to contain a single whole NALU */ + h264parse->packetized_chunked = + (GST_BASE_PARSE (h264parse)->segment.rate > 0.0); + h264parse->packetized_last = + (nalu.offset + nalu.size + nl >= GST_BUFFER_SIZE (buffer)); + GST_LOG_OBJECT (h264parse, "pushing NAL of size %d, last = %d", + nalu.size, h264parse->packetized_last); ret = h264parse->parse_chain (pad, parent, sub); } else { /* pass-through: no looking for frames (and nal processing), diff --git a/gst/videoparsers/gsth264parse.h b/gst/videoparsers/gsth264parse.h index 1064ff8bb..61afe9387 100644 --- a/gst/videoparsers/gsth264parse.h +++ b/gst/videoparsers/gsth264parse.h @@ -67,10 +67,11 @@ struct _GstH264Parse /* state */ GstH264NalParser *nalparser; - GstH264NalUnit nalu; guint align; guint format; - guint current_off; + gint current_off; + gboolean packetized_last; + gboolean packetized_chunked; GstClockTime last_report; gboolean push_codec; @@ -97,7 +98,7 @@ struct _GstH264Parse /* frame parsing */ /*guint last_nal_pos;*/ /*guint next_sc_pos;*/ - gint idr_pos; + gint idr_pos, sei_pos; gboolean update_caps; GstAdapter *frame_out; gboolean keyframe; diff --git a/gst/videoparsers/gstmpegvideoparse.c b/gst/videoparsers/gstmpegvideoparse.c index 974fecc56..37a13cc63 100644 --- a/gst/videoparsers/gstmpegvideoparse.c +++ b/gst/videoparsers/gstmpegvideoparse.c @@ -691,6 +691,9 @@ gst_mpegv_parse_update_src_caps (GstMpegvParse * mpvparse) gst_caps_set_simple (caps, "level", G_TYPE_STRING, level, NULL); else GST_DEBUG_OBJECT (mpvparse, "Invalid level - %u", level_c); + + gst_caps_set_simple (caps, "interlaced", + G_TYPE_BOOLEAN, !mpvparse->sequenceext.progressive, NULL); } gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (mpvparse), caps); |