]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavformat/avio.h
Use O_DIRECT buffer flushing only when we operate really on O_DIRECT file
[frescor/ffmpeg.git] / libavformat / avio.h
index 189c5f0e3089df06d2d675044420d7fc6be63d5d..b8b35afe84e4b25ce7b5ba93073ac3a5707bec76 100644 (file)
@@ -23,6 +23,9 @@
 /**
  * @file libavformat/avio.h
  * unbuffered I/O operations
+ *
+ * @warning This file has to be considered an internal but installed
+ * header, so it should not be directly included in your projects.
  */
 
 #include <stdint.h>
@@ -61,6 +64,7 @@ typedef struct URLPollEntry {
 #define URL_RDONLY 0
 #define URL_WRONLY 1
 #define URL_RDWR   2
+#define URL_DIRECT 4
 
 typedef int URLInterruptCB(void);
 
@@ -74,6 +78,15 @@ int url_close(URLContext *h);
 int url_exist(const char *filename);
 int64_t url_filesize(URLContext *h);
 
+/**
+ * Return the file descriptor associated with this URL. For RTP, this
+ * will return only the RTP file descriptor, not the RTCP file descriptor.
+ * To get both, use rtp_get_file_handles().
+ *
+ * @return the file descriptor associated with this URL, or <0 on error.
+ */
+int url_get_file_handle(URLContext *h);
+
 /**
  * Return the maximum packet size associated to packetized file
  * handle. If the file is not packetized (stream like HTTP or file on
@@ -141,6 +154,7 @@ typedef struct URLProtocol {
     int (*url_read_pause)(URLContext *h, int pause);
     int64_t (*url_read_seek)(URLContext *h, int stream_index,
                              int64_t timestamp, int flags);
+    int (*url_get_file_handle)(URLContext *h);
 } URLProtocol;
 
 #if LIBAVFORMAT_VERSION_MAJOR < 53
@@ -184,6 +198,7 @@ typedef struct {
     int must_flush; /**< true if the next seek should flush */
     int eof_reached; /**< true if eof reached */
     int write_flag;  /**< true if open for writing */
+    int o_direct_flag; /**< true if the underlaying file is open with O_DIRECT */
     int is_streamed;
     int max_packet_size;
     unsigned long checksum;
@@ -386,6 +401,8 @@ void init_checksum(ByteIOContext *s,
 /* udp.c */
 int udp_set_remote_url(URLContext *h, const char *uri);
 int udp_get_local_port(URLContext *h);
+#if (LIBAVFORMAT_VERSION_MAJOR <= 52)
 int udp_get_file_handle(URLContext *h);
+#endif
 
 #endif /* AVFORMAT_AVIO_H */