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

Commit 8bab6a8

Browse files
authored
Revert "Fix reading input for FIFO (#436)" (#447)
Reverts #436 which breaks reading 10bits, interleaved and -nb input. For non-stdin input(-i), only seekable stream is supported by sample app for now. For other corner case(pipe, fifo, socket etc.) please disable y4m probing(in SetCfgInputFile) on your personal branch. Signed-off-by: Jun Tian [email protected]
1 parent 7501a40 commit 8bab6a8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Source/App/EbAppInputy4m.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,12 @@ EB_BOOL check_if_y4m(EbConfig_t *cfg) {
345345
return EB_TRUE; /* YUV4MPEG2 file */
346346
}
347347
else {
348-
EB_STRNCPY((char*)cfg->y4m_buf, sizeof(cfg->y4m_buf), (char*)buffer, YUV4MPEG2_IND_SIZE);
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+
}
349354
return EB_FALSE; /* Not a YUV4MPEG2 file */
350355
}
351356
}

Source/App/EbAppProcessCmd.c

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

0 commit comments

Comments
 (0)