52 wchar_t filename_wchar[1024] = { 0 };
53 char filename_char[1024] = { 0 };
58 MultiByteToWideChar(CP_UTF8, 0, s->
filename, -1, filename_wchar, 1024);
59 WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wchar, -1, filename_char, 1024,
NULL,
NULL);
60 res = AVIFileOpen(&avs->
file, filename_char, OF_READ|OF_SHARE_DENY_WRITE,
NULL);
68 res = AVIFileInfo(avs->
file, &info,
sizeof(info));
78 for (
id=0;
id<info.dwStreams;
id++)
82 if (AVIFileGetStream(avs->
file, &stream->
handle, 0,
id) == S_OK)
84 if (AVIStreamInfo(stream->
handle, &stream->
info,
sizeof(stream->
info)) == S_OK)
86 if (stream->
info.fccType == streamtypeAUDIO)
89 LONG struct_size =
sizeof(WAVEFORMATEX);
90 if (AVIStreamReadFormat(stream->
handle, 0, &wvfmt, &struct_size) != S_OK)
103 stream->
chunck_samples = wvfmt.nSamplesPerSec * (uint64_t)info.dwScale / (uint64_t)info.dwRate;
109 else if (stream->
info.fccType == streamtypeVIDEO)
112 LONG struct_size =
sizeof(BITMAPINFO);
117 if (AVIStreamReadFormat(stream->
handle, 0, &imgfmt, &struct_size) != S_OK)
125 #if FF_API_R_FRAME_RATE
133 st->
codec->
bit_rate = (uint64_t)stream->
info.dwSampleSize * (uint64_t)stream->
info.dwRate * 8 / (uint64_t)stream->
info.dwScale;
149 AVIStreamRelease(stream->
handle);
175 stream = &avs->
streams[stream_id];
177 if (stream->
read >= stream->
info.dwLength)
187 pkt->
size = read_size;
196 return (res == S_OK) ? pkt->
size : -1;
210 AVIFileRelease(avs->
file);
220 for (stream_id = 0; stream_id < avs->
nb_streams; stream_id++)