Mercurial > mplayer.hg
annotate libmpdemux/demux_mpg.c @ 17606:9e27eb13ef43
support openbsd/zaurus aswell
author | alex |
---|---|
date | Sun, 12 Feb 2006 14:17:39 +0000 |
parents | 6c541a8421ca |
children | b849a99cdc3c |
rev | line source |
---|---|
1 | 1 // MPG/VOB file parser for DEMUXER v2.5 by A'rpi/ESP-team |
2 | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
3 #include <stdio.h> |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
4 #include <stdlib.h> |
1430 | 5 #include <unistd.h> |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
6 |
1567 | 7 #include "config.h" |
8 #include "mp_msg.h" | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1735
diff
changeset
|
9 #include "help_mp.h" |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
10 |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
11 #include "stream.h" |
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
12 #include "demuxer.h" |
1466 | 13 #include "parse_es.h" |
2338 | 14 #include "stheader.h" |
4711 | 15 #include "mp3_hdr.h" |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
16 |
524
9105fc95636c
A fast'n'ugly hack to correct DVD VOB playback problems
lgb
parents:
501
diff
changeset
|
17 //#define MAX_PS_PACKETSIZE 2048 |
501 | 18 #define MAX_PS_PACKETSIZE (224*1024) |
19 | |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
20 #define UNKNOWN 0 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
21 #define VIDEO_MPEG1 0x10000001 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
22 #define VIDEO_MPEG2 0x10000002 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
23 #define VIDEO_MPEG4 0x10000004 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
24 #define VIDEO_H264 0x10000005 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
25 #define AUDIO_MP2 0x50 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
26 #define AUDIO_A52 0x2000 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
27 #define AUDIO_LPCM_BE 0x10001 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
28 #define AUDIO_AAC mmioFOURCC('M', 'P', '4', 'A') |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
29 |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
30 typedef struct mpg_demuxer { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
31 float last_pts; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
32 float final_pts; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
33 int has_valid_timestamps; |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
34 unsigned int es_map[0x40]; //es map of stream types (associated to the pes id) from 0xb0 to 0xef |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
35 int num_a_streams; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
36 int a_stream_ids[MAX_A_STREAMS]; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
37 } mpg_demuxer_t; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
38 |
17286
b0046966ab82
don't reset dvdsub->id unless -slang is specified; assign default sub stream id when demux->sub->id is -1 (autodetect)
nicodvb
parents:
16877
diff
changeset
|
39 extern char* dvdsub_lang; |
547 | 40 static int mpeg_pts_error=0; |
41 | |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
42 static int parse_psm(demuxer_t *demux, int len) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
43 unsigned char c, id, type; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
44 unsigned int plen, prog_len, es_map_len; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
45 mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
46 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
47 mp_dbg(MSGT_DEMUX,MSGL_V, "PARSE_PSM, len=%d\n", len); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
48 if(! len) |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
49 return 0; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
50 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
51 c = stream_read_char(demux->stream); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
52 if(! (c & 0x80)) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
53 stream_skip(demux->stream, len - 1); //not yet valid, discard |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
54 return 0; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
55 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
56 stream_skip(demux->stream, 1); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
57 prog_len = stream_read_word(demux->stream); //length of program descriptors |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
58 stream_skip(demux->stream, prog_len); //.. that we ignore |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
59 es_map_len = stream_read_word(demux->stream); //length of elementary streams map |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
60 es_map_len = min(es_map_len, len - prog_len - 8); //sanity check |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
61 while(es_map_len > 0) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
62 type = stream_read_char(demux->stream); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
63 id = stream_read_char(demux->stream); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
64 if(id >= 0xB0 && id <= 0xEF && priv) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
65 int idoffset = id - 0xB0; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
66 switch(type) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
67 case 0x1: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
68 priv->es_map[idoffset] = VIDEO_MPEG1; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
69 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
70 case 0x2: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
71 priv->es_map[idoffset] = VIDEO_MPEG2; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
72 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
73 case 0x3: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
74 case 0x4: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
75 priv->es_map[idoffset] = AUDIO_MP2; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
76 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
77 case 0x0f: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
78 case 0x11: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
79 priv->es_map[idoffset] = AUDIO_AAC; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
80 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
81 case 0x10: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
82 priv->es_map[idoffset] = VIDEO_MPEG4; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
83 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
84 case 0x1b: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
85 priv->es_map[idoffset] = VIDEO_H264; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
86 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
87 case 0x81: |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
88 priv->es_map[idoffset] = AUDIO_A52; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
89 break; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
90 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
91 mp_dbg(MSGT_DEMUX,MSGL_V, "PSM ES, id=0x%x, type=%x, stype: %x\n", id, type, priv->es_map[idoffset]); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
92 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
93 plen = stream_read_word(demux->stream); //length of elementary stream descriptors |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
94 plen = min(plen, es_map_len); //sanity check |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
95 stream_skip(demux->stream, plen); //skip descriptors for now |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
96 es_map_len -= 4 + plen; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
97 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
98 stream_skip(demux->stream, 4); //skip crc32 |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
99 return 1; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
100 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
101 |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
102 /// Open an mpg physical stream |
16175 | 103 static demuxer_t* demux_mpg_open(demuxer_t* demuxer) { |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
104 stream_t *s = demuxer->stream; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
105 off_t pos = stream_tell(s); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
106 off_t end_seq_start = demuxer->movi_end-500000; // 500000 is a wild guess |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
107 float half_pts = 0.0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
108 mpg_demuxer_t* mpg_d; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
109 |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
110 if (!ds_fill_buffer(demuxer->video)) return 0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
111 mpg_d = (mpg_demuxer_t*)calloc(1,sizeof(mpg_demuxer_t)); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
112 demuxer->priv = mpg_d; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
113 mpg_d->final_pts = 0.0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
114 mpg_d->has_valid_timestamps = 1; |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
115 mpg_d->num_a_streams = 0; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
116 if (demuxer->seekable && stream_tell(demuxer->stream) < end_seq_start) { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
117 stream_seek(s,(pos + end_seq_start / 2)); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
118 while ((!s->eof) && ds_fill_buffer(demuxer->video) && half_pts == 0.0) { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
119 half_pts = mpg_d->last_pts; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
120 } |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
121 stream_seek(s,end_seq_start); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
122 while ((!s->eof) && ds_fill_buffer(demuxer->video)) { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
123 if (mpg_d->final_pts < mpg_d->last_pts) mpg_d->final_pts = mpg_d->last_pts; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
124 } |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
125 // educated guess about validity of timestamps |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
126 if (mpg_d->final_pts > 3 * half_pts || mpg_d->final_pts < 1.5 * half_pts) { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
127 mpg_d->has_valid_timestamps = 0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
128 } |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
129 ds_free_packs(demuxer->audio); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
130 ds_free_packs(demuxer->video); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
131 demuxer->stream->eof=0; // clear eof flag |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
132 demuxer->video->eof=0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
133 demuxer->audio->eof=0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
134 |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
135 stream_seek(s,pos); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
136 ds_fill_buffer(demuxer->video); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
137 } |
16175 | 138 return demuxer; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
139 } |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
140 |
16175 | 141 static void demux_close_mpg(demuxer_t* demuxer) { |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
142 mpg_demuxer_t* mpg_d = demuxer->priv; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
143 if (mpg_d) free(mpg_d); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
144 } |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
145 |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
146 |
1 | 147 static unsigned int read_mpeg_timestamp(stream_t *s,int c){ |
148 int d,e; | |
149 unsigned int pts; | |
150 d=stream_read_word(s); | |
151 e=stream_read_word(s); | |
547 | 152 if( ((c&1)!=1) || ((d&1)!=1) || ((e&1)!=1) ){ |
153 ++mpeg_pts_error; | |
154 return 0; // invalid pts | |
155 } | |
1 | 156 pts=(((c>>1)&7)<<30)|((d>>1)<<15)|(e>>1); |
1567 | 157 mp_dbg(MSGT_DEMUX,MSGL_DBG3,"{%d}",pts); |
1 | 158 return pts; |
159 } | |
160 | |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
161 static void new_audio_stream(demuxer_t *demux, int aid){ |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
162 if(!demux->a_streams[aid]){ |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
163 mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demux->priv; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
164 sh_audio_t* sh_a; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
165 new_sh_audio(demux,aid); |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
166 sh_a = (sh_audio_t*)demux->a_streams[aid]; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
167 switch(aid & 0xE0){ // 1110 0000 b (high 3 bit: type low 5: id) |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
168 case 0x00: sh_a->format=0x50;break; // mpeg |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
169 case 0xA0: sh_a->format=0x10001;break; // dvd pcm |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
170 case 0x80: if((aid & 0xF8) == 0x88) sh_a->format=0x2001;//dts |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
171 else sh_a->format=0x2000;break; // ac3 |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
172 } |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
173 if (mpg_d) mpg_d->a_stream_ids[mpg_d->num_a_streams++] = aid; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
174 } |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
175 if(demux->audio->id==-1) demux->audio->id=aid; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
176 } |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
177 |
1 | 178 static int demux_mpg_read_packet(demuxer_t *demux,int id){ |
179 int d; | |
180 int len; | |
181 unsigned char c=0; | |
182 unsigned int pts=0; | |
183 unsigned int dts=0; | |
184 demux_stream_t *ds=NULL; | |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
185 mpg_demuxer_t *priv = (mpg_demuxer_t *) demux->priv; |
1 | 186 |
1567 | 187 mp_dbg(MSGT_DEMUX,MSGL_DBG3,"demux_read_packet: %X\n",id); |
1 | 188 |
536 | 189 // if(id==0x1F0){ |
190 // demux->synced=0; // force resync after 0x1F0 | |
191 // return -1; | |
192 //} | |
501 | 193 |
1 | 194 // if(id==0x1BA) packet_start_pos=stream_tell(demux->stream); |
501 | 195 if(id<0x1BC || id>=0x1F0) return -1; |
1 | 196 if(id==0x1BE) return -1; // padding stream |
197 if(id==0x1BF) return -1; // private2 | |
198 | |
199 len=stream_read_word(demux->stream); | |
1567 | 200 mp_dbg(MSGT_DEMUX,MSGL_DBG3,"PACKET len=%d",len); |
536 | 201 // if(len==62480){ demux->synced=0;return -1;} /* :) */ |
501 | 202 if(len==0 || len>MAX_PS_PACKETSIZE){ |
1567 | 203 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"Invalid PS packet len: %d\n",len); |
501 | 204 return -2; // invalid packet !!!!!! |
205 } | |
1 | 206 |
547 | 207 mpeg_pts_error=0; |
208 | |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
209 if(id==0x1BC) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
210 parse_psm(demux, len); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
211 return 0; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
212 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
213 |
1 | 214 while(len>0){ // Skip stuFFing bytes |
215 c=stream_read_char(demux->stream);--len; | |
216 if(c!=0xFF)break; | |
217 } | |
218 if((c>>6)==1){ // Read (skip) STD scale & size value | |
219 // printf(" STD_scale=%d",(c>>5)&1); | |
220 d=((c&0x1F)<<8)|stream_read_char(demux->stream); | |
221 len-=2; | |
222 // printf(" STD_size=%d",d); | |
223 c=stream_read_char(demux->stream); | |
224 } | |
225 // Read System-1 stream timestamps: | |
226 if((c>>4)==2){ | |
227 pts=read_mpeg_timestamp(demux->stream,c); | |
228 len-=4; | |
229 } else | |
230 if((c>>4)==3){ | |
231 pts=read_mpeg_timestamp(demux->stream,c); | |
232 c=stream_read_char(demux->stream); | |
233 if((c>>4)!=1) pts=0; //printf("{ERROR4}"); | |
234 dts=read_mpeg_timestamp(demux->stream,c); | |
235 len-=4+1+4; | |
236 } else | |
237 if((c>>6)==2){ | |
238 int pts_flags; | |
239 int hdrlen; | |
240 // System-2 (.VOB) stream: | |
492 | 241 if((c>>4)&3) { |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1735
diff
changeset
|
242 mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_EncryptedVOB); |
492 | 243 } |
1 | 244 c=stream_read_char(demux->stream); pts_flags=c>>6; |
245 c=stream_read_char(demux->stream); hdrlen=c; | |
246 len-=2; | |
1567 | 247 mp_dbg(MSGT_DEMUX,MSGL_DBG3," hdrlen=%d (len=%d)",hdrlen,len); |
248 if(hdrlen>len){ mp_msg(MSGT_DEMUX,MSGL_V,"demux_mpg: invalid header length \n"); return -1;} | |
7671 | 249 if(pts_flags==2 && hdrlen>=5){ |
1 | 250 c=stream_read_char(demux->stream); |
251 pts=read_mpeg_timestamp(demux->stream,c); | |
252 len-=5;hdrlen-=5; | |
253 } else | |
7671 | 254 if(pts_flags==3 && hdrlen>=10){ |
1 | 255 c=stream_read_char(demux->stream); |
256 pts=read_mpeg_timestamp(demux->stream,c); | |
257 c=stream_read_char(demux->stream); | |
258 dts=read_mpeg_timestamp(demux->stream,c); | |
259 len-=10;hdrlen-=10; | |
260 } | |
261 len-=hdrlen; | |
262 if(hdrlen>0) stream_skip(demux->stream,hdrlen); // skip header bytes | |
263 | |
264 //============== DVD Audio sub-stream ====================== | |
265 if(id==0x1BD){ | |
15815
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
266 int aid, rawa52 = 0; |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
267 off_t tmppos; |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
268 unsigned int tmp; |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
269 |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
270 tmppos = stream_tell(demux->stream); |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
271 tmp = stream_read_word(demux->stream); |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
272 stream_seek(demux->stream, tmppos); |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
273 /// vdr stores A52 without the 4 header bytes, so we have to check this condition first |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
274 if(tmp == 0x0B77) { |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
275 aid = 128; |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
276 rawa52 = 1; |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
277 } |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
278 else { |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
279 aid=stream_read_char(demux->stream);--len; |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
280 if(len<3) return -1; // invalid audio packet |
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
281 } |
552 | 282 |
283 // AID: | |
284 // 0x20..0x3F subtitle | |
285 // 0x80..0x9F AC3 audio | |
286 // 0xA0..0xBF PCM audio | |
287 | |
288 if((aid & 0xE0) == 0x20){ | |
289 // subtitle: | |
290 aid&=0x1F; | |
426 | 291 |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
292 if(!demux->s_streams[aid]){ |
1567 | 293 mp_msg(MSGT_DEMUX,MSGL_V,"==> Found subtitle: %d\n",aid); |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
294 demux->s_streams[aid]=1; |
552 | 295 } |
296 | |
17286
b0046966ab82
don't reset dvdsub->id unless -slang is specified; assign default sub stream id when demux->sub->id is -1 (autodetect)
nicodvb
parents:
16877
diff
changeset
|
297 if(demux->sub->id > -1) |
b0046966ab82
don't reset dvdsub->id unless -slang is specified; assign default sub stream id when demux->sub->id is -1 (autodetect)
nicodvb
parents:
16877
diff
changeset
|
298 demux->sub->id &= 0x1F; |
b0046966ab82
don't reset dvdsub->id unless -slang is specified; assign default sub stream id when demux->sub->id is -1 (autodetect)
nicodvb
parents:
16877
diff
changeset
|
299 if(!dvdsub_lang && demux->sub->id == -1) |
b0046966ab82
don't reset dvdsub->id unless -slang is specified; assign default sub stream id when demux->sub->id is -1 (autodetect)
nicodvb
parents:
16877
diff
changeset
|
300 demux->sub->id = aid; |
552 | 301 if(demux->sub->id==aid){ |
302 ds=demux->sub; | |
303 } | |
304 | |
3955 | 305 } else if((aid & 0xC0) == 0x80 || (aid & 0xE0) == 0x00) { |
552 | 306 |
307 // aid=128+(aid&0x7F); | |
308 // aid=0x80..0xBF | |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
309 new_audio_stream(demux, aid); |
426 | 310 if(demux->audio->id==aid){ |
7671 | 311 int type; |
426 | 312 ds=demux->audio; |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
313 if(!ds->sh) ds->sh=demux->a_streams[aid]; |
1 | 314 // READ Packet: Skip additional audio header data: |
15815
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
315 if(!rawa52) { |
7671 | 316 c=stream_read_char(demux->stream);//num of frames |
317 type=stream_read_char(demux->stream);//startpos hi | |
318 type=(type<<8)|stream_read_char(demux->stream);//startpos lo | |
319 // printf("\r[%02X][%04X]",c,type); | |
1 | 320 len-=3; |
15815
488f31bd127e
support raw ac3 (in private pes packets without the usual dvd 4 bytes substream header). Patch by Matthias Scharzott
nicodvb
parents:
15670
diff
changeset
|
321 } |
7671 | 322 if((aid&0xE0)==0xA0 && len>=3){ |
323 unsigned char* hdr; | |
324 // save audio header as codecdata! | |
325 if(!((sh_audio_t*)(ds->sh))->codecdata_len){ | |
326 ((sh_audio_t*)(ds->sh))->codecdata=malloc(3); | |
327 ((sh_audio_t*)(ds->sh))->codecdata_len=3; | |
328 } | |
329 hdr=((sh_audio_t*)(ds->sh))->codecdata; | |
330 // read LPCM header: | |
331 // emphasis[1], mute[1], rvd[1], frame number[5]: | |
332 hdr[0]=stream_read_char(demux->stream); | |
333 // printf(" [%01X:%02d]",c>>5,c&31); | |
334 // quantization[2],freq[2],rvd[1],channels[3] | |
335 hdr[1]=stream_read_char(demux->stream); | |
336 // printf("[%01X:%01X] ",c>>4,c&15); | |
337 // dynamic range control (0x80=off): | |
338 hdr[2]=stream_read_char(demux->stream); | |
339 // printf("[%02X] ",c); | |
340 len-=3; | |
341 if(len<=0) mp_msg(MSGT_DEMUX,MSGL_V,"End of packet while searching for PCM header\n"); | |
1 | 342 } |
7671 | 343 // printf(" \n"); |
552 | 344 } // if(demux->audio->id==aid) |
345 | |
1567 | 346 } else mp_msg(MSGT_DEMUX,MSGL_V,"Unknown 0x1BD substream: 0x%02X \n",aid); |
552 | 347 |
348 } //if(id==0x1BD) | |
1 | 349 |
350 } else { | |
539 | 351 if(c!=0x0f){ |
1567 | 352 mp_msg(MSGT_DEMUX,MSGL_V," {ERROR5,c=%d} \n",c); |
539 | 353 return -1; // invalid packet !!!!!! |
354 } | |
1 | 355 } |
1567 | 356 if(mpeg_pts_error) mp_msg(MSGT_DEMUX,MSGL_V," {PTS_err:%d} \n",mpeg_pts_error); |
357 mp_dbg(MSGT_DEMUX,MSGL_DBG3," => len=%d\n",len); | |
1 | 358 |
501 | 359 // if(len<=0 || len>MAX_PS_PACKETSIZE) return -1; // Invalid packet size |
360 if(len<=0 || len>MAX_PS_PACKETSIZE){ | |
1567 | 361 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"Invalid PS data len: %d\n",len); |
501 | 362 return -1; // invalid packet !!!!!! |
363 } | |
1 | 364 |
365 if(id>=0x1C0 && id<=0x1DF){ | |
366 // mpeg audio | |
367 int aid=id-0x1C0; | |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
368 new_audio_stream(demux, aid); |
1 | 369 if(demux->audio->id==aid){ |
370 ds=demux->audio; | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
371 if(!ds->sh) ds->sh=demux->a_streams[aid]; |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
372 if(priv && ds->sh) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
373 sh_audio_t *sh = (sh_audio_t *)ds->sh; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
374 if(priv->es_map[id - 0x1B0]) |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
375 sh->format = priv->es_map[id - 0x1B0]; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
376 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"ASSIGNED TO STREAM %d CODEC %x\n", id, priv->es_map[id - 0x1B0]); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
377 } |
1 | 378 } |
379 } else | |
380 if(id>=0x1E0 && id<=0x1EF){ | |
381 // mpeg video | |
382 int aid=id-0x1E0; | |
1289 | 383 if(!demux->v_streams[aid]) new_sh_video(demux,aid); |
1 | 384 if(demux->video->id==-1) demux->video->id=aid; |
426 | 385 if(demux->video->id==aid){ |
386 ds=demux->video; | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
554
diff
changeset
|
387 if(!ds->sh) ds->sh=demux->v_streams[aid]; |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
388 if(priv && ds->sh) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
389 sh_video_t *sh = (sh_video_t *)ds->sh; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
390 if(priv->es_map[id - 0x1B0]) { |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
391 sh->format = priv->es_map[id - 0x1B0]; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
392 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"ASSIGNED TO STREAM %d CODEC %x\n", id, priv->es_map[id - 0x1B0]); |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
393 } |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
394 } |
426 | 395 } |
1 | 396 } |
397 | |
398 if(ds){ | |
1567 | 399 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Read %d data bytes from packet %04X\n",len,id); |
1 | 400 // printf("packet start = 0x%X \n",stream_tell(demux->stream)-packet_start_pos); |
1735 | 401 ds_read_packet(ds,demux->stream,len,pts/90000.0f,demux->filepos,0); |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
402 if (demux->priv) ((mpg_demuxer_t*)demux->priv)->last_pts = pts/90000.0f; |
554 | 403 // if(ds==demux->sub) parse_dvdsub(ds->last->buffer,ds->last->len); |
1 | 404 return 1; |
405 } | |
1567 | 406 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"DEMUX_MPG: Skipping %d data bytes from packet %04X\n",len,id); |
536 | 407 if(len<=2356) stream_skip(demux->stream,len); |
1 | 408 return 0; |
409 } | |
410 | |
15670 | 411 static int num_elementary_packets100=0; |
412 static int num_elementary_packets101=0; | |
413 static int num_elementary_packets12x=0; | |
414 static int num_elementary_packets1B6=0; | |
415 static int num_elementary_packetsPES=0; | |
416 static int num_h264_slice=0; //combined slice | |
417 static int num_h264_dpa=0; //DPA Slice | |
418 static int num_h264_dpb=0; //DPB Slice | |
419 static int num_h264_dpc=0; //DPC Slice | |
420 static int num_h264_idr=0; //IDR Slice | |
421 static int num_h264_sps=0; | |
422 static int num_h264_pps=0; | |
423 | |
424 static int num_mp3audio_packets=0; | |
425 | |
16175 | 426 static int demux_mpg_probe(demuxer_t *demuxer) { |
15670 | 427 int pes=1; |
428 int tmp; | |
429 off_t tmppos; | |
430 int file_format = DEMUXER_TYPE_UNKNOWN; | |
431 | |
432 tmppos=stream_tell(demuxer->stream); | |
433 tmp=stream_read_dword(demuxer->stream); | |
434 if(tmp==0x1E0 || tmp==0x1C0) { | |
435 tmp=stream_read_word(demuxer->stream); | |
436 if(tmp>1 && tmp<=2048) pes=0; // demuxer->synced=3; // PES... | |
437 } | |
438 stream_seek(demuxer->stream,tmppos); | |
439 | |
440 num_elementary_packets100=0; | |
441 num_elementary_packets101=0; | |
442 num_elementary_packets1B6=0; | |
443 num_elementary_packets12x=0; | |
444 num_elementary_packetsPES=0; | |
445 num_h264_slice=0; //combined slice | |
446 num_h264_dpa=0; //DPA Slice | |
447 num_h264_dpb=0; //DPB Slice | |
448 num_h264_dpc=0; //DPC Slice | |
449 num_h264_idr=0; //IDR Slice | |
450 num_h264_sps=0; | |
451 num_h264_pps=0; | |
452 num_mp3audio_packets=0; | |
9824 | 453 |
15670 | 454 if(demux_mpg_open(demuxer)) |
455 file_format=DEMUXER_TYPE_MPEG_PS; | |
456 else { | |
457 mp_msg(MSGT_DEMUX,MSGL_V,"MPEG packet stats: p100: %d p101: %d p1B6: %d p12x: %d sli: %d a: %d b: %d c: %d idr: %d sps: %d pps: %d PES: %d MP3: %d, synced: %d\n", | |
458 num_elementary_packets100,num_elementary_packets101, | |
459 num_elementary_packets1B6,num_elementary_packets12x, | |
460 num_h264_slice, num_h264_dpa, | |
461 num_h264_dpb, num_h264_dpc=0, | |
462 num_h264_idr, num_h264_sps=0, | |
463 num_h264_pps, | |
464 num_elementary_packetsPES,num_mp3audio_packets, demuxer->synced); | |
465 | |
466 //MPEG packet stats: p100: 458 p101: 458 PES: 0 MP3: 1103 (.m2v) | |
467 if(num_mp3audio_packets>50 && num_mp3audio_packets>2*num_elementary_packets100 | |
468 && abs(num_elementary_packets100-num_elementary_packets101)>2) | |
469 return file_format; | |
470 | |
471 // some hack to get meaningfull error messages to our unhappy users: | |
472 if(num_elementary_packets100>=2 && num_elementary_packets101>=2 && | |
473 abs(num_elementary_packets101+8-num_elementary_packets100)<16) { | |
474 if(num_elementary_packetsPES>=4 && num_elementary_packetsPES>=num_elementary_packets100-4) { | |
475 return file_format; | |
476 } | |
477 file_format=DEMUXER_TYPE_MPEG_ES; // <-- hack is here :) | |
478 } else | |
479 #if 1 | |
480 // fuzzy mpeg4-es detection. do NOT enable without heavy testing of mpeg formats detection! | |
481 if(num_elementary_packets1B6>3 && num_elementary_packets12x>=1 && | |
482 num_elementary_packetsPES==0 && num_elementary_packets100<=num_elementary_packets12x && | |
483 demuxer->synced<2) { | |
484 file_format=DEMUXER_TYPE_MPEG4_ES; | |
485 } else | |
486 #endif | |
487 #if 1 | |
488 // fuzzy h264-es detection. do NOT enable without heavy testing of mpeg formats detection! | |
489 if((num_h264_slice>3 || (num_h264_dpa>3 && num_h264_dpb>3 && num_h264_dpc>3)) && | |
490 /* FIXME num_h264_sps>=1 && */ num_h264_pps>=1 && num_h264_idr>=1 && | |
491 num_elementary_packets1B6==0 && num_elementary_packetsPES==0 && | |
492 demuxer->synced<2) { | |
493 file_format=DEMUXER_TYPE_H264_ES; | |
494 } else | |
495 #endif | |
496 { | |
497 if(demuxer->synced==2) | |
498 mp_msg(MSGT_DEMUXER,MSGL_ERR,"MPEG: " MSGTR_MissingVideoStreamBug); | |
499 else | |
500 mp_msg(MSGT_DEMUXER,MSGL_V,MSGTR_NotSystemStream); | |
501 } | |
502 } | |
503 return file_format; | |
504 } | |
1 | 505 |
16175 | 506 static int demux_mpg_es_fill_buffer(demuxer_t *demux, demux_stream_t *ds){ |
1 | 507 // Elementary video stream |
508 if(demux->stream->eof) return 0; | |
509 demux->filepos=stream_tell(demux->stream); | |
1735 | 510 ds_read_packet(demux->video,demux->stream,STREAM_BUFFER_SIZE,0,demux->filepos,0); |
1 | 511 return 1; |
512 } | |
513 | |
16369 | 514 /** |
515 * \brief discard until 0x100 header and return a filled buffer | |
516 * \param b buffer-end pointer | |
517 * \param pos current pos in stream, negative since b points to end of buffer | |
518 * \param s stream to read from | |
519 * \return new position, differs from original pos when eof hit and thus | |
520 * b was modified to point to the new end of buffer | |
521 */ | |
522 static int find_end(unsigned char **b, int pos, stream_t *s) { | |
523 register int state = 0xffffffff; | |
524 unsigned char *buf = *b; | |
525 int start = pos; | |
526 int read, unused; | |
527 // search already read part | |
528 while (state != 0x100 && pos) { | |
529 state = state << 8 | buf[pos++]; | |
530 } | |
531 // continue search in stream | |
532 while (state != 0x100) { | |
533 register int c = stream_read_char(s); | |
534 if (c < 0) break; | |
535 state = state << 8 | c; | |
536 } | |
537 // modify previous header (from 0x1bc or 0x1bf to 0x100) | |
538 buf[start++] = 0; | |
539 // copy remaining buffer part to current pos | |
540 memmove(&buf[start], &buf[pos], -pos); | |
541 unused = start + -pos; // -unused bytes in buffer | |
542 read = stream_read(s, &buf[unused], -unused); | |
543 unused += read; | |
544 // fix buffer so it ends at pos == 0 (eof case) | |
545 *b = &buf[unused]; | |
546 start -= unused; | |
547 return start; | |
548 } | |
549 | |
550 /** | |
551 * This format usually uses an insane bitrate, which makes this function | |
552 * performance-critical! | |
553 * Be sure to benchmark any changes with different compiler versions. | |
554 */ | |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
555 static int demux_mpg_gxf_fill_buffer(demuxer_t *demux, demux_stream_t *ds) { |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
556 demux_packet_t *pack; |
16369 | 557 int len; |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
558 demux->filepos = stream_tell(demux->stream); |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
559 pack = new_demux_packet(STREAM_BUFFER_SIZE); |
16369 | 560 len = stream_read(demux->stream, pack->buffer, STREAM_BUFFER_SIZE); |
561 if (len <= 0) | |
562 return 0; | |
563 { | |
564 register uint32_t state = (uint32_t)demux->priv; | |
565 register int pos = -len; | |
566 unsigned char *buf = &pack->buffer[len]; | |
567 do { | |
568 state = state << 8 | buf[pos]; | |
569 if (unlikely((state | 3) == 0x1bf)) | |
570 pos = find_end(&buf, pos, demux->stream); | |
571 } while (++pos); | |
572 demux->priv = (void *)state; | |
573 len = buf - pack->buffer; | |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
574 } |
16369 | 575 if (len < STREAM_BUFFER_SIZE) |
576 resize_demux_packet(pack, len); | |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
577 ds_add_packet(ds, pack); |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
578 return 1; |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
579 } |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
580 |
16175 | 581 int demux_mpg_fill_buffer(demuxer_t *demux, demux_stream_t *ds){ |
1 | 582 unsigned int head=0; |
583 int skipped=0; | |
5570
3a8d8c51355a
max_packs increased for some dvd with too many audio/sub
arpi
parents:
4711
diff
changeset
|
584 int max_packs=256; // 512kbyte |
1 | 585 int ret=0; |
586 | |
587 // System stream | |
588 do{ | |
589 demux->filepos=stream_tell(demux->stream); | |
590 head=stream_read_dword(demux->stream); | |
547 | 591 if((head&0xFFFFFF00)!=0x100){ |
592 // sync... | |
593 demux->filepos-=skipped; | |
594 while(1){ | |
536 | 595 int c=stream_read_char(demux->stream); |
596 if(c<0) break; //EOF | |
597 head<<=8; | |
598 if(head!=0x100){ | |
599 head|=c; | |
4711 | 600 if(mp_check_mp3_header(head)) ++num_mp3audio_packets; |
536 | 601 ++skipped; //++demux->filepos; |
602 continue; | |
603 } | |
604 head|=c; | |
605 break; | |
547 | 606 } |
607 demux->filepos+=skipped; | |
1 | 608 } |
609 if(stream_eof(demux->stream)) break; | |
610 // sure: head=0x000001XX | |
1567 | 611 mp_dbg(MSGT_DEMUX,MSGL_DBG4,"*** head=0x%X\n",head); |
1 | 612 if(demux->synced==0){ |
3770 | 613 if(head==0x1BA) demux->synced=1; //else |
614 // if(head==0x1BD || (head>=0x1C0 && head<=0x1EF)) demux->synced=3; // PES? | |
1 | 615 } else |
616 if(demux->synced==1){ | |
929 | 617 if(head==0x1BB || head==0x1BD || (head>=0x1C0 && head<=0x1EF)){ |
1 | 618 demux->synced=2; |
17366 | 619 mp_msg(MSGT_DEMUX,MSGL_V,"system stream synced at 0x%"PRIX64" (%"PRId64")!\n",(int64_t)demux->filepos,(int64_t)demux->filepos); |
536 | 620 num_elementary_packets100=0; // requires for re-sync! |
621 num_elementary_packets101=0; // requires for re-sync! | |
1 | 622 } else demux->synced=0; |
623 } // else | |
3255
ee28577dad02
combined PS/PES sync to allow .VDR playback from stdin
arpi
parents:
2555
diff
changeset
|
624 if(demux->synced>=2){ |
1 | 625 ret=demux_mpg_read_packet(demux,head); |
626 if(!ret) | |
627 if(--max_packs==0){ | |
628 demux->stream->eof=1; | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1735
diff
changeset
|
629 mp_msg(MSGT_DEMUX,MSGL_ERR,MSGTR_DoesntContainSelectedStream); |
1 | 630 return 0; |
631 } | |
3255
ee28577dad02
combined PS/PES sync to allow .VDR playback from stdin
arpi
parents:
2555
diff
changeset
|
632 if(demux->synced==3) demux->synced=(ret==1)?2:0; // PES detect |
1 | 633 } else { |
634 if(head>=0x100 && head<0x1B0){ | |
1162 | 635 if(head==0x100) ++num_elementary_packets100; else |
9069
0d2b25a821c9
raw mpeg4-es support (you need to set -fps manually!)
arpi
parents:
8254
diff
changeset
|
636 if(head==0x101) ++num_elementary_packets101; else |
0d2b25a821c9
raw mpeg4-es support (you need to set -fps manually!)
arpi
parents:
8254
diff
changeset
|
637 if(head>=0x120 && head<=0x12F) ++num_elementary_packets12x; |
9824 | 638 |
639 if((head&~0x60) == 0x101) ++num_h264_slice; else | |
640 if((head&~0x60) == 0x102) ++num_h264_dpa; else | |
641 if((head&~0x60) == 0x103) ++num_h264_dpb; else | |
642 if((head&~0x60) == 0x104) ++num_h264_dpc; else | |
643 if((head&~0x60) == 0x105 && head != 0x105) ++num_h264_idr; else | |
644 if((head&~0x60) == 0x107 && head != 0x107) ++num_h264_sps; else | |
645 if((head&~0x60) == 0x108 && head != 0x108) ++num_h264_pps; | |
646 | |
1567 | 647 mp_msg(MSGT_DEMUX,MSGL_DBG3,"Opps... elementary video packet found: %03X\n",head); |
1162 | 648 } else |
4711 | 649 if((head>=0x1C0 && head<0x1F0) || head==0x1BD){ |
1338
345585097137
mpeg PES steram support (only 1E0 & 1C0 packets, no 1BA/1BB headers)
arpi
parents:
1331
diff
changeset
|
650 ++num_elementary_packetsPES; |
1567 | 651 mp_msg(MSGT_DEMUX,MSGL_DBG3,"Opps... PES packet found: %03X\n",head); |
1338
345585097137
mpeg PES steram support (only 1E0 & 1C0 packets, no 1BA/1BB headers)
arpi
parents:
1331
diff
changeset
|
652 } else |
1162 | 653 if(head==0x1B6) ++num_elementary_packets1B6; |
1 | 654 #if 1 |
1338
345585097137
mpeg PES steram support (only 1E0 & 1C0 packets, no 1BA/1BB headers)
arpi
parents:
1331
diff
changeset
|
655 if( ( (num_elementary_packets100>50 && num_elementary_packets101>50) || |
345585097137
mpeg PES steram support (only 1E0 & 1C0 packets, no 1BA/1BB headers)
arpi
parents:
1331
diff
changeset
|
656 (num_elementary_packetsPES>50) ) && skipped>4000000){ |
1567 | 657 mp_msg(MSGT_DEMUX,MSGL_V,"sync_mpeg_ps: seems to be ES/PES stream...\n"); |
1 | 658 demux->stream->eof=1; |
659 break; | |
660 } | |
4711 | 661 if(num_mp3audio_packets>100 && num_elementary_packets100<10){ |
662 mp_msg(MSGT_DEMUX,MSGL_V,"sync_mpeg_ps: seems to be MP3 stream...\n"); | |
663 demux->stream->eof=1; | |
664 break; | |
665 } | |
1 | 666 #endif |
667 } | |
668 } while(ret!=1); | |
1567 | 669 mp_dbg(MSGT_DEMUX,MSGL_DBG2,"demux: %d bad bytes skipped\n",skipped); |
1 | 670 if(demux->stream->eof){ |
1567 | 671 mp_msg(MSGT_DEMUX,MSGL_V,"MPEG Stream reached EOF\n"); |
1 | 672 return 0; |
673 } | |
674 return 1; | |
675 } | |
676 | |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7671
diff
changeset
|
677 extern void skip_audio_frame(sh_audio_t *sh_audio); |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7671
diff
changeset
|
678 |
17569
6c541a8421ca
Reverse commit of unfinished patch for passing audio_delay to the demuxers.
corey
parents:
17553
diff
changeset
|
679 void demux_seek_mpg(demuxer_t *demuxer,float rel_seek_secs,int flags){ |
1466 | 680 demux_stream_t *d_audio=demuxer->audio; |
681 demux_stream_t *d_video=demuxer->video; | |
682 sh_audio_t *sh_audio=d_audio->sh; | |
683 sh_video_t *sh_video=d_video->sh; | |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
684 mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
685 int precision = 1; |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
686 float oldpts = 0; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
687 off_t oldpos = demuxer->filepos; |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
688 float newpts = 0; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
689 off_t newpos = (flags & 1) ? demuxer->movi_start : oldpos; |
1466 | 690 |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
691 if(mpg_d) |
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
692 oldpts = mpg_d->last_pts; |
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
693 newpts = (flags & 1) ? 0.0 : oldpts; |
1466 | 694 //================= seek in MPEG ========================== |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
695 //calculate the pts to seek to |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
696 if(flags & 2) { |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
697 if (mpg_d && mpg_d->final_pts > 0.0) |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
698 newpts += mpg_d->final_pts * rel_seek_secs; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
699 else |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
700 newpts += rel_seek_secs * (demuxer->movi_end - demuxer->movi_start) * oldpts / oldpos; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
701 } else |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
702 newpts += rel_seek_secs; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
703 if (newpts < 0) newpts = 0; |
1628
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
704 |
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
705 if(flags&2){ |
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
706 // float seek 0..1 |
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
707 newpos+=(demuxer->movi_end-demuxer->movi_start)*rel_seek_secs; |
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
708 } else { |
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
709 // time seek (secs) |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
710 if (mpg_d && mpg_d->has_valid_timestamps) { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
711 if (mpg_d->final_pts > 0.0) |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
712 newpos += rel_seek_secs * (demuxer->movi_end - demuxer->movi_start) / mpg_d->final_pts; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
713 else if (oldpts > 0.0) |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
714 newpos += rel_seek_secs * (oldpos - demuxer->movi_start) / oldpts; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
715 } else if(!sh_video || !sh_video->i_bps) // unspecified or VBR |
1628
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
716 newpos+=2324*75*rel_seek_secs; // 174.3 kbyte/sec |
1466 | 717 else |
1628
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
718 newpos+=sh_video->i_bps*rel_seek_secs; |
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
719 } |
1466 | 720 |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
721 while (1) { |
4391
6394c1e9e770
DVD start position handling changed (progbar/eta fix)
arpi
parents:
3975
diff
changeset
|
722 if(newpos<demuxer->movi_start){ |
6394c1e9e770
DVD start position handling changed (progbar/eta fix)
arpi
parents:
3975
diff
changeset
|
723 if(demuxer->stream->type!=STREAMTYPE_VCD) demuxer->movi_start=0; // for VCD |
6394c1e9e770
DVD start position handling changed (progbar/eta fix)
arpi
parents:
3975
diff
changeset
|
724 if(newpos<demuxer->movi_start) newpos=demuxer->movi_start; |
6394c1e9e770
DVD start position handling changed (progbar/eta fix)
arpi
parents:
3975
diff
changeset
|
725 } |
1628
bd1ef18cdf33
seeking flags implemented: 0x1=rel/abs and 0x2=time/percent
arpi
parents:
1597
diff
changeset
|
726 |
1466 | 727 #ifdef _LARGEFILE_SOURCE |
728 newpos&=~((long long)STREAM_BUFFER_SIZE-1); /* sector boundary */ | |
729 #else | |
730 newpos&=~(STREAM_BUFFER_SIZE-1); /* sector boundary */ | |
731 #endif | |
732 stream_seek(demuxer->stream,newpos); | |
733 | |
734 // re-sync video: | |
735 videobuf_code_len=0; // reset ES stream buffer | |
736 | |
737 ds_fill_buffer(d_video); | |
738 if(sh_audio){ | |
739 ds_fill_buffer(d_audio); | |
740 } | |
741 | |
742 while(1){ | |
743 int i; | |
744 if(sh_audio && !d_audio->eof && d_video->pts && d_audio->pts){ | |
745 float a_pts=d_audio->pts; | |
746 a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps; | |
747 if(d_video->pts>a_pts){ | |
748 skip_audio_frame(sh_audio); // sync audio | |
749 continue; | |
750 } | |
751 } | |
752 i=sync_video_packet(d_video); | |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
753 if(sh_video->format == 0x10000004) { //mpeg4 |
14923
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
754 if(i==0x1B6) { //vop (frame) startcode |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
755 int pos = videobuf_len; |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
756 if(!read_video_packet(d_video)) break; // EOF |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
757 if((videobuffer[pos+4] & 0x3F) == 0) break; //I-frame |
658fc109eefc
added support for other codecs (mpeg4/h264/aac) in mpeg-ps parsing the PSM
nicodvb
parents:
14502
diff
changeset
|
758 } |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
759 } else if(sh_video->format == 0x10000005){ //h264 |
17289 | 760 if((i & ~0x60) == 0x105) break; |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
761 } else { //default mpeg1/2 |
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
762 if(i==0x1B3 || i==0x1B8) break; // found it! |
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
763 } |
1466 | 764 if(!i || !skip_video_packet(d_video)) break; // EOF? |
765 } | |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
766 if(!mpg_d) |
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
767 break; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
768 if (!precision || abs(newpts - mpg_d->last_pts) < 0.5 || (mpg_d->last_pts == oldpts)) break; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
769 if ((newpos - oldpos) * (mpg_d->last_pts - oldpts) < 0) { // invalid timestamps |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
770 mpg_d->has_valid_timestamps = 0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
771 break; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
772 } |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
773 precision--; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
774 //prepare another seek because we are off by more than 0.5s |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
775 if(mpg_d) { |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
776 newpos += (newpts - mpg_d->last_pts) * (newpos - oldpos) / (mpg_d->last_pts - oldpts); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
777 ds_free_packs(d_audio); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
778 ds_free_packs(d_video); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
779 demuxer->stream->eof=0; // clear eof flag |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
780 d_video->eof=0; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
781 d_audio->eof=0; |
14426
3faa873334d7
fixed broken seeking in mpeg-es files; syncword seeking for all 3 video codecs
nicodvb
parents:
13738
diff
changeset
|
782 } |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
783 } |
1466 | 784 } |
785 | |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
786 int demux_mpg_control(demuxer_t *demuxer,int cmd, void *arg){ |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
787 demux_stream_t *d_video=demuxer->video; |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
788 sh_video_t *sh_video=d_video->sh; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
789 mpg_demuxer_t *mpg_d=(mpg_demuxer_t*)demuxer->priv; |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
790 |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
791 switch(cmd) { |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
792 case DEMUXER_CTRL_GET_TIME_LENGTH: |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
793 if (mpg_d && mpg_d->has_valid_timestamps) { |
16346
6ff303d2876b
Make -identify's 'ID_LENGTH=' print a float and not an integer.. The
ods15
parents:
16314
diff
changeset
|
794 *((double *)arg)=(double)mpg_d->final_pts; |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
795 return DEMUXER_CTRL_GUESS; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
796 } |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
797 return DEMUXER_CTRL_DONTKNOW; |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
798 |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
799 case DEMUXER_CTRL_GET_PERCENT_POS: |
13738
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
800 if (mpg_d && mpg_d->has_valid_timestamps && mpg_d->final_pts > 0.0) { |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
801 *((int *)arg)=(int)(100 * mpg_d->last_pts / mpg_d->final_pts); |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
802 return DEMUXER_CTRL_OK; |
39004f891def
seeking based on the largest timestamp in an mpeg stream
aurel
parents:
13649
diff
changeset
|
803 } |
14502
8769fa370f83
Move generic length and percent pos calculation to demuxer.c
reimar
parents:
14426
diff
changeset
|
804 return DEMUXER_CTRL_DONTKNOW; |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
805 |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
806 case DEMUXER_CTRL_SWITCH_AUDIO: |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
807 if (mpg_d && mpg_d->num_a_streams > 1 && demuxer->audio && demuxer->audio->sh) { |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
808 demux_stream_t *d_audio = demuxer->audio; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
809 sh_audio_t *sh_audio = d_audio->sh; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
810 sh_audio_t *sh_a; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
811 int i; |
15285
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
812 if (*((int*)arg) < 0) |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
813 { |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
814 for (i = 0; i < mpg_d->num_a_streams; i++) { |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
815 if (d_audio->id == mpg_d->a_stream_ids[i]) break; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
816 } |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
817 do { |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
818 i = (i+1) % mpg_d->num_a_streams; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
819 sh_a = (sh_audio_t*)demuxer->a_streams[mpg_d->a_stream_ids[i]]; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
820 } while (sh_a->format != sh_audio->format); |
15285
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
821 } |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
822 else { |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
823 for (i = 0; i < mpg_d->num_a_streams; i++) |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
824 if (*((int*)arg) == mpg_d->a_stream_ids[i]) break; |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
825 if (i < mpg_d->num_a_streams) |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
826 sh_a = (sh_audio_t*)demuxer->a_streams[*((int*)arg)]; |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
827 if (sh_a->format != sh_audio->format) |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
828 i = mpg_d->num_a_streams; |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
829 } |
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
830 if (i < mpg_d->num_a_streams && d_audio->id != mpg_d->a_stream_ids[i]) { |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
831 d_audio->id = mpg_d->a_stream_ids[i]; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
832 d_audio->sh = sh_a; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
833 ds_free_packs(d_audio); |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
834 } |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
835 } |
15285
39eb8a327ea9
adds a parameter to the switch_audio command to directly select a track.
reimar
parents:
15046
diff
changeset
|
836 *((int*)arg) = demuxer->audio->id; |
15046
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
837 return DEMUXER_CTRL_OK; |
b7aa70b05d76
Added support of audio stream switching in the MPEG demuxer using the #-key
gpoirier
parents:
14923
diff
changeset
|
838 |
8208
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
839 default: |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
840 return DEMUXER_CTRL_NOTIMPL; |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
841 } |
ae5a2ae1c349
demuxer_control(), percent position and time length query implemented in
arpi
parents:
8123
diff
changeset
|
842 } |
16175 | 843 |
844 | |
845 static int demux_mpg_pes_probe(demuxer_t *demuxer) { | |
846 demuxer->synced = 3; | |
16314 | 847 return (demux_mpg_probe(demuxer) == DEMUXER_TYPE_MPEG_PS) ? DEMUXER_TYPE_MPEG_PES : 0; |
16175 | 848 } |
849 | |
850 | |
851 static demuxer_t* demux_mpg_es_open(demuxer_t* demuxer) | |
852 { | |
853 sh_video_t *sh_video=NULL; | |
854 | |
855 demuxer->audio->sh = NULL; // ES streams has no audio channel | |
856 demuxer->video->sh = new_sh_video(demuxer,0); // create dummy video stream header, id=0 | |
857 sh_video=demuxer->video->sh;sh_video->ds=demuxer->video; | |
858 | |
859 return demuxer; | |
860 } | |
861 | |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
862 static demuxer_t *demux_mpg_gxf_open(demuxer_t *demuxer) { |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
863 demuxer->audio->sh = NULL; |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
864 demuxer->video->sh = new_sh_video(demuxer,0); |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
865 ((sh_video_t *)demuxer->video->sh)->ds = demuxer->video; |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
866 demuxer->priv = (void *) 0xffffffff; |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
867 return demuxer; |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
868 } |
16175 | 869 |
870 static demuxer_t* demux_mpg_ps_open(demuxer_t* demuxer) | |
871 { | |
872 sh_audio_t *sh_audio=NULL; | |
873 sh_video_t *sh_video=NULL; | |
874 | |
875 sh_video=demuxer->video->sh;sh_video->ds=demuxer->video; | |
876 | |
877 if(demuxer->audio->id!=-2) { | |
878 if(!ds_fill_buffer(demuxer->audio)){ | |
879 mp_msg(MSGT_DEMUXER,MSGL_INFO,"MPEG: " MSGTR_MissingAudioStream); | |
880 demuxer->audio->sh=NULL; | |
881 } else { | |
882 sh_audio=demuxer->audio->sh;sh_audio->ds=demuxer->audio; | |
883 } | |
884 } | |
885 | |
886 return demuxer; | |
887 } | |
888 | |
889 | |
890 demuxer_desc_t demuxer_desc_mpeg_ps = { | |
891 "MPEG PS demuxer", | |
892 "mpegps", | |
893 "MPEG-PS", | |
894 "Arpi?", | |
895 "Mpeg", | |
896 DEMUXER_TYPE_MPEG_PS, | |
897 0, // unsafe autodetect | |
898 demux_mpg_probe, | |
899 demux_mpg_fill_buffer, | |
900 demux_mpg_ps_open, | |
901 demux_close_mpg, | |
902 demux_seek_mpg, | |
16771
82a56c89b54d
10l, demux_mpg_control was missing from demuxer info struct, causing audio
reimar
parents:
16369
diff
changeset
|
903 demux_mpg_control, |
16175 | 904 }; |
905 | |
906 | |
907 demuxer_desc_t demuxer_desc_mpeg_pes = { | |
908 "MPEG PES demuxer", | |
909 "mpegpes", | |
910 "MPEG-PES", | |
911 "Arpi?", | |
912 "Mpeg", | |
913 DEMUXER_TYPE_MPEG_PES, | |
914 0, // unsafe autodetect | |
915 demux_mpg_pes_probe, | |
916 demux_mpg_fill_buffer, | |
16314 | 917 demux_mpg_ps_open, |
16175 | 918 demux_close_mpg, |
919 demux_seek_mpg, | |
16771
82a56c89b54d
10l, demux_mpg_control was missing from demuxer info struct, causing audio
reimar
parents:
16369
diff
changeset
|
920 demux_mpg_control, |
16175 | 921 }; |
922 | |
923 | |
16310
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
924 demuxer_desc_t demuxer_desc_mpeg_gxf = { |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
925 "MPEG ES in GXF demuxer", |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
926 "mpeggxf", |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
927 "MPEG-ES in GXF", |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
928 "Reimar Döffinger", |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
929 "Mpeg", |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
930 DEMUXER_TYPE_MPEG_GXF, |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
931 0, // hack autodetection |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
932 NULL, |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
933 demux_mpg_gxf_fill_buffer, |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
934 demux_mpg_gxf_open, |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
935 NULL, |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
936 NULL, |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
937 NULL |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
938 }; |
fb95057e370e
support MPEG in GXF container with extension-based detection.
reimar
parents:
16175
diff
changeset
|
939 |
16175 | 940 demuxer_desc_t demuxer_desc_mpeg_es = { |
941 "MPEG ES demuxer", | |
942 "mpeges", | |
943 "MPEG-ES", | |
944 "Arpi?", | |
945 "Mpeg", | |
946 DEMUXER_TYPE_MPEG_ES, | |
947 0, // hack autodetection | |
948 NULL, | |
949 demux_mpg_es_fill_buffer, | |
950 demux_mpg_es_open, | |
951 demux_close_mpg, | |
952 demux_seek_mpg, | |
16771
82a56c89b54d
10l, demux_mpg_control was missing from demuxer info struct, causing audio
reimar
parents:
16369
diff
changeset
|
953 demux_mpg_control, |
16175 | 954 }; |
955 | |
956 | |
957 demuxer_desc_t demuxer_desc_mpeg4_es = { | |
958 "MPEG4 ES demuxer", | |
959 "mpeg4es", | |
960 "MPEG-ES", | |
961 "Arpi?", | |
962 "Mpeg", | |
963 DEMUXER_TYPE_MPEG4_ES, | |
964 0, // hack autodetection | |
965 NULL, | |
966 demux_mpg_es_fill_buffer, | |
967 demux_mpg_es_open, | |
968 demux_close_mpg, | |
969 demux_seek_mpg, | |
16771
82a56c89b54d
10l, demux_mpg_control was missing from demuxer info struct, causing audio
reimar
parents:
16369
diff
changeset
|
970 demux_mpg_control, |
16175 | 971 }; |
972 | |
973 | |
974 demuxer_desc_t demuxer_desc_h264_es = { | |
975 "H.264 ES demuxer", | |
976 "h264es", | |
977 "H264-ES", | |
978 "Arpi?", | |
979 "Mpeg", | |
980 DEMUXER_TYPE_H264_ES, | |
981 0, // hack autodetection | |
982 NULL, | |
983 demux_mpg_es_fill_buffer, | |
984 demux_mpg_es_open, | |
985 demux_close_mpg, | |
986 demux_seek_mpg, | |
16771
82a56c89b54d
10l, demux_mpg_control was missing from demuxer info struct, causing audio
reimar
parents:
16369
diff
changeset
|
987 demux_mpg_control, |
16175 | 988 }; |