mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 10:41:04 +00:00
Merge branch 'master' into 0.11
Conflicts: ext/theora/gsttheoraenc.c
This commit is contained in:
commit
4007076b55
14 changed files with 170 additions and 90 deletions
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit 1ccbe098d6379612fcef09f4000da23585af980a
|
||||
Subproject commit c3cafe123f3a363d337a29ad32fdd6d3631f52c0
|
|
@ -272,6 +272,9 @@ static void theora_enc_set_property (GObject * object, guint prop_id,
|
|||
const GValue * value, GParamSpec * pspec);
|
||||
static void theora_enc_finalize (GObject * object);
|
||||
|
||||
static gboolean theora_enc_write_multipass_cache (GstTheoraEnc * enc,
|
||||
gboolean begin, gboolean eos);
|
||||
|
||||
static void
|
||||
gst_theora_enc_base_init (gpointer g_class)
|
||||
{
|
||||
|
@ -483,44 +486,6 @@ theora_enc_finalize (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
theora_enc_write_multipass_cache_beginning (GstTheoraEnc * enc, gboolean eos)
|
||||
{
|
||||
GError *err = NULL;
|
||||
GIOStatus stat;
|
||||
gint bytes_read = 0;
|
||||
gsize bytes_written = 0;
|
||||
gchar *buf;
|
||||
|
||||
stat =
|
||||
g_io_channel_seek_position (enc->multipass_cache_fd, 0, G_SEEK_SET, &err);
|
||||
if (stat != G_IO_STATUS_ERROR) {
|
||||
do {
|
||||
bytes_read =
|
||||
th_encode_ctl (enc->encoder, TH_ENCCTL_2PASS_OUT, &buf, sizeof (buf));
|
||||
if (bytes_read > 0)
|
||||
g_io_channel_write_chars (enc->multipass_cache_fd, buf, bytes_read,
|
||||
&bytes_written, NULL);
|
||||
} while (bytes_read > 0 && bytes_written > 0);
|
||||
|
||||
}
|
||||
|
||||
if (stat == G_IO_STATUS_ERROR || bytes_read < 0 || bytes_written < 0) {
|
||||
if (eos)
|
||||
GST_ELEMENT_WARNING (enc, RESOURCE, WRITE, (NULL),
|
||||
("Failed to seek to beginning of multipass cache file: %s",
|
||||
err->message));
|
||||
else
|
||||
GST_ELEMENT_ERROR (enc, RESOURCE, WRITE, (NULL),
|
||||
("Failed to seek to beginning of multipass cache file: %s",
|
||||
err->message));
|
||||
g_error_free (err);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
theora_enc_reset (GstTheoraEnc * enc)
|
||||
{
|
||||
|
@ -569,7 +534,7 @@ theora_enc_reset (GstTheoraEnc * enc)
|
|||
/* Get placeholder data */
|
||||
if (enc->multipass_cache_fd
|
||||
&& enc->multipass_mode == MULTIPASS_MODE_FIRST_PASS)
|
||||
theora_enc_write_multipass_cache_beginning (enc, FALSE);
|
||||
theora_enc_write_multipass_cache (enc, TRUE, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -904,7 +869,7 @@ theora_enc_sink_event (GstPad * pad, GstEvent * event)
|
|||
}
|
||||
if (enc->initialised && enc->multipass_cache_fd
|
||||
&& enc->multipass_mode == MULTIPASS_MODE_FIRST_PASS)
|
||||
theora_enc_write_multipass_cache_beginning (enc, TRUE);
|
||||
theora_enc_write_multipass_cache (enc, TRUE, TRUE);
|
||||
|
||||
theora_enc_clear_multipass_cache (enc);
|
||||
|
||||
|
@ -1095,23 +1060,46 @@ theora_enc_read_multipass_cache (GstTheoraEnc * enc)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
theora_enc_write_multipass_cache (GstTheoraEnc * enc)
|
||||
theora_enc_write_multipass_cache (GstTheoraEnc * enc, gboolean begin,
|
||||
gboolean eos)
|
||||
{
|
||||
gchar *buf;
|
||||
gint bytes_read;
|
||||
GError *err = NULL;
|
||||
GIOStatus stat = G_IO_STATUS_NORMAL;
|
||||
gint bytes_read = 0;
|
||||
gsize bytes_written = 0;
|
||||
gchar *buf;
|
||||
|
||||
do {
|
||||
bytes_read =
|
||||
th_encode_ctl (enc->encoder, TH_ENCCTL_2PASS_OUT, &buf, sizeof (buf));
|
||||
if (bytes_read > 0)
|
||||
g_io_channel_write_chars (enc->multipass_cache_fd, buf, bytes_read,
|
||||
&bytes_written, NULL);
|
||||
} while (bytes_read > 0 && bytes_written > 0);
|
||||
if (begin)
|
||||
stat = g_io_channel_seek_position (enc->multipass_cache_fd, 0, G_SEEK_SET,
|
||||
&err);
|
||||
if (stat != G_IO_STATUS_ERROR) {
|
||||
do {
|
||||
bytes_read =
|
||||
th_encode_ctl (enc->encoder, TH_ENCCTL_2PASS_OUT, &buf, sizeof (buf));
|
||||
if (bytes_read > 0)
|
||||
g_io_channel_write_chars (enc->multipass_cache_fd, buf, bytes_read,
|
||||
&bytes_written, NULL);
|
||||
} while (bytes_read > 0 && bytes_written > 0);
|
||||
|
||||
}
|
||||
|
||||
if (stat == G_IO_STATUS_ERROR || bytes_read < 0 || bytes_written < 0) {
|
||||
if (begin) {
|
||||
if (eos)
|
||||
GST_ELEMENT_WARNING (enc, RESOURCE, WRITE, (NULL),
|
||||
("Failed to seek to beginning of multipass cache file: %s",
|
||||
err->message));
|
||||
else
|
||||
GST_ELEMENT_ERROR (enc, RESOURCE, WRITE, (NULL),
|
||||
("Failed to seek to beginning of multipass cache file: %s",
|
||||
err->message));
|
||||
} else {
|
||||
GST_ELEMENT_ERROR (enc, RESOURCE, WRITE, (NULL),
|
||||
("Failed to write multipass cache file"));
|
||||
}
|
||||
if (err)
|
||||
g_error_free (err);
|
||||
|
||||
if (bytes_read < 0 || bytes_written < 0) {
|
||||
GST_ELEMENT_ERROR (enc, RESOURCE, WRITE, (NULL),
|
||||
("Failed to write multipass cache file"));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -1295,7 +1283,7 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
|
|||
|
||||
if (enc->multipass_cache_fd
|
||||
&& enc->multipass_mode == MULTIPASS_MODE_FIRST_PASS) {
|
||||
if (!theora_enc_write_multipass_cache (enc)) {
|
||||
if (!theora_enc_write_multipass_cache (enc, FALSE, FALSE)) {
|
||||
gst_buffer_unmap (buffer, data, size);
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto multipass_write_failed;
|
||||
|
|
|
@ -1014,7 +1014,7 @@ gst_rtcp_packet_sdes_next_item (GstRTCPPacket * packet)
|
|||
while (offset < len) {
|
||||
if (data[offset] == 0) {
|
||||
/* end of list, round to next 32-bit word */
|
||||
offset = (offset + 3) & ~3;
|
||||
offset = (offset + 4) & ~3;
|
||||
break;
|
||||
}
|
||||
offset += data[offset + 1] + 2;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <gst/math-compat.h>
|
||||
|
||||
/* Some useful constants */
|
||||
#define TIFF_LITTLE_ENDIAN 0x4949
|
||||
|
|
|
@ -368,7 +368,7 @@ gst_vorbis_tag_add_metadata_block_picture (GstTagList * tags,
|
|||
guint32 img_len = 0, img_type = 0;
|
||||
guint32 img_mimetype_len = 0, img_description_len = 0;
|
||||
gsize decoded_len;
|
||||
const guint8 *data;
|
||||
const guint8 *data = NULL;
|
||||
|
||||
/* img_data_base64 points to a temporary copy of the base64 encoded data, so
|
||||
* it's safe to do inpace decoding here
|
||||
|
|
|
@ -837,7 +837,7 @@ deserialize_tiff_orientation (XmpTag * xmptag, GstTagList * taglist,
|
|||
* http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/XMP.html
|
||||
*/
|
||||
static gpointer
|
||||
_init_xmp_tag_map ()
|
||||
_init_xmp_tag_map (gpointer user_data)
|
||||
{
|
||||
GPtrArray *array;
|
||||
XmpTag *xmpinfo;
|
||||
|
@ -984,7 +984,7 @@ static void
|
|||
xmp_tags_initialize ()
|
||||
{
|
||||
static GOnce my_once = G_ONCE_INIT;
|
||||
g_once (&my_once, _init_xmp_tag_map, NULL);
|
||||
g_once (&my_once, (GThreadFunc) _init_xmp_tag_map, NULL);
|
||||
}
|
||||
|
||||
typedef struct _GstXmpNamespaceMatch GstXmpNamespaceMatch;
|
||||
|
|
|
@ -297,7 +297,6 @@ gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
|
|||
{
|
||||
GstTagXmpWriterData *data;
|
||||
GstBuffer *buf = NULL;
|
||||
const gchar **array;
|
||||
gint i = 0;
|
||||
GSList *iter;
|
||||
|
||||
|
@ -307,12 +306,13 @@ gst_tag_xmp_writer_tag_list_to_xmp_buffer (GstTagXmpWriter * config,
|
|||
|
||||
g_static_mutex_lock (&data->lock);
|
||||
if (data->schemas) {
|
||||
array = g_new0 (const gchar *, g_slist_length (data->schemas) + 1);
|
||||
gchar **array = g_new0 (gchar *, g_slist_length (data->schemas) + 1);
|
||||
if (array) {
|
||||
for (iter = data->schemas; iter; iter = g_slist_next (iter)) {
|
||||
array[i++] = (const gchar *) iter->data;
|
||||
array[i++] = (gchar *) iter->data;
|
||||
}
|
||||
buf = gst_tag_list_to_xmp_buffer_full (taglist, read_only, array);
|
||||
buf = gst_tag_list_to_xmp_buffer_full (taglist, read_only,
|
||||
(const gchar **) array);
|
||||
g_free (array);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1937,12 +1937,12 @@ gst_video_format_get_component_offset (GstVideoFormat format,
|
|||
if (component == 0)
|
||||
return 0;
|
||||
if (component == 1) {
|
||||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
|
||||
return GST_ROUND_UP_4 (width) * height +
|
||||
GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
|
||||
(GST_ROUND_UP_4 (height) / 4);
|
||||
}
|
||||
if (component == 2)
|
||||
return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
|
||||
return GST_ROUND_UP_4 (width) * height;
|
||||
return 0;
|
||||
case GST_VIDEO_FORMAT_IYU1:
|
||||
if (component == 0)
|
||||
|
@ -2054,7 +2054,7 @@ gst_video_format_get_size (GstVideoFormat format, int width, int height)
|
|||
return size;
|
||||
case GST_VIDEO_FORMAT_YUV9:
|
||||
case GST_VIDEO_FORMAT_YVU9:
|
||||
size = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
|
||||
size = GST_ROUND_UP_4 (width) * height;
|
||||
size += GST_ROUND_UP_4 (GST_ROUND_UP_4 (width) / 4) *
|
||||
(GST_ROUND_UP_4 (height) / 4) * 2;
|
||||
return size;
|
||||
|
|
|
@ -473,7 +473,7 @@ gst_audio_resample_parse_caps (GstCaps * incaps,
|
|||
|
||||
structure = gst_caps_get_structure (incaps, 0);
|
||||
|
||||
if (g_str_equal (gst_structure_get_name (structure), "audio/x-raw-float"))
|
||||
if (gst_structure_has_name (structure, "audio/x-raw-float"))
|
||||
myfp = TRUE;
|
||||
else
|
||||
myfp = FALSE;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2005> Julien Moutte <julien@moutte.net>
|
||||
* <2009>,<2010> Stefan Kost <stefan.kost@nokia.com>
|
||||
* <2009>,<2010> Stefan Kost <stefan.kost@nokia.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -557,13 +557,6 @@ gst_xvimagesink_xwindow_clear (GstXvImageSink * xvimagesink,
|
|||
XvStopVideo (xvimagesink->xcontext->disp, xvimagesink->xcontext->xv_port_id,
|
||||
xwindow->win);
|
||||
|
||||
XSetForeground (xvimagesink->xcontext->disp, xwindow->gc,
|
||||
xvimagesink->xcontext->black);
|
||||
|
||||
XFillRectangle (xvimagesink->xcontext->disp, xwindow->win, xwindow->gc,
|
||||
xvimagesink->render_rect.x, xvimagesink->render_rect.y,
|
||||
xvimagesink->render_rect.w, xvimagesink->render_rect.h);
|
||||
|
||||
XSync (xvimagesink->xcontext->disp, FALSE);
|
||||
|
||||
g_mutex_unlock (xvimagesink->x_lock);
|
||||
|
@ -1355,7 +1348,7 @@ gst_xvimagesink_xcontext_get (GstXvImageSink * xvimagesink)
|
|||
for (i = 0; i < (sizeof (channels) / sizeof (char *)); i++) {
|
||||
XvAttribute *matching_attr = NULL;
|
||||
|
||||
/* Retrieve the property atom if it exists. If it doesn't exist,
|
||||
/* Retrieve the property atom if it exists. If it doesn't exist,
|
||||
* the attribute itself must not either, so we can skip */
|
||||
prop_atom = XInternAtom (xcontext->disp, channels[i], True);
|
||||
if (prop_atom == None)
|
||||
|
@ -1641,7 +1634,7 @@ gst_xvimagesink_setcaps (GstBaseSink * bsink, GstCaps * caps)
|
|||
GST_VIDEO_SINK_HEIGHT (xvimagesink));
|
||||
}
|
||||
|
||||
/* After a resize, we want to redraw the borders in case the new frame size
|
||||
/* After a resize, we want to redraw the borders in case the new frame size
|
||||
* doesn't cover the same area */
|
||||
xvimagesink->redraw_border = TRUE;
|
||||
|
||||
|
|
|
@ -140,6 +140,7 @@ check_PROGRAMS = \
|
|||
libs/libsabi \
|
||||
libs/audio \
|
||||
libs/cddabasesrc \
|
||||
libs/discoverer \
|
||||
libs/fft \
|
||||
libs/mixer \
|
||||
libs/navigation \
|
||||
|
@ -235,6 +236,14 @@ libs_cddabasesrc_LDADD = \
|
|||
$(GST_BASE_LIBS) \
|
||||
$(LDADD)
|
||||
|
||||
libs_discoverer_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) \
|
||||
$(AM_CFLAGS) \
|
||||
-DGST_TEST_FILE="\"$(abs_top_srcdir)/tests/files/partialframe.mjpeg\""
|
||||
libs_discoverer_LDADD = \
|
||||
$(top_builddir)/gst-libs/gst/pbutils/libgstpbutils-@GST_MAJORMINOR@.la \
|
||||
$(GST_BASE_LIBS) $(LDADD)
|
||||
|
||||
libs_fft_CFLAGS = \
|
||||
$(GST_PLUGINS_BASE_CFLAGS) \
|
||||
$(GST_BASE_CFLAGS) \
|
||||
|
|
3
tests/check/libs/.gitignore
vendored
3
tests/check/libs/.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
.dirstamp
|
||||
audio
|
||||
cddabasesrc
|
||||
discoverer
|
||||
fft
|
||||
gstlibscpp
|
||||
libsabi
|
||||
|
@ -14,4 +15,4 @@ rtsp
|
|||
tag
|
||||
utils
|
||||
video
|
||||
|
||||
xmpwriter
|
||||
|
|
94
tests/check/libs/discoverer.c
Normal file
94
tests/check/libs/discoverer.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/* GStreamer unit tests for discoverer
|
||||
*
|
||||
* Copyright (C) 2011 Stefan Kost <ensonic@users.sf.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gst/check/gstcheck.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
|
||||
GST_START_TEST (test_disco_init)
|
||||
{
|
||||
GError *err = NULL;
|
||||
GstDiscoverer *dc;
|
||||
|
||||
dc = gst_discoverer_new (GST_SECOND, &err);
|
||||
fail_unless (dc != NULL);
|
||||
fail_unless (err == NULL);
|
||||
|
||||
g_object_unref (dc);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_disco_sync)
|
||||
{
|
||||
GError *err = NULL;
|
||||
GstDiscoverer *dc;
|
||||
GstDiscovererInfo *info;
|
||||
GstDiscovererResult result;
|
||||
gchar *uri;
|
||||
|
||||
dc = gst_discoverer_new (GST_SECOND, &err);
|
||||
fail_unless (dc != NULL);
|
||||
fail_unless (err == NULL);
|
||||
|
||||
/* GST_TEST_FILE comes from makefile CFLAGS */
|
||||
GST_INFO ("discovering file '%s'", GST_TEST_FILE);
|
||||
uri = g_filename_to_uri (GST_TEST_FILE, NULL, &err);
|
||||
fail_unless (err == NULL);
|
||||
GST_INFO ("discovering uri '%s'", uri);
|
||||
|
||||
info = gst_discoverer_discover_uri (dc, uri, &err);
|
||||
result = gst_discoverer_info_get_result (info);
|
||||
GST_INFO ("result: %d", result);
|
||||
gst_discoverer_info_unref (info);
|
||||
g_free (uri);
|
||||
|
||||
if (err) {
|
||||
/* we won't have the codec for the jpeg */
|
||||
g_error_free (err);
|
||||
}
|
||||
|
||||
g_object_unref (dc);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
|
||||
static Suite *
|
||||
discoverer_suite (void)
|
||||
{
|
||||
Suite *s = suite_create ("discoverer");
|
||||
TCase *tc_chain = tcase_create ("general");
|
||||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_disco_init);
|
||||
tcase_add_test (tc_chain, test_disco_sync);
|
||||
return s;
|
||||
}
|
||||
|
||||
GST_CHECK_MAIN (discoverer);
|
|
@ -301,30 +301,25 @@ paint_setup_IMC4 (paintinfo * p, unsigned char *dest)
|
|||
static void
|
||||
paint_setup_YVU9 (paintinfo * p, unsigned char *dest)
|
||||
{
|
||||
int h = GST_ROUND_UP_4 (p->height);
|
||||
|
||||
p->yp = dest;
|
||||
p->ystride = GST_ROUND_UP_4 (p->width);
|
||||
p->vp = p->yp + p->ystride * GST_ROUND_UP_4 (p->height);
|
||||
p->vp = p->yp + p->ystride * p->height;
|
||||
p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
|
||||
p->up = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
|
||||
p->up = p->vp + p->vstride * (GST_ROUND_UP_4 (p->height) / 4);
|
||||
p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
|
||||
p->endptr = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
|
||||
p->endptr = p->up + p->ustride * (GST_ROUND_UP_4 (p->height) / 4);
|
||||
}
|
||||
|
||||
static void
|
||||
paint_setup_YUV9 (paintinfo * p, unsigned char *dest)
|
||||
{
|
||||
/* untested */
|
||||
int h = GST_ROUND_UP_4 (p->height);
|
||||
|
||||
p->yp = dest;
|
||||
p->ystride = GST_ROUND_UP_4 (p->width);
|
||||
p->up = p->yp + p->ystride * h;
|
||||
p->up = p->yp + p->ystride * p->height;
|
||||
p->ustride = GST_ROUND_UP_4 (p->ystride / 4);
|
||||
p->vp = p->up + p->ustride * GST_ROUND_UP_4 (h / 4);
|
||||
p->vp = p->up + p->ustride * (GST_ROUND_UP_4 (p->height) / 4);
|
||||
p->vstride = GST_ROUND_UP_4 (p->ystride / 4);
|
||||
p->endptr = p->vp + p->vstride * GST_ROUND_UP_4 (h / 4);
|
||||
p->endptr = p->vp + p->vstride * (GST_ROUND_UP_4 (p->height) / 4);
|
||||
}
|
||||
|
||||
#define gst_video_format_is_packed video_format_is_packed
|
||||
|
|
Loading…
Reference in a new issue