Am 18.03.2017 um 02:14 schrieb Marton Balint: > > On Fri, 17 Mar 2017, Matthias Hunstock wrote: > >> Signed-off-by: Matthias Hunstock <a...@fem.tu-ilmenau.de> >> --- >> libavdevice/decklink_common.cpp | 17 +++++++++++++---- >> libavdevice/decklink_common_c.h | 1 + >> libavdevice/decklink_dec.cpp | 5 +++-- >> libavdevice/decklink_dec_c.c | 1 + >> libavdevice/decklink_enc_c.c | 1 + >> 5 files changed, 19 insertions(+), 6 deletions(-) >> >> diff --git a/libavdevice/decklink_common.cpp >> b/libavdevice/decklink_common.cpp >> index 82b3a0c..a75ccc1 100644 >> --- a/libavdevice/decklink_common.cpp >> +++ b/libavdevice/decklink_common.cpp >> @@ -33,6 +33,7 @@ extern "C" { >> #include "libavformat/avformat.h" >> #include "libavformat/internal.h" >> #include "libavutil/imgutils.h" >> +#include "libavutil/intreadwrite.h" >> #include "libavutil/bswap.h" >> } >> >> @@ -158,8 +159,8 @@ int ff_decklink_set_format(AVFormatContext *avctx, >> int i = 1; >> HRESULT res; >> >> - av_log(avctx, AV_LOG_DEBUG, "Trying to find mode for frame size >> %dx%d, frame timing %d/%d, field order %d, direction %d, mode number >> %d\n", >> - width, height, tb_num, tb_den, field_order, direction, num); >> + av_log(avctx, AV_LOG_DEBUG, "Trying to find mode for frame size >> %dx%d, frame timing %d/%d, field order %d, direction %d, mode number >> %d, format code %s\n", >> + width, height, tb_num, tb_den, field_order, direction, num, >> (cctx->format_code) ? cctx->format_code : "(unset)"); >> >> if (ctx->duplex_mode) { >> DECKLINK_BOOL duplex_supported = false; >> @@ -196,12 +197,18 @@ int ff_decklink_set_format(AVFormatContext *avctx, >> return AVERROR(EIO); >> } >> >> + BMDDisplayMode target_mode = 0; >> + char format_buf[] = " "; >> + if (cctx->format_code) >> + av_strlcpy(format_buf, cctx->format_code, sizeof(format_buf)); > > Are you sure this does what you want it to do? The null terminator > should noy be copied to format_buf.
Oh, you are right, it doesn't work for 'pal'. I was eager to use some av* function. Will use memcpy. >> + target_mode = av_bswap32(AV_RL32(format_buf)); > > I think you can do this in one step with AV_RB32 (the big endian pair of > AV_RL32) Thanks for the hint. I tried to look up AV_RL32 but got lost in a loop of #define s. >> diff --git a/libavdevice/decklink_enc_c.c b/libavdevice/decklink_enc_c.c >> index 03734f8..76a040c 100644 >> --- a/libavdevice/decklink_enc_c.c >> +++ b/libavdevice/decklink_enc_c.c >> @@ -30,6 +30,7 @@ >> static const AVOption options[] = { >> { "list_devices", "list available devices" , >> OFFSET(list_devices), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, ENC }, >> { "list_formats", "list supported formats" , >> OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, ENC }, >> + { "format_code", "force format by fourcc" , >> OFFSET(format_code), AV_OPT_TYPE_STRING, { .str = NULL}, 3, 4, ENC }, >> { "preroll" , "video preroll in seconds", OFFSET(preroll >> ), AV_OPT_TYPE_DOUBLE, { .dbl = 0.5 }, 0, 5, ENC }, >> { NULL }, > > Please make outdev support a separate patch if you insist on it, I am > still not convinced that it is a good idea to support this for outdev > and allowing mismatching width/height/framerate at the same time. Ok, I'll just drop it. > On the other hand, you can merge the documentation into this patch. Ok Matthias _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel