Skip to content

Feat: ffmpeg_plugin expose and wire PTP AVOptions in libavdevice path - #1665

Open
dmkarthi wants to merge 2 commits into
OpenVisualCloud:mainfrom
dmkarthi:ffmpeg_libavdevice_set_ptp_parameters
Open

Feat: ffmpeg_plugin expose and wire PTP AVOptions in libavdevice path#1665
dmkarthi wants to merge 2 commits into
OpenVisualCloud:mainfrom
dmkarthi:ffmpeg_libavdevice_set_ptp_parameters

Conversation

@dmkarthi

@dmkarthi dmkarthi commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds libavdevice-level PTP option wiring in FFmpeg plugin initialization so users can control built-in MTL PTP behavior from AVOptions.

Changes

  • Updated ecosystem/ffmpeg_plugin/mtl_common.h

    • Added TX device AVOptions:
      • ptp_enable
      • ptp_pi
      • ptp_unicast
    • Extended StDevArgs with corresponding fields.
  • Updated ecosystem/ffmpeg_plugin/mtl_common.c

    • When ptp_enable is set:
      • enables MTL_FLAG_PTP_ENABLE
      • sets ST21_TX_PACING_WAY_PTP
      • conditionally enables MTL_FLAG_PTP_PI and MTL_FLAG_PTP_UNICAST_ADDR
      • wires ptp_sync_notify callback and logs sync metadata.
  • Files changed:

    • ecosystem/ffmpeg_plugin/mtl_common.h
    • ecosystem/ffmpeg_plugin/mtl_common.c

@dmkarthi
dmkarthi requested a review from awilczyns as a code owner July 20, 2026 09:58
@dmkarthi
dmkarthi marked this pull request as draft July 20, 2026 09:58
@dmkarthi dmkarthi changed the title ffmpeg_plugin: expose and wire PTP AVOptions in libavdevice path Feat: ffmpeg_plugin expose and wire PTP AVOptions in libavdevice path Jul 21, 2026
@dmkarthi
dmkarthi marked this pull request as ready for review July 28, 2026 03:59

@DawidWesierski4 DawidWesierski4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the ptp_sync_notify
Logging in itself is done via MTL ?

If there is a reson for it then it's diffrent story alltogether ?

Comment on lines +25 to +32
/* Logged every time the built-in PTP client receives a valid PTP_DELAY_RESP
* from the grandmaster (only fires when MTL_FLAG_PTP_ENABLE is set). priv is
* the AVFormatContext passed as mtl_init_params.priv below. */
static void mtl_ptp_sync_notify_cb(void* priv, struct mtl_ptp_sync_notify_meta* meta) {
AVFormatContext* ctx = (AVFormatContext*)priv;
info(ctx, "%s, PTP sync: master_utc_offset=%d delta=%" PRId64 "ns\n", __func__,
meta->master_utc_offset, meta->delta);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think there is a point of using this just to log a message?
The MTL has logging for PTP ? Is there a reson for it to be here ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We found that the same log is present in mt_ptp.c at line number 1505, will remove the callback function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this part is already taken care in PR #1677

@DawidWesierski4

DawidWesierski4 commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Hi i wanted to add some testing and other functionality so i cherry picked your changes into my branch
#1677

i preserved the auther and plan to rebase the chagne so the change will have your name on it but i changed them tad bit so it passes our doc/coding-standard.md

please review it, and don't hesitate to be brutal about feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants