[FFmpeg-soc] [soc] libavsequencer [PATCH] Initial implementation of main AVSequencer public API header file

Sebastian Vater cdgs.basty at googlemail.com
Sun Jul 11 22:20:26 CEST 2010


Michael Niedermayer a écrit :
> On Sat, Jul 10, 2010 at 06:36:39PM +0200, Sebastian Vater wrote:
>   
>
>>  avsequencer.h |  321 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 321 insertions(+)
>> 35215816e65fe3c672d2abb5f39d4c7189e5d26f  avsequencer.h.patch
>> diff --git a/libavsequencer/avsequencer.h b/libavsequencer/avsequencer.h
>> new file mode 100644
>> index 0000000..fcff374
>> --- /dev/null
>> +++ b/libavsequencer/avsequencer.h
>> @@ -0,0 +1,321 @@
>> +/*
>> + * AVSequencer main header file which connects to AVFormat and AVCodec
>> + * Copyright (c) 2010 Sebastian Vater <cdgs.basty at googlemail.com>
>> + *
>> + * This file is part of FFmpeg.
>> + *
>> + * FFmpeg is free software; you can redistribute it and/or
>> + * modify it under the terms of the GNU Lesser General Public
>> + * License as published by the Free Software Foundation; either
>> + * version 2.1 of the License, or (at your option) any later version.
>> + *
>> + * FFmpeg is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> + * Lesser General Public License for more details.
>> + *
>> + * You should have received a copy of the GNU Lesser General Public
>> + * License along with FFmpeg; if not, write to the Free Software
>> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>> + */
>> +
>> +#ifndef AVSEQUENCER_AVSEQUENCER_H
>> +#define AVSEQUENCER_AVSEQUENCER_H
>> +
>> +#define LIBAVSEQUENCER_VERSION_MAJOR 0
>> +#define LIBAVSEQUENCER_VERSION_MINOR 0
>> +#define LIBAVSEQUENCER_VERSION_MICRO 0
>> +
>> +#define LIBAVSEQUENCER_VERSION_INT AV_VERSION_INT(LIBAVSEQUENCER_VERSION_MAJOR, \
>> +                                                  LIBAVSEQUENCER_VERSION_MINOR, \
>> +                                                  LIBAVSEQUENCER_VERSION_MICRO)
>> +#define LIBAVSEQUENCER_VERSION     AV_VERSION(LIBAVSEQUENCER_VERSION_MAJOR,   \
>> +                                              LIBAVSEQUENCER_VERSION_MINOR,   \
>> +                                              LIBAVSEQUENCER_VERSION_MICRO)
>> +#define LIBAVSEQUENCER_BUILD       LIBAVSEQUENCER_VERSION_INT
>> +
>> +#define LIBAVSEQUENCER_IDENT       "Lavsequencer" AV_STRINGIFY(LIBAVSEQUENCER_VERSION)
>> +
>> +/**
>> + * Returns LIBAVSEQUENCER_VERSION_INT constant.
>> + */
>> +unsigned avsequencer_version(void);
>> +
>> +/**
>> + * Returns the libavsequencer build-time configuration.
>> + */
>> +const char *avsequencer_configuration(void);
>> +
>> +/**
>> + * Returns the libavsequencer license.
>> + */
>> +const char *avsequencer_license(void);
>> +
>> +#include "libavformat/avformat.h"
>> +#include "libavcodec/avcodec.h"
>> +#include "libavsequencer/module.h"
>> +#include "libavsequencer/song.h"
>> +#include "libavsequencer/player.h"
>> +#include "libavutil/tree.h"
>> +
>> +/**
>> + * Mixer context structure which is used to describe certain features
>> + * of registered mixers to the sequencer context.
>> + * New fields can be added to the end with minor version bumps.
>> + * Removal, reordering and changes to existing fields require a major
>> + * version bump.
>> + */
>> +typedef struct AVSequencerMixerContext {
>>     
>
> There will be more than 1 mixer ?
>   

Of course, people are free to contribute more mixers, I will do for my
own, two integer only mixers, but if someone wants to do a
floating-point mixer, or maybe even a SID-chip mixer is possible to play
C64 SID files at a later time?

I thought it to be a nice idea to make that extendable as muxers/codecs.

>
> [...]
>   
>> +/**
>> + * Sequencer context structure which is the very root of the
>> + * sequencer. It manages all modules currently in memory, controls
>> + * the playback stuff and declares some customizable lookup tables
>> + * for very strange sound formats. Also all registered mixing engines
>> + * are stored in this structure.
>> + * New fields can be added to the end with minor version bumps.
>> + * Removal, reordering and changes to existing fields require a major
>> + * version bump.
>> + */
>> +typedef struct AVSequencerContext {
>> +    /** Associated decoder packet for this sequencer context.  */
>> +    AVPacket *pkt;
>> +
>> +    /** Current module used by current playback handler or NULL if
>> +       no module is currently being processed.  */
>> +    AVSequencerModule *player_module;
>> +
>> +    /** Current sub-song used by current playback handler or NULL
>> +       if no sub-song is currently being processed.  */
>> +    AVSequencerSong *player_song;
>> +
>> +    /** Current mixing engine used by current playback handler
>> +       or NULL if there is no module and sub-song being processed.  */
>> +    AVSequencerMixerData *player_mixer_data;
>> +
>>     
>
>   
>> +    /** Pointer to sine table for very fast sine calculation. Value
>> +       is sin(x)*32767 with one element being one degree.  */
>> +    int16_t *sine_lut;
>>     
>
> a static or global tables seems cleaner besides we alraedy have sin/cos
> tables tough they might not be of correct size or type
>   

See player.c sine_lut, if we have this already we can drop that out.
>
>   
>> +
>> +    /** Pointer to linear frequency table for non-Amiga slide modes.
>> +       Value is 65536*2^(x/3072).  */
>> +    uint16_t *linear_frequency_lut;
>> +
>> +    /** Pointer to note calculation frequency table. Value is
>> +       65536*2^(x/12). Please note that the pointer actually points to
>> +       the 2nd element. So the base C-4 is [0], -1. B-3 is [-1].  */
>> +    uint32_t *frequency_lut;
>>     
>
> is this supposed to be public api?
> it appears quite internal to me ...
>   

In case some trackers are out there, which use incompatible tables, they
can be replaced. I'm not sure right now, if they should be here or
handled internally by the lavf (de-)muxers. Anyway these can be set to
NULL in that case player.c internal tables are used. They don't have to
be filled out by users.

Updated avsequencer.h patch included.

-- 

Best regards,
                   :-) Basty/CDGS (-:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: avsequencer.h_20100711.patch
Type: text/x-patch
Size: 14382 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20100711/1c170d66/attachment.bin>


More information about the FFmpeg-soc mailing list