Skip to content
Snippets Groups Projects

Improvements to VLCMedia.tracksInformation

Merged Hank Anderson requested to merge Sumou/VLCKit:refactor-VLCMediaTracksInformation into master
All threads resolved!

Stop using the deprecated API and use the new API.

LIBVLC_DEPRECATED LIBVLC_API unsigned libvlc_media_tracks_get( libvlc_media_t *p_md, libvlc_media_track_t ***tracks );

LIBVLC_API libvlc_media_tracklist_t * libvlc_media_get_tracklist( libvlc_media_t *p_md, libvlc_track_type_t type );

Replace the return value of VLCMedia.tracksInformation from NSArray <NSDictionary *> * to NSArray <VLCMediaTracksInformation *> *.

let media: VLCMedia = ...

// before
// trackInformation is imported as [Any]
let tracksInfo = media.tracksInformation as! [[AnyHashable: Any]]
let videoTrack = tracksInfo.first(where: { $0[VLCMediaTracksInformationType] as? String == VLCMediaTracksInformationTypeVideo })
let width = videoTrack[VLCMediaTracksInformationVideoWidth] as? Int
let height = videoTrack[VLCMediaTracksInformationVideoHeight] as? Int

//after
// trackInformation is imported as [VLCMediaTracksInformation]
let tracksInfo = media.tracksInformation
guard let videoTrack = tracksInfo.compactMap(\.video).first else { return }
let width = videoTrack.width
let height = videoTrack.height

Related #416 (closed)

Close this merge request if you don't need it.

Edited by Felix Paul Kühne

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • This is a lot nicer than what we had before. Good job!

  • Hank Anderson added 1 commit

    added 1 commit

    • 7a1c58cf - Improvements to VLCMedia.tracksInformation

    Compare with previous version

  • Hank Anderson changed the description

    changed the description

  • Hank Anderson changed the description

    changed the description

  • Hank Anderson changed the description

    changed the description

  • Hank Anderson added 1 commit

    added 1 commit

    • 9b96953f - Improvements to VLCMedia.tracksInformation

    Compare with previous version

  • Hank Anderson added 1 commit

    added 1 commit

    • cbe0a160 - Improvements to VLCMedia.tracksInformation

    Compare with previous version

  • Felix Paul Kühne resolved all threads

    resolved all threads

  • Felix Paul Kühne marked this merge request as ready

    marked this merge request as ready

  • Felix Paul Kühne changed milestone to %4.0

    changed milestone to %4.0

  • Felix Paul Kühne approved this merge request

    approved this merge request

  • Much better

  • Please register or sign in to reply
    Loading