Click here to Skip to main content
15,895,656 members

How to save data from video file into array

Tarun Batra asked:

Open original thread
Here is mine to parse the file video file

C++
int parsingmain1(char *Filepath){
	 FILE* infile;

    uint8_t* buf = (uint8_t*)malloc(BUFSIZE );

    h264_stream_t* h = h264_new();

    /*if (argc < 2) { usage(); return EXIT_FAILURE; }*/
	 infile = fopen(Filepath, "rb");



    if (infile == NULL) { fprintf( stderr, "!! Error: could not open file: %s \n", strerror(errno)); exit(EXIT_FAILURE); }
	h264_dbgfile = fopen ("C:\\myfile.txt","w");
   /* if (h264_dbgfile == NULL) { h264_dbgfile = stdout; }*/
    int opt_verbose = 1;
    int opt_probe = 0;
	 size_t rsz = 0;
    size_t sz = 0;
    int64_t off = 0;
    uint8_t* p = buf;

    int nal_start, nal_end;
	   while (1)
    {
        rsz = fread(buf + sz, 1, BUFSIZE - sz, infile);
        if (rsz == 0)
        {
            if (ferror(infile)) { fprintf( stderr, "!! Error: read failed: %s \n", strerror(errno)); break; }
            break;  // if (feof(infile)) 
        }

        sz += rsz;

        while (find_nal_unit(p, sz, &nal_start, &nal_end) > 0)
        {
            //here i want to save the data from the file of which i have given the path into an array(2d or 1d) of length specified by nal_start and nal_end
        }
    }
return 0;
}


Please provide the pseudo code
Tags: C++, C, Visual Studio, File

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900