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

Commit

Permalink
Fix reading input for FIFO (#436)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tianjunwork authored Dec 3, 2019
1 parent 19144a6 commit 4b40262
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions Source/App/EbAppInputy4m.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,7 @@ EB_BOOL check_if_y4m(EbConfig_t *cfg) {
return EB_TRUE; /* YUV4MPEG2 file */
}
else {
if (cfg->inputFile != stdin) {
fseek(cfg->inputFile, 0, SEEK_SET);
}
else {
EB_STRNCPY((char*)cfg->y4m_buf, sizeof(cfg->y4m_buf), (char*)buffer, YUV4MPEG2_IND_SIZE);
}
EB_STRNCPY((char*)cfg->y4m_buf, sizeof(cfg->y4m_buf), (char*)buffer, YUV4MPEG2_IND_SIZE);
return EB_FALSE; /* Not a YUV4MPEG2 file */
}
}
6 changes: 3 additions & 3 deletions Source/App/EbAppProcessCmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,9 +821,9 @@ static void ReadInputFrames(
read_y4m_frame_delimiter(config);
const uint32_t lumaReadSize = inputPaddedWidth * inputPaddedHeight << is16bit;
ebInputPtr = inputPtr->luma;
if (config->y4m_input == EB_FALSE && config->processedFrameCount == 0 && config->inputFile == stdin) {
/* if not a y4m file and input is read from stdin, 9 bytes were already read when checking
or the YUV4MPEG2 string in the stream, so copy those bytes over */
if (config->y4m_input == EB_FALSE && config->processedFrameCount == 0) {
/* if not a y4m file, 9 bytes were already read when checking
the YUV4MPEG2 string in the stream, so copy those bytes over */
memcpy(ebInputPtr, config->y4m_buf, YUV4MPEG2_IND_SIZE);
headerPtr->nFilledLen += YUV4MPEG2_IND_SIZE;
ebInputPtr += YUV4MPEG2_IND_SIZE;
Expand Down

0 comments on commit 4b40262

Please sign in to comment.