Merge branch 'master' into 0.11

Conflicts:
	ext/theora/gsttheoraenc.c
This commit is contained in:
Wim Taymans 2011-04-06 16:33:56 +02:00
commit 4007076b55
14 changed files with 170 additions and 90 deletions

2
common

@ -1 +1 @@
Subproject commit 1ccbe098d6379612fcef09f4000da23585af980a
Subproject commit c3cafe123f3a363d337a29ad32fdd6d3631f52c0

View file

@ -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,12 +1060,19 @@ 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;
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));
@ -1109,9 +1081,25 @@ theora_enc_write_multipass_cache (GstTheoraEnc * enc)
&bytes_written, NULL);
} while (bytes_read > 0 && bytes_written > 0);
if (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);
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;

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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) \

View file

@ -1,6 +1,7 @@
.dirstamp
audio
cddabasesrc
discoverer
fft
gstlibscpp
libsabi
@ -14,4 +15,4 @@ rtsp
tag
utils
video
xmpwriter

View 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);

View file

@ -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