Original commit message from CVS:
2006-03-03  Thomas Vander Stichele  <thomas at apestaart dot org>

* ext/theora/theoraenc.c: (theora_set_header_on_caps):
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(GST_START_TEST):
Fix for http://bugzilla.gnome.org/show_bug.cgi?id=333254
Set IN_CAPS on header buffers
This commit is contained in:
Thomas Vander Stichele 2006-03-03 15:22:02 +00:00
parent af09257fd0
commit daefa3e7fe
3 changed files with 33 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2006-03-03 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/theora/theoraenc.c: (theora_set_header_on_caps):
* tests/check/pipelines/theoraenc.c: (check_buffer_is_header),
(GST_START_TEST):
Fix for http://bugzilla.gnome.org/show_bug.cgi?id=333254
Set IN_CAPS on header buffers
2006-03-02 Wim Taymans <wim@fluendo.com> 2006-03-02 Wim Taymans <wim@fluendo.com>
* docs/plugins/Makefile.am: * docs/plugins/Makefile.am:

View file

@ -452,17 +452,17 @@ theora_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
caps = gst_caps_make_writable (caps); caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
/* mark buffers */
GST_BUFFER_FLAG_SET (buf1, GST_BUFFER_FLAG_IN_CAPS);
GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_FLAG_IN_CAPS);
GST_BUFFER_FLAG_SET (buf3, GST_BUFFER_FLAG_IN_CAPS);
/* Copy buffers, because we can't use the originals - /* Copy buffers, because we can't use the originals -
* it creates a circular refcount with the caps<->buffers */ * it creates a circular refcount with the caps<->buffers */
buf1 = gst_buffer_copy (buf1); buf1 = gst_buffer_copy (buf1);
buf2 = gst_buffer_copy (buf2); buf2 = gst_buffer_copy (buf2);
buf3 = gst_buffer_copy (buf3); buf3 = gst_buffer_copy (buf3);
/* mark buffers */
GST_BUFFER_FLAG_SET (buf1, GST_BUFFER_FLAG_IN_CAPS);
GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_FLAG_IN_CAPS);
GST_BUFFER_FLAG_SET (buf3, GST_BUFFER_FLAG_IN_CAPS);
/* put copies of the buffers in a fixed list */ /* put copies of the buffers in a fixed list */
g_value_init (&array, GST_TYPE_ARRAY); g_value_init (&array, GST_TYPE_ARRAY);

View file

@ -126,6 +126,15 @@ stop_pipeline (GstElement * bin, GstPad * pad)
cond = NULL; cond = NULL;
} }
static void
check_buffer_is_header (GstBuffer * buffer, gboolean is_header)
{
fail_unless (GST_BUFFER_FLAG_IS_SET (buffer,
GST_BUFFER_FLAG_IN_CAPS) == is_header,
"GST_BUFFER_IN_CAPS is set to %d but expected %d",
GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_IN_CAPS), is_header);
}
static void static void
check_buffer_timestamp (GstBuffer * buffer, GstClockTime timestamp) check_buffer_timestamp (GstBuffer * buffer, GstClockTime timestamp)
{ {
@ -207,23 +216,26 @@ GST_START_TEST (test_granulepos_offset)
start_pipeline (bin, pad); start_pipeline (bin, pad);
/* header packets should have timestamp == NONE, granulepos 0 */ /* header packets should have timestamp == NONE, granulepos 0, IN_CAPS */
buffer = get_buffer (bin, pad); buffer = get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE); check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE); check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
buffer = get_buffer (bin, pad); buffer = get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE); check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE); check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
buffer = get_buffer (bin, pad); buffer = get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE); check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE); check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
{ {
@ -240,6 +252,7 @@ GST_START_TEST (test_granulepos_offset)
check_buffer_timestamp (buffer, TIMESTAMP_OFFSET); check_buffer_timestamp (buffer, TIMESTAMP_OFFSET);
/* don't really have a good way of checking duration... */ /* don't really have a good way of checking duration... */
check_buffer_granulepos_from_starttime (buffer, TIMESTAMP_OFFSET); check_buffer_granulepos_from_starttime (buffer, TIMESTAMP_OFFSET);
check_buffer_is_header (buffer, FALSE);
next_timestamp = TIMESTAMP_OFFSET + GST_BUFFER_DURATION (buffer); next_timestamp = TIMESTAMP_OFFSET + GST_BUFFER_DURATION (buffer);
@ -253,6 +266,7 @@ GST_START_TEST (test_granulepos_offset)
FRAMERATE) FRAMERATE)
- gst_util_uint64_scale (last_granulepos, GST_SECOND, FRAMERATE)); - gst_util_uint64_scale (last_granulepos, GST_SECOND, FRAMERATE));
check_buffer_granulepos_from_starttime (buffer, next_timestamp); check_buffer_granulepos_from_starttime (buffer, next_timestamp);
check_buffer_is_header (buffer, FALSE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
} }
@ -300,18 +314,21 @@ GST_START_TEST (test_continuity)
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE); check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE); check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
buffer = get_buffer (bin, pad); buffer = get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE); check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE); check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
buffer = get_buffer (bin, pad); buffer = get_buffer (bin, pad);
check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE); check_buffer_timestamp (buffer, GST_CLOCK_TIME_NONE);
check_buffer_duration (buffer, GST_CLOCK_TIME_NONE); check_buffer_duration (buffer, GST_CLOCK_TIME_NONE);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, TRUE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
{ {
@ -329,6 +346,7 @@ GST_START_TEST (test_continuity)
/* plain division because I know the answer is exact */ /* plain division because I know the answer is exact */
check_buffer_duration (buffer, GST_SECOND / 10); check_buffer_duration (buffer, GST_SECOND / 10);
check_buffer_granulepos (buffer, 0); check_buffer_granulepos (buffer, 0);
check_buffer_is_header (buffer, FALSE);
next_timestamp = GST_BUFFER_DURATION (buffer); next_timestamp = GST_BUFFER_DURATION (buffer);
@ -339,6 +357,7 @@ GST_START_TEST (test_continuity)
check_buffer_timestamp (buffer, next_timestamp); check_buffer_timestamp (buffer, next_timestamp);
check_buffer_duration (buffer, GST_SECOND / 10); check_buffer_duration (buffer, GST_SECOND / 10);
check_buffer_granulepos (buffer, 1); check_buffer_granulepos (buffer, 1);
check_buffer_is_header (buffer, FALSE);
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
} }