Mercurial > hg > easaier-soundaccess
view sv/videoio/SDL_ffmpeg.h @ 129:587ad94d6ac2
(none)
author | ivand_qmul |
---|---|
date | Thu, 08 Nov 2007 13:29:48 +0000 |
parents | 66af7c1b10d9 |
children | c946c19e6329 |
line wrap: on
line source
/******************************************************************************* * * * SDL_ffmpeg is a library for basic multimedia functionality. * * SDL_ffmpeg is based on ffmpeg. * * * * Copyright (C) 2007 Arjan Houben * * * * SDL_ffmpeg is free software: you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License as published * * by the Free Software Foundation, either version 3 of the License, or any * * later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Lesser General Public License for more details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * * * *******************************************************************************/ #ifndef SDL_FFMPEG_INCLUDED #define SDL_FFMPEG_INCLUDED #ifdef __cplusplus extern "C" { #endif #ifdef WIN32 #ifdef SDL_FFMPEG_LIBRARY #define __STDC_LIMIT_MACROS #define __STDC_CONSTANT_MACROS #include "avformat.h" #include "swscale.h" #endif #include "SDL_thread.h" #include "SDL.h" #endif #ifdef __unix__ #include "SDL/SDL_thread.h" #include "SDL/SDL.h" #ifdef SDL_FFMPEG_LIBRARY #include "ffmpeg/avformat.h" #endif #endif #ifdef __cplusplus } #endif #define SWS_BICUBIC 4 const int SDL_FFMPEG_MAX_BUFFERED_FRAMES = 60; const int SDL_FFMPEG_MAX_BUFFERED_SAMPLES = 512*512; static int sws_flags = SWS_BICUBIC; // we pack our decoded images into bufferImage structs typedef struct bufferImage { // pointer to image data SDL_Surface *img; // timestamp of current image int64_t timestamp; } bufferImage; // this is the basic stream for SDL_ffmpeg typedef struct SDL_ffmpegStream { // pointer to ffmpeg data, internal use only! // points to AVCodecContext int pixFmt; void *_ffmpeg; // semaphore for current stream SDL_sem *sem; // audio/video buffers bufferImage **imageBuffer; int8_t *audio; int writeImage; int readImage; // userinfo double frameRate[2]; char language[4]; int sampleRate; int channels; char codecName[32]; double timeBase; uint16_t width; uint16_t height; // extra data for audio int32_t size; int id; int64_t lastTimeStamp; int64_t pts, hardPts; int64_t totalBytes; } SDL_ffmpegStream; typedef struct SDL_ffmpegFile { // pointer to ffmpeg data, internal use only! // points to AVFormatContext void *_ffmpeg; // our streams SDL_ffmpegStream **vs; SDL_ffmpegStream **as; // data used for syncing/searching int64_t offset, videoOffset, startTime; int pause; // streams and data about threads int VStreams, AStreams, videoStream, audioStream, threadActive, videoThreadActive; SDL_Thread *threadID, *videoThread; SDL_sem *decode; int skipAudio; int skipVideo; int delay; int64_t timer; int64_t countFreq; int timebase; int64_t audioTime; } SDL_ffmpegFile; int SDL_ffmpegStartDecoding(SDL_ffmpegFile* file); int SDL_ffmpegStopDecoding(SDL_ffmpegFile* file); SDL_Surface* SDL_ffmpegGetVideo(SDL_ffmpegFile* file); int SDL_ffmpegReleaseVideo(SDL_ffmpegFile *file, SDL_Surface *bmp); SDL_ffmpegStream* SDL_ffmpegGetAudioStream(SDL_ffmpegFile *file, int audioID); int SDL_ffmpegSelectAudioStream(SDL_ffmpegFile* file, int audioID); SDL_ffmpegStream* SDL_ffmpegGetVideoStream(SDL_ffmpegFile *file, int audioID); int SDL_ffmpegSelectVideoStream(SDL_ffmpegFile* file, int videoID); SDL_ffmpegFile* SDL_ffmpegCreateFile(); void SDL_ffmpegFree(SDL_ffmpegFile* file); SDL_ffmpegFile* SDL_ffmpegOpen(const char* filename); int SDL_ffmpegDecodeThread(void* data); int SDL_ffmpegSeek(SDL_ffmpegFile* file, int64_t timestamp); int SDL_ffmpegSeekRelative(SDL_ffmpegFile* file, int64_t timestamp); int SDL_ffmpegFlush(SDL_ffmpegFile *file); int8_t* SDL_ffmpegGetAudio(SDL_ffmpegFile *file, int *len); int SDL_ffmpegReleaseAudio(SDL_ffmpegFile *file, int len); int64_t SDL_ffmpegGetPosition(SDL_ffmpegFile *file); SDL_AudioSpec* SDL_ffmpegGetAudioSpec(SDL_ffmpegFile *file, int samples, void *callback); int SDL_ffmpegGetVideoSize(SDL_ffmpegFile *file, int *w, int *h); int64_t SDL_ffmpegGetDuration(SDL_ffmpegFile *file); int SDL_ffmpegValidAudio(SDL_ffmpegFile *file); int SDL_ffmpegValidVideo(SDL_ffmpegFile *file); int SDL_ffmpegPause(SDL_ffmpegFile *file, int state); int SDL_ffmpegGetState(SDL_ffmpegFile *file); #endif // SDL_FFMPEG_INCLUDED