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;
141 AVIStreamRelease(stream->
handle);
167 stream = &avs->
streams[stream_id];
169 if (stream->
read >= stream->
info.dwLength)
180 pkt->
size = read_size;
189 return (res == S_OK) ? pkt->
size : -1;
203 AVIFileRelease(avs->
file);
213 for (stream_id = 0; stream_id < avs->
nb_streams; stream_id++)
unsigned int stream_codec_tag
fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + ...
static int avisynth_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
int block_align
number of bytes per packet if constant and known or 0 Used by some WAV based audio codecs...
int id
Format-specific stream ID.
static av_cold int read_close(AVFormatContext *ctx)
int bits_per_coded_sample
bits per sample/pixel from the demuxer (needed for huffyuv).
static int avisynth_read_header(AVFormatContext *s)
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
AVStream * avformat_new_stream(AVFormatContext *s, AVCodec *c)
Add a new stream to a media file.
AVInputFormat ff_avisynth_demuxer
AVRational avg_frame_rate
Average framerate.
AVCodecContext * codec
Codec context associated with this stream.
static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
int bit_rate
the average bitrate
char filename[1024]
input or output filename
const AVCodecTag ff_codec_bmp_tags[]
int width
picture width / height.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static int read_header(FFV1Context *f)
enum AVMediaType codec_type
int sample_rate
samples per second
unsigned int codec_tag
fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A').
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
int64_t duration
Decoding: duration of the stream, in stream time base.
enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps)
int64_t start_time
Decoding: pts of the first frame of the stream, in stream time base.
static int avisynth_read_close(AVFormatContext *s)
int channels
number of audio channels
void * priv_data
Format private data.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...