## PopplerMedia

PopplerMedia — Media

## Functions

gboolean | (*PopplerMediaSaveFunc) ()
gboolean | poppler_media_get_auto_play ()
const gchar * | poppler_media_get_filename ()
const gchar * | poppler_media_get_mime_type ()
gfloat | poppler_media_get_repeat_count ()
gboolean | poppler_media_get_show_controls ()
gboolean | poppler_media_is_embedded ()
gboolean | poppler_media_save ()
gboolean | poppler_media_save_to_fd ()
gboolean | poppler_media_save_to_callback ()

## Types and Values

| PopplerMedia

## Object Hierarchy

        GObject
        ╰── PopplerMedia

## Includes

    #include <poppler.h>

## Description

## Functions

### PopplerMediaSaveFunc ()

    gboolean
    (*PopplerMediaSaveFunc) (const gchar *buf,
                             gsize count,
                             gpointer data,
                             GError **error);

Specifies the type of the function passed to `poppler_media_save_to_callback()`. It is called once for each block of bytes that is "written" by `poppler_media_save_to_callback()`. If successful it should return `TRUE`. If an error occurs it should set `error` and return `FALSE`, in which case `poppler_media_save_to_callback()` will fail with the same error.

#### Parameters

buf | buffer containing bytes to be written. | [array length=count][element-type guint8]
count | number of bytes in `buf` . |
data | user data passed to `poppler_media_save_to_callback()`. | [closure]
error | GError to set on error, or `NULL` |

#### Returns

`TRUE` if successful, `FALSE` (with `error` set) if failed.

Since: 0.14

### poppler_media_get_auto_play ()

    gboolean
    poppler_media_get_auto_play (PopplerMedia *poppler_media);

Returns the auto-play parameter.

#### Parameters

poppler_media | a PopplerMedia |

#### Returns

`TRUE` if media should auto-play, `FALSE` otherwise

Since: 20.04.0

### poppler_media_get_filename ()

    const gchar *
    poppler_media_get_filename (PopplerMedia *poppler_media);

Returns the media clip filename, in case of non-embedded media. filename might be a local relative or absolute path or a URI

#### Parameters

poppler_media | a PopplerMedia |

#### Returns

a filename, return value is owned by PopplerMedia and should not be freed

Since: 0.14

### poppler_media_get_mime_type ()

    const gchar *
    poppler_media_get_mime_type (PopplerMedia *poppler_media);

Returns the media clip mime-type

#### Parameters

poppler_media | a PopplerMedia |

#### Returns

the mime-type, return value is owned by PopplerMedia and should not be freed

Since: 0.14

### poppler_media_get_repeat_count ()

    gfloat
    poppler_media_get_repeat_count (PopplerMedia *poppler_media);

Returns the repeat count parameter.

#### Parameters

poppler_media | a PopplerMedia |

#### Returns

Repeat count parameter (float)

Since: 20.04.0

### poppler_media_get_show_controls ()

    gboolean
    poppler_media_get_show_controls (PopplerMedia *poppler_media);

Returns the show controls parameter.

#### Parameters

poppler_media | a PopplerMedia |

#### Returns

`TRUE` if media should show controls, `FALSE` otherwise

Since: 20.04.0

### poppler_media_is_embedded ()

    gboolean
    poppler_media_is_embedded (PopplerMedia *poppler_media);

Whether the media clip is embedded in the PDF. If the result is `TRUE`, the embedded stream can be saved with `poppler_media_save()` or `poppler_media_save_to_callback()` function. If the result is `FALSE`, the media clip filename can be retrieved with `poppler_media_get_filename()` function.

#### Parameters

poppler_media | a PopplerMedia |

#### Returns

`TRUE` if media clip is embedded, `FALSE` otherwise

Since: 0.14

### poppler_media_save ()

    gboolean
    poppler_media_save (PopplerMedia *poppler_media,
                        const char *filename,
                        GError **error);

Saves embedded stream of `poppler_media` to a file indicated by `filename` . If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain and whatever the save function generates.

#### Parameters

poppler_media | a PopplerMedia |
filename | name of file to save |
error | return location for error, or `NULL`. | [allow-none]

#### Returns

`TRUE`, if the file successfully saved

Since: 0.14

### poppler_media_save_to_fd ()

    gboolean
    poppler_media_save_to_fd (PopplerMedia *poppler_media,
                              int fd,
                              GError **error);

Saves embedded stream of `poppler_media` to a file referred to by `fd` . If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain and whatever the save function generates. Note that this function takes ownership of `fd` ; you must not operate on it again, nor close it.

#### Parameters

poppler_media | a PopplerMedia |
fd | a valid file descriptor open for writing |
error | return location for error, or `NULL`. | [allow-none]

#### Returns

`TRUE`, if the file successfully saved

Since: 21.12.0

### poppler_media_save_to_callback ()

    gboolean
    poppler_media_save_to_callback (PopplerMedia *poppler_media,
                                    PopplerMediaSaveFunc save_func,
                                    gpointer user_data,
                                    GError **error);

Saves embedded stream of `poppler_media` by feeding the produced data to `save_func` . Can be used when you want to store the media clip stream to something other than a file, such as an in-memory buffer or a socket. If `error` is set, `FALSE` will be returned. Possible errors include those in the G_FILE_ERROR domain and whatever the save function generates.

#### Parameters

poppler_media | a PopplerMedia |
save_func | a function that is called to save each block of data that the save routine generates. | [scope call]
user_data | user data to pass to the save function. |
error | return location for error, or `NULL`. | [allow-none]

#### Returns

`TRUE`, if the save successfully completed

Since: 0.14

## Types and Values

### PopplerMedia

    typedef struct _PopplerMedia PopplerMedia;