Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 4b40262

Browse files
authored
Fix reading input for FIFO (#436)
If input object is FIFO, fseek doesn’t work on it. Remove the fseek logic and save the bytes in buffer for file, stdin, FIFO input objects. Signed-off-by: Jun Tian <[email protected]>
1 parent 19144a6 commit 4b40262

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

Source/App/EbAppInputy4m.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,7 @@ EB_BOOL check_if_y4m(EbConfig_t *cfg) {
345345
return EB_TRUE; /* YUV4MPEG2 file */
346346
}
347347
else {
348-
if (cfg->inputFile != stdin) {
349-
fseek(cfg->inputFile, 0, SEEK_SET);
350-
}
351-
else {
352-
EB_STRNCPY((char*)cfg->y4m_buf, sizeof(cfg->y4m_buf), (char*)buffer, YUV4MPEG2_IND_SIZE);
353-
}
348+
EB_STRNCPY((char*)cfg->y4m_buf, sizeof(cfg->y4m_buf), (char*)buffer, YUV4MPEG2_IND_SIZE);
354349
return EB_FALSE; /* Not a YUV4MPEG2 file */
355350
}
356351
}

Source/App/EbAppProcessCmd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,9 +821,9 @@ static void ReadInputFrames(
821821
read_y4m_frame_delimiter(config);
822822
const uint32_t lumaReadSize = inputPaddedWidth * inputPaddedHeight << is16bit;
823823
ebInputPtr = inputPtr->luma;
824-
if (config->y4m_input == EB_FALSE && config->processedFrameCount == 0 && config->inputFile == stdin) {
825-
/* if not a y4m file and input is read from stdin, 9 bytes were already read when checking
826-
or the YUV4MPEG2 string in the stream, so copy those bytes over */
824+
if (config->y4m_input == EB_FALSE && config->processedFrameCount == 0) {
825+
/* if not a y4m file, 9 bytes were already read when checking
826+
the YUV4MPEG2 string in the stream, so copy those bytes over */
827827
memcpy(ebInputPtr, config->y4m_buf, YUV4MPEG2_IND_SIZE);
828828
headerPtr->nFilledLen += YUV4MPEG2_IND_SIZE;
829829
ebInputPtr += YUV4MPEG2_IND_SIZE;

0 commit comments

Comments
 (0)