mtp_playlist-spl.c

Langue: en

Version: 283277 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

libmtp - playlist-spl.c

SYNOPSIS


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <string.h>
#include 'libmtp.h'
#include 'libusb-glue.h'
#include 'ptp.h'
#include 'unicode.h'
#include 'playlist-spl.h'

Data Structures


struct text_struct

Defines


#define DEBUG_ENABLED 0

#define IF_DEBUG()

Typedefs


typedef struct text_struct text_t

Functions


int is_spl_playlist (PTPObjectInfo *oi)

void spl_to_playlist_t (LIBMTP_mtpdevice_t *device, PTPObjectInfo *oi, const uint32_t id, LIBMTP_playlist_t *const pl)

int playlist_t_to_spl (LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *const pl)

int update_spl_playlist (LIBMTP_mtpdevice_t *device, LIBMTP_playlist_t *const new)

Detailed Description

Playlist_t to Samsung (.spl) and back conversion functions.

Copyright (C) 2008 Alistair Boyle <alistair.js.boyle@gmail.com>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Define Documentation

#define IF_DEBUG()

Value:

 if(DEBUG_ENABLED) {                     printf('%s:%u:%s(): ', __FILE__, __LINE__, __func__);                    }                    if(DEBUG_ENABLED)
 

Function Documentation

int is_spl_playlist (PTPObjectInfo * oi)

Decides if the indicated object index is an .spl playlist.

Parameters:

oi object we are deciding on

Returns:

1 if this is a Samsung .spl object, 0 otherwise

Referenced by LIBMTP_Get_Playlist(), and LIBMTP_Get_Playlist_List().

int playlist_t_to_spl (LIBMTP_mtpdevice_t * device, LIBMTP_playlist_t *const pl)

Push a playlist_t onto the device after converting it to a .spl format

Parameters:

device mtp device pointer
pl the LIBMTP_playlist_t to convert (pl->playlist_id will be updated with the newly created object's id)

Returns:

0 on success, any other value means failure.

References LIBMTP_file_struct::filename, LIBMTP_file_struct::filesize, LIBMTP_file_struct::filetype, LIBMTP_file_struct::item_id, LIBMTP_Get_Filelisting_With_Callback(), LIBMTP_Get_Folder_List(), LIBMTP_Send_File_From_File_Descriptor(), LIBMTP_playlist_struct::name, LIBMTP_file_struct::next, LIBMTP_playlist_struct::no_tracks, LIBMTP_playlist_struct::parent_id, LIBMTP_file_struct::parent_id, LIBMTP_playlist_struct::playlist_id, LIBMTP_playlist_struct::storage_id, LIBMTP_file_struct::storage_id, LIBMTP_playlist_struct::tracks, and LIBMTP_mtpdevice_struct::usbinfo.

Referenced by LIBMTP_Create_New_Playlist().

void spl_to_playlist_t (LIBMTP_mtpdevice_t * device, PTPObjectInfo * oi, const uint32_t id, LIBMTP_playlist_t *const pl)

Take an object ID, a .spl playlist on the MTP device, and convert it to a playlist_t object.

Parameters:

device mtp device pointer
oi object we are reading
id .spl playlist id on MTP device
pl the LIBMTP_playlist_t pointer to be filled with info from id

References LIBMTP_Get_File_To_File_Descriptor(), LIBMTP_Get_Filelisting_With_Callback(), LIBMTP_Get_Folder_List(), LIBMTP_playlist_struct::name, LIBMTP_playlist_struct::no_tracks, LIBMTP_playlist_struct::parent_id, LIBMTP_playlist_struct::playlist_id, LIBMTP_playlist_struct::storage_id, and LIBMTP_playlist_struct::tracks.

Referenced by LIBMTP_Get_Playlist(), and LIBMTP_Get_Playlist_List().

int update_spl_playlist (LIBMTP_mtpdevice_t * device, LIBMTP_playlist_t *const new)

Update a playlist on the device. If only the playlist's name is being changed the pl->playlist_id will likely remain the same. An updated track list will result in the old playlist being replaced (ie: new playlist_id). NOTE: Other playlist metadata aside from playlist name and tracks are ignored.

Parameters:

device mtp device pointer
new the LIBMTP_playlist_t to convert (pl->playlist_id will be updated with the newly created object's id)

Returns:

0 on success, any other value means failure.

References LIBMTP_Create_New_Playlist(), LIBMTP_Delete_Object(), LIBMTP_Get_Playlist(), LIBMTP_Set_Playlist_Name(), LIBMTP_playlist_struct::name, LIBMTP_playlist_struct::no_tracks, LIBMTP_playlist_struct::playlist_id, and LIBMTP_playlist_struct::tracks.

Referenced by LIBMTP_Update_Playlist().

Author

Generated automatically by Doxygen for libmtp from the source code.