zarfld / AVB-Windows

A repository for enabling AVB functionality on Windows 10 using Intel i210
0 stars 0 forks source link

https://github.com/intel/AVBStreamHandler #173

Open zarfld opened 2 days ago

zarfld commented 2 days ago

The Intel AVB Stream Handler (AVBSH) is a project that serves as a bridge between AVB-capable Ethernet interfaces (such as Intel i210 NICs) and local audio/video applications. The AVB Stream Handler ensures proper AVB packet generation in line with the IEEE 1722 standard and manages a subset of IEEE 802.1Q protocols relevant for automotive and professional AV applications.

Key Features:

The project is no longer maintained by Intel, meaning there are no future updates, bug fixes, or new releases planned. However, it is open for forking and further development by the community.

You can find more details and explore the project on its GitHub page.

zarfld commented 2 days ago

check for code which can be resused from that repository

zarfld commented 1 day ago

which filewhich files could be referenced or used as dependencie? as this was provided by intel more correct code is assumeds could be referenced or used as dependencie? as this was provided by intel more correct code is assumed

zarfld commented 1 day ago

In the Intel AVBStreamHandler repository, several files are responsible for handling AVB packet generation. The primary components involved in generating and transmitting AVB packets are typically spread across files that manage stream configuration, packet construction, and network transmission.

Key files to look at for AVB packet generation include:

1. AvbStream.cpp

2. AvbPacket.cpp

3. AvbEthernet.cpp

4. AvbStreamHandler.cpp

5. AvtpAudio.cpp and AvtpVideo.cpp

6. Avtp.cpp

7. AvbTsnStream.cpp


Summary

The primary files responsible for AVB packet generation in the Intel AVBStreamHandler project are:

  1. AvbStream.cpp: Manages stream setup and controls packet generation.
  2. AvbPacket.cpp: Handles the actual construction of AVB packets.
  3. AvbEthernet.cpp: Manages Ethernet-level transmission of AVB packets.
  4. AvbStreamHandler.cpp: Coordinates stream operations and packet handling.
  5. AvtpAudio.cpp / AvtpVideo.cpp: Format audio and video AVTP packets.
  6. Avtp.cpp: Manages AVTP packet headers and encapsulation.
  7. AvbTsnStream.cpp: Manages TSN aspects of stream timing and scheduling (optional for AVB).

To dive deeper, examine the packet construction functions within AvbPacket.cpp and related header creation code in Avtp.cpp and AvtpAudio.cpp or AvtpVideo.cpp, depending on the stream type.

zarfld commented 1 day ago

Here are the mentioned files along with their relative paths within the Intel AVBStreamHandler repository:

  1. AvbStream.cpp

    • Path: private/src/avb_streamhandler/src/AvbStream.cpp
  2. AvbPacket.cpp

    • Path: private/src/avb_streamhandler/src/AvbPacket.cpp
  3. AvbEthernet.cpp

    • Path: private/src/avb_streamhandler/src/AvbEthernet.cpp
  4. AvbStreamHandler.cpp

    • Path: private/src/avb_streamhandler/src/AvbStreamHandler.cpp
  5. AvtpAudio.cpp

    • Path: private/src/avb_streamhandler/src/avtp/AvtpAudio.cpp
  6. AvtpVideo.cpp

    • Path: private/src/avb_streamhandler/src/avtp/AvtpVideo.cpp
  7. Avtp.cpp

    • Path: private/src/avb_streamhandler/src/avtp/Avtp.cpp
  8. AvbTsnStream.cpp

    • Path: private/src/avb_streamhandler/src/tsn/AvbTsnStream.cpp

These files contain the logic for handling AVB packet generation, media stream encapsulation, and Ethernet-level transmission within the AVB/TSN framework. You can explore these paths in the Intel AVBStreamHandler repository to dive deeper into each file's functionality.

zarfld commented 1 day ago

In the Intel AVBStreamHandler repository, audio and video stream handling is mainly managed through specific files that deal with the encapsulation and transmission of audio and video data. Here are the files responsible for handling audio and video streams:

Audio Stream Handling

  1. AvtpAudio.cpp

    • Path: private/src/avb_streamhandler/src/avtp/AvtpAudio.cpp
    • Function: This file handles the encapsulation of audio data into AVTP (Audio Video Transport Protocol) packets. It ensures that audio data is formatted with the appropriate headers for AVB-compliant transmission.
    • Key Responsibilities:
      • Formatting audio data into AVTP frames.
      • Managing audio-specific timestamps and sequence numbers.
      • Handling synchronization and clocking for audio streams.
  2. AvbStream.cpp

    • Path: private/src/avb_streamhandler/src/AvbStream.cpp
    • Function: Although this file handles general stream operations, it is also involved in managing audio streams, setting up buffers, and controlling the flow of audio data through the AVB/TSN network.
    • Key Responsibilities:
      • Stream initialization and control.
      • Handling audio data flow through buffers.

Video Stream Handling

  1. AvtpVideo.cpp

    • Path: private/src/avb_streamhandler/src/avtp/AvtpVideo.cpp
    • Function: This file handles the encapsulation of video data into AVTP packets. Similar to AvtpAudio.cpp, it deals with the correct formatting and transmission of video data over the network.
    • Key Responsibilities:
      • Formatting video data into AVTP frames.
      • Managing video-specific timestamps, sequence numbers, and payload formats.
      • Handling synchronization for video streams.
  2. AvbStream.cpp

    • Path: private/src/avb_streamhandler/src/AvbStream.cpp
    • Function: As with audio streams, this file also handles general stream operations for video streams. It manages the lifecycle of video streams and controls the flow of video data.
    • Key Responsibilities:
      • Stream initialization and control.
      • Managing video buffers and ensuring proper data transmission.

Common Stream Handling

  1. AvbStreamHandler.cpp

    • Path: private/src/avb_streamhandler/src/AvbStreamHandler.cpp
    • Function: This file coordinates the general handling of both audio and video streams. It manages the creation and control of streams, both audio and video, and interacts with lower-level packet handling components.
    • Key Responsibilities:
      • Centralized stream management for both audio and video.
      • Handling requests to start, stop, and control AVB streams.
  2. Avtp.cpp

    • Path: private/src/avb_streamhandler/src/avtp/Avtp.cpp
    • Function: This file handles the AVTP protocol, which is used for both audio and video streams. It creates AVTP headers and ensures that media data is properly encapsulated for network transmission.
    • Key Responsibilities:
      • Setting AVTP headers for both audio and video packets.
      • Handling common AVTP-related tasks for media streams.

Additional Components

Summary of Files Handling Audio and Video Streams

These files manage the flow, formatting, and transmission of both audio and video streams within the Intel AVBStreamHandler project. Each of these components is crucial for ensuring that AVB-compliant media streams are generated and transmitted across the network in a synchronized and reliable manner.

zarfld commented 1 day ago

To effectively reuse code from Intel’s AVBStreamHandler in your project, you’ll want to follow best practices to ensure compatibility, maintainability, and proper integration with your existing codebase. Here’s a structured approach to reusing code from the repository:

1. Identify Key Functionalities for Reuse

Start by identifying the specific functionalities from AVBStreamHandler that are most relevant to your project:

2. Select Relevant Components

Based on the functionality you identified, the following components are good candidates for reuse:

3. Isolate and Refactor the Code

After identifying the relevant code, refactor and isolate the specific modules for easier integration into your project. Here’s how you can do it:

4. Handle Dependencies and Licensing

5. Test the Integration

6. Extend or Customize as Needed

After successfully integrating the AVBStreamHandler code into your project, you may need to extend or customize certain features to meet your specific requirements:

7. Documentation and Maintenance


Best Practices Summary

  1. Identify relevant code: Focus on AVTP, packet handling, and stream management components.
  2. Isolate and refactor: Extract and modularize the needed functionality for your project.
  3. Handle dependencies: Make sure any external dependencies are properly integrated.
  4. Verify licensing: Ensure compliance with Intel’s licensing terms for code reuse.
  5. Test thoroughly: Perform unit and integration testing to ensure proper functionality.
  6. Extend and customize: Add custom logic or optimizations as needed for your specific use case.
  7. Document and maintain: Keep track of changes and periodically update with upstream improvements.

By following these steps, you can effectively reuse components from Intel’s AVBStreamHandler while ensuring that your project remains maintainable, functional, and legally compliant.