fishkingsin / mp4parser

Automatically exported from code.google.com/p/mp4parser
0 stars 0 forks source link

H264Example is a bad example since FileInputStream does not support mark/reset. #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Run this unit test:
    https://github.com/lucastheisen/mp4tools/blob/master/src/test/java/com/lucastheisen/mp4tools/edit/IsoParserMuxerTest.java

    Note that this unit test relies on the resources in this project so you may have to download my project.

What is the expected output? What do you see instead?
I expect the parts to be joined into the mp4 file, instead, I get:

java.io.IOException: mark/reset not supported
    at java.io.InputStream.reset(InputStream.java:347)
    at com.googlecode.mp4parser.authoring.tracks.H264TrackImpl$ReaderWrapper.reset(H264TrackImpl.java:528)
    at com.googlecode.mp4parser.authoring.tracks.H264TrackImpl.readSamples(H264TrackImpl.java:228)
    at com.googlecode.mp4parser.authoring.tracks.H264TrackImpl.<init>(H264TrackImpl.java:70)
    at com.lucastheisen.mp4tools.edit.IsoParserMuxer.mux(IsoParserMuxer.java:72)
    at com.lucastheisen.mp4tools.edit.IsoParserMuxerTest.testMux(IsoParserMuxerTest.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

What version of the product are you using? On what operating system?

I am using:
        <dependency>
            <groupId>com.googlecode.mp4parser</groupId>
            <artifactId>isoparser</artifactId>
            <version>1.0-RC-11-SNAPSHOT</version>
        </dependency>

On: 
        Windows 7 Professional (64 bit)

Using:
        C:\Users\ltheisen>"%JAVA_HOME%/jre/bin/java" -version
        java version "1.7.0_05"
        Java(TM) SE Runtime Environment (build 1.7.0_05-b05)
        Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

Please provide any additional information below.

My project is available via github and has a unit test for this use case:

https://github.com/lucastheisen/mp4tools/

It seems like the H264TrackImpl should probably take a ReadableByteChannel, or 
perhaps a RandomAccessFile instead of InputStream...

Original issue reported on code.google.com by lucasthe...@gmail.com on 28 Jul 2012 at 9:34

GoogleCodeExporter commented 8 years ago
Trunk now uses FileChannel for H264TrackImpl

Original comment by Sebastian.Annies on 30 Jun 2013 at 7:06