21#include <libsmbclient.h>
41 char *workgroup,
int workgroup_len,
42 char *username,
int username_len,
43 char *password,
int password_len)
53 libsmbc->
ctx = smbc_new_context();
59 if (!smbc_init_context(libsmbc->
ctx)) {
64 smbc_set_context(libsmbc->
ctx);
66 smbc_setOptionUserData(libsmbc->
ctx,
h);
70 smbc_setTimeout(libsmbc->
ctx, libsmbc->
timeout);
74 if (smbc_init(
NULL, 0) < 0) {
85 if (libsmbc->
fd >= 0) {
86 smbc_close(libsmbc->
fd);
90 smbc_free_context(libsmbc->
ctx, 1);
109 access = O_CREAT | O_RDWR;
113 access = O_CREAT | O_WRONLY;
120 if ((libsmbc->
fd = smbc_open(url, access, 0666)) < 0) {
126 if (smbc_fstat(libsmbc->
fd, &st) < 0)
150 if ((newpos = smbc_lseek(libsmbc->
fd,
pos, whence)) < 0) {
164 if ((bytes_read = smbc_read(libsmbc->
fd, buf,
size)) < 0) {
178 if ((bytes_written = smbc_write(libsmbc->
fd, buf,
size)) < 0) {
184 return bytes_written;
195 if ((libsmbc->
dh = smbc_opendir(
h->filename)) < 0) {
212 struct smbc_dirent *dirent =
NULL;
222 dirent = smbc_readdir(libsmbc->
dh);
227 switch (dirent->smbc_type) {
234 case SMBC_FILE_SHARE:
243 case SMBC_COMMS_SHARE:
245 case SMBC_PRINTER_SHARE:
253 }
while (skip_entry || !strcmp(dirent->name,
".") ||
254 !strcmp(dirent->name,
".."));
265 if (!smbc_stat(url, &st)) {
266 entry->group_id = st.st_gid;
267 entry->user_id = st.st_uid;
268 entry->size = st.st_size;
269 entry->filemode = st.st_mode & 0777;
270 entry->modification_timestamp = INT64_C(1000000) * st.st_mtime;
271 entry->access_timestamp = INT64_C(1000000) * st.st_atime;
272 entry->status_change_timestamp = INT64_C(1000000) * st.st_ctime;
283 if (libsmbc->
dh >= 0) {
284 smbc_closedir(libsmbc->
dh);
300 if ((libsmbc->
fd = smbc_open(
h->filename, O_WRONLY, 0666)) < 0) {
305 if (smbc_fstat(libsmbc->
fd, &st) < 0) {
310 smbc_close(libsmbc->
fd);
313 if (S_ISDIR(st.st_mode)) {
314 if (smbc_rmdir(
h->filename) < 0) {
319 if (smbc_unlink(
h->filename) < 0) {
352#define OFFSET(x) offsetof(LIBSMBContext, x)
353#define D AV_OPT_FLAG_DECODING_PARAM
354#define E AV_OPT_FLAG_ENCODING_PARAM
356 {
"timeout",
"set timeout in ms of socket I/O operations",
OFFSET(timeout),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
D|
E },
363 .class_name =
"libsmbc",
#define AVIO_FLAG_READ
read-only
#define AVSEEK_SIZE
Passing this as the "whence" parameter to a seek function causes it to return the filesize without se...
#define AVIO_FLAG_WRITE
write-only
#define flags(name, subs,...)
static __device__ float trunc(float a)
static av_cold void cleanup(FlashSV2Context *s)
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AVERROR_EOF
End of file.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
char * av_append_path_component(const char *path, const char *component)
Append path component to the existing path.
#define LIBAVUTIL_VERSION_INT
static int libsmbc_read(URLContext *h, unsigned char *buf, int size)
static int libsmbc_move(URLContext *h_src, URLContext *h_dst)
static av_cold int libsmbc_close(URLContext *h)
const URLProtocol ff_libsmbclient_protocol
static av_cold int libsmbc_connect(URLContext *h)
static av_cold int libsmbc_open(URLContext *h, const char *url, int flags)
static int libsmbc_delete(URLContext *h)
static int64_t libsmbc_seek(URLContext *h, int64_t pos, int whence)
static void libsmbc_get_auth_data(SMBCCTX *c, const char *server, const char *share, char *workgroup, int workgroup_len, char *username, int username_len, char *password, int password_len)
static int libsmbc_open_dir(URLContext *h)
static int libsmbc_write(URLContext *h, const unsigned char *buf, int size)
static const AVClass libsmbclient_context_class
static int libsmbc_close_dir(URLContext *h)
static int libsmbc_read_dir(URLContext *h, AVIODirEntry **next)
Memory handling functions.
Describe the class of an AVClass context structure.
Describes single entry of the directory.
char * filename
specified URL
AVIODirEntry * ff_alloc_dir_entry(void)
Allocate directory entry with default values.
unbuffered private I/O API
#define URL_PROTOCOL_FLAG_NETWORK