mirror of https://github.com/mpv-player/mpv
Introduce a sh_common struct that contains the parts in common by the audio, video
and sub "stream headers". One reason for this is to help avoid/make more obvious things like members with the same function but different name (extradata vs. codecdata etc.), or members with the same name but different semantics (pts for audio vs. pts for video). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30128 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
4fbcbaacbc
commit
52dab179cb
|
@ -25,13 +25,31 @@
|
||||||
|
|
||||||
// Stream headers:
|
// Stream headers:
|
||||||
|
|
||||||
|
#define SH_COMMON \
|
||||||
|
demux_stream_t *ds; \
|
||||||
|
struct codecs_st *codec; \
|
||||||
|
unsigned int format; \
|
||||||
|
int initialized; \
|
||||||
|
float stream_delay; /* number of seconds stream should be delayed (according to dwStart or similar) */ \
|
||||||
|
/* things needed for parsing */ \
|
||||||
|
int needs_parsing; \
|
||||||
|
struct AVCodecContext *avctx; \
|
||||||
|
struct AVCodecParserContext *parser; \
|
||||||
|
/* 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; \
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
SH_COMMON
|
||||||
|
} sh_common_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SH_COMMON
|
||||||
int aid;
|
int aid;
|
||||||
demux_stream_t *ds;
|
|
||||||
struct codecs_st *codec;
|
|
||||||
unsigned int format;
|
|
||||||
int initialized;
|
|
||||||
float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
|
|
||||||
// output format:
|
// output format:
|
||||||
int sample_format;
|
int sample_format;
|
||||||
int samplerate;
|
int samplerate;
|
||||||
|
@ -63,28 +81,19 @@ typedef struct {
|
||||||
AVIStreamHeader audio;
|
AVIStreamHeader audio;
|
||||||
WAVEFORMATEX* wf;
|
WAVEFORMATEX* wf;
|
||||||
// codec-specific:
|
// codec-specific:
|
||||||
void* context; // codec-specific stuff (usually HANDLE or struct pointer)
|
|
||||||
unsigned char* codecdata; // extra header data passed from demuxer to codec
|
unsigned char* codecdata; // extra header data passed from demuxer to codec
|
||||||
int codecdata_len;
|
int codecdata_len;
|
||||||
double pts; // last known pts value in output from decoder
|
|
||||||
int pts_bytes; // bytes output by decoder after last known pts
|
int pts_bytes; // bytes output by decoder after last known pts
|
||||||
char* lang; // track language
|
|
||||||
int default_track;
|
|
||||||
} sh_audio_t;
|
} sh_audio_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
SH_COMMON
|
||||||
int vid;
|
int vid;
|
||||||
demux_stream_t *ds;
|
|
||||||
struct codecs_st *codec;
|
|
||||||
unsigned int format;
|
|
||||||
int initialized;
|
|
||||||
float timer; // absolute time in video stream, since last start/seek
|
float timer; // absolute time in video stream, since last start/seek
|
||||||
float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
|
|
||||||
// frame counters:
|
// frame counters:
|
||||||
float num_frames; // number of frames played
|
float num_frames; // number of frames played
|
||||||
int num_frames_decoded; // number of frames decoded
|
int num_frames_decoded; // number of frames decoded
|
||||||
// timing (mostly for mpeg):
|
// timing (mostly for mpeg):
|
||||||
double pts; // predicted/interpolated PTS of the current frame
|
|
||||||
double i_pts; // PTS for the _next_ I/P frame
|
double i_pts; // PTS for the _next_ I/P frame
|
||||||
float next_frame_time;
|
float next_frame_time;
|
||||||
double last_pts;
|
double last_pts;
|
||||||
|
@ -108,11 +117,10 @@ typedef struct {
|
||||||
AVIStreamHeader video;
|
AVIStreamHeader video;
|
||||||
BITMAPINFOHEADER* bih;
|
BITMAPINFOHEADER* bih;
|
||||||
void* ImageDesc; // for quicktime codecs
|
void* ImageDesc; // for quicktime codecs
|
||||||
// codec-specific:
|
|
||||||
void* context; // codec-specific stuff (usually HANDLE or struct pointer)
|
|
||||||
} sh_video_t;
|
} sh_video_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
SH_COMMON
|
||||||
int sid;
|
int sid;
|
||||||
char type; // t = text, v = VobSub, a = SSA/ASS
|
char type; // t = text, v = VobSub, a = SSA/ASS
|
||||||
unsigned char* extradata; // extra header data passed from demuxer
|
unsigned char* extradata; // extra header data passed from demuxer
|
||||||
|
@ -120,8 +128,6 @@ typedef struct {
|
||||||
#ifdef CONFIG_ASS
|
#ifdef CONFIG_ASS
|
||||||
ass_track_t* ass_track; // for SSA/ASS streams (type == 'a')
|
ass_track_t* ass_track; // for SSA/ASS streams (type == 'a')
|
||||||
#endif
|
#endif
|
||||||
char* lang; // track language
|
|
||||||
int default_track;
|
|
||||||
} sh_sub_t;
|
} sh_sub_t;
|
||||||
|
|
||||||
// demuxer.c:
|
// demuxer.c:
|
||||||
|
|
Loading…
Reference in New Issue