vlc | branch: master | Rafaël Carré <fun...@videolan.org> | Sat May 10 18:05:50 2014 +0200| [c56ee724ceb7102b12316da2f8ca883de9a4a42c] | committer: Rafaël Carré
opus_header: opus_header_to_packet doesn't need to be exported > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c56ee724ceb7102b12316da2f8ca883de9a4a42c --- modules/codec/opus_header.c | 103 ++++++++++++++++++++++--------------------- modules/codec/opus_header.h | 1 - 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/modules/codec/opus_header.c b/modules/codec/opus_header.c index 7d48331..0c31af2 100644 --- a/modules/codec/opus_header.c +++ b/modules/codec/opus_header.c @@ -313,57 +313,7 @@ int opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header) return 0; } -int opus_write_header(uint8_t **p_extra, int *i_extra, OpusHeader *header) -{ - unsigned char header_data[100]; - const int packet_size = opus_header_to_packet(header, header_data, - sizeof(header_data)); - ogg_packet headers[2]; - headers[0].packet = header_data; - headers[0].bytes = packet_size; - headers[0].b_o_s = 1; - headers[0].e_o_s = 0; - headers[0].granulepos = 0; - headers[0].packetno = 0; - - size_t comments_length; - char *comments = comment_init(&comments_length); - if (!comments) - return 1; - if (comment_add(&comments, &comments_length, "ENCODER=", - "VLC media player")) - { - free(comments); - return 1; - } - - if (comment_pad(&comments, &comments_length)) - { - free(comments); - return 1; - } - - headers[1].packet = (unsigned char *) comments; - headers[1].bytes = comments_length; - headers[1].b_o_s = 0; - headers[1].e_o_s = 0; - headers[1].granulepos = 0; - headers[1].packetno = 1; - - for (unsigned i = 0; i < ARRAY_SIZE(headers); ++i) - { - if (xiph_AppendHeaders(i_extra, (void **) p_extra, - headers[i].bytes, headers[i].packet)) - { - *i_extra = 0; - *p_extra = NULL; - } - } - - return 0; -} - -int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len) +static int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len) { Packet p; unsigned char ch; @@ -416,3 +366,54 @@ int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len) return p.pos; } + +int opus_write_header(uint8_t **p_extra, int *i_extra, OpusHeader *header) +{ + unsigned char header_data[100]; + const int packet_size = opus_header_to_packet(header, header_data, + sizeof(header_data)); + ogg_packet headers[2]; + headers[0].packet = header_data; + headers[0].bytes = packet_size; + headers[0].b_o_s = 1; + headers[0].e_o_s = 0; + headers[0].granulepos = 0; + headers[0].packetno = 0; + + size_t comments_length; + char *comments = comment_init(&comments_length); + if (!comments) + return 1; + if (comment_add(&comments, &comments_length, "ENCODER=", + "VLC media player")) + { + free(comments); + return 1; + } + + if (comment_pad(&comments, &comments_length)) + { + free(comments); + return 1; + } + + headers[1].packet = (unsigned char *) comments; + headers[1].bytes = comments_length; + headers[1].b_o_s = 0; + headers[1].e_o_s = 0; + headers[1].granulepos = 0; + headers[1].packetno = 1; + + for (unsigned i = 0; i < ARRAY_SIZE(headers); ++i) + { + if (xiph_AppendHeaders(i_extra, (void **) p_extra, + headers[i].bytes, headers[i].packet)) + { + *i_extra = 0; + *p_extra = NULL; + } + } + + return 0; +} + diff --git a/modules/codec/opus_header.h b/modules/codec/opus_header.h index b1c5590..ed53055 100644 --- a/modules/codec/opus_header.h +++ b/modules/codec/opus_header.h @@ -45,7 +45,6 @@ typedef struct { } OpusHeader; int opus_header_parse(const unsigned char *header, int len, OpusHeader *h); -int opus_header_to_packet(const OpusHeader *h, unsigned char *packet, int len); int opus_prepare_header(unsigned channels, unsigned rate, OpusHeader *header); int opus_write_header(uint8_t **p_extra, int *i_extra, OpusHeader *header); _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits