From 5f3c3f8c32d20405a2caf7de66aa1ea7f513d4d2 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 24 Jul 2012 09:01:47 +0300 Subject: video, audio: use lavc decoders without codecs.conf entries Add support for using libavcodec decoders that do not have entries in codecs.conf. This is currently only used with demux_lavf, and the codec selection is based on codec_id returned by libavformat. Also modify codec-related terminal output somewhat to make it use information from libavcodec and avoid excessively long default output. The new any-lavc-codec support is implemented with codecs.conf entries that invoke vd_ffmpeg/ad_ffmpeg without directly specifying any libavcodec codec name. In this mode, the decoders now instead select the libavcodec codec based on codec_id previously set by demux_lavf (if any). These new "generic" codecs.conf entries specify "status buggy", so that they're tried after any specific entries with higher-priority status. Add new directive "anyinput" to codecs.conf syntax. This means the entry will always match regardless of fourcc. This is used for the above new codecs.conf entries (so the driver always gets to decide whether to accept the input, and will fail init() if it can't find a suitable codec in libavcodec). Remove parsing support for the obsolete codecs.conf directive "cpuflags". This directive has not had any effect and has not been used in default codecs.conf since many years ago. Shorten codec-related terminal output. When using libavcodec decoders, show the libavcodec long_name field rather than codecs.conf "info" field as the name of the codec. Stop showing the codecs.conf entry name and "vfm/afm" name by default, as these are rarely needed; they're now in verbose output only. Show "VIDEO:" line at VO initialization rather than at demuxer open. This didn't really belong in demuxer code; the new location may show more accurate values (known after decoder has been opened) and works right if video track is changed after initial demuxer open. The vd.c changes (primarily done for terminal output changes) remove round-to-even behavior from code setting dimensions based on aspect ratio. I hope nothing depended on this; at least the even values were not consistently guaranteed anyway, as the rounding code did not run if the video file did not specify a nonzero aspect value. --- libmpdemux/demuxer.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'libmpdemux/demuxer.c') diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 0ff734b074..8691880fe1 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -998,11 +998,8 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, if (!desc) // should only happen with obsolete -demuxer 99 numeric format return NULL; - demuxer = open_given_type(opts, desc, stream, force, audio_id, - video_id, sub_id, filename, params); - if (demuxer) - goto dmx_open; - return NULL; + return open_given_type(opts, desc, stream, force, audio_id, + video_id, sub_id, filename, params); } // Test demuxers with safe file checks @@ -1011,7 +1008,7 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, demuxer = open_given_type(opts, desc, stream, false, audio_id, video_id, sub_id, filename, params); if (demuxer) - goto dmx_open; + return demuxer; } } @@ -1024,7 +1021,7 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, demuxer = open_given_type(opts, desc, stream, false, audio_id, video_id, sub_id, filename, params); if (demuxer) - goto dmx_open; + return demuxer; } // Finally try detection for demuxers with unsafe checks @@ -1033,28 +1030,11 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, demuxer = open_given_type(opts, desc, stream, false, audio_id, video_id, sub_id, filename, params); if (demuxer) - goto dmx_open; + return demuxer; } } return NULL; - - dmx_open: - - if (demuxer->type == DEMUXER_TYPE_PLAYLIST) - return demuxer; - - struct sh_video *sh_video = demuxer->video->sh; - if (sh_video && sh_video->bih) { - int biComp = le2me_32(sh_video->bih->biCompression); - mp_msg(MSGT_DEMUX, MSGL_INFO, - "VIDEO: [%.4s] %dx%d %dbpp %5.3f fps %5.1f kbps (%4.1f kbyte/s)\n", - (char *) &biComp, sh_video->bih->biWidth, - sh_video->bih->biHeight, sh_video->bih->biBitCount, - sh_video->fps, sh_video->i_bps * 0.008f, - sh_video->i_bps / 1024.0f); - } - return demuxer; } struct demuxer *demux_open(struct MPOpts *opts, stream_t *vs, int file_format, -- cgit v1.2.3 From 8079f4ff821aa811de449f08dfdba777e8dd0397 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 25 Jul 2012 00:23:27 +0300 Subject: demux, vd_ffmpeg: fix demux keyframe flag, set AV_PKT_FLAG_KEY There was some confusion about the "flags" field in demuxer packets. Demuxers set it to either 1 or 0x10 to indicate a keyframe (and the field was not used to indicate anything else). This didn't cause visible problems because nothing read the value. Replace the "flags" field with a boolean "keyframe" field. Set AV_PKT_FLAG_KEY based on this field in packets fed to libavcodec video decoders (looks like PNG and ZeroCodec are the only ones which depend on values from demuxer; previously this was hardcoded to true for PNG). Make demux_mf set the keyframe field in every packet. This matters for PNG files now that the demuxer flag is forwarded to libavcodec. Fix logic setting the field in demux_mkv. It had probably not been updated when adding SimpleBlock support. This probably makes no difference for any current practical use. --- libmpdemux/demuxer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libmpdemux/demuxer.c') diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 8691880fe1..f00b0551d5 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -185,7 +185,7 @@ static struct demux_packet *create_packet(size_t len) dp->duration = -1; dp->stream_pts = MP_NOPTS_VALUE; dp->pos = 0; - dp->flags = 0; + dp->keyframe = false; dp->refcount = 1; dp->master = NULL; dp->buffer = NULL; @@ -599,14 +599,14 @@ void ds_clear_parser(demux_stream_t *ds) } void ds_read_packet(demux_stream_t *ds, stream_t *stream, int len, - double pts, off_t pos, int flags) + double pts, off_t pos, bool keyframe) { demux_packet_t *dp = new_demux_packet(len); len = stream_read(stream, dp->buffer, len); resize_demux_packet(dp, len); dp->pts = pts; dp->pos = pos; - dp->flags = flags; + dp->keyframe = keyframe; // append packet to DS stream: ds_add_packet(ds, dp); } @@ -650,7 +650,7 @@ int ds_fill_buffer(demux_stream_t *ds) ds->pts_bytes += p->len; // !!! if (p->stream_pts != MP_NOPTS_VALUE) demux->stream_pts = p->stream_pts; - ds->flags = p->flags; + ds->keyframe = p->keyframe; // unlink packet: ds->bytes -= p->len; ds->current = p; -- cgit v1.2.3