/* * Copyright (C) 2005 Michael Ahlberg, Måns Rullgård * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #include <stdlib.h> #include "libavutil/avstring.h" #include "libavutil/base64.h" #include "libavutil/dict.h" #include "libavutil/mem.h" #include "libavcodec/bytestream.h" #include "libavcodec/vorbis_parser.h" #include "avformat.h" #include "demux.h" #include "flac_picture.h" #include "internal.h" #include "oggdec.h" #include "vorbiscomment.h" #include "replaygain.h" static int ogm_chapter(AVFormatContext *as, const uint8_t *key, const uint8_t *val) { … } int ff_vorbis_stream_comment(AVFormatContext *as, AVStream *st, const uint8_t *buf, int size) { … } /** * This function temporarily modifies the (const qualified) input buffer * and reverts its changes before return. The input buffer needs to have * at least one byte of padding. */ static int vorbis_parse_single_comment(AVFormatContext *as, AVDictionary **m, const uint8_t *buf, uint32_t size, int *updates, int parse_picture) { … } int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m, const uint8_t *buf, int size, int parse_picture) { … } /* * Parse the vorbis header * * Vorbis Identification header from Vorbis_I_spec.html#vorbis-spec-codec * [vorbis_version] = read 32 bits as unsigned integer | Not used * [audio_channels] = read 8 bit integer as unsigned | Used * [audio_sample_rate] = read 32 bits as unsigned integer | Used * [bitrate_maximum] = read 32 bits as signed integer | Not used yet * [bitrate_nominal] = read 32 bits as signed integer | Not used yet * [bitrate_minimum] = read 32 bits as signed integer | Used as bitrate * [blocksize_0] = read 4 bits as unsigned integer | Not Used * [blocksize_1] = read 4 bits as unsigned integer | Not Used * [framing_flag] = read one bit | Not Used */ struct oggvorbis_private { … }; static int fixup_vorbis_headers(AVFormatContext *as, struct oggvorbis_private *priv, uint8_t **buf) { … } static void vorbis_cleanup(AVFormatContext *s, int idx) { … } static int vorbis_update_metadata(AVFormatContext *s, int idx) { … } static int vorbis_header(AVFormatContext *s, int idx) { … } static int vorbis_packet(AVFormatContext *s, int idx) { … } const struct ogg_codec ff_vorbis_codec = …;