WTV:move the common variable used by wtvdec.c and wtvenc.c to a new file wtv.h and wtv.c.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
zhentan feng 2011-05-01 21:12:02 +02:00 committed by Michael Niedermayer
parent 80a330679f
commit 5ab826c165
4 changed files with 88 additions and 29 deletions

View File

@ -299,7 +299,7 @@ OBJS-$(CONFIG_WEBM_MUXER) += matroskaenc.o matroska.o \
flacenc_header.o avlanguage.o flacenc_header.o avlanguage.o
OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o OBJS-$(CONFIG_WSAUD_DEMUXER) += westwood.o
OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o OBJS-$(CONFIG_WSVQA_DEMUXER) += westwood.o
OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o asf.o asfdec.o mpegts.o riff.o OBJS-$(CONFIG_WTV_DEMUXER) += wtvdec.o wtv.o asf.o asfdec.o mpegts.o riff.o
OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o OBJS-$(CONFIG_WV_DEMUXER) += wv.o apetag.o
OBJS-$(CONFIG_XA_DEMUXER) += xa.o OBJS-$(CONFIG_XA_DEMUXER) += xa.o
OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o OBJS-$(CONFIG_XWMA_DEMUXER) += xwma.o riff.o

45
libavformat/wtv.c Normal file
View File

@ -0,0 +1,45 @@
/*
* Windows Television (WTV)
* Copyright (c) 2010-2011 Peter Ross <pross@xvid.org>
*
* 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
*/
#include "wtv.h"
/* WTV GUIDs*/
const ff_asf_guid dir_entry_guid =
{0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D};
const ff_asf_guid wtv_guid =
{0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
const ff_asf_guid timestamp_guid =
{0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97};
const ff_asf_guid data_guid =
{0x95,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
const ff_asf_guid stream_guid =
{0xED,0xA4,0x13,0x23,0x2D,0xBF,0x4F,0x45,0xAD,0x8A,0xD9,0x5B,0xA7,0xF9,0x1F,0xEE};
const ff_asf_guid mediatype_audio =
{'a','u','d','s',FF_MEDIASUBTYPE_BASE_GUID};
const ff_asf_guid mediatype_video =
{'v','i','d','s',FF_MEDIASUBTYPE_BASE_GUID};
const ff_asf_guid format_none =
{0xD6,0x17,0x64,0x0F,0x18,0xC3,0xD0,0x11,0xA4,0x3F,0x00,0xA0,0xC9,0x22,0x31,0x96};
const AVCodecGuid video_guids[] = {
{CODEC_ID_MPEG2VIDEO, {0x26,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
{CODEC_ID_NONE}
};

41
libavformat/wtv.h Normal file
View File

@ -0,0 +1,41 @@
/*
* Windows Television (WTV)
* Copyright (c) 2010-2011 Peter Ross <pross@xvid.org>
*
* 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 AVFORMAT_WTV_H
#define AVFORMAT_WTV_H
#include "riff.h"
#include "asf.h"
#define WTV_SECTOR_BITS 12
#define WTV_SECTOR_SIZE (1 << WTV_SECTOR_BITS)
#define WTV_BIGSECTOR_BITS 18
extern const ff_asf_guid dir_entry_guid;
extern const ff_asf_guid wtv_guid;
extern const ff_asf_guid timestamp_guid;
extern const ff_asf_guid data_guid;
extern const ff_asf_guid stream_guid;
extern const ff_asf_guid mediatype_audio;
extern const ff_asf_guid mediatype_video;
extern const ff_asf_guid format_none;
extern const AVCodecGuid video_guids[];
#endif /* AVFORMAT_WTV_H */

View File

@ -29,8 +29,7 @@
#include "libavutil/intfloat_readwrite.h" #include "libavutil/intfloat_readwrite.h"
#include "avformat.h" #include "avformat.h"
#include "internal.h" #include "internal.h"
#include "riff.h" #include "wtv.h"
#include "asf.h"
#include "mpegts.h" #include "mpegts.h"
#include <strings.h> #include <strings.h>
@ -47,10 +46,6 @@
* *
*/ */
#define WTV_SECTOR_BITS 12
#define WTV_SECTOR_SIZE (1 << WTV_SECTOR_BITS)
#define WTV_BIGSECTOR_BITS 18
typedef struct { typedef struct {
AVIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */ AVIOContext *pb_filesystem; /** file system (AVFormatContext->pb) */
@ -241,9 +236,6 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int
return pb; return pb;
} }
static const ff_asf_guid dir_entry_guid =
{0x92,0xB7,0x74,0x91,0x59,0x70,0x70,0x44,0x88,0xDF,0x06,0x3B,0x82,0xCC,0x21,0x3D};
/** /**
* Open file using filename * Open file using filename
* @param[in] buf directory buffer * @param[in] buf directory buffer
@ -324,16 +316,8 @@ typedef struct {
} WtvContext; } WtvContext;
/* WTV GUIDs */ /* WTV GUIDs */
static const ff_asf_guid wtv_guid =
{0xB7,0xD8,0x00,0x20,0x37,0x49,0xDA,0x11,0xA6,0x4E,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
static const ff_asf_guid metadata_guid = static const ff_asf_guid metadata_guid =
{0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53}; {0x5A,0xFE,0xD7,0x6D,0xC8,0x1D,0x8F,0x4A,0x99,0x22,0xFA,0xB1,0x1C,0x38,0x14,0x53};
static const ff_asf_guid timestamp_guid =
{0x5B,0x05,0xE6,0x1B,0x97,0xA9,0x49,0x43,0x88,0x17,0x1A,0x65,0x5A,0x29,0x8A,0x97};
static const ff_asf_guid data_guid =
{0x95,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
static const ff_asf_guid stream_guid =
{0xED,0xA4,0x13,0x23,0x2D,0xBF,0x4F,0x45,0xAD,0x8A,0xD9,0x5B,0xA7,0xF9,0x1F,0xEE};
static const ff_asf_guid stream2_guid = static const ff_asf_guid stream2_guid =
{0xA2,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}; {0xA2,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D};
static const ff_asf_guid EVENTID_SubtitleSpanningEvent = static const ff_asf_guid EVENTID_SubtitleSpanningEvent =
@ -358,10 +342,6 @@ static const ff_asf_guid EVENTID_AudioTypeSpanningEvent =
/* Windows media GUIDs */ /* Windows media GUIDs */
/* Media types */ /* Media types */
static const ff_asf_guid mediatype_audio =
{'a','u','d','s',FF_MEDIASUBTYPE_BASE_GUID};
static const ff_asf_guid mediatype_video =
{'v','i','d','s',FF_MEDIASUBTYPE_BASE_GUID};
static const ff_asf_guid mediasubtype_mpeg1payload = static const ff_asf_guid mediasubtype_mpeg1payload =
{0x81,0xEB,0x36,0xE4,0x4F,0x52,0xCE,0x11,0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70}; {0x81,0xEB,0x36,0xE4,0x4F,0x52,0xCE,0x11,0x9F,0x53,0x00,0x20,0xAF,0x0B,0xA7,0x70};
static const ff_asf_guid mediatype_mpeg2_sections = static const ff_asf_guid mediatype_mpeg2_sections =
@ -392,13 +372,6 @@ static const ff_asf_guid format_videoinfo2 =
{0xA0,0x76,0x2A,0xF7,0x0A,0xEB,0xD0,0x11,0xAC,0xE4,0x00,0x00,0xC0,0xCC,0x16,0xBA}; {0xA0,0x76,0x2A,0xF7,0x0A,0xEB,0xD0,0x11,0xAC,0xE4,0x00,0x00,0xC0,0xCC,0x16,0xBA};
static const ff_asf_guid format_mpeg2_video = static const ff_asf_guid format_mpeg2_video =
{0xE3,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}; {0xE3,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA};
static const ff_asf_guid format_none =
{0xD6,0x17,0x64,0x0F,0x18,0xC3,0xD0,0x11,0xA4,0x3F,0x00,0xA0,0xC9,0x22,0x31,0x96};
static const AVCodecGuid video_guids[] = {
{CODEC_ID_MPEG2VIDEO, {0x26,0x80,0x6D,0xE0,0x46,0xDB,0xCF,0x11,0xB4,0xD1,0x00,0x80,0x5F,0x6C,0xBB,0xEA}},
{CODEC_ID_NONE}
};
static int read_probe(AVProbeData *p) static int read_probe(AVProbeData *p)
{ {