totem-disc

totem-disc — disc utility functions

Stability Level

Stable, unless otherwise indicated

Synopsis


#include <totem-disc.h>


enum                TotemDiscMediaType;
TotemDiscMediaType  totem_cd_detect_type                (const char *device,
                                                         GError **error);
TotemDiscMediaType  totem_cd_detect_type_with_url       (const char *device,
                                                         char **url,
                                                         GError **error);
TotemDiscMediaType  totem_cd_detect_type_from_dir       (const char *dir,
                                                         char **url,
                                                         GError **error);
const char*         totem_cd_get_human_readable_name    (TotemDiscMediaType type);
char*               totem_cd_mrl_from_type              (const char *scheme,
                                                         const char *dir);
gboolean            totem_cd_has_medium                 (const char *device);

Description

This file has various different disc utility functions for getting the media types and labels of discs.

Details

enum TotemDiscMediaType

typedef enum {
  MEDIA_TYPE_ERROR = -1,
  MEDIA_TYPE_DATA = 1,
  MEDIA_TYPE_CDDA,
  MEDIA_TYPE_VCD,
  MEDIA_TYPE_DVD,
  MEDIA_TYPE_DVB,
  MEDIA_TYPE_NUM_TYPES
} TotemDiscMediaType;

Gives the media type of a disc, or MEDIA_TYPE_ERROR if the media type could not be determined.

MEDIA_TYPE_ERROR

there was an error determining the media's type

MEDIA_TYPE_DATA

data disc

MEDIA_TYPE_CDDA

audio CD

MEDIA_TYPE_VCD

video CD

MEDIA_TYPE_DVD

video DVD

MEDIA_TYPE_DVB

digital television

MEDIA_TYPE_NUM_TYPES

the number of supported media types

totem_cd_detect_type ()

TotemDiscMediaType  totem_cd_detect_type                (const char *device,
                                                         GError **error);

Detects the disc's type, given its device node path.

device :

a device node path

error :

return location for a GError, or NULL

Returns :

TotemDiscMediaType corresponding to the disc's type, or MEDIA_TYPE_ERROR on failure

totem_cd_detect_type_with_url ()

TotemDiscMediaType  totem_cd_detect_type_with_url       (const char *device,
                                                         char **url,
                                                         GError **error);

Detects the disc's type, given its device node path. If a string pointer is passed to url, it will return the disc's MRL as from totem_cd_mrl_from_type().

device :

a device node path

url :

return location for the disc's MRL, or NULL

error :

return location for a GError, or NULL

Returns :

TotemDiscMediaType corresponding to the disc's type, or MEDIA_TYPE_ERROR on failure

totem_cd_detect_type_from_dir ()

TotemDiscMediaType  totem_cd_detect_type_from_dir       (const char *dir,
                                                         char **url,
                                                         GError **error);

Detects the disc's type, given its mount directory URI. If a string pointer is passed to url, it will return the disc's MRL as from totem_cd_mrl_from_type().

dir :

a directory URI

url :

return location for the disc's MRL, or NULL

error :

return location for a GError, or NULL

Returns :

TotemDiscMediaType corresponding to the disc's type, or MEDIA_TYPE_ERROR on failure

totem_cd_get_human_readable_name ()

const char*         totem_cd_get_human_readable_name    (TotemDiscMediaType type);

Returns the human-readable name for the given TotemDiscMediaType.

type :

a TotemDiscMediaType

Returns :

the disc media type's readable name, which must not be freed, or NULL for unhandled media types

totem_cd_mrl_from_type ()

char*               totem_cd_mrl_from_type              (const char *scheme,
                                                         const char *dir);

Builds an MRL using the scheme scheme and the given URI dir, taking the filename from the URI if it's a file:// and just using the whole URI otherwise.

scheme :

a scheme (e.g. "dvd")

dir :

a directory URI

Returns :

a newly-allocated string containing the MRL

totem_cd_has_medium ()

gboolean            totem_cd_has_medium                 (const char *device);

Returns whether the disc has a physical medium.

device :

a device node path

Returns :

TRUE if the disc physically exists