这篇教程C++ stream_Peek函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stream_Peek函数的典型用法代码示例。如果您正苦于以下问题:C++ stream_Peek函数的具体用法?C++ stream_Peek怎么用?C++ stream_Peek使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stream_Peek函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CheckHeaderstatic void CheckHeader( demux_meta_t *p_demux_meta ){ const uint8_t *p_peek; int i_size; demux_t *p_demux = (demux_t *)p_demux_meta->p_demux; if( stream_Seek( p_demux->s, 0 ) ) return; /* Test ID3v2 first */ if( stream_Peek( p_demux->s, &p_peek, ID3_TAG_QUERYSIZE ) != ID3_TAG_QUERYSIZE ) return; i_size = id3_tag_query( p_peek, ID3_TAG_QUERYSIZE ); if( i_size > 0 && stream_Peek( p_demux->s, &p_peek, i_size ) == i_size ) { msg_Dbg( p_demux, "found ID3v2 tag" ); ParseID3Tag( p_demux_meta, p_peek, i_size ); return; } /* Test APEv1 */ if( stream_Peek( p_demux->s, &p_peek, APE_TAG_HEADERSIZE ) != APE_TAG_HEADERSIZE ) return; i_size = GetAPEvXSize( p_peek, APE_TAG_HEADERSIZE ); if( i_size > 0 && stream_Peek( p_demux->s, &p_peek, i_size ) == i_size ) { msg_Dbg( p_demux, "found APEv1/2 tag" ); ParseAPEvXTag( p_demux_meta, p_peek, i_size ); }}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:33,
示例2: Import_M3U/***************************************************************************** * Import_M3U: main import function *****************************************************************************/int Import_M3U( vlc_object_t *p_this ){ demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; char *(*pf_dup) (const char *) = GuessEncoding; int offset = 0; CHECK_FILE(); if( stream_Peek( p_demux->s, &p_peek, 3 ) == 3 && !memcmp( p_peek, "/xef/xbb/xbf", 3) ) { pf_dup = CheckUnicode; /* UTF-8 Byte Order Mark */ offset = 3; } if( demux_IsPathExtension( p_demux, ".m3u8" ) || demux_IsForced( p_demux, "m3u8" ) || CheckContentType( p_demux->s, "application/vnd.apple.mpegurl" ) ) pf_dup = CheckUnicode; /* UTF-8 file type */ else if( demux_IsPathExtension( p_demux, ".m3u" ) || demux_IsPathExtension( p_demux, ".vlc" ) || demux_IsForced( p_demux, "m3u" ) || ContainsURL( p_demux ) || CheckContentType( p_demux->s, "audio/x-mpegurl") ) ; /* Guess encoding */ else { if( stream_Peek( p_demux->s, &p_peek, 8 + offset ) < (8 + offset) ) return VLC_EGENERIC; p_peek += offset; if( !strncasecmp( (const char *)p_peek, "RTSPtext", 8 ) ) /* QuickTime */ pf_dup = CheckUnicode; /* UTF-8 */ else if( !memcmp( p_peek, "#EXTM3U", 7 ) ) ; /* Guess encoding */ else return VLC_EGENERIC; } stream_Seek( p_demux->s, offset ); STANDARD_DEMUX_INIT_MSG( "found valid M3U playlist" ); p_demux->p_sys->psz_prefix = FindPrefix( p_demux ); p_demux->p_sys->pf_dup = pf_dup; return VLC_SUCCESS;}
开发者ID:Akilklk,项目名称:vlc,代码行数:53,
示例3: Import_IFO/***************************************************************************** * Import_IFO: main import function *****************************************************************************/int Import_IFO( vlc_object_t *p_this ){ demux_t *p_demux = (demux_t *)p_this; CHECK_FILE(); if( !p_demux->psz_file ) return VLC_EGENERIC; size_t len = strlen( p_demux->psz_file ); char *psz_file = p_demux->psz_file + len - strlen( "VIDEO_TS.IFO" ); /* Valid filenames are : * - VIDEO_TS.IFO * - VTS_XX_X.IFO where X are digits */ if( len > strlen( "VIDEO_TS.IFO" ) && ( !strcasecmp( psz_file, "VIDEO_TS.IFO" ) || (!strncasecmp( psz_file, "VTS_", 4 ) && !strcasecmp( psz_file + strlen( "VTS_00_0" ) , ".IFO" ) ) ) ) { int i_peek; const uint8_t *p_peek; i_peek = stream_Peek( p_demux->s, &p_peek, 8 ); if( i_peek != 8 || memcmp( p_peek, "DVDVIDEO", 8 ) ) return VLC_EGENERIC; p_demux->pf_demux = Demux; } /* Valid filename for DVD-VR is VR_MANGR.IFO */ else if( len >= 12 && !strcmp( &p_demux->psz_file[len-12], "VR_MANGR.IFO" ) ) { int i_peek; const uint8_t *p_peek; i_peek = stream_Peek( p_demux->s, &p_peek, 8 ); if( i_peek != 8 || memcmp( p_peek, "DVD_RTR_", 8 ) ) return VLC_EGENERIC; p_demux->pf_demux = DemuxDVD_VR; } else return VLC_EGENERIC;// STANDARD_DEMUX_INIT_MSG( "found valid VIDEO_TS.IFO" ) p_demux->pf_control = Control; return VLC_SUCCESS;}
开发者ID:CivilPol,项目名称:vlc,代码行数:52,
示例4: Import_DVB/***************************************************************************** * Import_DVB: main import function *****************************************************************************/int Import_DVB( vlc_object_t *p_this ){ demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; int i_peek; bool b_valid = false; if( !demux_IsPathExtension( p_demux, ".conf" ) && !p_demux->b_force ) return VLC_EGENERIC; /* Check if this really is a channels file */ if( (i_peek = stream_Peek( p_demux->s, &p_peek, 1024 )) > 0 ) { char psz_line[1024+1]; int i; for( i = 0; i < i_peek; i++ ) { if( p_peek[i] == '/n' ) break; psz_line[i] = p_peek[i]; } psz_line[i] = 0; if( ParseLine( psz_line, 0, 0, 0 ) ) b_valid = true; } if( !b_valid ) return VLC_EGENERIC; msg_Dbg( p_demux, "found valid DVB conf playlist file"); p_demux->pf_control = Control; p_demux->pf_demux = Demux; return VLC_SUCCESS;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:37,
示例5: PeekBlockstatic int PeekBlock(stream_t *s, rar_block_t *hdr){ const uint8_t *peek; int peek_size = stream_Peek(s, &peek, 11); if (peek_size < 7) return VLC_EGENERIC; hdr->crc = GetWLE(&peek[0]); hdr->type = peek[2]; hdr->flags = GetWLE(&peek[3]); hdr->size = GetWLE(&peek[5]); hdr->add_size = 0; if ((hdr->flags & 0x8000) || hdr->type == RAR_BLOCK_FILE || hdr->type == RAR_BLOCK_SUBBLOCK) { if (peek_size < 11) return VLC_EGENERIC; hdr->add_size = GetDWLE(&peek[7]); } if (hdr->size < 7) return VLC_EGENERIC; return VLC_SUCCESS;}
开发者ID:839687571,项目名称:vlc-2.2.1.32-2013,代码行数:25,
示例6: Import_IFO/***************************************************************************** * Import_IFO: main import function *****************************************************************************/int Import_IFO( vlc_object_t *p_this ){ demux_t *p_demux = (demux_t *)p_this; char *psz_file = p_demux->psz_path + strlen( p_demux->psz_path ) - strlen( "VIDEO_TS.IFO" ); /* Valid filenamed are : * - VIDEO_TS.IFO * - VTS_XX_X.IFO where X are digits */ if( strlen( p_demux->psz_path ) > strlen( "VIDEO_TS.IFO" ) && ( !strcasecmp( psz_file, "VIDEO_TS.IFO" ) || (!strncasecmp( psz_file, "VTS_", 4 ) && !strcasecmp( psz_file + strlen( "VTS_00_0" ) , ".IFO" ) ) ) ) { int i_peek; const uint8_t *p_peek; i_peek = stream_Peek( p_demux->s, &p_peek, 8 ); if( i_peek != 8 || memcmp( p_peek, "DVDVIDEO", 8 ) ) return VLC_EGENERIC; } else return VLC_EGENERIC;// STANDARD_DEMUX_INIT_MSG( "found valid VIDEO_TS.IFO" ) p_demux->pf_control = Control; p_demux->pf_demux = Demux; return VLC_SUCCESS;}
开发者ID:FLYKingdom,项目名称:vlc,代码行数:34,
示例7: ChunkFind/***************************************************************************** * Local functions *****************************************************************************/static int ChunkFind( demux_t *p_demux, const char *fcc, unsigned int *pi_size ){ const uint8_t *p_peek; for( ;; ) { uint32_t i_size; if( stream_Peek( p_demux->s, &p_peek, 8 ) < 8 ) { msg_Err( p_demux, "cannot peek" ); return VLC_EGENERIC; } i_size = GetDWLE( p_peek + 4 ); msg_Dbg( p_demux, "chunk: fcc=`%4.4s` size=%"PRIu32, p_peek, i_size ); if( !memcmp( p_peek, fcc, 4 ) ) { if( pi_size ) { *pi_size = i_size; } return VLC_SUCCESS; } /* Skip chunk */ if( stream_Read( p_demux->s, NULL, 8 ) != 8 || stream_Read( p_demux->s, NULL, i_size ) != (int)i_size || ( (i_size & 1) && stream_Read( p_demux->s, NULL, 1 ) != 1 ) ) return VLC_EGENERIC; }}
开发者ID:Tilka,项目名称:vlc,代码行数:37,
示例8: DemuxOpenstatic int DemuxOpen( vlc_object_t * p_this ){ demux_t *p_demux = (demux_t *)p_this; const uint8_t *p_peek; int i_size; /* Lets check the content to see if this is a NSC file */ i_size = stream_Peek( p_demux->s, &p_peek, MAX_LINE ); i_size -= sizeof("NSC Format Version=") - 1; if ( i_size > 0 ) { while ( i_size && strncasecmp( (char *)p_peek, "NSC Format Version=", (int) sizeof("NSC Format Version=") - 1 ) ) { p_peek++; i_size--; } if ( !strncasecmp( (char *)p_peek, "NSC Format Version=", (int) sizeof("NSC Format Version=") -1 ) ) { p_demux->pf_demux = Demux; p_demux->pf_control = Control; return VLC_SUCCESS; } } return VLC_EGENERIC;}
开发者ID:vlcchina,项目名称:vlc-player-experimental,代码行数:28,
示例9: Import_GVP/***************************************************************************** * Import_GVP: main import function *****************************************************************************/int Import_GVP( vlc_object_t *p_this ){ demux_t *p_demux = (demux_t *)p_this; int i_peek, i, b_found = false; const uint8_t *p_peek; i_peek = stream_Peek( p_demux->s, &p_peek, MAX_LINE ); for( i = 0; i < i_peek - (int)sizeof("gvp_version:"); i++ ) { if( p_peek[i] == 'g' && p_peek[i+1] == 'v' && p_peek[i+2] == 'p' && !memcmp( p_peek+i, "gvp_version:", sizeof("gvp_version:") - 1 ) ) { b_found = true; break; } } if( !b_found ) return VLC_EGENERIC; STANDARD_DEMUX_INIT_MSG( "using Google Video Playlist (gvp) import" ); p_demux->pf_control = Control; p_demux->pf_demux = Demux; p_demux->p_sys = malloc( sizeof( demux_sys_t ) ); if( !p_demux->p_sys ) return VLC_ENOMEM; return VLC_SUCCESS;}
开发者ID:CSRedRat,项目名称:vlc,代码行数:32,
示例10: ContainsURLstatic bool ContainsURL( demux_t *p_demux ){ const uint8_t *p_peek, *p_peek_end; int i_peek; i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ); if( i_peek <= 0 ) return false; p_peek_end = p_peek + i_peek; while( p_peek + sizeof( "https://" ) < p_peek_end ) { /* One line starting with a URL is enough */ if( !strncasecmp( (const char *)p_peek, "http://", 7 ) || !strncasecmp( (const char *)p_peek, "mms://", 6 ) || !strncasecmp( (const char *)p_peek, "rtsp://", 7 ) || !strncasecmp( (const char *)p_peek, "https://", 8 ) || !strncasecmp( (const char *)p_peek, "ftp://", 6 ) || !strncasecmp( (const char *)p_peek, "ftps://", 7 ) || !strncasecmp( (const char *)p_peek, "ftpes://", 8 ) ) { return true; } /* Comments and blank lines are ignored */ else if( *p_peek != '#' && *p_peek != '/n' && *p_peek != '/r') { return false; } while( p_peek < p_peek_end && *p_peek != '/n' ) p_peek++; if ( *p_peek == '/n' ) p_peek++; } return false;}
开发者ID:Akilklk,项目名称:vlc,代码行数:35,
示例11: Peek/***************************************************************************** * Peek: Helper function to peek data with incremental size. * /return false if peek no more data, true otherwise. *****************************************************************************/static bool Peek( demux_t *p_demux, bool b_first ){ int i_data; demux_sys_t *p_sys = p_demux->p_sys; if( b_first ) { p_sys->i_data_peeked = 0; } else if( p_sys->i_data_peeked == p_sys->i_frame_size_estimate ) { p_sys->i_frame_size_estimate += 5120; } i_data = stream_Peek( p_demux->s, &p_sys->p_peek, p_sys->i_frame_size_estimate ); if( i_data == p_sys->i_data_peeked ) { msg_Warn( p_demux, "no more data" ); return false; } p_sys->i_data_peeked = i_data; if( i_data <= 0 ) { msg_Warn( p_demux, "cannot peek data" ); return false; } return true;}
开发者ID:Flameeyes,项目名称:vlc,代码行数:32,
示例12: SkipEndstatic int SkipEnd(stream_t *s, const rar_block_t *hdr){ if (!(hdr->flags & RAR_BLOCK_END_HAS_NEXT)) return VLC_EGENERIC; if (SkipBlock(s, hdr)) return VLC_EGENERIC; /* Now, we need to look for a marker block, * It seems that there is garbage at EOF */ for (;;) { const uint8_t *peek; if (stream_Peek(s, &peek, rar_marker_size) < rar_marker_size) return VLC_EGENERIC; if (!memcmp(peek, rar_marker, rar_marker_size)) break; if (stream_Read(s, NULL, 1) != 1) return VLC_EGENERIC; } /* Skip marker and archive blocks */ if (IgnoreBlock(s, RAR_BLOCK_MARKER)) return VLC_EGENERIC; if (IgnoreBlock(s, RAR_BLOCK_ARCHIVE)) return VLC_EGENERIC; return VLC_SUCCESS;}
开发者ID:Flameeyes,项目名称:vlc,代码行数:31,
示例13: Import_DVB/** Detect dvb-utils zap channels.conf format */int Import_DVB(vlc_object_t *p_this){ demux_t *demux = (demux_t *)p_this; CHECK_FILE(); if (!demux_IsPathExtension(demux, ".conf" ) && !demux->b_force ) return VLC_EGENERIC; /* Check if this really is a channels file */ const uint8_t *peek; int len = stream_Peek(demux->s, &peek, 1023); if (len <= 0) return VLC_EGENERIC; const uint8_t *eol = memchr(peek, '/n', len); if (eol == NULL) return VLC_EGENERIC; len = eol - peek; char line[len + 1]; memcpy(line, peek, len); line[len] = '/0'; input_item_t *item = ParseLine(line); if (item == NULL) return VLC_EGENERIC; vlc_gc_decref(item); msg_Dbg(demux, "found valid channels.conf file"); demux->pf_control = Control; demux->pf_demux = Demux; return VLC_SUCCESS;}
开发者ID:0xheart0,项目名称:vlc,代码行数:35,
示例14: IsSVGstatic bool IsSVG(stream_t *s){ char *ext = strstr(s->psz_path, ".svg"); if (!ext) return false; const uint8_t *header; int size = stream_Peek(s, &header, 4096); int position = 0; const char xml[] = "<?xml version=/""; if (!FindSVGmarker(&position, header, size, xml)) return false; if (position != 0) return false; const char endxml[] = ">/0"; if (!FindSVGmarker(&position, header, size, endxml)) return false; if (position <= 15) return false; const char svg[] = "<svg"; if (!FindSVGmarker(&position, header, size, svg)) return false; if (position < 19) return false; /* SVG Scalable Vector Graphics image */ /* NOTE: some SVG images have the mimetype set in a meta data section * and some do not */ return true;}
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:33,
示例15: IsPnmstatic bool IsPnm(stream_t *s){ const uint8_t *header; int size = stream_Peek(s, &header, 256); if (size < 3) return false; if (header[0] != 'P' || header[1] < '1' || header[1] > '6' || !IsPnmBlank(header[2])) return false; int number_count = 0; for (int i = 3, parsing_number = 0; i < size && number_count < 2; i++) { if (IsPnmBlank(header[i])) { if (parsing_number) { parsing_number = 0; number_count++; } } else { if (header[i] < '0' || header[i] > '9') break; parsing_number = 1; } } if (number_count < 2) return false; return true;}
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:28,
示例16: vlclua_demux_peekstatic int vlclua_demux_peek( lua_State *L ){ demux_t *p_demux = (demux_t *)vlclua_get_this( L ); int n = luaL_checkint( L, 1 ); const uint8_t *p_peek; int i_peek = stream_Peek( p_demux->s, &p_peek, n ); lua_pushlstring( L, (const char *)p_peek, i_peek ); return 1;}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:9,
示例17: RarProbeint RarProbe(stream_t *s){ const uint8_t *peek; if (stream_Peek(s, &peek, rar_marker_size) < rar_marker_size) return VLC_EGENERIC; if (memcmp(peek, rar_marker, rar_marker_size)) return VLC_EGENERIC; return VLC_SUCCESS;}
开发者ID:Flameeyes,项目名称:vlc,代码行数:9,
示例18: StreamOpen/** ************************************************************************** * Open *****************************************************************************/int StreamOpen( vlc_object_t *p_this ){ stream_t *s = (stream_t*) p_this; stream_sys_t *p_sys; /* Verify file format */ const uint8_t *p_peek; if( stream_Peek( s->p_source, &p_peek, i_zip_marker ) < i_zip_marker ) return VLC_EGENERIC; if( memcmp( p_peek, p_zip_marker, i_zip_marker ) ) return VLC_EGENERIC; s->p_sys = p_sys = calloc( 1, sizeof( *p_sys ) ); if( !p_sys ) return VLC_ENOMEM; s->pf_read = Read; s->pf_peek = Peek; s->pf_control = Control; p_sys->fileFunctions = ( zlib_filefunc_def * ) calloc( 1, sizeof( zlib_filefunc_def ) ); if( !p_sys->fileFunctions ) { free( p_sys ); return VLC_ENOMEM; } p_sys->fileFunctions->zopen_file = ZipIO_Open; p_sys->fileFunctions->zread_file = ZipIO_Read; p_sys->fileFunctions->zwrite_file = ZipIO_Write; p_sys->fileFunctions->ztell_file = ZipIO_Tell; p_sys->fileFunctions->zseek_file = ZipIO_Seek; p_sys->fileFunctions->zclose_file = ZipIO_Close; p_sys->fileFunctions->zerror_file = ZipIO_Error; p_sys->fileFunctions->opaque = ( void * ) s; p_sys->zipFile = unzOpen2( NULL /* path */, p_sys->fileFunctions ); if( !p_sys->zipFile ) { msg_Warn( s, "unable to open file" ); free( p_sys->fileFunctions ); free( p_sys ); return VLC_EGENERIC; } /* Find the stream uri */ char *psz_tmp; if( asprintf( &psz_tmp, "%s.xspf", s->psz_path ) == -1 ) { free( p_sys->fileFunctions ); free( p_sys ); return VLC_ENOMEM; } p_sys->psz_path = s->psz_path; s->psz_path = psz_tmp; return VLC_SUCCESS;}
开发者ID:cobr123,项目名称:qtVlc,代码行数:60,
示例19: IsTargastatic bool IsTarga(stream_t *s){ /* The header is not enough to ensure proper detection, we need * to have a look at the footer. But doing so can be slow. So * try to avoid it when possible */ const uint8_t *header; if (stream_Peek(s, &header, 18) < 18) /* Targa fixed header */ return false; if (header[1] > 1) /* Color Map Type */ return false; if ((header[1] != 0 || header[3 + 4] != 0) && header[3 + 4] != 8 && header[3 + 4] != 15 && header[3 + 4] != 16 && header[3 + 4] != 24 && header[3 + 4] != 32) return false; if ((header[2] > 3 && header[2] < 9) || header[2] > 11) /* Image Type */ return false; if (GetWLE(&header[8 + 4]) <= 0 || /* Width */ GetWLE(&header[8 + 6]) <= 0) /* Height */ return false; if (header[8 + 8] != 8 && header[8 + 8] != 15 && header[8 + 8] != 16 && header[8 + 8] != 24 && header[8 + 8] != 32) return false; if (header[8 + 9] & 0xc0) /* Reserved bits */ return false; const int64_t size = stream_Size(s); if (size <= 18 + 26) return false; bool can_seek; if (stream_Control(s, STREAM_CAN_SEEK, &can_seek) || !can_seek) return false; const int64_t position = stream_Tell(s); if (stream_Seek(s, size - 26)) return false; const uint8_t *footer; bool is_targa = stream_Peek(s, &footer, 26) >= 26 && !memcmp(&footer[8], "TRUEVISION-XFILE./x00", 18); stream_Seek(s, position); return is_targa;}
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:44,
示例20: Import_WPLint Import_WPL( vlc_object_t* p_this ){ demux_t* p_demux = (demux_t*)p_this; CHECK_FILE(); if( !demux_IsPathExtension( p_demux, ".wpl" ) && !demux_IsPathExtension( p_demux, ".zpl" ) ) return VLC_EGENERIC; DEMUX_INIT_COMMON(); demux_sys_t* p_sys = p_demux->p_sys; uint8_t *p_peek; ssize_t i_peek = stream_Peek( p_demux->s, (const uint8_t **) &p_peek, 2048 ); if( unlikely( i_peek <= 0 ) ) { Close_WPL( p_this ); return VLC_EGENERIC; } stream_t *p_probestream = stream_MemoryNew( p_demux->s, p_peek, i_peek, true ); if( unlikely( !p_probestream ) ) { Close_WPL( p_this ); return VLC_EGENERIC; } p_sys->p_reader = xml_ReaderCreate( p_this, p_probestream ); if ( !p_sys->p_reader ) { msg_Err( p_demux, "Failed to create an XML reader" ); Close_WPL( p_this ); stream_Delete( p_probestream ); return VLC_EGENERIC; } const int i_flags = p_sys->p_reader->i_flags; p_sys->p_reader->i_flags |= OBJECT_FLAGS_QUIET; const char* psz_name; int type = xml_ReaderNextNode( p_sys->p_reader, &psz_name ); p_sys->p_reader->i_flags = i_flags; if ( type != XML_READER_STARTELEM || strcasecmp( psz_name, "smil" ) ) { msg_Err( p_demux, "Invalid WPL playlist. Root element should have been <smil>" ); Close_WPL( p_this ); stream_Delete( p_probestream ); return VLC_EGENERIC; } p_sys->p_reader = xml_ReaderReset( p_sys->p_reader, p_demux->s ); stream_Delete( p_probestream ); msg_Dbg( p_demux, "Found valid WPL playlist" ); return VLC_SUCCESS;}
开发者ID:J861449197,项目名称:vlc,代码行数:56,
示例21: IsLbmstatic bool IsLbm(stream_t *s){ const uint8_t *header; if (stream_Peek(s, &header, 12) < 12) return false; if (memcmp(&header[0], "FORM", 4) || GetDWBE(&header[4]) <= 4 || (memcmp(&header[8], "ILBM", 4) && memcmp(&header[8], "PBM ", 4))) return false; return true;}
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:11,
示例22: vlclua_demux_readstatic int vlclua_demux_read( lua_State *L ){ demux_t *p_demux = (demux_t *)vlclua_get_this( L ); const uint8_t *p_read; int n = luaL_checkint( L, 1 ); int i_read = stream_Peek( p_demux->s, &p_read, n ); lua_pushlstring( L, (const char *)p_read, i_read ); int i_seek = stream_Read( p_demux->s, NULL, i_read ); assert(i_read==i_seek); return 1;}
开发者ID:shanewfx,项目名称:vlc-arib,代码行数:11,
示例23: Open/***************************************************************************** * Open: initializes demux structures *****************************************************************************/static int Open( vlc_object_t * p_this ){ demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; bool b_forced = false; const uint8_t *p_peek; es_format_t fmt; if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) { msg_Err( p_demux, "cannot peek" ); return VLC_EGENERIC; } if( p_demux->b_force ) b_forced = true; if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 ) { if( !b_forced ) return VLC_EGENERIC; msg_Err( p_demux, "this doesn't look like an MPEG ES stream, continuing" ); } if( p_peek[3] > 0xb9 ) { if( !b_forced ) return VLC_EGENERIC; msg_Err( p_demux, "this seems to be a system stream (PS plug-in ?), but continuing" ); } p_demux->pf_demux = Demux; p_demux->pf_control= Control; p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); p_sys->b_start = true; p_sys->p_es = NULL; /* Load the mpegvideo packetizer */ es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV ); p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "mpeg video" ); if( !p_sys->p_packetizer ) { free( p_sys ); return VLC_EGENERIC; } /* create the output */ es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_MPGV ); p_sys->p_es = es_out_Add( p_demux->out, &fmt ); return VLC_SUCCESS;}
开发者ID:qdk0901,项目名称:vlc,代码行数:56,
示例24: IsSpiffstatic bool IsSpiff(stream_t *s){ const uint8_t *header; if (stream_Peek(s, &header, 36) < 36) /* SPIFF header size */ return false; if (header[0] != 0xff || header[1] != 0xd8 || header[2] != 0xff || header[3] != 0xe8) return false; if (memcmp(&header[6], "SPIFF/0", 6)) return false; return true;}
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:12,
示例25: Import_iTML/** * /brief iTML submodule initialization function */int Import_iTML( vlc_object_t *p_this ){ DEMUX_BY_EXTENSION_OR_FORCED_MSG( ".xml", "itml", "using iTunes Media Library reader" ); const uint8_t *p_peek; const uint64_t i_peek = stream_Peek( p_demux->s, &p_peek, 128 ); if ( i_peek < 32 || !strnstr( (const char *) p_peek, "<!DOCTYPE plist ", i_peek ) ) { Close_iTML( p_this ); return VLC_EGENERIC; } return VLC_SUCCESS;}
开发者ID:J861449197,项目名称:vlc,代码行数:17,
示例26: IsExifstatic bool IsExif(stream_t *s){ const uint8_t *header; int size = stream_Peek(s, &header, 256); int position = 0; if (FindJpegMarker(&position, header, size) != 0xd8) return false; if (FindJpegMarker(&position, header, size) != 0xe1) return false; position += 2; /* Skip size */ if (position + 5 > size) return false; if (memcmp(&header[position], "Exif/0", 5)) return false; return true;}
开发者ID:jomanmuk,项目名称:vlc-2.2,代码行数:17,
示例27: Open/***************************************************************************** * Open: initializes demux structures *****************************************************************************/static int Open( vlc_object_t * p_this ){ demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; const uint8_t *p_peek; es_format_t fmt; if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC; if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x01 || p_peek[3] != 0x0f ) /* Sequence header */ { if( !p_demux->b_force ) { msg_Warn( p_demux, "vc-1 module discarded (no startcode)" ); return VLC_EGENERIC; } msg_Err( p_demux, "this doesn't look like a VC-1 ES stream, " "continuing anyway" ); } p_sys = (demux_sys_t *)malloc( sizeof( demux_sys_t ) ); // sunqueen modify if( unlikely(p_sys == NULL) ) return VLC_ENOMEM; p_demux->pf_demux = Demux; p_demux->pf_control= Control; p_demux->p_sys = p_sys; p_sys->p_es = NULL; p_sys->i_dts = 0; p_sys->f_fps = var_CreateGetFloat( p_demux, "vc1-fps" ); if( p_sys->f_fps < 0.001 ) p_sys->f_fps = 0.0; /* Load the packetizer */ es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_VC1 ); p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "VC-1" ); if( !p_sys->p_packetizer ) { free( p_sys ); return VLC_EGENERIC; } return VLC_SUCCESS;}
开发者ID:12307,项目名称:VLC-for-VS2010,代码行数:48,
注:本文中的stream_Peek函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stream_Read函数代码示例 C++ stream_Delete函数代码示例 |