From 3486302514db31b8086f46226d9b46d53810d1e7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 23 Nov 2013 21:36:20 +0100 Subject: video: move decoder context from sh_video into new struct This is similar to the sh_audio commit. This is mostly cosmetic in nature, except that it also adds automatical freeing of the decoder driver's state struct (which was in sh_video->context, now in dec_video->priv). Also remove all the stheader.h fields that are not needed anymore. --- demux/demux.c | 4 ---- demux/stheader.h | 51 ++++++++------------------------------------------- 2 files changed, 8 insertions(+), 47 deletions(-) (limited to 'demux') diff --git a/demux/demux.c b/demux/demux.c index 095c23fd0c..592ad1608a 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -241,7 +241,6 @@ struct sh_stream *new_sh_stream(demuxer_t *demuxer, enum stream_type type) .demuxer = demuxer, .index = demuxer->num_streams, .demuxer_id = demuxer_id, // may be overwritten by demuxer - .opts = demuxer->opts, .ds = talloc_zero(sh, struct demux_stream), }; MP_TARRAY_APPEND(demuxer, demuxer->streams, demuxer->num_streams, sh); @@ -249,21 +248,18 @@ struct sh_stream *new_sh_stream(demuxer_t *demuxer, enum stream_type type) case STREAM_VIDEO: { struct sh_video *sht = talloc_zero(demuxer, struct sh_video); sht->gsh = sh; - sht->opts = sh->opts; sh->video = sht; break; } case STREAM_AUDIO: { struct sh_audio *sht = talloc_zero(demuxer, struct sh_audio); sht->gsh = sh; - sht->opts = sh->opts; sh->audio = sht; break; } case STREAM_SUB: { struct sh_sub *sht = talloc_zero(demuxer, struct sh_sub); sht->gsh = sh; - sht->opts = sh->opts; sh->sub = sht; break; } diff --git a/demux/stheader.h b/demux/stheader.h index eb7c3d132b..1c151cda3d 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -63,30 +63,14 @@ struct sh_stream { // stream is a picture (such as album art) struct demux_packet *attached_picture; - // Human readable description of the running decoder, or NULL - char *decoder_desc; - - // shouldn't exist type of stuff - struct MPOpts *opts; - // Internal to demux.c struct demux_stream *ds; }; -#define SH_COMMON \ - struct sh_stream *gsh; \ - struct MPOpts *opts; \ - /* usually a FourCC, exact meaning depends on gsh->format */ \ - unsigned int format; \ - int initialized; \ - /* audio: last known pts value in output from decoder \ - * video: predicted/interpolated PTS of the current frame */ \ - double pts; \ - /* decoder context */ \ - void *context; \ - typedef struct sh_audio { - SH_COMMON + struct sh_stream *gsh; + /* usually a FourCC, exact meaning depends on gsh->codec */ + unsigned int format; int samplerate; struct mp_chmap channels; int i_bps; // == bitrate (compressed bytes/sec) @@ -98,37 +82,18 @@ typedef struct sh_audio { } sh_audio_t; typedef struct sh_video { - SH_COMMON - float next_frame_time; - double last_pts; - double buffered_pts[32]; - int num_buffered_pts; - 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; - // output format: (set by demuxer) + struct sh_stream *gsh; + /* usually a FourCC, exact meaning depends on gsh->codec */ + unsigned int format; float fps; // frames per second (set only if constant fps) float aspect; // aspect ratio stored in the file (for prescaling) - float stream_aspect; // aspect ratio in media headers (DVD IFO files) int i_bps; // == bitrate (compressed bytes/sec) - int disp_w, disp_h; // display size (filled by demuxer or decoder) - // output driver/filters: (set by libmpcodecs core) - struct vf_instance *vfilter; // video filter chain - const struct vd_functions *vd_driver; - int vf_initialized; // -1 failed, 0 not done, 1 done - long vf_reconfig_count; // incremented each mpcodecs_reconfig_vo() call - struct mp_image_params *vf_input; // video filter input params - struct mp_hwdec_info *hwdec_info; // video output hwdec handles - // win32-compatible codec parameters: + int disp_w, disp_h; // display size MP_BITMAPINFOHEADER *bih; } sh_video_t; typedef struct sh_sub { - SH_COMMON + struct sh_stream *gsh; unsigned char *extradata; // extra header data passed from demuxer int extradata_len; int frame_based; // timestamps are frame-based -- cgit v1.2.3