mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Port AVERROR_EOF
This commit is contained in:
parent
b931e6a642
commit
af36b3cad1
5 changed files with 10 additions and 6 deletions
|
|
@ -4,6 +4,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
#define FFMPEG_AVSEEK_SIZE 0x10000
|
||||
|
||||
extern int FFMPEG_CONSTANT_AVERROR_EOF;
|
||||
|
||||
@interface FFMpegAVIOContext : NSObject
|
||||
|
||||
- (instancetype _Nullable)initWithBufferSize:(int32_t)bufferSize opaqueContext:(void * const)opaqueContext readPacket:(int (* _Nullable)(void * _Nullable opaque, uint8_t * _Nullable buf, int buf_size))readPacket writePacket:(int (* _Nullable)(void * _Nullable opaque, uint8_t * _Nullable buf, int buf_size))writePacket seek:(int64_t (*)(void * _Nullable opaque, int64_t offset, int whence))seek isSeekable:(bool)isSeekable;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#import "libavformat/avformat.h"
|
||||
|
||||
int FFMPEG_CONSTANT_AVERROR_EOF = AVERROR_EOF;
|
||||
|
||||
@interface FFMpegAVIOContext () {
|
||||
AVIOContext *_impl;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
|||
}
|
||||
if totalCount > maximumFetchSize {
|
||||
context.readingError = true
|
||||
return 0
|
||||
return FFMPEG_CONSTANT_AVERROR_EOF
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
|||
disposable.dispose()
|
||||
if !completedRequest {
|
||||
context.readingError = true
|
||||
return 0
|
||||
return FFMPEG_CONSTANT_AVERROR_EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
|||
disposable.dispose()
|
||||
if !completedRequest {
|
||||
context.readingError = true
|
||||
return 0
|
||||
return FFMPEG_CONSTANT_AVERROR_EOF
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -192,7 +192,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
|||
|
||||
if context.closed {
|
||||
context.readingError = true
|
||||
return 0
|
||||
return FFMPEG_CONSTANT_AVERROR_EOF
|
||||
}
|
||||
return fetchedCount
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
|||
if let fd = context.fd {
|
||||
return Int32(read(fd, buffer, Int(bufferSize)))
|
||||
}
|
||||
return 0
|
||||
return FFMPEG_CONSTANT_AVERROR_EOF
|
||||
}
|
||||
|
||||
private func seekCallback(userData: UnsafeMutableRawPointer?, offset: Int64, whence: Int32) -> Int64 {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ private func readPacketCallback(userData: UnsafeMutableRawPointer?, buffer: Unsa
|
|||
context.readingOffset += Int64(fetchedCount)
|
||||
return fetchedCount
|
||||
} else {
|
||||
return 0
|
||||
return FFMPEG_CONSTANT_AVERROR_EOF
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue