diff options
author | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2011-08-17 17:39:18 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2011-08-18 11:13:59 +0200 |
commit | 684b90ba74ed8997bd252ddef9f3bac8d5e3e245 (patch) | |
tree | 1a17665da804b1e55fd521ccf20b81d59607d5a0 /ext | |
parent | 3fe42b8e7e30d064ea60b649d681b0e0fcff5c1c (diff) |
oggmux: factor the header packet creation code
https://bugzilla.gnome.org/show_bug.cgi?id=656775
Diffstat (limited to 'ext')
-rw-r--r-- | ext/ogg/gstoggmux.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/ext/ogg/gstoggmux.c b/ext/ogg/gstoggmux.c index 60e92a009..40348acf0 100644 --- a/ext/ogg/gstoggmux.c +++ b/ext/ogg/gstoggmux.c @@ -1116,6 +1116,19 @@ gst_ogg_mux_set_header_on_caps (GstCaps * caps, GList * buffers) return caps; } +static void +create_header_packet (ogg_packet * packet, GstBuffer * buf, GstOggPadData * pad) +{ + packet->packet = GST_BUFFER_DATA (buf); + packet->bytes = GST_BUFFER_SIZE (buf); + packet->granulepos = 0; + /* mark BOS and packet number */ + packet->b_o_s = (pad->packetno == 0); + packet->packetno = pad->packetno++; + /* mark EOS */ + packet->e_o_s = 0; +} + /* * For each pad we need to write out one (small) header in one * page that allows decoders to identify the type of the stream. @@ -1196,14 +1209,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux) } /* create a packet from the buffer */ - packet.packet = GST_BUFFER_DATA (buf); - packet.bytes = GST_BUFFER_SIZE (buf); - packet.granulepos = 0; - /* mark BOS and packet number */ - packet.b_o_s = (pad->packetno == 0); - packet.packetno = pad->packetno++; - /* mark EOS */ - packet.e_o_s = 0; + create_header_packet (&packet, buf, pad); /* swap the packet in */ ogg_stream_packetin (&pad->map.stream, &packet); @@ -1263,14 +1269,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux) hwalk = hwalk->next; /* create a packet from the buffer */ - packet.packet = GST_BUFFER_DATA (buf); - packet.bytes = GST_BUFFER_SIZE (buf); - packet.granulepos = 0; - /* mark BOS and packet number */ - packet.b_o_s = (pad->packetno == 0); - packet.packetno = pad->packetno++; - /* mark EOS */ - packet.e_o_s = 0; + create_header_packet (&packet, buf, pad); /* swap the packet in */ ogg_stream_packetin (&pad->map.stream, &packet); |