2017-03-25 09:21:39 +00:00
|
|
|
/**
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
2017-03-25 13:29:29 +00:00
|
|
|
* Copyright (c) 2013-2017 OSSRS(winlin)
|
2017-03-25 09:21:39 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2015-01-18 14:51:07 +00:00
|
|
|
|
|
|
|
#ifndef SRS_KERNEL_AAC_HPP
|
|
|
|
#define SRS_KERNEL_AAC_HPP
|
|
|
|
|
|
|
|
#include <srs_core.hpp>
|
|
|
|
|
2015-10-01 05:04:28 +00:00
|
|
|
#if !defined(SRS_EXPORT_LIBRTMP)
|
|
|
|
|
2015-01-18 14:51:07 +00:00
|
|
|
#include <string>
|
|
|
|
|
2015-03-08 09:33:52 +00:00
|
|
|
#include <srs_kernel_codec.hpp>
|
|
|
|
|
2015-09-22 00:57:31 +00:00
|
|
|
class SrsBuffer;
|
2015-01-18 14:51:07 +00:00
|
|
|
class SrsFileWriter;
|
|
|
|
class SrsFileReader;
|
|
|
|
|
|
|
|
/**
|
2017-02-12 13:50:02 +00:00
|
|
|
* Transmux the RTMP packets to AAC stream.
|
|
|
|
*/
|
|
|
|
class SrsAacTransmuxer
|
2015-01-18 14:51:07 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
SrsFileWriter* _fs;
|
2015-01-18 16:05:12 +00:00
|
|
|
private:
|
2015-03-08 09:56:49 +00:00
|
|
|
SrsAacObjectType aac_object;
|
2015-01-18 16:05:12 +00:00
|
|
|
int8_t aac_sample_rate;
|
|
|
|
int8_t aac_channels;
|
|
|
|
bool got_sequence_header;
|
2015-01-18 14:51:07 +00:00
|
|
|
private:
|
2015-09-22 00:57:31 +00:00
|
|
|
SrsBuffer* tag_stream;
|
2015-01-18 14:51:07 +00:00
|
|
|
public:
|
2017-02-12 13:50:02 +00:00
|
|
|
SrsAacTransmuxer();
|
|
|
|
virtual ~SrsAacTransmuxer();
|
2015-01-18 14:51:07 +00:00
|
|
|
public:
|
|
|
|
/**
|
2017-03-25 09:21:39 +00:00
|
|
|
* initialize the underlayer file stream.
|
|
|
|
* @remark user can initialize multiple times to encode multiple aac files.
|
|
|
|
* @remark, user must free the fs, aac encoder never close/free it.
|
|
|
|
*/
|
2015-01-18 14:51:07 +00:00
|
|
|
virtual int initialize(SrsFileWriter* fs);
|
|
|
|
public:
|
|
|
|
/**
|
2017-03-25 09:21:39 +00:00
|
|
|
* write audio/video packet.
|
|
|
|
* @remark assert data is not NULL.
|
|
|
|
*/
|
2015-01-18 14:51:07 +00:00
|
|
|
virtual int write_audio(int64_t timestamp, char* data, int size);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2015-10-01 05:04:28 +00:00
|
|
|
#endif
|
|
|
|
|