annotate libmpdemux/demux_mng.c @ 33565:9c4163ef54e4

Add const to string pointer argument that will not be modified.
author reimar
date Sun, 19 Jun 2011 12:23:26 +0000
parents 8fa2f43cb760
children f3c835ddce85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28018
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
1 /*
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
2 * MNG file demuxer for MPlayer
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
3 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
4 * Copyright (C) 2008 Stefan Schuermans <stefan blinkenarea org>
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
5 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
6 * This file is part of MPlayer.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
7 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
11 * (at your option) any later version.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
12 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
16 * GNU General Public License for more details.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
17 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License along
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
21 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
22
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
23 #include <stdio.h>
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
24 #include <stdlib.h>
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
25 #include <unistd.h>
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
26
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
27 #include "config.h"
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
28
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
29 #include "mp_msg.h"
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
30 #include "help_mp.h"
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
31
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
32 #include "stream/stream.h"
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
33 #include "demuxer.h"
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
34 #include "stheader.h"
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
35
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
36 #define MNG_SUPPORT_READ
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
37 #define MNG_SUPPORT_DISPLAY
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
38 #include <libmng.h>
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
39
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
40 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
41 * \brief some small fixed start time > 0
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
42 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
43 * Start time must be > 0 for the variable frame time mechanism
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
44 * (GIF, MATROSKA, MNG) in video.c to work for the first frame.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
45 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
46 #define MNG_START_PTS 0.01f
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
47
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
48 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
49 * \brief private context structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
50 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
51 * This structure is used as private data for MPlayer demuxer
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
52 * and also as private data for the MNG library.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
53 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
54 * All members ending in \p _ms are in milliseconds
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
55 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
56 typedef struct {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
57 stream_t * stream; ///< pointer to MNG data input stream
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
58 mng_handle h_mng; ///< MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
59 int header_processed; ///< if MNG image header is processed
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
60 mng_uint32 width; ///< MNG image width
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
61 mng_uint32 height; ///< MNG image height
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
62 int total_time_ms; ///< total MNG animation time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
63 unsigned char * canvas; /**< \brief canvas to draw the image onto
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
64 * \details
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
65 * \li lines top-down
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
66 * \li pixels left-to-right
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
67 * \li channels RGB
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
68 * \li no padding
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
69 * \li NULL if no canvas yet
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
70 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
71 int displaying; /**< \brief if displaying already,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
72 * i.e. if mng_display has
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
73 * already been called
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
74 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
75 int finished; ///< if animation is finished
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
76 int global_time_ms; ///< current global time for MNG library
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
77 int anim_cur_time_ms; ///< current frame time in MNG animation
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
78 int anim_frame_duration_ms; ///< current frame duration in MNG animation
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
79 int show_cur_time_ms; /**< \brief current time in the show process,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
80 * i.e. time of last demux packet
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
81 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
82 int show_next_time_ms; /**< \brief next time in the show process,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
83 * i.e. time of next demux packet
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
84 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
85 int timer_ms; /**< \brief number of milliseconds after which
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
86 * libmng wants to be called again
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
87 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
88 } mng_priv_t;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
89
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
90 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
91 * \brief MNG library callback: Allocate a new zero-filled memory block.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
92 * \param[in] size memory block size
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
93 * \return pointer to new memory block
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
94 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
95 static mng_ptr demux_mng_alloc(mng_size_t size)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
96 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
97 return calloc(1, size);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
98 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
99
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
100 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
101 * \brief MNG library callback: Free memory block.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
102 * \param[in] ptr pointer to memory block
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
103 * \param[in] size memory block size
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
104 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
105 static void demux_mng_free(mng_ptr ptr, mng_size_t size)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
106 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
107 free(ptr);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
108 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
109
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
110 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
111 * \brief MNG library callback: Open MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
112 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
113 * \return \p MNG_TRUE on success, \p MNG_FALSE on error (never happens)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
114 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
115 static mng_bool demux_mng_openstream(mng_handle h_mng)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
116 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
117 mng_priv_t * mng_priv = mng_get_userdata(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
118 stream_t * stream = mng_priv->stream;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
119
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
120 // rewind stream to the beginning
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
121 stream_seek(stream, stream->start_pos);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
122
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
123 return MNG_TRUE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
124 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
125
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
126 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
127 * \brief MNG library callback: Close MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
128 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
129 * \return \p MNG_TRUE on success, \p MNG_FALSE on error (never happens)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
130 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
131 static mng_bool demux_mng_closestream(mng_handle h_mng)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
132 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
133 return MNG_TRUE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
134 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
135
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
136 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
137 * \brief MNG library callback: Read data from stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
138 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
139 * \param[in] buf pointer to buffer to fill with data
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
140 * \param[in] size size of buffer
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
141 * \param[out] read number of bytes read from stream
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
142 * \return \p MNG_TRUE on success, \p MNG_FALSE on error (never happens)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
143 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
144 static mng_bool demux_mng_readdata(mng_handle h_mng, mng_ptr buf,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
145 mng_uint32 size, mng_uint32 * read)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
146 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
147 mng_priv_t * mng_priv = mng_get_userdata(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
148 stream_t * stream = mng_priv->stream;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
149
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
150 // simply read data from stream and return number of bytes or error
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
151 *read = stream_read(stream, buf, size);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
152
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
153 return MNG_TRUE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
154 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
155
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
156 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
157 * \brief MNG library callback: Header information is processed now.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
158 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
159 * \param[in] width image width
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
160 * \param[in] height image height
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
161 * \return \p MNG_TRUE on success, \p MNG_FALSE on error
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
162 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
163 static mng_bool demux_mng_processheader(mng_handle h_mng, mng_uint32 width,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
164 mng_uint32 height)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
165 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
166 mng_priv_t * mng_priv = mng_get_userdata(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
167
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
168 // remember size in private data
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
169 mng_priv->header_processed = 1;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
170 mng_priv->width = width;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
171 mng_priv->height = height;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
172
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
173 // get total animation time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
174 mng_priv->total_time_ms = mng_get_playtime(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
175
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
176 // allocate canvas
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
177 mng_priv->canvas = malloc(height * width * 4);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
178 if (!mng_priv->canvas) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
179 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
180 "demux_mng: could not allocate canvas of size %dx%d\n",
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
181 width, height);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
182 return MNG_FALSE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
183 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
184
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
185 return MNG_TRUE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
186 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
187
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
188 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
189 * \brief MNG library callback: Get access to a canvas line.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
190 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
191 * \param[in] line y coordinate of line to access
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
192 * \return pointer to line on success, \p MNG_NULL on error
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
193 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
194 static mng_ptr demux_mng_getcanvasline(mng_handle h_mng, mng_uint32 line)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
195 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
196 mng_priv_t * mng_priv = mng_get_userdata(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
197
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
198 // return pointer to canvas line
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
199 if (line < mng_priv->height && mng_priv->canvas)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
200 return (mng_ptr)(mng_priv->canvas + line * mng_priv->width * 4);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
201 else
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
202 return (mng_ptr)MNG_NULL;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
203 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
204
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
205 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
206 * \brief MNG library callback: A part of the canvas should be shown.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
207 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
208 * This function is called by libmng whenever it thinks a
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
209 * rectangular part of the display should be updated. This
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
210 * can happen multiple times for a frame and/or a single time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
211 * for a frame. Only the the part of the display occupied by
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
212 * the rectangle defined by x, y, width, height is to be updated.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
213 * It is possible that some parts of the display are not updated
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
214 * for many frames. There is no chance here to find out if the
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
215 * current frame is completed with this update or not.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
216 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
217 * This mechanism does not match MPlayer's demuxer architecture,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
218 * so it will not be used exactly as intended by libmng.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
219 * A new frame is generated in the demux_mng_fill_buffer() function
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
220 * whenever libmng tells us to wait for some time.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
221 *
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
222 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
223 * \param[in] x rectangle's left edge
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
224 * \param[in] y rectangle's top edge
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
225 * \param[in] width rectangle's width
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
226 * \param[in] height rectangle's heigt
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
227 * \return \p MNG_TRUE on success, \p MNG_FALSE on error (never happens)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
228 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
229 static mng_bool demux_mng_refresh(mng_handle h_mng, mng_uint32 x, mng_uint32 y,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
230 mng_uint32 width, mng_uint32 height)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
231 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
232 // nothing to do here, the image data is already on the canvas
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
233 return MNG_TRUE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
234 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
235
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
236 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
237 * \brief MNG library callback: Get how many milliseconds have passed.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
238 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
239 * \return global time in milliseconds
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
240 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
241 static mng_uint32 demux_mng_gettickcount(mng_handle h_mng)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
242 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
243 mng_priv_t * mng_priv = mng_get_userdata(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
244
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
245 // return current global time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
246 return mng_priv->global_time_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
247 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
248
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
249 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
250 * \brief MNG library callback: Please call again after some milliseconds.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
251 * \param[in] h_mng MNG library image handle
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
252 * \param[in] msecs number of milliseconds after which to call again
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
253 * \return \p MNG_TRUE on success, \p MNG_FALSE on error (never happens)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
254 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
255 static mng_bool demux_mng_settimer(mng_handle h_mng, mng_uint32 msecs)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
256 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
257 mng_priv_t * mng_priv = mng_get_userdata(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
258
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
259 // Save number of milliseconds after which to call the MNG library again
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
260 // in private data.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
261 mng_priv->timer_ms = msecs;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
262 return MNG_TRUE;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
263 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
264
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
265 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
266 * \brief MPlayer callback: Check if stream contains MNG data.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
267 * \param[in] demuxer demuxer structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
268 * \return demuxer type constant, \p 0 if unknown
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
269 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
270 static int demux_mng_check_file(demuxer_t *demuxer)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
271 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
272 char buf[4];
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
273 if (stream_read(demuxer->stream, buf, 4) != 4)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
274 return 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
275 if (memcmp(buf, "\x8AMNG", 4))
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
276 return 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
277 return DEMUXER_TYPE_MNG;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
278 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
279
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
280 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
281 * \brief MPlayer callback: Fill buffer from MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
282 * \param[in] demuxer demuxer structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
283 * \param[in] ds demuxer stream
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
284 * \return \p 1 on success, \p 0 on error
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
285 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
286 static int demux_mng_fill_buffer(demuxer_t * demuxer,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
287 demux_stream_t * ds)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
288 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
289 mng_priv_t * mng_priv = demuxer->priv;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
290 mng_handle h_mng = mng_priv->h_mng;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
291 mng_retcode mng_ret;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
292 demux_packet_t * dp;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
293
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
294 // exit if animation is finished
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
295 if (mng_priv->finished)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
296 return 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
297
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
298 // advance animation to requested next show time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
299 while (mng_priv->anim_cur_time_ms + mng_priv->anim_frame_duration_ms
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
300 <= mng_priv->show_next_time_ms && !mng_priv->finished) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
301
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
302 // advance global and animation time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
303 mng_priv->global_time_ms += mng_priv->anim_frame_duration_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
304 mng_priv->anim_cur_time_ms += mng_priv->anim_frame_duration_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
305
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
306 // Clear variable MNG library will write number of milliseconds to
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
307 // (via settimer callback).
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
308 mng_priv->timer_ms = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
309
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
310 // get next image from MNG library
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
311 if (mng_priv->displaying)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
312 mng_ret = mng_display_resume(h_mng); // resume displaying MNG data
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
313 // to canvas
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
314 else
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
315 mng_ret = mng_display(h_mng); // start displaying MNG data to canvas
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
316 if (mng_ret && mng_ret != MNG_NEEDTIMERWAIT) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
317 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
318 "demux_mng: could not display MNG data to canvas: "
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
319 "mng_retcode %d\n", mng_ret);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
320 return 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
321 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
322 mng_priv->displaying = 1; // mng_display() has been called now
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
323 mng_priv->finished = mng_ret == 0; // animation is finished iff
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
324 // mng_display() returned 0
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
325
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
326 // save current frame duration
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
327 mng_priv->anim_frame_duration_ms = mng_priv->timer_ms < 1
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
328 ? 1 : mng_priv->timer_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
329
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
330 } // while (mng_priv->anim_cur_time_ms + ...
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
331
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
332 // create a new demuxer packet
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
333 dp = new_demux_packet(mng_priv->height * mng_priv->width * 4);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
334
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
335 // copy image data into demuxer packet
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
336 memcpy(dp->buffer, mng_priv->canvas,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
337 mng_priv->height * mng_priv->width * 4);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
338
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
339 // set current show time to requested show time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
340 mng_priv->show_cur_time_ms = mng_priv->show_next_time_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
341
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
342 // get time of next frame to show
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
343 mng_priv->show_next_time_ms = mng_priv->anim_cur_time_ms
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
344 + mng_priv->anim_frame_duration_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
345
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
346 // Set position and timing information in demuxer video and demuxer packet.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
347 // - Time must be time of next frame and always be > 0 for the variable
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
348 // frame time mechanism (GIF, MATROSKA, MNG) in video.c to work.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
349 demuxer->video->dpos++;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
350 dp->pts = (float)mng_priv->show_next_time_ms / 1000.0f + MNG_START_PTS;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
351 dp->pos = stream_tell(demuxer->stream);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
352 ds_add_packet(demuxer->video, dp);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
353
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
354 return 1;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
355 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
356
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
357 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
358 * \brief MPlayer callback: Open MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
359 * \param[in] demuxer demuxer structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
360 * \return demuxer structure on success, \p NULL on error
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
361 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
362 static demuxer_t * demux_mng_open(demuxer_t * demuxer)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
363 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
364 mng_priv_t * mng_priv;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
365 mng_handle h_mng;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
366 mng_retcode mng_ret;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
367 sh_video_t * sh_video;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
368
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
369 // create private data structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
370 mng_priv = calloc(1, sizeof(mng_priv_t));
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
371
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
372 //stream pointer into private data
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
373 mng_priv->stream = demuxer->stream;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
374
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
375 // initialize MNG image instance
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
376 h_mng = mng_initialize((mng_ptr)mng_priv, demux_mng_alloc,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
377 demux_mng_free, MNG_NULL);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
378 if (!h_mng) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
379 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
380 "demux_mng: could not initialize MNG image instance\n");
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
381 free(mng_priv);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
382 return NULL;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
383 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
384
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
385 // MNG image handle into private data
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
386 mng_priv->h_mng = h_mng;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
387
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
388 // set required MNG callbacks
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
389 if (mng_setcb_openstream(h_mng, demux_mng_openstream) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
390 mng_setcb_closestream(h_mng, demux_mng_closestream) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
391 mng_setcb_readdata(h_mng, demux_mng_readdata) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
392 mng_setcb_processheader(h_mng, demux_mng_processheader) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
393 mng_setcb_getcanvasline(h_mng, demux_mng_getcanvasline) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
394 mng_setcb_refresh(h_mng, demux_mng_refresh) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
395 mng_setcb_gettickcount(h_mng, demux_mng_gettickcount) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
396 mng_setcb_settimer(h_mng, demux_mng_settimer) ||
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
397 mng_set_canvasstyle(h_mng, MNG_CANVAS_RGBA8)) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
398 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
399 "demux_mng: could not set MNG callbacks\n");
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
400 mng_cleanup(&h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
401 free(mng_priv);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
402 return NULL;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
403 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
404
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
405 // start reading MNG data
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
406 mng_ret = mng_read(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
407 if (mng_ret) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
408 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
409 "demux_mng: could not start reading MNG data: "
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
410 "mng_retcode %d\n", mng_ret);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
411 mng_cleanup(&h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
412 free(mng_priv);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
413 return NULL;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
414 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
415
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
416 // check that MNG header is processed now
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
417 if (!mng_priv->header_processed) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
418 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
419 "demux_mng: internal error: header not processed\n");
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
420 mng_cleanup(&h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
421 free(mng_priv);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
422 return NULL;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
423 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
424
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
425 // create a new video stream header
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
426 sh_video = new_sh_video(demuxer, 0);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
427
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
428 // Make sure the demuxer knows about the new video stream header
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
429 // (even though new_sh_video() ought to take care of it).
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
430 // (Thanks to demux_gif.c for this.)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
431 demuxer->video->sh = sh_video;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
432
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
433 // Make sure that the video demuxer stream header knows about its
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
434 // parent video demuxer stream (this is getting wacky), or else
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
435 // video_read_properties() will choke.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
436 // (Thanks to demux_gif.c for this.)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
437 sh_video->ds = demuxer->video;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
438
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
439 // set format of pixels in video packets
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
440 sh_video->format = mmioFOURCC(32, 'B', 'G', 'R');
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
441
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
442 // set framerate to some value (MNG does not have a fixed framerate)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
443 sh_video->fps = 5.0f;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
444 sh_video->frametime = 1.0f / sh_video->fps;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
445
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
446 // set video frame parameters
32123
a86413775fbe Replace sizeof(BITMAPINFOHEADER)
reimar
parents: 30633
diff changeset
447 sh_video->bih = malloc(sizeof(*sh_video->bih));
28018
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
448 sh_video->bih->biCompression = sh_video->format;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
449 sh_video->bih->biWidth = mng_priv->width;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
450 sh_video->bih->biHeight = mng_priv->height;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
451 sh_video->bih->biBitCount = 32;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
452 sh_video->bih->biPlanes = 1;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
453
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
454 // Set start time to something > 0.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
455 // - This is required for the variable frame time mechanism
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
456 // (GIF, MATROSKA, MNG) in video.c to work for the first frame.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
457 sh_video->ds->pts = MNG_START_PTS;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
458
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
459 // set private data in demuxer and return demuxer
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
460 demuxer->priv = mng_priv;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
461 return demuxer;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
462 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
463
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
464 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
465 * \brief MPlayer callback: Close MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
466 * \param[in] demuxer demuxer structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
467 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
468 static void demux_mng_close(demuxer_t* demuxer)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
469 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
470 mng_priv_t * mng_priv = demuxer->priv;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
471
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
472 if (mng_priv) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
473
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
474 // shutdown MNG image instance
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
475 if (mng_priv->h_mng)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
476 mng_cleanup(&mng_priv->h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
477
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
478 // free private data
32537
8fa2f43cb760 Remove most of the NULL pointer check before free all over the code
cboesch
parents: 32123
diff changeset
479 free(mng_priv->canvas);
28018
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
480
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
481 free(mng_priv);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
482 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
483 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
484
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
485 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
486 * \brief MPlayer callback: Seek in MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
487 * \param[in] demuxer demuxer structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
488 * \param[in] rel_seek_secs relative seek time in seconds
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
489 * \param[in] audio_delay unused, MNG does not contain audio
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
490 * \param[in] flags bit flags, \p 1: absolute, \p 2: fractional position
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
491 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
492 static void demux_mng_seek(demuxer_t * demuxer, float rel_seek_secs,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
493 float audio_delay, int flags)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
494 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
495 mng_priv_t * mng_priv = demuxer->priv;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
496 mng_handle h_mng = mng_priv->h_mng;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
497 mng_retcode mng_ret;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
498 int seek_ms, pos_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
499
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
500 // exit if not ready to seek (header not yet read or not yet displaying)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
501 if (!mng_priv->header_processed || !mng_priv->displaying)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
502 return;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
503
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
504 // get number of milliseconds to seek to
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
505 if (flags & 2) // seek by fractional position (0.0 ... 1.0)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
506 seek_ms = (int)(rel_seek_secs * (float)mng_priv->total_time_ms);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
507 else // seek by time in seconds
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
508 seek_ms = (int)(rel_seek_secs * 1000.0f + 0.5f);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
509
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
510 // get new position in milliseconds
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
511 if (flags & 1) // absolute
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
512 pos_ms = seek_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
513 else // relative
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
514 pos_ms = mng_priv->show_cur_time_ms + seek_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
515
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
516 // fix position
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
517 if (pos_ms < 0)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
518 pos_ms = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
519 if (pos_ms > mng_priv->total_time_ms)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
520 pos_ms = mng_priv->total_time_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
521
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
522 // FIXME
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
523 // In principle there is a function to seek in MNG: mng_display_gotime().
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
524 // - Using it did not work out (documentation is very brief,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
525 // example code does not exist?).
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
526 // - The following code works, but its performance is quite bad.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
527
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
528 // seeking forward
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
529 if (pos_ms >= mng_priv->show_cur_time_ms) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
530
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
531 // Simply advance show time to seek position.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
532 // - Everything else will be handled in demux_mng_fill_buffer().
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
533 mng_priv->show_next_time_ms = pos_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
534
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
535 } // if (pos_ms > mng_priv->show_time_ms)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
536
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
537 // seeking backward
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
538 else { // if (pos_ms > mng_priv->show_time_ms)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
539
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
540 // Clear variable MNG library will write number of milliseconds to
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
541 // (via settimer callback).
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
542 mng_priv->timer_ms = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
543
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
544 // Restart displaying and advance show time to seek position.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
545 // - Everything else will be handled in demux_mng_fill_buffer().
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
546 mng_ret = mng_display_reset(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
547 // If a timer wait is needed, fool libmng that requested time
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
548 // passed and try again.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
549 if (mng_ret == MNG_NEEDTIMERWAIT) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
550 mng_priv->global_time_ms += mng_priv->timer_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
551 mng_ret = mng_display_reset(h_mng);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
552 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
553 if (mng_ret) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
554 mp_msg(MSGT_DEMUX, MSGL_ERR,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
555 "demux_mng: could not reset MNG display state: "
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
556 "mng_retcode %d\n", mng_ret);
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
557 return;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
558 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
559 mng_priv->displaying = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
560 mng_priv->finished = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
561 mng_priv->anim_cur_time_ms = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
562 mng_priv->anim_frame_duration_ms = 0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
563 mng_priv->show_next_time_ms = pos_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
564
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
565 } // if (pos_ms > mng_priv->show_time_ms) ... else
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
566 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
567
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
568 /**
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
569 * \brief MPlayer callback: Control MNG stream.
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
570 * \param[in] demuxer demuxer structure
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
571 * \param[in] cmd code of control command to perform
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
572 * \param[in,out] arg command argument
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
573 * \return demuxer control response code
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
574 */
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
575 static int demux_mng_control(demuxer_t * demuxer, int cmd, void * arg)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
576 {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
577 mng_priv_t * mng_priv = demuxer->priv;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
578
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
579 switch(cmd) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
580
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
581 // get total movie length
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
582 case DEMUXER_CTRL_GET_TIME_LENGTH:
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
583 if (mng_priv->header_processed) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
584 *(double *)arg = (double)mng_priv->total_time_ms / 1000.0;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
585 return DEMUXER_CTRL_OK;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
586 } else {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
587 return DEMUXER_CTRL_DONTKNOW;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
588 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
589 break;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
590
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
591 // get position in movie
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
592 case DEMUXER_CTRL_GET_PERCENT_POS:
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
593 if (mng_priv->header_processed && mng_priv->total_time_ms > 0) {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
594 *(int *)arg = (100 * mng_priv->show_cur_time_ms
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
595 + mng_priv->total_time_ms / 2)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
596 / mng_priv->total_time_ms;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
597 return DEMUXER_CTRL_OK;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
598 } else {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
599 return DEMUXER_CTRL_DONTKNOW;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
600 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
601 break;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
602
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
603 default:
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
604 return DEMUXER_CTRL_NOTIMPL;
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
605
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
606 } // switch (cmd)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
607 }
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
608
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
609 const demuxer_desc_t demuxer_desc_mng = {
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
610 "MNG demuxer",
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
611 "mng",
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
612 "MNG",
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
613 "Stefan Schuermans <stefan@blinkenarea.org>",
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
614 "MNG files, using libmng",
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
615 DEMUXER_TYPE_MNG,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
616 0, // unsafe autodetect (only checking magic at beginning of stream)
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
617 demux_mng_check_file,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
618 demux_mng_fill_buffer,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
619 demux_mng_open,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
620 demux_mng_close,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
621 demux_mng_seek,
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
622 demux_mng_control
4ac70bd6acac MNG demuxer by Stefan Schuermans, stefan blinkenarea org
diego
parents:
diff changeset
623 };