uint32_t mmsx_get_length (mmsx_t *mmsx) { if(mmsx->connection) return mms_get_length(mmsx->connection); else return mmsh_get_length(mmsx->connection_h); }
static int mms_vfs_fseek_impl (VFSFile * file, int64_t offset, int whence) { MMSHandle * h = vfs_get_handle (file); if (whence == SEEK_CUR) { if (h->mms) offset += mms_get_current_pos (h->mms); else offset += mmsh_get_current_pos (h->mmsh); } else if (whence == SEEK_END) { if (h->mms) offset += mms_get_length (h->mms); else offset += mmsh_get_length (h->mmsh); } int64_t ret; if (h->mms) ret = mms_seek (NULL, h->mms, offset, SEEK_SET); else ret = mmsh_seek (NULL, h->mmsh, offset, SEEK_SET); if (ret < 0 || ret != offset) { fprintf (stderr, "mms: Seek failed.\n"); return -1; } return 0; }
static int64_t mms_vfs_fsize_impl (VFSFile * file) { MMSHandle * h = vfs_get_handle (file); if (h->mms) return mms_get_length (h->mms); else return mmsh_get_length (h->mmsh); }
static bool_t mms_vfs_feof_impl (VFSFile * file) { MMSHandle * h = vfs_get_handle (file); if (h->mms) return (mms_get_current_pos (h->mms) < mms_get_length (h->mms)); else return (mmsh_get_current_pos (h->mmsh) < mmsh_get_length (h->mmsh)); }
static gboolean gst_mms_src_query (GstPad * pad, GstQuery * query) { GstMMS *mmssrc = GST_MMS (gst_pad_get_parent (pad)); gboolean res = TRUE; GstFormat format; gint64 value; switch (GST_QUERY_TYPE (query)) { case GST_QUERY_POSITION: gst_query_parse_position (query, &format, &value); if (format != GST_FORMAT_BYTES) { res = FALSE; break; } if (mmssrc->connection) { value = (gint64) mms_get_current_pos (mmssrc->connection); } else { value = (gint64) mmsh_get_current_pos (mmssrc->connection_h); } gst_query_set_position (query, format, value); break; case GST_QUERY_DURATION: gst_query_parse_duration (query, &format, &value); if (format != GST_FORMAT_BYTES) { res = FALSE; break; } if (mmssrc->connection) { value = (gint64) mms_get_length (mmssrc->connection); } else { value = (gint64) mmsh_get_length (mmssrc->connection_h); } gst_query_set_duration (query, format, value); break; default: res = FALSE; break; } gst_object_unref (mmssrc); return res; }
static off_t mms_plugin_get_length (input_plugin_t *this_gen) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; off_t length = 0; if (!this->mms) return 0; switch (this->protocol) { case PROTOCOL_MMST: length = mms_get_length (this->mms); break; case PROTOCOL_MMSH: length = mmsh_get_length (this->mmsh); break; } lprintf ("length is %"PRId64"\n", length); return length; }