On Tue, Jun 30, 2020 at 01:54:06AM +0200, Andreas Rheinhardt wrote: > lance.lmw...@gmail.com: > > On Mon, Jun 29, 2020 at 06:18:23PM +0200, Andreas Rheinhardt wrote: > >> lance.lmw...@gmail.com: > >>> On Mon, Jun 29, 2020 at 05:35:58PM +0200, Andreas Rheinhardt wrote: > >>>> lance.lmw...@gmail.com: > >>>>> From: Limin Wang <lance.lmw...@gmail.com> > >>>>> > >>>>> Signed-off-by: Limin Wang <lance.lmw...@gmail.com> > >>>>> --- > >>>>> doc/APIchanges | 3 +++ > >>>>> libavcodec/avpacket.c | 1 + > >>>>> libavcodec/decode.c | 1 + > >>>>> libavcodec/packet.h | 6 ++++++ > >>>>> libavcodec/version.h | 2 +- > >>>>> libavformat/dump.c | 21 +++++++++++++++++++++ > >>>>> 6 files changed, 33 insertions(+), 1 deletion(-) > >>>>> > >>>>> diff --git a/doc/APIchanges b/doc/APIchanges > >>>>> index 1d6cc36..7cad7fa 100644 > >>>>> --- a/doc/APIchanges > >>>>> +++ b/doc/APIchanges > >>>>> @@ -15,6 +15,9 @@ libavutil: 2017-10-21 > >>>>> > >>>>> API changes, most recent first: > >>>>> > >>>>> +2020-06-xx - xxxxxxxxxx - lavc 58.94.100 - packet.h > >>>>> + Add AV_PKT_DATA_S12M_TIMECODE. > >>>>> + > >>>>> 2020-06-12 - b09fb030c1 - lavu 56.55.100 - pixdesc.h > >>>>> Add AV_PIX_FMT_X2RGB10. > >>>>> > >>>>> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c > >>>>> index dce26cb..24e2a74 100644 > >>>>> --- a/libavcodec/avpacket.c > >>>>> +++ b/libavcodec/avpacket.c > >>>>> @@ -400,6 +400,7 @@ const char *av_packet_side_data_name(enum > >>>>> AVPacketSideDataType type) > >>>>> case AV_PKT_DATA_PRFT: return "Producer > >>>>> Reference Time"; > >>>>> case AV_PKT_DATA_ICC_PROFILE: return "ICC Profile"; > >>>>> case AV_PKT_DATA_DOVI_CONF: return "DOVI > >>>>> configuration record"; > >>>>> + case AV_PKT_DATA_S12M_TIMECODE: return "SMPTE ST > >>>>> 12-1:2014 timecode"; > >>>>> } > >>>>> return NULL; > >>>>> } > >>>>> diff --git a/libavcodec/decode.c b/libavcodec/decode.c > >>>>> index de9c079..f2244fc 100644 > >>>>> --- a/libavcodec/decode.c > >>>>> +++ b/libavcodec/decode.c > >>>>> @@ -1699,6 +1699,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, > >>>>> AVFrame *frame) > >>>>> { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, > >>>>> AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, > >>>>> { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC > >>>>> }, > >>>>> { AV_PKT_DATA_ICC_PROFILE, > >>>>> AV_FRAME_DATA_ICC_PROFILE }, > >>>>> + { AV_PKT_DATA_S12M_TIMECODE, > >>>>> AV_FRAME_DATA_S12M_TIMECODE }, > >>>>> }; > >>>>> > >>>>> if (pkt) { > >>>>> diff --git a/libavcodec/packet.h b/libavcodec/packet.h > >>>>> index 96f237f..d84aaaa 100644 > >>>>> --- a/libavcodec/packet.h > >>>>> +++ b/libavcodec/packet.h > >>>>> @@ -283,6 +283,12 @@ enum AVPacketSideDataType { > >>>>> AV_PKT_DATA_DOVI_CONF, > >>>>> > >>>>> /** > >>>>> + * Timecode which conforms to SMPTE ST 12-1:2014. The data is an > >>>>> array of 4 uint32_t > >>>>> + * where the first uint32_t describes how many (1-3) of the other > >>>>> timecodes are used. > >>>>> + */ > >>>> > >>>> You should move the doc to timecode.h first in a separate patch and then > >>>> reference the documentation here. > >>> > >>> I'm not native English, so it's difficult for me to describe the format > >>> of timecode in comments clearly. > >>> As it's defined in SMPTE ST 12-1:2014, so I think it's enough as it says > >>> conforms to SMPTE ST 12-1:2014 > >>> at beginning. > >>> > >> > >> Could you please point me to the part of SMPTE ST 12-1:2014 that > >> describes the format that we use here? Because AFAIK SMPTE ST 12-1:2014 > >> just defines what fields a SMPTE ST 12-1 message has (and what > >> semantics), but leaves the rest (the actual framing) to other standards: > >> > >> "The actual transport of the codewords for digital systems varies > >> significantly from the transport methods defined for analog systems, and > >> is defined in the associated document, SMPTE ST 12-2." > >> > >> E.g. RTP uses a different framing (see RFC 5484); obviously every > >> framing method used for transport must prescribe endianness of not > >> depend upon endianness; yet our method does. (Isn't this actually a > >> problem for fate-tests because framecrc calculates checksums for side > >> date?) > > > > So the transport format is using SMPTE ST 12-2? I'm not sure about it. It's > > better to say which standard are using in comments, it's not private format. > > Now I'm just using the timecode.[ch], so it's difficult to give comments for > > its format. For HEVC timecode, it's use little endianness. > > > > No, av_timecode_get_smpte seems to use a custom format, not SMPTE ST > 12-2. That's why it is so important to actually document it.
av_timecode_get_smpte() is coming from h264_slice. In fact, I have plan to remove the duplicate code with av_timecode_get_smpte_from_framenum(). So the real format which is refer by the orignal author is av_timecode_get_smpte_from_framenum() To keep things going, I can add more format description for av_timecode_get_smpte_from_framenum() by the code. Please correct it if it's not OK. Now the format is used by local system only, that's why the byte order isn't considered I think. > > >> > >>>> > >>>>> + AV_PKT_DATA_S12M_TIMECODE, > >>>>> + > >>>>> + /** > >>>>> * The number of side data types. > >>>>> * This is not part of the public API/ABI in the sense that it may > >>>>> * change when new side data types are added. > >>>>> diff --git a/libavcodec/version.h b/libavcodec/version.h > >>>>> index 0359302..482cc6d 100644 > >>>>> --- a/libavcodec/version.h > >>>>> +++ b/libavcodec/version.h > >>>>> @@ -28,7 +28,7 @@ > >>>>> #include "libavutil/version.h" > >>>>> > >>>>> #define LIBAVCODEC_VERSION_MAJOR 58 > >>>>> -#define LIBAVCODEC_VERSION_MINOR 93 > >>>>> +#define LIBAVCODEC_VERSION_MINOR 94 > >>>>> #define LIBAVCODEC_VERSION_MICRO 100 > >>>>> > >>>>> #define LIBAVCODEC_VERSION_INT > >>>>> AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > >>>>> diff --git a/libavformat/dump.c b/libavformat/dump.c > >>>>> index 117c681..0f64c4f 100644 > >>>>> --- a/libavformat/dump.c > >>>>> +++ b/libavformat/dump.c > >>>>> @@ -34,6 +34,7 @@ > >>>>> #include "libavutil/replaygain.h" > >>>>> #include "libavutil/spherical.h" > >>>>> #include "libavutil/stereo3d.h" > >>>>> +#include "libavutil/timecode.h" > >>>>> > >>>>> #include "avformat.h" > >>>>> > >>>>> @@ -402,6 +403,22 @@ static void dump_dovi_conf(void *ctx, > >>>>> AVPacketSideData* sd) > >>>>> dovi->dv_bl_signal_compatibility_id); > >>>>> } > >>>>> > >>>>> +static void dump_s12m_timecode(void *ctx, AVPacketSideData* sd) > >>>> > >>>> * belongs to the variable, not the type. OK, got it > >>>> > >>>>> +{ > >>>>> + uint32_t *tc = (uint32_t*)sd->data; > >>>>> + > >>>>> + if ((sd->size != sizeof(uint32_t) * 4) || (tc[0] > 3)) { > >>>>> + av_log(ctx, AV_LOG_ERROR, "invalid data\n"); > >>>>> + return; > >>>>> + } > >>>>> + > >>>>> + for (int j = 1; j <= tc[0]; j++) { > >>>>> + char tcbuf[AV_TIMECODE_STR_SIZE]; > >>>>> + av_timecode_make_smpte_tc_string(tcbuf, tc[j], 0); > >>>>> + av_log(ctx, AV_LOG_INFO, "timecode - %s%s", tcbuf, j != tc[0] > >>>>> ? ", " : ""); > >>>>> + } > >>>>> +} > >>>>> + > >>>>> static void dump_sidedata(void *ctx, AVStream *st, const char *indent) > >>>>> { > >>>>> int i; > >>>>> @@ -468,6 +485,10 @@ static void dump_sidedata(void *ctx, AVStream *st, > >>>>> const char *indent) > >>>>> av_log(ctx, AV_LOG_INFO, "DOVI configuration record: "); > >>>>> dump_dovi_conf(ctx, &sd); > >>>>> break; > >>>>> + case AV_PKT_DATA_S12M_TIMECODE: > >>>>> + av_log(ctx, AV_LOG_INFO, "SMPTE ST 12-1:2014: "); > >>>>> + dump_s12m_timecode(ctx, &sd); > >>>>> + break; > >>>>> default: > >>>>> av_log(ctx, AV_LOG_INFO, > >>>>> "unknown side data type %d (%d bytes)", sd.type, > >>>>> sd.size); > >>>>> > >>>> > >> _______________________________________________ > >> ffmpeg-devel mailing list > >> ffmpeg-devel@ffmpeg.org > >> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >> > >> To unsubscribe, visit link above, or email > >> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". -- Thanks, Limin Wang _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".