libavformat/spdif.h
Go to the documentation of this file.
00001 /*
00002  * IEC 61937 common header
00003  * Copyright (c) 2009 Bartlomiej Wolowiec
00004  *
00005  * This file is part of Libav.
00006  *
00007  * Libav is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * Libav is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with Libav; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #ifndef AVFORMAT_SPDIF_H
00023 #define AVFORMAT_SPDIF_H
00024 
00025 #include <stdint.h>
00026 
00027 #define SYNCWORD1 0xF872
00028 #define SYNCWORD2 0x4E1F
00029 #define BURST_HEADER_SIZE 0x8
00030 
00031 enum IEC61937DataType {
00032     IEC61937_AC3                = 0x01,          
00033     IEC61937_MPEG1_LAYER1       = 0x04,          
00034     IEC61937_MPEG1_LAYER23      = 0x05,          
00035     IEC61937_MPEG2_EXT          = 0x06,          
00036     IEC61937_MPEG2_AAC          = 0x07,          
00037     IEC61937_MPEG2_LAYER1_LSF   = 0x08,          
00038     IEC61937_MPEG2_LAYER2_LSF   = 0x09,          
00039     IEC61937_MPEG2_LAYER3_LSF   = 0x0A,          
00040     IEC61937_DTS1               = 0x0B,          
00041     IEC61937_DTS2               = 0x0C,          
00042     IEC61937_DTS3               = 0x0D,          
00043     IEC61937_ATRAC              = 0x0E,          
00044     IEC61937_ATRAC3             = 0x0F,          
00045     IEC61937_ATRACX             = 0x10,          
00046     IEC61937_DTSHD              = 0x11,          
00047     IEC61937_WMAPRO             = 0x12,          
00048     IEC61937_MPEG2_AAC_LSF_2048 = 0x13,          
00049     IEC61937_MPEG2_AAC_LSF_4096 = 0x13 | 0x20,   
00050     IEC61937_EAC3               = 0x15,          
00051     IEC61937_TRUEHD             = 0x16,          
00052 };
00053 
00054 static const uint16_t spdif_mpeg_pkt_offset[2][3] = {
00055     //LAYER1  LAYER2  LAYER3
00056     { 3072,    9216,   4608 }, // MPEG2 LSF
00057     { 1536,    4608,   4608 }, // MPEG1
00058 };
00059 
00060 void ff_spdif_bswap_buf16(uint16_t *dst, const uint16_t *src, int w);
00061 
00062 #endif /* AVFORMAT_SPDIF_H */