Go to the documentation of this file.
21 #include <libsmbclient.h>
40 char *workgroup,
int workgroup_len,
41 char *username,
int username_len,
42 char *password,
int password_len)
52 libsmbc->
ctx = smbc_new_context();
58 if (!smbc_init_context(libsmbc->
ctx)) {
63 smbc_set_context(libsmbc->
ctx);
65 smbc_setOptionUserData(libsmbc->
ctx,
h);
69 smbc_setTimeout(libsmbc->
ctx, libsmbc->
timeout);
73 if (smbc_init(
NULL, 0) < 0) {
84 if (libsmbc->
fd >= 0) {
85 smbc_close(libsmbc->
fd);
89 smbc_free_context(libsmbc->
ctx, 1);
108 access = O_CREAT | O_RDWR;
112 access = O_CREAT | O_WRONLY;
119 if ((libsmbc->
fd = smbc_open(url, access, 0666)) < 0) {
125 if (smbc_fstat(libsmbc->
fd, &st) < 0)
149 if ((newpos = smbc_lseek(libsmbc->
fd,
pos, whence)) < 0) {
163 if ((bytes_read = smbc_read(libsmbc->
fd, buf,
size)) < 0) {
177 if ((bytes_written = smbc_write(libsmbc->
fd, buf,
size)) < 0) {
183 return bytes_written;
194 if ((libsmbc->
dh = smbc_opendir(
h->filename)) < 0) {
211 struct smbc_dirent *dirent =
NULL;
221 dirent = smbc_readdir(libsmbc->
dh);
226 switch (dirent->smbc_type) {
233 case SMBC_FILE_SHARE:
242 case SMBC_COMMS_SHARE:
244 case SMBC_PRINTER_SHARE:
252 }
while (skip_entry || !strcmp(dirent->name,
".") ||
253 !strcmp(dirent->name,
".."));
264 if (!smbc_stat(url, &st)) {
267 entry->
size = st.st_size;
268 entry->
filemode = st.st_mode & 0777;
282 if (libsmbc->
dh >= 0) {
283 smbc_closedir(libsmbc->
dh);
299 if ((libsmbc->
fd = smbc_open(
h->filename, O_WRONLY, 0666)) < 0) {
304 if (smbc_fstat(libsmbc->
fd, &st) < 0) {
309 smbc_close(libsmbc->
fd);
312 if (S_ISDIR(st.st_mode)) {
313 if (smbc_rmdir(
h->filename) < 0) {
318 if (smbc_unlink(
h->filename) < 0) {
351 #define OFFSET(x) offsetof(LIBSMBContext, x)
352 #define D AV_OPT_FLAG_DECODING_PARAM
353 #define E AV_OPT_FLAG_ENCODING_PARAM
355 {
"timeout",
"set timeout in ms of socket I/O operations",
OFFSET(timeout),
AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX,
D|
E },
#define AV_LOG_WARNING
Something somehow does not look correct.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int64_t libsmbc_seek(URLContext *h, int64_t pos, int whence)
char * filename
specified URL
#define URL_PROTOCOL_FLAG_NETWORK
#define AVERROR_EOF
End of file.
static const AVOption options[]
static av_cold void cleanup(FlashSV2Context *s)
int type
Type of the entry.
#define AVSEEK_SIZE
ORing this as the "whence" parameter to a seek function causes it to return the filesize without seek...
int64_t access_timestamp
Time of last access in microseconds since unix epoch, -1 if unknown.
char * av_append_path_component(const char *path, const char *component)
Append path component to the existing path.
static int libsmbc_delete(URLContext *h)
int64_t modification_timestamp
Time of last modification in microseconds since unix epoch, -1 if unknown.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_cold int libsmbc_close(URLContext *h)
#define AVIO_FLAG_WRITE
write-only
static av_cold int libsmbc_open(URLContext *h, const char *url, int flags)
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
const URLProtocol ff_libsmbclient_protocol
int64_t size
File size in bytes, -1 if unknown.
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t group_id
Group ID of owner, -1 if unknown.
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)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static av_always_inline av_const double trunc(double x)
int64_t filemode
Unix file mode, -1 if unknown.
Describes single entry of the directory.
static int libsmbc_open_dir(URLContext *h)
int64_t status_change_timestamp
Time of last status change in microseconds since unix epoch, -1 if unknown.
static int libsmbc_close_dir(URLContext *h)
static const AVClass libsmbclient_context_class
int64_t user_id
User ID of owner, -1 if unknown.
AVIODirEntry * ff_alloc_dir_entry(void)
Allocate directory entry with default values.
static int libsmbc_move(URLContext *h_src, URLContext *h_dst)
static int libsmbc_read_dir(URLContext *h, AVIODirEntry **next)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
#define AVIO_FLAG_READ
read-only
char * av_strdup(const char *s)
Duplicate a string.
static av_cold int libsmbc_connect(URLContext *h)
static int libsmbc_read(URLContext *h, unsigned char *buf, int size)
#define flags(name, subs,...)
static int libsmbc_write(URLContext *h, const unsigned char *buf, int size)