[FFmpeg-devel] Codec detailed info (continuation)
Michael Niedermayer
michaelni
Sun Jul 13 14:54:40 CEST 2008
On Fri, Jul 11, 2008 at 12:28:13PM +0200, Andreas ?man wrote:
> Hi
>
> I've manage to delete all my old mails, so i'm unable to reply
> to the original thread [1].
>
> Here is an updated version which also extends av_find_stream_info()
> with a new flag to force the function to open all codecs and get
> the info. Obivously, this is API breaking. (version bump not
> included in patch)
>
> Two other options would be:
> a) Rename av_find_stream_info() => av_find_stream_info_ext() and
> keep the old function around which just invokes the _ext() one
> with a 0 flag argument, but IIRC Michael is a bit opposed to such
> solutions.
>
> b) Implement another new av_find_stream_info_detailed() which just
> does the getinfo() job. I haven't given this much thought, but I
> suspect it will sometimes do redundant work that
> av_find_stream_info() might just have performed (in case
> av_find_stream_info() also opened the codecs for other reasons).
>
>
> For the ffmpeg tool I've added a new option '-dci' (Detailed codec info)
> which invokes av_find_stream_info() with the new flag.
>
> I've also tried to suggest a simple syntax for the detailed output.
> (See doxy for avcodec.h:avcodec_getinfo() )
> This should aid machine parsing of the information.
> Ie, could be used to fix:
> https://roundup.mplayerhq.hu/roundup/ffmpeg/issue514
>
> [1]
> http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/2008-March/043098.html
> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c (revision 14166)
> +++ libavcodec/h264.c (working copy)
> @@ -8115,7 +8115,30 @@
> return 0;
> }
>
> +static int getinfo(AVCodecContext *avctx, char *buf, size_t buf_size, int flags)
> +{
> + H264Context *h = avctx->priv_data;
> + const char *profile;
> + if(!h->s.mb_width) /* If mb_width is set we know that we have valid PPS and SPS in the context */
> + return -1;
>
> + switch(h->sps.profile_idc) {
> + case 66: profile = "Baseline"; break;
> + case 77: profile = "Main"; break;
> + case 88: profile = "Extended"; break;
> + case 100: profile = "High"; break;
> + case 110: profile = "High 10"; break;
> + case 122: profile = "High 4:2:2"; break;
> + case 144: profile = "High 4:4:4"; break;
> + default: profile = "Unknown"; break;
> + }
> + snprintf(buf, buf_size, "profile = %s, level = %d.%d, %s",
> + profile, h->sps.level_idc / 10, h->sps.level_idc % 10,
> + h->pps.cabac ? "CABAC" : "CAVLC");
> + return 0;
> +}
There are AVCodecContext.profile, level and coder_type to export the
respective information.
There is no sense in inventing a new API that exports these fields as
a string that then has to be parsed.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080713/75da2600/attachment.pgp>
More information about the ffmpeg-devel
mailing list