资源描述:
《gstfilesrc源文件》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、/*GStreamer*Copyright(C)1999,2000ErikWalthinsen*2000,2005WimTaymans**gstfilesrc.c:**Thislibraryisfreesoftware;youcanredistributeitand/or*modifyitunderthetermsoftheGNULibraryGeneralPublic*LicenseaspublishedbytheFreeSoftwareFoundation;either*version2oftheLicense,
2、or(atyouroption)anylaterversion.**Thislibraryisdistributedinthehopethatitwillbeuseful,*butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof*MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.SeetheGNU*LibraryGeneralPublicLicenseformoredetails.**YoushouldhavereceivedacopyoftheGNULibraryGeneralPublic*L
3、icensealongwiththislibrary;ifnot,writetothe*FreeSoftwareFoundation,Inc.,59TemplePlace-Suite330,*Boston,MA02111-1307,USA.*//***SECTION:element-filesrc*@see_also:#GstFileSrc**Readdatafromafileinthelocalfilesystem.*/#ifdefHAVE_CONFIG_H#include"config.h"#endif#include#include"gstfilesrc.h"
4、#include#include#ifdefG_OS_WIN32#include/*lseek,open,close,read*//*Onwin32,stat*defaultto32bit;weneedthe64-bit*variants,soexplicitlydefineitthatway.*/#definestat__stat64#definefstat_fstat64#undeflseek#definelseek_lseeki64#undefoff_t#defineoff_tguint64/*Preventstat.hfro
5、mdefiningthestat*functionsas*_stat*,sincewe'reexplicitlyoverridingthat*/#undef_INC_STAT_INL#endif#include#include#ifdefHAVE_UNISTD_H#include#endif#ifdefHAVE_MMAP#include#endif#include#include#include"../../gst/gst-i18n-lib.h"staticGstS
6、taticPadTemplatesrctemplate=GST_STATIC_PAD_TEMPLATE("src",GST_PAD_SRC,GST_PAD_ALWAYS,GST_STATIC_CAPS_ANY);/*FIXMEweshouldbeusingglibforthis*/#ifndefS_ISREG#defineS_ISREG(mode)((mode)&_S_IFREG)#endif#ifndefS_ISDIR#defineS_ISDIR(mode)((mode)&_S_IFDIR)#endif#ifndefS_ISSOCK#defineS_ISSOCK(x)(0)#endif
7、#ifndefO_BINARY#defineO_BINARY(0)#endif/*Copyofglib'sg_openduetowin32libc/cross-DLLbrokenness:wecan't*usethe'filedescriptor'openedinglib(andreturnedfromthisfunction)*inthislibrary,astheymayhaveunrelatedCruntimes.*/intg