annotate mpeg.h @ 4027:11fbf47f3e16 libavformat

matroskadec: fix index timestamps for some broken files fix issue697
author aurel
date Sat, 15 Nov 2008 15:34:51 +0000
parents 1b6245500d8c
children 77e0c7511d41
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
1 /*
2176
50322a49fa2b split mpeg ps and variants muxer and demuxer, I'll clean more in a few minutes, lpcm freq tab is left static const in mpeg.h for now until we have more code in common
bcoudurier
parents: 2164
diff changeset
2 * MPEG1/2 muxer and demuxer common defines
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
3 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
4 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
5 * This file is part of FFmpeg.
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
6 *
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
11 *
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
15 * Lesser General Public License for more details.
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
16 *
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
1358
0899bfe4105c Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 1332
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
896
edbe5c3717f9 Update licensing information: The FSF changed postal address.
diego
parents: 885
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
20 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
21
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3286
diff changeset
22 #ifndef AVFORMAT_MPEG_H
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3286
diff changeset
23 #define AVFORMAT_MPEG_H
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
24
3108
feeee985c74c include required headers for int64_t and AV_RB16()
aurel
parents: 2906
diff changeset
25 #include <stdint.h>
3286
6f61c3b36632 Use full path for #includes from another directory.
diego
parents: 3108
diff changeset
26 #include "libavutil/intreadwrite.h"
3108
feeee985c74c include required headers for int64_t and AV_RB16()
aurel
parents: 2906
diff changeset
27
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
28 #define PACK_START_CODE ((unsigned int)0x000001ba)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
29 #define SYSTEM_HEADER_START_CODE ((unsigned int)0x000001bb)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
30 #define SEQUENCE_END_CODE ((unsigned int)0x000001b7)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
31 #define PACKET_START_CODE_MASK ((unsigned int)0xffffff00)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
32 #define PACKET_START_CODE_PREFIX ((unsigned int)0x00000100)
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
33 #define ISO_11172_END_CODE ((unsigned int)0x000001b9)
885
da1d5db0ce5c COSMETICS: Remove all trailing whitespace.
diego
parents: 858
diff changeset
34
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
35 /* mpeg2 */
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
36 #define PROGRAM_STREAM_MAP 0x1bc
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
37 #define PRIVATE_STREAM_1 0x1bd
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
38 #define PADDING_STREAM 0x1be
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
39 #define PRIVATE_STREAM_2 0x1bf
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
40
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
41 #define AUDIO_ID 0xc0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
42 #define VIDEO_ID 0xe0
336
d75fd4c6ab62 primitive LPCM generator
bellard
parents: 335
diff changeset
43 #define AC3_ID 0x80
496
112057e05179 libdts support by (Benjamin Zores <ben at geexbox dot org>)
michael
parents: 483
diff changeset
44 #define DTS_ID 0x8a
336
d75fd4c6ab62 primitive LPCM generator
bellard
parents: 335
diff changeset
45 #define LPCM_ID 0xa0
789
411b75055a43 add support for muxing subtitles in mpeg-ps
aurel
parents: 783
diff changeset
46 #define SUB_ID 0x20
0
05318cf2e886 renamed libav to libavformat
bellard
parents:
diff changeset
47
722
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
48 #define STREAM_TYPE_VIDEO_MPEG1 0x01
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
49 #define STREAM_TYPE_VIDEO_MPEG2 0x02
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
50 #define STREAM_TYPE_AUDIO_MPEG1 0x03
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
51 #define STREAM_TYPE_AUDIO_MPEG2 0x04
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
52 #define STREAM_TYPE_PRIVATE_SECTION 0x05
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
53 #define STREAM_TYPE_PRIVATE_DATA 0x06
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
54 #define STREAM_TYPE_AUDIO_AAC 0x0f
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
55 #define STREAM_TYPE_VIDEO_MPEG4 0x10
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
56 #define STREAM_TYPE_VIDEO_H264 0x1b
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
57
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
58 #define STREAM_TYPE_AUDIO_AC3 0x81
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
59 #define STREAM_TYPE_AUDIO_DTS 0x8a
2443f9469df2 PSM support in MPEG-PS demuxer.
mru
parents: 708
diff changeset
60
356
72c7cf2f3a7a CONFIG_ENCODERS fix by (Ronald Bultje <rbultje at ronald dot bitfreak dot net>)
michael
parents: 355
diff changeset
61 static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
72c7cf2f3a7a CONFIG_ENCODERS fix by (Ronald Bultje <rbultje at ronald dot bitfreak dot net>)
michael
parents: 355
diff changeset
62
2906
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
63 /**
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
64 * Parse MPEG-PES five-byte timestamp
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
65 */
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
66 static inline int64_t ff_parse_pes_pts(uint8_t *buf) {
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
67 return (int64_t)(*buf & 0x0e) << 29 |
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
68 (AV_RB16(buf+1) >> 1) << 15 |
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
69 AV_RB16(buf+3) >> 1;
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
70 }
e5dfe3c96f3b Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it
ivo
parents: 2620
diff changeset
71
3852
1b6245500d8c Globally rename the header inclusion guard names.
stefano
parents: 3286
diff changeset
72 #endif /* AVFORMAT_MPEG_H */