Mixxx

/home/maxime/Projets/Mixxx/1.10/mixxx/src/recording/encodervorbis.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                      encodervorbis.h  -  vorbis encoder for mixxx
00003                              -------------------
00004     copyright            : (C) 2007 by Wesley Stessens
00005                            (C) 1994 by Xiph.org (encoder example)
00006                            (C) 1994 Tobias Rafreider (shoutcast and recording fixes)
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef ENCODERVORBIS_H
00019 #define ENCODERVORBIS_H
00020 
00021 #include <QObject>
00022 #include "defs.h"
00023 #include "configobject.h"
00024 #include "encoder.h"
00025 #include "defs_recording.h"
00026 
00027 #include <vorbis/vorbisenc.h> // this also includes vorbis/codec.h
00028 
00029 class EngineAbstractRecord;
00030 class TrackInfoObject;
00031 
00032 class EncoderVorbis : public Encoder {
00033     Q_OBJECT
00034   public:
00035     EncoderVorbis(EngineAbstractRecord *engine=0);
00036     ~EncoderVorbis();
00037     int initEncoder(int bitrate);
00038     void encodeBuffer(const CSAMPLE *samples, const int size);
00039     void updateMetaData(char* artist, char* title, char* album);
00040     void flush();
00041 
00042   private:
00043     int getSerial();
00044     void initStream();
00045     bool metaDataHasChanged();
00046     //Call this method in conjunction with shoutcast streaming
00047     void writePage();
00048 
00049     bool m_bStreamInitialized;
00050     ogg_stream_state m_oggs;    /* take physical pages, weld into logical stream
00051                                  of packets */
00052     ogg_page m_oggpage;         /* Ogg bitstream page: contains Vorbis packets */
00053     ogg_packet m_oggpacket;     /* raw packet of data */
00054     vorbis_block m_vblock;      /* local working space for packet-to-PCM */
00055     vorbis_dsp_state m_vdsp;    /* central working space for packet-to-PCM */
00056     vorbis_info m_vinfo;        /* stores all static vorbis bitstream settings */
00057     vorbis_comment m_vcomment;  /* stores all user comments */
00058     bool m_header_write;
00059 
00060     EngineAbstractRecord *m_pEngine;
00061     TrackPointer m_pMetaData;
00062     char *m_metaDataTitle;
00063     char *m_metaDataArtist;
00064     char *m_metaDataAlbum;
00065     QFile m_file;
00066 
00067     ControlObjectThread* m_samplerate;
00068 
00069 };
00070 
00071 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines