p7zip: assorted fixes
[oi-userland.git] / components / encumbered / gst-plugins-bad / patches / 0010-opus-Handle-GstByteWriter-return-values.patch
blob0664dd57b2b9d14776e30b5cf91e07694ee62758
1 From 95626e69c86686d5b94ebb0a42c778fce7ad63ff Mon Sep 17 00:00:00 2001
2 From: Edward Hervey <edward.hervey@collabora.co.uk>
3 Date: Wed, 4 Apr 2012 11:51:28 +0200
4 Subject: [PATCH 10/20] opus: Handle GstByteWriter return values
6 ---
7 ext/opus/gstopusheader.c | 24 ++++++++++++++----------
8 1 file changed, 14 insertions(+), 10 deletions(-)
10 diff --git a/ext/opus/gstopusheader.c b/ext/opus/gstopusheader.c
11 index d3d631f..9048eb8 100644
12 --- a/ext/opus/gstopusheader.c
13 +++ b/ext/opus/gstopusheader.c
14 @@ -33,6 +33,7 @@ gst_opus_enc_create_id_buffer (gint nchannels, gint n_stereo_streams,
16 GstBuffer *buffer;
17 GstByteWriter bw;
18 + gboolean hdl = TRUE;
20 g_return_val_if_fail (nchannels > 0 && nchannels < 256, NULL);
21 g_return_val_if_fail (n_stereo_streams >= 0, NULL);
22 @@ -41,19 +42,22 @@ gst_opus_enc_create_id_buffer (gint nchannels, gint n_stereo_streams,
23 gst_byte_writer_init (&bw);
25 /* See http://wiki.xiph.org/OggOpus */
26 - gst_byte_writer_put_data (&bw, (const guint8 *) "OpusHead", 8);
27 - gst_byte_writer_put_uint8 (&bw, 0); /* version number */
28 - gst_byte_writer_put_uint8 (&bw, nchannels);
29 - gst_byte_writer_put_uint16_le (&bw, 0); /* pre-skip */
30 - gst_byte_writer_put_uint32_le (&bw, sample_rate);
31 - gst_byte_writer_put_uint16_le (&bw, 0); /* output gain */
32 - gst_byte_writer_put_uint8 (&bw, channel_mapping_family);
33 + hdl &= gst_byte_writer_put_data (&bw, (const guint8 *) "OpusHead", 8);
34 + hdl &= gst_byte_writer_put_uint8 (&bw, 0); /* version number */
35 + hdl &= gst_byte_writer_put_uint8 (&bw, nchannels);
36 + hdl &= gst_byte_writer_put_uint16_le (&bw, 0); /* pre-skip */
37 + hdl &= gst_byte_writer_put_uint32_le (&bw, sample_rate);
38 + hdl &= gst_byte_writer_put_uint16_le (&bw, 0); /* output gain */
39 + hdl &= gst_byte_writer_put_uint8 (&bw, channel_mapping_family);
40 if (channel_mapping_family > 0) {
41 - gst_byte_writer_put_uint8 (&bw, nchannels - n_stereo_streams);
42 - gst_byte_writer_put_uint8 (&bw, n_stereo_streams);
43 - gst_byte_writer_put_data (&bw, channel_mapping, nchannels);
44 + hdl &= gst_byte_writer_put_uint8 (&bw, nchannels - n_stereo_streams);
45 + hdl &= gst_byte_writer_put_uint8 (&bw, n_stereo_streams);
46 + hdl &= gst_byte_writer_put_data (&bw, channel_mapping, nchannels);
49 + if (!hdl)
50 + GST_WARNING ("Error creating header");
52 buffer = gst_byte_writer_reset_and_get_buffer (&bw);
54 GST_BUFFER_OFFSET (buffer) = 0;
55 --
56 1.7.10.4