如何检查视频或音频文件格式是否可以在iphone中以编程方式播放?(How to check whether a video or audio file format is playable in iPhone programmatically?)
我有一些音频和视频文件存储在服务器中。 我需要玩他们,但我不知道存储在iPhone支持的服务器上播放的文件,
如何在开始播放前检查文件是否受iPhone支持,我正在使用MPMoviePlayerController播放文件。
I have some audio and video files stored in a server. I need to play them, but I do not know the files stored in server supported by iphone to play,
How can I check whether the file is supported by IPhone before start playing, I am using MPMoviePlayerController to play the files.
原文:https://stackoverflow.com/questions/4920197
最满意答案
创建字符串的副本并对其进行修改,然后将其设置回来(如果这是您需要的)。
std::string newid = some_reader->Key(); int start_index = newid.find("something"); newid.erase(start_index, 3); some_reader->SetKey(newid); // if required and possible
除非你知道你在做什么,为什么要这样做并考虑了所有其他选择,否则应该避免其他路线......在这种情况下,你首先不需要问这个问题。
Create a copy of the string and modify that, then set it back (if that's what you need).
std::string newid = some_reader->Key(); int start_index = newid.find("something"); newid.erase(start_index, 3); some_reader->SetKey(newid); // if required and possible
Other routes shall be avoided unless you know what you're doing, why you're doing it and have considered all other options ... in which case you would never need to ask this question in the first place.
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
修改C中的const char *(Modify const char * in C)[2022-03-29]
如果你想在main()反转str2 ,你需要将一个足够大的缓冲区传递给reverse_const来保存反向字符串,或者你需要在reverse_const动态分配存储空间(一个局部变量长度数组赢了' t)): #include... void reverse_const (const char **str_const) { int c_size = strlen (*str_const); char *str = calloc (c_size + 1, sizeof * ... -
创建字符串的副本并对其进行修改,然后将其设置回来(如果这是您需要的)。 std::string newid = some_reader->Key(); int start_index = newid.find("something"); newid.erase(start_index, 3); some_reader->SetKey(newid); // if required and possible 除非你知道你在做什么,为什么要这样做并考虑了所有其他选择,否则应该避免其他路线......在这种情况 ...
-
情况1:您正在使用静态投射来消除常量。 您违反了为该方法定义的合同。 情况2:你没有改变(这是const)的内容,而是分配包含const void指针的变量a。 对于实际的影响:对于情况1),如果a没有真正指向一个变量,那么你可以在脚下开枪。 建议:只有在你知道自己在做什么的情况下才能抛弃常量。 Case 1: You are using a static cast to cast away the constness. You are violating the contract that was def ...
-
一个有效的简单反例: void foo(const int *a) { // Pointer-to-const here int *p = const_cast
(a); *p = 2; } int main() { int a = 1; // But underlying object is not const foo(&a); } A simple counterexample which is ... -
当参数按值传递时,它是可以修改的,并且可以省略复制它。 例如,实现赋值运算符的规范方式如下所示: T& T::operator= (T value) { value.swap(*this); return *this; } 乍一看,它可能看起来效率低下,因为T正在被复制。 但是,无论如何它都会被复制,即如果需要复制,将会创建一种方法: T& T::operator= (T const& value) { T(value).swap(*this); // has to do a co ...
-
在doSomething中使用const引用来返回rvalue是否安全? 是的,这很好。 该语言有一个特定的子句,可以保证如果绑定对rvalue的引用,则会创建一个临时值 ,并将生命周期延长到创建引用的作用域的末尾。 doSomething2是否创建了返回的右值的副本,是否允许编译器在这里进行右值优化? 在这两种情况下,成本都是相同的,因为编译器会执行RVO(返回值优化) doSomething和doSomething2之间有什么区别,哪一个是可以忍受的? 主要区别在于,在一种情况下,您为真实对象指定名称, ...
-
在C中通过const引用(Pass by const reference in C)[2022-06-05]
C不支持引用或通过引用传递。 你应该使用指针代替并通过地址传递。 按值传递对于基本类型是有效的,但对结构进行浅层复制。 在C ++中,为了提高效率,通过引用传递对象会很有意义。 在定义复制构造函数时,它可以节省大量复制和调用构造函数/析构函数。 对于大型数据对象(例如std::list ),传递值是不切实际的,因为传递时会复制列表。 在这里你绝对应该通过引用传递。 C does not support references or passing by reference. You should use po ... -
引用C ++ 11,8.3.2 / 1: ...除非通过使用typedef(7.1.3)或模板类型参数(14.3)引入cv限定符,否则Cv限定引用的格式不正确,在这种情况下,cv限定符将被忽略。 ... Quoting C++11, 8.3.2/1: ... Cv-qualified references are ill-formed except when the cv-qualifiers are introduced through the use of a typedef (7.1.3) or of ...