[FFmpeg-devel] [PATCH v5 12/13] avdevice/dshow: discover source color range/space/etc
Diederick C. Niehorster
dcnieho at gmail.com
Mon Dec 20 10:10:43 EET 2021
On Mon, Dec 20, 2021 at 2:27 AM Andreas Rheinhardt
<andreas.rheinhardt at outlook.com> wrote:
>
> Diederick Niehorster:
> > @@ -545,11 +759,40 @@ dshow_cycle_formats(AVFormatContext *avctx, enum dshowDeviceType devtype,
> > } else {
> > av_log(avctx, AV_LOG_INFO, " pixel_format=%s", av_get_pix_fmt_name(pix_fmt));
> > }
> > - av_log(avctx, AV_LOG_INFO, " min s=%ldx%ld fps=%g max s=%ldx%ld fps=%g\n",
> > + av_log(avctx, AV_LOG_INFO, " min s=%ldx%ld fps=%g max s=%ldx%ld fps=%g",
> > vcaps->MinOutputSize.cx, vcaps->MinOutputSize.cy,
> > 1e7 / vcaps->MaxFrameInterval,
> > vcaps->MaxOutputSize.cx, vcaps->MaxOutputSize.cy,
> > 1e7 / vcaps->MinFrameInterval);
> > + if (extended_format_info) {
> > + enum AVColorRange col_range = dshow_color_range(extended_format_info);
> > + enum AVColorSpace col_space = dshow_color_space(extended_format_info);
> > + enum AVColorPrimaries col_prim = dshow_color_primaries(extended_format_info);
> > + enum AVColorTransferCharacteristic col_trc = dshow_color_trc(extended_format_info);
> > + enum AVChromaLocation chroma_loc = dshow_chroma_loc(extended_format_info);
> > + if (col_range != AVCOL_RANGE_UNSPECIFIED || col_space != AVCOL_SPC_UNSPECIFIED || col_prim != AVCOL_PRI_UNSPECIFIED || col_trc != AVCOL_TRC_UNSPECIFIED) {
> > + const char *range = av_color_range_name(col_range);
> > + const char *space = av_color_space_name(col_space);
> > + const char *prim = av_color_primaries_name(col_prim);
> > + const char *trc = av_color_transfer_name(col_trc);
> > + av_log(avctx, AV_LOG_INFO, " (%s, %s/%s/%s",
> > + range ? range : "unknown",
> > + space ? space : "unknown",
> > + prim ? prim : "unknown",
> > + trc ? trc : "unknown");
> > + if (chroma_loc != AVCHROMA_LOC_UNSPECIFIED) {
> > + const char *chroma = av_chroma_location_name(chroma_loc);
> > + av_log(avctx, AV_LOG_INFO, ", %s", chroma ? chroma : "unknown");
> > + }
> > + av_log(avctx, AV_LOG_INFO, ")");
> > + }
> > + else if (chroma_loc != AVCHROMA_LOC_UNSPECIFIED) {
> > + const char *chroma = av_chroma_location_name(chroma_loc);
> > + av_log(avctx, AV_LOG_INFO, "(%s)", chroma ? chroma : "unknown");
> > + }
>
> This looks an awful lot like avcodec_string().
The logic is modeled after that indeed, but i only need a small part
of what avcodec_string does, and don't have avcodeccontext here, so
can't use avcodec_string. Is there a change you think i should make
here?
Thanks!
Dee
More information about the ffmpeg-devel
mailing list