ref: 7ff162d8b3dc3bd2f8cc6231d05a6ca4e93d7ff7
parent: f1d9657db2babcf5eb10e8c6098cb743ee83d3c9
author: Jean-Marc Valin <[email protected]>
date: Wed May 10 20:43:28 EDT 2017
Calling packet callback on headers too
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -431,10 +431,12 @@
p = oggp_get_packet_buffer(enc->oggp, 276);
int packet_size = opus_header_to_packet(&enc->header, p, 276);
oggp_commit_packet(enc->oggp, packet_size, 0, 0);
+ if (enc->packet_callback) enc->packet_callback(enc->streams->user_data, p, packet_size, 0);
oe_flush_page(enc);
p = oggp_get_packet_buffer(enc->oggp, enc->streams->comment_length);
memcpy(p, enc->streams->comment, enc->streams->comment_length);
oggp_commit_packet(enc->oggp, enc->streams->comment_length, 0, 0);
+ if (enc->packet_callback) enc->packet_callback(enc->streams->user_data, p, enc->streams->comment_length, 0);
oe_flush_page(enc);
#else
@@ -453,6 +455,7 @@
op.granulepos=0;
op.packetno=0;
ogg_stream_packetin(&enc->streams->os, &op);
+ if (enc->packet_callback) enc->packet_callback(enc->streams->user_data, op.packet, op.bytes, 0);
oe_flush_page(enc);
op.packet = (unsigned char *)enc->streams->comment;
@@ -462,6 +465,7 @@
op.granulepos = 0;
op.packetno = 1;
ogg_stream_packetin(&enc->streams->os, &op);
+ if (enc->packet_callback) enc->packet_callback(enc->streams->user_data, op.packet, op.bytes, 0);
oe_flush_page(enc);
#endif
}