seek

Using Boost Spirit to parse a text file while skipping large parts of it

僤鯓⒐⒋嵵緔 提交于 2019-12-07 12:59:45
问题 I have the following std::string : <lots of text not including "label A" or "label B"> label A: 34 <lots of text not including "label A" or "label B"> label B: 45 <lots of text not including "label A" or "label B"> ... I want extract single integral numbers following all occurrences of label A or label B and place them in corresponding vector<int> a, b . A simple, but not elegant way of doing it is using find("label A") and find("label B") and parsing whichever is first. Is there a succinct

AVPlayer seekToTime not working properly

邮差的信 提交于 2019-12-07 08:07:47
问题 Im having a problem with seeking with AVPlayer.seekToTime, I have the time index that I want to seek to inside a scrollViewDidScroll method like this: func scrollViewDidScroll(scrollView: UIScrollView) { let offsetTime = scrollView.contentOffset.y * 0.1 self.playerController.player?.seekToTime(CMTime(seconds: Double(offsetTime), preferredTimescale: 10), toleranceBefore: kCMTimePositiveInfinity, toleranceAfter: kCMTimeZero) } But the video does not flow nice. For example, when you scroll I

Does FileInputStream.skip() do a seek?

ε祈祈猫儿з 提交于 2019-12-06 18:36:21
问题 I want to copy the last 10MB of a possibly large file into another file. Ideally I would use FileInputStream, skip() and then read(). However I'm unsure if the performance of skip() will be bad. Is skip() typically implemented using a file seek underneath or does it actually read and discard data? I know about RandomAccessFile but I'm interested in whether I could use FileInputStream in place of that (RandomAccessFile is annoying as the API is non-standard). 回答1: Depends on your JVM, but here

Python regex search for hexadecimal bytes

被刻印的时光 ゝ 提交于 2019-12-06 12:54:30
I'm trying to search a binary file for a series of hexadecimal values, however, I've run into a few issues that I can't quite solve. (1) I'm not sure how to search the entire file and return all the matches. Currently I have f.seek going only as far as I think the value might be, which is no good. (2) I'd like to return the offset in either decimal or hex where there might be a match, although I get 0 each time, so I'm not sure what I did wrong. example.bin AA BB CC DD EE FF AB AC AD AE AF BA BB BC BD BE BF CA CB CC CD CE CF DA DB DC DD DE DF EA EB EC code: # coding: utf-8 import struct import

ffmpeg av_seek_frame with AVSEEK_FLAG_ANY causes grey screen

有些话、适合烂在心里 提交于 2019-12-06 07:36:35
问题 Problem: omxplayer's source code calls the ffmpeg av_seek_frame() method using the AVSEEK_FLAG_BACKWARD flag. Although not 100% sure, I believe this seeks to the closest i-frame. Instead, I want to seek to exact locations, so I modified the source code such that the av_seek_frame() method now uses the AVSEEK_FLAG_ANY flag. Now, when the movie loads, I get a grey screen, generally for 1 second, during which I can hear the audio. I have tried this on multiple computers (I am actually

Using MPMusicPlayerController, setting musicPlayer.currentPlaybackTime to seek but takes second to take effect

只谈情不闲聊 提交于 2019-12-06 06:13:33
问题 I have a UISlider acting as the scrubber. As the thumb is dragged I execute the following: - (void) _seekTo:(double)playbackTime { mPlayer.currentPlaybackTime = playbackTime; } That works fine, music seeks forward. Upon releasing the thumb, I restart the NSTimer to send time updates to keep the UISlider in synch. Problem is, upon releasing the thumb, the first few call backs contain the previous time value. This causes the thumb to jump back to its original position before returning to the

Android MediaCodec backward seeking

百般思念 提交于 2019-12-06 05:14:55
I'm trying to implement precise seeking for video using MediaCodec and MediaExtractor . By following Grafika's MoviePlayer , I've managed to implement the forward seeking. However I'm still having problem with backward seeking. The relevant bit of code is here: public void seekBackward(long position){ final int TIMEOUT_USEC = 10000; int inputChunk = 0; long firstInputTimeNsec = -1; boolean outputDone = false; boolean inputDone = false; mExtractor.seekTo(position, MediaExtractor.SEEK_TO_PREVIOUS_SYNC); Log.d("TEST_MEDIA", "sampleTime: " + mExtractor.getSampleTime()/1000 + " -- position: " +

How to implement custom std::streambuf's seekoff()?

烈酒焚心 提交于 2019-12-06 04:37:18
问题 I have the following implementation based on e.g. this question and answer struct membuf : std::streambuf { membuf(char* begin, char* end) { this->setg(begin, begin, end); } protected: virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, std::ios_base::openmode which = std::ios_base::in) { std::istream::pos_type ret; if(dir == std::ios_base::cur) { this->gbump(off); } // something is missing here... } }; I would like to use it in my methods in the following way: char buffer[] =

seekTo in VideoView

橙三吉。 提交于 2019-12-06 01:20:46
问题 I'm having problems with seeking video. My application should resume video from place where it was stopped last time. So I do this: videoView.seekTo(bookmark); videoView.start(); However when it plays I hear sounds form beginning of video for about 1-2 sec. And only after that video seeks to the right position. This behavior is reproducible on HTC Nexus One, HTC G1, HTC evo. But on Samsung galaxy tab all plays normally. Anybody had similar problems? Is this bug HTC-specific? Thanks in advance

How is Average Seek Time Calculated?

99封情书 提交于 2019-12-06 00:41:32
A hard disk system has the following parameters : Number of tracks = 500 Number of sectors/track = 100 Number of bytes /sector = 500 Time taken by the head to move from one track to adjacent track = 1 ms Rotation speed = 600 rpm. What is the average time taken for transferring 250 bytes from the disk ? Well I wanted to know How the average seek time is calculated ? My Approach Avg. time to transfer = Avg. seek time + Avg. rotational delay + Data transfer time Avg Seek Time given that : time to move between successive tracks is 1 ms time to move from track 1 to track 1 : 0ms time to move from