Liking cljdoc? Tell your friends :D
All platforms.

dk.simongray.podcast.format.media

What a media file says about itself, apart from the feed.

A media file gives its duration, its chapters and its artwork. It's an MP3 file, an MP4 or M4A file, an Ogg file of Opus or Vorbis, or an AAC file of ADTS frames.

A reading takes a view of the parts of the file at hand, as in dk.simongray.podcast.util.bytes.view, and gives what they say, or the ranges that it still needs. A fetch of those ranges most often takes one or two requests and a few hundred kilobytes.

A host that inserts ads serves another file to each request, so the duration is that of the file that came.

The readers are strict, and their namespaces name their quirks. The :except option leaves out the quirks that it names.

What a media file says about itself, apart from the feed.

A media file gives its duration, its chapters and its artwork. It's an
MP3 file, an MP4 or M4A file, an Ogg file of Opus or Vorbis, or an AAC
file of ADTS frames.

A reading takes a view of the parts of the file at hand, as in
dk.simongray.podcast.util.bytes.view, and gives what they say, or the
ranges that it still needs. A fetch of those ranges most often takes one
or two requests and a few hundred kilobytes.

A host that inserts ads serves another file to each request, so the
duration is that of the file that came.

The readers are strict, and their namespaces name their quirks. The
:except option leaves out the quirks that it names.
raw docstring

readclj/s

(read view)
(read view opts)

What the media file whose parts view holds says about itself, read with opts. It's a map of the keys below, and for an MP4 file the :width, :height and :movie-first? that format.media.mp4/read gives, each absent when the file doesn't have it.

  • :format is :mp3, :mp4, :ogg or :aac
  • :codecs is the RFC 6381 codecs string of an MP4, Ogg or AAC file
  • :tags is a map of the :title, :artist, :album, :date, :genre and :description that the file gives in its ID3 tags, iTunes metadata or Vorbis comments, e.g. for an upload or a local file
  • :duration is in seconds
  • :bitrate is in bit/s, that of the media over the duration
  • :sample-rate and :channels of the audio, and for an MP3 or AAC file :vbr?, whether the bitrate varies, as its headers say
  • :chapters is a chapters document of dk.simongray.podcast.format.chapters, and the images of the chapters of an MP3 or MP4 file are data URLs, which a host serves as files with update-image-urls of that namespace
  • :artwork is a map of :type and :data
  • :bytes is the size of the file, when the view knows it
  • :media-start is where the audio or video starts, after the ID3 tags of an MP3 or AAC file, the boxes before the media data of an MP4 file, or the pages of the headers of an Ogg file. With :bytes, it's the :header and the :size of analytics/threshold.

When the view lacks bytes, the result has the ranges that the reading needs under :need, as pairs of start and end, end excluded.

The reading doesn't throw on the content of the file, and the report tells what it didn't read. The opts are these:

  • :except, the ids of the quirks to leave out
  • :chapter-images?, false to leave out the chapter images of an MP4 file, which lie in its media data, so that the reading needs fewer bytes. Those of an MP3 file are in its tags, which it reads anyway.
What the media file whose parts `view` holds says about itself, read
with `opts`. It's a map of the keys below, and for an MP4 file the
:width, :height and :movie-first? that format.media.mp4/read gives, each
absent when the file doesn't have it.

- :format is :mp3, :mp4, :ogg or :aac
- :codecs is the RFC 6381 codecs string of an MP4, Ogg or AAC file
- :tags is a map of the :title, :artist, :album, :date, :genre and
  :description that the file gives in its ID3 tags, iTunes metadata or
  Vorbis comments, e.g. for an upload or a local file
- :duration is in seconds
- :bitrate is in bit/s, that of the media over the duration
- :sample-rate and :channels of the audio, and for an MP3 or AAC file
  :vbr?, whether the bitrate varies, as its headers say
- :chapters is a chapters document of dk.simongray.podcast.format.chapters,
  and the images of the chapters of an MP3 or MP4 file are data URLs,
  which a host serves as files with update-image-urls of that namespace
- :artwork is a map of :type and :data
- :bytes is the size of the file, when the view knows it
- :media-start is where the audio or video starts, after the ID3 tags of
  an MP3 or AAC file, the boxes before the media data of an MP4 file, or
  the pages of the headers of an Ogg file. With :bytes, it's the :header
  and the :size of analytics/threshold.

When the view lacks bytes, the result has the ranges that the reading
needs under :need, as pairs of start and end, end excluded.

The reading doesn't throw on the content of the file, and the report
tells what it didn't read. The `opts` are these:

- :except, the ids of the quirks to leave out
- :chapter-images?, false to leave out the chapter images of an MP4
  file, which lie in its media data, so that the reading needs fewer
  bytes. Those of an MP3 file are in its tags, which it reads anyway.
sourceraw docstring

read!clj/s

(read! url)
(read! url opts)

Read what the media file at url says about itself, fetched with opts. On the JVM it gives the result, and in ClojureScript a promise of it.

The opts are these:

  • :fetch, a function as http/fetcher makes, to fetch your own way, or for a local file one that ranges/file-fetcher or ranges/blob-fetcher makes, when url only names the file in an error
  • :headers, :timeout-seconds and :send, as http/fetcher takes them
  • :allow-pred and :user-agent, as http/send! takes them
  • :except and :chapter-images?, as read takes them
  • the limits of ranges/read!, with ranges/default-limits for those that they don't set

When the ranges don't come, or the file asks for more than the limits allow, the report has :file/incomplete. A server that ignores ranges sends a file from its start, so the bytes at an offset cost all the bytes before them.

Nothing that the network or the server does throws. When a request fails, the result has a :file/unreachable diagnostic under :error.

Read what the media file at `url` says about itself, fetched with
`opts`. On the JVM it gives the result, and in ClojureScript a promise
of it.

The `opts` are these:

- :fetch, a function as http/fetcher makes, to fetch your own way, or
  for a local file one that ranges/file-fetcher or ranges/blob-fetcher
  makes, when `url` only names the file in an error
- :headers, :timeout-seconds and :send, as http/fetcher takes them
- :allow-pred and :user-agent, as http/send! takes them
- :except and :chapter-images?, as read takes them
- the limits of ranges/read!, with ranges/default-limits for those that
  they don't set

When the ranges don't come, or the file asks for more than the limits
allow, the report has :file/incomplete. A server that ignores ranges
sends a file from its start, so the bytes at an offset cost all the
bytes before them.

Nothing that the network or the server does throws. When a request
fails, the result has a :file/unreachable diagnostic under :error.
sourceraw docstring

reportclj/s

(report file)

The diagnostics of the read file. Each diagnostic has its message.

The diagnostics of the read `file`. Each diagnostic has its message.
sourceraw docstring

typesclj/s

What each media type of an enclosure says of its files: the :extension of a file name, and the :format that read finds in them, for those it reads.

What each media type of an enclosure says of its files: the :extension
of a file name, and the :format that read finds in them, for those it
reads.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close