Mercurial > mplayer.hg
annotate libmpdemux/demux_nuv.c @ 4030:922241968c63
Embedding vidix
author | nick |
---|---|
date | Mon, 07 Jan 2002 09:28:22 +0000 |
parents | 79e1c3c0e634 |
children | 763a0e7e0521 |
rev | line source |
---|---|
3801
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
1 /* |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
2 * NuppelVideo 0.05 file parser |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
3 * for MPlayer |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
4 * by Panagiotis Issaris <takis@lumumba.luc.ac.be> |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
5 * |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
6 * Reworked by alex |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
7 */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
8 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
9 #include <stdio.h> |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
10 #include <stdlib.h> |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
11 #include <unistd.h> |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
12 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
13 #include "config.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
14 #include "mp_msg.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
15 #include "help_mp.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
16 #include "stream.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
17 #include "demuxer.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
18 #include "stheader.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
19 #include "nuppelvideo.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
20 //#include "RTjpegN.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
21 //#include "minilzo.h" |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
22 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
23 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
24 struct nuv_signature |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
25 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
26 char finfo[12]; /* "NuppelVideo" + \0 */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
27 char version[5]; /* "0.05" + \0 */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
28 }; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
29 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
30 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
31 void demux_seek_nuv ( demuxer_t *demuxer, float rel_seek_secs, int flags ) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
32 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
33 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
34 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
35 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
36 int demux_nuv_fill_buffer ( demuxer_t *demuxer ) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
37 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
38 struct rtframeheader rtjpeg_frameheader; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
39 int orig_pos; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
40 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
41 orig_pos = stream_tell ( demuxer->stream ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
42 if (stream_read ( demuxer->stream, (char*)& rtjpeg_frameheader, sizeof ( rtjpeg_frameheader ) ) < sizeof(rtjpeg_frameheader)) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
43 return 0; /* EOF */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
44 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
45 #if 0 |
3811 | 46 printf("NUV frame: frametype: %c, comptype: %c, packetlength: %d\n", |
47 rtjpeg_frameheader.frametype, rtjpeg_frameheader.comptype, | |
48 rtjpeg_frameheader.packetlength); | |
3801
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
49 #endif |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
50 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
51 /* Skip Seekpoint, Text and Sync for now */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
52 if ((rtjpeg_frameheader.frametype == 'R') || |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
53 (rtjpeg_frameheader.frametype == 'T') || |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
54 (rtjpeg_frameheader.frametype == 'S')) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
55 return 1; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
56 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
57 if (((rtjpeg_frameheader.frametype == 'D') && |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
58 (rtjpeg_frameheader.comptype == 'R')) || |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
59 (rtjpeg_frameheader.frametype == 'V')) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
60 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
61 /* put RTjpeg tables, Video info to video buffer */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
62 stream_seek ( demuxer->stream, orig_pos ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
63 ds_read_packet ( demuxer->video, demuxer->stream, rtjpeg_frameheader.packetlength + 12, |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
64 rtjpeg_frameheader.timecode / 1000, orig_pos, 0 ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
65 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
66 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
67 /* copy PCM only */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
68 if (demuxer->audio && (rtjpeg_frameheader.frametype == 'A') && |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
69 (rtjpeg_frameheader.comptype == '0')) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
70 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
71 /* put Audio to audio buffer */ |
3960
79e1c3c0e634
last minute audio demuxer patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3958
diff
changeset
|
72 ds_read_packet ( demuxer->audio, demuxer->stream, rtjpeg_frameheader.packetlength, |
79e1c3c0e634
last minute audio demuxer patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3958
diff
changeset
|
73 rtjpeg_frameheader.timecode / 1000, orig_pos + 12, 0 ); |
3801
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
74 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
75 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
76 return 1; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
77 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
78 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
79 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
80 demuxer_t* demux_open_nuv ( demuxer_t* demuxer ) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
81 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
82 sh_video_t *sh_video = NULL; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
83 sh_audio_t *sh_audio = NULL; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
84 struct rtfileheader rtjpeg_fileheader; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
85 struct rtframeheader rtjpeg_frameheader; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
86 unsigned long int tbls[128]; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
87 int bytes_read; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
88 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
89 /* Go to the start */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
90 stream_reset(demuxer->stream); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
91 stream_seek(demuxer->stream, 0); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
92 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
93 stream_read ( demuxer->stream, (char*)& rtjpeg_fileheader, sizeof(rtjpeg_fileheader) ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
94 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
95 /* no video */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
96 if (rtjpeg_fileheader.videoblocks == 0) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
97 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
98 printf("No video blocks in file\n"); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
99 return NULL; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
100 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
101 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
102 /* Create a new video stream header */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
103 sh_video = new_sh_video ( demuxer, 0 ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
104 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
105 /* Make sure the demuxer knows about the new video stream header |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
106 * (even though new_sh_video() ought to take care of it) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
107 */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
108 demuxer->video->sh = sh_video; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
109 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
110 /* Make sure that the video demuxer stream header knows about its |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
111 * parent video demuxer stream (this is getting wacky), or else |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
112 * video_read_properties() will choke |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
113 */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
114 sh_video->ds = demuxer->video; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
115 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
116 /* Custom fourcc for internal MPlayer use */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
117 sh_video->format = mmioFOURCC('N', 'U', 'V', '1'); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
118 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
119 sh_video->disp_w = rtjpeg_fileheader.width; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
120 sh_video->disp_h = rtjpeg_fileheader.height; |
3811 | 121 |
3958
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
122 /* NuppelVideo uses pixel aspect ratio |
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
123 here display aspect ratio is used. |
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
124 For the moment NuppelVideo only supports 1.0 thus |
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
125 1.33 == 4:3 aspect ratio. |
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
126 */ |
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
127 if(rtjpeg_fileheader.aspect == 1.0) |
5e61815deced
last minute aspect patch by Panagiotis Issaris <takis@lumumba.luc.ac.be>
arpi
parents:
3811
diff
changeset
|
128 sh_video->aspect = (float) 1.33; |
3801
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
129 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
130 /* Get the FPS */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
131 sh_video->fps = rtjpeg_fileheader.fps; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
132 sh_video->frametime = 1 / sh_video->fps; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
133 |
3811 | 134 #if 1 |
3801
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
135 if (rtjpeg_fileheader.audioblocks != 0) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
136 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
137 sh_audio = new_sh_audio(demuxer, 0); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
138 demuxer->audio->sh = sh_audio; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
139 sh_audio->ds = demuxer->audio; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
140 sh_audio->format = 0x1; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
141 sh_audio->channels = 2; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
142 sh_audio->samplerate = 44100; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
143 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
144 sh_audio->wf = malloc(sizeof(WAVEFORMATEX)); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
145 memset(sh_audio->wf, 0, sizeof(WAVEFORMATEX)); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
146 sh_audio->wf->wFormatTag = sh_audio->format; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
147 sh_audio->wf->nChannels = sh_audio->channels; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
148 sh_audio->wf->wBitsPerSample = 16; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
149 sh_audio->wf->nSamplesPerSec = sh_audio->samplerate; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
150 sh_audio->wf->nAvgBytesPerSec = sh_audio->wf->nChannels* |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
151 sh_audio->wf->wBitsPerSample*sh_audio->wf->nSamplesPerSec/8; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
152 sh_audio->wf->nBlockAlign = sh_audio->channels * 2; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
153 sh_audio->wf->cbSize = 0; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
154 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
155 #endif |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
156 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
157 return demuxer; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
158 } |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
159 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
160 int nuv_check_file ( demuxer_t* demuxer ) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
161 { |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
162 struct nuv_signature ns; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
163 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
164 /* Store original position */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
165 int orig_pos = stream_tell(demuxer->stream); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
166 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
167 mp_msg ( MSGT_DEMUX, MSGL_V, "Checking for NuppelVideo\n" ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
168 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
169 stream_read(demuxer->stream,(char*)&ns,sizeof(ns)); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
170 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
171 if ( strncmp ( ns.finfo, "NuppelVideo", 12 ) ) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
172 return 0; /* Not a NuppelVideo file */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
173 if ( strncmp ( ns.version, "0.05", 5 ) ) |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
174 return 0; /* Wrong version NuppelVideo file */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
175 |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
176 /* Return to original position */ |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
177 stream_seek ( demuxer->stream, orig_pos ); |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
178 return 1; |
3cea69dda1b3
added NuppelVideo demuxer, based on Panagiotis Issaris' patch
alex
parents:
diff
changeset
|
179 } |