2009-05-08 21:51:13 +00:00
|
|
|
/*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_STHEADER_H
|
|
|
|
#define MPLAYER_STHEADER_H
|
2002-03-03 18:47:29 +00:00
|
|
|
|
2004-04-28 10:18:33 +00:00
|
|
|
#include "aviheader.h"
|
|
|
|
#include "ms_hdr.h"
|
2008-04-16 01:23:38 +00:00
|
|
|
struct MPOpts;
|
2009-04-19 14:37:03 +00:00
|
|
|
struct demuxer;
|
2002-09-22 00:43:14 +00:00
|
|
|
|
|
|
|
// Stream headers:
|
2002-01-16 12:24:36 +00:00
|
|
|
|
2009-12-27 14:40:56 +00:00
|
|
|
#define SH_COMMON \
|
2009-12-29 22:53:08 +00:00
|
|
|
struct MPOpts *opts; \
|
|
|
|
struct demux_stream *ds; \
|
|
|
|
struct codecs *codec; \
|
2009-12-27 14:40:56 +00:00
|
|
|
unsigned int format; \
|
|
|
|
int initialized; \
|
|
|
|
float stream_delay; /* number of seconds stream should be delayed (according to dwStart or similar) */ \
|
2009-12-27 15:28:01 +00:00
|
|
|
/* things needed for parsing */ \
|
|
|
|
int needs_parsing; \
|
|
|
|
struct AVCodecContext *avctx; \
|
|
|
|
struct AVCodecParserContext *parser; \
|
2009-12-27 14:40:56 +00:00
|
|
|
/* audio: last known pts value in output from decoder \
|
|
|
|
* video: predicted/interpolated PTS of the current frame */ \
|
|
|
|
double pts; \
|
|
|
|
/* codec-specific: */ \
|
|
|
|
void* context; /* codec-specific stuff (usually HANDLE or struct pointer) */ \
|
|
|
|
char* lang; /* track language */ \
|
|
|
|
int default_track; \
|
|
|
|
|
2009-12-29 22:53:08 +00:00
|
|
|
typedef struct sh_common {
|
2009-12-27 14:40:56 +00:00
|
|
|
SH_COMMON
|
|
|
|
} sh_common_t;
|
|
|
|
|
2008-04-16 02:00:34 +00:00
|
|
|
typedef struct sh_audio {
|
2009-12-27 14:40:56 +00:00
|
|
|
SH_COMMON
|
2006-08-26 19:17:04 +00:00
|
|
|
int aid;
|
2002-09-21 23:23:03 +00:00
|
|
|
// output format:
|
|
|
|
int sample_format;
|
2001-04-06 01:18:59 +00:00
|
|
|
int samplerate;
|
|
|
|
int samplesize;
|
|
|
|
int channels;
|
2001-05-10 03:39:54 +00:00
|
|
|
int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec)
|
|
|
|
int i_bps; // == bitrate (compressed bytes/sec)
|
2001-04-06 16:31:18 +00:00
|
|
|
// in buffers:
|
2002-10-05 22:55:45 +00:00
|
|
|
int audio_in_minsize; // max. compressed packet size (== min. in buffer size)
|
2001-04-06 01:18:59 +00:00
|
|
|
char* a_in_buffer;
|
|
|
|
int a_in_buffer_len;
|
|
|
|
int a_in_buffer_size;
|
2002-10-05 22:55:45 +00:00
|
|
|
// decoder buffers:
|
|
|
|
int audio_out_minsize; // max. uncompressed packet size (==min. out buffsize)
|
2001-04-06 16:31:18 +00:00
|
|
|
char* a_buffer;
|
|
|
|
int a_buffer_len;
|
|
|
|
int a_buffer_size;
|
2002-10-05 22:55:45 +00:00
|
|
|
// output buffers:
|
|
|
|
char* a_out_buffer;
|
|
|
|
int a_out_buffer_len;
|
|
|
|
int a_out_buffer_size;
|
|
|
|
// void* audio_out; // the audio_out handle, used for this audio stream
|
2008-04-24 02:49:44 +00:00
|
|
|
struct af_stream *afilter; // the audio filter stream
|
2010-07-01 20:41:42 +00:00
|
|
|
const struct ad_functions *ad_driver;
|
2008-08-07 12:20:50 +00:00
|
|
|
#ifdef CONFIG_DYNAMIC_PLUGINS
|
2002-11-11 17:28:41 +00:00
|
|
|
void *dec_handle;
|
|
|
|
#endif
|
2002-09-21 23:23:03 +00:00
|
|
|
// win32-compatible codec parameters:
|
2001-04-06 01:18:59 +00:00
|
|
|
AVIStreamHeader audio;
|
2002-09-21 23:23:03 +00:00
|
|
|
WAVEFORMATEX* wf;
|
|
|
|
// codec-specific:
|
|
|
|
unsigned char* codecdata; // extra header data passed from demuxer to codec
|
2002-03-24 02:25:41 +00:00
|
|
|
int codecdata_len;
|
2006-04-24 10:58:40 +00:00
|
|
|
int pts_bytes; // bytes output by decoder after last known pts
|
2001-04-06 01:18:59 +00:00
|
|
|
} sh_audio_t;
|
|
|
|
|
2008-04-16 02:00:34 +00:00
|
|
|
typedef struct sh_video {
|
2009-12-27 14:40:56 +00:00
|
|
|
SH_COMMON
|
2006-08-26 19:17:04 +00:00
|
|
|
int vid;
|
2002-11-02 19:59:40 +00:00
|
|
|
float timer; // absolute time in video stream, since last start/seek
|
2002-09-21 23:23:03 +00:00
|
|
|
// frame counters:
|
2001-07-28 20:33:51 +00:00
|
|
|
float num_frames; // number of frames played
|
2002-09-21 23:23:03 +00:00
|
|
|
int num_frames_decoded; // number of frames decoded
|
2003-01-16 22:34:46 +00:00
|
|
|
// timing (mostly for mpeg):
|
2006-04-27 11:13:21 +00:00
|
|
|
double i_pts; // PTS for the _next_ I/P frame
|
2006-11-20 09:12:07 +00:00
|
|
|
float next_frame_time;
|
|
|
|
double last_pts;
|
2006-07-06 06:58:17 +00:00
|
|
|
double buffered_pts[20];
|
|
|
|
int num_buffered_pts;
|
2009-11-21 18:53:10 +00:00
|
|
|
double codec_reordered_pts;
|
|
|
|
double prev_codec_reordered_pts;
|
|
|
|
int num_reordered_pts_problems;
|
|
|
|
double sorted_pts;
|
|
|
|
double prev_sorted_pts;
|
|
|
|
int num_sorted_pts_problems;
|
|
|
|
int pts_assoc_mode;
|
2002-09-21 23:23:03 +00:00
|
|
|
// output format: (set by demuxer)
|
|
|
|
float fps; // frames per second (set only if constant fps)
|
|
|
|
float frametime; // 1/fps
|
|
|
|
float aspect; // aspect ratio stored in the file (for prescaling)
|
2007-09-01 15:54:45 +00:00
|
|
|
float stream_aspect; // aspect ratio stored in the media headers (e.g. in DVD IFO files)
|
2002-09-21 23:23:03 +00:00
|
|
|
int i_bps; // == bitrate (compressed bytes/sec)
|
|
|
|
int disp_w,disp_h; // display size (filled by fileformat parser)
|
|
|
|
// output driver/filters: (set by libmpcodecs core)
|
|
|
|
unsigned int outfmtidx;
|
2008-04-24 02:49:44 +00:00
|
|
|
struct vf_instance *vfilter; // the video filter chain, used for this video stream
|
2008-04-24 05:16:11 +00:00
|
|
|
int output_flags; // query_format() results for output filters+vo
|
2008-04-24 05:43:56 +00:00
|
|
|
const struct vd_functions *vd_driver;
|
2008-02-14 14:23:55 +00:00
|
|
|
int vf_initialized;
|
2008-08-07 12:20:50 +00:00
|
|
|
#ifdef CONFIG_DYNAMIC_PLUGINS
|
2002-11-11 17:28:41 +00:00
|
|
|
void *dec_handle;
|
|
|
|
#endif
|
2002-09-21 23:23:03 +00:00
|
|
|
// win32-compatible codec parameters:
|
|
|
|
AVIStreamHeader video;
|
|
|
|
BITMAPINFOHEADER* bih;
|
2002-11-11 23:46:27 +00:00
|
|
|
void* ImageDesc; // for quicktime codecs
|
2001-04-06 01:18:59 +00:00
|
|
|
} sh_video_t;
|
|
|
|
|
2008-04-16 02:00:34 +00:00
|
|
|
typedef struct sh_sub {
|
2009-12-27 14:40:56 +00:00
|
|
|
SH_COMMON
|
2006-11-13 18:38:29 +00:00
|
|
|
int sid;
|
|
|
|
char type; // t = text, v = VobSub, a = SSA/ASS
|
2008-01-11 21:45:10 +00:00
|
|
|
unsigned char* extradata; // extra header data passed from demuxer
|
|
|
|
int extradata_len;
|
2009-07-28 22:11:33 +00:00
|
|
|
struct ass_track *ass_track; // for SSA/ASS streams (type == 'a')
|
2006-11-13 18:38:29 +00:00
|
|
|
} sh_sub_t;
|
|
|
|
|
2002-09-21 23:23:03 +00:00
|
|
|
// demuxer.c:
|
2006-08-26 19:17:04 +00:00
|
|
|
#define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
|
2009-04-19 14:37:03 +00:00
|
|
|
sh_audio_t* new_sh_audio_aid(struct demuxer *demuxer,int id,int aid);
|
2006-08-26 19:17:04 +00:00
|
|
|
#define new_sh_video(d, i) new_sh_video_vid(d, i, i)
|
2009-04-19 14:37:03 +00:00
|
|
|
sh_video_t* new_sh_video_vid(struct demuxer *demuxer,int id,int vid);
|
2006-11-13 16:18:05 +00:00
|
|
|
#define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
|
2009-04-19 14:37:03 +00:00
|
|
|
sh_sub_t *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
|
|
|
|
void free_sh_audio(struct demuxer *demuxer, int id);
|
2002-03-15 15:53:11 +00:00
|
|
|
void free_sh_video(sh_video_t *sh);
|
2001-04-15 03:40:37 +00:00
|
|
|
|
2002-09-21 23:23:03 +00:00
|
|
|
// video.c:
|
2001-10-30 20:36:20 +00:00
|
|
|
int video_read_properties(sh_video_t *sh_video);
|
|
|
|
int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps);
|
2002-03-03 18:47:29 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_STHEADER_H */
|