comparison libmpdemux/demux_roq.c @ 16175:6b86089c2edd

Demuxer modularization Demuxer selection by name with -demuxer command (bakward compatible)
author rtognimp
date Fri, 05 Aug 2005 19:57:47 +0000
parents 1a26db279e50
children 83c3afeab35d
comparison
equal deleted inserted replaced
16174:b118c000ddd2 16175:6b86089c2edd
46 } roq_data_t; 46 } roq_data_t;
47 47
48 // Check if a stream qualifies as a RoQ file based on the magic numbers 48 // Check if a stream qualifies as a RoQ file based on the magic numbers
49 // at the start of the file: 49 // at the start of the file:
50 // 84 10 FF FF FF FF xx xx 50 // 84 10 FF FF FF FF xx xx
51 int roq_check_file(demuxer_t *demuxer) 51 static int roq_check_file(demuxer_t *demuxer)
52 { 52 {
53 if ((stream_read_dword(demuxer->stream) == 0x8410FFFF) && 53 if ((stream_read_dword(demuxer->stream) == 0x8410FFFF) &&
54 ((stream_read_dword(demuxer->stream) & 0xFFFF0000) == 0xFFFF0000)) 54 ((stream_read_dword(demuxer->stream) & 0xFFFF0000) == 0xFFFF0000))
55 return 1; 55 return DEMUXER_TYPE_ROQ;
56 else 56 else
57 return 0; 57 return 0;
58 } 58 }
59 59
60 // return value: 60 // return value:
61 // 0 = EOF or no stream found 61 // 0 = EOF or no stream found
62 // 1 = successfully read a packet 62 // 1 = successfully read a packet
63 int demux_roq_fill_buffer(demuxer_t *demuxer) 63 static int demux_roq_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
64 { 64 {
65 sh_video_t *sh_video = demuxer->video->sh; 65 sh_video_t *sh_video = demuxer->video->sh;
66 roq_data_t *roq_data = (roq_data_t *)demuxer->priv; 66 roq_data_t *roq_data = (roq_data_t *)demuxer->priv;
67 roq_chunk_t roq_chunk; 67 roq_chunk_t roq_chunk;
68 68
85 85
86 roq_data->current_chunk++; 86 roq_data->current_chunk++;
87 return 1; 87 return 1;
88 } 88 }
89 89
90 demuxer_t* demux_open_roq(demuxer_t* demuxer) 90 static demuxer_t* demux_open_roq(demuxer_t* demuxer)
91 { 91 {
92 sh_video_t *sh_video = NULL; 92 sh_video_t *sh_video = NULL;
93 sh_audio_t *sh_audio = NULL; 93 sh_audio_t *sh_audio = NULL;
94 94
95 roq_data_t *roq_data = (roq_data_t *)malloc(sizeof(roq_data_t)); 95 roq_data_t *roq_data = (roq_data_t *)malloc(sizeof(roq_data_t));
238 stream_reset(demuxer->stream); 238 stream_reset(demuxer->stream);
239 239
240 return demuxer; 240 return demuxer;
241 } 241 }
242 242
243 void demux_close_roq(demuxer_t* demuxer) { 243 static void demux_close_roq(demuxer_t* demuxer) {
244 roq_data_t *roq_data = demuxer->priv; 244 roq_data_t *roq_data = demuxer->priv;
245 245
246 if(!roq_data) 246 if(!roq_data)
247 return; 247 return;
248 free(roq_data); 248 free(roq_data);
249 } 249 }
250 250
251
252 demuxer_desc_t demuxer_desc_roq = {
253 "RoQ demuxer",
254 "roq",
255 "ROQ",
256 "Mike Melanson",
257 "",
258 DEMUXER_TYPE_ROQ,
259 0, // unsafe autodetect
260 roq_check_file,
261 demux_roq_fill_buffer,
262 demux_open_roq,
263 demux_close_roq,
264 NULL,
265 NULL
266 };