annotate libmpdemux/demux_demuxers.c @ 33588:c4d315b544a1

Remove GUI-specific code that is already handled by common code now.
author reimar
date Sun, 19 Jun 2011 18:55:30 +0000
parents 6cb191a2cc1a
children f4828b517f4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29238
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
1 /*
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
2 * This file is part of MPlayer.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
3 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
5 * it under the terms of the GNU General Public License as published by
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
7 * (at your option) any later version.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
8 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
12 * GNU General Public License for more details.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
13 *
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
14 * You should have received a copy of the GNU General Public License along
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
d643e4643313 Add standard license header to all files in libmpdemux.
diego
parents: 26817
diff changeset
17 */
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
18
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
19 #include "config.h"
18176
f72bc5754209 Part3 of Otvos Attila's oattila AT chello-hu mp_msg changes, with lots of modifications as usual
reynaldo
parents: 17636
diff changeset
20 #include "mp_msg.h"
f72bc5754209 Part3 of Otvos Attila's oattila AT chello-hu mp_msg changes, with lots of modifications as usual
reynaldo
parents: 17636
diff changeset
21 #include "help_mp.h"
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
22
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
23 #include <stdlib.h>
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
24 #include <stdio.h>
22605
4d81dbdf46b9 Add explicit location for headers from the stream/ directory.
diego
parents: 20071
diff changeset
25 #include "stream/stream.h"
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
26 #include "demuxer.h"
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
27 #include "stheader.h"
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
28
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
29 typedef struct dd_priv {
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
30 demuxer_t* vd;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
31 demuxer_t* ad;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
32 demuxer_t* sd;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
33 } dd_priv_t;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
34
25707
d4fe6e23283e Make all demuxer_desc_t const, thus moving them to .rodata
reimar
parents: 22605
diff changeset
35 extern const demuxer_desc_t demuxer_desc_demuxers;
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
36
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
37 demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
33237
a8619bfabf84 Add a alloc_demuxer function that ensures all the critical stuff is
reimar
parents: 32604
diff changeset
38 // Video is the most important :-)
a8619bfabf84 Add a alloc_demuxer function that ensures all the critical stuff is
reimar
parents: 32604
diff changeset
39 demuxer_t* ret = alloc_demuxer(vd->stream, DEMUXER_TYPE_DEMUXERS, vd->filename);
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
40 dd_priv_t* priv;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
41
18885
5c8acc972551 rm unnecesary casts from void* - part 4
reynaldo
parents: 18710
diff changeset
42 priv = malloc(sizeof(dd_priv_t));
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
43 priv->vd = vd;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
44 priv->ad = ad;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
45 priv->sd = sd;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
46 ret->priv = priv;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
47
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
48 ret->type = ret->file_format = DEMUXER_TYPE_DEMUXERS;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
49 ret->seekable = vd->seekable && ad->seekable && sd->seekable;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29238
diff changeset
50
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
51 ret->video = vd->video;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
52 ret->audio = ad->audio;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
53 ret->sub = sd->sub;
29768
fa5a020677d6 Unbreak the demuxer-specific code in video.c with e.g.
reimar
parents: 29569
diff changeset
54 if (sd && sd != vd && sd != ad) sd->sub->non_interleaved = 1;
fa5a020677d6 Unbreak the demuxer-specific code in video.c with e.g.
reimar
parents: 29569
diff changeset
55
fa5a020677d6 Unbreak the demuxer-specific code in video.c with e.g.
reimar
parents: 29569
diff changeset
56 // without these, demux_demuxers_fill_buffer will never be called,
fa5a020677d6 Unbreak the demuxer-specific code in video.c with e.g.
reimar
parents: 29569
diff changeset
57 // but they break the demuxer-specific code in video.c
fa5a020677d6 Unbreak the demuxer-specific code in video.c with e.g.
reimar
parents: 29569
diff changeset
58 #if 0
29568
ccb7b7f4b764 Hack demux_demuxers so that demux_demuxers_fill_buffer is actually called.
reimar
parents: 29263
diff changeset
59 if (vd) vd->video->demuxer = ret;
ccb7b7f4b764 Hack demux_demuxers so that demux_demuxers_fill_buffer is actually called.
reimar
parents: 29263
diff changeset
60 if (ad) ad->audio->demuxer = ret;
ccb7b7f4b764 Hack demux_demuxers so that demux_demuxers_fill_buffer is actually called.
reimar
parents: 29263
diff changeset
61 if (sd) sd->sub->demuxer = ret;
29768
fa5a020677d6 Unbreak the demuxer-specific code in video.c with e.g.
reimar
parents: 29569
diff changeset
62 #endif
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
63
26817
a0c157a99aac Make internal subtitle and subtitle switching work with -audiofile
reimar
parents: 26297
diff changeset
64 // HACK?, necessary for subtitle (and audio and video when implemented) switching
a0c157a99aac Make internal subtitle and subtitle switching work with -audiofile
reimar
parents: 26297
diff changeset
65 memcpy(ret->v_streams, vd->v_streams, sizeof(ret->v_streams));
a0c157a99aac Make internal subtitle and subtitle switching work with -audiofile
reimar
parents: 26297
diff changeset
66 memcpy(ret->a_streams, ad->a_streams, sizeof(ret->a_streams));
a0c157a99aac Make internal subtitle and subtitle switching work with -audiofile
reimar
parents: 26297
diff changeset
67 memcpy(ret->s_streams, sd->s_streams, sizeof(ret->s_streams));
a0c157a99aac Make internal subtitle and subtitle switching work with -audiofile
reimar
parents: 26297
diff changeset
68
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
69 ret->desc = &demuxer_desc_demuxers;
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
70
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
71 return ret;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
72 }
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
73
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
74 static int demux_demuxers_fill_buffer(demuxer_t *demux,demux_stream_t *ds) {
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
75 dd_priv_t* priv;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
76
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
77 priv=demux->priv;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
78
29569
3e13839031b3 Add a hack to ensure data from e.g. mov format -subfile gets read at all
reimar
parents: 29568
diff changeset
79 // HACK: make sure the subtitles get properly interleaved if with -subfile
3e13839031b3 Add a hack to ensure data from e.g. mov format -subfile gets read at all
reimar
parents: 29568
diff changeset
80 if (priv->sd && priv->sd->sub != ds &&
3e13839031b3 Add a hack to ensure data from e.g. mov format -subfile gets read at all
reimar
parents: 29568
diff changeset
81 priv->sd != priv->vd && priv->sd != priv->ad)
3e13839031b3 Add a hack to ensure data from e.g. mov format -subfile gets read at all
reimar
parents: 29568
diff changeset
82 ds_get_next_pts(priv->sd->sub);
29568
ccb7b7f4b764 Hack demux_demuxers so that demux_demuxers_fill_buffer is actually called.
reimar
parents: 29263
diff changeset
83 if(priv->vd && priv->vd->video == ds)
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
84 return demux_fill_buffer(priv->vd,ds);
29568
ccb7b7f4b764 Hack demux_demuxers so that demux_demuxers_fill_buffer is actually called.
reimar
parents: 29263
diff changeset
85 else if(priv->ad && priv->ad->audio == ds)
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
86 return demux_fill_buffer(priv->ad,ds);
29568
ccb7b7f4b764 Hack demux_demuxers so that demux_demuxers_fill_buffer is actually called.
reimar
parents: 29263
diff changeset
87 else if(priv->sd && priv->sd->sub == ds)
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
88 return demux_fill_buffer(priv->sd,ds);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29238
diff changeset
89
18176
f72bc5754209 Part3 of Otvos Attila's oattila AT chello-hu mp_msg changes, with lots of modifications as usual
reynaldo
parents: 17636
diff changeset
90 mp_msg(MSGT_DEMUX,MSGL_WARN,MSGTR_MPDEMUX_DEMUXERS_FillBufferError);
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
91 return 0;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
92 }
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
93
17636
b849a99cdc3c Second-try commit of this patch.
corey
parents: 17569
diff changeset
94 static void demux_demuxers_seek(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags) {
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
95 dd_priv_t* priv;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
96 float pos;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
97 priv=demuxer->priv;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
98
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
99 priv->ad->stream->eof = 0;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
100 priv->sd->stream->eof = 0;
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
101
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
102 // Seek video
17636
b849a99cdc3c Second-try commit of this patch.
corey
parents: 17569
diff changeset
103 demux_seek(priv->vd,rel_seek_secs,audio_delay,flags);
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
104 // Get the new pos
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
105 pos = demuxer->video->pts;
20071
672123d27ae3 Fix demux_demuxers seeking if the video demuxer does not set
reimar
parents: 18958
diff changeset
106 if (!pos) {
33238
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
107 // since the video demuxer might provide multiple
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
108 // streams (e.g. subs) we might have to call
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
109 // demux_fill_buffer multiple times.
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
110 int limit = 10;
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
111 do {
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
112 demux_fill_buffer(priv->vd, demuxer->video);
b09a5d9ff050 Call demux_fill_buffer multiple times when trying to get a
reimar
parents: 33237
diff changeset
113 } while (--limit && !demuxer->video->first);
20071
672123d27ae3 Fix demux_demuxers seeking if the video demuxer does not set
reimar
parents: 18958
diff changeset
114 if (demuxer->video->first)
672123d27ae3 Fix demux_demuxers seeking if the video demuxer does not set
reimar
parents: 18958
diff changeset
115 pos = demuxer->video->first->pts;
672123d27ae3 Fix demux_demuxers seeking if the video demuxer does not set
reimar
parents: 18958
diff changeset
116 }
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
117
32604
3ba59e647e58 Fix crahs with -audiofile and audio disabled.
reimar
parents: 29768
diff changeset
118 if(priv->ad != priv->vd && demuxer->audio->sh) {
26297
e9e160b6b5ad Remove useless cast
reimar
parents: 25707
diff changeset
119 sh_audio_t* sh = demuxer->audio->sh;
17636
b849a99cdc3c Second-try commit of this patch.
corey
parents: 17569
diff changeset
120 demux_seek(priv->ad,pos,audio_delay,1);
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
121 // In case the demuxer don't set pts
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
122 if(!demuxer->audio->pts)
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
123 demuxer->audio->pts = pos-((ds_tell_pts(demuxer->audio)-sh->a_in_buffer_len)/(float)sh->i_bps);
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
124 }
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
125
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
126 if(priv->sd != priv->vd)
17636
b849a99cdc3c Second-try commit of this patch.
corey
parents: 17569
diff changeset
127 demux_seek(priv->sd,pos,audio_delay,1);
4765
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
128
d0c2c8af46b4 Demuxers demuxer support for using external audiofile (or muxed subtitles).
albeu
parents:
diff changeset
129 }
5812
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
130
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
131 static void demux_close_demuxers(demuxer_t* demuxer) {
5812
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
132 dd_priv_t* priv = demuxer->priv;
9710
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
133 stream_t *s;
5812
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
134
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
135 if(priv->vd)
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
136 free_demuxer(priv->vd);
9710
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
137 if(priv->ad && priv->ad != priv->vd) {
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
138 // That's a hack to free the audio file stream
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
139 // It's ok atm but we shouldn't free that here
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
140 s = priv->ad->stream;
5812
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
141 free_demuxer(priv->ad);
9710
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
142 free_stream(s);
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
143 } if(priv->sd && priv->sd != priv->vd && priv->sd != priv->ad) {
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
144 s = priv->sd->stream;
5812
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
145 free_demuxer(priv->sd);
9710
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
146 free_stream(s);
e3db09ae5154 Free the stream of the audio and subtitle demuxer.
albeu
parents: 8056
diff changeset
147 }
5812
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
148
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
149 free(priv);
f9d23c2aa6b7 Uninit added
albeu
parents: 4765
diff changeset
150 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29238
diff changeset
151
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
152
16876
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
153 static int demux_demuxers_control(demuxer_t *demuxer,int cmd, void *arg){
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
154 dd_priv_t* priv = demuxer->priv;
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
155 switch (cmd) {
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
156 case DEMUXER_CTRL_GET_TIME_LENGTH:
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
157 *((double *)arg) = demuxer_get_time_length(priv->vd);
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
158 return DEMUXER_CTRL_OK;
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
159 case DEMUXER_CTRL_GET_PERCENT_POS:
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
160 *((int *)arg) = demuxer_get_percent_pos(priv->vd);
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
161 return DEMUXER_CTRL_OK;
33239
6cb191a2cc1a Pass through correct-pts setting from video sub demuxer.
reimar
parents: 33238
diff changeset
162 case DEMUXER_CTRL_CORRECT_PTS:
6cb191a2cc1a Pass through correct-pts setting from video sub demuxer.
reimar
parents: 33238
diff changeset
163 return demux_control(priv->vd, DEMUXER_CTRL_CORRECT_PTS, NULL);
16876
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
164 }
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
165 return DEMUXER_CTRL_NOTIMPL;
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
166 }
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
167
25707
d4fe6e23283e Make all demuxer_desc_t const, thus moving them to .rodata
reimar
parents: 22605
diff changeset
168 const demuxer_desc_t demuxer_desc_demuxers = {
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
169 "Demuxers demuxer",
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
170 "", // Not selectable
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
171 "",
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
172 "?",
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
173 "internal use only",
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
174 DEMUXER_TYPE_DEMUXERS,
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
175 0, // no autodetect
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
176 NULL,
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
177 demux_demuxers_fill_buffer,
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
178 NULL,
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
179 demux_close_demuxers,
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
180 demux_demuxers_seek,
16876
9dd44ff7ec32 Provide DEMUXER_CTRL_GET_TIME_LENGTH and DEMUXER_CTRL_GET_PERCENT_POS.
reimar
parents: 16291
diff changeset
181 demux_demuxers_control
16175
6b86089c2edd Demuxer modularization
rtognimp
parents: 9710
diff changeset
182 };