mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-26 23:12:44 +02:00
Origin commit data
------------------
Branch: master
Commit: 7d49d4d32b
Author: martii <m4rtii@gmx.de>
Date: 2014-04-08 (Tue, 08 Apr 2014)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
63 lines
1.9 KiB
C++
63 lines
1.9 KiB
C++
/*
|
|
* linuxdvb output/writer handling
|
|
*
|
|
* Copyright (C) 2010 konfetti (based on code from libeplayer2)
|
|
* Copyright (C) 2014 martii (based on code from libeplayer3)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <sys/uio.h>
|
|
#include <errno.h>
|
|
|
|
#include "misc.h"
|
|
#include "pes.h"
|
|
#include "writer.h"
|
|
|
|
class WriterAC3 : public Writer
|
|
{
|
|
public:
|
|
bool Write(int fd, AVFormatContext *avfc, AVStream *stream, AVPacket *packet, int64_t pts);
|
|
WriterAC3();
|
|
};
|
|
|
|
bool WriterAC3::Write(int fd, AVFormatContext * /* avfc */, AVStream * /* stream */, AVPacket *packet, int64_t pts)
|
|
{
|
|
if (fd < 0 || !packet)
|
|
return false;
|
|
|
|
unsigned char PesHeader[PES_MAX_HEADER_SIZE];
|
|
struct iovec iov[2];
|
|
|
|
iov[0].iov_base = PesHeader;
|
|
iov[0].iov_len = InsertPesHeader(PesHeader, packet->size, PRIVATE_STREAM_1_PES_START_CODE, pts, 0);
|
|
iov[1].iov_base = packet->data;
|
|
iov[1].iov_len = packet->size;
|
|
|
|
return writev(fd, iov, 2) > -1;
|
|
}
|
|
|
|
WriterAC3::WriterAC3()
|
|
{
|
|
Register(this, AV_CODEC_ID_AC3, AUDIO_ENCODING_AC3);
|
|
Register(this, AV_CODEC_ID_EAC3, AUDIO_ENCODING_AC3);
|
|
}
|
|
|
|
static WriterAC3 writer_ac3 __attribute__ ((init_priority (300)));
|